@sanity/client 6.29.0-generate.2 → 6.29.0-generate.3

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.
@@ -71,24 +71,45 @@ export declare type AgentActionPathSegment =
71
71
  declare class AgentActionsClient {
72
72
  #private
73
73
  constructor(client: SanityClient, httpRequest: HttpRequest)
74
- generate(request: GenerateAsyncInstruction): Promise<{
75
- _id: string
76
- }>
74
+ /**
75
+ * Run an instruction to generate content in a target document.
76
+ * @param request instruction request
77
+ */
77
78
  generate<DocumentShape extends Record<string, Any>>(
78
- request: GenerateSyncInstruction<DocumentShape>,
79
- ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
80
- transform(request: TransformDocumentAsync): Promise<{
81
- _id: string
82
- }>
79
+ request: GenerateInstruction<DocumentShape>,
80
+ ): Promise<
81
+ (typeof request)['async'] extends true
82
+ ? {
83
+ _id: string
84
+ }
85
+ : IdentifiedSanityDocumentStub & DocumentShape
86
+ >
87
+ /**
88
+ * Transform a target document based on a source.
89
+ * @param request translation request
90
+ */
83
91
  transform<DocumentShape extends Record<string, Any>>(
84
- request: TransformDocumentSync,
85
- ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
86
- translate(request: TranslateDocumentAsync): Promise<{
87
- _id: string
88
- }>
92
+ request: TransformDocument<DocumentShape>,
93
+ ): Promise<
94
+ (typeof request)['async'] extends true
95
+ ? {
96
+ _id: string
97
+ }
98
+ : IdentifiedSanityDocumentStub & DocumentShape
99
+ >
100
+ /**
101
+ * Translate a target document based on a source.
102
+ * @param request translation request
103
+ */
89
104
  translate<DocumentShape extends Record<string, Any>>(
90
- request: TranslateDocumentSync,
91
- ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
105
+ request: TranslateDocument<DocumentShape>,
106
+ ): Promise<
107
+ (typeof request)['async'] extends true
108
+ ? {
109
+ _id: string
110
+ }
111
+ : IdentifiedSanityDocumentStub & DocumentShape
112
+ >
92
113
  }
93
114
 
94
115
  /**
@@ -1585,24 +1606,45 @@ export declare type MutationSelectionQueryParams = {
1585
1606
  declare class ObservableAgentsActionClient {
1586
1607
  #private
1587
1608
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
1588
- generate(request: GenerateAsyncInstruction): Observable<{
1589
- _id: string
1590
- }>
1609
+ /**
1610
+ * Run an instruction to generate content in a target document.
1611
+ * @param request instruction request
1612
+ */
1591
1613
  generate<DocumentShape extends Record<string, Any>>(
1592
- request: GenerateSyncInstruction<DocumentShape>,
1593
- ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
1594
- transform(request: TransformDocumentAsync): Observable<{
1595
- _id: string
1596
- }>
1614
+ request: GenerateInstruction<DocumentShape>,
1615
+ ): Observable<
1616
+ (typeof request)['async'] extends true
1617
+ ? {
1618
+ _id: string
1619
+ }
1620
+ : IdentifiedSanityDocumentStub & DocumentShape
1621
+ >
1622
+ /**
1623
+ * Transform a target document based on a source.
1624
+ * @param request translation request
1625
+ */
1597
1626
  transform<DocumentShape extends Record<string, Any>>(
1598
- request: TransformDocumentSync,
1599
- ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
1600
- translate(request: TranslateDocumentAsync): Observable<{
1601
- _id: string
1602
- }>
1627
+ request: TransformDocument<DocumentShape>,
1628
+ ): Observable<
1629
+ (typeof request)['async'] extends true
1630
+ ? {
1631
+ _id: string
1632
+ }
1633
+ : IdentifiedSanityDocumentStub & DocumentShape
1634
+ >
1635
+ /**
1636
+ * Translate a target document based on a source.
1637
+ * @param request translation request
1638
+ */
1603
1639
  translate<DocumentShape extends Record<string, Any>>(
1604
- request: TranslateDocumentSync,
1605
- ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
1640
+ request: TranslateDocument<DocumentShape>,
1641
+ ): Observable<
1642
+ (typeof request)['async'] extends true
1643
+ ? {
1644
+ _id: string
1645
+ }
1646
+ : IdentifiedSanityDocumentStub & DocumentShape
1647
+ >
1606
1648
  }
1607
1649
 
1608
1650
  /** @internal */
@@ -3522,13 +3564,16 @@ export declare type TransactionMutationOptions =
3522
3564
  | TransactionAllDocumentIdsMutationOptions
3523
3565
 
3524
3566
  /** @beta */
3525
- export declare type TransformDocument = TransformDocumentSync | TransformDocumentAsync
3567
+ export declare type TransformDocument<T extends Record<string, Any> = Record<string, Any>> =
3568
+ | TransformDocumentSync<T>
3569
+ | TransformDocumentAsync
3526
3570
 
3527
3571
  /** @beta */
3528
3572
  declare type TransformDocumentAsync = TransformRequestBase & AgentActionAsync
3529
3573
 
3530
3574
  /** @beta */
3531
- declare type TransformDocumentSync = TransformRequestBase & AgentActionSync
3575
+ declare type TransformDocumentSync<T extends Record<string, Any> = Record<string, Any>> =
3576
+ TransformRequestBase & AgentActionSync
3532
3577
 
3533
3578
  /** @beta */
3534
3579
  declare interface TransformRequestBase extends AgentActionRequestBase {
@@ -3604,13 +3649,16 @@ export declare interface TransformTargetInclude extends AgentActionTargetInclude
3604
3649
  }
3605
3650
 
3606
3651
  /** @beta */
3607
- export declare type TranslateDocument = TranslateDocumentSync | TranslateDocumentAsync
3652
+ export declare type TranslateDocument<T extends Record<string, Any> = Record<string, Any>> =
3653
+ | TranslateDocumentSync<T>
3654
+ | TranslateDocumentAsync
3608
3655
 
3609
3656
  /** @beta */
3610
3657
  declare type TranslateDocumentAsync = TranslateRequestBase & AgentActionAsync
3611
3658
 
3612
3659
  /** @beta */
3613
- declare type TranslateDocumentSync = TranslateRequestBase & AgentActionSync
3660
+ declare type TranslateDocumentSync<T extends Record<string, Any> = Record<string, Any>> =
3661
+ TranslateRequestBase & AgentActionSync
3614
3662
 
3615
3663
  /** @beta */
3616
3664
  declare interface TranslateLanguage {
@@ -71,24 +71,45 @@ export declare type AgentActionPathSegment =
71
71
  declare class AgentActionsClient {
72
72
  #private
73
73
  constructor(client: SanityClient, httpRequest: HttpRequest)
74
- generate(request: GenerateAsyncInstruction): Promise<{
75
- _id: string
76
- }>
74
+ /**
75
+ * Run an instruction to generate content in a target document.
76
+ * @param request instruction request
77
+ */
77
78
  generate<DocumentShape extends Record<string, Any>>(
78
- request: GenerateSyncInstruction<DocumentShape>,
79
- ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
80
- transform(request: TransformDocumentAsync): Promise<{
81
- _id: string
82
- }>
79
+ request: GenerateInstruction<DocumentShape>,
80
+ ): Promise<
81
+ (typeof request)['async'] extends true
82
+ ? {
83
+ _id: string
84
+ }
85
+ : IdentifiedSanityDocumentStub & DocumentShape
86
+ >
87
+ /**
88
+ * Transform a target document based on a source.
89
+ * @param request translation request
90
+ */
83
91
  transform<DocumentShape extends Record<string, Any>>(
84
- request: TransformDocumentSync,
85
- ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
86
- translate(request: TranslateDocumentAsync): Promise<{
87
- _id: string
88
- }>
92
+ request: TransformDocument<DocumentShape>,
93
+ ): Promise<
94
+ (typeof request)['async'] extends true
95
+ ? {
96
+ _id: string
97
+ }
98
+ : IdentifiedSanityDocumentStub & DocumentShape
99
+ >
100
+ /**
101
+ * Translate a target document based on a source.
102
+ * @param request translation request
103
+ */
89
104
  translate<DocumentShape extends Record<string, Any>>(
90
- request: TranslateDocumentSync,
91
- ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
105
+ request: TranslateDocument<DocumentShape>,
106
+ ): Promise<
107
+ (typeof request)['async'] extends true
108
+ ? {
109
+ _id: string
110
+ }
111
+ : IdentifiedSanityDocumentStub & DocumentShape
112
+ >
92
113
  }
93
114
 
94
115
  /**
@@ -1585,24 +1606,45 @@ export declare type MutationSelectionQueryParams = {
1585
1606
  declare class ObservableAgentsActionClient {
1586
1607
  #private
1587
1608
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
1588
- generate(request: GenerateAsyncInstruction): Observable<{
1589
- _id: string
1590
- }>
1609
+ /**
1610
+ * Run an instruction to generate content in a target document.
1611
+ * @param request instruction request
1612
+ */
1591
1613
  generate<DocumentShape extends Record<string, Any>>(
1592
- request: GenerateSyncInstruction<DocumentShape>,
1593
- ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
1594
- transform(request: TransformDocumentAsync): Observable<{
1595
- _id: string
1596
- }>
1614
+ request: GenerateInstruction<DocumentShape>,
1615
+ ): Observable<
1616
+ (typeof request)['async'] extends true
1617
+ ? {
1618
+ _id: string
1619
+ }
1620
+ : IdentifiedSanityDocumentStub & DocumentShape
1621
+ >
1622
+ /**
1623
+ * Transform a target document based on a source.
1624
+ * @param request translation request
1625
+ */
1597
1626
  transform<DocumentShape extends Record<string, Any>>(
1598
- request: TransformDocumentSync,
1599
- ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
1600
- translate(request: TranslateDocumentAsync): Observable<{
1601
- _id: string
1602
- }>
1627
+ request: TransformDocument<DocumentShape>,
1628
+ ): Observable<
1629
+ (typeof request)['async'] extends true
1630
+ ? {
1631
+ _id: string
1632
+ }
1633
+ : IdentifiedSanityDocumentStub & DocumentShape
1634
+ >
1635
+ /**
1636
+ * Translate a target document based on a source.
1637
+ * @param request translation request
1638
+ */
1603
1639
  translate<DocumentShape extends Record<string, Any>>(
1604
- request: TranslateDocumentSync,
1605
- ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
1640
+ request: TranslateDocument<DocumentShape>,
1641
+ ): Observable<
1642
+ (typeof request)['async'] extends true
1643
+ ? {
1644
+ _id: string
1645
+ }
1646
+ : IdentifiedSanityDocumentStub & DocumentShape
1647
+ >
1606
1648
  }
1607
1649
 
1608
1650
  /** @internal */
@@ -3522,13 +3564,16 @@ export declare type TransactionMutationOptions =
3522
3564
  | TransactionAllDocumentIdsMutationOptions
3523
3565
 
3524
3566
  /** @beta */
3525
- export declare type TransformDocument = TransformDocumentSync | TransformDocumentAsync
3567
+ export declare type TransformDocument<T extends Record<string, Any> = Record<string, Any>> =
3568
+ | TransformDocumentSync<T>
3569
+ | TransformDocumentAsync
3526
3570
 
3527
3571
  /** @beta */
3528
3572
  declare type TransformDocumentAsync = TransformRequestBase & AgentActionAsync
3529
3573
 
3530
3574
  /** @beta */
3531
- declare type TransformDocumentSync = TransformRequestBase & AgentActionSync
3575
+ declare type TransformDocumentSync<T extends Record<string, Any> = Record<string, Any>> =
3576
+ TransformRequestBase & AgentActionSync
3532
3577
 
3533
3578
  /** @beta */
3534
3579
  declare interface TransformRequestBase extends AgentActionRequestBase {
@@ -3604,13 +3649,16 @@ export declare interface TransformTargetInclude extends AgentActionTargetInclude
3604
3649
  }
3605
3650
 
3606
3651
  /** @beta */
3607
- export declare type TranslateDocument = TranslateDocumentSync | TranslateDocumentAsync
3652
+ export declare type TranslateDocument<T extends Record<string, Any> = Record<string, Any>> =
3653
+ | TranslateDocumentSync<T>
3654
+ | TranslateDocumentAsync
3608
3655
 
3609
3656
  /** @beta */
3610
3657
  declare type TranslateDocumentAsync = TranslateRequestBase & AgentActionAsync
3611
3658
 
3612
3659
  /** @beta */
3613
- declare type TranslateDocumentSync = TranslateRequestBase & AgentActionSync
3660
+ declare type TranslateDocumentSync<T extends Record<string, Any> = Record<string, Any>> =
3661
+ TranslateRequestBase & AgentActionSync
3614
3662
 
3615
3663
  /** @beta */
3616
3664
  declare interface TranslateLanguage {