@sanity/client 7.4.1 → 7.5.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.
@@ -1706,6 +1706,24 @@ export declare type IdentifiedSanityDocumentStub<
1706
1706
  _id: string
1707
1707
  } & SanityDocumentStub
1708
1708
 
1709
+ /**
1710
+ *
1711
+ * @see #TransformOperation
1712
+ * @beta
1713
+ */
1714
+ export declare interface ImageDescriptionOperation {
1715
+ type: 'image-description'
1716
+ /**
1717
+ * When omitted, parent image value will be inferred from the arget path.
1718
+ *
1719
+ * When specified, the `sourcePath` should be a path to an image (or image asset) field:
1720
+ * - `['image']`
1721
+ * - `['wrapper', 'mainImage']`
1722
+ * - `['heroImage', 'asset'] // the asset segment is optional, but supported`
1723
+ */
1724
+ sourcePath?: AgentActionPath
1725
+ }
1726
+
1709
1727
  /** @public */
1710
1728
  export declare interface InitializedClientConfig extends ClientConfig {
1711
1729
  apiHost: string
@@ -5506,6 +5524,39 @@ declare type TransformDocumentAsync = TransformRequestBase & AgentActionAsync
5506
5524
  declare type TransformDocumentSync<T extends Record<string, Any> = Record<string, Any>> =
5507
5525
  TransformRequestBase & AgentActionSync
5508
5526
 
5527
+ /**
5528
+ *
5529
+ * ## `set` by default
5530
+ * By default, Transform will change the value of every target field in place using a set operation.
5531
+ *
5532
+ * ## Image description
5533
+ *
5534
+ * ### Targeting image fields
5535
+ * Images can be transformed to a textual description by targeting a `string`, `text` or Portable Text field (`array` with `block`)
5536
+ * with `operation: {type: 'image-description'}`.
5537
+ *
5538
+ * Custom instructions for image description targets will be used to generate the description.
5539
+ *
5540
+ * Such targets must be a descendant field of an image object.
5541
+ *
5542
+ * For example:
5543
+ * - `target: {path: ['image', 'description'], operation: {type: 'image-description'} }`
5544
+ * - `target: {path: ['array', {_key: 'abc'}, 'alt'], operation: {type: 'image-description'} } //assuming the item in the array on the key-ed path is an image`
5545
+ * - `target: {path: ['image'], include: ['portableTextField'], operation: {type: 'image-description'}, instruction: 'Use formatting and headings to describe the image in great detail' }`
5546
+ *
5547
+ * ### Targeting non-image fields
5548
+ * If the target image description lives outside an image object, use the `sourcePath` option to specify the path to the image field.
5549
+ * `sourcePath` must be an image or image asset field.
5550
+ *
5551
+ * For example:
5552
+ * - `target: {path: ['description'], operation: operation: {type: 'image-description', sourcePath: ['image', 'asset'] }`
5553
+ * - `target: {path: ['wrapper', 'title'], operation: {type: 'image-description', sourcePath: ['array', {_key: 'abc'}, 'image'] }`
5554
+ * - `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
+ *
5556
+ * @beta
5557
+ */
5558
+ export declare type TransformOperation = 'set' | ImageDescriptionOperation
5559
+
5509
5560
  /** @beta */
5510
5561
  declare interface TransformRequestBase extends AgentActionRequestBase {
5511
5562
  /** schemaId as reported by sanity deploy / sanity schema store */
@@ -5647,7 +5698,10 @@ declare interface TransformRequestBase extends AgentActionRequestBase {
5647
5698
  target?: TransformTarget | TransformTarget[]
5648
5699
  }
5649
5700
 
5650
- /** @beta */
5701
+ /**
5702
+ * @see #TransformOperation
5703
+ * @beta
5704
+ * */
5651
5705
  export declare interface TransformTarget extends AgentActionTarget {
5652
5706
  /**
5653
5707
  * Specifies a tailored instruction of this target.
@@ -5663,6 +5717,11 @@ export declare interface TransformTarget extends AgentActionTarget {
5663
5717
  * Fields or array items not on the include list, are implicitly excluded.
5664
5718
  */
5665
5719
  include?: (AgentActionPathSegment | TransformTargetInclude)[]
5720
+ /**
5721
+ * Default: `set`
5722
+ * @see #TransformOperation
5723
+ */
5724
+ operation?: TransformOperation
5666
5725
  }
5667
5726
 
5668
5727
  /**
@@ -5688,7 +5747,10 @@ export declare type TransformTargetDocument =
5688
5747
  _id: string
5689
5748
  }
5690
5749
 
5691
- /** @beta */
5750
+ /**
5751
+ * @see #TransformOperation
5752
+ * @beta
5753
+ * */
5692
5754
  export declare interface TransformTargetInclude extends AgentActionTargetInclude {
5693
5755
  /**
5694
5756
  * Specifies a tailored instruction of this target.
@@ -5703,6 +5765,11 @@ export declare interface TransformTargetInclude extends AgentActionTargetInclude
5703
5765
  * Fields or array items not on the include list, are implicitly excluded.
5704
5766
  */
5705
5767
  include?: (AgentActionPathSegment | TransformTargetInclude)[]
5768
+ /**
5769
+ * Default: `set`
5770
+ * @see #TransformOperation
5771
+ */
5772
+ operation?: TransformOperation
5706
5773
  }
5707
5774
 
5708
5775
  /** @beta */
@@ -1706,6 +1706,24 @@ export declare type IdentifiedSanityDocumentStub<
1706
1706
  _id: string
1707
1707
  } & SanityDocumentStub
1708
1708
 
1709
+ /**
1710
+ *
1711
+ * @see #TransformOperation
1712
+ * @beta
1713
+ */
1714
+ export declare interface ImageDescriptionOperation {
1715
+ type: 'image-description'
1716
+ /**
1717
+ * When omitted, parent image value will be inferred from the arget path.
1718
+ *
1719
+ * When specified, the `sourcePath` should be a path to an image (or image asset) field:
1720
+ * - `['image']`
1721
+ * - `['wrapper', 'mainImage']`
1722
+ * - `['heroImage', 'asset'] // the asset segment is optional, but supported`
1723
+ */
1724
+ sourcePath?: AgentActionPath
1725
+ }
1726
+
1709
1727
  /** @public */
1710
1728
  export declare interface InitializedClientConfig extends ClientConfig {
1711
1729
  apiHost: string
@@ -5506,6 +5524,39 @@ declare type TransformDocumentAsync = TransformRequestBase & AgentActionAsync
5506
5524
  declare type TransformDocumentSync<T extends Record<string, Any> = Record<string, Any>> =
5507
5525
  TransformRequestBase & AgentActionSync
5508
5526
 
5527
+ /**
5528
+ *
5529
+ * ## `set` by default
5530
+ * By default, Transform will change the value of every target field in place using a set operation.
5531
+ *
5532
+ * ## Image description
5533
+ *
5534
+ * ### Targeting image fields
5535
+ * Images can be transformed to a textual description by targeting a `string`, `text` or Portable Text field (`array` with `block`)
5536
+ * with `operation: {type: 'image-description'}`.
5537
+ *
5538
+ * Custom instructions for image description targets will be used to generate the description.
5539
+ *
5540
+ * Such targets must be a descendant field of an image object.
5541
+ *
5542
+ * For example:
5543
+ * - `target: {path: ['image', 'description'], operation: {type: 'image-description'} }`
5544
+ * - `target: {path: ['array', {_key: 'abc'}, 'alt'], operation: {type: 'image-description'} } //assuming the item in the array on the key-ed path is an image`
5545
+ * - `target: {path: ['image'], include: ['portableTextField'], operation: {type: 'image-description'}, instruction: 'Use formatting and headings to describe the image in great detail' }`
5546
+ *
5547
+ * ### Targeting non-image fields
5548
+ * If the target image description lives outside an image object, use the `sourcePath` option to specify the path to the image field.
5549
+ * `sourcePath` must be an image or image asset field.
5550
+ *
5551
+ * For example:
5552
+ * - `target: {path: ['description'], operation: operation: {type: 'image-description', sourcePath: ['image', 'asset'] }`
5553
+ * - `target: {path: ['wrapper', 'title'], operation: {type: 'image-description', sourcePath: ['array', {_key: 'abc'}, 'image'] }`
5554
+ * - `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
+ *
5556
+ * @beta
5557
+ */
5558
+ export declare type TransformOperation = 'set' | ImageDescriptionOperation
5559
+
5509
5560
  /** @beta */
5510
5561
  declare interface TransformRequestBase extends AgentActionRequestBase {
5511
5562
  /** schemaId as reported by sanity deploy / sanity schema store */
@@ -5647,7 +5698,10 @@ declare interface TransformRequestBase extends AgentActionRequestBase {
5647
5698
  target?: TransformTarget | TransformTarget[]
5648
5699
  }
5649
5700
 
5650
- /** @beta */
5701
+ /**
5702
+ * @see #TransformOperation
5703
+ * @beta
5704
+ * */
5651
5705
  export declare interface TransformTarget extends AgentActionTarget {
5652
5706
  /**
5653
5707
  * Specifies a tailored instruction of this target.
@@ -5663,6 +5717,11 @@ export declare interface TransformTarget extends AgentActionTarget {
5663
5717
  * Fields or array items not on the include list, are implicitly excluded.
5664
5718
  */
5665
5719
  include?: (AgentActionPathSegment | TransformTargetInclude)[]
5720
+ /**
5721
+ * Default: `set`
5722
+ * @see #TransformOperation
5723
+ */
5724
+ operation?: TransformOperation
5666
5725
  }
5667
5726
 
5668
5727
  /**
@@ -5688,7 +5747,10 @@ export declare type TransformTargetDocument =
5688
5747
  _id: string
5689
5748
  }
5690
5749
 
5691
- /** @beta */
5750
+ /**
5751
+ * @see #TransformOperation
5752
+ * @beta
5753
+ * */
5692
5754
  export declare interface TransformTargetInclude extends AgentActionTargetInclude {
5693
5755
  /**
5694
5756
  * Specifies a tailored instruction of this target.
@@ -5703,6 +5765,11 @@ export declare interface TransformTargetInclude extends AgentActionTargetInclude
5703
5765
  * Fields or array items not on the include list, are implicitly excluded.
5704
5766
  */
5705
5767
  include?: (AgentActionPathSegment | TransformTargetInclude)[]
5768
+ /**
5769
+ * Default: `set`
5770
+ * @see #TransformOperation
5771
+ */
5772
+ operation?: TransformOperation
5706
5773
  }
5707
5774
 
5708
5775
  /** @beta */