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

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.
@@ -1,3 +1,10 @@
1
+ import type {AgentActionAsync} from '@sanity/client/agent/actions/commonTypes'
2
+ import type {AgentActionPath as AgentActionPath_2} from '@sanity/client/agent/actions/commonTypes'
3
+ import type {AgentActionPathSegment as AgentActionPathSegment_2} from '@sanity/client/agent/actions/commonTypes'
4
+ import type {AgentActionRequestBase} from '@sanity/client/agent/actions/commonTypes'
5
+ import type {AgentActionSync} from '@sanity/client/agent/actions/commonTypes'
6
+ import type {AgentActionTarget as AgentActionTarget_2} from '@sanity/client/agent/actions/commonTypes'
7
+ import type {AgentActionTargetInclude} from '@sanity/client/agent/actions/commonTypes'
1
8
  import {ClientConfig as ClientConfig_2} from '@sanity/client'
2
9
  import {Observable} from 'rxjs'
3
10
  import {Requester} from 'get-it'
@@ -33,6 +40,27 @@ export declare interface ActionErrorItem {
33
40
  index: number
34
41
  }
35
42
 
43
+ /** @beta */
44
+ export declare type AgentActionParam =
45
+ | string
46
+ | ConstantAgentActionParam
47
+ | FieldAgentActionParam
48
+ | DocumentAgentActionParam
49
+ | GroqAgentActionParam
50
+
51
+ /** @beta */
52
+ export declare type AgentActionParams = Record<string, AgentActionParam>
53
+
54
+ /** @beta */
55
+ export declare type AgentActionPath = AgentActionPathSegment[]
56
+
57
+ /** @beta */
58
+ export declare type AgentActionPathSegment =
59
+ | string
60
+ | {
61
+ _key: string
62
+ }
63
+
36
64
  /** @public */
37
65
  declare class AgentActionsClient {
38
66
  #private
@@ -43,8 +71,82 @@ declare class AgentActionsClient {
43
71
  generate<DocumentShape extends Record<string, Any>>(
44
72
  request: GenerateSyncInstruction<DocumentShape>,
45
73
  ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
74
+ transform(request: TransformDocumentAsync): Promise<{
75
+ _id: string
76
+ }>
77
+ transform<DocumentShape extends Record<string, Any>>(
78
+ request: TransformDocumentSync,
79
+ ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
80
+ translate(request: TranslateDocumentAsync): Promise<{
81
+ _id: string
82
+ }>
83
+ translate<DocumentShape extends Record<string, Any>>(
84
+ request: TranslateDocumentSync,
85
+ ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
46
86
  }
47
87
 
88
+ /**
89
+ * @beta
90
+ */
91
+ export declare interface AgentActionTarget {
92
+ /**
93
+ * Root target path.
94
+ *
95
+ * Use this to have the instruction only affect a part of the document.
96
+ *
97
+ * To further control the behavior of individual paths under the root, use `include`, `exclude`, `types.include`
98
+ * and `types.exclude`.
99
+ *
100
+ * Example:
101
+ *
102
+ * `path: ['body', {_key: 'someKey'}, 'nestedObject']`
103
+ *
104
+ * Here, the instruction will only write to fields under the nestedObject.
105
+ *
106
+ * Default: [] = the document itself
107
+ *
108
+ * @see #AgentActionPathSegment
109
+ * @see #AgentActionPath
110
+ * */
111
+ path?: AgentActionPathSegment | AgentActionPath
112
+ /**
113
+ * maxPathDepth controls how deep into the schema from the target root the instruction will affect.
114
+ *
115
+ * Depth is based on path segments:
116
+ * - `title` has depth 1
117
+ * - `array[_key="no"].title` has depth 3
118
+ *
119
+ * Be careful not to set this too high in studios with recursive document schemas, as it could have
120
+ * negative impact on performance; both for runtime and quality of responses.
121
+ *
122
+ * Default: 4
123
+ */
124
+ maxPathDepth?: number
125
+ /**
126
+ * By default, all children up to `target.maxPathDepth` are included.
127
+ * Fields or array items not on the exclude list, are implicitly included.
128
+ */
129
+ exclude?: AgentActionPathSegment[]
130
+ /**
131
+ * Types can be used to exclude array item types or all fields directly under the target path of a certain type.
132
+ * If you do exclude: ['string'] all string fields under the target will be excluded, for instance.
133
+ *
134
+ * `types.include` and `types.exclude` are mutually exclusive.
135
+ */
136
+ types?: AgentActionTypeConfig
137
+ }
138
+
139
+ /** @beta */
140
+ declare type AgentActionTypeConfig =
141
+ | {
142
+ include: string[]
143
+ exclude?: never
144
+ }
145
+ | {
146
+ exclude: string[]
147
+ include?: never
148
+ }
149
+
48
150
  /** @internal */
49
151
  export declare type AllDocumentIdsMutationOptions = BaseMutationOptions & {
50
152
  returnFirst: false
@@ -122,18 +224,6 @@ export declare class AssetsClient {
122
224
  ): Promise<SanityAssetDocument | SanityImageAssetDocument>
123
225
  }
124
226
 
125
- declare interface Async {
126
- /**
127
- * When async: true, requests responds with status 201 and {_id} as response body as soon as the request is validated.
128
- * The instruction operation will carry on in the background.
129
- *
130
- * When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
131
- *
132
- * async: true is incompatible with noWrite, as async: true does not return the resulting document
133
- */
134
- async: true
135
- }
136
-
137
227
  /** @internal */
138
228
  export declare type AttributeSet = {
139
229
  [key: string]: Any
@@ -499,6 +589,12 @@ export declare class ConnectionFailedError extends Error {
499
589
  readonly name = 'ConnectionFailedError'
500
590
  }
501
591
 
592
+ /** @beta */
593
+ export declare interface ConstantAgentActionParam {
594
+ type: 'constant'
595
+ value: string
596
+ }
597
+
502
598
  /** @public */
503
599
  export declare interface ContentSourceMap {
504
600
  mappings: ContentSourceMapMappings
@@ -717,19 +813,6 @@ export declare type CreateAction = {
717
813
  */
718
814
  export declare const createClient: (config: ClientConfig_2) => SanityClient
719
815
 
720
- /**
721
- * Instruction to create a new document
722
- * @beta
723
- */
724
- declare interface CreateDocumentRequest<T extends Record<string, Any> = Record<string, Any>> {
725
- createDocument: {
726
- /** if no _id is provided, one will be generated. _id is always returned when the requests succeed */
727
- _id?: string
728
- _type: string
729
- } & SanityDocumentStub<T>
730
- documentId?: never
731
- }
732
-
733
816
  /** @public */
734
817
  export declare interface CurrentSanityUser {
735
818
  id: string
@@ -874,6 +957,19 @@ export declare type DisconnectEvent = {
874
957
  reason: string
875
958
  }
876
959
 
960
+ /**
961
+ *
962
+ * Includes a LLM-friendly version of the document in the instruction
963
+ * @beta
964
+ * */
965
+ export declare interface DocumentAgentActionParam {
966
+ type: 'document'
967
+ /**
968
+ * If omitted, implicitly uses the documentId of the instruction target
969
+ */
970
+ documentId?: string
971
+ }
972
+
877
973
  /**
878
974
  * Modifies an existing draft document.
879
975
  * It applies the given patch to the document referenced by draftId.
@@ -936,12 +1032,20 @@ export declare type EventSourceEvent<Name extends string> = ServerSentEvent<Name
936
1032
  export declare type EventSourceInstance = InstanceType<typeof globalThis.EventSource>
937
1033
 
938
1034
  /**
939
- * Instruction for an existing document.
1035
+ *
1036
+ * Includes a LLM-friendly version of the field value in the instruction
940
1037
  * @beta
941
- */
942
- declare interface ExistingDocumentRequest {
943
- documentId: string
944
- createDocument?: never
1038
+ * */
1039
+ export declare interface FieldAgentActionParam {
1040
+ type: 'field'
1041
+ /**
1042
+ * Examples: ['title'], ['array', {_key: 'arrayItemKey'}, 'field']
1043
+ */
1044
+ path: AgentActionPath
1045
+ /**
1046
+ * If omitted, implicitly uses the documentId of the instruction target
1047
+ */
1048
+ documentId?: string
945
1049
  }
946
1050
 
947
1051
  /** @public */
@@ -1060,53 +1164,35 @@ export declare type FirstDocumentMutationOptions = BaseMutationOptions & {
1060
1164
  }
1061
1165
 
1062
1166
  /** @beta */
1063
- export declare type GenerateAsyncInstruction<T extends Record<string, Any> = Record<string, Any>> =
1064
- (ExistingDocumentRequest | CreateDocumentRequest<T>) & GenerateRequestBase & Async
1065
-
1066
- /** @beta */
1067
- export declare interface GenerateConstantInstructionParam {
1068
- type: 'constant'
1069
- value: string
1070
- }
1071
-
1072
- /**
1073
- *
1074
- * Includes a LLM-friendly version of the document in the instruction
1075
- * @beta
1076
- * */
1077
- declare interface GenerateDocumentInstructionParam {
1078
- type: 'document'
1079
- /**
1080
- * If omitted, implicitly uses the documentId of the instruction target
1081
- */
1082
- documentId?: string
1083
- }
1167
+ declare type GenerateAsyncInstruction<T extends Record<string, Any> = Record<string, Any>> = (
1168
+ | GenerateExistingDocumentRequest
1169
+ | GenerateCreateDocumentRequest<T>
1170
+ ) &
1171
+ GenerateRequestBase &
1172
+ AgentActionAsync
1084
1173
 
1085
1174
  /**
1086
- *
1087
- * Includes a LLM-friendly version of the field value in the instruction
1175
+ * Instruction to create a new document
1088
1176
  * @beta
1089
- * */
1090
- export declare interface GenerateFieldInstructionParam {
1091
- type: 'field'
1092
- /**
1093
- * Examples: ['title'], ['array', {_key: 'arrayItemKey'}, 'field']
1094
- */
1095
- path: GeneratePath
1096
- /**
1097
- * If omitted, implicitly uses the documentId of the instruction target
1098
- */
1099
- documentId?: string
1177
+ */
1178
+ declare interface GenerateCreateDocumentRequest<
1179
+ T extends Record<string, Any> = Record<string, Any>,
1180
+ > {
1181
+ createDocument: {
1182
+ /** if no _id is provided, one will be generated. _id is always returned when the requests succeed */
1183
+ _id?: string
1184
+ _type: string
1185
+ } & SanityDocumentStub<T>
1186
+ documentId?: never
1100
1187
  }
1101
1188
 
1102
1189
  /**
1103
- * Includes a LLM-friendly version of GROQ query result in the instruction
1190
+ * Instruction for an existing document.
1104
1191
  * @beta
1105
- * */
1106
- export declare interface GenerateGroqInstructionParam {
1107
- type: 'groq'
1108
- query: string
1109
- params?: Record<string, string>
1192
+ */
1193
+ declare interface GenerateExistingDocumentRequest {
1194
+ documentId: string
1195
+ createDocument?: never
1110
1196
  }
1111
1197
 
1112
1198
  /** @beta */
@@ -1114,34 +1200,17 @@ export declare type GenerateInstruction<T extends Record<string, Any> = Record<s
1114
1200
  | GenerateSyncInstruction<T>
1115
1201
  | GenerateAsyncInstruction<T>
1116
1202
 
1117
- /** @beta */
1118
- export declare type GenerateInstructionParam =
1119
- | string
1120
- | GenerateConstantInstructionParam
1121
- | GenerateFieldInstructionParam
1122
- | GenerateDocumentInstructionParam
1123
- | GenerateGroqInstructionParam
1124
-
1125
- /** @beta */
1126
- export declare type GenerateInstructionParams = Record<string, GenerateInstructionParam>
1127
-
1128
- declare type GenerateOperation = 'set' | 'append' | 'mixed'
1129
-
1130
- declare type GeneratePath = GeneratePathSegment[]
1131
-
1132
- declare type GeneratePathSegment =
1133
- | string
1134
- | {
1135
- _key: string
1136
- }
1203
+ /** @beta */
1204
+ export declare type GenerateOperation = 'set' | 'append' | 'mixed'
1137
1205
 
1138
- declare interface GenerateRequestBase {
1206
+ /** @beta */
1207
+ declare interface GenerateRequestBase extends AgentActionRequestBase {
1139
1208
  /** schemaId as reported by sanity deploy / sanity schema store */
1140
1209
  schemaId: string
1141
- /** string template using $variable – more on this below under "Dynamic instruction" */
1210
+ /** string template using $variable */
1142
1211
  instruction: string
1143
1212
  /** param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable" */
1144
- instructionParams?: GenerateInstructionParams
1213
+ instructionParams?: AgentActionParams
1145
1214
  /**
1146
1215
  * Target defines which parts of the document will be affected by the instruction.
1147
1216
  * It can be an array, so multiple parts of the document can be separately configured in detail.
@@ -1153,109 +1222,21 @@ declare interface GenerateRequestBase {
1153
1222
  * - when multiple targets are provided, they will be coalesced into a single target sharing a common target root.
1154
1223
  * It is therefor an error to provide conflicting include/exclude across targets (ie, include title in one, and exclude it in another)
1155
1224
  *
1156
- * @see GenerateRequestBase#conditionalPaths
1225
+ * @see AgentActionRequestBase#conditionalPaths
1157
1226
  */
1158
1227
  target?: GenerateTarget | GenerateTarget[]
1159
- /**
1160
- * When a type or field in the schema has a function set for `hidden` or `readOnly`, it is conditional.
1161
- *
1162
- * By default, Generate will not output to conditional `readOnly` and `hidden` fields,
1163
- * ie, they are considered to resolve to `readOnly: true` / `hidden: true`.
1164
- *
1165
- * `conditionalPaths` param allows setting the default conditional value for
1166
- * `hidden` and `readOnly` to false,
1167
- * or individually set `hidden` and `readOnly` state for individual document paths.
1168
- *
1169
- *
1170
- * Note: fields and types with explicit readOnly: true or hidden: true in the schema, are not available to Generate,
1171
- * and cannot be changed via conditionalPaths
1172
- *
1173
- * conditionalPaths state only apply to fields and types that have conditional `hidden` or `readOnly` in their schema definition.
1174
- *
1175
- * Consider using `hidden: () => true` in schema config, if a field should be writeable only by Generate and never
1176
- * visible in the studio – then make the field visible to the Generate using `conditionalPaths`.
1177
- *
1178
- * @see GenerateRequestBase#target
1179
- */
1180
- conditionalPaths?: {
1181
- defaultReadOnly?: boolean
1182
- defaultHidden?: boolean
1183
- paths?: {
1184
- /** path here is not a relative path: it must be the full document path, regardless of `path` param used in targets */
1185
- path: GeneratePath
1186
- readOnly: boolean
1187
- hidden: boolean
1188
- }[]
1189
- }
1190
- /**
1191
- * When localeSettings is provided on the request, instruct can write to date and datetime fields.
1192
- * Otherwise, such fields will be ignored.
1193
- */
1194
- localeSettings?: {
1195
- /**
1196
- * A valid Unicode BCP 47 locale identifier used to interpret and format
1197
- * natural language inputs and date output. Examples include "en-US", "fr-FR", or "ja-JP".
1198
- *
1199
- * This affects how phrases like "next Friday" or "in two weeks" are parsed,
1200
- * and how resulting dates are presented (e.g., 12-hour vs 24-hour format).
1201
- *
1202
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#getcanonicalocales
1203
- */
1204
- locale: string
1205
- /**
1206
- * A valid IANA time zone identifier used to resolve relative and absolute
1207
- * date expressions to a specific point in time. Examples include
1208
- * "America/New_York", "Europe/Paris", or "Asia/Tokyo".
1209
- *
1210
- * This ensures phrases like "tomorrow at 9am" are interpreted correctly
1211
- * based on the user's local time.
1212
- *
1213
- * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
1214
- */
1215
- timeZone: string
1216
- }
1217
- /**
1218
- * Controls how much variance the instructions will run with.
1219
- *
1220
- * Value must be in the range [0, 1] (inclusive).
1221
- *
1222
- * Default: 0.3
1223
- */
1224
- temperature?: number
1225
1228
  }
1226
1229
 
1227
1230
  /** @beta */
1228
- export declare type GenerateSyncInstruction<T extends Record<string, Any> = Record<string, Any>> = (
1229
- | ExistingDocumentRequest
1230
- | CreateDocumentRequest<T>
1231
+ declare type GenerateSyncInstruction<T extends Record<string, Any> = Record<string, Any>> = (
1232
+ | GenerateExistingDocumentRequest
1233
+ | GenerateCreateDocumentRequest<T>
1231
1234
  ) &
1232
1235
  GenerateRequestBase &
1233
- Sync
1236
+ AgentActionSync
1234
1237
 
1235
- /**
1236
- * @beta
1237
- */
1238
- declare interface GenerateTarget {
1239
- /**
1240
- * Root target path.
1241
- *
1242
- * Use this to have the instruction only affect a part of the document.
1243
- *
1244
- * To further control the behavior of individual paths under the root, use `include`, `exclude`, `types.include`
1245
- * and `types.exclude`.
1246
- *
1247
- * Example:
1248
- *
1249
- * `path: ['body', {_key: 'someKey'}, 'nestedObject']`
1250
- *
1251
- * Here, the instruction will only write to fields under the nestedObject.
1252
- *
1253
- * Default: [] = the document itself
1254
- *
1255
- * @see #GeneratePathSegment
1256
- * @see #GeneratePath
1257
- * */
1258
- path?: GeneratePathSegment | GeneratePath
1238
+ /** @beta */
1239
+ export declare interface GenerateTarget extends AgentActionTarget_2 {
1259
1240
  /**
1260
1241
  * Sets the default operation for all paths in the target.
1261
1242
  * Generate runs in `'mixed'` operation mode by default:
@@ -1284,24 +1265,11 @@ declare interface GenerateTarget {
1284
1265
  * To insert in the middle of the array, use `target: {path: ['array', {_key: 'appendAfterKey'}], operation: 'append'}`.
1285
1266
  * Here, the output of the instruction will be appended after the array item with key `'appendAfterKey'`.
1286
1267
  *
1287
- * @see #GenerateTargetInclude.operation
1268
+ * @see #AgentActionTargetInclude.operation
1288
1269
  * @see #include
1289
- * @see #GenerateTargetInclude.include
1270
+ * @see #AgentActionTargetInclude.include
1290
1271
  */
1291
1272
  operation?: GenerateOperation
1292
- /**
1293
- * maxPathDepth controls how deep into the schema from the target root the instruction will affect.
1294
- *
1295
- * Depth is based on path segments:
1296
- * - `title` has depth 1
1297
- * - `array[_key="no"].title` has depth 3
1298
- *
1299
- * Be careful not to set this too high in studios with recursive document schemas, as it could have
1300
- * negative impact on performance; both for runtime and quality of responses.
1301
- *
1302
- * Default: 4
1303
- */
1304
- maxPathDepth?: number
1305
1273
  /**
1306
1274
  * By default, all children up to `target.maxPathDepth` are included.
1307
1275
  *
@@ -1309,23 +1277,11 @@ declare interface GenerateTarget {
1309
1277
  *
1310
1278
  * Fields or array items not on the include list, are implicitly excluded.
1311
1279
  */
1312
- include?: (GeneratePathSegment | GenerateTargetInclude)[]
1313
- /**
1314
- * By default, all children up to `target.maxPathDepth` are included.
1315
- * Fields or array items not on the exclude list, are implicitly included.
1316
- */
1317
- exclude?: GeneratePathSegment[]
1318
- /**
1319
- * Types can be used to exclude array item types or all fields directly under the target path of a certain type.
1320
- * If you do exclude: ['string'] all string fields under the target will be excluded, for instance.
1321
- *
1322
- * `types.include` and `types.exclude` are mutually exclusive.
1323
- */
1324
- types?: GenerateTypeConfig
1280
+ include?: (AgentActionPathSegment_2 | GenerateTargetInclude)[]
1325
1281
  }
1326
1282
 
1327
- declare interface GenerateTargetInclude {
1328
- path: GeneratePathSegment | GeneratePath
1283
+ /** @beta */
1284
+ export declare interface GenerateTargetInclude extends AgentActionTargetInclude {
1329
1285
  /**
1330
1286
  * Sets the operation for this path, and all its children.
1331
1287
  * This overrides any operation set parents or the root target.
@@ -1340,30 +1296,18 @@ declare interface GenerateTargetInclude {
1340
1296
  *
1341
1297
  * Fields or array items not on the include list, are implicitly excluded.
1342
1298
  */
1343
- include?: (GeneratePathSegment | GenerateTargetInclude)[]
1344
- /**
1345
- * By default, all children up to `target.maxPathDepth` are included.
1346
- * Fields or array items not on the exclude list, are implicitly included.
1347
- */
1348
- exclude?: GeneratePathSegment[]
1349
- /**
1350
- * Types can be used to exclude array item types or all fields directly under the target path of a certain type.
1351
- * If you do exclude: ['string'] all string fields under the target will be excluded, for instance.
1352
- *
1353
- * `types.include` and `types.exclude` are mutually exclusive.
1354
- */
1355
- types?: GenerateTypeConfig
1299
+ include?: (AgentActionPathSegment_2 | GenerateTargetInclude)[]
1356
1300
  }
1357
1301
 
1358
- declare type GenerateTypeConfig =
1359
- | {
1360
- include: string[]
1361
- exclude?: never
1362
- }
1363
- | {
1364
- exclude: string[]
1365
- include?: never
1366
- }
1302
+ /**
1303
+ * Includes a LLM-friendly version of GROQ query result in the instruction
1304
+ * @beta
1305
+ * */
1306
+ export declare interface GroqAgentActionParam {
1307
+ type: 'groq'
1308
+ query: string
1309
+ params?: Record<string, string>
1310
+ }
1367
1311
 
1368
1312
  /** @public */
1369
1313
  export declare type HttpRequest = {
@@ -1824,6 +1768,18 @@ declare class ObservableAgentsActionClient {
1824
1768
  generate<DocumentShape extends Record<string, Any>>(
1825
1769
  request: GenerateSyncInstruction<DocumentShape>,
1826
1770
  ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
1771
+ transform(request: TransformDocumentAsync): Observable<{
1772
+ _id: string
1773
+ }>
1774
+ transform<DocumentShape extends Record<string, Any>>(
1775
+ request: TransformDocumentSync,
1776
+ ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
1777
+ translate(request: TranslateDocumentAsync): Observable<{
1778
+ _id: string
1779
+ }>
1780
+ translate<DocumentShape extends Record<string, Any>>(
1781
+ request: TranslateDocumentSync,
1782
+ ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
1827
1783
  }
1828
1784
 
1829
1785
  /** @internal */
@@ -3723,29 +3679,6 @@ export declare type StudioBaseUrl =
3723
3679
  /** @alpha */
3724
3680
  export declare type StudioUrl = StudioBaseUrl | StudioBaseRoute
3725
3681
 
3726
- declare interface Sync {
3727
- /**
3728
- * By default, noWrite: false.
3729
- * Write enabled operations will mutate the target document, and emit AI presence in the studio.
3730
- *
3731
- * When noWrite: true, the api will not mutate any documents nor emit presence.
3732
- * Ie, when true, no changes will be made to content-lake
3733
- *
3734
- * noWrite: true is incompatible with async: true,
3735
- * as noWrite implies that you will use the return value of the operation
3736
- */
3737
- noWrite?: boolean
3738
- /**
3739
- * When async: true, requests responds with status 201 and {_id} as response body as soon as the request is validated.
3740
- * The instruction operation will carry on in the background.
3741
- *
3742
- * When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
3743
- *
3744
- * async: true is incompatible with noWrite: true, as async: true does not return the resulting document
3745
- */
3746
- async?: false
3747
- }
3748
-
3749
3682
  /** @public */
3750
3683
  export declare type SyncTag = `s1:${string}`
3751
3684
 
@@ -3846,6 +3779,161 @@ export declare type TransactionMutationOptions =
3846
3779
  | TransactionAllDocumentsMutationOptions
3847
3780
  | TransactionAllDocumentIdsMutationOptions
3848
3781
 
3782
+ /** @beta */
3783
+ export declare type TransformDocument = TransformDocumentSync | TransformDocumentAsync
3784
+
3785
+ /** @beta */
3786
+ declare type TransformDocumentAsync = TransformRequestBase & AgentActionAsync
3787
+
3788
+ /** @beta */
3789
+ declare type TransformDocumentSync = TransformRequestBase & AgentActionSync
3790
+
3791
+ /** @beta */
3792
+ declare interface TransformRequestBase extends AgentActionRequestBase {
3793
+ /** schemaId as reported by sanity deploy / sanity schema store */
3794
+ schemaId: string
3795
+ documentId: string
3796
+ targetDocument?: TransformTargetDocument
3797
+ /** string template using $variable */
3798
+ transformation: string
3799
+ /** param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable" */
3800
+ transformationParams?: AgentActionParams
3801
+ /**
3802
+ * Target defines which parts of the document will be affected by the instruction.
3803
+ * It can be an array, so multiple parts of the document can be separately configured in detail.
3804
+ *
3805
+ * Omitting target implies that the document itself is the root.
3806
+ *
3807
+ * Notes:
3808
+ * - instruction can only affect fields up to `maxPathDepth`
3809
+ * - when multiple targets are provided, they will be coalesced into a single target sharing a common target root.
3810
+ * It is therefor an error to provide conflicting include/exclude across targets (ie, include title in one, and exclude it in another)
3811
+ *
3812
+ * @see AgentActionRequestBase#conditionalPaths
3813
+ */
3814
+ target?: TransformTarget | TransformTarget[]
3815
+ }
3816
+
3817
+ /** @beta */
3818
+ export declare interface TransformTarget extends AgentActionTarget_2 {
3819
+ /** string template using $variable from instructionParams */
3820
+ transformation?: string
3821
+ /**
3822
+ * By default, all children up to `target.maxPathDepth` are included.
3823
+ *
3824
+ * When `include` is specified, only segments explicitly listed will be included.
3825
+ *
3826
+ * Fields or array items not on the include list, are implicitly excluded.
3827
+ */
3828
+ include?: (AgentActionPathSegment_2 | TransformTargetInclude)[]
3829
+ }
3830
+
3831
+ /** @beta */
3832
+ export declare type TransformTargetDocument =
3833
+ | {
3834
+ operation: 'get'
3835
+ _id: string
3836
+ }
3837
+ | {
3838
+ operation: 'create'
3839
+ _id?: string
3840
+ }
3841
+ | {
3842
+ operation: 'createIfNotExists'
3843
+ _id: string
3844
+ }
3845
+ | {
3846
+ operation: 'createOrReplace'
3847
+ _id: string
3848
+ }
3849
+
3850
+ /** @beta */
3851
+ export declare interface TransformTargetInclude extends AgentActionTargetInclude {
3852
+ /** string template using $variable from instructionParams */
3853
+ transformation?: string
3854
+ /**
3855
+ * By default, all children up to `target.maxPathDepth` are included.
3856
+ *
3857
+ * When `include` is specified, only segments explicitly listed will be included.
3858
+ *
3859
+ * Fields or array items not on the include list, are implicitly excluded.
3860
+ */
3861
+ include?: (AgentActionPathSegment_2 | TransformTargetInclude)[]
3862
+ }
3863
+
3864
+ /** @beta */
3865
+ export declare type TranslateDocument = TranslateDocumentSync | TranslateDocumentAsync
3866
+
3867
+ /** @beta */
3868
+ declare type TranslateDocumentAsync = TranslateRequestBase & AgentActionAsync
3869
+
3870
+ /** @beta */
3871
+ declare type TranslateDocumentSync = TranslateRequestBase & AgentActionSync
3872
+
3873
+ /** @beta */
3874
+ declare interface TranslateLanguage {
3875
+ id: string
3876
+ title?: string
3877
+ }
3878
+
3879
+ /** @beta */
3880
+ declare interface TranslateRequestBase extends AgentActionRequestBase {
3881
+ /** schemaId as reported by sanity deploy / sanity schema store */
3882
+ schemaId: string
3883
+ documentId: string
3884
+ targetDocument?: TransformTargetDocument
3885
+ fromLanguage?: TranslateLanguage
3886
+ toLanguage: TranslateLanguage
3887
+ /** string template using $variable */
3888
+ styleGuide?: string
3889
+ /** param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable" */
3890
+ styleGuideParams?: AgentActionParams
3891
+ /**
3892
+ * Target defines which parts of the document will be affected by the instruction.
3893
+ * It can be an array, so multiple parts of the document can be separately configured in detail.
3894
+ *
3895
+ * Omitting target implies that the document itself is the root.
3896
+ *
3897
+ * Notes:
3898
+ * - instruction can only affect fields up to `maxPathDepth`
3899
+ * - when multiple targets are provided, they will be coalesced into a single target sharing a common target root.
3900
+ * It is therefor an error to provide conflicting include/exclude across targets (ie, include title in one, and exclude it in another)
3901
+ *
3902
+ * @see AgentActionRequestBase#conditionalPaths
3903
+ */
3904
+ target?: TranslateTarget | TranslateTarget[]
3905
+ languageFieldPath?: AgentActionPathSegment | AgentActionPath_2
3906
+ protectedPhrases?: string[]
3907
+ }
3908
+
3909
+ /** @beta */
3910
+ export declare interface TranslateTarget extends AgentActionTarget {
3911
+ /** string template using $variable from instructionParams */
3912
+ styleGuide?: string
3913
+ /**
3914
+ * By default, all children up to `target.maxPathDepth` are included.
3915
+ *
3916
+ * When `include` is specified, only segments explicitly listed will be included.
3917
+ *
3918
+ * Fields or array items not on the include list, are implicitly excluded.
3919
+ */
3920
+ include?: (AgentActionPathSegment | TranslateTargetInclude)[]
3921
+ }
3922
+
3923
+ /** @beta */
3924
+ export declare interface TranslateTargetInclude extends AgentActionTargetInclude {
3925
+ /** string template using $variable from instructionParams */
3926
+ styleGuide?: string
3927
+ /**
3928
+ * By default, all children up to `target.maxPathDepth` are included.
3929
+ *
3930
+ * When `include` is specified, only segments explicitly listed will be included.
3931
+ *
3932
+ * Fields or array items not on the include list, are implicitly excluded.
3933
+ */
3934
+ include?: (AgentActionPathSegment | TranslateTargetInclude)[]
3935
+ }
3936
+
3849
3937
  /** @public */
3850
3938
  export declare interface UnfilteredResponseQueryOptions extends ResponseQueryOptions {
3851
3939
  filterResponse: false