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

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.
@@ -93,23 +93,27 @@ export interface TranslateTarget extends AgentActionTarget {
93
93
  }
94
94
 
95
95
  /** @beta */
96
- export type TranslateDocumentSync = TranslateRequestBase & AgentActionSync
96
+ // need the generics to hold optional call-site response generics
97
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
98
+ export type TranslateDocumentSync<T extends Record<string, Any> = Record<string, Any>> =
99
+ TranslateRequestBase & AgentActionSync
97
100
 
98
101
  /** @beta */
99
102
  export type TranslateDocumentAsync = TranslateRequestBase & AgentActionAsync
100
103
 
101
104
  /** @beta */
102
- export type TranslateDocument = TranslateDocumentSync | TranslateDocumentAsync
105
+ export type TranslateDocument<T extends Record<string, Any> = Record<string, Any>> =
106
+ | TranslateDocumentSync<T>
107
+ | TranslateDocumentAsync
103
108
 
104
- export function _translate<
105
- DocumentShape extends Record<string, Any>,
106
- Req extends TranslateDocument,
107
- >(
109
+ export function _translate<DocumentShape extends Record<string, Any>>(
108
110
  client: SanityClient | ObservableSanityClient,
109
111
  httpRequest: HttpRequest,
110
- request: Req,
112
+ request: TranslateDocument<DocumentShape>,
111
113
  ): Observable<
112
- Req['async'] extends true ? {_id: string} : IdentifiedSanityDocumentStub & DocumentShape
114
+ (typeof request)['async'] extends true
115
+ ? {_id: string}
116
+ : IdentifiedSanityDocumentStub & DocumentShape
113
117
  > {
114
118
  const dataset = hasDataset(client.config())
115
119
  return _request(client, httpRequest, {
package/src/types.ts CHANGED
@@ -1373,30 +1373,45 @@ export type ClientReturn<
1373
1373
  > = GroqString extends keyof SanityQueries ? SanityQueries[GroqString] : Fallback
1374
1374
 
1375
1375
  export type {
1376
+ AgentActionAsync,
1376
1377
  AgentActionParam,
1377
1378
  AgentActionParams,
1378
1379
  AgentActionPath,
1379
1380
  AgentActionPathSegment,
1381
+ AgentActionRequestBase,
1382
+ AgentActionSync,
1380
1383
  AgentActionTarget,
1384
+ AgentActionTargetInclude,
1385
+ AgentActionTypeConfig,
1381
1386
  ConstantAgentActionParam,
1382
1387
  DocumentAgentActionParam,
1383
1388
  FieldAgentActionParam,
1384
1389
  GroqAgentActionParam,
1385
1390
  } from './agent/actions/commonTypes'
1386
1391
  export type {
1392
+ GenerateAsyncInstruction,
1387
1393
  GenerateInstruction,
1388
1394
  GenerateOperation,
1395
+ GenerateRequestBase,
1396
+ GenerateSyncInstruction,
1389
1397
  GenerateTarget,
1390
1398
  GenerateTargetInclude,
1391
1399
  } from './agent/actions/generate'
1392
1400
  export type {
1393
1401
  TransformDocument,
1402
+ TransformDocumentAsync,
1403
+ TransformDocumentSync,
1404
+ TransformRequestBase,
1394
1405
  TransformTarget,
1395
1406
  TransformTargetDocument,
1396
1407
  TransformTargetInclude,
1397
1408
  } from './agent/actions/transform'
1398
1409
  export type {
1399
1410
  TranslateDocument,
1411
+ TranslateDocumentAsync,
1412
+ TranslateDocumentSync,
1413
+ TranslateLanguage,
1414
+ TranslateRequestBase,
1400
1415
  TranslateTarget,
1401
1416
  TranslateTargetInclude,
1402
1417
  } from './agent/actions/translate'