From a668f1b4ad4d5303e7560d0ecd277c1eb6f5aebb Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 09:12:27 +0000 Subject: [PATCH] SDK regeneration --- package.json | 10 +- reference.md | 2652 +++-------------- src/Client.ts | 3 + src/api/resources/attempt/client/Client.ts | 25 +- src/api/resources/bookmark/client/Client.ts | 91 +- src/api/resources/connection/client/Client.ts | 133 +- .../ConnectionCreateRequestDestination.ts | 6 +- ...CreateRequestDestinationRateLimitPeriod.ts | 2 +- .../ConnectionUpsertRequestDestination.ts | 6 +- ...UpsertRequestDestinationRateLimitPeriod.ts | 2 +- .../resources/customDomain/client/Client.ts | 29 +- .../resources/destination/client/Client.ts | 101 +- .../requests/DestinationCreateRequest.ts | 6 +- .../requests/DestinationUpdateRequest.ts | 6 +- .../requests/DestinationUpsertRequest.ts | 6 +- ...DestinationCreateRequestRateLimitPeriod.ts | 2 +- ...DestinationUpdateRequestRateLimitPeriod.ts | 2 +- ...DestinationUpsertRequestRateLimitPeriod.ts | 2 +- src/api/resources/event/client/Client.ts | 55 +- .../resources/eventBulkRetry/client/Client.ts | 63 +- ...ventBulkRetryCreateRequestQueryAttempts.ts | 2 +- ...tBulkRetryCreateRequestQueryAttemptsAll.ts | 13 - ...entBulkRetryCreateRequestQueryCreatedAt.ts | 2 +- ...ulkRetryCreateRequestQueryLastAttemptAt.ts | 4 +- ...RetryCreateRequestQueryLastAttemptAtAny.ts | 11 - ...lkRetryCreateRequestQueryResponseStatus.ts | 5 +- ...etryCreateRequestQueryResponseStatusAll.ts | 13 - ...BulkRetryCreateRequestQuerySuccessfulAt.ts | 4 +- ...kRetryCreateRequestQuerySuccessfulAtAny.ts | 11 - .../resources/eventBulkRetry/types/index.ts | 5 - .../ignoredEventBulkRetry/client/Client.ts | 61 +- src/api/resources/issue/client/Client.ts | 59 +- .../resources/issueTrigger/client/Client.ts | 97 +- .../resources/notification/client/Client.ts | 13 +- src/api/resources/request/client/Client.ts | 79 +- .../requestBulkRetry/client/Client.ts | 63 +- ...tBulkRetryCreateRequestQueryEventsCount.ts | 5 +- ...lkRetryCreateRequestQueryEventsCountAll.ts | 13 - ...BulkRetryCreateRequestQueryIgnoredCount.ts | 5 +- ...kRetryCreateRequestQueryIgnoredCountAll.ts | 13 - ...stBulkRetryCreateRequestQueryIngestedAt.ts | 4 +- ...ulkRetryCreateRequestQueryIngestedAtAny.ts | 11 - .../resources/requestBulkRetry/types/index.ts | 3 - src/api/resources/source/client/Client.ts | 101 +- .../resources/transformation/client/Client.ts | 111 +- src/api/types/AttemptState.ts | 13 - src/api/types/AttemptStatus.ts | 4 +- src/api/types/Destination.ts | 2 +- ...DestinationAuthMethodAwsSignatureConfig.ts | 4 + ...AuthMethodOAuth2ClientCredentialsConfig.ts | 2 +- ...ientCredentialsConfigAuthenticationType.ts | 8 +- src/api/types/DestinationRateLimitPeriod.ts | 2 +- src/api/types/EventAttempt.ts | 6 +- src/api/types/FilteredMeta.ts | 9 +- src/api/types/FilteredMetaItem.ts | 12 + src/api/types/IgnoredEvent.ts | 2 +- src/api/types/IntegrationProvider.ts | 4 +- .../Operators.ts} | 2 +- src/api/types/RetriedEvent.ts | 35 +- src/api/types/ShopifyIntegrationConfigs.ts | 7 - ...hopifyIntegrationConfigsRateLimitPeriod.ts | 10 - src/api/types/Source.ts | 2 +- src/api/types/SourceVerificationOne.ts | 5 - src/api/types/TransformationExecution.ts | 1 + src/api/types/VerificationConfig.ts | 7 +- ...eVerification.ts => VerificationPaypal.ts} | 4 +- src/api/types/VerificationPaypalConfigs.ts | 10 + src/api/types/VerificationRechargeConfigs.ts | 5 - .../VerificationRechargeConfigsEncoding.ts | 11 - src/api/types/VerificationShopifyConfigs.ts | 7 - ...rificationShopifyConfigsRateLimitPeriod.ts | 10 - src/api/types/index.ts | 10 +- 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 | 252 ++ .../stream-wrappers/NodePre18StreamWrapper.ts | 106 + .../stream-wrappers/UndiciStreamWrapper.ts | 239 ++ .../stream-wrappers/chooseStreamWrapper.ts | 33 + src/core/runtime/runtime.ts | 2 + src/core/schemas/Schema.ts | 12 +- 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 +- src/core/schemas/utils/maybeSkipValidation.ts | 9 +- src/environments.ts | 2 +- .../ConnectionCreateRequestDestination.ts | 4 +- .../ConnectionUpsertRequestDestination.ts | 4 +- .../requests/DestinationCreateRequest.ts | 4 +- .../requests/DestinationUpdateRequest.ts | 4 +- .../requests/DestinationUpsertRequest.ts | 4 +- ...ventBulkRetryCreateRequestQueryAttempts.ts | 6 +- ...tBulkRetryCreateRequestQueryAttemptsAll.ts | 32 - ...entBulkRetryCreateRequestQueryCreatedAt.ts | 6 +- ...BulkRetryCreateRequestQueryCreatedAtAny.ts | 28 - ...ulkRetryCreateRequestQueryLastAttemptAt.ts | 9 +- ...RetryCreateRequestQueryLastAttemptAtAny.ts | 28 - ...lkRetryCreateRequestQueryResponseStatus.ts | 6 +- ...etryCreateRequestQueryResponseStatusAll.ts | 32 - ...BulkRetryCreateRequestQuerySuccessfulAt.ts | 9 +- ...kRetryCreateRequestQuerySuccessfulAtAny.ts | 28 - .../resources/eventBulkRetry/types/index.ts | 5 - ...tBulkRetryCreateRequestQueryEventsCount.ts | 6 +- ...lkRetryCreateRequestQueryEventsCountAll.ts | 32 - ...BulkRetryCreateRequestQueryIgnoredCount.ts | 6 +- ...kRetryCreateRequestQueryIgnoredCountAll.ts | 32 - ...stBulkRetryCreateRequestQueryIngestedAt.ts | 9 +- ...ulkRetryCreateRequestQueryIngestedAtAny.ts | 28 - .../resources/requestBulkRetry/types/index.ts | 3 - src/serialization/types/AttemptState.ts | 14 - src/serialization/types/AttemptStatus.ts | 4 +- ...DestinationAuthMethodAwsSignatureConfig.ts | 4 + ...ientCredentialsConfigAuthenticationType.ts | 4 +- src/serialization/types/EventAttempt.ts | 7 +- src/serialization/types/FilteredMeta.ts | 5 +- src/serialization/types/FilteredMetaItem.ts | 14 + src/serialization/types/IgnoredEvent.ts | 2 - src/serialization/types/IgnoredEventMeta.ts | 1 + .../types/IntegrationProvider.ts | 4 +- src/serialization/types/Operators.ts | 26 + src/serialization/types/RetriedEvent.ts | 45 +- .../types/ShopifyIntegrationConfigs.ts | 14 - ...hopifyIntegrationConfigsRateLimitPeriod.ts | 16 - src/serialization/types/Source.ts | 6 +- src/serialization/types/SourceVerification.ts | 18 - .../types/SourceVerificationOne.ts | 16 - src/serialization/types/VerificationConfig.ts | 9 +- src/serialization/types/VerificationPaypal.ts | 21 + .../types/VerificationPaypalConfigs.ts | 20 + .../types/VerificationRechargeConfigs.ts | 8 - .../VerificationRechargeConfigsEncoding.ts | 16 - .../types/VerificationShopifyConfigs.ts | 14 - ...rificationShopifyConfigsRateLimitPeriod.ts | 16 - src/serialization/types/index.ts | 10 +- 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 + 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 | 493 +-- 188 files changed, 4917 insertions(+), 3817 deletions(-) delete mode 100644 src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryAttemptsAll.ts delete mode 100644 src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryLastAttemptAtAny.ts delete mode 100644 src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryResponseStatusAll.ts delete mode 100644 src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQuerySuccessfulAtAny.ts delete mode 100644 src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryEventsCountAll.ts delete mode 100644 src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIgnoredCountAll.ts delete mode 100644 src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIngestedAtAny.ts delete mode 100644 src/api/types/AttemptState.ts create mode 100644 src/api/types/FilteredMetaItem.ts rename src/api/{resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryCreatedAtAny.ts => types/Operators.ts} (71%) delete mode 100644 src/api/types/ShopifyIntegrationConfigsRateLimitPeriod.ts delete mode 100644 src/api/types/SourceVerificationOne.ts rename src/api/types/{SourceVerification.ts => VerificationPaypal.ts} (54%) create mode 100644 src/api/types/VerificationPaypalConfigs.ts delete mode 100644 src/api/types/VerificationRechargeConfigsEncoding.ts delete mode 100644 src/api/types/VerificationShopifyConfigsRateLimitPeriod.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 delete mode 100644 src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryAttemptsAll.ts delete mode 100644 src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryCreatedAtAny.ts delete mode 100644 src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryLastAttemptAtAny.ts delete mode 100644 src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryResponseStatusAll.ts delete mode 100644 src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQuerySuccessfulAtAny.ts delete mode 100644 src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryEventsCountAll.ts delete mode 100644 src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIgnoredCountAll.ts delete mode 100644 src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIngestedAtAny.ts delete mode 100644 src/serialization/types/AttemptState.ts create mode 100644 src/serialization/types/FilteredMetaItem.ts create mode 100644 src/serialization/types/Operators.ts delete mode 100644 src/serialization/types/ShopifyIntegrationConfigsRateLimitPeriod.ts delete mode 100644 src/serialization/types/SourceVerification.ts delete mode 100644 src/serialization/types/SourceVerificationOne.ts create mode 100644 src/serialization/types/VerificationPaypal.ts create mode 100644 src/serialization/types/VerificationPaypalConfigs.ts delete mode 100644 src/serialization/types/VerificationRechargeConfigsEncoding.ts delete mode 100644 src/serialization/types/VerificationShopifyConfigsRateLimitPeriod.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/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/package.json b/package.json index 6e9f448..46fa981 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hookdeck/sdk", - "version": "0.4.0", + "version": "0.5.0", "private": false, "repository": "https://github.com/hookdeck/hookdeck-typescript-sdk", "main": "./index.js", @@ -13,7 +13,7 @@ }, "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", @@ -23,6 +23,7 @@ "@types/url-join": "4.0.1", "@types/qs": "6.9.8", "@types/node-fetch": "2.6.9", + "fetch-mock-jest": "^1.5.1", "jest": "29.7.0", "@types/jest": "29.5.5", "ts-jest": "29.1.1", @@ -30,5 +31,10 @@ "@types/node": "17.0.33", "prettier": "2.7.1", "typescript": "4.6.4" + }, + "browser": { + "fs": false, + "os": false, + "path": false } } diff --git a/reference.md b/reference.md index b4e134f..72af72a 100644 --- a/reference.md +++ b/reference.md @@ -1,951 +1,722 @@ -## IssueTrigger +# Reference -
hookdeck.issueTrigger.list({ ...params }) -> Hookdeck.IssueTriggerPaginatedResult +## IssueTrigger +
client.issueTrigger.list({ ...params }) -> Hookdeck.IssueTriggerPaginatedResult
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.issueTrigger.list(); +```typescript +await client.issueTrigger.list(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.IssueTriggerListRequest`** +**request:** `Hookdeck.IssueTriggerListRequest`
-
-
-**requestOptions: `IssueTrigger.RequestOptions`** +**requestOptions:** `IssueTrigger.RequestOptions`
-
-
-
-
-
hookdeck.issueTrigger.create({ ...params }) -> Hookdeck.IssueTrigger - +
client.issueTrigger.create({ ...params }) -> Hookdeck.IssueTrigger
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.issueTrigger.create({ +```typescript +await client.issueTrigger.create({ type: Hookdeck.IssueType.Delivery, }); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.IssueTriggerCreateRequest`** +**request:** `Hookdeck.IssueTriggerCreateRequest`
-
-
-**requestOptions: `IssueTrigger.RequestOptions`** +**requestOptions:** `IssueTrigger.RequestOptions`
-
-
-
-
-
hookdeck.issueTrigger.upsert({ ...params }) -> Hookdeck.IssueTrigger - +
client.issueTrigger.upsert({ ...params }) -> Hookdeck.IssueTrigger
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.issueTrigger.upsert({ +```typescript +await client.issueTrigger.upsert({ type: Hookdeck.IssueType.Delivery, name: "name", }); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.IssueTriggerUpsertRequest`** +**request:** `Hookdeck.IssueTriggerUpsertRequest`
-
-
-**requestOptions: `IssueTrigger.RequestOptions`** +**requestOptions:** `IssueTrigger.RequestOptions`
-
-
-
-
-
hookdeck.issueTrigger.retrieve(id) -> Hookdeck.IssueTrigger - +
client.issueTrigger.retrieve(id) -> Hookdeck.IssueTrigger
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.issueTrigger.retrieve("id"); +```typescript +await client.issueTrigger.retrieve("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `IssueTrigger.RequestOptions`** +**requestOptions:** `IssueTrigger.RequestOptions`
-
-
-
-
-
hookdeck.issueTrigger.update(id, { ...params }) -> Hookdeck.IssueTrigger - +
client.issueTrigger.update(id, { ...params }) -> Hookdeck.IssueTrigger
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.issueTrigger.update("id"); +```typescript +await client.issueTrigger.update("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**request: `Hookdeck.IssueTriggerUpdateRequest`** +**request:** `Hookdeck.IssueTriggerUpdateRequest`
-
-
-**requestOptions: `IssueTrigger.RequestOptions`** +**requestOptions:** `IssueTrigger.RequestOptions`
-
-
-
-
-
hookdeck.issueTrigger.delete(id) -> Hookdeck.DeletedIssueTriggerResponse - +
client.issueTrigger.delete(id) -> Hookdeck.DeletedIssueTriggerResponse
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.issueTrigger.delete("id"); +```typescript +await client.issueTrigger.delete("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `IssueTrigger.RequestOptions`** +**requestOptions:** `IssueTrigger.RequestOptions`
-
-
-
-
-
hookdeck.issueTrigger.disable(id) -> Hookdeck.IssueTrigger - +
client.issueTrigger.disable(id) -> Hookdeck.IssueTrigger
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.issueTrigger.disable("id"); +```typescript +await client.issueTrigger.disable("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `IssueTrigger.RequestOptions`** +**requestOptions:** `IssueTrigger.RequestOptions`
-
-
-
-
-
hookdeck.issueTrigger.enable(id) -> Hookdeck.IssueTrigger - +
client.issueTrigger.enable(id) -> Hookdeck.IssueTrigger
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.issueTrigger.enable("id"); +```typescript +await client.issueTrigger.enable("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `IssueTrigger.RequestOptions`** +**requestOptions:** `IssueTrigger.RequestOptions`
-
-
-
-
## Attempt -
hookdeck.attempt.list({ ...params }) -> Hookdeck.EventAttemptPaginatedResult - +
client.attempt.list({ ...params }) -> Hookdeck.EventAttemptPaginatedResult
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.attempt.list(); +```typescript +await client.attempt.list(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.AttemptListRequest`** +**request:** `Hookdeck.AttemptListRequest`
-
-
-**requestOptions: `Attempt.RequestOptions`** +**requestOptions:** `Attempt.RequestOptions`
-
-
-
-
-
hookdeck.attempt.retrieve(id) -> Hookdeck.EventAttempt | undefined - +
client.attempt.retrieve(id) -> Hookdeck.EventAttempt | undefined
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.attempt.retrieve("id"); +```typescript +await client.attempt.retrieve("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Attempt.RequestOptions`** +**requestOptions:** `Attempt.RequestOptions`
-
-
-
-
## Bookmark -
hookdeck.bookmark.list({ ...params }) -> Hookdeck.BookmarkPaginatedResult - +
client.bookmark.list({ ...params }) -> Hookdeck.BookmarkPaginatedResult
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.bookmark.list(); +```typescript +await client.bookmark.list(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.BookmarkListRequest`** +**request:** `Hookdeck.BookmarkListRequest`
-
-
-**requestOptions: `Bookmark.RequestOptions`** +**requestOptions:** `Bookmark.RequestOptions`
-
-
-
-
-
hookdeck.bookmark.create({ ...params }) -> Hookdeck.Bookmark - +
client.bookmark.create({ ...params }) -> Hookdeck.Bookmark
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.bookmark.create({ +```typescript +await client.bookmark.create({ eventDataId: "event_data_id", webhookId: "webhook_id", label: "label", @@ -953,2376 +724,1794 @@ await hookdeck.bookmark.create({ ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.BookmarkCreateRequest`** +**request:** `Hookdeck.BookmarkCreateRequest`
-
-
-**requestOptions: `Bookmark.RequestOptions`** +**requestOptions:** `Bookmark.RequestOptions`
-
-
-
-
-
hookdeck.bookmark.retrieve(id) -> Hookdeck.Bookmark - +
client.bookmark.retrieve(id) -> Hookdeck.Bookmark
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.bookmark.retrieve("id"); +```typescript +await client.bookmark.retrieve("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Bookmark.RequestOptions`** +**requestOptions:** `Bookmark.RequestOptions`
-
-
-
-
-
hookdeck.bookmark.update(id, { ...params }) -> Hookdeck.Bookmark - +
client.bookmark.update(id, { ...params }) -> Hookdeck.Bookmark
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.bookmark.update("id"); +```typescript +await client.bookmark.update("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**request: `Hookdeck.BookmarkUpdateRequest`** +**request:** `Hookdeck.BookmarkUpdateRequest`
-
-
-**requestOptions: `Bookmark.RequestOptions`** +**requestOptions:** `Bookmark.RequestOptions`
-
-
-
-
-
hookdeck.bookmark.delete(id) -> Hookdeck.DeletedBookmarkResponse - +
client.bookmark.delete(id) -> Hookdeck.DeletedBookmarkResponse
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.bookmark.delete("id"); +```typescript +await client.bookmark.delete("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Bookmark.RequestOptions`** +**requestOptions:** `Bookmark.RequestOptions`
-
-
-
-
-
hookdeck.bookmark.retrieveBody(id) -> Hookdeck.RawBody - +
client.bookmark.retrieveBody(id) -> Hookdeck.RawBody
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.bookmark.retrieveBody("id"); +```typescript +await client.bookmark.retrieveBody("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Bookmark.RequestOptions`** +**requestOptions:** `Bookmark.RequestOptions`
-
-
-
-
-
hookdeck.bookmark.trigger(id, { ...params }) -> Hookdeck.EventArray - +
client.bookmark.trigger(id, { ...params }) -> Hookdeck.EventArray
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.bookmark.trigger("id"); +```typescript +await client.bookmark.trigger("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**request: `Hookdeck.BookmarkTriggerRequest`** +**request:** `Hookdeck.BookmarkTriggerRequest`
-
-
-**requestOptions: `Bookmark.RequestOptions`** +**requestOptions:** `Bookmark.RequestOptions`
-
-
-
-
## Destination -
hookdeck.destination.list({ ...params }) -> Hookdeck.DestinationPaginatedResult - +
client.destination.list({ ...params }) -> Hookdeck.DestinationPaginatedResult
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.destination.list(); +```typescript +await client.destination.list(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.DestinationListRequest`** +**request:** `Hookdeck.DestinationListRequest`
-
-
-**requestOptions: `Destination.RequestOptions`** +**requestOptions:** `Destination.RequestOptions`
-
-
-
-
-
hookdeck.destination.create({ ...params }) -> Hookdeck.Destination - +
client.destination.create({ ...params }) -> Hookdeck.Destination
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.destination.create({ +```typescript +await client.destination.create({ name: "name", }); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.DestinationCreateRequest`** +**request:** `Hookdeck.DestinationCreateRequest`
-
-
-**requestOptions: `Destination.RequestOptions`** +**requestOptions:** `Destination.RequestOptions`
-
-
-
-
-
hookdeck.destination.upsert({ ...params }) -> Hookdeck.Destination - +
client.destination.upsert({ ...params }) -> Hookdeck.Destination
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.destination.upsert({ +```typescript +await client.destination.upsert({ name: "name", }); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.DestinationUpsertRequest`** +**request:** `Hookdeck.DestinationUpsertRequest`
-
-
-**requestOptions: `Destination.RequestOptions`** +**requestOptions:** `Destination.RequestOptions`
-
-
-
-
-
hookdeck.destination.retrieve(id) -> Hookdeck.Destination - +
client.destination.retrieve(id) -> Hookdeck.Destination
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.destination.retrieve("id"); +```typescript +await client.destination.retrieve("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Destination.RequestOptions`** +**requestOptions:** `Destination.RequestOptions`
-
-
-
-
-
hookdeck.destination.update(id, { ...params }) -> Hookdeck.Destination - +
client.destination.update(id, { ...params }) -> Hookdeck.Destination
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.destination.update("id"); +```typescript +await client.destination.update("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**request: `Hookdeck.DestinationUpdateRequest`** +**request:** `Hookdeck.DestinationUpdateRequest`
-
-
-**requestOptions: `Destination.RequestOptions`** +**requestOptions:** `Destination.RequestOptions`
-
-
-
-
-
hookdeck.destination.delete(id) -> Hookdeck.DestinationDeleteResponse - +
client.destination.delete(id) -> Hookdeck.DestinationDeleteResponse
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.destination.delete("id"); +```typescript +await client.destination.delete("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Destination.RequestOptions`** +**requestOptions:** `Destination.RequestOptions`
-
-
-
-
-
hookdeck.destination.disable(id) -> Hookdeck.Destination - +
client.destination.disable(id) -> Hookdeck.Destination
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.destination.disable("id"); +```typescript +await client.destination.disable("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Destination.RequestOptions`** +**requestOptions:** `Destination.RequestOptions`
-
-
-
-
-
hookdeck.destination.enable(id) -> Hookdeck.Destination - +
client.destination.enable(id) -> Hookdeck.Destination
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.destination.enable("id"); +```typescript +await client.destination.enable("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Destination.RequestOptions`** +**requestOptions:** `Destination.RequestOptions`
-
-
-
-
## EventBulkRetry -
hookdeck.eventBulkRetry.list({ ...params }) -> Hookdeck.BatchOperationPaginatedResult - +
client.eventBulkRetry.list({ ...params }) -> Hookdeck.BatchOperationPaginatedResult
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.eventBulkRetry.list(); +```typescript +await client.eventBulkRetry.list(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.EventBulkRetryListRequest`** +**request:** `Hookdeck.EventBulkRetryListRequest`
-
-
-**requestOptions: `EventBulkRetry.RequestOptions`** +**requestOptions:** `EventBulkRetry.RequestOptions`
-
-
-
-
-
hookdeck.eventBulkRetry.create({ ...params }) -> Hookdeck.BatchOperation - +
client.eventBulkRetry.create({ ...params }) -> Hookdeck.BatchOperation
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.eventBulkRetry.create(); +```typescript +await client.eventBulkRetry.create(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.EventBulkRetryCreateRequest`** +**request:** `Hookdeck.EventBulkRetryCreateRequest`
-
-
-**requestOptions: `EventBulkRetry.RequestOptions`** +**requestOptions:** `EventBulkRetry.RequestOptions`
-
-
-
-
-
hookdeck.eventBulkRetry.plan() -> Hookdeck.EventBulkRetryPlanResponse - +
client.eventBulkRetry.plan() -> Hookdeck.EventBulkRetryPlanResponse
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.eventBulkRetry.plan(); +```typescript +await client.eventBulkRetry.plan(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**requestOptions: `EventBulkRetry.RequestOptions`** +**requestOptions:** `EventBulkRetry.RequestOptions`
-
-
-
-
-
hookdeck.eventBulkRetry.retrieve(id) -> Hookdeck.BatchOperation - +
client.eventBulkRetry.retrieve(id) -> Hookdeck.BatchOperation
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.eventBulkRetry.retrieve("id"); +```typescript +await client.eventBulkRetry.retrieve("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `EventBulkRetry.RequestOptions`** +**requestOptions:** `EventBulkRetry.RequestOptions`
-
-
-
-
-
hookdeck.eventBulkRetry.cancel(id) -> Hookdeck.BatchOperation - +
client.eventBulkRetry.cancel(id) -> Hookdeck.BatchOperation
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.eventBulkRetry.cancel("id"); +```typescript +await client.eventBulkRetry.cancel("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `EventBulkRetry.RequestOptions`** +**requestOptions:** `EventBulkRetry.RequestOptions`
-
-
-
-
## Event -
hookdeck.event.list({ ...params }) -> Hookdeck.EventPaginatedResult - +
client.event.list({ ...params }) -> Hookdeck.EventPaginatedResult
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.event.list(); +```typescript +await client.event.list(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.EventListRequest`** +**request:** `Hookdeck.EventListRequest`
-
-
-**requestOptions: `Event.RequestOptions`** +**requestOptions:** `Event.RequestOptions`
-
-
-
-
-
hookdeck.event.retrieve(id) -> Hookdeck.Event - +
client.event.retrieve(id) -> Hookdeck.Event
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.event.retrieve("id"); +```typescript +await client.event.retrieve("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Event.RequestOptions`** +**requestOptions:** `Event.RequestOptions`
-
-
-
-
-
hookdeck.event.retrieveBody(id) -> Hookdeck.RawBody - +
client.event.retrieveBody(id) -> Hookdeck.RawBody
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.event.retrieveBody("id"); +```typescript +await client.event.retrieveBody("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Event.RequestOptions`** +**requestOptions:** `Event.RequestOptions`
-
-
-
-
-
hookdeck.event.retry(id) -> Hookdeck.RetriedEvent - +
client.event.retry(id) -> Hookdeck.RetriedEvent
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.event.retry("id"); +```typescript +await client.event.retry("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Event.RequestOptions`** +**requestOptions:** `Event.RequestOptions`
-
-
-
-
-
hookdeck.event.mute(id) -> Hookdeck.Event - +
client.event.mute(id) -> Hookdeck.Event
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.event.mute("id"); +```typescript +await client.event.mute("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Event.RequestOptions`** +**requestOptions:** `Event.RequestOptions`
-
-
-
-
## IgnoredEventBulkRetry -
hookdeck.ignoredEventBulkRetry.list({ ...params }) -> Hookdeck.BatchOperationPaginatedResult - +
client.ignoredEventBulkRetry.list({ ...params }) -> Hookdeck.BatchOperationPaginatedResult
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.ignoredEventBulkRetry.list(); +```typescript +await client.ignoredEventBulkRetry.list(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.IgnoredEventBulkRetryListRequest`** +**request:** `Hookdeck.IgnoredEventBulkRetryListRequest`
-
-
-**requestOptions: `IgnoredEventBulkRetry.RequestOptions`** +**requestOptions:** `IgnoredEventBulkRetry.RequestOptions`
-
-
-
-
-
hookdeck.ignoredEventBulkRetry.create({ ...params }) -> Hookdeck.BatchOperation - +
client.ignoredEventBulkRetry.create({ ...params }) -> Hookdeck.BatchOperation
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.ignoredEventBulkRetry.create(); +```typescript +await client.ignoredEventBulkRetry.create(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.IgnoredEventBulkRetryCreateRequest`** +**request:** `Hookdeck.IgnoredEventBulkRetryCreateRequest`
-
-
-**requestOptions: `IgnoredEventBulkRetry.RequestOptions`** +**requestOptions:** `IgnoredEventBulkRetry.RequestOptions`
-
-
-
-
-
hookdeck.ignoredEventBulkRetry.plan() -> Hookdeck.IgnoredEventBulkRetryPlanResponse - +
client.ignoredEventBulkRetry.plan() -> Hookdeck.IgnoredEventBulkRetryPlanResponse
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.ignoredEventBulkRetry.plan(); +```typescript +await client.ignoredEventBulkRetry.plan(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**requestOptions: `IgnoredEventBulkRetry.RequestOptions`** +**requestOptions:** `IgnoredEventBulkRetry.RequestOptions`
-
-
-
-
-
hookdeck.ignoredEventBulkRetry.retrieve(id) -> Hookdeck.BatchOperation - +
client.ignoredEventBulkRetry.retrieve(id) -> Hookdeck.BatchOperation
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.ignoredEventBulkRetry.retrieve("id"); +```typescript +await client.ignoredEventBulkRetry.retrieve("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `IgnoredEventBulkRetry.RequestOptions`** +**requestOptions:** `IgnoredEventBulkRetry.RequestOptions`
-
-
-
-
-
hookdeck.ignoredEventBulkRetry.cancel(id) -> Hookdeck.BatchOperation - +
client.ignoredEventBulkRetry.cancel(id) -> Hookdeck.BatchOperation
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.ignoredEventBulkRetry.cancel("id"); +```typescript +await client.ignoredEventBulkRetry.cancel("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `IgnoredEventBulkRetry.RequestOptions`** +**requestOptions:** `IgnoredEventBulkRetry.RequestOptions`
-
-
-
-
## Issue -
hookdeck.issue.list({ ...params }) -> Hookdeck.IssueWithDataPaginatedResult - +
client.issue.list({ ...params }) -> Hookdeck.IssueWithDataPaginatedResult
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.issue.list({ +```typescript +await client.issue.list({ id: "iss_YXKv5OdJXCiVwkPhGy", issueTriggerId: "it_BXKv5OdJXCiVwkPhGy", mergedWith: "iss_AXKv3OdJXCiKlkPhDz", @@ -3330,84 +2519,64 @@ await hookdeck.issue.list({ ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.IssueListRequest`** +**request:** `Hookdeck.IssueListRequest`
-
-
-**requestOptions: `Issue.RequestOptions`** +**requestOptions:** `Issue.RequestOptions`
-
-
-
-
-
hookdeck.issue.count({ ...params }) -> Hookdeck.IssueCount - +
client.issue.count({ ...params }) -> Hookdeck.IssueCount
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.issue.count({ +```typescript +await client.issue.count({ id: "iss_YXKv5OdJXCiVwkPhGy", issueTriggerId: "it_BXKv5OdJXCiVwkPhGy", mergedWith: "iss_AXKv3OdJXCiKlkPhDz", @@ -3415,3799 +2584,2872 @@ await hookdeck.issue.count({ ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.IssueCountRequest`** +**request:** `Hookdeck.IssueCountRequest`
-
-
-**requestOptions: `Issue.RequestOptions`** +**requestOptions:** `Issue.RequestOptions`
-
-
-
-
-
hookdeck.issue.retrieve(id) -> Hookdeck.IssueWithData - +
client.issue.retrieve(id) -> Hookdeck.IssueWithData
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.issue.retrieve("string"); +```typescript +await client.issue.retrieve("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Issue.RequestOptions`** +**requestOptions:** `Issue.RequestOptions`
-
-
-
-
-
hookdeck.issue.update(id, { ...params }) -> Hookdeck.Issue - +
client.issue.update(id, { ...params }) -> Hookdeck.Issue
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.issue.update("string", { +```typescript +await client.issue.update("id", { status: Hookdeck.IssueUpdateRequestStatus.Opened, }); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**request: `Hookdeck.IssueUpdateRequest`** +**request:** `Hookdeck.IssueUpdateRequest`
-
-
-**requestOptions: `Issue.RequestOptions`** +**requestOptions:** `Issue.RequestOptions`
-
-
-
-
-
hookdeck.issue.dismiss(id) -> Hookdeck.Issue - +
client.issue.dismiss(id) -> Hookdeck.Issue
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.issue.dismiss("string"); +```typescript +await client.issue.dismiss("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Issue.RequestOptions`** +**requestOptions:** `Issue.RequestOptions`
-
-
-
-
## Request -
hookdeck.request.list({ ...params }) -> Hookdeck.RequestPaginatedResult - +
client.request.list({ ...params }) -> Hookdeck.RequestPaginatedResult
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.request.list(); +```typescript +await client.request.list(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.RequestListRequest`** +**request:** `Hookdeck.RequestListRequest`
-
-
-**requestOptions: `Request.RequestOptions`** +**requestOptions:** `Request.RequestOptions`
-
-
-
-
-
hookdeck.request.retrieve(id) -> Hookdeck.Request - +
client.request.retrieve(id) -> Hookdeck.Request
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.request.retrieve("id"); +```typescript +await client.request.retrieve("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Request.RequestOptions`** +**requestOptions:** `Request.RequestOptions`
-
-
-
-
-
hookdeck.request.retrieveBody(id) -> Hookdeck.RawBody - +
client.request.retrieveBody(id) -> Hookdeck.RawBody
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.request.retrieveBody("id"); +```typescript +await client.request.retrieveBody("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Request.RequestOptions`** +**requestOptions:** `Request.RequestOptions`
-
-
-
-
-
hookdeck.request.retry(id, { ...params }) -> Hookdeck.RetryRequest - +
client.request.retry(id, { ...params }) -> Hookdeck.RetryRequest
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.request.retry("id", { +```typescript +await client.request.retry("id", { webhookIds: ["webhook_ids"], }); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**request: `Hookdeck.RequestRetryRequest`** +**request:** `Hookdeck.RequestRetryRequest`
-
-
-**requestOptions: `Request.RequestOptions`** +**requestOptions:** `Request.RequestOptions`
-
-
-
-
-
hookdeck.request.listEvent(id, { ...params }) -> Hookdeck.EventPaginatedResult - +
client.request.listEvent(id, { ...params }) -> Hookdeck.EventPaginatedResult
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.request.listEvent("id"); +```typescript +await client.request.listEvent("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**request: `Hookdeck.RequestListEventRequest`** +**request:** `Hookdeck.RequestListEventRequest`
-
-
-**requestOptions: `Request.RequestOptions`** +**requestOptions:** `Request.RequestOptions`
-
-
-
-
-
hookdeck.request.listIgnoredEvent(id, { ...params }) -> Hookdeck.IgnoredEventPaginatedResult - +
client.request.listIgnoredEvent(id, { ...params }) -> Hookdeck.IgnoredEventPaginatedResult
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.request.listIgnoredEvent("id"); +```typescript +await client.request.listIgnoredEvent("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**request: `Hookdeck.RequestListIgnoredEventRequest`** +**request:** `Hookdeck.RequestListIgnoredEventRequest`
-
-
-**requestOptions: `Request.RequestOptions`** +**requestOptions:** `Request.RequestOptions`
-
-
-
-
## RequestBulkRetry -
hookdeck.requestBulkRetry.list({ ...params }) -> Hookdeck.BatchOperationPaginatedResult - +
client.requestBulkRetry.list({ ...params }) -> Hookdeck.BatchOperationPaginatedResult
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.requestBulkRetry.list(); +```typescript +await client.requestBulkRetry.list(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.RequestBulkRetryListRequest`** +**request:** `Hookdeck.RequestBulkRetryListRequest`
-
-
-**requestOptions: `RequestBulkRetry.RequestOptions`** +**requestOptions:** `RequestBulkRetry.RequestOptions`
-
-
-
-
-
hookdeck.requestBulkRetry.create({ ...params }) -> Hookdeck.BatchOperation - +
client.requestBulkRetry.create({ ...params }) -> Hookdeck.BatchOperation
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.requestBulkRetry.create(); +```typescript +await client.requestBulkRetry.create(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.RequestBulkRetryCreateRequest`** +**request:** `Hookdeck.RequestBulkRetryCreateRequest`
-
-
-**requestOptions: `RequestBulkRetry.RequestOptions`** +**requestOptions:** `RequestBulkRetry.RequestOptions`
-
-
-
-
-
hookdeck.requestBulkRetry.plan() -> Hookdeck.RequestBulkRetryPlanResponse - +
client.requestBulkRetry.plan() -> Hookdeck.RequestBulkRetryPlanResponse
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.requestBulkRetry.plan(); +```typescript +await client.requestBulkRetry.plan(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**requestOptions: `RequestBulkRetry.RequestOptions`** +**requestOptions:** `RequestBulkRetry.RequestOptions`
-
-
-
-
-
hookdeck.requestBulkRetry.retrieve(id) -> Hookdeck.BatchOperation - +
client.requestBulkRetry.retrieve(id) -> Hookdeck.BatchOperation
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.requestBulkRetry.retrieve("id"); +```typescript +await client.requestBulkRetry.retrieve("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `RequestBulkRetry.RequestOptions`** +**requestOptions:** `RequestBulkRetry.RequestOptions`
-
-
-
-
-
hookdeck.requestBulkRetry.cancel(id) -> Hookdeck.BatchOperation - +
client.requestBulkRetry.cancel(id) -> Hookdeck.BatchOperation
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.requestBulkRetry.cancel("id"); +```typescript +await client.requestBulkRetry.cancel("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `RequestBulkRetry.RequestOptions`** +**requestOptions:** `RequestBulkRetry.RequestOptions`
-
-
-
-
## Source -
hookdeck.source.list({ ...params }) -> Hookdeck.SourcePaginatedResult - +
client.source.list({ ...params }) -> Hookdeck.SourcePaginatedResult
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.source.list(); +```typescript +await client.source.list(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.SourceListRequest`** +**request:** `Hookdeck.SourceListRequest`
-
-
-**requestOptions: `Source.RequestOptions`** +**requestOptions:** `Source.RequestOptions`
-
-
-
-
-
hookdeck.source.create({ ...params }) -> Hookdeck.Source - +
client.source.create({ ...params }) -> Hookdeck.Source
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.source.create({ +```typescript +await client.source.create({ name: "name", }); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.SourceCreateRequest`** +**request:** `Hookdeck.SourceCreateRequest`
-
-
-**requestOptions: `Source.RequestOptions`** +**requestOptions:** `Source.RequestOptions`
-
-
-
-
-
hookdeck.source.upsert({ ...params }) -> Hookdeck.Source - +
client.source.upsert({ ...params }) -> Hookdeck.Source
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.source.upsert({ +```typescript +await client.source.upsert({ name: "name", }); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.SourceUpsertRequest`** +**request:** `Hookdeck.SourceUpsertRequest`
-
-
-**requestOptions: `Source.RequestOptions`** +**requestOptions:** `Source.RequestOptions`
-
-
-
-
-
hookdeck.source.retrieve(id, { ...params }) -> Hookdeck.Source - +
client.source.retrieve(id, { ...params }) -> Hookdeck.Source
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.source.retrieve("id"); +```typescript +await client.source.retrieve("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**request: `Hookdeck.SourceRetrieveRequest`** +**request:** `Hookdeck.SourceRetrieveRequest`
-
-
-**requestOptions: `Source.RequestOptions`** +**requestOptions:** `Source.RequestOptions`
-
-
-
-
-
hookdeck.source.update(id, { ...params }) -> Hookdeck.Source - +
client.source.update(id, { ...params }) -> Hookdeck.Source
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.source.update("id"); +```typescript +await client.source.update("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**request: `Hookdeck.SourceUpdateRequest`** +**request:** `Hookdeck.SourceUpdateRequest`
-
-
-**requestOptions: `Source.RequestOptions`** +**requestOptions:** `Source.RequestOptions`
-
-
-
-
-
hookdeck.source.delete(id) -> Hookdeck.SourceDeleteResponse - +
client.source.delete(id) -> Hookdeck.SourceDeleteResponse
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.source.delete("id"); +```typescript +await client.source.delete("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Source.RequestOptions`** +**requestOptions:** `Source.RequestOptions`
-
-
-
-
-
hookdeck.source.disable(id) -> Hookdeck.Source - +
client.source.disable(id) -> Hookdeck.Source
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.source.disable("id"); +```typescript +await client.source.disable("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Source.RequestOptions`** +**requestOptions:** `Source.RequestOptions`
-
-
-
-
-
hookdeck.source.enable(id) -> Hookdeck.Source - +
client.source.enable(id) -> Hookdeck.Source
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.source.enable("id"); +```typescript +await client.source.enable("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Source.RequestOptions`** +**requestOptions:** `Source.RequestOptions`
-
-
-
-
## Notification -
hookdeck.notification.update({ ...params }) -> Hookdeck.ToggleWebhookNotifications - +
client.notification.update({ ...params }) -> Hookdeck.ToggleWebhookNotifications
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.notification.update(); +```typescript +await client.notification.update(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.NotificationUpdateRequest`** +**request:** `Hookdeck.NotificationUpdateRequest`
-
-
-**requestOptions: `Notification.RequestOptions`** +**requestOptions:** `Notification.RequestOptions`
-
-
-
-
## CustomDomain -
hookdeck.customDomain.list() -> Hookdeck.ListCustomDomainSchema - +
client.customDomain.list() -> Hookdeck.ListCustomDomainSchema
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.customDomain.list(); +```typescript +await client.customDomain.list(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**requestOptions: `CustomDomain.RequestOptions`** +**requestOptions:** `CustomDomain.RequestOptions`
-
-
-
-
-
hookdeck.customDomain.create({ ...params }) -> Hookdeck.AddCustomHostname - +
client.customDomain.create({ ...params }) -> Hookdeck.AddCustomHostname
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.customDomain.create({ +```typescript +await client.customDomain.create({ hostname: "hostname", }); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.AddCustomHostname`** +**request:** `Hookdeck.AddCustomHostname`
-
-
-**requestOptions: `CustomDomain.RequestOptions`** +**requestOptions:** `CustomDomain.RequestOptions`
-
-
-
-
-
hookdeck.customDomain.delete(domainId) -> Hookdeck.DeleteCustomDomainSchema - +
client.customDomain.delete(domainId) -> Hookdeck.DeleteCustomDomainSchema
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.customDomain.delete("domain_id"); +```typescript +await client.customDomain.delete("domain_id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**domainId: `string`** +**domainId:** `string`
-
-
-**requestOptions: `CustomDomain.RequestOptions`** +**requestOptions:** `CustomDomain.RequestOptions`
-
-
-
-
## Transformation -
hookdeck.transformation.list({ ...params }) -> Hookdeck.TransformationPaginatedResult - +
client.transformation.list({ ...params }) -> Hookdeck.TransformationPaginatedResult
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.transformation.list(); +```typescript +await client.transformation.list(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.TransformationListRequest`** +**request:** `Hookdeck.TransformationListRequest`
-
-
-**requestOptions: `Transformation.RequestOptions`** +**requestOptions:** `Transformation.RequestOptions`
-
-
-
-
-
hookdeck.transformation.create({ ...params }) -> Hookdeck.Transformation - +
client.transformation.create({ ...params }) -> Hookdeck.Transformation
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.transformation.create({ +```typescript +await client.transformation.create({ name: "name", code: "code", }); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.TransformationCreateRequest`** +**request:** `Hookdeck.TransformationCreateRequest`
-
-
-**requestOptions: `Transformation.RequestOptions`** +**requestOptions:** `Transformation.RequestOptions`
-
-
-
-
-
hookdeck.transformation.upsert({ ...params }) -> Hookdeck.Transformation - +
client.transformation.upsert({ ...params }) -> Hookdeck.Transformation
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.transformation.upsert({ +```typescript +await client.transformation.upsert({ name: "name", code: "code", }); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.TransformationUpsertRequest`** +**request:** `Hookdeck.TransformationUpsertRequest`
-
-
-**requestOptions: `Transformation.RequestOptions`** +**requestOptions:** `Transformation.RequestOptions`
-
-
-
-
-
hookdeck.transformation.retrieve(id) -> Hookdeck.Transformation - +
client.transformation.retrieve(id) -> Hookdeck.Transformation
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.transformation.retrieve("id"); +```typescript +await client.transformation.retrieve("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Transformation.RequestOptions`** +**requestOptions:** `Transformation.RequestOptions`
-
-
-
-
-
hookdeck.transformation.update(id, { ...params }) -> Hookdeck.Transformation - +
client.transformation.update(id, { ...params }) -> Hookdeck.Transformation
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.transformation.update("id"); +```typescript +await client.transformation.update("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**request: `Hookdeck.TransformationUpdateRequest`** +**request:** `Hookdeck.TransformationUpdateRequest`
-
-
-**requestOptions: `Transformation.RequestOptions`** +**requestOptions:** `Transformation.RequestOptions`
-
-
-
-
-
hookdeck.transformation.run({ ...params }) -> Hookdeck.TransformationExecutorOutput - +
client.transformation.run({ ...params }) -> Hookdeck.TransformationExecutorOutput
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.transformation.run(); +```typescript +await client.transformation.run(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.TransformationRunRequest`** +**request:** `Hookdeck.TransformationRunRequest`
-
-
-**requestOptions: `Transformation.RequestOptions`** +**requestOptions:** `Transformation.RequestOptions`
-
-
-
-
-
hookdeck.transformation.listExecution(id, { ...params }) -> Hookdeck.TransformationExecutionPaginatedResult - +
client.transformation.listExecution(id, { ...params }) -> Hookdeck.TransformationExecutionPaginatedResult
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.transformation.listExecution("id"); +```typescript +await client.transformation.listExecution("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**request: `Hookdeck.TransformationListExecutionRequest`** +**request:** `Hookdeck.TransformationListExecutionRequest`
-
-
-**requestOptions: `Transformation.RequestOptions`** +**requestOptions:** `Transformation.RequestOptions`
-
-
-
-
-
hookdeck.transformation.retrieveExecution(id, executionId) -> Hookdeck.TransformationExecution - +
client.transformation.retrieveExecution(id, executionId) -> Hookdeck.TransformationExecution
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.transformation.retrieveExecution("id", "execution_id"); +```typescript +await client.transformation.retrieveExecution("id", "execution_id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**executionId: `string`** +**executionId:** `string`
-
-
-**requestOptions: `Transformation.RequestOptions`** +**requestOptions:** `Transformation.RequestOptions`
-
-
-
-
## Connection -
hookdeck.connection.list({ ...params }) -> Hookdeck.ConnectionPaginatedResult - +
client.connection.list({ ...params }) -> Hookdeck.ConnectionPaginatedResult
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.connection.list(); +```typescript +await client.connection.list(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.ConnectionListRequest`** +**request:** `Hookdeck.ConnectionListRequest`
-
-
-**requestOptions: `Connection.RequestOptions`** +**requestOptions:** `Connection.RequestOptions`
-
-
-
-
-
hookdeck.connection.create({ ...params }) -> Hookdeck.Connection - +
client.connection.create({ ...params }) -> Hookdeck.Connection
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.connection.create(); +```typescript +await client.connection.create(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.ConnectionCreateRequest`** +**request:** `Hookdeck.ConnectionCreateRequest`
-
-
-**requestOptions: `Connection.RequestOptions`** +**requestOptions:** `Connection.RequestOptions`
-
-
-
-
-
hookdeck.connection.upsert({ ...params }) -> Hookdeck.Connection - +
client.connection.upsert({ ...params }) -> Hookdeck.Connection
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.connection.upsert(); +```typescript +await client.connection.upsert(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.ConnectionUpsertRequest`** +**request:** `Hookdeck.ConnectionUpsertRequest`
-
-
-**requestOptions: `Connection.RequestOptions`** +**requestOptions:** `Connection.RequestOptions`
-
-
-
-
-
hookdeck.connection.count({ ...params }) -> Hookdeck.ConnectionCountResponse - +
client.connection.count({ ...params }) -> Hookdeck.ConnectionCountResponse
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.connection.count(); +```typescript +await client.connection.count(); ```
-
-
-
#### ⚙️ Parameters
-
-
-**request: `Hookdeck.ConnectionCountRequest`** +**request:** `Hookdeck.ConnectionCountRequest`
-
-
-**requestOptions: `Connection.RequestOptions`** +**requestOptions:** `Connection.RequestOptions`
-
-
-
-
-
hookdeck.connection.retrieve(id) -> Hookdeck.Connection - +
client.connection.retrieve(id) -> Hookdeck.Connection
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.connection.retrieve("id"); +```typescript +await client.connection.retrieve("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Connection.RequestOptions`** +**requestOptions:** `Connection.RequestOptions`
-
-
-
-
-
hookdeck.connection.update(id, { ...params }) -> Hookdeck.Connection - +
client.connection.update(id, { ...params }) -> Hookdeck.Connection
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.connection.update("id"); +```typescript +await client.connection.update("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**request: `Hookdeck.ConnectionUpdateRequest`** +**request:** `Hookdeck.ConnectionUpdateRequest`
-
-
-**requestOptions: `Connection.RequestOptions`** +**requestOptions:** `Connection.RequestOptions`
-
-
-
-
-
hookdeck.connection.delete(id) -> Hookdeck.ConnectionDeleteResponse - +
client.connection.delete(id) -> Hookdeck.ConnectionDeleteResponse
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.connection.delete("id"); +```typescript +await client.connection.delete("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Connection.RequestOptions`** +**requestOptions:** `Connection.RequestOptions`
-
-
-
-
-
hookdeck.connection.disable(id) -> Hookdeck.Connection - +
client.connection.disable(id) -> Hookdeck.Connection
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.connection.disable("id"); +```typescript +await client.connection.disable("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Connection.RequestOptions`** +**requestOptions:** `Connection.RequestOptions`
-
-
-
-
-
hookdeck.connection.enable(id) -> Hookdeck.Connection - +
client.connection.enable(id) -> Hookdeck.Connection
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.connection.enable("id"); +```typescript +await client.connection.enable("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Connection.RequestOptions`** +**requestOptions:** `Connection.RequestOptions`
-
-
-
-
-
hookdeck.connection.pause(id) -> Hookdeck.Connection - +
client.connection.pause(id) -> Hookdeck.Connection
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.connection.pause("id"); +```typescript +await client.connection.pause("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Connection.RequestOptions`** +**requestOptions:** `Connection.RequestOptions`
-
-
-
-
-
hookdeck.connection.unpause(id) -> Hookdeck.Connection - +
client.connection.unpause(id) -> Hookdeck.Connection
-
#### 📝 Description
-
-
-
-
-
#### 🔌 Usage
-
-
-```ts -await hookdeck.connection.unpause("id"); +```typescript +await client.connection.unpause("id"); ```
-
-
-
#### ⚙️ Parameters
-
-
-**id: `string`** +**id:** `string`
-
-
-**requestOptions: `Connection.RequestOptions`** +**requestOptions:** `Connection.RequestOptions`
-
-
-
-
diff --git a/src/Client.ts b/src/Client.ts index faa92e8..1807d29 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -28,8 +28,11 @@ export declare namespace HookdeckClient { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ abortSignal?: AbortSignal; } } diff --git a/src/api/resources/attempt/client/Client.ts b/src/api/resources/attempt/client/Client.ts index 38f80e1..7a53bf6 100644 --- a/src/api/resources/attempt/client/Client.ts +++ b/src/api/resources/attempt/client/Client.ts @@ -17,8 +17,11 @@ export declare namespace Attempt { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ abortSignal?: AbortSignal; } } @@ -36,7 +39,7 @@ export class Attempt { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.attempt.list() + * await client.attempt.list() */ public async list( request: Hookdeck.AttemptListRequest = {}, @@ -82,18 +85,20 @@ export class Attempt { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.EventAttemptPaginatedResult.parseOrThrow(_response.body, { + return serializers.EventAttemptPaginatedResult.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -106,7 +111,7 @@ export class Attempt { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -116,7 +121,7 @@ export class Attempt { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -156,7 +161,7 @@ export class Attempt { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.attempt.retrieve("id") + * await client.attempt.retrieve("id") */ public async retrieve( id: string, @@ -172,17 +177,19 @@ export class Attempt { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.attempt.retrieve.Response.parseOrThrow(_response.body, { + return serializers.attempt.retrieve.Response.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -195,7 +202,7 @@ export class Attempt { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/bookmark/client/Client.ts b/src/api/resources/bookmark/client/Client.ts index f009154..6331f6a 100644 --- a/src/api/resources/bookmark/client/Client.ts +++ b/src/api/resources/bookmark/client/Client.ts @@ -17,8 +17,11 @@ export declare namespace Bookmark { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ abortSignal?: AbortSignal; } } @@ -36,7 +39,7 @@ export class Bookmark { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.bookmark.list() + * await client.bookmark.list() */ public async list( request: Hookdeck.BookmarkListRequest = {}, @@ -118,18 +121,20 @@ export class Bookmark { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.BookmarkPaginatedResult.parseOrThrow(_response.body, { + return serializers.BookmarkPaginatedResult.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -142,7 +147,7 @@ export class Bookmark { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -152,7 +157,7 @@ export class Bookmark { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -193,7 +198,7 @@ export class Bookmark { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.bookmark.create({ + * await client.bookmark.create({ * eventDataId: "event_data_id", * webhookId: "webhook_id", * label: "label" @@ -213,18 +218,20 @@ export class Bookmark { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.BookmarkCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.BookmarkCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Bookmark.parseOrThrow(_response.body, { + return serializers.Bookmark.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -237,7 +244,7 @@ export class Bookmark { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -247,7 +254,7 @@ export class Bookmark { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -287,7 +294,7 @@ export class Bookmark { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.bookmark.retrieve("id") + * await client.bookmark.retrieve("id") */ public async retrieve(id: string, requestOptions?: Bookmark.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -300,17 +307,19 @@ export class Bookmark { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.Bookmark.parseOrThrow(_response.body, { + return serializers.Bookmark.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -323,7 +332,7 @@ export class Bookmark { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -366,7 +375,7 @@ export class Bookmark { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.bookmark.update("id") + * await client.bookmark.update("id") */ public async update( id: string, @@ -383,18 +392,20 @@ export class Bookmark { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.BookmarkUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.BookmarkUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Bookmark.parseOrThrow(_response.body, { + return serializers.Bookmark.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -407,7 +418,7 @@ export class Bookmark { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -417,7 +428,7 @@ export class Bookmark { ); case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -427,7 +438,7 @@ export class Bookmark { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -467,7 +478,7 @@ export class Bookmark { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.bookmark.delete("id") + * await client.bookmark.delete("id") */ public async delete( id: string, @@ -483,17 +494,19 @@ export class Bookmark { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.DeletedBookmarkResponse.parseOrThrow(_response.body, { + return serializers.DeletedBookmarkResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -506,7 +519,7 @@ export class Bookmark { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -546,7 +559,7 @@ export class Bookmark { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.bookmark.retrieveBody("id") + * await client.bookmark.retrieveBody("id") */ public async retrieveBody(id: string, requestOptions?: Bookmark.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -559,17 +572,19 @@ export class Bookmark { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.RawBody.parseOrThrow(_response.body, { + return serializers.RawBody.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -582,7 +597,7 @@ export class Bookmark { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -625,7 +640,7 @@ export class Bookmark { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.bookmark.trigger("id") + * await client.bookmark.trigger("id") */ public async trigger( id: string, @@ -642,18 +657,20 @@ export class Bookmark { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.BookmarkTriggerRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.BookmarkTriggerRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.EventArray.parseOrThrow(_response.body, { + return serializers.EventArray.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -666,7 +683,7 @@ export class Bookmark { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -676,7 +693,7 @@ export class Bookmark { ); case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -686,7 +703,7 @@ export class Bookmark { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/connection/client/Client.ts b/src/api/resources/connection/client/Client.ts index 0e575d9..34c5b54 100644 --- a/src/api/resources/connection/client/Client.ts +++ b/src/api/resources/connection/client/Client.ts @@ -17,8 +17,11 @@ export declare namespace Connection { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ abortSignal?: AbortSignal; } } @@ -36,7 +39,7 @@ export class Connection { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.connection.list() + * await client.connection.list() */ public async list( request: Hookdeck.ConnectionListRequest = {}, @@ -132,18 +135,20 @@ export class Connection { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.ConnectionPaginatedResult.parseOrThrow(_response.body, { + return serializers.ConnectionPaginatedResult.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -156,7 +161,7 @@ export class Connection { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -166,7 +171,7 @@ export class Connection { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -207,7 +212,7 @@ export class Connection { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.connection.create() + * await client.connection.create() */ public async create( request: Hookdeck.ConnectionCreateRequest = {}, @@ -223,18 +228,20 @@ export class Connection { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.ConnectionCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.ConnectionCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Connection.parseOrThrow(_response.body, { + return serializers.Connection.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -247,7 +254,7 @@ export class Connection { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -257,7 +264,7 @@ export class Connection { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -298,7 +305,7 @@ export class Connection { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.connection.upsert() + * await client.connection.upsert() */ public async upsert( request: Hookdeck.ConnectionUpsertRequest = {}, @@ -314,18 +321,20 @@ export class Connection { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.ConnectionUpsertRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.ConnectionUpsertRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Connection.parseOrThrow(_response.body, { + return serializers.Connection.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -338,7 +347,7 @@ export class Connection { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -348,7 +357,7 @@ export class Connection { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -389,7 +398,7 @@ export class Connection { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.connection.count() + * await client.connection.count() */ public async count( request: Hookdeck.ConnectionCountRequest = {}, @@ -435,18 +444,20 @@ export class Connection { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.ConnectionCountResponse.parseOrThrow(_response.body, { + return serializers.ConnectionCountResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -459,7 +470,7 @@ export class Connection { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -469,7 +480,7 @@ export class Connection { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -510,7 +521,7 @@ export class Connection { * @throws {@link Hookdeck.GoneError} * * @example - * await hookdeck.connection.retrieve("id") + * await client.connection.retrieve("id") */ public async retrieve(id: string, requestOptions?: Connection.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -523,17 +534,19 @@ export class Connection { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.Connection.parseOrThrow(_response.body, { + return serializers.Connection.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -546,7 +559,7 @@ export class Connection { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -556,7 +569,7 @@ export class Connection { ); case 410: throw new Hookdeck.GoneError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -599,7 +612,7 @@ export class Connection { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.connection.update("id") + * await client.connection.update("id") */ public async update( id: string, @@ -616,18 +629,20 @@ export class Connection { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.ConnectionUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.ConnectionUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Connection.parseOrThrow(_response.body, { + return serializers.Connection.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -640,7 +655,7 @@ export class Connection { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -650,7 +665,7 @@ export class Connection { ); case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -660,7 +675,7 @@ export class Connection { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -700,7 +715,7 @@ export class Connection { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.connection.delete("id") + * await client.connection.delete("id") */ public async delete( id: string, @@ -716,17 +731,19 @@ export class Connection { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.ConnectionDeleteResponse.parseOrThrow(_response.body, { + return serializers.ConnectionDeleteResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -739,7 +756,7 @@ export class Connection { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -779,7 +796,7 @@ export class Connection { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.connection.disable("id") + * await client.connection.disable("id") */ public async disable(id: string, requestOptions?: Connection.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -792,17 +809,19 @@ export class Connection { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.Connection.parseOrThrow(_response.body, { + return serializers.Connection.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -815,7 +834,7 @@ export class Connection { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -855,7 +874,7 @@ export class Connection { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.connection.enable("id") + * await client.connection.enable("id") */ public async enable(id: string, requestOptions?: Connection.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -868,17 +887,19 @@ export class Connection { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.Connection.parseOrThrow(_response.body, { + return serializers.Connection.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -891,7 +912,7 @@ export class Connection { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -931,7 +952,7 @@ export class Connection { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.connection.pause("id") + * await client.connection.pause("id") */ public async pause(id: string, requestOptions?: Connection.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -944,17 +965,19 @@ export class Connection { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.Connection.parseOrThrow(_response.body, { + return serializers.Connection.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -967,7 +990,7 @@ export class Connection { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -1007,7 +1030,7 @@ export class Connection { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.connection.unpause("id") + * await client.connection.unpause("id") */ public async unpause(id: string, requestOptions?: Connection.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -1020,17 +1043,19 @@ export class Connection { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.Connection.parseOrThrow(_response.body, { + return serializers.Connection.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -1043,7 +1068,7 @@ export class Connection { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/connection/types/ConnectionCreateRequestDestination.ts b/src/api/resources/connection/types/ConnectionCreateRequestDestination.ts index ea8f7f7..bb2208a 100644 --- a/src/api/resources/connection/types/ConnectionCreateRequestDestination.ts +++ b/src/api/resources/connection/types/ConnectionCreateRequestDestination.ts @@ -16,10 +16,10 @@ export interface ConnectionCreateRequestDestination { url?: string; /** Path for the CLI destination */ cliPath?: string; - /** Period to rate limit attempts */ - rateLimitPeriod?: Hookdeck.ConnectionCreateRequestDestinationRateLimitPeriod; - /** Limit event attempts to receive per period */ + /** Limit of events to receive per period. Refered as Delivery Rate limit in the dashboard and documentation. */ rateLimit?: number; + /** Period to rate limit events by. Refered as Delivery Rate period in the dashboard and documentation. */ + rateLimitPeriod?: Hookdeck.ConnectionCreateRequestDestinationRateLimitPeriod; httpMethod?: Hookdeck.DestinationHttpMethod; authMethod?: Hookdeck.DestinationAuthMethodConfig; pathForwardingDisabled?: boolean; diff --git a/src/api/resources/connection/types/ConnectionCreateRequestDestinationRateLimitPeriod.ts b/src/api/resources/connection/types/ConnectionCreateRequestDestinationRateLimitPeriod.ts index b129a17..accc77d 100644 --- a/src/api/resources/connection/types/ConnectionCreateRequestDestinationRateLimitPeriod.ts +++ b/src/api/resources/connection/types/ConnectionCreateRequestDestinationRateLimitPeriod.ts @@ -3,7 +3,7 @@ */ /** - * Period to rate limit attempts + * Period to rate limit events by. Refered as Delivery Rate period in the dashboard and documentation. */ export type ConnectionCreateRequestDestinationRateLimitPeriod = "second" | "minute" | "hour" | "concurrent"; diff --git a/src/api/resources/connection/types/ConnectionUpsertRequestDestination.ts b/src/api/resources/connection/types/ConnectionUpsertRequestDestination.ts index 24b7be9..61b2b05 100644 --- a/src/api/resources/connection/types/ConnectionUpsertRequestDestination.ts +++ b/src/api/resources/connection/types/ConnectionUpsertRequestDestination.ts @@ -16,10 +16,10 @@ export interface ConnectionUpsertRequestDestination { url?: string; /** Path for the CLI destination */ cliPath?: string; - /** Period to rate limit attempts */ - rateLimitPeriod?: Hookdeck.ConnectionUpsertRequestDestinationRateLimitPeriod; - /** Limit event attempts to receive per period */ + /** Limit of events to receive per period. Refered as Delivery Rate limit in the dashboard and documentation. */ rateLimit?: number; + /** Period to rate limit events by. Refered as Delivery Rate period in the dashboard and documentation. */ + rateLimitPeriod?: Hookdeck.ConnectionUpsertRequestDestinationRateLimitPeriod; httpMethod?: Hookdeck.DestinationHttpMethod; authMethod?: Hookdeck.DestinationAuthMethodConfig; pathForwardingDisabled?: boolean; diff --git a/src/api/resources/connection/types/ConnectionUpsertRequestDestinationRateLimitPeriod.ts b/src/api/resources/connection/types/ConnectionUpsertRequestDestinationRateLimitPeriod.ts index 9102a7f..fbc8dd9 100644 --- a/src/api/resources/connection/types/ConnectionUpsertRequestDestinationRateLimitPeriod.ts +++ b/src/api/resources/connection/types/ConnectionUpsertRequestDestinationRateLimitPeriod.ts @@ -3,7 +3,7 @@ */ /** - * Period to rate limit attempts + * Period to rate limit events by. Refered as Delivery Rate period in the dashboard and documentation. */ export type ConnectionUpsertRequestDestinationRateLimitPeriod = "second" | "minute" | "hour" | "concurrent"; diff --git a/src/api/resources/customDomain/client/Client.ts b/src/api/resources/customDomain/client/Client.ts index 2b63ec1..9096fdf 100644 --- a/src/api/resources/customDomain/client/Client.ts +++ b/src/api/resources/customDomain/client/Client.ts @@ -17,8 +17,11 @@ export declare namespace CustomDomain { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ abortSignal?: AbortSignal; } } @@ -32,7 +35,7 @@ export class CustomDomain { * @param {CustomDomain.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await hookdeck.customDomain.list() + * await client.customDomain.list() */ public async list(requestOptions?: CustomDomain.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -45,17 +48,19 @@ export class CustomDomain { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.ListCustomDomainSchema.parseOrThrow(_response.body, { + return serializers.ListCustomDomainSchema.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -93,7 +98,7 @@ export class CustomDomain { * @param {CustomDomain.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await hookdeck.customDomain.create({ + * await client.customDomain.create({ * hostname: "hostname" * }) */ @@ -111,18 +116,20 @@ export class CustomDomain { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.AddCustomHostname.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.AddCustomHostname.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.AddCustomHostname.parseOrThrow(_response.body, { + return serializers.AddCustomHostname.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -160,7 +167,7 @@ export class CustomDomain { * @param {CustomDomain.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await hookdeck.customDomain.delete("domain_id") + * await client.customDomain.delete("domain_id") */ public async delete( domainId: string, @@ -176,17 +183,19 @@ export class CustomDomain { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.DeleteCustomDomainSchema.parseOrThrow(_response.body, { + return serializers.DeleteCustomDomainSchema.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/destination/client/Client.ts b/src/api/resources/destination/client/Client.ts index 2ee23c4..d4238c5 100644 --- a/src/api/resources/destination/client/Client.ts +++ b/src/api/resources/destination/client/Client.ts @@ -17,8 +17,11 @@ export declare namespace Destination { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ abortSignal?: AbortSignal; } } @@ -36,7 +39,7 @@ export class Destination { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.destination.list() + * await client.destination.list() */ public async list( request: Hookdeck.DestinationListRequest = {}, @@ -106,18 +109,20 @@ export class Destination { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.DestinationPaginatedResult.parseOrThrow(_response.body, { + return serializers.DestinationPaginatedResult.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -130,7 +135,7 @@ export class Destination { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -140,7 +145,7 @@ export class Destination { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -181,7 +186,7 @@ export class Destination { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.destination.create({ + * await client.destination.create({ * name: "name" * }) */ @@ -199,18 +204,20 @@ export class Destination { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.DestinationCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.DestinationCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Destination.parseOrThrow(_response.body, { + return serializers.Destination.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -223,7 +230,7 @@ export class Destination { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -233,7 +240,7 @@ export class Destination { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -274,7 +281,7 @@ export class Destination { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.destination.upsert({ + * await client.destination.upsert({ * name: "name" * }) */ @@ -292,18 +299,20 @@ export class Destination { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.DestinationUpsertRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.DestinationUpsertRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Destination.parseOrThrow(_response.body, { + return serializers.Destination.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -316,7 +325,7 @@ export class Destination { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -326,7 +335,7 @@ export class Destination { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -367,7 +376,7 @@ export class Destination { * @throws {@link Hookdeck.GoneError} * * @example - * await hookdeck.destination.retrieve("id") + * await client.destination.retrieve("id") */ public async retrieve(id: string, requestOptions?: Destination.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -380,17 +389,19 @@ export class Destination { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.Destination.parseOrThrow(_response.body, { + return serializers.Destination.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -403,7 +414,7 @@ export class Destination { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -413,7 +424,7 @@ export class Destination { ); case 410: throw new Hookdeck.GoneError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -456,7 +467,7 @@ export class Destination { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.destination.update("id") + * await client.destination.update("id") */ public async update( id: string, @@ -473,18 +484,20 @@ export class Destination { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.DestinationUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.DestinationUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Destination.parseOrThrow(_response.body, { + return serializers.Destination.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -497,7 +510,7 @@ export class Destination { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -507,7 +520,7 @@ export class Destination { ); case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -517,7 +530,7 @@ export class Destination { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -557,7 +570,7 @@ export class Destination { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.destination.delete("id") + * await client.destination.delete("id") */ public async delete( id: string, @@ -573,17 +586,19 @@ export class Destination { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.DestinationDeleteResponse.parseOrThrow(_response.body, { + return serializers.DestinationDeleteResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -596,7 +611,7 @@ export class Destination { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -636,7 +651,7 @@ export class Destination { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.destination.disable("id") + * await client.destination.disable("id") */ public async disable(id: string, requestOptions?: Destination.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -649,17 +664,19 @@ export class Destination { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.Destination.parseOrThrow(_response.body, { + return serializers.Destination.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -672,7 +689,7 @@ export class Destination { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -712,7 +729,7 @@ export class Destination { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.destination.enable("id") + * await client.destination.enable("id") */ public async enable(id: string, requestOptions?: Destination.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -725,17 +742,19 @@ export class Destination { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.Destination.parseOrThrow(_response.body, { + return serializers.Destination.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -748,7 +767,7 @@ export class Destination { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/destination/client/requests/DestinationCreateRequest.ts b/src/api/resources/destination/client/requests/DestinationCreateRequest.ts index d7c56f6..e789886 100644 --- a/src/api/resources/destination/client/requests/DestinationCreateRequest.ts +++ b/src/api/resources/destination/client/requests/DestinationCreateRequest.ts @@ -19,10 +19,10 @@ export interface DestinationCreateRequest { url?: string; /** Path for the CLI destination */ cliPath?: string; - /** Period to rate limit attempts */ - rateLimitPeriod?: Hookdeck.DestinationCreateRequestRateLimitPeriod; - /** Limit event attempts to receive per period */ + /** Limit of events to receive per period. Refered as Delivery Rate limit in the dashboard and documentation. */ rateLimit?: number; + /** Period to rate limit events by. Refered as Delivery Rate period in the dashboard and documentation. */ + rateLimitPeriod?: Hookdeck.DestinationCreateRequestRateLimitPeriod; httpMethod?: Hookdeck.DestinationHttpMethod; authMethod?: Hookdeck.DestinationAuthMethodConfig; pathForwardingDisabled?: boolean; diff --git a/src/api/resources/destination/client/requests/DestinationUpdateRequest.ts b/src/api/resources/destination/client/requests/DestinationUpdateRequest.ts index 49220d8..2707239 100644 --- a/src/api/resources/destination/client/requests/DestinationUpdateRequest.ts +++ b/src/api/resources/destination/client/requests/DestinationUpdateRequest.ts @@ -17,10 +17,10 @@ export interface DestinationUpdateRequest { url?: string; /** Path for the CLI destination */ cliPath?: string; - /** Period to rate limit attempts */ - rateLimitPeriod?: Hookdeck.DestinationUpdateRequestRateLimitPeriod; - /** Limit event attempts to receive per period */ + /** Limit of events to receive per period. Refered as Delivery Rate limit in the dashboard and documentation. */ rateLimit?: number; + /** Period to rate limit events by. Refered as Delivery Rate period in the dashboard and documentation. */ + rateLimitPeriod?: Hookdeck.DestinationUpdateRequestRateLimitPeriod; httpMethod?: Hookdeck.DestinationHttpMethod; authMethod?: Hookdeck.DestinationAuthMethodConfig; pathForwardingDisabled?: boolean; diff --git a/src/api/resources/destination/client/requests/DestinationUpsertRequest.ts b/src/api/resources/destination/client/requests/DestinationUpsertRequest.ts index 6dd1434..84380d7 100644 --- a/src/api/resources/destination/client/requests/DestinationUpsertRequest.ts +++ b/src/api/resources/destination/client/requests/DestinationUpsertRequest.ts @@ -19,10 +19,10 @@ export interface DestinationUpsertRequest { url?: string; /** Path for the CLI destination */ cliPath?: string; - /** Period to rate limit attempts */ - rateLimitPeriod?: Hookdeck.DestinationUpsertRequestRateLimitPeriod; - /** Limit event attempts to receive per period */ + /** Limit of events to receive per period. Refered as Delivery Rate limit in the dashboard and documentation. */ rateLimit?: number; + /** Period to rate limit events by. Refered as Delivery Rate period in the dashboard and documentation. */ + rateLimitPeriod?: Hookdeck.DestinationUpsertRequestRateLimitPeriod; httpMethod?: Hookdeck.DestinationHttpMethod; authMethod?: Hookdeck.DestinationAuthMethodConfig; pathForwardingDisabled?: boolean; diff --git a/src/api/resources/destination/types/DestinationCreateRequestRateLimitPeriod.ts b/src/api/resources/destination/types/DestinationCreateRequestRateLimitPeriod.ts index c7b9c45..16b5b36 100644 --- a/src/api/resources/destination/types/DestinationCreateRequestRateLimitPeriod.ts +++ b/src/api/resources/destination/types/DestinationCreateRequestRateLimitPeriod.ts @@ -3,7 +3,7 @@ */ /** - * Period to rate limit attempts + * Period to rate limit events by. Refered as Delivery Rate period in the dashboard and documentation. */ export type DestinationCreateRequestRateLimitPeriod = "second" | "minute" | "hour" | "concurrent"; diff --git a/src/api/resources/destination/types/DestinationUpdateRequestRateLimitPeriod.ts b/src/api/resources/destination/types/DestinationUpdateRequestRateLimitPeriod.ts index 61e0a83..e23f63e 100644 --- a/src/api/resources/destination/types/DestinationUpdateRequestRateLimitPeriod.ts +++ b/src/api/resources/destination/types/DestinationUpdateRequestRateLimitPeriod.ts @@ -3,7 +3,7 @@ */ /** - * Period to rate limit attempts + * Period to rate limit events by. Refered as Delivery Rate period in the dashboard and documentation. */ export type DestinationUpdateRequestRateLimitPeriod = "second" | "minute" | "hour" | "concurrent"; diff --git a/src/api/resources/destination/types/DestinationUpsertRequestRateLimitPeriod.ts b/src/api/resources/destination/types/DestinationUpsertRequestRateLimitPeriod.ts index 0635984..97f5c77 100644 --- a/src/api/resources/destination/types/DestinationUpsertRequestRateLimitPeriod.ts +++ b/src/api/resources/destination/types/DestinationUpsertRequestRateLimitPeriod.ts @@ -3,7 +3,7 @@ */ /** - * Period to rate limit attempts + * Period to rate limit events by. Refered as Delivery Rate period in the dashboard and documentation. */ export type DestinationUpsertRequestRateLimitPeriod = "second" | "minute" | "hour" | "concurrent"; diff --git a/src/api/resources/event/client/Client.ts b/src/api/resources/event/client/Client.ts index 07175d0..68bfdd2 100644 --- a/src/api/resources/event/client/Client.ts +++ b/src/api/resources/event/client/Client.ts @@ -17,8 +17,11 @@ export declare namespace Event { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ abortSignal?: AbortSignal; } } @@ -36,7 +39,7 @@ export class Event { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.event.list() + * await client.event.list() */ public async list( request: Hookdeck.EventListRequest = {}, @@ -222,18 +225,20 @@ export class Event { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.EventPaginatedResult.parseOrThrow(_response.body, { + return serializers.EventPaginatedResult.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -246,7 +251,7 @@ export class Event { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -256,7 +261,7 @@ export class Event { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -296,7 +301,7 @@ export class Event { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.event.retrieve("id") + * await client.event.retrieve("id") */ public async retrieve(id: string, requestOptions?: Event.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -309,17 +314,19 @@ export class Event { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.Event.parseOrThrow(_response.body, { + return serializers.Event.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -332,7 +339,7 @@ export class Event { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -372,7 +379,7 @@ export class Event { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.event.retrieveBody("id") + * await client.event.retrieveBody("id") */ public async retrieveBody(id: string, requestOptions?: Event.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -385,17 +392,19 @@ export class Event { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.RawBody.parseOrThrow(_response.body, { + return serializers.RawBody.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -408,7 +417,7 @@ export class Event { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -448,7 +457,7 @@ export class Event { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.event.retry("id") + * await client.event.retry("id") */ public async retry(id: string, requestOptions?: Event.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -461,17 +470,19 @@ export class Event { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.RetriedEvent.parseOrThrow(_response.body, { + return serializers.RetriedEvent.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -484,7 +495,7 @@ export class Event { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -524,7 +535,7 @@ export class Event { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.event.mute("id") + * await client.event.mute("id") */ public async mute(id: string, requestOptions?: Event.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -537,17 +548,19 @@ export class Event { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.Event.parseOrThrow(_response.body, { + return serializers.Event.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -560,7 +573,7 @@ export class Event { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/eventBulkRetry/client/Client.ts b/src/api/resources/eventBulkRetry/client/Client.ts index 1567ffa..9cb3484 100644 --- a/src/api/resources/eventBulkRetry/client/Client.ts +++ b/src/api/resources/eventBulkRetry/client/Client.ts @@ -17,8 +17,11 @@ export declare namespace EventBulkRetry { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ abortSignal?: AbortSignal; } } @@ -36,7 +39,7 @@ export class EventBulkRetry { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.eventBulkRetry.list() + * await client.eventBulkRetry.list() */ public async list( request: Hookdeck.EventBulkRetryListRequest = {}, @@ -114,18 +117,20 @@ export class EventBulkRetry { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.BatchOperationPaginatedResult.parseOrThrow(_response.body, { + return serializers.BatchOperationPaginatedResult.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -138,7 +143,7 @@ export class EventBulkRetry { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -148,7 +153,7 @@ export class EventBulkRetry { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -189,7 +194,7 @@ export class EventBulkRetry { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.eventBulkRetry.create() + * await client.eventBulkRetry.create() */ public async create( request: Hookdeck.EventBulkRetryCreateRequest = {}, @@ -205,20 +210,20 @@ export class EventBulkRetry { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.EventBulkRetryCreateRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - }), + requestType: "json", + body: serializers.EventBulkRetryCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.BatchOperation.parseOrThrow(_response.body, { + return serializers.BatchOperation.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -231,7 +236,7 @@ export class EventBulkRetry { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -241,7 +246,7 @@ export class EventBulkRetry { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -281,7 +286,7 @@ export class EventBulkRetry { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.eventBulkRetry.plan() + * await client.eventBulkRetry.plan() */ public async plan(requestOptions?: EventBulkRetry.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -294,17 +299,19 @@ export class EventBulkRetry { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.EventBulkRetryPlanResponse.parseOrThrow(_response.body, { + return serializers.EventBulkRetryPlanResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -317,7 +324,7 @@ export class EventBulkRetry { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -327,7 +334,7 @@ export class EventBulkRetry { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -367,7 +374,7 @@ export class EventBulkRetry { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.eventBulkRetry.retrieve("id") + * await client.eventBulkRetry.retrieve("id") */ public async retrieve( id: string, @@ -383,17 +390,19 @@ export class EventBulkRetry { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.BatchOperation.parseOrThrow(_response.body, { + return serializers.BatchOperation.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -406,7 +415,7 @@ export class EventBulkRetry { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -446,7 +455,7 @@ export class EventBulkRetry { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.eventBulkRetry.cancel("id") + * await client.eventBulkRetry.cancel("id") */ public async cancel(id: string, requestOptions?: EventBulkRetry.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -459,17 +468,19 @@ export class EventBulkRetry { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.BatchOperation.parseOrThrow(_response.body, { + return serializers.BatchOperation.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -482,7 +493,7 @@ export class EventBulkRetry { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryAttempts.ts b/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryAttempts.ts index a4966fc..55359f0 100644 --- a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryAttempts.ts +++ b/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryAttempts.ts @@ -7,4 +7,4 @@ import * as Hookdeck from "../../../index"; /** * Filter by number of attempts */ -export type EventBulkRetryCreateRequestQueryAttempts = number | Hookdeck.EventBulkRetryCreateRequestQueryAttemptsAll; +export type EventBulkRetryCreateRequestQueryAttempts = number | Hookdeck.Operators; diff --git a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryAttemptsAll.ts b/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryAttemptsAll.ts deleted file mode 100644 index faf42cf..0000000 --- a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryAttemptsAll.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface EventBulkRetryCreateRequestQueryAttemptsAll { - gt?: number; - gte?: number; - le?: number; - lte?: number; - any?: boolean; - all?: boolean; - contains?: number; -} diff --git a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryCreatedAt.ts b/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryCreatedAt.ts index 6359120..b3f46a9 100644 --- a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryCreatedAt.ts +++ b/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryCreatedAt.ts @@ -7,4 +7,4 @@ import * as Hookdeck from "../../../index"; /** * Filter by `created_at` date using a date operator */ -export type EventBulkRetryCreateRequestQueryCreatedAt = Date | Hookdeck.EventBulkRetryCreateRequestQueryCreatedAtAny; +export type EventBulkRetryCreateRequestQueryCreatedAt = Date | Hookdeck.Operators; diff --git a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryLastAttemptAt.ts b/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryLastAttemptAt.ts index 4b3292f..d6b9b20 100644 --- a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryLastAttemptAt.ts +++ b/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryLastAttemptAt.ts @@ -7,6 +7,4 @@ import * as Hookdeck from "../../../index"; /** * Filter by `last_attempt_at` date using a date operator */ -export type EventBulkRetryCreateRequestQueryLastAttemptAt = - | Date - | Hookdeck.EventBulkRetryCreateRequestQueryLastAttemptAtAny; +export type EventBulkRetryCreateRequestQueryLastAttemptAt = Date | Hookdeck.Operators; diff --git a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryLastAttemptAtAny.ts b/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryLastAttemptAtAny.ts deleted file mode 100644 index ea513cb..0000000 --- a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryLastAttemptAtAny.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface EventBulkRetryCreateRequestQueryLastAttemptAtAny { - gt?: Date; - gte?: Date; - le?: Date; - lte?: Date; - any?: boolean; -} diff --git a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryResponseStatus.ts b/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryResponseStatus.ts index 720b2a9..49b2803 100644 --- a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryResponseStatus.ts +++ b/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryResponseStatus.ts @@ -7,7 +7,4 @@ import * as Hookdeck from "../../../index"; /** * Filter by HTTP response status code */ -export type EventBulkRetryCreateRequestQueryResponseStatus = - | number - | Hookdeck.EventBulkRetryCreateRequestQueryResponseStatusAll - | number[]; +export type EventBulkRetryCreateRequestQueryResponseStatus = number | Hookdeck.Operators | number[]; diff --git a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryResponseStatusAll.ts b/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryResponseStatusAll.ts deleted file mode 100644 index 61736d9..0000000 --- a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryResponseStatusAll.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface EventBulkRetryCreateRequestQueryResponseStatusAll { - gt?: number; - gte?: number; - le?: number; - lte?: number; - any?: boolean; - all?: boolean; - contains?: number; -} diff --git a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQuerySuccessfulAt.ts b/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQuerySuccessfulAt.ts index 30b1608..7194deb 100644 --- a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQuerySuccessfulAt.ts +++ b/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQuerySuccessfulAt.ts @@ -7,6 +7,4 @@ import * as Hookdeck from "../../../index"; /** * Filter by `successful_at` date using a date operator */ -export type EventBulkRetryCreateRequestQuerySuccessfulAt = - | Date - | Hookdeck.EventBulkRetryCreateRequestQuerySuccessfulAtAny; +export type EventBulkRetryCreateRequestQuerySuccessfulAt = Date | Hookdeck.Operators; diff --git a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQuerySuccessfulAtAny.ts b/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQuerySuccessfulAtAny.ts deleted file mode 100644 index 222c612..0000000 --- a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQuerySuccessfulAtAny.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface EventBulkRetryCreateRequestQuerySuccessfulAtAny { - gt?: Date; - gte?: Date; - le?: Date; - lte?: Date; - any?: boolean; -} diff --git a/src/api/resources/eventBulkRetry/types/index.ts b/src/api/resources/eventBulkRetry/types/index.ts index 6a43051..4372a8e 100644 --- a/src/api/resources/eventBulkRetry/types/index.ts +++ b/src/api/resources/eventBulkRetry/types/index.ts @@ -5,18 +5,13 @@ export * from "./EventBulkRetryCreateRequestQueryStatus"; export * from "./EventBulkRetryCreateRequestQueryWebhookId"; export * from "./EventBulkRetryCreateRequestQueryDestinationId"; export * from "./EventBulkRetryCreateRequestQuerySourceId"; -export * from "./EventBulkRetryCreateRequestQueryAttemptsAll"; export * from "./EventBulkRetryCreateRequestQueryAttempts"; -export * from "./EventBulkRetryCreateRequestQueryResponseStatusAll"; export * from "./EventBulkRetryCreateRequestQueryResponseStatus"; -export * from "./EventBulkRetryCreateRequestQuerySuccessfulAtAny"; export * from "./EventBulkRetryCreateRequestQuerySuccessfulAt"; -export * from "./EventBulkRetryCreateRequestQueryCreatedAtAny"; export * from "./EventBulkRetryCreateRequestQueryCreatedAt"; export * from "./EventBulkRetryCreateRequestQueryErrorCode"; export * from "./EventBulkRetryCreateRequestQueryCliIdAll"; export * from "./EventBulkRetryCreateRequestQueryCliId"; -export * from "./EventBulkRetryCreateRequestQueryLastAttemptAtAny"; export * from "./EventBulkRetryCreateRequestQueryLastAttemptAt"; export * from "./EventBulkRetryCreateRequestQueryHeadersOne"; export * from "./EventBulkRetryCreateRequestQueryHeaders"; diff --git a/src/api/resources/ignoredEventBulkRetry/client/Client.ts b/src/api/resources/ignoredEventBulkRetry/client/Client.ts index 7c94012..b78b175 100644 --- a/src/api/resources/ignoredEventBulkRetry/client/Client.ts +++ b/src/api/resources/ignoredEventBulkRetry/client/Client.ts @@ -17,8 +17,11 @@ export declare namespace IgnoredEventBulkRetry { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ abortSignal?: AbortSignal; } } @@ -36,7 +39,7 @@ export class IgnoredEventBulkRetry { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.ignoredEventBulkRetry.list() + * await client.ignoredEventBulkRetry.list() */ public async list( request: Hookdeck.IgnoredEventBulkRetryListRequest = {}, @@ -114,18 +117,20 @@ export class IgnoredEventBulkRetry { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.BatchOperationPaginatedResult.parseOrThrow(_response.body, { + return serializers.BatchOperationPaginatedResult.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -138,7 +143,7 @@ export class IgnoredEventBulkRetry { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -148,7 +153,7 @@ export class IgnoredEventBulkRetry { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -189,7 +194,7 @@ export class IgnoredEventBulkRetry { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.ignoredEventBulkRetry.create() + * await client.ignoredEventBulkRetry.create() */ public async create( request: Hookdeck.IgnoredEventBulkRetryCreateRequest = {}, @@ -205,12 +210,14 @@ export class IgnoredEventBulkRetry { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.IgnoredEventBulkRetryCreateRequest.jsonOrThrow(request, { + requestType: "json", + body: serializers.IgnoredEventBulkRetryCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -218,7 +225,7 @@ export class IgnoredEventBulkRetry { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.BatchOperation.parseOrThrow(_response.body, { + return serializers.BatchOperation.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -231,7 +238,7 @@ export class IgnoredEventBulkRetry { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -241,7 +248,7 @@ export class IgnoredEventBulkRetry { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -281,7 +288,7 @@ export class IgnoredEventBulkRetry { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.ignoredEventBulkRetry.plan() + * await client.ignoredEventBulkRetry.plan() */ public async plan( requestOptions?: IgnoredEventBulkRetry.RequestOptions @@ -296,17 +303,19 @@ export class IgnoredEventBulkRetry { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.IgnoredEventBulkRetryPlanResponse.parseOrThrow(_response.body, { + return serializers.IgnoredEventBulkRetryPlanResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -319,7 +328,7 @@ export class IgnoredEventBulkRetry { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -329,7 +338,7 @@ export class IgnoredEventBulkRetry { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -369,7 +378,7 @@ export class IgnoredEventBulkRetry { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.ignoredEventBulkRetry.retrieve("id") + * await client.ignoredEventBulkRetry.retrieve("id") */ public async retrieve( id: string, @@ -385,17 +394,19 @@ export class IgnoredEventBulkRetry { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.BatchOperation.parseOrThrow(_response.body, { + return serializers.BatchOperation.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -408,7 +419,7 @@ export class IgnoredEventBulkRetry { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -448,7 +459,7 @@ export class IgnoredEventBulkRetry { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.ignoredEventBulkRetry.cancel("id") + * await client.ignoredEventBulkRetry.cancel("id") */ public async cancel( id: string, @@ -464,17 +475,19 @@ export class IgnoredEventBulkRetry { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.BatchOperation.parseOrThrow(_response.body, { + return serializers.BatchOperation.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -487,7 +500,7 @@ export class IgnoredEventBulkRetry { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/issue/client/Client.ts b/src/api/resources/issue/client/Client.ts index d39818f..350a829 100644 --- a/src/api/resources/issue/client/Client.ts +++ b/src/api/resources/issue/client/Client.ts @@ -17,8 +17,11 @@ export declare namespace Issue { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ abortSignal?: AbortSignal; } } @@ -36,7 +39,7 @@ export class Issue { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.issue.list({ + * await client.issue.list({ * id: "iss_YXKv5OdJXCiVwkPhGy", * issueTriggerId: "it_BXKv5OdJXCiVwkPhGy", * mergedWith: "iss_AXKv3OdJXCiKlkPhDz" @@ -141,18 +144,20 @@ export class Issue { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.IssueWithDataPaginatedResult.parseOrThrow(_response.body, { + return serializers.IssueWithDataPaginatedResult.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -165,7 +170,7 @@ export class Issue { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -175,7 +180,7 @@ export class Issue { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -215,7 +220,7 @@ export class Issue { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.issue.count({ + * await client.issue.count({ * id: "iss_YXKv5OdJXCiVwkPhGy", * issueTriggerId: "it_BXKv5OdJXCiVwkPhGy", * mergedWith: "iss_AXKv3OdJXCiKlkPhDz" @@ -320,18 +325,20 @@ export class Issue { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.IssueCount.parseOrThrow(_response.body, { + return serializers.IssueCount.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -344,7 +351,7 @@ export class Issue { switch (_response.error.statusCode) { case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -384,7 +391,7 @@ export class Issue { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.issue.retrieve("string") + * await client.issue.retrieve("id") */ public async retrieve(id: string, requestOptions?: Issue.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -397,17 +404,19 @@ export class Issue { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.IssueWithData.parseOrThrow(_response.body, { + return serializers.IssueWithData.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -420,7 +429,7 @@ export class Issue { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -462,7 +471,7 @@ export class Issue { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.issue.update("string", { + * await client.issue.update("id", { * status: Hookdeck.IssueUpdateRequestStatus.Opened * }) */ @@ -481,18 +490,20 @@ export class Issue { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.IssueUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.IssueUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Issue.parseOrThrow(_response.body, { + return serializers.Issue.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -505,7 +516,7 @@ export class Issue { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -515,7 +526,7 @@ export class Issue { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -555,7 +566,7 @@ export class Issue { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.issue.dismiss("string") + * await client.issue.dismiss("id") */ public async dismiss(id: string, requestOptions?: Issue.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -568,17 +579,19 @@ export class Issue { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.Issue.parseOrThrow(_response.body, { + return serializers.Issue.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -591,7 +604,7 @@ export class Issue { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/issueTrigger/client/Client.ts b/src/api/resources/issueTrigger/client/Client.ts index 9abddaf..d17136e 100644 --- a/src/api/resources/issueTrigger/client/Client.ts +++ b/src/api/resources/issueTrigger/client/Client.ts @@ -17,8 +17,11 @@ export declare namespace IssueTrigger { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ abortSignal?: AbortSignal; } } @@ -36,7 +39,7 @@ export class IssueTrigger { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.issueTrigger.list() + * await client.issueTrigger.list() */ public async list( request: Hookdeck.IssueTriggerListRequest = {}, @@ -86,18 +89,20 @@ export class IssueTrigger { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.IssueTriggerPaginatedResult.parseOrThrow(_response.body, { + return serializers.IssueTriggerPaginatedResult.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -110,7 +115,7 @@ export class IssueTrigger { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -120,7 +125,7 @@ export class IssueTrigger { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -161,7 +166,7 @@ export class IssueTrigger { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.issueTrigger.create({ + * await client.issueTrigger.create({ * type: Hookdeck.IssueType.Delivery * }) */ @@ -179,18 +184,20 @@ export class IssueTrigger { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.IssueTriggerCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.IssueTriggerCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.IssueTrigger.parseOrThrow(_response.body, { + return serializers.IssueTrigger.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -203,7 +210,7 @@ export class IssueTrigger { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -213,7 +220,7 @@ export class IssueTrigger { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -254,7 +261,7 @@ export class IssueTrigger { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.issueTrigger.upsert({ + * await client.issueTrigger.upsert({ * type: Hookdeck.IssueType.Delivery, * name: "name" * }) @@ -273,18 +280,20 @@ export class IssueTrigger { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.IssueTriggerUpsertRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.IssueTriggerUpsertRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.IssueTrigger.parseOrThrow(_response.body, { + return serializers.IssueTrigger.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -297,7 +306,7 @@ export class IssueTrigger { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -307,7 +316,7 @@ export class IssueTrigger { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -347,7 +356,7 @@ export class IssueTrigger { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.issueTrigger.retrieve("id") + * await client.issueTrigger.retrieve("id") */ public async retrieve(id: string, requestOptions?: IssueTrigger.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -360,17 +369,19 @@ export class IssueTrigger { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.IssueTrigger.parseOrThrow(_response.body, { + return serializers.IssueTrigger.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -383,7 +394,7 @@ export class IssueTrigger { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -425,7 +436,7 @@ export class IssueTrigger { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.issueTrigger.update("id") + * await client.issueTrigger.update("id") */ public async update( id: string, @@ -442,18 +453,20 @@ export class IssueTrigger { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.IssueTriggerUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.IssueTriggerUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.IssueTrigger.parseOrThrow(_response.body, { + return serializers.IssueTrigger.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -466,7 +479,7 @@ export class IssueTrigger { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -476,7 +489,7 @@ export class IssueTrigger { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -516,7 +529,7 @@ export class IssueTrigger { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.issueTrigger.delete("id") + * await client.issueTrigger.delete("id") */ public async delete( id: string, @@ -532,17 +545,19 @@ export class IssueTrigger { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.DeletedIssueTriggerResponse.parseOrThrow(_response.body, { + return serializers.DeletedIssueTriggerResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -555,7 +570,7 @@ export class IssueTrigger { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -595,7 +610,7 @@ export class IssueTrigger { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.issueTrigger.disable("id") + * await client.issueTrigger.disable("id") */ public async disable(id: string, requestOptions?: IssueTrigger.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -608,17 +623,19 @@ export class IssueTrigger { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.IssueTrigger.parseOrThrow(_response.body, { + return serializers.IssueTrigger.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -631,7 +648,7 @@ export class IssueTrigger { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -671,7 +688,7 @@ export class IssueTrigger { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.issueTrigger.enable("id") + * await client.issueTrigger.enable("id") */ public async enable(id: string, requestOptions?: IssueTrigger.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -684,17 +701,19 @@ export class IssueTrigger { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.IssueTrigger.parseOrThrow(_response.body, { + return serializers.IssueTrigger.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -707,7 +726,7 @@ export class IssueTrigger { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/notification/client/Client.ts b/src/api/resources/notification/client/Client.ts index c7b640f..93d4adf 100644 --- a/src/api/resources/notification/client/Client.ts +++ b/src/api/resources/notification/client/Client.ts @@ -17,8 +17,11 @@ export declare namespace Notification { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ abortSignal?: AbortSignal; } } @@ -33,7 +36,7 @@ export class Notification { * @param {Notification.RequestOptions} requestOptions - Request-specific configuration. * * @example - * await hookdeck.notification.update() + * await client.notification.update() */ public async update( request: Hookdeck.NotificationUpdateRequest = {}, @@ -49,18 +52,20 @@ export class Notification { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.NotificationUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.NotificationUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.ToggleWebhookNotifications.parseOrThrow(_response.body, { + return serializers.ToggleWebhookNotifications.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/request/client/Client.ts b/src/api/resources/request/client/Client.ts index 86945b5..f11fed9 100644 --- a/src/api/resources/request/client/Client.ts +++ b/src/api/resources/request/client/Client.ts @@ -17,8 +17,11 @@ export declare namespace Request { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ abortSignal?: AbortSignal; } } @@ -36,7 +39,7 @@ export class Request { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.request.list() + * await client.request.list() */ public async list( request: Hookdeck.RequestListRequest = {}, @@ -167,18 +170,20 @@ export class Request { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.RequestPaginatedResult.parseOrThrow(_response.body, { + return serializers.RequestPaginatedResult.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -191,7 +196,7 @@ export class Request { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -201,7 +206,7 @@ export class Request { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -241,7 +246,7 @@ export class Request { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.request.retrieve("id") + * await client.request.retrieve("id") */ public async retrieve(id: string, requestOptions?: Request.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -254,17 +259,19 @@ export class Request { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.Request.parseOrThrow(_response.body, { + return serializers.Request.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -277,7 +284,7 @@ export class Request { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -317,7 +324,7 @@ export class Request { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.request.retrieveBody("id") + * await client.request.retrieveBody("id") */ public async retrieveBody(id: string, requestOptions?: Request.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -330,17 +337,19 @@ export class Request { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.RawBody.parseOrThrow(_response.body, { + return serializers.RawBody.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -353,7 +362,7 @@ export class Request { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -396,7 +405,7 @@ export class Request { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.request.retry("id", { + * await client.request.retry("id", { * webhookIds: ["webhook_ids"] * }) */ @@ -415,18 +424,20 @@ export class Request { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.RequestRetryRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.RequestRetryRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.RetryRequest.parseOrThrow(_response.body, { + return serializers.RetryRequest.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -439,7 +450,7 @@ export class Request { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -449,7 +460,7 @@ export class Request { ); case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -459,7 +470,7 @@ export class Request { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -502,7 +513,7 @@ export class Request { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.request.listEvent("id") + * await client.request.listEvent("id") */ public async listEvent( id: string, @@ -689,18 +700,20 @@ export class Request { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.EventPaginatedResult.parseOrThrow(_response.body, { + return serializers.EventPaginatedResult.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -713,7 +726,7 @@ export class Request { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -723,7 +736,7 @@ export class Request { ); case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -733,7 +746,7 @@ export class Request { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -776,7 +789,7 @@ export class Request { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.request.listIgnoredEvent("id") + * await client.request.listIgnoredEvent("id") */ public async listIgnoredEvent( id: string, @@ -823,18 +836,20 @@ export class Request { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.IgnoredEventPaginatedResult.parseOrThrow(_response.body, { + return serializers.IgnoredEventPaginatedResult.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -847,7 +862,7 @@ export class Request { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -857,7 +872,7 @@ export class Request { ); case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -867,7 +882,7 @@ export class Request { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/requestBulkRetry/client/Client.ts b/src/api/resources/requestBulkRetry/client/Client.ts index 308a6ef..ff2daf6 100644 --- a/src/api/resources/requestBulkRetry/client/Client.ts +++ b/src/api/resources/requestBulkRetry/client/Client.ts @@ -17,8 +17,11 @@ export declare namespace RequestBulkRetry { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ abortSignal?: AbortSignal; } } @@ -36,7 +39,7 @@ export class RequestBulkRetry { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.requestBulkRetry.list() + * await client.requestBulkRetry.list() */ public async list( request: Hookdeck.RequestBulkRetryListRequest = {}, @@ -114,18 +117,20 @@ export class RequestBulkRetry { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.BatchOperationPaginatedResult.parseOrThrow(_response.body, { + return serializers.BatchOperationPaginatedResult.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -138,7 +143,7 @@ export class RequestBulkRetry { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -148,7 +153,7 @@ export class RequestBulkRetry { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -189,7 +194,7 @@ export class RequestBulkRetry { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.requestBulkRetry.create() + * await client.requestBulkRetry.create() */ public async create( request: Hookdeck.RequestBulkRetryCreateRequest = {}, @@ -205,20 +210,20 @@ export class RequestBulkRetry { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.RequestBulkRetryCreateRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - }), + requestType: "json", + body: serializers.RequestBulkRetryCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.BatchOperation.parseOrThrow(_response.body, { + return serializers.BatchOperation.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -231,7 +236,7 @@ export class RequestBulkRetry { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -241,7 +246,7 @@ export class RequestBulkRetry { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -281,7 +286,7 @@ export class RequestBulkRetry { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.requestBulkRetry.plan() + * await client.requestBulkRetry.plan() */ public async plan( requestOptions?: RequestBulkRetry.RequestOptions @@ -296,17 +301,19 @@ export class RequestBulkRetry { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.RequestBulkRetryPlanResponse.parseOrThrow(_response.body, { + return serializers.RequestBulkRetryPlanResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -319,7 +326,7 @@ export class RequestBulkRetry { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -329,7 +336,7 @@ export class RequestBulkRetry { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -369,7 +376,7 @@ export class RequestBulkRetry { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.requestBulkRetry.retrieve("id") + * await client.requestBulkRetry.retrieve("id") */ public async retrieve( id: string, @@ -385,17 +392,19 @@ export class RequestBulkRetry { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.BatchOperation.parseOrThrow(_response.body, { + return serializers.BatchOperation.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -408,7 +417,7 @@ export class RequestBulkRetry { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -448,7 +457,7 @@ export class RequestBulkRetry { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.requestBulkRetry.cancel("id") + * await client.requestBulkRetry.cancel("id") */ public async cancel( id: string, @@ -464,17 +473,19 @@ export class RequestBulkRetry { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.BatchOperation.parseOrThrow(_response.body, { + return serializers.BatchOperation.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -487,7 +498,7 @@ export class RequestBulkRetry { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryEventsCount.ts b/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryEventsCount.ts index c3ba284..08f713e 100644 --- a/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryEventsCount.ts +++ b/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryEventsCount.ts @@ -7,7 +7,4 @@ import * as Hookdeck from "../../../index"; /** * Filter by count of events */ -export type RequestBulkRetryCreateRequestQueryEventsCount = - | number - | Hookdeck.RequestBulkRetryCreateRequestQueryEventsCountAll - | number[]; +export type RequestBulkRetryCreateRequestQueryEventsCount = number | Hookdeck.Operators | number[]; diff --git a/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryEventsCountAll.ts b/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryEventsCountAll.ts deleted file mode 100644 index 2488774..0000000 --- a/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryEventsCountAll.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface RequestBulkRetryCreateRequestQueryEventsCountAll { - gt?: number; - gte?: number; - le?: number; - lte?: number; - any?: boolean; - all?: boolean; - contains?: number; -} diff --git a/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIgnoredCount.ts b/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIgnoredCount.ts index fed60d5..308b791 100644 --- a/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIgnoredCount.ts +++ b/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIgnoredCount.ts @@ -7,7 +7,4 @@ import * as Hookdeck from "../../../index"; /** * Filter by count of ignored events */ -export type RequestBulkRetryCreateRequestQueryIgnoredCount = - | number - | Hookdeck.RequestBulkRetryCreateRequestQueryIgnoredCountAll - | number[]; +export type RequestBulkRetryCreateRequestQueryIgnoredCount = number | Hookdeck.Operators | number[]; diff --git a/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIgnoredCountAll.ts b/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIgnoredCountAll.ts deleted file mode 100644 index dc4ac9c..0000000 --- a/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIgnoredCountAll.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface RequestBulkRetryCreateRequestQueryIgnoredCountAll { - gt?: number; - gte?: number; - le?: number; - lte?: number; - any?: boolean; - all?: boolean; - contains?: number; -} diff --git a/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIngestedAt.ts b/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIngestedAt.ts index e3e37a8..0455387 100644 --- a/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIngestedAt.ts +++ b/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIngestedAt.ts @@ -7,6 +7,4 @@ import * as Hookdeck from "../../../index"; /** * Filter by event ingested date */ -export type RequestBulkRetryCreateRequestQueryIngestedAt = - | Date - | Hookdeck.RequestBulkRetryCreateRequestQueryIngestedAtAny; +export type RequestBulkRetryCreateRequestQueryIngestedAt = Date | Hookdeck.Operators; diff --git a/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIngestedAtAny.ts b/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIngestedAtAny.ts deleted file mode 100644 index 616d674..0000000 --- a/src/api/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIngestedAtAny.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface RequestBulkRetryCreateRequestQueryIngestedAtAny { - gt?: Date; - gte?: Date; - le?: Date; - lte?: Date; - any?: boolean; -} diff --git a/src/api/resources/requestBulkRetry/types/index.ts b/src/api/resources/requestBulkRetry/types/index.ts index bbb5009..053e0c0 100644 --- a/src/api/resources/requestBulkRetry/types/index.ts +++ b/src/api/resources/requestBulkRetry/types/index.ts @@ -10,11 +10,8 @@ export * from "./RequestBulkRetryCreateRequestQueryBodyOne"; export * from "./RequestBulkRetryCreateRequestQueryBody"; export * from "./RequestBulkRetryCreateRequestQueryParsedQueryOne"; export * from "./RequestBulkRetryCreateRequestQueryParsedQuery"; -export * from "./RequestBulkRetryCreateRequestQueryIgnoredCountAll"; export * from "./RequestBulkRetryCreateRequestQueryIgnoredCount"; -export * from "./RequestBulkRetryCreateRequestQueryEventsCountAll"; export * from "./RequestBulkRetryCreateRequestQueryEventsCount"; -export * from "./RequestBulkRetryCreateRequestQueryIngestedAtAny"; export * from "./RequestBulkRetryCreateRequestQueryIngestedAt"; export * from "./RequestBulkRetryCreateRequestQueryBulkRetryId"; export * from "./RequestBulkRetryCreateRequestQuery"; diff --git a/src/api/resources/source/client/Client.ts b/src/api/resources/source/client/Client.ts index 0bf6aa3..3e29320 100644 --- a/src/api/resources/source/client/Client.ts +++ b/src/api/resources/source/client/Client.ts @@ -17,8 +17,11 @@ export declare namespace Source { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ abortSignal?: AbortSignal; } } @@ -36,7 +39,7 @@ export class Source { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.source.list() + * await client.source.list() */ public async list( request: Hookdeck.SourceListRequest = {}, @@ -94,18 +97,20 @@ export class Source { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.SourcePaginatedResult.parseOrThrow(_response.body, { + return serializers.SourcePaginatedResult.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -118,7 +123,7 @@ export class Source { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -128,7 +133,7 @@ export class Source { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -169,7 +174,7 @@ export class Source { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.source.create({ + * await client.source.create({ * name: "name" * }) */ @@ -187,18 +192,20 @@ export class Source { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.SourceCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.SourceCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Source.parseOrThrow(_response.body, { + return serializers.Source.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -211,7 +218,7 @@ export class Source { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -221,7 +228,7 @@ export class Source { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -262,7 +269,7 @@ export class Source { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.source.upsert({ + * await client.source.upsert({ * name: "name" * }) */ @@ -280,18 +287,20 @@ export class Source { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.SourceUpsertRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.SourceUpsertRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Source.parseOrThrow(_response.body, { + return serializers.Source.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -304,7 +313,7 @@ export class Source { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -314,7 +323,7 @@ export class Source { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -356,7 +365,7 @@ export class Source { * @throws {@link Hookdeck.GoneError} * * @example - * await hookdeck.source.retrieve("id") + * await client.source.retrieve("id") */ public async retrieve( id: string, @@ -379,18 +388,20 @@ export class Source { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.Source.parseOrThrow(_response.body, { + return serializers.Source.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -403,7 +414,7 @@ export class Source { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -413,7 +424,7 @@ export class Source { ); case 410: throw new Hookdeck.GoneError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -456,7 +467,7 @@ export class Source { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.source.update("id") + * await client.source.update("id") */ public async update( id: string, @@ -473,18 +484,20 @@ export class Source { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.SourceUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.SourceUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Source.parseOrThrow(_response.body, { + return serializers.Source.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -497,7 +510,7 @@ export class Source { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -507,7 +520,7 @@ export class Source { ); case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -517,7 +530,7 @@ export class Source { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -557,7 +570,7 @@ export class Source { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.source.delete("id") + * await client.source.delete("id") */ public async delete(id: string, requestOptions?: Source.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -570,17 +583,19 @@ export class Source { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.SourceDeleteResponse.parseOrThrow(_response.body, { + return serializers.SourceDeleteResponse.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -593,7 +608,7 @@ export class Source { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -633,7 +648,7 @@ export class Source { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.source.disable("id") + * await client.source.disable("id") */ public async disable(id: string, requestOptions?: Source.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -646,17 +661,19 @@ export class Source { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.Source.parseOrThrow(_response.body, { + return serializers.Source.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -669,7 +686,7 @@ export class Source { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -709,7 +726,7 @@ export class Source { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.source.enable("id") + * await client.source.enable("id") */ public async enable(id: string, requestOptions?: Source.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -722,17 +739,19 @@ export class Source { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.Source.parseOrThrow(_response.body, { + return serializers.Source.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -745,7 +764,7 @@ export class Source { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/resources/transformation/client/Client.ts b/src/api/resources/transformation/client/Client.ts index a4d1ae8..8194951 100644 --- a/src/api/resources/transformation/client/Client.ts +++ b/src/api/resources/transformation/client/Client.ts @@ -17,8 +17,11 @@ export declare namespace Transformation { } interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; + /** A hook to abort the request. */ abortSignal?: AbortSignal; } } @@ -36,7 +39,7 @@ export class Transformation { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.transformation.list() + * await client.transformation.list() */ public async list( request: Hookdeck.TransformationListRequest = {}, @@ -86,18 +89,20 @@ export class Transformation { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.TransformationPaginatedResult.parseOrThrow(_response.body, { + return serializers.TransformationPaginatedResult.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -110,7 +115,7 @@ export class Transformation { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -120,7 +125,7 @@ export class Transformation { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -161,7 +166,7 @@ export class Transformation { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.transformation.create({ + * await client.transformation.create({ * name: "name", * code: "code" * }) @@ -180,20 +185,20 @@ export class Transformation { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.TransformationCreateRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - }), + requestType: "json", + body: serializers.TransformationCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Transformation.parseOrThrow(_response.body, { + return serializers.Transformation.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -206,7 +211,7 @@ export class Transformation { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -216,7 +221,7 @@ export class Transformation { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -257,7 +262,7 @@ export class Transformation { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.transformation.upsert({ + * await client.transformation.upsert({ * name: "name", * code: "code" * }) @@ -276,20 +281,20 @@ export class Transformation { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.TransformationUpsertRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - }), + requestType: "json", + body: serializers.TransformationUpsertRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Transformation.parseOrThrow(_response.body, { + return serializers.Transformation.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -302,7 +307,7 @@ export class Transformation { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -312,7 +317,7 @@ export class Transformation { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -352,7 +357,7 @@ export class Transformation { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.transformation.retrieve("id") + * await client.transformation.retrieve("id") */ public async retrieve( id: string, @@ -368,17 +373,19 @@ export class Transformation { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.Transformation.parseOrThrow(_response.body, { + return serializers.Transformation.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -391,7 +398,7 @@ export class Transformation { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -434,7 +441,7 @@ export class Transformation { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.transformation.update("id") + * await client.transformation.update("id") */ public async update( id: string, @@ -451,20 +458,20 @@ export class Transformation { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.TransformationUpdateRequest.jsonOrThrow(request, { - unrecognizedObjectKeys: "strip", - }), + requestType: "json", + body: serializers.TransformationUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.Transformation.parseOrThrow(_response.body, { + return serializers.Transformation.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -477,7 +484,7 @@ export class Transformation { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -487,7 +494,7 @@ export class Transformation { ); case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -497,7 +504,7 @@ export class Transformation { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -538,7 +545,7 @@ export class Transformation { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.transformation.run() + * await client.transformation.run() */ public async run( request: Hookdeck.TransformationRunRequest = {}, @@ -554,18 +561,20 @@ export class Transformation { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, contentType: "application/json", - body: await serializers.TransformationRunRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestType: "json", + body: serializers.TransformationRunRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return await serializers.TransformationExecutorOutput.parseOrThrow(_response.body, { + return serializers.TransformationExecutorOutput.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -578,7 +587,7 @@ export class Transformation { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -588,7 +597,7 @@ export class Transformation { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -630,7 +639,7 @@ export class Transformation { * @throws {@link Hookdeck.UnprocessableEntityError} * * @example - * await hookdeck.transformation.listExecution("id") + * await client.transformation.listExecution("id") */ public async listExecution( id: string, @@ -693,18 +702,20 @@ export class Transformation { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.TransformationExecutionPaginatedResult.parseOrThrow(_response.body, { + return serializers.TransformationExecutionPaginatedResult.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -717,7 +728,7 @@ export class Transformation { switch (_response.error.statusCode) { case 400: throw new Hookdeck.BadRequestError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -727,7 +738,7 @@ export class Transformation { ); case 422: throw new Hookdeck.UnprocessableEntityError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -768,7 +779,7 @@ export class Transformation { * @throws {@link Hookdeck.NotFoundError} * * @example - * await hookdeck.transformation.retrieveExecution("id", "execution_id") + * await client.transformation.retrieveExecution("id", "execution_id") */ public async retrieveExecution( id: string, @@ -785,17 +796,19 @@ export class Transformation { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@hookdeck/sdk", - "X-Fern-SDK-Version": "0.4.0", + "X-Fern-SDK-Version": "0.5.0", + "User-Agent": "@hookdeck/sdk/0.5.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.TransformationExecution.parseOrThrow(_response.body, { + return serializers.TransformationExecution.parseOrThrow(_response.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, @@ -808,7 +821,7 @@ export class Transformation { switch (_response.error.statusCode) { case 404: throw new Hookdeck.NotFoundError( - await serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { + serializers.ApiErrorResponse.parseOrThrow(_response.error.body, { unrecognizedObjectKeys: "passthrough", allowUnrecognizedUnionMembers: true, allowUnrecognizedEnumValues: true, diff --git a/src/api/types/AttemptState.ts b/src/api/types/AttemptState.ts deleted file mode 100644 index 8001de4..0000000 --- a/src/api/types/AttemptState.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export type AttemptState = "DELIVERING" | "QUEUED" | "PENDING" | "COMPLETED" | "HOLD"; - -export const AttemptState = { - Delivering: "DELIVERING", - Queued: "QUEUED", - Pending: "PENDING", - Completed: "COMPLETED", - Hold: "HOLD", -} as const; diff --git a/src/api/types/AttemptStatus.ts b/src/api/types/AttemptStatus.ts index 52ae0f7..fe2a23b 100644 --- a/src/api/types/AttemptStatus.ts +++ b/src/api/types/AttemptStatus.ts @@ -5,11 +5,9 @@ /** * Attempt status */ -export type AttemptStatus = "QUEUED" | "FAILED" | "SUCCESSFUL" | "HOLD"; +export type AttemptStatus = "FAILED" | "SUCCESSFUL"; export const AttemptStatus = { - Queued: "QUEUED", Failed: "FAILED", Successful: "SUCCESSFUL", - Hold: "HOLD", } as const; diff --git a/src/api/types/Destination.ts b/src/api/types/Destination.ts index f0bd302..64ccaf9 100644 --- a/src/api/types/Destination.ts +++ b/src/api/types/Destination.ts @@ -21,7 +21,7 @@ export interface Destination { url?: string; /** Path for the CLI destination */ cliPath?: string; - /** Limit delivery rate of event attempts to receive per period. */ + /** Limit of events to receive per period. Refered as Delivery Rate limit in the dashboard and documentation. */ rateLimit?: number; rateLimitPeriod?: Hookdeck.DestinationRateLimitPeriod; httpMethod?: Hookdeck.DestinationHttpMethod; diff --git a/src/api/types/DestinationAuthMethodAwsSignatureConfig.ts b/src/api/types/DestinationAuthMethodAwsSignatureConfig.ts index 3f0e9e5..3733c2d 100644 --- a/src/api/types/DestinationAuthMethodAwsSignatureConfig.ts +++ b/src/api/types/DestinationAuthMethodAwsSignatureConfig.ts @@ -10,4 +10,8 @@ export interface DestinationAuthMethodAwsSignatureConfig { accessKeyId: string; /** AWS secret access key */ secretAccessKey: string; + /** AWS region */ + region?: string; + /** AWS service */ + service?: string; } diff --git a/src/api/types/DestinationAuthMethodOAuth2ClientCredentialsConfig.ts b/src/api/types/DestinationAuthMethodOAuth2ClientCredentialsConfig.ts index 838a2d7..4e50b8f 100644 --- a/src/api/types/DestinationAuthMethodOAuth2ClientCredentialsConfig.ts +++ b/src/api/types/DestinationAuthMethodOAuth2ClientCredentialsConfig.ts @@ -16,6 +16,6 @@ export interface DestinationAuthMethodOAuth2ClientCredentialsConfig { scope?: string; /** URL of the auth server */ authServer: string; - /** Basic (default) or Bearer Authentication */ + /** Basic (default), Bearer Authentication or x-www-form-urlencoded */ authenticationType?: Hookdeck.DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType; } diff --git a/src/api/types/DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType.ts b/src/api/types/DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType.ts index e584449..1cbf982 100644 --- a/src/api/types/DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType.ts +++ b/src/api/types/DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType.ts @@ -3,11 +3,15 @@ */ /** - * Basic (default) or Bearer Authentication + * Basic (default), Bearer Authentication or x-www-form-urlencoded */ -export type DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType = "basic" | "bearer"; +export type DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType = + | "basic" + | "bearer" + | "x-www-form-urlencoded"; export const DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType = { Basic: "basic", Bearer: "bearer", + XWwwFormUrlencoded: "x-www-form-urlencoded", } as const; diff --git a/src/api/types/DestinationRateLimitPeriod.ts b/src/api/types/DestinationRateLimitPeriod.ts index 61cac14..a8943fa 100644 --- a/src/api/types/DestinationRateLimitPeriod.ts +++ b/src/api/types/DestinationRateLimitPeriod.ts @@ -3,7 +3,7 @@ */ /** - * Period to rate limit attempts + * Period to rate limit events by. Refered as Delivery Rate period in the dashboard and documentation. */ export type DestinationRateLimitPeriod = "second" | "minute" | "hour" | "concurrent"; diff --git a/src/api/types/EventAttempt.ts b/src/api/types/EventAttempt.ts index 4d199db..42eb0e6 100644 --- a/src/api/types/EventAttempt.ts +++ b/src/api/types/EventAttempt.ts @@ -7,10 +7,12 @@ import * as Hookdeck from "../index"; export interface EventAttempt { /** Attempt ID */ id: string; - /** Team ID */ + /** ID of the project */ teamId: string; /** Event ID */ eventId: string; + /** Destination ID */ + destinationId: string; /** Attempt's HTTP response code */ responseStatus?: number; /** Sequential number of attempts (up to and including this one) made for the associated event */ @@ -39,6 +41,4 @@ export interface EventAttempt { updatedAt: Date; /** Date the attempt was created */ createdAt: Date; - state?: Hookdeck.AttemptState; - destinationId?: string; } diff --git a/src/api/types/FilteredMeta.ts b/src/api/types/FilteredMeta.ts index 31e04a3..6df166b 100644 --- a/src/api/types/FilteredMeta.ts +++ b/src/api/types/FilteredMeta.ts @@ -2,11 +2,6 @@ * This file was auto-generated by Fern from our API Definition. */ -export type FilteredMeta = "body" | "headers" | "path" | "query"; +import * as Hookdeck from "../index"; -export const FilteredMeta = { - Body: "body", - Headers: "headers", - Path: "path", - Query: "query", -} as const; +export type FilteredMeta = Hookdeck.FilteredMetaItem[]; diff --git a/src/api/types/FilteredMetaItem.ts b/src/api/types/FilteredMetaItem.ts new file mode 100644 index 0000000..cb72df4 --- /dev/null +++ b/src/api/types/FilteredMetaItem.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type FilteredMetaItem = "body" | "headers" | "path" | "query"; + +export const FilteredMetaItem = { + Body: "body", + Headers: "headers", + Path: "path", + Query: "query", +} as const; diff --git a/src/api/types/IgnoredEvent.ts b/src/api/types/IgnoredEvent.ts index 6488653..12cbc9d 100644 --- a/src/api/types/IgnoredEvent.ts +++ b/src/api/types/IgnoredEvent.ts @@ -6,11 +6,11 @@ import * as Hookdeck from "../index"; export interface IgnoredEvent { id: string; + /** ID of the project */ teamId: string; webhookId: string; cause: Hookdeck.IgnoredEventCause; requestId: string; meta?: Hookdeck.IgnoredEventMeta; - updatedAt: Date; createdAt: Date; } diff --git a/src/api/types/IntegrationProvider.ts b/src/api/types/IntegrationProvider.ts index dae8e04..c03ec4f 100644 --- a/src/api/types/IntegrationProvider.ts +++ b/src/api/types/IntegrationProvider.ts @@ -62,7 +62,8 @@ export type IntegrationProvider = | "SLACK" | "RAZORPAY" | "MAILCHIMP" - | "PADDLE"; + | "PADDLE" + | "PAYPAL"; export const IntegrationProvider = { Hmac: "HMAC", @@ -125,4 +126,5 @@ export const IntegrationProvider = { Razorpay: "RAZORPAY", Mailchimp: "MAILCHIMP", Paddle: "PADDLE", + Paypal: "PAYPAL", } as const; diff --git a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryCreatedAtAny.ts b/src/api/types/Operators.ts similarity index 71% rename from src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryCreatedAtAny.ts rename to src/api/types/Operators.ts index 4f40e44..19dfe65 100644 --- a/src/api/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryCreatedAtAny.ts +++ b/src/api/types/Operators.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -export interface EventBulkRetryCreateRequestQueryCreatedAtAny { +export interface Operators { gt?: Date; gte?: Date; le?: Date; diff --git a/src/api/types/RetriedEvent.ts b/src/api/types/RetriedEvent.ts index 1c0e5f4..d1c8230 100644 --- a/src/api/types/RetriedEvent.ts +++ b/src/api/types/RetriedEvent.ts @@ -5,6 +5,37 @@ import * as Hookdeck from "../index"; export interface RetriedEvent { - event: Hookdeck.Event; - attempt?: Hookdeck.EventAttempt; + /** ID of the event */ + id: string; + /** ID of the project */ + teamId: string; + /** ID of the associated connection */ + webhookId: string; + /** ID of the associated source */ + sourceId: string; + /** ID of the associated destination */ + destinationId: string; + /** ID of the event data */ + eventDataId: string; + /** ID of the request that created the event */ + requestId: string; + /** Number of delivery attempts made */ + attempts: number; + /** Date of the most recently attempted retry */ + lastAttemptAt?: Date; + /** Date of the next scheduled retry */ + nextAttemptAt?: Date; + /** Event status */ + responseStatus?: number; + errorCode?: Hookdeck.AttemptErrorCodes; + status: Hookdeck.EventStatus; + /** Date of the latest successful attempt */ + successfulAt?: Date; + /** ID of the CLI the event is sent to */ + cliId?: string; + /** Date the event was last updated */ + updatedAt: Date; + /** Date the event was created */ + createdAt: Date; + data?: Hookdeck.ShortEventData; } diff --git a/src/api/types/ShopifyIntegrationConfigs.ts b/src/api/types/ShopifyIntegrationConfigs.ts index 8a3eb40..369e03c 100644 --- a/src/api/types/ShopifyIntegrationConfigs.ts +++ b/src/api/types/ShopifyIntegrationConfigs.ts @@ -2,13 +2,6 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Hookdeck from "../index"; - export interface ShopifyIntegrationConfigs { webhookSecretKey: string; - rateLimitPeriod?: Hookdeck.ShopifyIntegrationConfigsRateLimitPeriod; - rateLimit?: number; - apiKey?: string; - apiSecret?: string; - shop?: string; } diff --git a/src/api/types/ShopifyIntegrationConfigsRateLimitPeriod.ts b/src/api/types/ShopifyIntegrationConfigsRateLimitPeriod.ts deleted file mode 100644 index ced79d9..0000000 --- a/src/api/types/ShopifyIntegrationConfigsRateLimitPeriod.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export type ShopifyIntegrationConfigsRateLimitPeriod = "minute" | "second"; - -export const ShopifyIntegrationConfigsRateLimitPeriod = { - Minute: "minute", - Second: "second", -} as const; diff --git a/src/api/types/Source.ts b/src/api/types/Source.ts index ed664ae..7e14e20 100644 --- a/src/api/types/Source.ts +++ b/src/api/types/Source.ts @@ -18,7 +18,7 @@ export interface Source { teamId: string; /** A unique URL that must be supplied to your webhook's provider */ url: string; - verification?: Hookdeck.SourceVerification; + verification?: Hookdeck.VerificationConfig; allowedHttpMethods?: Hookdeck.SourceAllowedHttpMethod | undefined; customResponse?: Hookdeck.SourceCustomResponse; /** Date the source was disabled */ diff --git a/src/api/types/SourceVerificationOne.ts b/src/api/types/SourceVerificationOne.ts deleted file mode 100644 index 51ca2ac..0000000 --- a/src/api/types/SourceVerificationOne.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface SourceVerificationOne {} diff --git a/src/api/types/TransformationExecution.ts b/src/api/types/TransformationExecution.ts index 0a69a06..a4dca64 100644 --- a/src/api/types/TransformationExecution.ts +++ b/src/api/types/TransformationExecution.ts @@ -9,6 +9,7 @@ export interface TransformationExecution { transformedEventDataId: string; originalEventDataId: string; transformationId: string; + /** ID of the project */ teamId: string; webhookId: string; logLevel: Hookdeck.TransformationExecutionLogLevel; diff --git a/src/api/types/VerificationConfig.ts b/src/api/types/VerificationConfig.ts index 3880c1c..232a08d 100644 --- a/src/api/types/VerificationConfig.ts +++ b/src/api/types/VerificationConfig.ts @@ -67,7 +67,8 @@ export type VerificationConfig = | Hookdeck.VerificationConfig.Slack | Hookdeck.VerificationConfig.Razorpay | Hookdeck.VerificationConfig.Mailchimp - | Hookdeck.VerificationConfig.Paddle; + | Hookdeck.VerificationConfig.Paddle + | Hookdeck.VerificationConfig.Paypal; export declare namespace VerificationConfig { interface Hmac extends Hookdeck.VerificationHmac { @@ -309,4 +310,8 @@ export declare namespace VerificationConfig { interface Paddle extends Hookdeck.VerificationPaddle { type: "paddle"; } + + interface Paypal extends Hookdeck.VerificationPaypal { + type: "paypal"; + } } diff --git a/src/api/types/SourceVerification.ts b/src/api/types/VerificationPaypal.ts similarity index 54% rename from src/api/types/SourceVerification.ts rename to src/api/types/VerificationPaypal.ts index 6be56c8..a692b27 100644 --- a/src/api/types/SourceVerification.ts +++ b/src/api/types/VerificationPaypal.ts @@ -4,4 +4,6 @@ import * as Hookdeck from "../index"; -export type SourceVerification = Hookdeck.VerificationConfig | Hookdeck.SourceVerificationOne; +export interface VerificationPaypal { + configs?: Hookdeck.VerificationPaypalConfigs; +} diff --git a/src/api/types/VerificationPaypalConfigs.ts b/src/api/types/VerificationPaypalConfigs.ts new file mode 100644 index 0000000..614728c --- /dev/null +++ b/src/api/types/VerificationPaypalConfigs.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The verification configs for Paypal. Only included if the ?include=verification.configs query param is present + */ +export interface VerificationPaypalConfigs { + webhookId: string; +} diff --git a/src/api/types/VerificationRechargeConfigs.ts b/src/api/types/VerificationRechargeConfigs.ts index 7a55bbd..9522764 100644 --- a/src/api/types/VerificationRechargeConfigs.ts +++ b/src/api/types/VerificationRechargeConfigs.ts @@ -2,14 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Hookdeck from "../index"; - /** * The verification configs for Recharge. Only included if the ?include=verification.configs query param is present */ export interface VerificationRechargeConfigs { webhookSecretKey: string; - algorithm: Hookdeck.HmacAlgorithms; - headerKey: string; - encoding: Hookdeck.VerificationRechargeConfigsEncoding; } diff --git a/src/api/types/VerificationRechargeConfigsEncoding.ts b/src/api/types/VerificationRechargeConfigsEncoding.ts deleted file mode 100644 index 73397ce..0000000 --- a/src/api/types/VerificationRechargeConfigsEncoding.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export type VerificationRechargeConfigsEncoding = "base64" | "base64url" | "hex"; - -export const VerificationRechargeConfigsEncoding = { - Base64: "base64", - Base64Url: "base64url", - Hex: "hex", -} as const; diff --git a/src/api/types/VerificationShopifyConfigs.ts b/src/api/types/VerificationShopifyConfigs.ts index 8f04b8d..c81f102 100644 --- a/src/api/types/VerificationShopifyConfigs.ts +++ b/src/api/types/VerificationShopifyConfigs.ts @@ -2,16 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Hookdeck from "../index"; - /** * The verification configs for Shopify. Only included if the ?include=verification.configs query param is present */ export interface VerificationShopifyConfigs { webhookSecretKey: string; - rateLimitPeriod?: Hookdeck.VerificationShopifyConfigsRateLimitPeriod; - rateLimit?: number; - apiKey?: string; - apiSecret?: string; - shop?: string; } diff --git a/src/api/types/VerificationShopifyConfigsRateLimitPeriod.ts b/src/api/types/VerificationShopifyConfigsRateLimitPeriod.ts deleted file mode 100644 index 7573e0e..0000000 --- a/src/api/types/VerificationShopifyConfigsRateLimitPeriod.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export type VerificationShopifyConfigsRateLimitPeriod = "minute" | "second"; - -export const VerificationShopifyConfigsRateLimitPeriod = { - Minute: "minute", - Second: "second", -} as const; diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 6499be5..07ea7f5 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -21,11 +21,11 @@ export * from "./IssueTrigger"; export * from "./IssueTriggerPaginatedResult"; export * from "./ApiErrorResponseData"; export * from "./ApiErrorResponse"; +export * from "./Operators"; export * from "./DeletedIssueTriggerResponse"; export * from "./AttemptTrigger"; export * from "./AttemptErrorCodes"; export * from "./AttemptStatus"; -export * from "./AttemptState"; export * from "./EventAttemptBodyZero"; export * from "./EventAttemptBody"; export * from "./EventAttemptHttpMethod"; @@ -81,7 +81,6 @@ export * from "./ApiKeyIntegrationConfigs"; export * from "./HandledApiKeyIntegrationConfigs"; export * from "./HandledHmacConfigs"; export * from "./BasicAuthIntegrationConfigs"; -export * from "./ShopifyIntegrationConfigsRateLimitPeriod"; export * from "./ShopifyIntegrationConfigs"; export * from "./VercelLogDrainsIntegrationConfigs"; export * from "./IntegrationConfigsSeven"; @@ -115,6 +114,7 @@ export * from "./Request"; export * from "./RequestPaginatedResult"; export * from "./RetryRequest"; export * from "./IgnoredEventCause"; +export * from "./FilteredMetaItem"; export * from "./FilteredMeta"; export * from "./TransformationFailedMeta"; export * from "./IgnoredEventMeta"; @@ -137,14 +137,12 @@ export * from "./VerificationTwitterConfigs"; export * from "./VerificationTwitter"; export * from "./VerificationStripeConfigs"; export * from "./VerificationStripe"; -export * from "./VerificationRechargeConfigsEncoding"; export * from "./VerificationRechargeConfigs"; export * from "./VerificationRecharge"; export * from "./VerificationTwilioConfigs"; export * from "./VerificationTwilio"; export * from "./VerificationGitHubConfigs"; export * from "./VerificationGitHub"; -export * from "./VerificationShopifyConfigsRateLimitPeriod"; export * from "./VerificationShopifyConfigs"; export * from "./VerificationShopify"; export * from "./VerificationPostmarkConfigs"; @@ -243,13 +241,13 @@ export * from "./VerificationMailchimpConfigs"; export * from "./VerificationMailchimp"; export * from "./VerificationPaddleConfigs"; export * from "./VerificationPaddle"; +export * from "./VerificationPaypalConfigs"; +export * from "./VerificationPaypal"; export * from "./VerificationConfig"; export * from "./SourceAllowedHttpMethodItem"; export * from "./SourceAllowedHttpMethod"; export * from "./SourceCustomResponseContentType"; export * from "./SourceCustomResponse"; -export * from "./SourceVerificationOne"; -export * from "./SourceVerification"; export * from "./Source"; export * from "./SourcePaginatedResult"; export * from "./TopicsValue"; diff --git a/src/core/fetcher/Fetcher.ts b/src/core/fetcher/Fetcher.ts index 5106568..d67bc04 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 0000000..9288a99 --- /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 0000000..9fd9bfc --- /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 0000000..1138414 --- /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 0000000..a7a9c50 --- /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 0000000..8fb4bac --- /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 0000000..ff5dc3b --- /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 0000000..6c124ff --- /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 0000000..e5db873 --- /dev/null +++ b/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts @@ -0,0 +1,252 @@ +import type { Writable } from "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 0000000..f9bead2 --- /dev/null +++ b/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts @@ -0,0 +1,106 @@ +import type { Readable, Writable } from "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 0000000..7a52805 --- /dev/null +++ b/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts @@ -0,0 +1,239 @@ +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 0000000..d60991d --- /dev/null +++ b/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts @@ -0,0 +1,33 @@ +import type { Readable } from "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 30fe077..4d0687e 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 870f373..19acc5d 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,9 +6,9 @@ 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 = { @@ -91,4 +90,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/lazy/lazy.ts b/src/core/schemas/builders/lazy/lazy.ts index a665472..835c61f 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 e48c016..38c9e28 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 b333321..e4c5c4a 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 270ea17..8331d08 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 6427678..e00136d 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 17cff4f..de9bb40 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 ac1cd22..6683ac3 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 0c0d379..79ecad9 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 3113bcb..e9e6bb7 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 771dc6a..21ed3df 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 ed659be..ab61475 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/maybeSkipValidation.ts b/src/core/schemas/utils/maybeSkipValidation.ts index 99c02c3..86c07ab 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/environments.ts b/src/environments.ts index 6ce9728..e6aa8db 100644 --- a/src/environments.ts +++ b/src/environments.ts @@ -3,7 +3,7 @@ */ export const HookdeckEnvironment = { - Default: "https://api.hookdeck.com/2024-03-01", + Default: "https://api.hookdeck.com/2024-09-01", } as const; export type HookdeckEnvironment = typeof HookdeckEnvironment.Default; diff --git a/src/serialization/resources/connection/types/ConnectionCreateRequestDestination.ts b/src/serialization/resources/connection/types/ConnectionCreateRequestDestination.ts index 012e0b1..0b124ca 100644 --- a/src/serialization/resources/connection/types/ConnectionCreateRequestDestination.ts +++ b/src/serialization/resources/connection/types/ConnectionCreateRequestDestination.ts @@ -17,11 +17,11 @@ export const ConnectionCreateRequestDestination: core.serialization.ObjectSchema description: core.serialization.string().optional(), url: core.serialization.string().optional(), cliPath: core.serialization.property("cli_path", core.serialization.string().optional()), + rateLimit: core.serialization.property("rate_limit", core.serialization.number().optional()), rateLimitPeriod: core.serialization.property( "rate_limit_period", ConnectionCreateRequestDestinationRateLimitPeriod.optional() ), - rateLimit: core.serialization.property("rate_limit", core.serialization.number().optional()), httpMethod: core.serialization.property("http_method", DestinationHttpMethod.optional()), authMethod: core.serialization.property("auth_method", DestinationAuthMethodConfig.optional()), pathForwardingDisabled: core.serialization.property( @@ -36,8 +36,8 @@ export declare namespace ConnectionCreateRequestDestination { description?: string | null; url?: string | null; cli_path?: string | null; - rate_limit_period?: ConnectionCreateRequestDestinationRateLimitPeriod.Raw | null; rate_limit?: number | null; + rate_limit_period?: ConnectionCreateRequestDestinationRateLimitPeriod.Raw | null; http_method?: DestinationHttpMethod.Raw | null; auth_method?: DestinationAuthMethodConfig.Raw | null; path_forwarding_disabled?: boolean | null; diff --git a/src/serialization/resources/connection/types/ConnectionUpsertRequestDestination.ts b/src/serialization/resources/connection/types/ConnectionUpsertRequestDestination.ts index 2a3611c..95f6d8d 100644 --- a/src/serialization/resources/connection/types/ConnectionUpsertRequestDestination.ts +++ b/src/serialization/resources/connection/types/ConnectionUpsertRequestDestination.ts @@ -17,11 +17,11 @@ export const ConnectionUpsertRequestDestination: core.serialization.ObjectSchema description: core.serialization.string().optional(), url: core.serialization.string().optional(), cliPath: core.serialization.property("cli_path", core.serialization.string().optional()), + rateLimit: core.serialization.property("rate_limit", core.serialization.number().optional()), rateLimitPeriod: core.serialization.property( "rate_limit_period", ConnectionUpsertRequestDestinationRateLimitPeriod.optional() ), - rateLimit: core.serialization.property("rate_limit", core.serialization.number().optional()), httpMethod: core.serialization.property("http_method", DestinationHttpMethod.optional()), authMethod: core.serialization.property("auth_method", DestinationAuthMethodConfig.optional()), pathForwardingDisabled: core.serialization.property( @@ -36,8 +36,8 @@ export declare namespace ConnectionUpsertRequestDestination { description?: string | null; url?: string | null; cli_path?: string | null; - rate_limit_period?: ConnectionUpsertRequestDestinationRateLimitPeriod.Raw | null; rate_limit?: number | null; + rate_limit_period?: ConnectionUpsertRequestDestinationRateLimitPeriod.Raw | null; http_method?: DestinationHttpMethod.Raw | null; auth_method?: DestinationAuthMethodConfig.Raw | null; path_forwarding_disabled?: boolean | null; diff --git a/src/serialization/resources/destination/client/requests/DestinationCreateRequest.ts b/src/serialization/resources/destination/client/requests/DestinationCreateRequest.ts index 20dd94c..217c7b4 100644 --- a/src/serialization/resources/destination/client/requests/DestinationCreateRequest.ts +++ b/src/serialization/resources/destination/client/requests/DestinationCreateRequest.ts @@ -17,11 +17,11 @@ export const DestinationCreateRequest: core.serialization.Schema< description: core.serialization.string().optional(), url: core.serialization.string().optional(), cliPath: core.serialization.property("cli_path", core.serialization.string().optional()), + rateLimit: core.serialization.property("rate_limit", core.serialization.number().optional()), rateLimitPeriod: core.serialization.property( "rate_limit_period", DestinationCreateRequestRateLimitPeriod.optional() ), - rateLimit: core.serialization.property("rate_limit", core.serialization.number().optional()), httpMethod: core.serialization.property("http_method", DestinationHttpMethod.optional()), authMethod: core.serialization.property("auth_method", DestinationAuthMethodConfig.optional()), pathForwardingDisabled: core.serialization.property( @@ -36,8 +36,8 @@ export declare namespace DestinationCreateRequest { description?: string | null; url?: string | null; cli_path?: string | null; - rate_limit_period?: DestinationCreateRequestRateLimitPeriod.Raw | null; rate_limit?: number | null; + rate_limit_period?: DestinationCreateRequestRateLimitPeriod.Raw | null; http_method?: DestinationHttpMethod.Raw | null; auth_method?: DestinationAuthMethodConfig.Raw | null; path_forwarding_disabled?: boolean | null; diff --git a/src/serialization/resources/destination/client/requests/DestinationUpdateRequest.ts b/src/serialization/resources/destination/client/requests/DestinationUpdateRequest.ts index 7054b43..364cce4 100644 --- a/src/serialization/resources/destination/client/requests/DestinationUpdateRequest.ts +++ b/src/serialization/resources/destination/client/requests/DestinationUpdateRequest.ts @@ -17,11 +17,11 @@ export const DestinationUpdateRequest: core.serialization.Schema< description: core.serialization.string().optional(), url: core.serialization.string().optional(), cliPath: core.serialization.property("cli_path", core.serialization.string().optional()), + rateLimit: core.serialization.property("rate_limit", core.serialization.number().optional()), rateLimitPeriod: core.serialization.property( "rate_limit_period", DestinationUpdateRequestRateLimitPeriod.optional() ), - rateLimit: core.serialization.property("rate_limit", core.serialization.number().optional()), httpMethod: core.serialization.property("http_method", DestinationHttpMethod.optional()), authMethod: core.serialization.property("auth_method", DestinationAuthMethodConfig.optional()), pathForwardingDisabled: core.serialization.property( @@ -36,8 +36,8 @@ export declare namespace DestinationUpdateRequest { description?: string | null; url?: string | null; cli_path?: string | null; - rate_limit_period?: DestinationUpdateRequestRateLimitPeriod.Raw | null; rate_limit?: number | null; + rate_limit_period?: DestinationUpdateRequestRateLimitPeriod.Raw | null; http_method?: DestinationHttpMethod.Raw | null; auth_method?: DestinationAuthMethodConfig.Raw | null; path_forwarding_disabled?: boolean | null; diff --git a/src/serialization/resources/destination/client/requests/DestinationUpsertRequest.ts b/src/serialization/resources/destination/client/requests/DestinationUpsertRequest.ts index b2e30a4..08821ef 100644 --- a/src/serialization/resources/destination/client/requests/DestinationUpsertRequest.ts +++ b/src/serialization/resources/destination/client/requests/DestinationUpsertRequest.ts @@ -17,11 +17,11 @@ export const DestinationUpsertRequest: core.serialization.Schema< description: core.serialization.string().optional(), url: core.serialization.string().optional(), cliPath: core.serialization.property("cli_path", core.serialization.string().optional()), + rateLimit: core.serialization.property("rate_limit", core.serialization.number().optional()), rateLimitPeriod: core.serialization.property( "rate_limit_period", DestinationUpsertRequestRateLimitPeriod.optional() ), - rateLimit: core.serialization.property("rate_limit", core.serialization.number().optional()), httpMethod: core.serialization.property("http_method", DestinationHttpMethod.optional()), authMethod: core.serialization.property("auth_method", DestinationAuthMethodConfig.optional()), pathForwardingDisabled: core.serialization.property( @@ -36,8 +36,8 @@ export declare namespace DestinationUpsertRequest { description?: string | null; url?: string | null; cli_path?: string | null; - rate_limit_period?: DestinationUpsertRequestRateLimitPeriod.Raw | null; rate_limit?: number | null; + rate_limit_period?: DestinationUpsertRequestRateLimitPeriod.Raw | null; http_method?: DestinationHttpMethod.Raw | null; auth_method?: DestinationAuthMethodConfig.Raw | null; path_forwarding_disabled?: boolean | null; diff --git a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryAttempts.ts b/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryAttempts.ts index 9e3fc0c..3454661 100644 --- a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryAttempts.ts +++ b/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryAttempts.ts @@ -5,13 +5,13 @@ import * as serializers from "../../../index"; import * as Hookdeck from "../../../../api/index"; import * as core from "../../../../core"; -import { EventBulkRetryCreateRequestQueryAttemptsAll } from "./EventBulkRetryCreateRequestQueryAttemptsAll"; +import { Operators } from "../../../types/Operators"; export const EventBulkRetryCreateRequestQueryAttempts: core.serialization.Schema< serializers.EventBulkRetryCreateRequestQueryAttempts.Raw, Hookdeck.EventBulkRetryCreateRequestQueryAttempts -> = core.serialization.undiscriminatedUnion([core.serialization.number(), EventBulkRetryCreateRequestQueryAttemptsAll]); +> = core.serialization.undiscriminatedUnion([core.serialization.number(), Operators]); export declare namespace EventBulkRetryCreateRequestQueryAttempts { - type Raw = number | EventBulkRetryCreateRequestQueryAttemptsAll.Raw; + type Raw = number | Operators.Raw; } diff --git a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryAttemptsAll.ts b/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryAttemptsAll.ts deleted file mode 100644 index 613010b..0000000 --- a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryAttemptsAll.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../index"; -import * as Hookdeck from "../../../../api/index"; -import * as core from "../../../../core"; - -export const EventBulkRetryCreateRequestQueryAttemptsAll: core.serialization.ObjectSchema< - serializers.EventBulkRetryCreateRequestQueryAttemptsAll.Raw, - Hookdeck.EventBulkRetryCreateRequestQueryAttemptsAll -> = core.serialization.object({ - gt: core.serialization.number().optional(), - gte: core.serialization.number().optional(), - le: core.serialization.number().optional(), - lte: core.serialization.number().optional(), - any: core.serialization.boolean().optional(), - all: core.serialization.boolean().optional(), - contains: core.serialization.number().optional(), -}); - -export declare namespace EventBulkRetryCreateRequestQueryAttemptsAll { - interface Raw { - gt?: number | null; - gte?: number | null; - le?: number | null; - lte?: number | null; - any?: boolean | null; - all?: boolean | null; - contains?: number | null; - } -} diff --git a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryCreatedAt.ts b/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryCreatedAt.ts index f431c21..83aa4ba 100644 --- a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryCreatedAt.ts +++ b/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryCreatedAt.ts @@ -5,13 +5,13 @@ import * as serializers from "../../../index"; import * as Hookdeck from "../../../../api/index"; import * as core from "../../../../core"; -import { EventBulkRetryCreateRequestQueryCreatedAtAny } from "./EventBulkRetryCreateRequestQueryCreatedAtAny"; +import { Operators } from "../../../types/Operators"; export const EventBulkRetryCreateRequestQueryCreatedAt: core.serialization.Schema< serializers.EventBulkRetryCreateRequestQueryCreatedAt.Raw, Hookdeck.EventBulkRetryCreateRequestQueryCreatedAt -> = core.serialization.undiscriminatedUnion([core.serialization.date(), EventBulkRetryCreateRequestQueryCreatedAtAny]); +> = core.serialization.undiscriminatedUnion([core.serialization.date(), Operators]); export declare namespace EventBulkRetryCreateRequestQueryCreatedAt { - type Raw = string | EventBulkRetryCreateRequestQueryCreatedAtAny.Raw; + type Raw = string | Operators.Raw; } diff --git a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryCreatedAtAny.ts b/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryCreatedAtAny.ts deleted file mode 100644 index ba31187..0000000 --- a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryCreatedAtAny.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../index"; -import * as Hookdeck from "../../../../api/index"; -import * as core from "../../../../core"; - -export const EventBulkRetryCreateRequestQueryCreatedAtAny: core.serialization.ObjectSchema< - serializers.EventBulkRetryCreateRequestQueryCreatedAtAny.Raw, - Hookdeck.EventBulkRetryCreateRequestQueryCreatedAtAny -> = core.serialization.object({ - gt: core.serialization.date().optional(), - gte: core.serialization.date().optional(), - le: core.serialization.date().optional(), - lte: core.serialization.date().optional(), - any: core.serialization.boolean().optional(), -}); - -export declare namespace EventBulkRetryCreateRequestQueryCreatedAtAny { - interface Raw { - gt?: string | null; - gte?: string | null; - le?: string | null; - lte?: string | null; - any?: boolean | null; - } -} diff --git a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryLastAttemptAt.ts b/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryLastAttemptAt.ts index 3947d8f..c14eaa4 100644 --- a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryLastAttemptAt.ts +++ b/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryLastAttemptAt.ts @@ -5,16 +5,13 @@ import * as serializers from "../../../index"; import * as Hookdeck from "../../../../api/index"; import * as core from "../../../../core"; -import { EventBulkRetryCreateRequestQueryLastAttemptAtAny } from "./EventBulkRetryCreateRequestQueryLastAttemptAtAny"; +import { Operators } from "../../../types/Operators"; export const EventBulkRetryCreateRequestQueryLastAttemptAt: core.serialization.Schema< serializers.EventBulkRetryCreateRequestQueryLastAttemptAt.Raw, Hookdeck.EventBulkRetryCreateRequestQueryLastAttemptAt -> = core.serialization.undiscriminatedUnion([ - core.serialization.date(), - EventBulkRetryCreateRequestQueryLastAttemptAtAny, -]); +> = core.serialization.undiscriminatedUnion([core.serialization.date(), Operators]); export declare namespace EventBulkRetryCreateRequestQueryLastAttemptAt { - type Raw = string | EventBulkRetryCreateRequestQueryLastAttemptAtAny.Raw; + type Raw = string | Operators.Raw; } diff --git a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryLastAttemptAtAny.ts b/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryLastAttemptAtAny.ts deleted file mode 100644 index fd28821..0000000 --- a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryLastAttemptAtAny.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../index"; -import * as Hookdeck from "../../../../api/index"; -import * as core from "../../../../core"; - -export const EventBulkRetryCreateRequestQueryLastAttemptAtAny: core.serialization.ObjectSchema< - serializers.EventBulkRetryCreateRequestQueryLastAttemptAtAny.Raw, - Hookdeck.EventBulkRetryCreateRequestQueryLastAttemptAtAny -> = core.serialization.object({ - gt: core.serialization.date().optional(), - gte: core.serialization.date().optional(), - le: core.serialization.date().optional(), - lte: core.serialization.date().optional(), - any: core.serialization.boolean().optional(), -}); - -export declare namespace EventBulkRetryCreateRequestQueryLastAttemptAtAny { - interface Raw { - gt?: string | null; - gte?: string | null; - le?: string | null; - lte?: string | null; - any?: boolean | null; - } -} diff --git a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryResponseStatus.ts b/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryResponseStatus.ts index 19f116e..e9284ca 100644 --- a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryResponseStatus.ts +++ b/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryResponseStatus.ts @@ -5,17 +5,17 @@ import * as serializers from "../../../index"; import * as Hookdeck from "../../../../api/index"; import * as core from "../../../../core"; -import { EventBulkRetryCreateRequestQueryResponseStatusAll } from "./EventBulkRetryCreateRequestQueryResponseStatusAll"; +import { Operators } from "../../../types/Operators"; export const EventBulkRetryCreateRequestQueryResponseStatus: core.serialization.Schema< serializers.EventBulkRetryCreateRequestQueryResponseStatus.Raw, Hookdeck.EventBulkRetryCreateRequestQueryResponseStatus > = core.serialization.undiscriminatedUnion([ core.serialization.number(), - EventBulkRetryCreateRequestQueryResponseStatusAll, + Operators, core.serialization.list(core.serialization.number()), ]); export declare namespace EventBulkRetryCreateRequestQueryResponseStatus { - type Raw = number | EventBulkRetryCreateRequestQueryResponseStatusAll.Raw | number[]; + type Raw = number | Operators.Raw | number[]; } diff --git a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryResponseStatusAll.ts b/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryResponseStatusAll.ts deleted file mode 100644 index a85cc44..0000000 --- a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQueryResponseStatusAll.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../index"; -import * as Hookdeck from "../../../../api/index"; -import * as core from "../../../../core"; - -export const EventBulkRetryCreateRequestQueryResponseStatusAll: core.serialization.ObjectSchema< - serializers.EventBulkRetryCreateRequestQueryResponseStatusAll.Raw, - Hookdeck.EventBulkRetryCreateRequestQueryResponseStatusAll -> = core.serialization.object({ - gt: core.serialization.number().optional(), - gte: core.serialization.number().optional(), - le: core.serialization.number().optional(), - lte: core.serialization.number().optional(), - any: core.serialization.boolean().optional(), - all: core.serialization.boolean().optional(), - contains: core.serialization.number().optional(), -}); - -export declare namespace EventBulkRetryCreateRequestQueryResponseStatusAll { - interface Raw { - gt?: number | null; - gte?: number | null; - le?: number | null; - lte?: number | null; - any?: boolean | null; - all?: boolean | null; - contains?: number | null; - } -} diff --git a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQuerySuccessfulAt.ts b/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQuerySuccessfulAt.ts index 6b95dcb..d801736 100644 --- a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQuerySuccessfulAt.ts +++ b/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQuerySuccessfulAt.ts @@ -5,16 +5,13 @@ import * as serializers from "../../../index"; import * as Hookdeck from "../../../../api/index"; import * as core from "../../../../core"; -import { EventBulkRetryCreateRequestQuerySuccessfulAtAny } from "./EventBulkRetryCreateRequestQuerySuccessfulAtAny"; +import { Operators } from "../../../types/Operators"; export const EventBulkRetryCreateRequestQuerySuccessfulAt: core.serialization.Schema< serializers.EventBulkRetryCreateRequestQuerySuccessfulAt.Raw, Hookdeck.EventBulkRetryCreateRequestQuerySuccessfulAt -> = core.serialization.undiscriminatedUnion([ - core.serialization.date(), - EventBulkRetryCreateRequestQuerySuccessfulAtAny, -]); +> = core.serialization.undiscriminatedUnion([core.serialization.date(), Operators]); export declare namespace EventBulkRetryCreateRequestQuerySuccessfulAt { - type Raw = string | EventBulkRetryCreateRequestQuerySuccessfulAtAny.Raw; + type Raw = string | Operators.Raw; } diff --git a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQuerySuccessfulAtAny.ts b/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQuerySuccessfulAtAny.ts deleted file mode 100644 index 8566d6d..0000000 --- a/src/serialization/resources/eventBulkRetry/types/EventBulkRetryCreateRequestQuerySuccessfulAtAny.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../index"; -import * as Hookdeck from "../../../../api/index"; -import * as core from "../../../../core"; - -export const EventBulkRetryCreateRequestQuerySuccessfulAtAny: core.serialization.ObjectSchema< - serializers.EventBulkRetryCreateRequestQuerySuccessfulAtAny.Raw, - Hookdeck.EventBulkRetryCreateRequestQuerySuccessfulAtAny -> = core.serialization.object({ - gt: core.serialization.date().optional(), - gte: core.serialization.date().optional(), - le: core.serialization.date().optional(), - lte: core.serialization.date().optional(), - any: core.serialization.boolean().optional(), -}); - -export declare namespace EventBulkRetryCreateRequestQuerySuccessfulAtAny { - interface Raw { - gt?: string | null; - gte?: string | null; - le?: string | null; - lte?: string | null; - any?: boolean | null; - } -} diff --git a/src/serialization/resources/eventBulkRetry/types/index.ts b/src/serialization/resources/eventBulkRetry/types/index.ts index 6a43051..4372a8e 100644 --- a/src/serialization/resources/eventBulkRetry/types/index.ts +++ b/src/serialization/resources/eventBulkRetry/types/index.ts @@ -5,18 +5,13 @@ export * from "./EventBulkRetryCreateRequestQueryStatus"; export * from "./EventBulkRetryCreateRequestQueryWebhookId"; export * from "./EventBulkRetryCreateRequestQueryDestinationId"; export * from "./EventBulkRetryCreateRequestQuerySourceId"; -export * from "./EventBulkRetryCreateRequestQueryAttemptsAll"; export * from "./EventBulkRetryCreateRequestQueryAttempts"; -export * from "./EventBulkRetryCreateRequestQueryResponseStatusAll"; export * from "./EventBulkRetryCreateRequestQueryResponseStatus"; -export * from "./EventBulkRetryCreateRequestQuerySuccessfulAtAny"; export * from "./EventBulkRetryCreateRequestQuerySuccessfulAt"; -export * from "./EventBulkRetryCreateRequestQueryCreatedAtAny"; export * from "./EventBulkRetryCreateRequestQueryCreatedAt"; export * from "./EventBulkRetryCreateRequestQueryErrorCode"; export * from "./EventBulkRetryCreateRequestQueryCliIdAll"; export * from "./EventBulkRetryCreateRequestQueryCliId"; -export * from "./EventBulkRetryCreateRequestQueryLastAttemptAtAny"; export * from "./EventBulkRetryCreateRequestQueryLastAttemptAt"; export * from "./EventBulkRetryCreateRequestQueryHeadersOne"; export * from "./EventBulkRetryCreateRequestQueryHeaders"; diff --git a/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryEventsCount.ts b/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryEventsCount.ts index 120a410..7cfe3c2 100644 --- a/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryEventsCount.ts +++ b/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryEventsCount.ts @@ -5,17 +5,17 @@ import * as serializers from "../../../index"; import * as Hookdeck from "../../../../api/index"; import * as core from "../../../../core"; -import { RequestBulkRetryCreateRequestQueryEventsCountAll } from "./RequestBulkRetryCreateRequestQueryEventsCountAll"; +import { Operators } from "../../../types/Operators"; export const RequestBulkRetryCreateRequestQueryEventsCount: core.serialization.Schema< serializers.RequestBulkRetryCreateRequestQueryEventsCount.Raw, Hookdeck.RequestBulkRetryCreateRequestQueryEventsCount > = core.serialization.undiscriminatedUnion([ core.serialization.number(), - RequestBulkRetryCreateRequestQueryEventsCountAll, + Operators, core.serialization.list(core.serialization.number()), ]); export declare namespace RequestBulkRetryCreateRequestQueryEventsCount { - type Raw = number | RequestBulkRetryCreateRequestQueryEventsCountAll.Raw | number[]; + type Raw = number | Operators.Raw | number[]; } diff --git a/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryEventsCountAll.ts b/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryEventsCountAll.ts deleted file mode 100644 index 1e017a0..0000000 --- a/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryEventsCountAll.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../index"; -import * as Hookdeck from "../../../../api/index"; -import * as core from "../../../../core"; - -export const RequestBulkRetryCreateRequestQueryEventsCountAll: core.serialization.ObjectSchema< - serializers.RequestBulkRetryCreateRequestQueryEventsCountAll.Raw, - Hookdeck.RequestBulkRetryCreateRequestQueryEventsCountAll -> = core.serialization.object({ - gt: core.serialization.number().optional(), - gte: core.serialization.number().optional(), - le: core.serialization.number().optional(), - lte: core.serialization.number().optional(), - any: core.serialization.boolean().optional(), - all: core.serialization.boolean().optional(), - contains: core.serialization.number().optional(), -}); - -export declare namespace RequestBulkRetryCreateRequestQueryEventsCountAll { - interface Raw { - gt?: number | null; - gte?: number | null; - le?: number | null; - lte?: number | null; - any?: boolean | null; - all?: boolean | null; - contains?: number | null; - } -} diff --git a/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIgnoredCount.ts b/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIgnoredCount.ts index 45f0370..0ec7d72 100644 --- a/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIgnoredCount.ts +++ b/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIgnoredCount.ts @@ -5,17 +5,17 @@ import * as serializers from "../../../index"; import * as Hookdeck from "../../../../api/index"; import * as core from "../../../../core"; -import { RequestBulkRetryCreateRequestQueryIgnoredCountAll } from "./RequestBulkRetryCreateRequestQueryIgnoredCountAll"; +import { Operators } from "../../../types/Operators"; export const RequestBulkRetryCreateRequestQueryIgnoredCount: core.serialization.Schema< serializers.RequestBulkRetryCreateRequestQueryIgnoredCount.Raw, Hookdeck.RequestBulkRetryCreateRequestQueryIgnoredCount > = core.serialization.undiscriminatedUnion([ core.serialization.number(), - RequestBulkRetryCreateRequestQueryIgnoredCountAll, + Operators, core.serialization.list(core.serialization.number()), ]); export declare namespace RequestBulkRetryCreateRequestQueryIgnoredCount { - type Raw = number | RequestBulkRetryCreateRequestQueryIgnoredCountAll.Raw | number[]; + type Raw = number | Operators.Raw | number[]; } diff --git a/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIgnoredCountAll.ts b/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIgnoredCountAll.ts deleted file mode 100644 index 7155f2a..0000000 --- a/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIgnoredCountAll.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../index"; -import * as Hookdeck from "../../../../api/index"; -import * as core from "../../../../core"; - -export const RequestBulkRetryCreateRequestQueryIgnoredCountAll: core.serialization.ObjectSchema< - serializers.RequestBulkRetryCreateRequestQueryIgnoredCountAll.Raw, - Hookdeck.RequestBulkRetryCreateRequestQueryIgnoredCountAll -> = core.serialization.object({ - gt: core.serialization.number().optional(), - gte: core.serialization.number().optional(), - le: core.serialization.number().optional(), - lte: core.serialization.number().optional(), - any: core.serialization.boolean().optional(), - all: core.serialization.boolean().optional(), - contains: core.serialization.number().optional(), -}); - -export declare namespace RequestBulkRetryCreateRequestQueryIgnoredCountAll { - interface Raw { - gt?: number | null; - gte?: number | null; - le?: number | null; - lte?: number | null; - any?: boolean | null; - all?: boolean | null; - contains?: number | null; - } -} diff --git a/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIngestedAt.ts b/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIngestedAt.ts index 9357813..44985a3 100644 --- a/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIngestedAt.ts +++ b/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIngestedAt.ts @@ -5,16 +5,13 @@ import * as serializers from "../../../index"; import * as Hookdeck from "../../../../api/index"; import * as core from "../../../../core"; -import { RequestBulkRetryCreateRequestQueryIngestedAtAny } from "./RequestBulkRetryCreateRequestQueryIngestedAtAny"; +import { Operators } from "../../../types/Operators"; export const RequestBulkRetryCreateRequestQueryIngestedAt: core.serialization.Schema< serializers.RequestBulkRetryCreateRequestQueryIngestedAt.Raw, Hookdeck.RequestBulkRetryCreateRequestQueryIngestedAt -> = core.serialization.undiscriminatedUnion([ - core.serialization.date(), - RequestBulkRetryCreateRequestQueryIngestedAtAny, -]); +> = core.serialization.undiscriminatedUnion([core.serialization.date(), Operators]); export declare namespace RequestBulkRetryCreateRequestQueryIngestedAt { - type Raw = string | RequestBulkRetryCreateRequestQueryIngestedAtAny.Raw; + type Raw = string | Operators.Raw; } diff --git a/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIngestedAtAny.ts b/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIngestedAtAny.ts deleted file mode 100644 index f001f11..0000000 --- a/src/serialization/resources/requestBulkRetry/types/RequestBulkRetryCreateRequestQueryIngestedAtAny.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../../../index"; -import * as Hookdeck from "../../../../api/index"; -import * as core from "../../../../core"; - -export const RequestBulkRetryCreateRequestQueryIngestedAtAny: core.serialization.ObjectSchema< - serializers.RequestBulkRetryCreateRequestQueryIngestedAtAny.Raw, - Hookdeck.RequestBulkRetryCreateRequestQueryIngestedAtAny -> = core.serialization.object({ - gt: core.serialization.date().optional(), - gte: core.serialization.date().optional(), - le: core.serialization.date().optional(), - lte: core.serialization.date().optional(), - any: core.serialization.boolean().optional(), -}); - -export declare namespace RequestBulkRetryCreateRequestQueryIngestedAtAny { - interface Raw { - gt?: string | null; - gte?: string | null; - le?: string | null; - lte?: string | null; - any?: boolean | null; - } -} diff --git a/src/serialization/resources/requestBulkRetry/types/index.ts b/src/serialization/resources/requestBulkRetry/types/index.ts index bbb5009..053e0c0 100644 --- a/src/serialization/resources/requestBulkRetry/types/index.ts +++ b/src/serialization/resources/requestBulkRetry/types/index.ts @@ -10,11 +10,8 @@ export * from "./RequestBulkRetryCreateRequestQueryBodyOne"; export * from "./RequestBulkRetryCreateRequestQueryBody"; export * from "./RequestBulkRetryCreateRequestQueryParsedQueryOne"; export * from "./RequestBulkRetryCreateRequestQueryParsedQuery"; -export * from "./RequestBulkRetryCreateRequestQueryIgnoredCountAll"; export * from "./RequestBulkRetryCreateRequestQueryIgnoredCount"; -export * from "./RequestBulkRetryCreateRequestQueryEventsCountAll"; export * from "./RequestBulkRetryCreateRequestQueryEventsCount"; -export * from "./RequestBulkRetryCreateRequestQueryIngestedAtAny"; export * from "./RequestBulkRetryCreateRequestQueryIngestedAt"; export * from "./RequestBulkRetryCreateRequestQueryBulkRetryId"; export * from "./RequestBulkRetryCreateRequestQuery"; diff --git a/src/serialization/types/AttemptState.ts b/src/serialization/types/AttemptState.ts deleted file mode 100644 index 77c4332..0000000 --- a/src/serialization/types/AttemptState.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Hookdeck from "../../api/index"; -import * as core from "../../core"; - -export const AttemptState: core.serialization.Schema = - core.serialization.enum_(["DELIVERING", "QUEUED", "PENDING", "COMPLETED", "HOLD"]); - -export declare namespace AttemptState { - type Raw = "DELIVERING" | "QUEUED" | "PENDING" | "COMPLETED" | "HOLD"; -} diff --git a/src/serialization/types/AttemptStatus.ts b/src/serialization/types/AttemptStatus.ts index e5e66df..9f84311 100644 --- a/src/serialization/types/AttemptStatus.ts +++ b/src/serialization/types/AttemptStatus.ts @@ -7,8 +7,8 @@ import * as Hookdeck from "../../api/index"; import * as core from "../../core"; export const AttemptStatus: core.serialization.Schema = - core.serialization.enum_(["QUEUED", "FAILED", "SUCCESSFUL", "HOLD"]); + core.serialization.enum_(["FAILED", "SUCCESSFUL"]); export declare namespace AttemptStatus { - type Raw = "QUEUED" | "FAILED" | "SUCCESSFUL" | "HOLD"; + type Raw = "FAILED" | "SUCCESSFUL"; } diff --git a/src/serialization/types/DestinationAuthMethodAwsSignatureConfig.ts b/src/serialization/types/DestinationAuthMethodAwsSignatureConfig.ts index 937d298..d34b27c 100644 --- a/src/serialization/types/DestinationAuthMethodAwsSignatureConfig.ts +++ b/src/serialization/types/DestinationAuthMethodAwsSignatureConfig.ts @@ -12,11 +12,15 @@ export const DestinationAuthMethodAwsSignatureConfig: core.serialization.ObjectS > = core.serialization.object({ accessKeyId: core.serialization.property("access_key_id", core.serialization.string()), secretAccessKey: core.serialization.property("secret_access_key", core.serialization.string()), + region: core.serialization.string().optional(), + service: core.serialization.string().optional(), }); export declare namespace DestinationAuthMethodAwsSignatureConfig { interface Raw { access_key_id: string; secret_access_key: string; + region?: string | null; + service?: string | null; } } diff --git a/src/serialization/types/DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType.ts b/src/serialization/types/DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType.ts index 000896c..fab3145 100644 --- a/src/serialization/types/DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType.ts +++ b/src/serialization/types/DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType.ts @@ -9,8 +9,8 @@ import * as core from "../../core"; export const DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType: core.serialization.Schema< serializers.DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType.Raw, Hookdeck.DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType -> = core.serialization.enum_(["basic", "bearer"]); +> = core.serialization.enum_(["basic", "bearer", "x-www-form-urlencoded"]); export declare namespace DestinationAuthMethodOAuth2ClientCredentialsConfigAuthenticationType { - type Raw = "basic" | "bearer"; + type Raw = "basic" | "bearer" | "x-www-form-urlencoded"; } diff --git a/src/serialization/types/EventAttempt.ts b/src/serialization/types/EventAttempt.ts index 0e3fbcb..e9ce0e5 100644 --- a/src/serialization/types/EventAttempt.ts +++ b/src/serialization/types/EventAttempt.ts @@ -10,13 +10,13 @@ import { AttemptErrorCodes } from "./AttemptErrorCodes"; import { EventAttemptBody } from "./EventAttemptBody"; import { EventAttemptHttpMethod } from "./EventAttemptHttpMethod"; import { AttemptStatus } from "./AttemptStatus"; -import { AttemptState } from "./AttemptState"; export const EventAttempt: core.serialization.ObjectSchema = core.serialization.object({ id: core.serialization.string(), teamId: core.serialization.property("team_id", core.serialization.string()), eventId: core.serialization.property("event_id", core.serialization.string()), + destinationId: core.serialization.property("destination_id", core.serialization.string()), responseStatus: core.serialization.property("response_status", core.serialization.number().optional()), attemptNumber: core.serialization.property("attempt_number", core.serialization.number().optional()), trigger: AttemptTrigger.optional(), @@ -33,8 +33,6 @@ export const EventAttempt: core.serialization.ObjectSchema = - core.serialization.enum_(["body", "headers", "path", "query"]); + core.serialization.list(FilteredMetaItem); export declare namespace FilteredMeta { - type Raw = "body" | "headers" | "path" | "query"; + type Raw = FilteredMetaItem.Raw[]; } diff --git a/src/serialization/types/FilteredMetaItem.ts b/src/serialization/types/FilteredMetaItem.ts new file mode 100644 index 0000000..d7afba8 --- /dev/null +++ b/src/serialization/types/FilteredMetaItem.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Hookdeck from "../../api/index"; +import * as core from "../../core"; + +export const FilteredMetaItem: core.serialization.Schema = + core.serialization.enum_(["body", "headers", "path", "query"]); + +export declare namespace FilteredMetaItem { + type Raw = "body" | "headers" | "path" | "query"; +} diff --git a/src/serialization/types/IgnoredEvent.ts b/src/serialization/types/IgnoredEvent.ts index d972654..bfaf020 100644 --- a/src/serialization/types/IgnoredEvent.ts +++ b/src/serialization/types/IgnoredEvent.ts @@ -16,7 +16,6 @@ export const IgnoredEvent: core.serialization.ObjectSchema = core.serialization.undiscriminatedUnion([FilteredMeta, TransformationFailedMeta]); diff --git a/src/serialization/types/IntegrationProvider.ts b/src/serialization/types/IntegrationProvider.ts index 4bac59d..0a5882f 100644 --- a/src/serialization/types/IntegrationProvider.ts +++ b/src/serialization/types/IntegrationProvider.ts @@ -70,6 +70,7 @@ export const IntegrationProvider: core.serialization.Schema< "RAZORPAY", "MAILCHIMP", "PADDLE", + "PAYPAL", ]); export declare namespace IntegrationProvider { @@ -133,5 +134,6 @@ export declare namespace IntegrationProvider { | "SLACK" | "RAZORPAY" | "MAILCHIMP" - | "PADDLE"; + | "PADDLE" + | "PAYPAL"; } diff --git a/src/serialization/types/Operators.ts b/src/serialization/types/Operators.ts new file mode 100644 index 0000000..e10c25a --- /dev/null +++ b/src/serialization/types/Operators.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Hookdeck from "../../api/index"; +import * as core from "../../core"; + +export const Operators: core.serialization.ObjectSchema = + core.serialization.object({ + gt: core.serialization.date().optional(), + gte: core.serialization.date().optional(), + le: core.serialization.date().optional(), + lte: core.serialization.date().optional(), + any: core.serialization.boolean().optional(), + }); + +export declare namespace Operators { + interface Raw { + gt?: string | null; + gte?: string | null; + le?: string | null; + lte?: string | null; + any?: boolean | null; + } +} diff --git a/src/serialization/types/RetriedEvent.ts b/src/serialization/types/RetriedEvent.ts index 40e8dd6..2257a9f 100644 --- a/src/serialization/types/RetriedEvent.ts +++ b/src/serialization/types/RetriedEvent.ts @@ -5,18 +5,51 @@ import * as serializers from "../index"; import * as Hookdeck from "../../api/index"; import * as core from "../../core"; -import { Event } from "./Event"; -import { EventAttempt } from "./EventAttempt"; +import { AttemptErrorCodes } from "./AttemptErrorCodes"; +import { EventStatus } from "./EventStatus"; +import { ShortEventData } from "./ShortEventData"; export const RetriedEvent: core.serialization.ObjectSchema = core.serialization.object({ - event: Event, - attempt: EventAttempt.optional(), + id: core.serialization.string(), + teamId: core.serialization.property("team_id", core.serialization.string()), + webhookId: core.serialization.property("webhook_id", core.serialization.string()), + sourceId: core.serialization.property("source_id", core.serialization.string()), + destinationId: core.serialization.property("destination_id", core.serialization.string()), + eventDataId: core.serialization.property("event_data_id", core.serialization.string()), + requestId: core.serialization.property("request_id", core.serialization.string()), + attempts: core.serialization.number(), + lastAttemptAt: core.serialization.property("last_attempt_at", core.serialization.date().optional()), + nextAttemptAt: core.serialization.property("next_attempt_at", core.serialization.date().optional()), + responseStatus: core.serialization.property("response_status", core.serialization.number().optional()), + errorCode: core.serialization.property("error_code", AttemptErrorCodes.optional()), + status: EventStatus, + successfulAt: core.serialization.property("successful_at", core.serialization.date().optional()), + cliId: core.serialization.property("cli_id", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), + createdAt: core.serialization.property("created_at", core.serialization.date()), + data: ShortEventData.optional(), }); export declare namespace RetriedEvent { interface Raw { - event: Event.Raw; - attempt?: EventAttempt.Raw | null; + id: string; + team_id: string; + webhook_id: string; + source_id: string; + destination_id: string; + event_data_id: string; + request_id: string; + attempts: number; + last_attempt_at?: string | null; + next_attempt_at?: string | null; + response_status?: number | null; + error_code?: AttemptErrorCodes.Raw | null; + status: EventStatus.Raw; + successful_at?: string | null; + cli_id?: string | null; + updated_at: string; + created_at: string; + data?: ShortEventData.Raw | null; } } diff --git a/src/serialization/types/ShopifyIntegrationConfigs.ts b/src/serialization/types/ShopifyIntegrationConfigs.ts index 21a3f89..f789590 100644 --- a/src/serialization/types/ShopifyIntegrationConfigs.ts +++ b/src/serialization/types/ShopifyIntegrationConfigs.ts @@ -5,30 +5,16 @@ import * as serializers from "../index"; import * as Hookdeck from "../../api/index"; import * as core from "../../core"; -import { ShopifyIntegrationConfigsRateLimitPeriod } from "./ShopifyIntegrationConfigsRateLimitPeriod"; export const ShopifyIntegrationConfigs: core.serialization.ObjectSchema< serializers.ShopifyIntegrationConfigs.Raw, Hookdeck.ShopifyIntegrationConfigs > = core.serialization.object({ webhookSecretKey: core.serialization.property("webhook_secret_key", core.serialization.string()), - rateLimitPeriod: core.serialization.property( - "rate_limit_period", - ShopifyIntegrationConfigsRateLimitPeriod.optional() - ), - rateLimit: core.serialization.property("rate_limit", core.serialization.number().optional()), - apiKey: core.serialization.property("api_key", core.serialization.string().optional()), - apiSecret: core.serialization.property("api_secret", core.serialization.string().optional()), - shop: core.serialization.string().optional(), }); export declare namespace ShopifyIntegrationConfigs { interface Raw { webhook_secret_key: string; - rate_limit_period?: ShopifyIntegrationConfigsRateLimitPeriod.Raw | null; - rate_limit?: number | null; - api_key?: string | null; - api_secret?: string | null; - shop?: string | null; } } diff --git a/src/serialization/types/ShopifyIntegrationConfigsRateLimitPeriod.ts b/src/serialization/types/ShopifyIntegrationConfigsRateLimitPeriod.ts deleted file mode 100644 index ddf168a..0000000 --- a/src/serialization/types/ShopifyIntegrationConfigsRateLimitPeriod.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Hookdeck from "../../api/index"; -import * as core from "../../core"; - -export const ShopifyIntegrationConfigsRateLimitPeriod: core.serialization.Schema< - serializers.ShopifyIntegrationConfigsRateLimitPeriod.Raw, - Hookdeck.ShopifyIntegrationConfigsRateLimitPeriod -> = core.serialization.enum_(["minute", "second"]); - -export declare namespace ShopifyIntegrationConfigsRateLimitPeriod { - type Raw = "minute" | "second"; -} diff --git a/src/serialization/types/Source.ts b/src/serialization/types/Source.ts index df93215..ff5aac9 100644 --- a/src/serialization/types/Source.ts +++ b/src/serialization/types/Source.ts @@ -5,7 +5,7 @@ import * as serializers from "../index"; import * as Hookdeck from "../../api/index"; import * as core from "../../core"; -import { SourceVerification } from "./SourceVerification"; +import { VerificationConfig } from "./VerificationConfig"; import { SourceAllowedHttpMethod } from "./SourceAllowedHttpMethod"; import { SourceCustomResponse } from "./SourceCustomResponse"; import { SourceAllowedHttpMethodItem } from "./SourceAllowedHttpMethodItem"; @@ -17,7 +17,7 @@ export const Source: core.serialization.ObjectSchema = core.serialization.undiscriminatedUnion([VerificationConfig, SourceVerificationOne]); - -export declare namespace SourceVerification { - type Raw = VerificationConfig.Raw | SourceVerificationOne.Raw; -} diff --git a/src/serialization/types/SourceVerificationOne.ts b/src/serialization/types/SourceVerificationOne.ts deleted file mode 100644 index 8c0ea54..0000000 --- a/src/serialization/types/SourceVerificationOne.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Hookdeck from "../../api/index"; -import * as core from "../../core"; - -export const SourceVerificationOne: core.serialization.ObjectSchema< - serializers.SourceVerificationOne.Raw, - Hookdeck.SourceVerificationOne -> = core.serialization.object({}); - -export declare namespace SourceVerificationOne { - interface Raw {} -} diff --git a/src/serialization/types/VerificationConfig.ts b/src/serialization/types/VerificationConfig.ts index e8b24cc..501bbbd 100644 --- a/src/serialization/types/VerificationConfig.ts +++ b/src/serialization/types/VerificationConfig.ts @@ -65,6 +65,7 @@ import { VerificationSlack } from "./VerificationSlack"; import { VerificationRazorpay } from "./VerificationRazorpay"; import { VerificationMailchimp } from "./VerificationMailchimp"; import { VerificationPaddle } from "./VerificationPaddle"; +import { VerificationPaypal } from "./VerificationPaypal"; export const VerificationConfig: core.serialization.Schema< serializers.VerificationConfig.Raw, @@ -131,6 +132,7 @@ export const VerificationConfig: core.serialization.Schema< razorpay: VerificationRazorpay, mailchimp: VerificationMailchimp, paddle: VerificationPaddle, + paypal: VerificationPaypal, }) .transform({ transform: (value) => value, @@ -198,7 +200,8 @@ export declare namespace VerificationConfig { | VerificationConfig.Slack | VerificationConfig.Razorpay | VerificationConfig.Mailchimp - | VerificationConfig.Paddle; + | VerificationConfig.Paddle + | VerificationConfig.Paypal; interface Hmac extends VerificationHmac.Raw { type: "hmac"; @@ -439,4 +442,8 @@ export declare namespace VerificationConfig { interface Paddle extends VerificationPaddle.Raw { type: "paddle"; } + + interface Paypal extends VerificationPaypal.Raw { + type: "paypal"; + } } diff --git a/src/serialization/types/VerificationPaypal.ts b/src/serialization/types/VerificationPaypal.ts new file mode 100644 index 0000000..8fbe3a5 --- /dev/null +++ b/src/serialization/types/VerificationPaypal.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Hookdeck from "../../api/index"; +import * as core from "../../core"; +import { VerificationPaypalConfigs } from "./VerificationPaypalConfigs"; + +export const VerificationPaypal: core.serialization.ObjectSchema< + serializers.VerificationPaypal.Raw, + Hookdeck.VerificationPaypal +> = core.serialization.object({ + configs: VerificationPaypalConfigs.optional(), +}); + +export declare namespace VerificationPaypal { + interface Raw { + configs?: VerificationPaypalConfigs.Raw | null; + } +} diff --git a/src/serialization/types/VerificationPaypalConfigs.ts b/src/serialization/types/VerificationPaypalConfigs.ts new file mode 100644 index 0000000..d7362e1 --- /dev/null +++ b/src/serialization/types/VerificationPaypalConfigs.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Hookdeck from "../../api/index"; +import * as core from "../../core"; + +export const VerificationPaypalConfigs: core.serialization.ObjectSchema< + serializers.VerificationPaypalConfigs.Raw, + Hookdeck.VerificationPaypalConfigs +> = core.serialization.object({ + webhookId: core.serialization.property("webhook_id", core.serialization.string()), +}); + +export declare namespace VerificationPaypalConfigs { + interface Raw { + webhook_id: string; + } +} diff --git a/src/serialization/types/VerificationRechargeConfigs.ts b/src/serialization/types/VerificationRechargeConfigs.ts index 26de51b..6db2e06 100644 --- a/src/serialization/types/VerificationRechargeConfigs.ts +++ b/src/serialization/types/VerificationRechargeConfigs.ts @@ -5,24 +5,16 @@ import * as serializers from "../index"; import * as Hookdeck from "../../api/index"; import * as core from "../../core"; -import { HmacAlgorithms } from "./HmacAlgorithms"; -import { VerificationRechargeConfigsEncoding } from "./VerificationRechargeConfigsEncoding"; export const VerificationRechargeConfigs: core.serialization.ObjectSchema< serializers.VerificationRechargeConfigs.Raw, Hookdeck.VerificationRechargeConfigs > = core.serialization.object({ webhookSecretKey: core.serialization.property("webhook_secret_key", core.serialization.string()), - algorithm: HmacAlgorithms, - headerKey: core.serialization.property("header_key", core.serialization.string()), - encoding: VerificationRechargeConfigsEncoding, }); export declare namespace VerificationRechargeConfigs { interface Raw { webhook_secret_key: string; - algorithm: HmacAlgorithms.Raw; - header_key: string; - encoding: VerificationRechargeConfigsEncoding.Raw; } } diff --git a/src/serialization/types/VerificationRechargeConfigsEncoding.ts b/src/serialization/types/VerificationRechargeConfigsEncoding.ts deleted file mode 100644 index d574734..0000000 --- a/src/serialization/types/VerificationRechargeConfigsEncoding.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Hookdeck from "../../api/index"; -import * as core from "../../core"; - -export const VerificationRechargeConfigsEncoding: core.serialization.Schema< - serializers.VerificationRechargeConfigsEncoding.Raw, - Hookdeck.VerificationRechargeConfigsEncoding -> = core.serialization.enum_(["base64", "base64url", "hex"]); - -export declare namespace VerificationRechargeConfigsEncoding { - type Raw = "base64" | "base64url" | "hex"; -} diff --git a/src/serialization/types/VerificationShopifyConfigs.ts b/src/serialization/types/VerificationShopifyConfigs.ts index c24f976..bf471dd 100644 --- a/src/serialization/types/VerificationShopifyConfigs.ts +++ b/src/serialization/types/VerificationShopifyConfigs.ts @@ -5,30 +5,16 @@ import * as serializers from "../index"; import * as Hookdeck from "../../api/index"; import * as core from "../../core"; -import { VerificationShopifyConfigsRateLimitPeriod } from "./VerificationShopifyConfigsRateLimitPeriod"; export const VerificationShopifyConfigs: core.serialization.ObjectSchema< serializers.VerificationShopifyConfigs.Raw, Hookdeck.VerificationShopifyConfigs > = core.serialization.object({ webhookSecretKey: core.serialization.property("webhook_secret_key", core.serialization.string()), - rateLimitPeriod: core.serialization.property( - "rate_limit_period", - VerificationShopifyConfigsRateLimitPeriod.optional() - ), - rateLimit: core.serialization.property("rate_limit", core.serialization.number().optional()), - apiKey: core.serialization.property("api_key", core.serialization.string().optional()), - apiSecret: core.serialization.property("api_secret", core.serialization.string().optional()), - shop: core.serialization.string().optional(), }); export declare namespace VerificationShopifyConfigs { interface Raw { webhook_secret_key: string; - rate_limit_period?: VerificationShopifyConfigsRateLimitPeriod.Raw | null; - rate_limit?: number | null; - api_key?: string | null; - api_secret?: string | null; - shop?: string | null; } } diff --git a/src/serialization/types/VerificationShopifyConfigsRateLimitPeriod.ts b/src/serialization/types/VerificationShopifyConfigsRateLimitPeriod.ts deleted file mode 100644 index 16f7849..0000000 --- a/src/serialization/types/VerificationShopifyConfigsRateLimitPeriod.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as serializers from "../index"; -import * as Hookdeck from "../../api/index"; -import * as core from "../../core"; - -export const VerificationShopifyConfigsRateLimitPeriod: core.serialization.Schema< - serializers.VerificationShopifyConfigsRateLimitPeriod.Raw, - Hookdeck.VerificationShopifyConfigsRateLimitPeriod -> = core.serialization.enum_(["minute", "second"]); - -export declare namespace VerificationShopifyConfigsRateLimitPeriod { - type Raw = "minute" | "second"; -} diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index 6499be5..07ea7f5 100644 --- a/src/serialization/types/index.ts +++ b/src/serialization/types/index.ts @@ -21,11 +21,11 @@ export * from "./IssueTrigger"; export * from "./IssueTriggerPaginatedResult"; export * from "./ApiErrorResponseData"; export * from "./ApiErrorResponse"; +export * from "./Operators"; export * from "./DeletedIssueTriggerResponse"; export * from "./AttemptTrigger"; export * from "./AttemptErrorCodes"; export * from "./AttemptStatus"; -export * from "./AttemptState"; export * from "./EventAttemptBodyZero"; export * from "./EventAttemptBody"; export * from "./EventAttemptHttpMethod"; @@ -81,7 +81,6 @@ export * from "./ApiKeyIntegrationConfigs"; export * from "./HandledApiKeyIntegrationConfigs"; export * from "./HandledHmacConfigs"; export * from "./BasicAuthIntegrationConfigs"; -export * from "./ShopifyIntegrationConfigsRateLimitPeriod"; export * from "./ShopifyIntegrationConfigs"; export * from "./VercelLogDrainsIntegrationConfigs"; export * from "./IntegrationConfigsSeven"; @@ -115,6 +114,7 @@ export * from "./Request"; export * from "./RequestPaginatedResult"; export * from "./RetryRequest"; export * from "./IgnoredEventCause"; +export * from "./FilteredMetaItem"; export * from "./FilteredMeta"; export * from "./TransformationFailedMeta"; export * from "./IgnoredEventMeta"; @@ -137,14 +137,12 @@ export * from "./VerificationTwitterConfigs"; export * from "./VerificationTwitter"; export * from "./VerificationStripeConfigs"; export * from "./VerificationStripe"; -export * from "./VerificationRechargeConfigsEncoding"; export * from "./VerificationRechargeConfigs"; export * from "./VerificationRecharge"; export * from "./VerificationTwilioConfigs"; export * from "./VerificationTwilio"; export * from "./VerificationGitHubConfigs"; export * from "./VerificationGitHub"; -export * from "./VerificationShopifyConfigsRateLimitPeriod"; export * from "./VerificationShopifyConfigs"; export * from "./VerificationShopify"; export * from "./VerificationPostmarkConfigs"; @@ -243,13 +241,13 @@ export * from "./VerificationMailchimpConfigs"; export * from "./VerificationMailchimp"; export * from "./VerificationPaddleConfigs"; export * from "./VerificationPaddle"; +export * from "./VerificationPaypalConfigs"; +export * from "./VerificationPaypal"; export * from "./VerificationConfig"; export * from "./SourceAllowedHttpMethodItem"; export * from "./SourceAllowedHttpMethod"; export * from "./SourceCustomResponseContentType"; export * from "./SourceCustomResponse"; -export * from "./SourceVerificationOne"; -export * from "./SourceVerification"; export * from "./Source"; export * from "./SourcePaginatedResult"; export * from "./TopicsValue"; diff --git a/tests/unit/auth/BasicAuth.test.ts b/tests/unit/auth/BasicAuth.test.ts new file mode 100644 index 0000000..fc35704 --- /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 0000000..7757b87 --- /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 0000000..0e14a8c --- /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 0000000..f2cd24b --- /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 0000000..9b315ad --- /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 0000000..1b1462c --- /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 0000000..3510779 --- /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 0000000..5969d51 --- /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 0000000..b53e043 --- /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 0000000..9cabfa0 --- /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 0000000..e307b15 --- /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("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 0000000..861142a --- /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("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("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("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("stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const dest = new (await import("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("stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const buffer: Uint8Array[] = []; + const dest = new (await import("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("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("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("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("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("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("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 0000000..1d171ce --- /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 0000000..aff7579 --- /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("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/zurg/date/date.test.ts b/tests/unit/zurg/date/date.test.ts new file mode 100644 index 0000000..2790268 --- /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 0000000..ab0df02 --- /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 0000000..6906bf4 --- /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 0000000..8813cc9 --- /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 0000000..8b7d5e4 --- /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 0000000..fb219d5 --- /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 0000000..424ed64 --- /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 0000000..fa6c888 --- /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 0000000..9f5dd0e --- /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 0000000..54fc8c4 --- /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 0000000..0acf0e2 --- /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 0000000..d87a65f --- /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 0000000..1adbbe2 --- /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 0000000..897a829 --- /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 0000000..2d01415 --- /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 0000000..57b2368 --- /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 0000000..4d17a7d --- /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 0000000..7e4ba39 --- /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 0000000..da10086 --- /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 0000000..94089a9 --- /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 0000000..e17f908 --- /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 0000000..5dc8809 --- /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 0000000..0e66433 --- /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 0000000..7901846 --- /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 0000000..67b6c92 --- /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 0000000..75b2c08 --- /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 3113e69..546aaaf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10,131 +10,131 @@ "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.24" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.7.tgz#882fd9e09e8ee324e496bd040401c6f046ef4465" - integrity sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA== +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.25.7": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.25.7.tgz#438f2c524071531d643c6f0188e1e28f130cebc7" + integrity sha512-0xZJFNE5XMpENsgfHYTw8FbX4kv53mFLn2i3XPoq69LyhYSCBJtitaHx9QnsVTrsogI4Z3+HtEfZ2/GFPOtf5g== dependencies: - "@babel/highlight" "^7.24.7" + "@babel/highlight" "^7.25.7" 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== +"@babel/compat-data@^7.25.7": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.25.7.tgz#b8479fe0018ef0ac87b6b7a5c6916fcd67ae2c9c" + integrity sha512-9ickoLz+hcXCeh7jrcin+/SLWm+GkxE2kTvoYyp38p4WkdFXfQJxDFGWp/YHjiKLPx06z2A7W8XKuqbReXDzsw== -"@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== +"@babel/core@^7.0.0", "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.25.7.tgz#1b3d144157575daf132a3bc80b2b18e6e3ca6ece" + integrity sha512-yJ474Zv3cwiSOO9nXJuqzvwEeM+chDuQ8GJirw+pZ91sCGCyOZ3dJkVE09fTV0VEVzXyLWhh3G/AolYTPX7Mow== dependencies: "@ampproject/remapping" "^2.2.0" - "@babel/code-frame" "^7.24.7" - "@babel/generator" "^7.25.0" - "@babel/helper-compilation-targets" "^7.25.2" - "@babel/helper-module-transforms" "^7.25.2" - "@babel/helpers" "^7.25.0" - "@babel/parser" "^7.25.0" - "@babel/template" "^7.25.0" - "@babel/traverse" "^7.25.2" - "@babel/types" "^7.25.2" + "@babel/code-frame" "^7.25.7" + "@babel/generator" "^7.25.7" + "@babel/helper-compilation-targets" "^7.25.7" + "@babel/helper-module-transforms" "^7.25.7" + "@babel/helpers" "^7.25.7" + "@babel/parser" "^7.25.7" + "@babel/template" "^7.25.7" + "@babel/traverse" "^7.25.7" + "@babel/types" "^7.25.7" convert-source-map "^2.0.0" debug "^4.1.0" gensync "^1.0.0-beta.2" 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.7", "@babel/generator@^7.7.2": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.25.7.tgz#de86acbeb975a3e11ee92dd52223e6b03b479c56" + integrity sha512-5Dqpl5fyV9pIAD62yK9P7fcA768uVPUyrQmqpqstHWgMma4feF1x/oFysBCVZLY5wJ2GkMUCdsNDnGZrPoR6rA== dependencies: - "@babel/types" "^7.25.0" + "@babel/types" "^7.25.7" "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.25" - jsesc "^2.5.1" + jsesc "^3.0.2" -"@babel/helper-compilation-targets@^7.25.2": - version "7.25.2" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.2.tgz#e1d9410a90974a3a5a66e84ff55ef62e3c02d06c" - integrity sha512-U2U5LsSaZ7TAt3cfaymQ8WHh0pxvdHoEk6HVpaexxixjyEquMh0L0YNJNM6CTGKMXV1iksi0iZkGw4AcFkPaaw== +"@babel/helper-compilation-targets@^7.25.7": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.7.tgz#11260ac3322dda0ef53edfae6e97b961449f5fa4" + integrity sha512-DniTEax0sv6isaw6qSQSfV4gVRNtw2rte8HHM45t9ZR0xILaufBRNkpMifCRiAPyvL4ACD6v0gfCwCmtOQaV4A== dependencies: - "@babel/compat-data" "^7.25.2" - "@babel/helper-validator-option" "^7.24.8" - browserslist "^4.23.1" + "@babel/compat-data" "^7.25.7" + "@babel/helper-validator-option" "^7.25.7" + browserslist "^4.24.0" lru-cache "^5.1.1" semver "^6.3.1" -"@babel/helper-module-imports@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz#f2f980392de5b84c3328fc71d38bd81bbb83042b" - integrity sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA== - dependencies: - "@babel/traverse" "^7.24.7" - "@babel/types" "^7.24.7" - -"@babel/helper-module-transforms@^7.25.2": - version "7.25.2" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.25.2.tgz#ee713c29768100f2776edf04d4eb23b8d27a66e6" - integrity sha512-BjyRAbix6j/wv83ftcVJmBt72QtHI56C7JXZoG2xATiLpmoC7dpd8WnkikExHDVPpi/3qCmO6WY1EaXOluiecQ== - dependencies: - "@babel/helper-module-imports" "^7.24.7" - "@babel/helper-simple-access" "^7.24.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": - 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== - -"@babel/helper-simple-access@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz#bcade8da3aec8ed16b9c4953b74e506b51b5edb3" - integrity sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg== - dependencies: - "@babel/traverse" "^7.24.7" - "@babel/types" "^7.24.7" - -"@babel/helper-string-parser@^7.24.8": - version "7.24.8" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz#5b3329c9a58803d5df425e5785865881a81ca48d" - integrity sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ== - -"@babel/helper-validator-identifier@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz#75b889cfaf9e35c2aaf42cf0d72c8e91719251db" - integrity sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w== - -"@babel/helper-validator-option@^7.24.8": - version "7.24.8" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz#3725cdeea8b480e86d34df15304806a06975e33d" - 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== - dependencies: - "@babel/template" "^7.25.0" - "@babel/types" "^7.25.0" - -"@babel/highlight@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.7.tgz#a05ab1df134b286558aae0ed41e6c5f731bf409d" - integrity sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw== - dependencies: - "@babel/helper-validator-identifier" "^7.24.7" +"@babel/helper-module-imports@^7.25.7": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.25.7.tgz#dba00d9523539152906ba49263e36d7261040472" + integrity sha512-o0xCgpNmRohmnoWKQ0Ij8IdddjyBFE4T2kagL/x6M3+4zUgc+4qTOUBoNe4XxDskt1HPKO007ZPiMgLDq2s7Kw== + dependencies: + "@babel/traverse" "^7.25.7" + "@babel/types" "^7.25.7" + +"@babel/helper-module-transforms@^7.25.7": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.25.7.tgz#2ac9372c5e001b19bc62f1fe7d96a18cb0901d1a" + integrity sha512-k/6f8dKG3yDz/qCwSM+RKovjMix563SLxQFo0UhRNo239SP6n9u5/eLtKD6EAjwta2JHJ49CsD8pms2HdNiMMQ== + dependencies: + "@babel/helper-module-imports" "^7.25.7" + "@babel/helper-simple-access" "^7.25.7" + "@babel/helper-validator-identifier" "^7.25.7" + "@babel/traverse" "^7.25.7" + +"@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.25.7", "@babel/helper-plugin-utils@^7.8.0": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.7.tgz#8ec5b21812d992e1ef88a9b068260537b6f0e36c" + integrity sha512-eaPZai0PiqCi09pPs3pAFfl/zYgGaE6IdXtYvmf0qlcDTd3WCtO7JWCcRd64e0EQrcYgiHibEZnOGsSY4QSgaw== + +"@babel/helper-simple-access@^7.25.7": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.25.7.tgz#5eb9f6a60c5d6b2e0f76057004f8dacbddfae1c0" + integrity sha512-FPGAkJmyoChQeM+ruBGIDyrT2tKfZJO8NcxdC+CWNJi7N8/rZpSxK7yvBJ5O/nF1gfu5KzN7VKG3YVSLFfRSxQ== + dependencies: + "@babel/traverse" "^7.25.7" + "@babel/types" "^7.25.7" + +"@babel/helper-string-parser@^7.25.7": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.7.tgz#d50e8d37b1176207b4fe9acedec386c565a44a54" + integrity sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g== + +"@babel/helper-validator-identifier@^7.25.7": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.7.tgz#77b7f60c40b15c97df735b38a66ba1d7c3e93da5" + integrity sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg== + +"@babel/helper-validator-option@^7.25.7": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.25.7.tgz#97d1d684448228b30b506d90cace495d6f492729" + integrity sha512-ytbPLsm+GjArDYXJ8Ydr1c/KJuutjF2besPNbIZnZ6MKUxi/uTA22t2ymmA4WFjZFpjiAMO0xuuJPqK2nvDVfQ== + +"@babel/helpers@^7.25.7": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.25.7.tgz#091b52cb697a171fe0136ab62e54e407211f09c2" + integrity sha512-Sv6pASx7Esm38KQpF/U/OXLwPPrdGHNKoeblRxgZRLXnAtnkEe4ptJPDtAZM7fBLadbc1Q07kQpSiGQ0Jg6tRA== + dependencies: + "@babel/template" "^7.25.7" + "@babel/types" "^7.25.7" + +"@babel/highlight@^7.25.7": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.25.7.tgz#20383b5f442aa606e7b5e3043b0b1aafe9f37de5" + integrity sha512-iYyACpW3iW8Fw+ZybQK+drQre+ns/tKpXbNESfrhNnPLIklLbXr7MYJ6gPEd0iETGLOK+SxMjVvKb/ffmk+FEw== + dependencies: + "@babel/helper-validator-identifier" "^7.25.7" chalk "^2.4.2" 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.7": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.25.7.tgz#99b927720f4ddbfeb8cd195a363ed4532f87c590" + integrity sha512-aZn7ETtQsjjGG5HruveUK06cU3Hljuhd9Iojm4M8WWv3wLE6OkE5PWbDUkItmMgegmccaITudyuW5RPYrYlgWw== dependencies: - "@babel/types" "^7.25.2" + "@babel/types" "^7.25.7" "@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.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.25.7.tgz#d78dd0499d30df19a598e63ab895e21b909bc43f" + integrity sha512-AqVo+dguCgmpi/3mYBdu9lkngOBlQ2w2vnNpa6gfiCxQZLzV4ZbhsXitJ2Yblkoe1VQwtHSaNmIaGll/26YWRw== dependencies: - "@babel/helper-plugin-utils" "^7.24.7" + "@babel/helper-plugin-utils" "^7.25.7" "@babel/plugin-syntax-import-meta@^7.10.4": version "7.10.4" @@ -186,11 +186,11 @@ "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-jsx@^7.7.2": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.7.tgz#39a1fa4a7e3d3d7f34e2acc6be585b718d30e02d" - integrity sha512-6ddciUPe/mpMnOKv/U+RSd2vvVy+Yw/JfBB0ZHYjEZt9NLHmCUylNYlsbqCCS1Bffjlb0fCwC9Vqz+sBz6PsiQ== + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.25.7.tgz#5352d398d11ea5e7ef330c854dea1dae0bf18165" + integrity sha512-ruZOnKO+ajVL/MVx+PwNBPOkrnXTXoWMtte1MBpegfCArhqOe3Bj52avVj1huLLxNKYKXYaSxZ2F+woK1ekXfw== dependencies: - "@babel/helper-plugin-utils" "^7.24.7" + "@babel/helper-plugin-utils" "^7.25.7" "@babel/plugin-syntax-logical-assignment-operators@^7.10.4": version "7.10.4" @@ -249,41 +249,48 @@ "@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== - dependencies: - "@babel/helper-plugin-utils" "^7.24.7" - -"@babel/template@^7.25.0", "@babel/template@^7.3.3": - version "7.25.0" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.25.0.tgz#e733dc3134b4fede528c15bc95e89cb98c52592a" - integrity sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q== - dependencies: - "@babel/code-frame" "^7.24.7" - "@babel/parser" "^7.25.0" - "@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== - dependencies: - "@babel/code-frame" "^7.24.7" - "@babel/generator" "^7.25.0" - "@babel/parser" "^7.25.3" - "@babel/template" "^7.25.0" - "@babel/types" "^7.25.2" + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.25.7.tgz#bfc05b0cc31ebd8af09964650cee723bb228108b" + integrity sha512-rR+5FDjpCHqqZN2bzZm18bVYGaejGq5ZkpVCJLXor/+zlSrSoc4KWcHI0URVWjl/68Dyr1uwZUz/1njycEAv9g== + dependencies: + "@babel/helper-plugin-utils" "^7.25.7" + +"@babel/runtime@^7.0.0": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.25.7.tgz#7ffb53c37a8f247c8c4d335e89cdf16a2e0d0fb6" + integrity sha512-FjoyLe754PMiYsFaN5C94ttGiOmBNYTf6pLr4xXHAT5uctHb092PBszndLDR5XA/jghQvn4n7JMHl7dmTgbm9w== + dependencies: + regenerator-runtime "^0.14.0" + +"@babel/template@^7.25.7", "@babel/template@^7.3.3": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.25.7.tgz#27f69ce382855d915b14ab0fe5fb4cbf88fa0769" + integrity sha512-wRwtAgI3bAS+JGU2upWNL9lSlDcRCqD05BZ1n3X2ONLH1WilFP6O1otQjeMK/1g0pvYcXC7b/qVUB1keofjtZA== + dependencies: + "@babel/code-frame" "^7.25.7" + "@babel/parser" "^7.25.7" + "@babel/types" "^7.25.7" + +"@babel/traverse@^7.25.7": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.7.tgz#83e367619be1cab8e4f2892ef30ba04c26a40fa8" + integrity sha512-jatJPT1Zjqvh/1FyJs6qAHL+Dzb7sTb+xr7Q+gM1b+1oBsMsQQ4FkVKb6dFlJvLlVssqkRzV05Jzervt9yhnzg== + dependencies: + "@babel/code-frame" "^7.25.7" + "@babel/generator" "^7.25.7" + "@babel/parser" "^7.25.7" + "@babel/template" "^7.25.7" + "@babel/types" "^7.25.7" 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.25.7", "@babel/types@^7.3.3": + version "7.25.7" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.25.7.tgz#1b7725c1d3a59f328cb700ce704c46371e6eef9b" + integrity sha512-vwIVdXG+j+FOpkwqHRcBgHLYNL7XMkufrlaFvL9o6Ai9sJn9+PdyIL5qa0XzTZw084c+u9LOls53eoZWP/W5WQ== dependencies: - "@babel/helper-string-parser" "^7.24.8" - "@babel/helper-validator-identifier" "^7.24.7" + "@babel/helper-string-parser" "^7.25.7" + "@babel/helper-validator-identifier" "^7.25.7" to-fast-properties "^2.0.0" "@bcoe/v8-coverage@^0.2.3": @@ -640,9 +647,9 @@ form-data "^4.0.0" "@types/node@*": - version "22.5.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-22.5.0.tgz#10f01fe9465166b4cab72e75f60d8b99d019f958" - integrity sha512-DkFrJOe+rfdHTqqMg0bSNlGlQ85hSoh2TPzZyhHsXnMtligRWpxUySiyw8FY14ITt24HVCiQPWxS3KO/QlGmWg== + version "22.7.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.5.tgz#cfde981727a7ab3611a481510b473ae54442b92b" + integrity sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ== dependencies: undici-types "~6.19.2" @@ -697,9 +704,9 @@ acorn-globals@^7.0.0: acorn-walk "^8.0.2" 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" @@ -849,13 +856,13 @@ braces@^3.0.3: dependencies: fill-range "^7.1.1" -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== +browserslist@^4.24.0: + version "4.24.0" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.24.0.tgz#a1325fe4bc80b64fda169629fc01b3d6cecd38d4" + integrity sha512-Rmb62sR1Zpjql25eSanFGEhAxcFwfA1K0GuQcLoaJBAcENegrQut3hYdhXFF1obQfiDyqIW/cLM5HSJ/9k884A== dependencies: - caniuse-lite "^1.0.30001646" - electron-to-chromium "^1.5.4" + caniuse-lite "^1.0.30001663" + electron-to-chromium "^1.5.28" node-releases "^2.0.18" update-browserslist-db "^1.1.0" @@ -904,10 +911,10 @@ camelcase@^6.2.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" 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== +caniuse-lite@^1.0.30001663: + version "1.0.30001667" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001667.tgz#99fc5ea0d9c6e96897a104a8352604378377f949" + integrity sha512-7LTwJjcRkzKFmtqGsibMeuXmvFDfZq/nzIjnmgCGzKKRVzjD72selLDK1oPF/Oxzmt4fNcPvTDvGqSDG4tCALw== chalk@^2.4.2: version "2.4.2" @@ -937,9 +944,9 @@ ci-info@^3.2.0: 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" @@ -1001,6 +1008,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 +1062,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" @@ -1102,10 +1114,10 @@ domexception@^4.0.0: dependencies: webidl-conversions "^7.0.0" -electron-to-chromium@^1.5.4: - version "1.5.13" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.13.tgz#1abf0410c5344b2b829b7247e031f02810d442e6" - integrity sha512-lbBcvtIJ4J6sS4tb5TLp1b4LyfCdMkwStzXPyAgVgTRAsep4bvrAGaBOP7ZJtQMNJpSQ9SqG4brWOroNaQtm7Q== +electron-to-chromium@^1.5.28: + version "1.5.35" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.35.tgz#1d38d386186c72b1fa6e74c3a7de5f888b503100" + integrity sha512-hOSRInrIDm0Brzp4IHW2F/VM+638qOL2CzE0DgpnGzKW27C95IqqeqgKz/hxHGnvPxvQGpHUGD5qRVC9EZY2+A== emittery@^0.13.1: version "0.13.1" @@ -1141,10 +1153,10 @@ es-errors@^1.3.0: resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== -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== +escalade@^3.1.1, escalade@^3.2.0: + 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" @@ -1225,6 +1237,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,10 +1275,10 @@ 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: - version "4.0.0" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" - integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== +form-data@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.1.tgz#ba1076daaaa5bfd7e99c1a6cb02aa0a5cff90d48" + integrity sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw== dependencies: asynckit "^0.4.0" combined-stream "^1.0.8" @@ -1300,6 +1335,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: + 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" @@ -1436,9 +1476,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 +1507,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" @@ -1947,10 +1992,10 @@ jsdom@^20.0.0: ws "^8.11.0" xml-name-validator "^4.0.0" -jsesc@^2.5.1: - version "2.5.2" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" - integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== +jsesc@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.0.2.tgz#bb8b09a6597ba426425f2e4a07245c3d00b9343e" + integrity sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g== json-parse-even-better-errors@^2.3.0: version "2.3.1" @@ -1984,11 +2029,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" @@ -2021,9 +2076,9 @@ merge-stream@^2.0.0: 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== + 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" @@ -2052,10 +2107,10 @@ 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" @@ -2092,9 +2147,9 @@ npm-run-path@^4.0.1: path-key "^3.0.0" nwsapi@^2.2.2: - version "2.2.12" - resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.12.tgz#fb6af5c0ec35b27b4581eb3bbad34ec9e5c696f8" - integrity sha512-qXDmcVlZV4XRtKFzddidpfVP4oMSGhga+xdMc25mv8kaLUHtgzCDhUxkrN8exkGdTlLNaXj7CV3GtON7zuGZ+w== + version "2.2.13" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.13.tgz#e56b4e98960e7a040e5474536587e599c4ff4655" + integrity sha512-cTGB9ptp9dY9A5VbMSe7fQBcl/tt22Vcqdq8+eN93rblOuE0aCFu4aZ2vMwct/2t+lFnosm8RkQW1I0Omb1UtQ== object-inspect@^1.13.1: version "1.13.2" @@ -2178,10 +2233,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== -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== +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.1.0: + 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" @@ -2227,7 +2287,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,6 +2304,11 @@ 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" @@ -2254,6 +2319,11 @@ react-is@^18.0.0: resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== +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" @@ -2492,6 +2562,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" @@ -2544,12 +2621,12 @@ universalify@^0.2.0: integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== update-browserslist-db@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz#7ca61c0d8650766090728046e416a8cde682859e" - integrity sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ== + version "1.1.1" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz#80846fba1d79e82547fb661f8d141e0945755fe5" + integrity sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A== dependencies: - escalade "^3.1.2" - picocolors "^1.0.1" + escalade "^3.2.0" + picocolors "^1.1.0" url-join@4.0.1: version "4.0.1" @@ -2592,6 +2669,11 @@ webidl-conversions@^3.0.0: 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" @@ -2625,6 +2707,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"