@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.
package/dist/index.d.cts CHANGED
@@ -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
  /**
@@ -1589,24 +1610,45 @@ export declare type MutationSelectionQueryParams = {
1589
1610
  declare class ObservableAgentsActionClient {
1590
1611
  #private
1591
1612
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
1592
- generate(request: GenerateAsyncInstruction): Observable<{
1593
- _id: string
1594
- }>
1613
+ /**
1614
+ * Run an instruction to generate content in a target document.
1615
+ * @param request instruction request
1616
+ */
1595
1617
  generate<DocumentShape extends Record<string, Any>>(
1596
- request: GenerateSyncInstruction<DocumentShape>,
1597
- ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
1598
- transform(request: TransformDocumentAsync): Observable<{
1599
- _id: string
1600
- }>
1618
+ request: GenerateInstruction<DocumentShape>,
1619
+ ): Observable<
1620
+ (typeof request)['async'] extends true
1621
+ ? {
1622
+ _id: string
1623
+ }
1624
+ : IdentifiedSanityDocumentStub & DocumentShape
1625
+ >
1626
+ /**
1627
+ * Transform a target document based on a source.
1628
+ * @param request translation request
1629
+ */
1601
1630
  transform<DocumentShape extends Record<string, Any>>(
1602
- request: TransformDocumentSync,
1603
- ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
1604
- translate(request: TranslateDocumentAsync): Observable<{
1605
- _id: string
1606
- }>
1631
+ request: TransformDocument<DocumentShape>,
1632
+ ): Observable<
1633
+ (typeof request)['async'] extends true
1634
+ ? {
1635
+ _id: string
1636
+ }
1637
+ : IdentifiedSanityDocumentStub & DocumentShape
1638
+ >
1639
+ /**
1640
+ * Translate a target document based on a source.
1641
+ * @param request translation request
1642
+ */
1607
1643
  translate<DocumentShape extends Record<string, Any>>(
1608
- request: TranslateDocumentSync,
1609
- ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
1644
+ request: TranslateDocument<DocumentShape>,
1645
+ ): Observable<
1646
+ (typeof request)['async'] extends true
1647
+ ? {
1648
+ _id: string
1649
+ }
1650
+ : IdentifiedSanityDocumentStub & DocumentShape
1651
+ >
1610
1652
  }
1611
1653
 
1612
1654
  /** @internal */
@@ -3526,13 +3568,16 @@ export declare type TransactionMutationOptions =
3526
3568
  | TransactionAllDocumentIdsMutationOptions
3527
3569
 
3528
3570
  /** @beta */
3529
- export declare type TransformDocument = TransformDocumentSync | TransformDocumentAsync
3571
+ export declare type TransformDocument<T extends Record<string, Any> = Record<string, Any>> =
3572
+ | TransformDocumentSync<T>
3573
+ | TransformDocumentAsync
3530
3574
 
3531
3575
  /** @beta */
3532
3576
  declare type TransformDocumentAsync = TransformRequestBase & AgentActionAsync
3533
3577
 
3534
3578
  /** @beta */
3535
- declare type TransformDocumentSync = TransformRequestBase & AgentActionSync
3579
+ declare type TransformDocumentSync<T extends Record<string, Any> = Record<string, Any>> =
3580
+ TransformRequestBase & AgentActionSync
3536
3581
 
3537
3582
  /** @beta */
3538
3583
  declare interface TransformRequestBase extends AgentActionRequestBase {
@@ -3608,13 +3653,16 @@ export declare interface TransformTargetInclude extends AgentActionTargetInclude
3608
3653
  }
3609
3654
 
3610
3655
  /** @beta */
3611
- export declare type TranslateDocument = TranslateDocumentSync | TranslateDocumentAsync
3656
+ export declare type TranslateDocument<T extends Record<string, Any> = Record<string, Any>> =
3657
+ | TranslateDocumentSync<T>
3658
+ | TranslateDocumentAsync
3612
3659
 
3613
3660
  /** @beta */
3614
3661
  declare type TranslateDocumentAsync = TranslateRequestBase & AgentActionAsync
3615
3662
 
3616
3663
  /** @beta */
3617
- declare type TranslateDocumentSync = TranslateRequestBase & AgentActionSync
3664
+ declare type TranslateDocumentSync<T extends Record<string, Any> = Record<string, Any>> =
3665
+ TranslateRequestBase & AgentActionSync
3618
3666
 
3619
3667
  /** @beta */
3620
3668
  declare interface TranslateLanguage {
package/dist/index.d.ts CHANGED
@@ -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
  /**
@@ -1589,24 +1610,45 @@ export declare type MutationSelectionQueryParams = {
1589
1610
  declare class ObservableAgentsActionClient {
1590
1611
  #private
1591
1612
  constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
1592
- generate(request: GenerateAsyncInstruction): Observable<{
1593
- _id: string
1594
- }>
1613
+ /**
1614
+ * Run an instruction to generate content in a target document.
1615
+ * @param request instruction request
1616
+ */
1595
1617
  generate<DocumentShape extends Record<string, Any>>(
1596
- request: GenerateSyncInstruction<DocumentShape>,
1597
- ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
1598
- transform(request: TransformDocumentAsync): Observable<{
1599
- _id: string
1600
- }>
1618
+ request: GenerateInstruction<DocumentShape>,
1619
+ ): Observable<
1620
+ (typeof request)['async'] extends true
1621
+ ? {
1622
+ _id: string
1623
+ }
1624
+ : IdentifiedSanityDocumentStub & DocumentShape
1625
+ >
1626
+ /**
1627
+ * Transform a target document based on a source.
1628
+ * @param request translation request
1629
+ */
1601
1630
  transform<DocumentShape extends Record<string, Any>>(
1602
- request: TransformDocumentSync,
1603
- ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
1604
- translate(request: TranslateDocumentAsync): Observable<{
1605
- _id: string
1606
- }>
1631
+ request: TransformDocument<DocumentShape>,
1632
+ ): Observable<
1633
+ (typeof request)['async'] extends true
1634
+ ? {
1635
+ _id: string
1636
+ }
1637
+ : IdentifiedSanityDocumentStub & DocumentShape
1638
+ >
1639
+ /**
1640
+ * Translate a target document based on a source.
1641
+ * @param request translation request
1642
+ */
1607
1643
  translate<DocumentShape extends Record<string, Any>>(
1608
- request: TranslateDocumentSync,
1609
- ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
1644
+ request: TranslateDocument<DocumentShape>,
1645
+ ): Observable<
1646
+ (typeof request)['async'] extends true
1647
+ ? {
1648
+ _id: string
1649
+ }
1650
+ : IdentifiedSanityDocumentStub & DocumentShape
1651
+ >
1610
1652
  }
1611
1653
 
1612
1654
  /** @internal */
@@ -3526,13 +3568,16 @@ export declare type TransactionMutationOptions =
3526
3568
  | TransactionAllDocumentIdsMutationOptions
3527
3569
 
3528
3570
  /** @beta */
3529
- export declare type TransformDocument = TransformDocumentSync | TransformDocumentAsync
3571
+ export declare type TransformDocument<T extends Record<string, Any> = Record<string, Any>> =
3572
+ | TransformDocumentSync<T>
3573
+ | TransformDocumentAsync
3530
3574
 
3531
3575
  /** @beta */
3532
3576
  declare type TransformDocumentAsync = TransformRequestBase & AgentActionAsync
3533
3577
 
3534
3578
  /** @beta */
3535
- declare type TransformDocumentSync = TransformRequestBase & AgentActionSync
3579
+ declare type TransformDocumentSync<T extends Record<string, Any> = Record<string, Any>> =
3580
+ TransformRequestBase & AgentActionSync
3536
3581
 
3537
3582
  /** @beta */
3538
3583
  declare interface TransformRequestBase extends AgentActionRequestBase {
@@ -3608,13 +3653,16 @@ export declare interface TransformTargetInclude extends AgentActionTargetInclude
3608
3653
  }
3609
3654
 
3610
3655
  /** @beta */
3611
- export declare type TranslateDocument = TranslateDocumentSync | TranslateDocumentAsync
3656
+ export declare type TranslateDocument<T extends Record<string, Any> = Record<string, Any>> =
3657
+ | TranslateDocumentSync<T>
3658
+ | TranslateDocumentAsync
3612
3659
 
3613
3660
  /** @beta */
3614
3661
  declare type TranslateDocumentAsync = TranslateRequestBase & AgentActionAsync
3615
3662
 
3616
3663
  /** @beta */
3617
- declare type TranslateDocumentSync = TranslateRequestBase & AgentActionSync
3664
+ declare type TranslateDocumentSync<T extends Record<string, Any> = Record<string, Any>> =
3665
+ TranslateRequestBase & AgentActionSync
3618
3666
 
3619
3667
  /** @beta */
3620
3668
  declare interface TranslateLanguage {
package/dist/index.js CHANGED
@@ -1651,7 +1651,7 @@ function defineDeprecatedCreateClient(createClient2) {
1651
1651
  return printNoDefaultExport(), createClient2(config);
1652
1652
  };
1653
1653
  }
1654
- var name = "@sanity/client", version = "6.29.0-generate.2";
1654
+ var name = "@sanity/client", version = "6.29.0-generate.3";
1655
1655
  const middleware = [
1656
1656
  debug({ verbose: !0, namespace: "sanity:client" }),
1657
1657
  headers({ "User-Agent": `${name} ${version}` }),