@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.
@@ -1711,7 +1711,7 @@ export declare type IdentifiedSanityDocumentStub<
1711
1711
  * @see #TransformOperation
1712
1712
  * @beta
1713
1713
  */
1714
- export declare interface ImageDescriptionOperation {
1714
+ export declare type ImageDescriptionOperation = {
1715
1715
  type: 'image-description'
1716
1716
  /**
1717
1717
  * When omitted, parent image value will be inferred from the arget path.
@@ -1722,7 +1722,32 @@ export declare interface ImageDescriptionOperation {
1722
1722
  * - `['heroImage', 'asset'] // the asset segment is optional, but supported`
1723
1723
  */
1724
1724
  sourcePath?: AgentActionPath
1725
- }
1725
+ } & (
1726
+ | {
1727
+ /**
1728
+ * When omitted, parent image value will be inferred from the target path.
1729
+ *
1730
+ * When specified, the `sourcePath` should be a path to an image (or image asset) field:
1731
+ * - `['image']`
1732
+ * - `['wrapper', 'mainImage']`
1733
+ * - `['heroImage', 'asset'] // the asset segment is optional, but supported`
1734
+ *
1735
+ * Incompatible with `imageUrl`
1736
+ *
1737
+ */
1738
+ sourcePath?: AgentActionPath
1739
+ imageUrl?: never
1740
+ }
1741
+ | {
1742
+ /**
1743
+ * When specified, the image source to be described will be fetched from the URL.
1744
+ *
1745
+ * Incompatible with `sourcePath`
1746
+ */
1747
+ imageUrl?: `https://${string}`
1748
+ sourcePath?: never
1749
+ }
1750
+ )
1726
1751
 
1727
1752
  /** @public */
1728
1753
  export declare interface InitializedClientConfig extends ClientConfig {
@@ -5553,6 +5578,11 @@ declare type TransformDocumentSync<T extends Record<string, Any> = Record<string
5553
5578
  * - `target: {path: ['wrapper', 'title'], operation: {type: 'image-description', sourcePath: ['array', {_key: 'abc'}, 'image'] }`
5554
5579
  * - `target: {path: ['wrapper'], include: ['portableTextField'], operation: {type: 'image-description', sourcePath: ['image', 'asset'] }, instruction: 'Use formatting and headings to describe the image in great detail' }`
5555
5580
  *
5581
+ * ### Targeting images outside the document (URL)
5582
+ * 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`.
5583
+ *
5584
+ * Example:
5585
+ * - `target: {path: ['description'], operation: operation: {type: 'image-description', imageUrL: 'https://www.sanity.io/static/images/favicons/android-icon-192x192.png?v=2' }`
5556
5586
  * @beta
5557
5587
  */
5558
5588
  export declare type TransformOperation = 'set' | ImageDescriptionOperation
@@ -1711,7 +1711,7 @@ export declare type IdentifiedSanityDocumentStub<
1711
1711
  * @see #TransformOperation
1712
1712
  * @beta
1713
1713
  */
1714
- export declare interface ImageDescriptionOperation {
1714
+ export declare type ImageDescriptionOperation = {
1715
1715
  type: 'image-description'
1716
1716
  /**
1717
1717
  * When omitted, parent image value will be inferred from the arget path.
@@ -1722,7 +1722,32 @@ export declare interface ImageDescriptionOperation {
1722
1722
  * - `['heroImage', 'asset'] // the asset segment is optional, but supported`
1723
1723
  */
1724
1724
  sourcePath?: AgentActionPath
1725
- }
1725
+ } & (
1726
+ | {
1727
+ /**
1728
+ * When omitted, parent image value will be inferred from the target path.
1729
+ *
1730
+ * When specified, the `sourcePath` should be a path to an image (or image asset) field:
1731
+ * - `['image']`
1732
+ * - `['wrapper', 'mainImage']`
1733
+ * - `['heroImage', 'asset'] // the asset segment is optional, but supported`
1734
+ *
1735
+ * Incompatible with `imageUrl`
1736
+ *
1737
+ */
1738
+ sourcePath?: AgentActionPath
1739
+ imageUrl?: never
1740
+ }
1741
+ | {
1742
+ /**
1743
+ * When specified, the image source to be described will be fetched from the URL.
1744
+ *
1745
+ * Incompatible with `sourcePath`
1746
+ */
1747
+ imageUrl?: `https://${string}`
1748
+ sourcePath?: never
1749
+ }
1750
+ )
1726
1751
 
1727
1752
  /** @public */
1728
1753
  export declare interface InitializedClientConfig extends ClientConfig {
@@ -5553,6 +5578,11 @@ declare type TransformDocumentSync<T extends Record<string, Any> = Record<string
5553
5578
  * - `target: {path: ['wrapper', 'title'], operation: {type: 'image-description', sourcePath: ['array', {_key: 'abc'}, 'image'] }`
5554
5579
  * - `target: {path: ['wrapper'], include: ['portableTextField'], operation: {type: 'image-description', sourcePath: ['image', 'asset'] }, instruction: 'Use formatting and headings to describe the image in great detail' }`
5555
5580
  *
5581
+ * ### Targeting images outside the document (URL)
5582
+ * 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`.
5583
+ *
5584
+ * Example:
5585
+ * - `target: {path: ['description'], operation: operation: {type: 'image-description', imageUrL: 'https://www.sanity.io/static/images/favicons/android-icon-192x192.png?v=2' }`
5556
5586
  * @beta
5557
5587
  */
5558
5588
  export declare type TransformOperation = 'set' | ImageDescriptionOperation