@sanity/client 6.29.0-generate.0 → 6.29.1
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.cjs +2 -44
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +0 -404
- package/dist/index.browser.d.ts +0 -404
- package/dist/index.browser.js +2 -44
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +3 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -393
- package/dist/index.d.ts +0 -393
- package/dist/index.js +3 -45
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +0 -393
- package/dist/stega.browser.d.ts +0 -393
- package/dist/stega.d.cts +0 -393
- package/dist/stega.d.ts +0 -393
- package/package.json +2 -1
- package/src/SanityClient.ts +0 -13
- package/src/types.ts +0 -10
- package/umd/sanityClient.js +2 -44
- package/umd/sanityClient.min.js +2 -2
- package/src/agent/actions/AgentActionsClient.ts +0 -74
- package/src/agent/actions/generate.ts +0 -24
- package/src/agent/actions/types.ts +0 -373
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import type {Any as Any_2} from '@sanity/client'
|
|
2
1
|
import type {ContentSourceMapDocuments as ContentSourceMapDocuments_2} from '@sanity/client/csm'
|
|
3
2
|
import {ContentSourceMapParsedPath} from '@sanity/client/csm'
|
|
4
3
|
import {ContentSourceMapParsedPathKeyedSegment} from '@sanity/client/csm'
|
|
5
4
|
import {Observable} from 'rxjs'
|
|
6
5
|
import {Requester} from 'get-it'
|
|
7
6
|
import type {ResolveStudioUrl} from '@sanity/client/csm'
|
|
8
|
-
import type {SanityDocumentStub as SanityDocumentStub_2} from '@sanity/client'
|
|
9
7
|
import {StudioBaseRoute} from '@sanity/client/csm'
|
|
10
8
|
import {StudioBaseUrl} from '@sanity/client/csm'
|
|
11
9
|
import {StudioUrl} from '@sanity/client/csm'
|
|
@@ -41,18 +39,6 @@ export declare interface ActionErrorItem {
|
|
|
41
39
|
index: number
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
/** @public */
|
|
45
|
-
declare class AgentActionsClient {
|
|
46
|
-
#private
|
|
47
|
-
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
48
|
-
generate(request: GenerateAsyncInstruction): Promise<{
|
|
49
|
-
_id: string
|
|
50
|
-
}>
|
|
51
|
-
generate<DocumentShape extends Record<string, Any>>(
|
|
52
|
-
request: GenerateSyncInstruction<DocumentShape>,
|
|
53
|
-
): Promise<IdentifiedSanityDocumentStub & DocumentShape>
|
|
54
|
-
}
|
|
55
|
-
|
|
56
42
|
/** @internal */
|
|
57
43
|
export declare type AllDocumentIdsMutationOptions = BaseMutationOptions & {
|
|
58
44
|
returnFirst: false
|
|
@@ -130,18 +116,6 @@ export declare class AssetsClient {
|
|
|
130
116
|
): Promise<SanityAssetDocument | SanityImageAssetDocument>
|
|
131
117
|
}
|
|
132
118
|
|
|
133
|
-
declare interface Async {
|
|
134
|
-
/**
|
|
135
|
-
* When async: true, requests responds with status 201 and {_id} as response body as soon as the request is validated.
|
|
136
|
-
* The instruction operation will carry on in the background.
|
|
137
|
-
*
|
|
138
|
-
* When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
|
|
139
|
-
*
|
|
140
|
-
* async: true is incompatible with noWrite, as async: true does not return the resulting document
|
|
141
|
-
*/
|
|
142
|
-
async: true
|
|
143
|
-
}
|
|
144
|
-
|
|
145
119
|
/** @internal */
|
|
146
120
|
export declare type AttributeSet = {
|
|
147
121
|
[key: string]: Any
|
|
@@ -624,19 +598,6 @@ export declare type CreateAction = {
|
|
|
624
598
|
*/
|
|
625
599
|
export declare const createClient: (config: ClientConfig) => SanityClient
|
|
626
600
|
|
|
627
|
-
/**
|
|
628
|
-
* Instruction to create a new document
|
|
629
|
-
* @beta
|
|
630
|
-
*/
|
|
631
|
-
declare interface CreateDocumentRequest<T extends Record<string, Any_2> = Record<string, Any_2>> {
|
|
632
|
-
createDocument: {
|
|
633
|
-
/** if no _id is provided, one will be generated. _id is always returned when the requests succeed */
|
|
634
|
-
_id?: string
|
|
635
|
-
_type: string
|
|
636
|
-
} & SanityDocumentStub_2<T>
|
|
637
|
-
documentId?: never
|
|
638
|
-
}
|
|
639
|
-
|
|
640
601
|
/** @public */
|
|
641
602
|
export declare interface CurrentSanityUser {
|
|
642
603
|
id: string
|
|
@@ -830,15 +791,6 @@ export declare type EventSourceEvent<Name extends string> = ServerSentEvent<Name
|
|
|
830
791
|
*/
|
|
831
792
|
export declare type EventSourceInstance = InstanceType<typeof globalThis.EventSource>
|
|
832
793
|
|
|
833
|
-
/**
|
|
834
|
-
* Instruction for an existing document.
|
|
835
|
-
* @beta
|
|
836
|
-
*/
|
|
837
|
-
declare interface ExistingDocumentRequest {
|
|
838
|
-
documentId: string
|
|
839
|
-
createDocument?: never
|
|
840
|
-
}
|
|
841
|
-
|
|
842
794
|
/** @public */
|
|
843
795
|
export declare type FilterDefault = (props: {
|
|
844
796
|
/**
|
|
@@ -905,310 +857,6 @@ export declare type FirstDocumentMutationOptions = BaseMutationOptions & {
|
|
|
905
857
|
returnDocuments?: true
|
|
906
858
|
}
|
|
907
859
|
|
|
908
|
-
/** @beta */
|
|
909
|
-
export declare type GenerateAsyncInstruction<
|
|
910
|
-
T extends Record<string, Any_2> = Record<string, Any_2>,
|
|
911
|
-
> = (ExistingDocumentRequest | CreateDocumentRequest<T>) & GenerateRequestBase & Async
|
|
912
|
-
|
|
913
|
-
/** @beta */
|
|
914
|
-
export declare interface GenerateConstantInstructionParam {
|
|
915
|
-
type: 'constant'
|
|
916
|
-
value: string
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
/**
|
|
920
|
-
*
|
|
921
|
-
* Includes a LLM-friendly version of the document in the instruction
|
|
922
|
-
* @beta
|
|
923
|
-
* */
|
|
924
|
-
declare interface GenerateDocumentInstructionParam {
|
|
925
|
-
type: 'document'
|
|
926
|
-
/**
|
|
927
|
-
* If omitted, implicitly uses the documentId of the instruction target
|
|
928
|
-
*/
|
|
929
|
-
documentId?: string
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
/**
|
|
933
|
-
*
|
|
934
|
-
* Includes a LLM-friendly version of the field value in the instruction
|
|
935
|
-
* @beta
|
|
936
|
-
* */
|
|
937
|
-
export declare interface GenerateFieldInstructionParam {
|
|
938
|
-
type: 'field'
|
|
939
|
-
/**
|
|
940
|
-
* Examples: ['title'], ['array', {_key: 'arrayItemKey'}, 'field']
|
|
941
|
-
*/
|
|
942
|
-
path: GeneratePath
|
|
943
|
-
/**
|
|
944
|
-
* If omitted, implicitly uses the documentId of the instruction target
|
|
945
|
-
*/
|
|
946
|
-
documentId?: string
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
/**
|
|
950
|
-
* Includes a LLM-friendly version of GROQ query result in the instruction
|
|
951
|
-
* @beta
|
|
952
|
-
* */
|
|
953
|
-
export declare interface GenerateGroqInstructionParam {
|
|
954
|
-
type: 'groq'
|
|
955
|
-
query: string
|
|
956
|
-
params?: Record<string, string>
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
/** @beta */
|
|
960
|
-
export declare type GenerateInstruction<T extends Record<string, Any_2> = Record<string, Any_2>> =
|
|
961
|
-
| GenerateSyncInstruction<T>
|
|
962
|
-
| GenerateAsyncInstruction<T>
|
|
963
|
-
|
|
964
|
-
/** @beta */
|
|
965
|
-
export declare type GenerateInstructionParam =
|
|
966
|
-
| string
|
|
967
|
-
| GenerateConstantInstructionParam
|
|
968
|
-
| GenerateFieldInstructionParam
|
|
969
|
-
| GenerateDocumentInstructionParam
|
|
970
|
-
| GenerateGroqInstructionParam
|
|
971
|
-
|
|
972
|
-
/** @beta */
|
|
973
|
-
export declare type GenerateInstructionParams = Record<string, GenerateInstructionParam>
|
|
974
|
-
|
|
975
|
-
declare type GenerateOperation = 'set' | 'append' | 'mixed'
|
|
976
|
-
|
|
977
|
-
declare type GeneratePath = GeneratePathSegment[]
|
|
978
|
-
|
|
979
|
-
declare type GeneratePathSegment =
|
|
980
|
-
| string
|
|
981
|
-
| {
|
|
982
|
-
_key: string
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
declare interface GenerateRequestBase {
|
|
986
|
-
/** schemaId as reported by sanity deploy / sanity schema store */
|
|
987
|
-
schemaId: string
|
|
988
|
-
/** string template using $variable – more on this below under "Dynamic instruction" */
|
|
989
|
-
instruction: string
|
|
990
|
-
/** param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable" */
|
|
991
|
-
instructionParams?: GenerateInstructionParams
|
|
992
|
-
/**
|
|
993
|
-
* Target defines which parts of the document will be affected by the instruction.
|
|
994
|
-
* It can be an array, so multiple parts of the document can be separately configured in detail.
|
|
995
|
-
*
|
|
996
|
-
* Omitting target implies that the document itself is the root.
|
|
997
|
-
*
|
|
998
|
-
* Notes:
|
|
999
|
-
* - instruction can only affect fields up to `maxPathDepth`
|
|
1000
|
-
* - when multiple targets are provided, they will be coalesced into a single target sharing a common target root.
|
|
1001
|
-
* It is therefor an error to provide conflicting include/exclude across targets (ie, include title in one, and exclude it in another)
|
|
1002
|
-
*
|
|
1003
|
-
* @see GenerateRequestBase#conditionalPaths
|
|
1004
|
-
*/
|
|
1005
|
-
target?: GenerateTarget | GenerateTarget[]
|
|
1006
|
-
/**
|
|
1007
|
-
* When a type or field in the schema has a function set for `hidden` or `readOnly`, it is conditional.
|
|
1008
|
-
*
|
|
1009
|
-
* By default, Generate will not output to conditional `readOnly` and `hidden` fields,
|
|
1010
|
-
* ie, they are considered to resolve to `readOnly: true` / `hidden: true`.
|
|
1011
|
-
*
|
|
1012
|
-
* `conditionalPaths` param allows setting the default conditional value for
|
|
1013
|
-
* `hidden` and `readOnly` to false,
|
|
1014
|
-
* or individually set `hidden` and `readOnly` state for individual document paths.
|
|
1015
|
-
*
|
|
1016
|
-
*
|
|
1017
|
-
* Note: fields and types with explicit readOnly: true or hidden: true in the schema, are not available to Generate,
|
|
1018
|
-
* and cannot be changed via conditionalPaths
|
|
1019
|
-
*
|
|
1020
|
-
* conditionalPaths state only apply to fields and types that have conditional `hidden` or `readOnly` in their schema definition.
|
|
1021
|
-
*
|
|
1022
|
-
* Consider using `hidden: () => true` in schema config, if a field should be writeable only by Generate and never
|
|
1023
|
-
* visible in the studio – then make the field visible to the Generate using `conditionalPaths`.
|
|
1024
|
-
*
|
|
1025
|
-
* @see GenerateRequestBase#target
|
|
1026
|
-
*/
|
|
1027
|
-
conditionalPaths?: {
|
|
1028
|
-
defaultReadOnly?: boolean
|
|
1029
|
-
defaultHidden?: boolean
|
|
1030
|
-
paths?: {
|
|
1031
|
-
/** path here is not a relative path: it must be the full document path, regardless of `path` param used in targets */
|
|
1032
|
-
path: GeneratePath
|
|
1033
|
-
readOnly: boolean
|
|
1034
|
-
hidden: boolean
|
|
1035
|
-
}[]
|
|
1036
|
-
}
|
|
1037
|
-
/**
|
|
1038
|
-
* When localeSettings is provided on the request, instruct can write to date and datetime fields.
|
|
1039
|
-
* Otherwise, such fields will be ignored.
|
|
1040
|
-
*/
|
|
1041
|
-
localeSettings?: {
|
|
1042
|
-
/**
|
|
1043
|
-
* A valid Unicode BCP 47 locale identifier used to interpret and format
|
|
1044
|
-
* natural language inputs and date output. Examples include "en-US", "fr-FR", or "ja-JP".
|
|
1045
|
-
*
|
|
1046
|
-
* This affects how phrases like "next Friday" or "in two weeks" are parsed,
|
|
1047
|
-
* and how resulting dates are presented (e.g., 12-hour vs 24-hour format).
|
|
1048
|
-
*
|
|
1049
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#getcanonicalocales
|
|
1050
|
-
*/
|
|
1051
|
-
locale: string
|
|
1052
|
-
/**
|
|
1053
|
-
* A valid IANA time zone identifier used to resolve relative and absolute
|
|
1054
|
-
* date expressions to a specific point in time. Examples include
|
|
1055
|
-
* "America/New_York", "Europe/Paris", or "Asia/Tokyo".
|
|
1056
|
-
*
|
|
1057
|
-
* This ensures phrases like "tomorrow at 9am" are interpreted correctly
|
|
1058
|
-
* based on the user's local time.
|
|
1059
|
-
*
|
|
1060
|
-
* @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
|
1061
|
-
*/
|
|
1062
|
-
timeZone: string
|
|
1063
|
-
}
|
|
1064
|
-
/**
|
|
1065
|
-
* Controls how much variance the instructions will run with.
|
|
1066
|
-
*
|
|
1067
|
-
* Value must be in the range [0, 1] (inclusive).
|
|
1068
|
-
*
|
|
1069
|
-
* Default: 0.3
|
|
1070
|
-
*/
|
|
1071
|
-
temperature?: number
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
/** @beta */
|
|
1075
|
-
export declare type GenerateSyncInstruction<
|
|
1076
|
-
T extends Record<string, Any_2> = Record<string, Any_2>,
|
|
1077
|
-
> = (ExistingDocumentRequest | CreateDocumentRequest<T>) & GenerateRequestBase & Sync
|
|
1078
|
-
|
|
1079
|
-
/**
|
|
1080
|
-
* @beta
|
|
1081
|
-
*/
|
|
1082
|
-
declare interface GenerateTarget {
|
|
1083
|
-
/**
|
|
1084
|
-
* Root target path.
|
|
1085
|
-
*
|
|
1086
|
-
* Use this to have the instruction only affect a part of the document.
|
|
1087
|
-
*
|
|
1088
|
-
* To further control the behavior of individual paths under the root, use `include`, `exclude`, `types.include`
|
|
1089
|
-
* and `types.exclude`.
|
|
1090
|
-
*
|
|
1091
|
-
* Example:
|
|
1092
|
-
*
|
|
1093
|
-
* `path: ['body', {_key: 'someKey'}, 'nestedObject']`
|
|
1094
|
-
*
|
|
1095
|
-
* Here, the instruction will only write to fields under the nestedObject.
|
|
1096
|
-
*
|
|
1097
|
-
* Default: [] = the document itself
|
|
1098
|
-
*
|
|
1099
|
-
* @see #GeneratePathSegment
|
|
1100
|
-
* @see #GeneratePath
|
|
1101
|
-
* */
|
|
1102
|
-
path?: GeneratePathSegment | GeneratePath
|
|
1103
|
-
/**
|
|
1104
|
-
* Sets the default operation for all paths in the target.
|
|
1105
|
-
* Generate runs in `'mixed'` operation mode by default:
|
|
1106
|
-
* Changes are set in all non-array fields, and append to all array fields.
|
|
1107
|
-
*
|
|
1108
|
-
* ### Operation types
|
|
1109
|
-
* - `'set'` – an *overwriting* operation, and replaces the full field value.
|
|
1110
|
-
* - `'append'`:
|
|
1111
|
-
* – array fields: appends new items to the end of the array,
|
|
1112
|
-
* - string fields: '<existing content> <new content>'
|
|
1113
|
-
* - text fields: '<existing content>\n<new content>'
|
|
1114
|
-
* - number fields: existing + new
|
|
1115
|
-
* - other field types not mentioned will set instead (dates, url)
|
|
1116
|
-
* - `'mixed'` – (default) sets non-array fields, and appends to array fields
|
|
1117
|
-
*
|
|
1118
|
-
* The default operation can be overridden on a per-path basis using `include`.
|
|
1119
|
-
*
|
|
1120
|
-
* Nested fields inherit the operation specified by their parent and falls back to the
|
|
1121
|
-
* top level target operation if not otherwise specified.
|
|
1122
|
-
*
|
|
1123
|
-
* Use `include` to change the `operation` of individual fields or items.
|
|
1124
|
-
*
|
|
1125
|
-
* #### Appending in the middle of arrays
|
|
1126
|
-
* `target: {path: ['array'], operation: 'append'}` will append the output of the instruction to the end of the array.
|
|
1127
|
-
*
|
|
1128
|
-
* To insert in the middle of the array, use `target: {path: ['array', {_key: 'appendAfterKey'}], operation: 'append'}`.
|
|
1129
|
-
* Here, the output of the instruction will be appended after the array item with key `'appendAfterKey'`.
|
|
1130
|
-
*
|
|
1131
|
-
* @see #GenerateTargetInclude.operation
|
|
1132
|
-
* @see #include
|
|
1133
|
-
* @see #GenerateTargetInclude.include
|
|
1134
|
-
*/
|
|
1135
|
-
operation?: GenerateOperation
|
|
1136
|
-
/**
|
|
1137
|
-
* maxPathDepth controls how deep into the schema from the target root the instruction will affect.
|
|
1138
|
-
*
|
|
1139
|
-
* Depth is based on path segments:
|
|
1140
|
-
* - `title` has depth 1
|
|
1141
|
-
* - `array[_key="no"].title` has depth 3
|
|
1142
|
-
*
|
|
1143
|
-
* Be careful not to set this too high in studios with recursive document schemas, as it could have
|
|
1144
|
-
* negative impact on performance; both for runtime and quality of responses.
|
|
1145
|
-
*
|
|
1146
|
-
* Default: 4
|
|
1147
|
-
*/
|
|
1148
|
-
maxPathDepth?: number
|
|
1149
|
-
/**
|
|
1150
|
-
* By default, all children up to `target.maxPathDepth` are included.
|
|
1151
|
-
*
|
|
1152
|
-
* When `include` is specified, only segments explicitly listed will be included.
|
|
1153
|
-
*
|
|
1154
|
-
* Fields or array items not on the include list, are implicitly excluded.
|
|
1155
|
-
*/
|
|
1156
|
-
include?: (GeneratePathSegment | GenerateTargetInclude)[]
|
|
1157
|
-
/**
|
|
1158
|
-
* By default, all children up to `target.maxPathDepth` are included.
|
|
1159
|
-
* Fields or array items not on the exclude list, are implicitly included.
|
|
1160
|
-
*/
|
|
1161
|
-
exclude?: GeneratePathSegment[]
|
|
1162
|
-
/**
|
|
1163
|
-
* Types can be used to exclude array item types or all fields directly under the target path of a certain type.
|
|
1164
|
-
* If you do exclude: ['string'] all string fields under the target will be excluded, for instance.
|
|
1165
|
-
*
|
|
1166
|
-
* `types.include` and `types.exclude` are mutually exclusive.
|
|
1167
|
-
*/
|
|
1168
|
-
types?: GenerateTypeConfig
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
declare interface GenerateTargetInclude {
|
|
1172
|
-
path: GeneratePathSegment | GeneratePath
|
|
1173
|
-
/**
|
|
1174
|
-
* Sets the operation for this path, and all its children.
|
|
1175
|
-
* This overrides any operation set parents or the root target.
|
|
1176
|
-
* @see #GenerateTarget.operation
|
|
1177
|
-
* @see #include
|
|
1178
|
-
*/
|
|
1179
|
-
operation?: GenerateOperation
|
|
1180
|
-
/**
|
|
1181
|
-
* By default, all children up to `target.maxPathDepth` are included.
|
|
1182
|
-
*
|
|
1183
|
-
* When `include` is specified, only segments explicitly listed will be included.
|
|
1184
|
-
*
|
|
1185
|
-
* Fields or array items not on the include list, are implicitly excluded.
|
|
1186
|
-
*/
|
|
1187
|
-
include?: (GeneratePathSegment | GenerateTargetInclude)[]
|
|
1188
|
-
/**
|
|
1189
|
-
* By default, all children up to `target.maxPathDepth` are included.
|
|
1190
|
-
* Fields or array items not on the exclude list, are implicitly included.
|
|
1191
|
-
*/
|
|
1192
|
-
exclude?: GeneratePathSegment[]
|
|
1193
|
-
/**
|
|
1194
|
-
* Types can be used to exclude array item types or all fields directly under the target path of a certain type.
|
|
1195
|
-
* If you do exclude: ['string'] all string fields under the target will be excluded, for instance.
|
|
1196
|
-
*
|
|
1197
|
-
* `types.include` and `types.exclude` are mutually exclusive.
|
|
1198
|
-
*/
|
|
1199
|
-
types?: GenerateTypeConfig
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
declare type GenerateTypeConfig =
|
|
1203
|
-
| {
|
|
1204
|
-
include: string[]
|
|
1205
|
-
exclude?: never
|
|
1206
|
-
}
|
|
1207
|
-
| {
|
|
1208
|
-
exclude: string[]
|
|
1209
|
-
include?: never
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
860
|
/** @public */
|
|
1213
861
|
export declare type HttpRequest = {
|
|
1214
862
|
(options: RequestOptions, requester: Requester): ReturnType<Requester>
|
|
@@ -1641,18 +1289,6 @@ export declare type MutationSelectionQueryParams = {
|
|
|
1641
1289
|
[key: string]: Any
|
|
1642
1290
|
}
|
|
1643
1291
|
|
|
1644
|
-
/** @public */
|
|
1645
|
-
declare class ObservableAgentsActionClient {
|
|
1646
|
-
#private
|
|
1647
|
-
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
1648
|
-
generate(request: GenerateAsyncInstruction): Observable<{
|
|
1649
|
-
_id: string
|
|
1650
|
-
}>
|
|
1651
|
-
generate<DocumentShape extends Record<string, Any>>(
|
|
1652
|
-
request: GenerateSyncInstruction<DocumentShape>,
|
|
1653
|
-
): Observable<IdentifiedSanityDocumentStub & DocumentShape>
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
1292
|
/** @internal */
|
|
1657
1293
|
export declare class ObservableAssetsClient {
|
|
1658
1294
|
#private
|
|
@@ -1830,9 +1466,6 @@ export declare class ObservableSanityClient {
|
|
|
1830
1466
|
live: LiveClient
|
|
1831
1467
|
projects: ObservableProjectsClient
|
|
1832
1468
|
users: ObservableUsersClient
|
|
1833
|
-
agent: {
|
|
1834
|
-
action: ObservableAgentsActionClient
|
|
1835
|
-
}
|
|
1836
1469
|
/**
|
|
1837
1470
|
* Instance properties
|
|
1838
1471
|
*/
|
|
@@ -2752,9 +2385,6 @@ export declare class SanityClient {
|
|
|
2752
2385
|
live: LiveClient
|
|
2753
2386
|
projects: ProjectsClient
|
|
2754
2387
|
users: UsersClient
|
|
2755
|
-
agent: {
|
|
2756
|
-
action: AgentActionsClient
|
|
2757
|
-
}
|
|
2758
2388
|
/**
|
|
2759
2389
|
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
2760
2390
|
*/
|
|
@@ -3469,29 +3099,6 @@ export {StudioBaseUrl}
|
|
|
3469
3099
|
|
|
3470
3100
|
export {StudioUrl}
|
|
3471
3101
|
|
|
3472
|
-
declare interface Sync {
|
|
3473
|
-
/**
|
|
3474
|
-
* By default, noWrite: false.
|
|
3475
|
-
* Write enabled operations will mutate the target document, and emit AI presence in the studio.
|
|
3476
|
-
*
|
|
3477
|
-
* When noWrite: true, the api will not mutate any documents nor emit presence.
|
|
3478
|
-
* Ie, when true, no changes will be made to content-lake
|
|
3479
|
-
*
|
|
3480
|
-
* noWrite: true is incompatible with async: true,
|
|
3481
|
-
* as noWrite implies that you will use the return value of the operation
|
|
3482
|
-
*/
|
|
3483
|
-
noWrite?: boolean
|
|
3484
|
-
/**
|
|
3485
|
-
* When async: true, requests responds with status 201 and {_id} as response body as soon as the request is validated.
|
|
3486
|
-
* The instruction operation will carry on in the background.
|
|
3487
|
-
*
|
|
3488
|
-
* When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
|
|
3489
|
-
*
|
|
3490
|
-
* async: true is incompatible with noWrite: true, as async: true does not return the resulting document
|
|
3491
|
-
*/
|
|
3492
|
-
async?: false
|
|
3493
|
-
}
|
|
3494
|
-
|
|
3495
3102
|
/** @public */
|
|
3496
3103
|
export declare type SyncTag = `s1:${string}`
|
|
3497
3104
|
|
package/dist/index.js
CHANGED
|
@@ -806,42 +806,6 @@ const resourceDataBase = (config) => {
|
|
|
806
806
|
throw new Error(`Unsupported resource type: ${type.toString()}`);
|
|
807
807
|
}
|
|
808
808
|
};
|
|
809
|
-
function _generate(client, httpRequest, request) {
|
|
810
|
-
const dataset2 = hasDataset(client.config());
|
|
811
|
-
return _request(client, httpRequest, {
|
|
812
|
-
method: "POST",
|
|
813
|
-
uri: `/agent/action/generate/${dataset2}`,
|
|
814
|
-
body: request
|
|
815
|
-
});
|
|
816
|
-
}
|
|
817
|
-
class ObservableAgentsActionClient {
|
|
818
|
-
#client;
|
|
819
|
-
#httpRequest;
|
|
820
|
-
constructor(client, httpRequest) {
|
|
821
|
-
this.#client = client, this.#httpRequest = httpRequest;
|
|
822
|
-
}
|
|
823
|
-
/**
|
|
824
|
-
* Run an instruction to generate content in a target document.
|
|
825
|
-
* @param request instruction request
|
|
826
|
-
*/
|
|
827
|
-
generate(request) {
|
|
828
|
-
return _generate(this.#client, this.#httpRequest, request);
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
class AgentActionsClient {
|
|
832
|
-
#client;
|
|
833
|
-
#httpRequest;
|
|
834
|
-
constructor(client, httpRequest) {
|
|
835
|
-
this.#client = client, this.#httpRequest = httpRequest;
|
|
836
|
-
}
|
|
837
|
-
/**
|
|
838
|
-
* Run an instruction to generate content in a target document.
|
|
839
|
-
* @param request instruction request
|
|
840
|
-
*/
|
|
841
|
-
generate(request) {
|
|
842
|
-
return lastValueFrom(_generate(this.#client, this.#httpRequest, request));
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
809
|
class ObservableAssetsClient {
|
|
846
810
|
#client;
|
|
847
811
|
#httpRequest;
|
|
@@ -1262,7 +1226,6 @@ class ObservableSanityClient {
|
|
|
1262
1226
|
live;
|
|
1263
1227
|
projects;
|
|
1264
1228
|
users;
|
|
1265
|
-
agent;
|
|
1266
1229
|
/**
|
|
1267
1230
|
* Private properties
|
|
1268
1231
|
*/
|
|
@@ -1273,9 +1236,7 @@ class ObservableSanityClient {
|
|
|
1273
1236
|
*/
|
|
1274
1237
|
listen = _listen;
|
|
1275
1238
|
constructor(httpRequest, config = defaultConfig) {
|
|
1276
|
-
this.config(config), this.#httpRequest = httpRequest, this.assets = new ObservableAssetsClient(this, this.#httpRequest), this.datasets = new ObservableDatasetsClient(this, this.#httpRequest), this.live = new LiveClient(this), this.projects = new ObservableProjectsClient(this, this.#httpRequest), this.users = new ObservableUsersClient(this, this.#httpRequest)
|
|
1277
|
-
action: new ObservableAgentsActionClient(this, this.#httpRequest)
|
|
1278
|
-
};
|
|
1239
|
+
this.config(config), this.#httpRequest = httpRequest, this.assets = new ObservableAssetsClient(this, this.#httpRequest), this.datasets = new ObservableDatasetsClient(this, this.#httpRequest), this.live = new LiveClient(this), this.projects = new ObservableProjectsClient(this, this.#httpRequest), this.users = new ObservableUsersClient(this, this.#httpRequest);
|
|
1279
1240
|
}
|
|
1280
1241
|
/**
|
|
1281
1242
|
* Clone the client - returns a new instance
|
|
@@ -1414,7 +1375,6 @@ class SanityClient {
|
|
|
1414
1375
|
live;
|
|
1415
1376
|
projects;
|
|
1416
1377
|
users;
|
|
1417
|
-
agent;
|
|
1418
1378
|
/**
|
|
1419
1379
|
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
1420
1380
|
*/
|
|
@@ -1429,9 +1389,7 @@ class SanityClient {
|
|
|
1429
1389
|
*/
|
|
1430
1390
|
listen = _listen;
|
|
1431
1391
|
constructor(httpRequest, config = defaultConfig) {
|
|
1432
|
-
this.config(config), this.#httpRequest = httpRequest, this.assets = new AssetsClient(this, this.#httpRequest), this.datasets = new DatasetsClient(this, this.#httpRequest), this.live = new LiveClient(this), this.projects = new ProjectsClient(this, this.#httpRequest), this.users = new UsersClient(this, this.#httpRequest), this.
|
|
1433
|
-
action: new AgentActionsClient(this, this.#httpRequest)
|
|
1434
|
-
}, this.observable = new ObservableSanityClient(httpRequest, config);
|
|
1392
|
+
this.config(config), this.#httpRequest = httpRequest, this.assets = new AssetsClient(this, this.#httpRequest), this.datasets = new DatasetsClient(this, this.#httpRequest), this.live = new LiveClient(this), this.projects = new ProjectsClient(this, this.#httpRequest), this.users = new UsersClient(this, this.#httpRequest), this.observable = new ObservableSanityClient(httpRequest, config);
|
|
1435
1393
|
}
|
|
1436
1394
|
/**
|
|
1437
1395
|
* Clone the client - returns a new instance
|
|
@@ -1607,7 +1565,7 @@ function defineDeprecatedCreateClient(createClient2) {
|
|
|
1607
1565
|
return printNoDefaultExport(), createClient2(config);
|
|
1608
1566
|
};
|
|
1609
1567
|
}
|
|
1610
|
-
var name = "@sanity/client", version = "6.29.
|
|
1568
|
+
var name = "@sanity/client", version = "6.29.1";
|
|
1611
1569
|
const middleware = [
|
|
1612
1570
|
debug({ verbose: !0, namespace: "sanity:client" }),
|
|
1613
1571
|
headers({ "User-Agent": `${name} ${version}` }),
|