8000 Releases · sanity-io/client · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

Releases: sanity-io/client

v7.4.1

04 Jun 11:14
b92a34d
Compare
Choose a tag to compare

7.4.1 (2025-06-04)

Bug Fixes

  • only allow non-nullable values in search params (#1043) (19c00ea)

v7.4.0

30 May 12:18
8ae294f
Compare
Choose a tag to compare

7.4.0 (2025-05-29)

Highlights

Agent Actions no longer mutate published documents by default (#1092) (7587e2c)

API Breaking Change: As of this release, Agent Actions will never write to published documents by default. Use forcePublishedWrite: true in the request to write to published documents.

Agent Actions require apiVersion: 'vX'. Therefore, this is new behavior will apply to all users of agent actions, regardless of client version. Using this release (or later) will be required to opt out of the new behavior using forcePublishedWrite: true.

As of this going out, by default:

  • Agent Actions will not mutate a published document. It will use a drafts id if a published id is provided
  • Operations on drafts will get initial state from published doc if no draft exists.
  • Callers should check the _id in the response as needed; when a publishedId is provided a drafts.publishedId will be returned.

To opt out of the default behavior, pass forcePublishedWrite: true

Exceptions:

  • Documents with liveEdit: true in the schema definition will behave as if forcePublishedWrite: true, and also will not accept drafts IDs in requests.
  • Versioned Ids on the form "versions.release-id.document-id" will always behave as if forcePublishedWrite: true, and will not consider draft nor published state; only the version itself.

New Agent Actions

Patch: a schema aware patch API(#1091) (0bf6de3)

The client.patch and client.transaction API are not schema aware. These allows patching documents any way you want, but the operations will not fail if they deviate from the document schema.

To ensure schema-compliant operation, client.agent.action.patch is available. It will ensure that provided paths and values adhere to the document schema, ensure no duplicate keys are inserted, and merge object values so set operations don't accidentally remove existing values. Learn more in the quick start.

await client.agent.action.patch({
  schemaId: '_.schema.default',
  documentId: 'documentId',
  target: {
    path: ['metadata', 'title'], // path to metadata.title
    operation: 'set',
    value: 'New title'
  }
})

Prompt: Make LLM requests without mutating documents (#1078) (d6b08b7)

agent.action.prompt is an API for sending instructions to the LLM and receiving text or json back. Useful if you want to use the same Sanity client and feed in your content, but don't want to incorporate a third-party library or API key. Learn more in the quick start.

await client.agent.action.prompt({
  instruction: `Give me some ideas for a blog post 
    about using AI with structured content.`
})

Generate and Transform for images(#1093) (475214d)

Generating images

Generate can generate images the same way as AI Assist, for images that have been configured using AI Assist schema options.

To generate images without changing the schema, you can now directly target an image asset path.

For example, all the following will generate an image into the provided asset:

  • target: {path: ['image', 'asset'] }
  • target: {path: 'image', include: ['asset'] }

Image generation can be combined with regular content targets:

  • target: [{path: ['image', 'asset'] }, {include: ['title', 'description']}]

As Generate happens in a single LLM pass, the image will be contextually related to other generated content.

Transforming images

To transform an existing image, directly target an image asset path with Transform.

For example, all the following will transform the image into the provided asset:

  • target: {path: ['image', 'asset'] }

target: {path: 'image', include: ['asset'] }

Image transform can be combined with regular content targets:

  • target: [{path: ['image', 'asset'] }, {include: ['title', 'description']}]

Image transform can have per-path instructions, just like any other target paths:

  • target: [{path: ['image', 'asset'], instruction: 'Make the sky blue' }

See the updated image generation documentation for more details.

Bug Fixes

  • add support for custom headers in listen and live clients (#1087) (11a103f)

v7.3.0

20 May 15:21
580a524
Compare
Choose a tag to compare

7.3.0 (2025-05-20)

Features

  • pass default headers to createClient for all requests (#1079) (e99c852)

v7.2.2

19 May 08:41
010e75e
Compare
Choose a tag to compare

7.2.2 (2025-05-19)

Bug Fixes

  • deps: update dependency get-it to ^8.6.9 (#1080) (7a7c6be)

v7.2.1

09 May 15:58
7db7b9a
Compare
Choose a tag to compare

7.2.1 (2025-05-09)

Bug Fixes

  • downgrade nanoid to ensure compatibility with node < 22 (#1076) (368a12d)

v7.2.0

09 May 13:45
3e3f398
Compare
Choose a tag to compare

7.2.0 (2025-05-09)

Features

Content Release and Document Version operations (#1067) (9b80bd8)

The client now has complete abstractions and types for all Content Lake release and version actions.

These are available to be used directly interfacing with the server action:

client.action(
  {
    actionType: 'sanity.action.document.version.create',
    publishedId: 'bike-123',
    document: {
      _id: 'versions.new-bike-release.bike-123'
      _type: 'bike'
    }
  }
)

Or additionally through method abstractions which provide more unified concepts such as releaseId and publishedId, in addition to client side guards on mismatching IDs:

client.createVersion(
  {
    publishedId: 'bike-123',
    releaseId: 'new-bike-release',
    document: {
      _type: 'bike'
    }
  }
)

Important

Deprecation notice of some document server actions
The discard and replaceDraft actions now have deprecation notices in the client, to reflect updates on the underlying Content Lake API.

discard is superseded by discardVersion and replaceDraft by replaceVersion

v7.1.0

06 May 08:51
4529e0d
Compare
Choose a tag to compare

7.1.0 (2025-05-05)

Features

v7.0.0

30 Apr 13:15
f678b54
Compare
Choose a tag to compare

7.0.0 (2025-04-30)

⚠ BREAKING CHANGES

  • Dropping support for Node.js < v20 as Node.js v18 is EOL as of 2025-04-30

Bug Fixes

v6.29.1

25 Apr 00:12
107a380
Compare
Choose a tag to compare

6.29.1 (2025-04-25)

Bug Fixes

  • dependency update, import condition (d8109b9)

v6.29.0

11 Apr 14:02
09ed88b
Compare
Choose a tag to compare

6.29.0 (2025-04-11)

Features

0