Skip to content

Commit

Permalink
release: 10.0.0 (#524)
Browse files Browse the repository at this point in the history
* chore: rebuild project due to codegen change (#523)

* docs: remove suggestion to use `npm` call out (#525)

* chore: remove redundant word in comment (#526)

* feat(internal): make git install file structure match npm (#527)

* chore(internal): remove unnecessary getRequestClient function (#528)

* chore(internal): bump cross-spawn to v7.0.6 (#529)

Note: it is a dev transitive dependency.

* chore(types): nicer error class types + jsdocs (#530)

* chore(internal): update isAbsoluteURL (#531)

* feat: generate more types that are used as request bodies (#532)

* feat(api): api update (#533)

* trigger CI

* chore(internal): fix some typos (#534)

* codegen metadata

* fix(client): normalize method (#535)

* feat: Add video.asset.non_standard_input_detected webhook (#317) (#536)

* docs: minor formatting changes (#537)

* chore(internal): codegen related update (#538)

* chore(internal): codegen related update (#539)

* chore(internal): codegen related update (#541)

* feat(client): send `X-Stainless-Timeout` header (#542)

* feat: Add passthrough field on static renditions (#320) (#543)

* feat: Additional Standard Dimensions (#319) (#544)

* fix(client): fix export map for index exports (#545)

* chore!: deprecate `mp4_support` option (#321) (#547)

* chore(internal): fix devcontainers setup (#548)

* codegen metadata

* release: 10.0.0

---------

Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
Co-authored-by: Samuel El-Borai <sam@elborai.me>
  • Loading branch information
stainless-app[bot] and dgellow authored Feb 25, 2025
1 parent 3b6a553 commit 8efeda0
Show file tree
Hide file tree
Showing 37 changed files with 495 additions and 285 deletions.
23 changes: 0 additions & 23 deletions .devcontainer/Dockerfile

This file was deleted.

27 changes: 12 additions & 15 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: /~https://github.com/devcontainers/templates/tree/main/src/debian
{
"name": "Debian",
"build": {
"dockerfile": "Dockerfile"
"name": "Development",
"image": "mcr.microsoft.com/devcontainers/typescript-node:latest",
"features": {
"ghcr.io/devcontainers/features/node:1": {}
},
"postCreateCommand": "yarn install",
"customizations": {
"vscode": {
"extensions": [
"esbenp.prettier-vscode"
]
}
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "9.0.1"
".": "10.0.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 88
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mux%2Fmux-59cc6a0736ea7363f64111dcca8774fe5e7f353c547071c7064574456c178486.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mux%2Fmux-2eec862e75143314aec7ca531a90eecc404ce10a5038c2140810caaeb22cae43.yml
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,51 @@
# Changelog

## 10.0.0 (2025-02-21)

Full Changelog: [v9.0.1...v10.0.0](/~https://github.com/muxinc/mux-node-sdk/compare/v9.0.1...v10.0.0)

### ⚠ BREAKING CHANGES

* deprecate `mp4_support` option ([#321](/~https://github.com/muxinc/mux-node-sdk/issues/321)) (#547)

### Features

* Add passthrough field on static renditions ([#320](/~https://github.com/muxinc/mux-node-sdk/issues/320)) ([#543](/~https://github.com/muxinc/mux-node-sdk/issues/543)) ([33ceef2](/~https://github.com/muxinc/mux-node-sdk/commit/33ceef2da37106ef2b2abef8a950544df279a42f))
* Add video.asset.non_standard_input_detected webhook ([#317](/~https://github.com/muxinc/mux-node-sdk/issues/317)) ([#536](/~https://github.com/muxinc/mux-node-sdk/issues/536)) ([d39b407](/~https://github.com/muxinc/mux-node-sdk/commit/d39b407da4e2cf57e600a0181175de8e0ecd7aeb))
* Additional Standard Dimensions ([#319](/~https://github.com/muxinc/mux-node-sdk/issues/319)) ([#544](/~https://github.com/muxinc/mux-node-sdk/issues/544)) ([22dbea3](/~https://github.com/muxinc/mux-node-sdk/commit/22dbea3eea8efcd8c9bd8e650f5af4f94ce44e3e))
* **api:** api update ([#533](/~https://github.com/muxinc/mux-node-sdk/issues/533)) ([febeae5](/~https://github.com/muxinc/mux-node-sdk/commit/febeae5171526e60460024b6c46a142533eeb235))
* **client:** send `X-Stainless-Timeout` header ([#542](/~https://github.com/muxinc/mux-node-sdk/issues/542)) ([bddd452](/~https://github.com/muxinc/mux-node-sdk/commit/bddd45248b23fb9b363ccdb75d442e9b6ff4aa1c))
* generate more types that are used as request bodies ([#532](/~https://github.com/muxinc/mux-node-sdk/issues/532)) ([17dc3e2](/~https://github.com/muxinc/mux-node-sdk/commit/17dc3e216554bf18b3e015577f192c024c63bc38))
* **internal:** make git install file structure match npm ([#527](/~https://github.com/muxinc/mux-node-sdk/issues/527)) ([10ae8eb](/~https://github.com/muxinc/mux-node-sdk/commit/10ae8ebf80dd4f2962739694229c700c55b682b3))


### Bug Fixes

* **client:** fix export map for index exports ([#545](/~https://github.com/muxinc/mux-node-sdk/issues/545)) ([228c810](/~https://github.com/muxinc/mux-node-sdk/commit/228c8101ed21732bca78383561cec082a0076e92))
* **client:** normalize method ([#535](/~https://github.com/muxinc/mux-node-sdk/issues/535)) ([7993276](/~https://github.com/muxinc/mux-node-sdk/commit/799327684ce912491a776a272e0f13ad0ac23944))


### Chores

* deprecate `mp4_support` option ([#321](/~https://github.com/muxinc/mux-node-sdk/issues/321)) ([#547](/~https://github.com/muxinc/mux-node-sdk/issues/547)) ([1562daa](/~https://github.com/muxinc/mux-node-sdk/commit/1562daa64a421c7a31bf1330bc41c634b26b7319))
* **internal:** bump cross-spawn to v7.0.6 ([#529](/~https://github.com/muxinc/mux-node-sdk/issues/529)) ([625f90b](/~https://github.com/muxinc/mux-node-sdk/commit/625f90b108126c7940dc668d5ee4e0bd6095b39a))
* **internal:** codegen related update ([#538](/~https://github.com/muxinc/mux-node-sdk/issues/538)) ([7291076](/~https://github.com/muxinc/mux-node-sdk/commit/729107671e066d0966048f56ab97a42187632eb4))
* **internal:** codegen related update ([#539](/~https://github.com/muxinc/mux-node-sdk/issues/539)) ([1ca421c](/~https://github.com/muxinc/mux-node-sdk/commit/1ca421c2aa6f3ec359d0d60f37535510a88c478f))
* **internal:** codegen related update ([#541](/~https://github.com/muxinc/mux-node-sdk/issues/541)) ([81fe307](/~https://github.com/muxinc/mux-node-sdk/commit/81fe3077369f56adac67b69471a0512b65ed94d7))
* **internal:** fix devcontainers setup ([#548](/~https://github.com/muxinc/mux-node-sdk/issues/548)) ([b916855](/~https://github.com/muxinc/mux-node-sdk/commit/b9168551c77fd14be61545fd8e680828e0892957))
* **internal:** fix some typos ([#534](/~https://github.com/muxinc/mux-node-sdk/issues/534)) ([5ea0e8e](/~https://github.com/muxinc/mux-node-sdk/commit/5ea0e8e9c26fe491f63c44be522748c1e267bf5e))
* **internal:** remove unnecessary getRequestClient function ([#528](/~https://github.com/muxinc/mux-node-sdk/issues/528)) ([a8a00ef](/~https://github.com/muxinc/mux-node-sdk/commit/a8a00eff2bb0586d5780c93199d120b5673f0d49))
* **internal:** update isAbsoluteURL ([#531](/~https://github.com/muxinc/mux-node-sdk/issues/531)) ([e1b231d](/~https://github.com/muxinc/mux-node-sdk/commit/e1b231dabdd236cb773de2e9e13c26ca8866356b))
* rebuild project due to codegen change ([#523](/~https://github.com/muxinc/mux-node-sdk/issues/523)) ([9cc566c](/~https://github.com/muxinc/mux-node-sdk/commit/9cc566cdeba6d3e1f6ed6bcd4643ecbafedda110))
* remove redundant word in comment ([#526](/~https://github.com/muxinc/mux-node-sdk/issues/526)) ([f5dd390](/~https://github.com/muxinc/mux-node-sdk/commit/f5dd3901391cb3d210a42cbfe4874e203013107a))
* **types:** nicer error class types + jsdocs ([#530](/~https://github.com/muxinc/mux-node-sdk/issues/530)) ([2b6cf7e](/~https://github.com/muxinc/mux-node-sdk/commit/2b6cf7e1da6895a7a1f5ab348f8b28f82dcc856d))


### Documentation

* minor formatting changes ([#537](/~https://github.com/muxinc/mux-node-sdk/issues/537)) ([69e736a](/~https://github.com/muxinc/mux-node-sdk/commit/69e736a7f8b7f24a23624f3ba9e0cefb35bd1415))
* remove suggestion to use `npm` call out ([#525](/~https://github.com/muxinc/mux-node-sdk/issues/525)) ([a1250bc](/~https://github.com/muxinc/mux-node-sdk/commit/a1250bcb104d1e0a93cec2bcc19d96d56f323fe9))

## 9.0.1 (2024-11-15)

Full Changelog: [v9.0.0...v9.0.1](/~https://github.com/muxinc/mux-node-sdk/compare/v9.0.0...v9.0.1)
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Setting up the environment

This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable).
This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install).
Other package managers may work but are not officially supported for development.

To set up the repository, run:
Expand Down Expand Up @@ -29,10 +29,10 @@ All files in the `examples/` directory are not modified by the generator and can
```

```
chmod +x examples/<your-example>.ts
```sh
$ chmod +x examples/<your-example>.ts
# run the example against your api
yarn tsn -T examples/<your-example>.ts
$ yarn tsn -T examples/<your-example>.ts
```

## Using the repository from source
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2024 Mux
Copyright 2025 Mux

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ await client.video.assets.retrieve('t02rm...', {
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:

1. Changes that only affect static types, without breaking runtime behavior.
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
3. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
Expand All @@ -533,7 +533,7 @@ The following runtimes are supported:

- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)
- Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
- Deno v1.28.0 or higher, using `import Mux from "npm:@mux/mux-node"`.
- Deno v1.28.0 or higher.
- Bun 1.0 or later.
- Cloudflare Workers.
- Vercel Edge Runtime.
Expand Down
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ Types:
- <code><a href="./src/resources/webhooks.ts">VideoAssetTrackErroredWebhookEvent</a></code>
- <code><a href="./src/resources/webhooks.ts">VideoAssetTrackDeletedWebhookEvent</a></code>
- <code><a href="./src/resources/webhooks.ts">VideoAssetWarningWebhookEvent</a></code>
- <code><a href="./src/resources/webhooks.ts">VideoAssetNonStandardInputDetectedWebhookEvent</a></code>
- <code><a href="./src/resources/webhooks.ts">VideoUploadAssetCreatedWebhookEvent</a></code>
- <code><a href="./src/resources/webhooks.ts">VideoUploadCancelledWebhookEvent</a></code>
- <code><a href="./src/resources/webhooks.ts">VideoUploadCreatedWebhookEvent</a></code>
Expand Down
39 changes: 30 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mux/mux-node",
"version": "9.0.1",
"version": "10.0.0",
"description": "The official TypeScript library for the Mux API",
"author": "Mux <devex@mux.com>",
"types": "dist/index.d.ts",
Expand All @@ -18,7 +18,7 @@
"build": "./scripts/build",
"prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1",
"format": "prettier --write --cache --cache-strategy metadata . !dist",
"prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build; fi",
"prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build && ./scripts/utils/git-swap.sh; fi",
"tsn": "ts-node -r tsconfig-paths/register",
"lint": "./scripts/lint",
"fix": "./scripts/format"
Expand Down Expand Up @@ -108,17 +108,38 @@
"default": "./dist/index.mjs"
},
"./*.mjs": {
"types": "./dist/*.d.ts",
"default": "./dist/*.mjs"
"types": [
"./dist/*.d.ts",
"./dist/*/index.d.ts"
],
"default": [
"./dist/*.mjs",
"./dist/*/index.mjs"
]
},
"./*.js": {
"types": "./dist/*.d.ts",
"default": "./dist/*.js"
"types": [
"./dist/*.d.ts",
"./dist/*/index.d.ts"
],
"default": [
"./dist/*.js",
"./dist/*/index.js"
]
},
"./*": {
"types": "./dist/*.d.ts",
"require": "./dist/*.js",
"default": "./dist/*.mjs"
"types": [
"./dist/*.d.ts",
"./dist/*/index.d.ts"
],
"require": [
"./dist/*.js",
"./dist/*/index.js"
],
"default": [
"./dist/*.mjs",
"./dist/*/index.mjs"
]
}
}
}
2 changes: 1 addition & 1 deletion scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ npm exec tsc-multi
# copy over handwritten .js/.mjs/.d.ts files
cp src/_shims/*.{d.ts,js,mjs,md} dist/_shims
cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto
# we need to add exports = module.exports = Mux Node to index.js;
# we need to add exports = module.exports = Mux to index.js;
# No way to get that from index.ts because it would cause compile errors
# when building .mjs
node scripts/utils/fix-index-exports.cjs
Expand Down
2 changes: 1 addition & 1 deletion scripts/utils/check-is-in-git-install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Check if you happen to call prepare for a repository that's already in node_modules.
[ "$(basename "$(dirname "$PWD")")" = 'node_modules' ] ||
# The name of the containing directory that 'npm` uses, which looks like
Expand Down
13 changes: 13 additions & 0 deletions scripts/utils/git-swap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -exuo pipefail
# the package is published to NPM from ./dist
# we want the final file structure for git installs to match the npm installs, so we

# delete everything except ./dist and ./node_modules
find . -maxdepth 1 -mindepth 1 ! -name 'dist' ! -name 'node_modules' -exec rm -rf '{}' +

# move everything from ./dist to .
mv dist/* .

# delete the now-empty ./dist
rmdir dist
52 changes: 32 additions & 20 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export abstract class APIClient {
maxRetries = 2,
timeout = 60000, // 1 minute
httpAgent,
fetch: overridenFetch,
fetch: overriddenFetch,
}: {
baseURL: string;
maxRetries?: number | undefined;
Expand All @@ -176,7 +176,7 @@ export abstract class APIClient {
this.timeout = validatePositiveInteger('timeout', timeout);
this.httpAgent = httpAgent;

this.fetch = overridenFetch ?? fetch;
this.fetch = overriddenFetch ?? fetch;
}

protected authHeaders(opts: FinalRequestOptions): Headers {
Expand Down Expand Up @@ -268,6 +268,7 @@ export abstract class APIClient {
options: FinalRequestOptions<Req>,
{ retryCount = 0 }: { retryCount?: number } = {},
): { req: RequestInit; url: string; timeout: number } {
options = { ...options };
const { method, path, query, headers: headers = {} } = options;

const body =
Expand All @@ -278,9 +279,9 @@ export abstract class APIClient {

const url = this.buildURL(path!, query);
if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
const timeout = options.timeout ?? this.timeout;
options.timeout = options.timeout ?? this.timeout;
const httpAgent = options.httpAgent ?? this.httpAgent ?? getDefaultAgent(url);
const minAgentTimeout = timeout + 1000;
const minAgentTimeout = options.timeout + 1000;
if (
typeof (httpAgent as any)?.options?.timeout === 'number' &&
minAgentTimeout > ((httpAgent as any).options.timeout ?? 0)
Expand Down Expand Up @@ -309,7 +310,7 @@ export abstract class APIClient {
signal: options.signal ?? null,
};

return { req, url, timeout };
return { req, url, timeout: options.timeout };
}

private buildHeaders({
Expand Down Expand Up @@ -337,15 +338,22 @@ export abstract class APIClient {
delete reqHeaders['content-type'];
}

// Don't set the retry count header if it was already set or removed through default headers or by the
// caller. We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to
// account for the removal case.
// Don't set theses headers if they were already set or removed through default headers or by the caller.
// We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to account
// for the removal case.
if (
getHeader(defaultHeaders, 'x-stainless-retry-count') === undefined &&
getHeader(headers, 'x-stainless-retry-count') === undefined
) {
reqHeaders['x-stainless-retry-count'] = String(retryCount);
}
if (
getHeader(defaultHeaders, 'x-stainless-timeout') === undefined &&
getHeader(headers, 'x-stainless-timeout') === undefined &&
options.timeout
) {
reqHeaders['x-stainless-timeout'] = String(options.timeout);
}

this.validateHeaders(reqHeaders, headers);

Expand Down Expand Up @@ -508,20 +516,24 @@ export abstract class APIClient {

const timeout = setTimeout(() => controller.abort(), ms);

const fetchOptions = {
signal: controller.signal as any,
...options,
};
if (fetchOptions.method) {
// Custom methods like 'patch' need to be uppercased
// See /~https://github.com/nodejs/undici/issues/2294
fetchOptions.method = fetchOptions.method.toUpperCase();
}

return (
this.getRequestClient()
// use undefined this binding; fetch errors if bound to something else in browser/cloudflare
.fetch.call(undefined, url, { signal: controller.signal as any, ...options })
.finally(() => {
clearTimeout(timeout);
})
// use undefined this binding; fetch errors if bound to something else in browser/cloudflare
this.fetch.call(undefined, url, fetchOptions).finally(() => {
clearTimeout(timeout);
})
);
}

protected getRequestClient(): RequestClient {
return { fetch: this.fetch };
}

private shouldRetry(response: Response): boolean {
// Note this is not a standard header.
const shouldRetryHeader = response.headers.get('x-should-retry');
Expand Down Expand Up @@ -957,8 +969,8 @@ export const safeJSON = (text: string) => {
}
};

// https://stackoverflow.com/a/19709846
const startsWithSchemeRegexp = new RegExp('^(?:[a-z]+:)?//', 'i');
// https://url.spec.whatwg.org/#url-scheme-string
const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
const isAbsoluteURL = (url: string): boolean => {
return startsWithSchemeRegexp.test(url);
};
Expand Down
Loading

0 comments on commit 8efeda0

Please sign in to comment.