Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ jobs:
lint:
name: lint
runs-on: ubuntu-latest


steps:
- uses: actions/checkout@v4

Expand All @@ -31,8 +29,9 @@ jobs:
build:
name: build
runs-on: ubuntu-latest


permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4

Expand All @@ -46,10 +45,24 @@ jobs:

- name: Check build
run: ./scripts/build

- name: Get GitHub OIDC Token
if: github.repository == 'stainless-sdks/mux-node'
id: github-oidc
uses: actions/github-script@v6
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Upload tarball
if: github.repository == 'stainless-sdks/mux-node'
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
run: ./scripts/utils/upload-artifact.sh
test:
name: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "11.0.1"
".": "11.0.2"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 88
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mux%2Fmux-c82f962313c7a8512450ffab731fffa6a295de3cb666cf3afcebc56191439e19.yml
openapi_spec_hash: a9cee3d6aa6af1fe8b0c1de7b713a8fc
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mux%2Fmux-7f3ef26966f06eab76abd513d5654c7059b84e47125b834fa8073d46ff005eb3.yml
openapi_spec_hash: 648e3026f149d4a0291ee04915e26aea
config_hash: f941b9f1f7c0d16e4e150799bd13f5b1
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Changelog

## 11.0.2 (2025-04-14)

Full Changelog: [v11.0.1...v11.0.2](https://github.com/muxinc/mux-node-sdk/compare/v11.0.1...v11.0.2)

### Bug Fixes

* add `audio-only` enum option in `resolution_tier` for Static Rendition responses ([#339](https://github.com/muxinc/mux-node-sdk/issues/339)) ([#581](https://github.com/muxinc/mux-node-sdk/issues/581)) ([08a6aed](https://github.com/muxinc/mux-node-sdk/commit/08a6aedb36689e9857603405a8f680ea00874215))
* **api:** improve type resolution when importing as a package ([#578](https://github.com/muxinc/mux-node-sdk/issues/578)) ([eaa6190](https://github.com/muxinc/mux-node-sdk/commit/eaa6190a2d8615cae7497076b5b484bf7a17bbd0))
* **client:** send `X-Stainless-Timeout` in seconds ([#576](https://github.com/muxinc/mux-node-sdk/issues/576)) ([365f84d](https://github.com/muxinc/mux-node-sdk/commit/365f84d3950de97ddf05d1e417d2284dfb7063b6))
* **mcp:** remove unused tools.ts ([#579](https://github.com/muxinc/mux-node-sdk/issues/579)) ([65b514b](https://github.com/muxinc/mux-node-sdk/commit/65b514bf697ba0de7d144174d516940c91e53869))


### Chores

* **client:** minor internal fixes ([b991d1e](https://github.com/muxinc/mux-node-sdk/commit/b991d1eaae02f6a368c5fcbc7aef615ab24c7726))
* **internal:** add aliases for Record and Array ([#577](https://github.com/muxinc/mux-node-sdk/issues/577)) ([ae647ce](https://github.com/muxinc/mux-node-sdk/commit/ae647ced0dc096d78d0487c5aab272424bb7a9ae))
* **internal:** reduce CI branch coverage ([e015341](https://github.com/muxinc/mux-node-sdk/commit/e01534171f4e55eba0602782a75aef917461c3ed))
* **internal:** upload builds and expand CI branch coverage ([#582](https://github.com/muxinc/mux-node-sdk/issues/582)) ([e61097a](https://github.com/muxinc/mux-node-sdk/commit/e61097a30d72011f248e13ef15c53ba6c8ff5803))
* **tests:** improve enum examples ([#580](https://github.com/muxinc/mux-node-sdk/issues/580)) ([9519087](https://github.com/muxinc/mux-node-sdk/commit/9519087018d6aacf81981a9c0785cd7747661f2c))


### Documentation

* change video to asset in metadata docs ([#340](https://github.com/muxinc/mux-node-sdk/issues/340)) ([cc9a980](https://github.com/muxinc/mux-node-sdk/commit/cc9a98088586e56872af9923154f0c4f7c1be5f4))
* Document add-asset-track requirements a little more ([#338](https://github.com/muxinc/mux-node-sdk/issues/338)) ([#574](https://github.com/muxinc/mux-node-sdk/issues/574)) ([21bbfa3](https://github.com/muxinc/mux-node-sdk/commit/21bbfa3f2a531229b8ef80bab877849eb0c6ff35))

## 11.0.1 (2025-04-01)

Full Changelog: [v11.0.0...v11.0.1](https://github.com/muxinc/mux-node-sdk/compare/v11.0.0...v11.0.1)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mux/mux-node",
"version": "11.0.1",
"version": "11.0.2",
"description": "The official TypeScript library for the Mux API",
"author": "Mux <devex@mux.com>",
"types": "dist/index.d.ts",
Expand Down
25 changes: 25 additions & 0 deletions scripts/utils/upload-artifact.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -exuo pipefail

RESPONSE=$(curl -X POST "$URL" \
-H "Authorization: Bearer $AUTH" \
-H "Content-Type: application/json")

SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url')

if [[ "$SIGNED_URL" == "null" ]]; then
echo -e "\033[31mFailed to get signed URL.\033[0m"
exit 1
fi

UPLOAD_RESPONSE=$(tar -cz dist | curl -v -X PUT \
-H "Content-Type: application/gzip" \
--data-binary @- "$SIGNED_URL" 2>&1)

if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
echo -e "\033[32mInstallation: npm install 'https://pkg.stainless.com/s/mux-node/$SHA'\033[0m"
else
echo -e "\033[31mFailed to upload artifact.\033[0m"
exit 1
fi
24 changes: 19 additions & 5 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ export {

export type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;

/**
* An alias to the builtin `Array` type so we can
* easily alias it in import statements if there are name clashes.
*/
type _Array<T> = Array<T>;

/**
* An alias to the builtin `Record` type so we can
* easily alias it in import statements if there are name clashes.
*/
type _Record<K extends keyof any, T> = Record<K, T>;

export type { _Array as Array, _Record as Record };

type PromiseOrValue<T> = T | Promise<T>;

type APIResponseProps = {
Expand Down Expand Up @@ -270,10 +284,10 @@ export abstract class APIClient {
}

buildRequest<Req>(
options: FinalRequestOptions<Req>,
inputOptions: FinalRequestOptions<Req>,
{ retryCount = 0 }: { retryCount?: number } = {},
): { req: RequestInit; url: string; timeout: number } {
options = { ...options };
const options = { ...inputOptions };
const { method, path, query, headers: headers = {} } = options;

const body =
Expand All @@ -299,8 +313,8 @@ export abstract class APIClient {
}

if (this.idempotencyHeader && method !== 'get') {
if (!options.idempotencyKey) options.idempotencyKey = this.defaultIdempotencyKey();
headers[this.idempotencyHeader] = options.idempotencyKey;
if (!inputOptions.idempotencyKey) inputOptions.idempotencyKey = this.defaultIdempotencyKey();
headers[this.idempotencyHeader] = inputOptions.idempotencyKey;
}

const reqHeaders = this.buildHeaders({ options, headers, contentLength, retryCount });
Expand Down Expand Up @@ -357,7 +371,7 @@ export abstract class APIClient {
getHeader(headers, 'x-stainless-timeout') === undefined &&
options.timeout
) {
reqHeaders['x-stainless-timeout'] = String(options.timeout);
reqHeaders['x-stainless-timeout'] = String(Math.trunc(options.timeout / 1000));
}

this.validateHeaders(reqHeaders, headers);
Expand Down
28 changes: 14 additions & 14 deletions src/resources/video/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class Assets extends APIResource {

/**
* Adds an asset track (for example, subtitles, or an alternate audio track) to an
* asset.
* asset. Assets must be in the `ready` state before tracks can be added.
*/
createTrack(
assetId: string,
Expand Down Expand Up @@ -449,19 +449,19 @@ export namespace Asset {
*/
export interface Meta {
/**
* This is an identifier you provide to keep track of the creator of the video. Max
* This is an identifier you provide to keep track of the creator of the asset. Max
* 128 code points.
*/
creator_id?: string;

/**
* This is an identifier you provide to link the video to your own data. Max 128
* This is an identifier you provide to link the asset to your own data. Max 128
* code points.
*/
external_id?: string;

/**
* The video title. Max 512 code points.
* The asset title. Max 512 code points.
*/
title?: string;
}
Expand Down Expand Up @@ -655,7 +655,7 @@ export namespace Asset {
* Indicates the resolution tier of this specific MP4 version of this asset. This
* field is only valid for `static_renditions`, not for `mp4_support`.
*/
resolution_tier?: '2160p' | '1440p' | '1080p' | '720p';
resolution_tier?: '2160p' | '1440p' | '1080p' | '720p' | 'audio-only';

/**
* Indicates the status of this specific MP4 version of this asset. This field is
Expand Down Expand Up @@ -1288,19 +1288,19 @@ export namespace AssetOptions {
*/
export interface Meta {
/**
* This is an identifier you provide to keep track of the creator of the video. Max
* This is an identifier you provide to keep track of the creator of the asset. Max
* 128 code points.
*/
creator_id?: string;

/**
* This is an identifier you provide to link the video to your own data. Max 128
* This is an identifier you provide to link the asset to your own data. Max 128
* code points.
*/
external_id?: string;

/**
* The video title. Max 512 code points.
* The asset title. Max 512 code points.
*/
title?: string;
}
Expand Down Expand Up @@ -2305,19 +2305,19 @@ export namespace AssetCreateParams {
*/
export interface Meta {
/**
* This is an identifier you provide to keep track of the creator of the video. Max
* This is an identifier you provide to keep track of the creator of the asset. Max
* 128 code points.
*/
creator_id?: string;

/**
* This is an identifier you provide to link the video to your own data. Max 128
* This is an identifier you provide to link the asset to your own data. Max 128
* code points.
*/
external_id?: string;

/**
* The video title. Max 512 code points.
* The asset title. Max 512 code points.
*/
title?: string;
}
Expand Down Expand Up @@ -2371,19 +2371,19 @@ export namespace AssetUpdateParams {
*/
export interface Meta {
/**
* This is an identifier you provide to keep track of the creator of the video. Max
* This is an identifier you provide to keep track of the creator of the asset. Max
* 128 code points.
*/
creator_id?: string;

/**
* This is an identifier you provide to link the video to your own data. Max 128
* This is an identifier you provide to link the asset to your own data. Max 128
* code points.
*/
external_id?: string;

/**
* The video title. Max 512 code points.
* The asset title. Max 512 code points.
*/
title?: string;
}
Expand Down
6 changes: 3 additions & 3 deletions src/resources/video/live-streams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -929,19 +929,19 @@ export namespace LiveStreamUpdateParams {
*/
export interface Meta {
/**
* This is an identifier you provide to keep track of the creator of the video. Max
* This is an identifier you provide to keep track of the creator of the asset. Max
* 128 code points.
*/
creator_id?: string;

/**
* This is an identifier you provide to link the video to your own data. Max 128
* This is an identifier you provide to link the asset to your own data. Max 128
* code points.
*/
external_id?: string;

/**
* The video title. Max 512 code points.
* The asset title. Max 512 code points.
*/
title?: string;
}
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '11.0.1'; // x-release-please-version
export const VERSION = '11.0.2'; // x-release-please-version
Loading