diff --git a/src/index.ts b/src/index.ts index 486c4a54..8015f909 100644 --- a/src/index.ts +++ b/src/index.ts @@ -58,7 +58,7 @@ export interface ClientOptions { * Note that request timeouts are retried by default, so in a worst-case scenario you may wait * much longer than this timeout before the promise succeeds or fails. */ - timeout?: number; + timeout?: number | undefined; /** * An HTTP agent used to manage HTTP(S) connections. @@ -66,7 +66,7 @@ export interface ClientOptions { * If not provided, an agent will be constructed by default in the Node.js environment, * otherwise no agent is used. */ - httpAgent?: Agent; + httpAgent?: Agent | undefined; /** * Specify a custom `fetch` function implementation. @@ -82,7 +82,7 @@ export interface ClientOptions { * * @default 2 */ - maxRetries?: number; + maxRetries?: number | undefined; /** * Default headers to include with every request to the API. @@ -90,7 +90,7 @@ export interface ClientOptions { * These can be removed in individual requests by explicitly setting the * header to `undefined` or `null` in request options. */ - defaultHeaders?: Core.Headers; + defaultHeaders?: Core.Headers | undefined; /** * Default query parameters to include with every request to the API. @@ -98,7 +98,7 @@ export interface ClientOptions { * These can be removed in individual requests by explicitly setting the * param to `undefined` in request options. */ - defaultQuery?: Core.DefaultQuery; + defaultQuery?: Core.DefaultQuery | undefined; } /** diff --git a/src/resources/video/assets.ts b/src/resources/video/assets.ts index 9460f327..4d2ad5c4 100644 --- a/src/resources/video/assets.ts +++ b/src/resources/video/assets.ts @@ -225,7 +225,7 @@ export interface Asset { created_at: string; /** - * @deprecated: This field is deprecated. Please use `video_quality` instead. The + * @deprecated This field is deprecated. Please use `video_quality` instead. The * encoding tier informs the cost, quality, and available platform features for the * asset. The default encoding tier for an account can be set in the Mux Dashboard. * [See the video quality guide for more details.](https://docs.mux.com/guides/use-video-quality-levels) @@ -297,7 +297,7 @@ export interface Asset { max_stored_frame_rate?: number; /** - * @deprecated: This field is deprecated. Please use `resolution_tier` instead. The + * @deprecated This field is deprecated. Please use `resolution_tier` instead. The * maximum resolution that has been stored for the asset. The asset may be * delivered at lower resolutions depending on the device and bandwidth, however it * cannot be delivered at a higher value than is stored. @@ -581,7 +581,7 @@ export interface AssetOptions { advanced_playback_policies?: Array; /** - * @deprecated: This field is deprecated. Please use `video_quality` instead. The + * @deprecated This field is deprecated. Please use `video_quality` instead. The * encoding tier informs the cost, quality, and available platform features for the * asset. The default encoding tier for an account can be set in the Mux Dashboard. * [See the video quality guide for more details.](https://docs.mux.com/guides/use-video-quality-levels) @@ -1210,7 +1210,7 @@ export interface Track { language_code?: string; /** - * @deprecated: Only set for the `audio` type track. + * @deprecated Only set for the `audio` type track. */ max_channel_layout?: string; diff --git a/src/resources/video/delivery-usage.ts b/src/resources/video/delivery-usage.ts index b377eb87..6cf881bb 100644 --- a/src/resources/video/delivery-usage.ts +++ b/src/resources/video/delivery-usage.ts @@ -38,7 +38,7 @@ export interface DeliveryReport { asset_duration: number; /** - * @deprecated: This field is deprecated. Please use `asset_video_quality` instead. + * @deprecated This field is deprecated. Please use `asset_video_quality` instead. * The encoding tier that the asset was ingested at. * [See the video quality guide for more details.](https://docs.mux.com/guides/use-video-quality-levels) */ diff --git a/src/resources/video/live-streams.ts b/src/resources/video/live-streams.ts index 0d71c19e..57165d5c 100644 --- a/src/resources/video/live-streams.ts +++ b/src/resources/video/live-streams.ts @@ -358,11 +358,11 @@ export interface LiveStream { generated_subtitles?: Array; /** - * @deprecated: This field is deprecated. Please use `latency_mode` instead. - * Latency is the time from when the streamer transmits a frame of video to when - * you see it in the player. Setting this option will enable compatibility with the - * LL-HLS specification for low-latency streaming. This typically has lower latency - * than Reduced Latency streams, and cannot be combined with Reduced Latency. + * @deprecated This field is deprecated. Please use `latency_mode` instead. Latency + * is the time from when the streamer transmits a frame of video to when you see it + * in the player. Setting this option will enable compatibility with the LL-HLS + * specification for low-latency streaming. This typically has lower latency than + * Reduced Latency streams, and cannot be combined with Reduced Latency. */ low_latency?: boolean; @@ -415,10 +415,9 @@ export interface LiveStream { reconnect_window?: number; /** - * @deprecated: This field is deprecated. Please use `latency_mode` instead. - * Latency is the time from when the streamer transmits a frame of video to when - * you see it in the player. Set this if you want lower latency for your live - * stream. See the + * @deprecated This field is deprecated. Please use `latency_mode` instead. Latency + * is the time from when the streamer transmits a frame of video to when you see it + * in the player. Set this if you want lower latency for your live stream. See the * [Reduce live stream latency guide](https://docs.mux.com/guides/reduce-live-stream-latency) * to understand the tradeoffs. */ diff --git a/src/resources/webhooks.ts b/src/resources/webhooks.ts index 7991e1a0..4b59bad4 100644 --- a/src/resources/webhooks.ts +++ b/src/resources/webhooks.ts @@ -543,7 +543,7 @@ export namespace VideoDeliveryHighTrafficWebhookEvent { asset_duration?: number; /** - * @deprecated: This field is deprecated. Please use `asset_video_quality` instead. + * @deprecated This field is deprecated. Please use `asset_video_quality` instead. * The encoding tier that the asset was ingested at. * [See the video quality guide for more details.](https://docs.mux.com/guides/use-video-quality-levels) */ diff --git a/tests/api-resources/video/transcription-vocabularies.test.ts b/tests/api-resources/video/transcription-vocabularies.test.ts index 066a519d..5889f8ab 100644 --- a/tests/api-resources/video/transcription-vocabularies.test.ts +++ b/tests/api-resources/video/transcription-vocabularies.test.ts @@ -94,7 +94,7 @@ describe('resource transcriptionVocabularies', () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( client.video.transcriptionVocabularies.list( - { limit: 0, page: 0 }, + { limit: 10, page: 0 }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(Mux.NotFoundError); diff --git a/tests/index.test.ts b/tests/index.test.ts index 0a5957a7..6b1f66a0 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -101,6 +101,16 @@ describe('instantiate client', () => { expect(response).toEqual({ url: 'http://localhost:5000/foo', custom: true }); }); + test('explicit global fetch', async () => { + // make sure the global fetch type is assignable to our Fetch type + const client = new Mux({ + baseURL: 'http://localhost:5000/', + tokenId: 'my token id', + tokenSecret: 'my secret', + fetch: defaultFetch, + }); + }); + test('custom signal', async () => { const client = new Mux({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',