Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Announcement: Version 8 released to address many pain points #327

Open
1 task done
dylanjha opened this issue Jan 12, 2024 · 1 comment
Open
1 task done

Announcement: Version 8 released to address many pain points #327

dylanjha opened this issue Jan 12, 2024 · 1 comment

Comments

@dylanjha
Copy link
Collaborator

dylanjha commented Jan 12, 2024

We heard about all the pain points people were having with this SDK. Since the time this was originally built (back in 2018) the node ecosystem has evolved substantially and admittedly, we fell a little behind.

That has changed now, and we have a new v8 version of this SDK in beta. It's been re-built from the ground up. So bear with me here. The main things we addressed are:

  1. Much better TypeScript support: previously this SDK was built in JS and to satisfy TS users we were maintaining types by hand. This was unsustainable and inevitably led to types being stale. A number of folks opened issues reporting wrong types and we had to keep playing whack-a-mole to patch those. That is no longer the case.
  2. Support for new JS runtimes: We love that people want to use this SDK with Deno, Bun, Cloudflare Workers, Vercel Edge, etc. That's awesome! The problem was our JWT signing relied on node:crypto which is not available on those platforms. We've fix that.

Those are the 2 big things, but v8 also brings some other quality-of-life improvements like:

  • Configurable retries and timeouts
  • Auto-pagination with for await... of
  • Nice way to access raw response vs. the parsed response

How to use v8

  • It's under the name npm package, on the beta channel: npm i @mux/mux-node@beta
  • Still in this github repo, on branch beta-8. See the README for usage and examples
  • See the api.md file for full API reference

Syntax changes

Since everything here was re-built to be better, there are significant syntax changes. Anywhere you were calling this SDK will require changing your code. If you're using TypeScript your editor should give you nice hints when making these changes.

Also, we highly recommend after installing the v8 SDK you run the codemod script:

npx @getgrit/launcher apply mux_v8

This will edit the files in your project in a way that converts your existing code to the new v8 syntax. The codemod script is working well for us, but you should still verify your code changes and make sure it works as expected before deploying the new code to production.

How you can help

  • Please try out the beta and report any issues
  • Particularly around the codemod script, if there's any issues there please let us know so that we can fix it

We plan to keep this in beta for ~2 weeks and then merge and live happily ever after.

Known issues:

  • mux.video.assets.delete is getting HTTP 406 error. Possibly the other delete endpoints are getting this as well. Stay tuned as we get this resolved. (fixed in 8.0.0-canary.4)
luwes added a commit that referenced this issue Feb 7, 2024
* refactor: rename top level params types

* feat(docs): add more doc comments

* chore(internal): update tsconfig

* chore(internal): improve check-version script

* chore(internal): improve check-version script

* chore(internal): improve test case names

* chore(internal): improve support for streaming responses

* fix(client): properly expose `maxRetries` option

* chore(internal): add prettierignore

* feat(client): handle trailing slash in base url properly

* fix(sse): handle server-sent events more robustly

* feat(api): updates

* chore(internal): add empty request preparation method

* feat(client): add support for specifying client-level default headers

* chore(internal): restructure core streaming implementation

* chore(internal): updates to type formatting & remove duplicated types

* docs: point to github repo instead of email contact

* chore(internal): improve SSE decoding of lines

* refactor: move error type definitions to error.ts

* fix(internal): improve stream cancellation handling of abort controllers

* docs!: drop official support for EOL Node versions (Node 12, 13, 14, 15)

* build: add `.github` folder to `.npmignore`

* docs!: drop official support for EOL Node versions (Node 12, 13, 14, 15)

# Migration

We no longer officially support Node 12+, as our policy is to support only [non-EOL](https://endoflife.date/nodejs) language runtime versions.

We have not made any code changes that would cause the library to break on older versions of node; this is a documentation-only change.

Note that we expect to move to Node 18+ in a few months, when Node 16 reaches EOL.

We recommend upgrading your Node version to the latest LTS.

* build: add `.github` folder to `.npmignore`

* docs(readme): update main example

* feat(api/data): add `video-startup-failure-percentage` enum member

* fix(form-data): strip out undefined properties

* feat(types): export nested types through the root client export

* feat(api): add video startup failure to metrics

* refactor(types)!: singularize array item types

* refactor: make `SimulcastTarget` its own type

* feat: support ESM and web platform runtimes; easier file uploads

* style: minor reordering of types and properties

* chore: speed up build script slightly

* docs: rearrange sections in api.md

* fix(types): remove incorrect duplicated `Promise` from some return types

* refactor: move to src directory, improve ecosystem compatibility

* feat(client): add support for `defaultQuery` option

* docs(api.md): fix links not referencing `src` directory

* fix!: import issue with ESM

* docs(client): improve documentation for client options

* chore(internal): fix tsc usage

* refactor: mark `.responseHeaders` and `.response` as deprecated

* chore: set `noEmit: true` in `tsconfig.json`, since it's for typechecking only

* fix: fix link to README file uploads in fileFromPath

* fix: fix link to README file uploads in fileFromPath

* docs(readme): fix typescript usage example response types

* fix(streaming): polyfill ReadableStream async iterator and text decoding

* fix: include README.md, LICENSE and CHANGELOG.md in published package

* refactor: improve streaming implementation

* fix: support `PromiseLike` input to `toFile`

* refactor: improve streaming implementation

* Bump for 91f53a3

* fix: fix errors in package source files when users go to definition in VSCode

* feat(client): improve timeout handling to reuse agent

* fix(streaming): fix response body streaming in non-Chrome environments

* refactor(streaming): make response body streaming polyfill more spec-compliant

* feat(client): support passing a custom `fetch` function

* fix(client): properly handle multi-byte characters in Content-Length

* docs(readme): minor improvements

* fix(streaming): do not abort successfully completed streams

* docs: rename package

* feat(client): add support for passing a `signal` request option

* feat(api): add resolution_tier propery

* chore(internal): remove unused streaming implementation

* feat: improvements to ecosystem compatibility

* chore(internal): let `toFile` helper accept promises to objects with name/type properties

* chore(internal): add `codegen.log` to `.gitignore` and use caching for prettier

* fix: fix errors with "named" client export in CJS

* fix: fix error in environments without `TextEncoder`

* chore(internal): restructure code to stringify query

* fix: fix export map order

* feat(client): export ClientOptions interface

* fix(client): fix errors with file uploads in the browser

* feat(streaming): make requests immediately throw an error if an aborted signal is passed in

* feat(api): deprecate video spaces

* feat(client): add webhook verification helpers

* fix(client): set client options argument as optional

* fix: fix undefined message in errors

* fix(client): handle undefined process in more places

* Created automatically from stainless-api/stainless#1866.

* Bump for d43c42cc

* feat(api): add `asset_resolution_tier` property

* refactor: use destructuring arguments in client constructor and respect false values

* chore(internal): allow the build script to be run without yarn installed

* refactor: create build for deno.land

* feat(api): updates

* chore(internal): fix deno build

* feat: read environment variables in Deno

* chore(internal): use deno_qs in place of npm:qs in deno build

* fix(client): fix query array format

* docs(readme): remove beta status + document versioning policy

* feat(client): detect browser usage

* refactor(deno): use mod.ts files instead of index.ts files

* feat(api): add JWT signing methods

* feat(streaming): add `.toReadableStream()` method

* chore(internal): update typescript

* chore(internal): update eslint

* chore(internal): update tsconfig-paths dep

* feat(client): support JWT signing methods in Deno, Web, and other environments

* feat(api): add `"minute"` to `timeseries_group_by parameter` enum

* Bump for 59b76e48ddc3bdfc800656b6e70a55aa6f393f6b

* feat(api): add `"minute"` to `timeseries_group_by parameter` enum

* feat(client)!: support accessing raw response + remove deprecated features

* docs(readme): minor updates

* docs(readme): minor updates

* chore(docs): fix typo in deprecation message

* chore(internal): conditionally include bin during build output

* fix(api): fix array query param names

* fix(client): fix array query param serialization

* feat: allow a default timeout to be set for clients

* feat(webhooks): add typed webhook unwrapper (with timestamp fixes)

* chore(internal): fix error happening in CloudFlare pages

* chore(internal): improve error message when option is missing

* chore(internal): fix error happening in CloudFlare pages

* chore(internal): improve error message when option is missing

* fix(client): fix TypeError when a request gets retried

* feat(docs): add documentation to the client constructor

* feat(api): add video.assets.retrieve_input_info method

* feat(client): improve compatibility with Bun

* chore(internal): add missing eslint-plugin-prettier

* wip

* chore(internal): add missing eslint-plugin-prettier

* fix(core): fix navigator check for strange environments

* feat(types): export RequestOptions type

* chore(internal): export HeadersInit type shim

* chore(internal): add helper method

* fix(types): improve getNextPage() return type

* feat(package): add Bun export map

* chore: remove unneeded type

* fix(client): use explicit file extensions in _shims imports

* fix(client): fix TS errors that appear when users Go to Source in VSCode

* fix(client): handle case where the client is instantiated with a undefined baseURL

* feat: fixes tests where an array has to have unique enum values

* docs(readme): add link to api.md

* fix(readme): update link to api.md to use the correct branch

* chore(internal): export helper from core

* chore(internal): minor formatting changes

* fix: fix module not found errors in Vercel edge

* fix: fix module not found errors in Vercel edge

* feat(client): retry on 408 Request Timeout

* docs: declare Bun 1.0 officially supported

* feat(errors): add status code to error message

* docs(readme): remove incorrect wording in opening

* feat(client): support importing node or web shims manually

* feat(client): support importing node or web shims manually

* docs(README): fix variable names in some examples

* chore(internal): add postpublish script to push deno build to a branch and tag

* chore(internal): add postpublish script to push deno build to a branch and tag

* chore(internal): add postpublish script to push deno build to a branch and tag

* docs(api.md): add shared models

* feat(package): export a root error type

* feat(client): handle retry-after with a date

* chore(internal): update lock file

* test: use `TEST_API_BASE_URL` in tests

* chore(tests): update test examples

* fix: prevent ReferenceError, update compatibility to ES2020 and Node 18+

* fix(client): eliminate circular imports, which cause runtime errors in webpack dev bundles

* fix: fix namespace exports regression

* chore: update README

* chore(internal): refactor status code printing in error

* chore(internal): refactor status code printing in error

* refactor(test): refactor authentication tests

* chore: add case insensitive get header function

* chore: update comment

* fix: improve status code in error messages

* fix: import web-streams-polyfill without overriding globals

* feat: handle 204 No Content gracefully

* feat(client): adjust retry behavior to be exponential backoff

* ci: add lint workflow

* feat(client): adjust retry behavior to be exponential backoff

* ci: add lint workflow

* fix: typo in build script

* fix: deploy deno in a github workflow instead of postpublish step

* Bump for 3b68b4b4893566886887a45525480191f1f8a9df

* fix: deploy deno in a github workflow instead of postpublish step

* chore(internal): update gitignore

* feat(github): include a devcontainer setup

* feat(client): allow binary returns

* docs: document customizing fetch

* ci: improve deno releases

* fix: improve deno releases

* docs(readme): remove redundant whitespace

* fix: improve deno readme

* docs: update deno link in more places

* docs: deno version

* ci: deno improvement

* chore(internal): update tsconfig

* chore(docs): fix github links

* chore(docs): fix github links

* chore(internal): update tsconfig

* ci: fix deno version bump

* chore(internal): update jest config

* chore(internal): update APIResource structure

* chore(internal): add publish script

* feat: update required fields (#327)

* feat: update required fields

* feat: update required fields

* feat: update required fields

* feat: update required fields

* bump 8.0.0-canary.1

---------

Co-authored-by: Dylan Jhaveri <dylanjha@users.noreply.github.com>

* feat: update required fields

* fix(types): asset create required params

* chore(internal): update stats file

* chore(ci): fix publish-npm

* feat: allow installing package directly from github

* chore(internal): don't call prepare in dist

* chore(internal): remove file import and conditionally run prepare

* ci: bump node version from 16 to 18 since 16 is no longer supported

* docs(readme): update example snippets

* feat(client): support reading the base url from an env variable

* ci: ensure PR titles use conventional commits

* ci: remove PR title linter

* build: specify `packageManager: yarn`

* chore: update prettier

* chore: update dependencies

* chore(deps): update dependency ts-jest to v29.1.1

* chore(deps): update jest

* Created automatically from stainless-api/stainless#3325.

* chore(deps): update jest

* Created automatically from stainless-api/stainless#3324.

* refactor: write jest config in typescript

* chore(internal): minor updates to pagination

* docs: reformat README.md

* Bump for b0411082434eeb218ea81c7bb90def24645c888d

* fix(headers): always send lowercase headers and strip undefined (BREAKING in rare cases)

* chore(internal): improve type signatures

* chore: add .keep files for examples and custom code directories

* chore(internal): minor improvements to auth code

* fix: use default base url if BASE_URL env var is blank

Previously, a blank BASE_URL environment variable would cause an invalid URL error. Now it uses the default.

* fix: use default base url if BASE_URL env var is blank

* chore(internal): narrow type into stringifyQuery

* docs(readme): improve api reference

* feat!: remove old SDK

* cd: add CD GH action workflow

* 8.0.0-beta.0

* cd: upgrade wet-run releaser

* update README with beta language and update package.json to canary.3

* docs: fix missing async in readme code sample

* fix: use `Accept: */*` as a default Header for void endpoints

* chore(internal): debug logging for retries; speculative retry-after-ms support

* fix(types): accept undefined for optional client options

* fix: allow body type in RequestOptions to be null

* chore(internal): add internal helpers & improve build scripts

* 8.0.0-canary.4

* Update README.md links to api.md

* chore(internal): re-order pagination import

* chore(internal): enable building when git installed

* fix(api): fix `live_stream` enum value on JWT `DataTypeClaim`

* docs: add a CONTRIBUTING.md

* 8.0.0-canary.5

* update README and add Upgrading to 8.x md file

* bump versions to 8.0.0

* add note about Documentation

---------

Co-authored-by: Stainless Bot <107565488+stainless-bot@users.noreply.github.com>
Co-authored-by: Stainless Bot <dev@stainlessapi.com>
Co-authored-by: Dylan Jhaveri <dylanjha@users.noreply.github.com>
Co-authored-by: Dylan Jhaveri <djhaveri@mux.com>
@dylanjha dylanjha changed the title Announcement: New version 8 beta to solve a lot of pain points Announcement: Version 8 released to address many pain points Feb 12, 2024
@dylanjha
Copy link
Collaborator Author

Update: Version 8 has been released:

https://github.com/muxinc/mux-node-sdk/releases/tag/v8.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant