@sanity/client 7.5.0 → 7.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1715,7 +1715,7 @@ export declare type IdentifiedSanityDocumentStub<
1715
1715
  * @see #TransformOperation
1716
1716
  * @beta
1717
1717
  */
1718
- export declare interface ImageDescriptionOperation {
1718
+ export declare type ImageDescriptionOperation = {
1719
1719
  type: 'image-description'
1720
1720
  /**
1721
1721
  * When omitted, parent image value will be inferred from the arget path.
@@ -1726,7 +1726,32 @@ export declare interface ImageDescriptionOperation {
1726
1726
  * - `['heroImage', 'asset'] // the asset segment is optional, but supported`
1727
1727
  */
1728
1728
  sourcePath?: AgentActionPath
1729
- }
1729
+ } & (
1730
+ | {
1731
+ /**
1732
+ * When omitted, parent image value will be inferred from the target path.
1733
+ *
1734
+ * When specified, the `sourcePath` should be a path to an image (or image asset) field:
1735
+ * - `['image']`
1736
+ * - `['wrapper', 'mainImage']`
1737
+ * - `['heroImage', 'asset'] // the asset segment is optional, but supported`
1738
+ *
1739
+ * Incompatible with `imageUrl`
1740
+ *
1741
+ */
1742
+ sourcePath?: AgentActionPath
1743
+ imageUrl?: never
1744
+ }
1745
+ | {
1746
+ /**
1747
+ * When specified, the image source to be described will be fetched from the URL.
1748
+ *
1749
+ * Incompatible with `sourcePath`
1750
+ */
1751
+ imageUrl?: `https://${string}`
1752
+ sourcePath?: never
1753
+ }
1754
+ )
1730
1755
 
1731
1756
  /** @public */
1732
1757
  export declare interface InitializedClientConfig extends ClientConfig {
@@ -5557,6 +5582,11 @@ declare type TransformDocumentSync<T extends Record<string, Any> = Record<string
5557
5582
  * - `target: {path: ['wrapper', 'title'], operation: {type: 'image-description', sourcePath: ['array', {_key: 'abc'}, 'image'] }`
5558
5583
  * - `target: {path: ['wrapper'], include: ['portableTextField'], operation: {type: 'image-description', sourcePath: ['image', 'asset'] }, instruction: 'Use formatting and headings to describe the image in great detail' }`
5559
5584
  *
5585
+ * ### Targeting images outside the document (URL)
5586
+ * If the source image is available on a https URL outside the target document, it is possible to get a description for it using `imageUrl`.
5587
+ *
5588
+ * Example:
5589
+ * - `target: {path: ['description'], operation: operation: {type: 'image-description', imageUrL: 'https://www.sanity.io/static/images/favicons/android-icon-192x192.png?v=2' }`
5560
5590
  * @beta
5561
5591
  */
5562
5592
  export declare type TransformOperation = 'set' | ImageDescriptionOperation
package/dist/index.d.ts CHANGED
@@ -1715,7 +1715,7 @@ export declare type IdentifiedSanityDocumentStub<
1715
1715
  * @see #TransformOperation
1716
1716
  * @beta
1717
1717
  */
1718
- export declare interface ImageDescriptionOperation {
1718
+ export declare type ImageDescriptionOperation = {
1719
1719
  type: 'image-description'
1720
1720
  /**
1721
1721
  * When omitted, parent image value will be inferred from the arget path.
@@ -1726,7 +1726,32 @@ export declare interface ImageDescriptionOperation {
1726
1726
  * - `['heroImage', 'asset'] // the asset segment is optional, but supported`
1727
1727
  */
1728
1728
  sourcePath?: AgentActionPath
1729
- }
1729
+ } & (
1730
+ | {
1731
+ /**
1732
+ * When omitted, parent image value will be inferred from the target path.
1733
+ *
1734
+ * When specified, the `sourcePath` should be a path to an image (or image asset) field:
1735
+ * - `['image']`
1736
+ * - `['wrapper', 'mainImage']`
1737
+ * - `['heroImage', 'asset'] // the asset segment is optional, but supported`
1738
+ *
1739
+ * Incompatible with `imageUrl`
1740
+ *
1741
+ */
1742
+ sourcePath?: AgentActionPath
1743
+ imageUrl?: never
1744
+ }
1745
+ | {
1746
+ /**
1747
+ * When specified, the image source to be described will be fetched from the URL.
1748
+ *
1749
+ * Incompatible with `sourcePath`
1750
+ */
1751
+ imageUrl?: `https://${string}`
1752
+ sourcePath?: never
1753
+ }
1754
+ )
1730
1755
 
1731
1756
  /** @public */
1732
1757
  export declare interface InitializedClientConfig extends ClientConfig {
@@ -5557,6 +5582,11 @@ declare type TransformDocumentSync<T extends Record<string, Any> = Record<string
5557
5582
  * - `target: {path: ['wrapper', 'title'], operation: {type: 'image-description', sourcePath: ['array', {_key: 'abc'}, 'image'] }`
5558
5583
  * - `target: {path: ['wrapper'], include: ['portableTextField'], operation: {type: 'image-description', sourcePath: ['image', 'asset'] }, instruction: 'Use formatting and headings to describe the image in great detail' }`
5559
5584
  *
5585
+ * ### Targeting images outside the document (URL)
5586
+ * If the source image is available on a https URL outside the target document, it is possible to get a description for it using `imageUrl`.
5587
+ *
5588
+ * Example:
5589
+ * - `target: {path: ['description'], operation: operation: {type: 'image-description', imageUrL: 'https://www.sanity.io/static/images/favicons/android-icon-192x192.png?v=2' }`
5560
5590
  * @beta
5561
5591
  */
5562
5592
  export declare type TransformOperation = 'set' | ImageDescriptionOperation
package/dist/index.js CHANGED
@@ -2510,7 +2510,7 @@ function defineDeprecatedCreateClient(createClient2) {
2510
2510
  return printNoDefaultExport(), createClient2(config);
2511
2511
  };
2512
2512
  }
2513
- var name = "@sanity/client", version = "7.5.0";
2513
+ var name = "@sanity/client", version = "7.6.0";
2514
2514
  const middleware = [
2515
2515
  debug({ verbose: !0, namespace: "sanity:client" }),
2516
2516
  headers({ "User-Agent": `${name} ${version}` }),