From 53533f5f4d32af6a5f669667fefb3cf80176a9f2 Mon Sep 17 00:00:00 2001 From: Cody Olsen Date: Wed, 3 May 2023 14:46:37 +0200 Subject: [PATCH] fix: add release notes Co-authored-by: Martin Jacobsen <174970+mmgj@users.noreply.github.com> Co-authored-by: tarungangwani <7750305+tarungangwani@users.noreply.github.com> Co-authored-by: even westvang --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 28 +++++++++++++ README.md | 85 ++++++++++++++++++++++++++++++++++------ 3 files changed, 102 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b357c91b..1ad59508 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -199,7 +199,7 @@ jobs: cache: npm - run: npm ci # Branches that will release new versions are defined in .releaserc.json - - run: npx semantic-release --dry-run --debug + - run: npx semantic-release # Don't allow interrupting the release step if the job is cancelled, as it can lead to an inconsistent state # e.g. git tags were pushed but it exited before `npm publish` if: always() diff --git a/CHANGELOG.md b/CHANGELOG.md index 97a43178..b96f7ffc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,34 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [6.0.0](https://github.com/sanity-io/client/compare/v5.4.2...v6.0.0) (2023-05-03) + +### ⚠ BREAKING CHANGES + +- `useCdn` is now set to `true` by default. Our CDN ensures your content has reliably, world-wide delivery by caching queries made from your front-end. If you require fresh data for every query, perhaps for testing purposes, add `useCdn: false` to your configuration. +- Client will now automatically retry all GET/HEAD requests as well as queries if the server responds with a 429, 502 or 503 status code - as well as on socket/DNS errors. Previously, the client would immediately throw an error. If you have application-level retry code, you should either disable the retrying in the client by passing `{maxRetries: 0}`, or remove the custom retry code and potentially alter the `retryDelay` and `maxRetries` options to match your wanted behavior. + +[The migration guide outlines every breaking change and how to migrate your code](https://github.com/sanity-io/client#from-v5) + +### Introducing Content Source Maps + +> **Note** +> +> Content Source Maps are available for select [Sanity enterprise customers](https://www.sanity.io/enterprise?utm_source=github.com&utm_medium=referral&utm_campaign=may-vercel-launch). [Contact our sales team for more information.](https://www.sanity.io/contact/sales?utm_source=github.com&utm_medium=referral&utm_campaign=may-vercel-launch) + +![](https://i.imgur.com/wt95U5Q.jpg) + +Content Source Maps are an optional layer of contextual metadata sent with queries to enable use cases such as [Visual Editing](https://www.sanity.io/blog/visual-editing-sanity-vercel?utm_source=github.com&utm_medium=referral&utm_campaign=may-vercel-launch), tracing content lineage, and more. Our implementation of Content Source Maps are based on an [open standard posted on GitHub](https://github.com/sanity-io/content-source-maps), and you can read [the API documentation here](https://#https://www.sanity.io/docs/content-source-maps?utm_source=github.com&utm_medium=referral&utm_campaign=may-vercel-launch). To get started with Content Source Maps, check out the documentation in the README file. + +### Features + +- add automatic retrying of 429, 502, 503 (#199) + +### Bug Fixes + +- make useCdn use true by default (#191) +- undeprecate request() (#205) + ## [5.4.2](https://github.com/sanity-io/client/compare/v5.4.1...v5.4.2) (2023-04-03) ### Bug Fixes diff --git a/README.md b/README.md index 8e006f9b..25579efa 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ export const client = createClient({ projectId: 'your-project-id', dataset: 'your-dataset-name', useCdn: true, // set to `false` to bypass the edge cache - apiVersion: '2022-01-12', // use current date (YYYY-MM-DD) to target the latest API version + apiVersion: '2023-05-03', // use current date (YYYY-MM-DD) to target the latest API version // token: process.env.SANITY_SECRET_TOKEN // Only if you want to update content with the client }) @@ -65,6 +65,7 @@ export async function updateDocumentTitle(_id, title) { - [UMD](#umd) - [Specifying API version](#specifying-api-version) - [Performing queries](#performing-queries) + - [Fetching Content Source Maps](#fetching-content-source-maps) - [Listening to queries](#listening-to-queries) - [Fetch a single document](#fetch-a-single-document) - [Fetch multiple documents in one go](#fetch-multiple-documents-in-one-go) @@ -132,7 +133,7 @@ const client = createClient({ projectId: 'your-project-id', dataset: 'your-dataset-name', useCdn: true, // set to `false` to bypass the edge cache - apiVersion: '2022-01-12', // use current date (YYYY-MM-DD) to target the latest API version + apiVersion: '2023-05-03', // use current date (YYYY-MM-DD) to target the latest API version }) const data = await client.fetch(`count(*)`) @@ -148,7 +149,7 @@ const client = createClient({ projectId: 'your-project-id', dataset: 'your-dataset-name', useCdn: true, // set to `false` to bypass the edge cache - apiVersion: '2022-01-12', // use current date (YYYY-MM-DD) to target the latest API version + apiVersion: '2023-05-03', // use current date (YYYY-MM-DD) to target the latest API version }) client @@ -166,7 +167,7 @@ const config: ClientConfig = { projectId: 'your-project-id', dataset: 'your-dataset-name', useCdn: true, // set to `false` to bypass the edge cache - apiVersion: '2022-01-12', // use current date (YYYY-MM-DD) to target the latest API version + apiVersion: '2023-05-03', // use current date (YYYY-MM-DD) to target the latest API version } const client = createClient(config) @@ -186,7 +187,7 @@ const client = createClient({ projectId: 'your-project-id', dataset: 'your-dataset-name', useCdn: true, // set to `false` to bypass the edge cache - apiVersion: '2022-01-12', // use current date (YYYY-MM-DD) to target the latest API version + apiVersion: '2023-05-03', // use current date (YYYY-MM-DD) to target the latest API version }) const schema = z.number() @@ -213,7 +214,7 @@ const client = createClient({ projectId: 'your-project-id', dataset: 'your-dataset-name', useCdn: true, // set to `false` to bypass the edge cache - apiVersion: '2022-01-12', // use current date (YYYY-MM-DD) to target the latest API version + apiVersion: '2023-05-03', // use current date (YYYY-MM-DD) to target the latest API version }) const data = await client.fetch(`count(*)`) @@ -241,7 +242,7 @@ const client = createClient({ projectId: 'your-project-id', dataset: 'your-dataset-name', useCdn: true, // set to `false` to bypass the edge cache - apiVersion: '2022-01-12', // use current date (YYYY-MM-DD) to target the latest API version + apiVersion: '2023-05-03', // use current date (YYYY-MM-DD) to target the latest API version }) const data = await client.fetch(`count(*)`) @@ -274,7 +275,7 @@ export default async function handler(req: NextRequest) { projectId: 'your-project-id', dataset: 'your-dataset-name', useCdn: true, // set to `false` to bypass the edge cache - apiVersion: '2022-01-12', // use current date (YYYY-MM-DD) to target the latest API version + apiVersion: '2023-05-03', // use current date (YYYY-MM-DD) to target the latest API version }) const count = await client.fetch(`count(*)`) @@ -305,7 +306,7 @@ Using [esm.sh] you can either load the client using a `