@sanity/client 6.28.3-instruct.4 → 6.28.3-instruct.6
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.browser.d.cts +163 -38
- package/dist/index.browser.d.ts +163 -38
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +163 -38
- package/dist/index.d.ts +163 -38
- package/dist/index.js +1 -1
- package/dist/stega.browser.d.cts +163 -38
- package/dist/stega.browser.d.ts +163 -38
- package/dist/stega.d.cts +163 -38
- package/dist/stega.d.ts +163 -38
- package/package.json +1 -1
- package/src/instruct/types.ts +161 -27
package/dist/index.browser.d.cts
CHANGED
|
@@ -602,6 +602,7 @@ declare interface CreateDocumentRequest<T extends Record<string, Any_2> = Record
|
|
|
602
602
|
_id?: string
|
|
603
603
|
_type: string
|
|
604
604
|
} & SanityDocumentStub_2<T>
|
|
605
|
+
documentId?: never
|
|
605
606
|
}
|
|
606
607
|
|
|
607
608
|
/** @public */
|
|
@@ -816,6 +817,7 @@ export declare type EventSourceInstance = InstanceType<typeof globalThis.EventSo
|
|
|
816
817
|
*/
|
|
817
818
|
declare interface ExistingDocumentRequest {
|
|
818
819
|
documentId: string
|
|
820
|
+
createDocument?: never
|
|
819
821
|
}
|
|
820
822
|
|
|
821
823
|
/** @public */
|
|
@@ -998,6 +1000,16 @@ export declare type InstructInstructionParam =
|
|
|
998
1000
|
/** @beta */
|
|
999
1001
|
export declare type InstructInstructionParams = Record<string, InstructInstructionParam>
|
|
1000
1002
|
|
|
1003
|
+
declare type InstructOperation = 'set' | 'append' | 'mixed'
|
|
1004
|
+
|
|
1005
|
+
declare type InstructPath = InstructPathSegment[]
|
|
1006
|
+
|
|
1007
|
+
declare type InstructPathSegment =
|
|
1008
|
+
| string
|
|
1009
|
+
| {
|
|
1010
|
+
_key: string
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1001
1013
|
declare interface InstructRequestBase {
|
|
1002
1014
|
/** schemaId as reported by sanity deploy / sanity schema store */
|
|
1003
1015
|
schemaId: string
|
|
@@ -1006,45 +1018,17 @@ declare interface InstructRequestBase {
|
|
|
1006
1018
|
/** param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable" */
|
|
1007
1019
|
instructionParams?: InstructInstructionParams
|
|
1008
1020
|
/**
|
|
1009
|
-
*
|
|
1010
|
-
*
|
|
1021
|
+
* Target defines which parts of the document will be affected by the instruction.
|
|
1022
|
+
* It can be an array, so multiple parts of the document can be separately configured in detail.
|
|
1011
1023
|
*
|
|
1012
|
-
*
|
|
1013
|
-
* - `path: 'title'` will output to the title field in the document
|
|
1014
|
-
* - `path: 'array[_key="xx"]'` will output to the item with `_key: 'xx'` in the array field
|
|
1015
|
-
*/
|
|
1016
|
-
path?: string
|
|
1017
|
-
/**
|
|
1018
|
-
* Controls sub-paths in the document that can be output to.
|
|
1019
|
-
*
|
|
1020
|
-
* The string-paths are relative to the `path` param
|
|
1024
|
+
* Omitting target implies that the document itself is the root.
|
|
1021
1025
|
*
|
|
1022
|
-
*
|
|
1023
|
-
*
|
|
1024
|
-
*
|
|
1025
|
-
*
|
|
1026
|
-
* @see InstructRequestBase#outputTypes
|
|
1026
|
+
* Notes:
|
|
1027
|
+
* - instruction can only affect fields up to `maxPathDepth`
|
|
1028
|
+
* - when multiple targets are provided, they will be coalesced into a single target sharing a common target root.
|
|
1029
|
+
* It is therefor an error to provide conflicting include/exclude across targets (ie, include title in one, and exclude it in another)
|
|
1027
1030
|
*/
|
|
1028
|
-
|
|
1029
|
-
| {
|
|
1030
|
-
include: string[]
|
|
1031
|
-
}
|
|
1032
|
-
| {
|
|
1033
|
-
exclude: string[]
|
|
1034
|
-
}
|
|
1035
|
-
/**
|
|
1036
|
-
* Controls which types the instruction is allowed to output to.
|
|
1037
|
-
*
|
|
1038
|
-
* @see InstructRequestBase#relativeOutputPaths
|
|
1039
|
-
* @see InstructRequestBase#conditionalPaths
|
|
1040
|
-
*/
|
|
1041
|
-
outputTypes?:
|
|
1042
|
-
| {
|
|
1043
|
-
include: string[]
|
|
1044
|
-
}
|
|
1045
|
-
| {
|
|
1046
|
-
exclude: string[]
|
|
1047
|
-
}
|
|
1031
|
+
target?: InstructTarget | InstructTarget[]
|
|
1048
1032
|
/**
|
|
1049
1033
|
* When a type or field in the schema has a function set for `hidden` or `readOnly`, it is conditional.
|
|
1050
1034
|
*
|
|
@@ -1068,8 +1052,8 @@ declare interface InstructRequestBase {
|
|
|
1068
1052
|
defaultReadOnly?: boolean
|
|
1069
1053
|
defaultHidden?: boolean
|
|
1070
1054
|
paths?: {
|
|
1071
|
-
/** path here is not a relative path: it must be the full document path, regardless of `path` param
|
|
1072
|
-
path:
|
|
1055
|
+
/** path here is not a relative path: it must be the full document path, regardless of `path` param used in targets */
|
|
1056
|
+
path: InstructPath
|
|
1073
1057
|
readOnly: boolean
|
|
1074
1058
|
hidden: boolean
|
|
1075
1059
|
}[]
|
|
@@ -1101,6 +1085,14 @@ declare interface InstructRequestBase {
|
|
|
1101
1085
|
*/
|
|
1102
1086
|
timeZone: string
|
|
1103
1087
|
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Controls how much variance the instructions will run with.
|
|
1090
|
+
*
|
|
1091
|
+
* Value must be in the range [0, 1] (inclusive).
|
|
1092
|
+
*
|
|
1093
|
+
* Default: 0.3
|
|
1094
|
+
*/
|
|
1095
|
+
temperature?: number
|
|
1104
1096
|
}
|
|
1105
1097
|
|
|
1106
1098
|
/** @beta */
|
|
@@ -1108,6 +1100,139 @@ export declare type InstructSyncInstruction<
|
|
|
1108
1100
|
T extends Record<string, Any_2> = Record<string, Any_2>,
|
|
1109
1101
|
> = (ExistingDocumentRequest | CreateDocumentRequest<T>) & InstructRequestBase & Sync
|
|
1110
1102
|
|
|
1103
|
+
/**
|
|
1104
|
+
* @beta
|
|
1105
|
+
*/
|
|
1106
|
+
declare interface InstructTarget {
|
|
1107
|
+
/**
|
|
1108
|
+
* Root target path.
|
|
1109
|
+
*
|
|
1110
|
+
* Use this to have the instruction only affect a part of the document.
|
|
1111
|
+
*
|
|
1112
|
+
* To further control the behavior of individual paths under the root, use `include`, `exclude`, `types.include`
|
|
1113
|
+
* and `types.exclude`.
|
|
1114
|
+
*
|
|
1115
|
+
* Example:
|
|
1116
|
+
*
|
|
1117
|
+
* `target: ['body', {_key: 'someKey'}, 'nestedObject']`
|
|
1118
|
+
*
|
|
1119
|
+
* Here, the instruction will only write to fields under the nestedObject.
|
|
1120
|
+
*
|
|
1121
|
+
* Default: [] = the document itself
|
|
1122
|
+
*
|
|
1123
|
+
* @see #InstructPathSegment
|
|
1124
|
+
* @see #InstructPath
|
|
1125
|
+
* */
|
|
1126
|
+
path?: InstructPathSegment | InstructPath
|
|
1127
|
+
/**
|
|
1128
|
+
* Sets the default operation for all paths in the target.
|
|
1129
|
+
* Instruct runs in `'mixed'` operation mode by default:
|
|
1130
|
+
* Changes are set in all non-array fields, and append to all array fields.
|
|
1131
|
+
*
|
|
1132
|
+
* ### Operation types
|
|
1133
|
+
* - `'set'` – an *overwriting* operation, and replaces the full field value.
|
|
1134
|
+
* - `'append'`:
|
|
1135
|
+
* – array fields: appends new items to the end of the array,
|
|
1136
|
+
* - string fields: '<existing content> <new content>'
|
|
1137
|
+
* - text fields: '<existing content>\n<new content>'
|
|
1138
|
+
* - number fields: existing + new
|
|
1139
|
+
* - other field types not mentioned will set instead (dates, url)
|
|
1140
|
+
* - `'mixed'` – (default) sets non-array fields, and appends to array fields
|
|
1141
|
+
*
|
|
1142
|
+
* The default operation can be overridden on a per-path basis using `include`.
|
|
1143
|
+
*
|
|
1144
|
+
* Nested fields inherit the operation specified by their parent and falls back to the
|
|
1145
|
+
* top level target operation if not otherwise specified.
|
|
1146
|
+
*
|
|
1147
|
+
* Use `include` to change the `operation` of individual fields or items.
|
|
1148
|
+
*
|
|
1149
|
+
* #### Appending in the middle of arrays
|
|
1150
|
+
* `target: {path: ['array'], operation: 'append'}` will append the output of the instruction to the end of the array.
|
|
1151
|
+
*
|
|
1152
|
+
* To insert in the middle of the array, use `target: {path: ['array', {_key: 'appendAfterKey'}], operation: 'append'}`.
|
|
1153
|
+
* Here, the output of the instruction will be appended after the array item with key `'appendAfterKey'`.
|
|
1154
|
+
*
|
|
1155
|
+
* @see #InstructTargetInclude.operation
|
|
1156
|
+
* @see #include
|
|
1157
|
+
* @see #InstructTargetInclude.include
|
|
1158
|
+
*/
|
|
1159
|
+
operation?: InstructOperation
|
|
1160
|
+
/**
|
|
1161
|
+
* maxPathDepth controls how deep into the schema from the target root the instruction will affect.
|
|
1162
|
+
*
|
|
1163
|
+
* Depth is based on path segments:
|
|
1164
|
+
* - `title` has depth 1
|
|
1165
|
+
* - `array[_key="no"].title` has depth 3
|
|
1166
|
+
*
|
|
1167
|
+
* Be careful not to set this too high in studios with recursive document schemas, as it could have
|
|
1168
|
+
* negative impact on performance; both for runtime and quality of responses.
|
|
1169
|
+
*
|
|
1170
|
+
* Default: 4
|
|
1171
|
+
*/
|
|
1172
|
+
maxPathDepth?: number
|
|
1173
|
+
/**
|
|
1174
|
+
* By default, all children up to `target.maxPathDepth` are included.
|
|
1175
|
+
*
|
|
1176
|
+
* When `include` is specified, only segments explicitly listed will be included.
|
|
1177
|
+
*
|
|
1178
|
+
* Fields or array items not on the include list, are implicitly excluded.
|
|
1179
|
+
*/
|
|
1180
|
+
include?: (InstructPathSegment | InstructTargetInclude)[]
|
|
1181
|
+
/**
|
|
1182
|
+
* By default, all children up to `target.maxPathDepth` are included.
|
|
1183
|
+
* Fields or array items not on the exclude list, are implicitly included.
|
|
1184
|
+
*/
|
|
1185
|
+
exclude?: InstructPathSegment[]
|
|
1186
|
+
/**
|
|
1187
|
+
* Types can be used to exclude array item types or all fields directly under the target path of a certain type.
|
|
1188
|
+
* If you do exclude: ['string'] all string fields under the target will be excluded, for instance.
|
|
1189
|
+
*
|
|
1190
|
+
* `types.include` and `types.exclude` are mutually exclusive.
|
|
1191
|
+
*/
|
|
1192
|
+
types?: InstructTypeConfig
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
declare interface InstructTargetInclude {
|
|
1196
|
+
path: InstructPathSegment | InstructPath
|
|
1197
|
+
/**
|
|
1198
|
+
* Sets the operation for this path, and all its children.
|
|
1199
|
+
* This overrides any operation set parents or the root target.
|
|
1200
|
+
* @see #InstructTarget.operation
|
|
1201
|
+
* @see #include
|
|
1202
|
+
*/
|
|
1203
|
+
operation?: InstructOperation
|
|
1204
|
+
/**
|
|
1205
|
+
* By default, all children up to `target.maxPathDepth` are included.
|
|
1206
|
+
*
|
|
1207
|
+
* When `include` is specified, only segments explicitly listed will be included.
|
|
1208
|
+
*
|
|
1209
|
+
* Fields or array items not on the include list, are implicitly excluded.
|
|
1210
|
+
*/
|
|
1211
|
+
include?: (InstructPathSegment | InstructTargetInclude)[]
|
|
1212
|
+
/**
|
|
1213
|
+
* By default, all children up to `target.maxPathDepth` are included.
|
|
1214
|
+
* Fields or array items not on the exclude list, are implicitly included.
|
|
1215
|
+
*/
|
|
1216
|
+
exclude?: InstructPathSegment[]
|
|
1217
|
+
/**
|
|
1218
|
+
* Types can be used to exclude array item types or all fields directly under the target path of a certain type.
|
|
1219
|
+
* If you do exclude: ['string'] all string fields under the target will be excluded, for instance.
|
|
1220
|
+
*
|
|
1221
|
+
* `types.include` and `types.exclude` are mutually exclusive.
|
|
1222
|
+
*/
|
|
1223
|
+
types?: InstructTypeConfig
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
declare type InstructTypeConfig =
|
|
1227
|
+
| {
|
|
1228
|
+
include: string[]
|
|
1229
|
+
exclude?: never
|
|
1230
|
+
}
|
|
1231
|
+
| {
|
|
1232
|
+
exclude: string[]
|
|
1233
|
+
include?: never
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1111
1236
|
/**
|
|
1112
1237
|
* Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
|
|
1113
1238
|
*
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -602,6 +602,7 @@ declare interface CreateDocumentRequest<T extends Record<string, Any_2> = Record
|
|
|
602
602
|
_id?: string
|
|
603
603
|
_type: string
|
|
604
604
|
} & SanityDocumentStub_2<T>
|
|
605
|
+
documentId?: never
|
|
605
606
|
}
|
|
606
607
|
|
|
607
608
|
/** @public */
|
|
@@ -816,6 +817,7 @@ export declare type EventSourceInstance = InstanceType<typeof globalThis.EventSo
|
|
|
816
817
|
*/
|
|
817
818
|
declare interface ExistingDocumentRequest {
|
|
818
819
|
documentId: string
|
|
820
|
+
createDocument?: never
|
|
819
821
|
}
|
|
820
822
|
|
|
821
823
|
/** @public */
|
|
@@ -998,6 +1000,16 @@ export declare type InstructInstructionParam =
|
|
|
998
1000
|
/** @beta */
|
|
999
1001
|
export declare type InstructInstructionParams = Record<string, InstructInstructionParam>
|
|
1000
1002
|
|
|
1003
|
+
declare type InstructOperation = 'set' | 'append' | 'mixed'
|
|
1004
|
+
|
|
1005
|
+
declare type InstructPath = InstructPathSegment[]
|
|
1006
|
+
|
|
1007
|
+
declare type InstructPathSegment =
|
|
1008
|
+
| string
|
|
1009
|
+
| {
|
|
1010
|
+
_key: string
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1001
1013
|
declare interface InstructRequestBase {
|
|
1002
1014
|
/** schemaId as reported by sanity deploy / sanity schema store */
|
|
1003
1015
|
schemaId: string
|
|
@@ -1006,45 +1018,17 @@ declare interface InstructRequestBase {
|
|
|
1006
1018
|
/** param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable" */
|
|
1007
1019
|
instructionParams?: InstructInstructionParams
|
|
1008
1020
|
/**
|
|
1009
|
-
*
|
|
1010
|
-
*
|
|
1021
|
+
* Target defines which parts of the document will be affected by the instruction.
|
|
1022
|
+
* It can be an array, so multiple parts of the document can be separately configured in detail.
|
|
1011
1023
|
*
|
|
1012
|
-
*
|
|
1013
|
-
* - `path: 'title'` will output to the title field in the document
|
|
1014
|
-
* - `path: 'array[_key="xx"]'` will output to the item with `_key: 'xx'` in the array field
|
|
1015
|
-
*/
|
|
1016
|
-
path?: string
|
|
1017
|
-
/**
|
|
1018
|
-
* Controls sub-paths in the document that can be output to.
|
|
1019
|
-
*
|
|
1020
|
-
* The string-paths are relative to the `path` param
|
|
1024
|
+
* Omitting target implies that the document itself is the root.
|
|
1021
1025
|
*
|
|
1022
|
-
*
|
|
1023
|
-
*
|
|
1024
|
-
*
|
|
1025
|
-
*
|
|
1026
|
-
* @see InstructRequestBase#outputTypes
|
|
1026
|
+
* Notes:
|
|
1027
|
+
* - instruction can only affect fields up to `maxPathDepth`
|
|
1028
|
+
* - when multiple targets are provided, they will be coalesced into a single target sharing a common target root.
|
|
1029
|
+
* It is therefor an error to provide conflicting include/exclude across targets (ie, include title in one, and exclude it in another)
|
|
1027
1030
|
*/
|
|
1028
|
-
|
|
1029
|
-
| {
|
|
1030
|
-
include: string[]
|
|
1031
|
-
}
|
|
1032
|
-
| {
|
|
1033
|
-
exclude: string[]
|
|
1034
|
-
}
|
|
1035
|
-
/**
|
|
1036
|
-
* Controls which types the instruction is allowed to output to.
|
|
1037
|
-
*
|
|
1038
|
-
* @see InstructRequestBase#relativeOutputPaths
|
|
1039
|
-
* @see InstructRequestBase#conditionalPaths
|
|
1040
|
-
*/
|
|
1041
|
-
outputTypes?:
|
|
1042
|
-
| {
|
|
1043
|
-
include: string[]
|
|
1044
|
-
}
|
|
1045
|
-
| {
|
|
1046
|
-
exclude: string[]
|
|
1047
|
-
}
|
|
1031
|
+
target?: InstructTarget | InstructTarget[]
|
|
1048
1032
|
/**
|
|
1049
1033
|
* When a type or field in the schema has a function set for `hidden` or `readOnly`, it is conditional.
|
|
1050
1034
|
*
|
|
@@ -1068,8 +1052,8 @@ declare interface InstructRequestBase {
|
|
|
1068
1052
|
defaultReadOnly?: boolean
|
|
1069
1053
|
defaultHidden?: boolean
|
|
1070
1054
|
paths?: {
|
|
1071
|
-
/** path here is not a relative path: it must be the full document path, regardless of `path` param
|
|
1072
|
-
path:
|
|
1055
|
+
/** path here is not a relative path: it must be the full document path, regardless of `path` param used in targets */
|
|
1056
|
+
path: InstructPath
|
|
1073
1057
|
readOnly: boolean
|
|
1074
1058
|
hidden: boolean
|
|
1075
1059
|
}[]
|
|
@@ -1101,6 +1085,14 @@ declare interface InstructRequestBase {
|
|
|
1101
1085
|
*/
|
|
1102
1086
|
timeZone: string
|
|
1103
1087
|
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Controls how much variance the instructions will run with.
|
|
1090
|
+
*
|
|
1091
|
+
* Value must be in the range [0, 1] (inclusive).
|
|
1092
|
+
*
|
|
1093
|
+
* Default: 0.3
|
|
1094
|
+
*/
|
|
1095
|
+
temperature?: number
|
|
1104
1096
|
}
|
|
1105
1097
|
|
|
1106
1098
|
/** @beta */
|
|
@@ -1108,6 +1100,139 @@ export declare type InstructSyncInstruction<
|
|
|
1108
1100
|
T extends Record<string, Any_2> = Record<string, Any_2>,
|
|
1109
1101
|
> = (ExistingDocumentRequest | CreateDocumentRequest<T>) & InstructRequestBase & Sync
|
|
1110
1102
|
|
|
1103
|
+
/**
|
|
1104
|
+
* @beta
|
|
1105
|
+
*/
|
|
1106
|
+
declare interface InstructTarget {
|
|
1107
|
+
/**
|
|
1108
|
+
* Root target path.
|
|
1109
|
+
*
|
|
1110
|
+
* Use this to have the instruction only affect a part of the document.
|
|
1111
|
+
*
|
|
1112
|
+
* To further control the behavior of individual paths under the root, use `include`, `exclude`, `types.include`
|
|
1113
|
+
* and `types.exclude`.
|
|
1114
|
+
*
|
|
1115
|
+
* Example:
|
|
1116
|
+
*
|
|
1117
|
+
* `target: ['body', {_key: 'someKey'}, 'nestedObject']`
|
|
1118
|
+
*
|
|
1119
|
+
* Here, the instruction will only write to fields under the nestedObject.
|
|
1120
|
+
*
|
|
1121
|
+
* Default: [] = the document itself
|
|
1122
|
+
*
|
|
1123
|
+
* @see #InstructPathSegment
|
|
1124
|
+
* @see #InstructPath
|
|
1125
|
+
* */
|
|
1126
|
+
path?: InstructPathSegment | InstructPath
|
|
1127
|
+
/**
|
|
1128
|
+
* Sets the default operation for all paths in the target.
|
|
1129
|
+
* Instruct runs in `'mixed'` operation mode by default:
|
|
1130
|
+
* Changes are set in all non-array fields, and append to all array fields.
|
|
1131
|
+
*
|
|
1132
|
+
* ### Operation types
|
|
1133
|
+
* - `'set'` – an *overwriting* operation, and replaces the full field value.
|
|
1134
|
+
* - `'append'`:
|
|
1135
|
+
* – array fields: appends new items to the end of the array,
|
|
1136
|
+
* - string fields: '<existing content> <new content>'
|
|
1137
|
+
* - text fields: '<existing content>\n<new content>'
|
|
1138
|
+
* - number fields: existing + new
|
|
1139
|
+
* - other field types not mentioned will set instead (dates, url)
|
|
1140
|
+
* - `'mixed'` – (default) sets non-array fields, and appends to array fields
|
|
1141
|
+
*
|
|
1142
|
+
* The default operation can be overridden on a per-path basis using `include`.
|
|
1143
|
+
*
|
|
1144
|
+
* Nested fields inherit the operation specified by their parent and falls back to the
|
|
1145
|
+
* top level target operation if not otherwise specified.
|
|
1146
|
+
*
|
|
1147
|
+
* Use `include` to change the `operation` of individual fields or items.
|
|
1148
|
+
*
|
|
1149
|
+
* #### Appending in the middle of arrays
|
|
1150
|
+
* `target: {path: ['array'], operation: 'append'}` will append the output of the instruction to the end of the array.
|
|
1151
|
+
*
|
|
1152
|
+
* To insert in the middle of the array, use `target: {path: ['array', {_key: 'appendAfterKey'}], operation: 'append'}`.
|
|
1153
|
+
* Here, the output of the instruction will be appended after the array item with key `'appendAfterKey'`.
|
|
1154
|
+
*
|
|
1155
|
+
* @see #InstructTargetInclude.operation
|
|
1156
|
+
* @see #include
|
|
1157
|
+
* @see #InstructTargetInclude.include
|
|
1158
|
+
*/
|
|
1159
|
+
operation?: InstructOperation
|
|
1160
|
+
/**
|
|
1161
|
+
* maxPathDepth controls how deep into the schema from the target root the instruction will affect.
|
|
1162
|
+
*
|
|
1163
|
+
* Depth is based on path segments:
|
|
1164
|
+
* - `title` has depth 1
|
|
1165
|
+
* - `array[_key="no"].title` has depth 3
|
|
1166
|
+
*
|
|
1167
|
+
* Be careful not to set this too high in studios with recursive document schemas, as it could have
|
|
1168
|
+
* negative impact on performance; both for runtime and quality of responses.
|
|
1169
|
+
*
|
|
1170
|
+
* Default: 4
|
|
1171
|
+
*/
|
|
1172
|
+
maxPathDepth?: number
|
|
1173
|
+
/**
|
|
1174
|
+
* By default, all children up to `target.maxPathDepth` are included.
|
|
1175
|
+
*
|
|
1176
|
+
* When `include` is specified, only segments explicitly listed will be included.
|
|
1177
|
+
*
|
|
1178
|
+
* Fields or array items not on the include list, are implicitly excluded.
|
|
1179
|
+
*/
|
|
1180
|
+
include?: (InstructPathSegment | InstructTargetInclude)[]
|
|
1181
|
+
/**
|
|
1182
|
+
* By default, all children up to `target.maxPathDepth` are included.
|
|
1183
|
+
* Fields or array items not on the exclude list, are implicitly included.
|
|
1184
|
+
*/
|
|
1185
|
+
exclude?: InstructPathSegment[]
|
|
1186
|
+
/**
|
|
1187
|
+
* Types can be used to exclude array item types or all fields directly under the target path of a certain type.
|
|
1188
|
+
* If you do exclude: ['string'] all string fields under the target will be excluded, for instance.
|
|
1189
|
+
*
|
|
1190
|
+
* `types.include` and `types.exclude` are mutually exclusive.
|
|
1191
|
+
*/
|
|
1192
|
+
types?: InstructTypeConfig
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
declare interface InstructTargetInclude {
|
|
1196
|
+
path: InstructPathSegment | InstructPath
|
|
1197
|
+
/**
|
|
1198
|
+
* Sets the operation for this path, and all its children.
|
|
1199
|
+
* This overrides any operation set parents or the root target.
|
|
1200
|
+
* @see #InstructTarget.operation
|
|
1201
|
+
* @see #include
|
|
1202
|
+
*/
|
|
1203
|
+
operation?: InstructOperation
|
|
1204
|
+
/**
|
|
1205
|
+
* By default, all children up to `target.maxPathDepth` are included.
|
|
1206
|
+
*
|
|
1207
|
+
* When `include` is specified, only segments explicitly listed will be included.
|
|
1208
|
+
*
|
|
1209
|
+
* Fields or array items not on the include list, are implicitly excluded.
|
|
1210
|
+
*/
|
|
1211
|
+
include?: (InstructPathSegment | InstructTargetInclude)[]
|
|
1212
|
+
/**
|
|
1213
|
+
* By default, all children up to `target.maxPathDepth` are included.
|
|
1214
|
+
* Fields or array items not on the exclude list, are implicitly included.
|
|
1215
|
+
*/
|
|
1216
|
+
exclude?: InstructPathSegment[]
|
|
1217
|
+
/**
|
|
1218
|
+
* Types can be used to exclude array item types or all fields directly under the target path of a certain type.
|
|
1219
|
+
* If you do exclude: ['string'] all string fields under the target will be excluded, for instance.
|
|
1220
|
+
*
|
|
1221
|
+
* `types.include` and `types.exclude` are mutually exclusive.
|
|
1222
|
+
*/
|
|
1223
|
+
types?: InstructTypeConfig
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
declare type InstructTypeConfig =
|
|
1227
|
+
| {
|
|
1228
|
+
include: string[]
|
|
1229
|
+
exclude?: never
|
|
1230
|
+
}
|
|
1231
|
+
| {
|
|
1232
|
+
exclude: string[]
|
|
1233
|
+
include?: never
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1111
1236
|
/**
|
|
1112
1237
|
* Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
|
|
1113
1238
|
*
|
package/dist/index.cjs
CHANGED
|
@@ -1550,7 +1550,7 @@ function defineDeprecatedCreateClient(createClient2) {
|
|
|
1550
1550
|
return config.printNoDefaultExport(), createClient2(config$1);
|
|
1551
1551
|
};
|
|
1552
1552
|
}
|
|
1553
|
-
var name = "@sanity/client", version = "6.28.3-instruct.
|
|
1553
|
+
var name = "@sanity/client", version = "6.28.3-instruct.6";
|
|
1554
1554
|
const middleware = [
|
|
1555
1555
|
middleware$1.debug({ verbose: !0, namespace: "sanity:client" }),
|
|
1556
1556
|
middleware$1.headers({ "User-Agent": `${name} ${version}` }),
|