@sanity/client 6.28.3-instruct.1 → 6.28.3-resources.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/_chunks-cjs/config.cjs +19 -3
- package/dist/_chunks-cjs/config.cjs.map +1 -1
- package/dist/_chunks-es/config.js +19 -3
- package/dist/_chunks-es/config.js.map +1 -1
- package/dist/index.browser.cjs +60 -59
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +7 -244
- package/dist/index.browser.d.ts +7 -244
- package/dist/index.browser.js +60 -59
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +44 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -233
- package/dist/index.d.ts +7 -233
- package/dist/index.js +45 -58
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +7 -233
- package/dist/stega.browser.d.ts +7 -233
- package/dist/stega.d.cts +7 -233
- package/dist/stega.d.ts +7 -233
- package/package.json +6 -25
- package/src/SanityClient.ts +1 -5
- package/src/assets/AssetsClient.ts +15 -3
- package/src/config.ts +6 -2
- package/src/data/dataMethods.ts +43 -5
- package/src/data/live.ts +2 -0
- package/src/datasets/DatasetsClient.ts +5 -0
- package/src/projects/ProjectsClient.ts +5 -0
- package/src/types.ts +8 -10
- package/src/validators.ts +23 -0
- package/umd/sanityClient.js +60 -59
- package/umd/sanityClient.min.js +2 -2
- package/src/ai/AiClient.ts +0 -93
- package/src/ai/types.ts +0 -206
package/dist/stega.d.cts
CHANGED
|
@@ -33,18 +33,6 @@ export declare interface ActionErrorItem {
|
|
|
33
33
|
index: number
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
/** @public */
|
|
37
|
-
declare class AiClient {
|
|
38
|
-
#private
|
|
39
|
-
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
40
|
-
instruct(request: InstructAsyncInstruction): Promise<{
|
|
41
|
-
_id: string
|
|
42
|
-
}>
|
|
43
|
-
instruct<DocumentShape extends Record<string, Any>>(
|
|
44
|
-
request: InstructSyncInstruction<DocumentShape>,
|
|
45
|
-
): Promise<IdentifiedSanityDocumentStub & DocumentShape>
|
|
46
|
-
}
|
|
47
|
-
|
|
48
36
|
/** @internal */
|
|
49
37
|
export declare type AllDocumentIdsMutationOptions = BaseMutationOptions & {
|
|
50
38
|
returnFirst: false
|
|
@@ -122,18 +110,6 @@ export declare class AssetsClient {
|
|
|
122
110
|
): Promise<SanityAssetDocument | SanityImageAssetDocument>
|
|
123
111
|
}
|
|
124
112
|
|
|
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 skipWrite, as async: true does not return the resulting document
|
|
133
|
-
*/
|
|
134
|
-
async: true
|
|
135
|
-
}
|
|
136
|
-
|
|
137
113
|
/** @internal */
|
|
138
114
|
export declare type AttributeSet = {
|
|
139
115
|
[key: string]: Any
|
|
@@ -357,6 +333,8 @@ export declare interface ClientConfig {
|
|
|
357
333
|
/** @defaultValue true */
|
|
358
334
|
useCdn?: boolean
|
|
359
335
|
token?: string
|
|
336
|
+
/** @internal */
|
|
337
|
+
'~experimental_resource'?: ClientConfigResource
|
|
360
338
|
/**
|
|
361
339
|
* What perspective to use for the client. See {@link https://www.sanity.io/docs/perspectives|perspective documentation}
|
|
362
340
|
* @remarks
|
|
@@ -417,6 +395,11 @@ export declare interface ClientConfig {
|
|
|
417
395
|
stega?: StegaConfig | boolean
|
|
418
396
|
}
|
|
419
397
|
|
|
398
|
+
declare type ClientConfigResource = {
|
|
399
|
+
type: string
|
|
400
|
+
id: string
|
|
401
|
+
}
|
|
402
|
+
|
|
420
403
|
/** @public */
|
|
421
404
|
export declare class ClientError extends Error {
|
|
422
405
|
response: ErrorProps['response']
|
|
@@ -697,18 +680,6 @@ export declare type CreateAction = {
|
|
|
697
680
|
*/
|
|
698
681
|
export declare const createClient: (config: ClientConfig_2) => SanityClient
|
|
699
682
|
|
|
700
|
-
/**
|
|
701
|
-
* Instruction to create a new document
|
|
702
|
-
* @beta
|
|
703
|
-
*/
|
|
704
|
-
declare interface CreateDocumentRequest<T extends Record<string, Any> = Record<string, Any>> {
|
|
705
|
-
createDocument: {
|
|
706
|
-
/** if no _id is provided, one will be generated. _id is always returned when the requests succeed */
|
|
707
|
-
_id?: string
|
|
708
|
-
_type: string
|
|
709
|
-
} & SanityDocumentStub<T>
|
|
710
|
-
}
|
|
711
|
-
|
|
712
683
|
/** @public */
|
|
713
684
|
export declare interface CurrentSanityUser {
|
|
714
685
|
id: string
|
|
@@ -853,19 +824,6 @@ export declare type DisconnectEvent = {
|
|
|
853
824
|
reason: string
|
|
854
825
|
}
|
|
855
826
|
|
|
856
|
-
/**
|
|
857
|
-
*
|
|
858
|
-
* Includes a LLM-friendly version of the document in the instruction
|
|
859
|
-
* @beta
|
|
860
|
-
* */
|
|
861
|
-
declare interface DocumentInstructionParam {
|
|
862
|
-
type: 'document'
|
|
863
|
-
/**
|
|
864
|
-
* If omitted, implicitly uses the documentId of the instruction target
|
|
865
|
-
*/
|
|
866
|
-
documentId?: string
|
|
867
|
-
}
|
|
868
|
-
|
|
869
827
|
/**
|
|
870
828
|
* Modifies an existing draft document.
|
|
871
829
|
* It applies the given patch to the document referenced by draftId.
|
|
@@ -927,14 +885,6 @@ export declare type EventSourceEvent<Name extends string> = ServerSentEvent<Name
|
|
|
927
885
|
*/
|
|
928
886
|
export declare type EventSourceInstance = InstanceType<typeof globalThis.EventSource>
|
|
929
887
|
|
|
930
|
-
/**
|
|
931
|
-
* Instruction for an existing document.
|
|
932
|
-
* @beta
|
|
933
|
-
*/
|
|
934
|
-
declare interface ExistingDocumentRequest {
|
|
935
|
-
documentId: string
|
|
936
|
-
}
|
|
937
|
-
|
|
938
888
|
/** @public */
|
|
939
889
|
export declare type FilterDefault = (props: {
|
|
940
890
|
/**
|
|
@@ -1120,145 +1070,6 @@ export declare type InsertPatch =
|
|
|
1120
1070
|
items: Any[]
|
|
1121
1071
|
}
|
|
1122
1072
|
|
|
1123
|
-
/** @beta */
|
|
1124
|
-
export declare type InstructAsyncInstruction<T extends Record<string, Any> = Record<string, Any>> =
|
|
1125
|
-
(ExistingDocumentRequest | CreateDocumentRequest<T>) & InstructRequestBase & Async
|
|
1126
|
-
|
|
1127
|
-
/** @beta */
|
|
1128
|
-
export declare interface InstructConstantInstructionParam {
|
|
1129
|
-
type: 'constant'
|
|
1130
|
-
value: string
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
/**
|
|
1134
|
-
*
|
|
1135
|
-
* Includes a LLM-friendly version of the field value in the instruction
|
|
1136
|
-
* @beta
|
|
1137
|
-
* */
|
|
1138
|
-
export declare interface InstructFieldInstructionParam {
|
|
1139
|
-
type: 'field'
|
|
1140
|
-
/**
|
|
1141
|
-
* Examples: 'title', 'array[_key=="key"].field'
|
|
1142
|
-
*/
|
|
1143
|
-
path: string
|
|
1144
|
-
/**
|
|
1145
|
-
* If omitted, implicitly uses the documentId of the instruction target
|
|
1146
|
-
*/
|
|
1147
|
-
documentId?: string
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
/**
|
|
1151
|
-
* Includes a LLM-friendly version of GROQ query result in the instruction
|
|
1152
|
-
* @beta
|
|
1153
|
-
* */
|
|
1154
|
-
export declare interface InstructGroqInstructionParam {
|
|
1155
|
-
type: 'groq'
|
|
1156
|
-
query: string
|
|
1157
|
-
params?: Record<string, string>
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
/** @beta */
|
|
1161
|
-
export declare type InstructInstruction<T extends Record<string, Any> = Record<string, Any>> =
|
|
1162
|
-
| InstructSyncInstruction<T>
|
|
1163
|
-
| InstructAsyncInstruction<T>
|
|
1164
|
-
|
|
1165
|
-
/** @beta */
|
|
1166
|
-
export declare type InstructInstructionParam =
|
|
1167
|
-
| string
|
|
1168
|
-
| InstructConstantInstructionParam
|
|
1169
|
-
| InstructFieldInstructionParam
|
|
1170
|
-
| DocumentInstructionParam
|
|
1171
|
-
| InstructGroqInstructionParam
|
|
1172
|
-
|
|
1173
|
-
/** @beta */
|
|
1174
|
-
export declare type InstructInstructionParams = Record<string, InstructInstructionParam>
|
|
1175
|
-
|
|
1176
|
-
declare interface InstructRequestBase {
|
|
1177
|
-
/** schemaId as reported by sanity deploy / sanity schema store */
|
|
1178
|
-
schemaId: string
|
|
1179
|
-
/** string template using $variable – more on this below under "Dynamic instruction" */
|
|
1180
|
-
instruction: string
|
|
1181
|
-
/** param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable" */
|
|
1182
|
-
instructionParams?: InstructInstructionParams
|
|
1183
|
-
/**
|
|
1184
|
-
* Optional document path output target for the instruction.
|
|
1185
|
-
* When provided, the instruction will apply to this path in the document and its children.
|
|
1186
|
-
*
|
|
1187
|
-
* ## Examples
|
|
1188
|
-
* - `path: 'title'` will output to the title field in the document
|
|
1189
|
-
* - `path: 'array[_key="xx"]'` will output to the item with `_key: 'xx'` in the array field
|
|
1190
|
-
*/
|
|
1191
|
-
path?: string
|
|
1192
|
-
/**
|
|
1193
|
-
* Controls sub-paths in the document that can be output to.
|
|
1194
|
-
*
|
|
1195
|
-
* The string-paths are relative to the `path` param
|
|
1196
|
-
*
|
|
1197
|
-
* Note: these path strings are less strictly validated than the `path` param itself:
|
|
1198
|
-
* if an relative-path does not exist or is invalid, it will be silently ignored.
|
|
1199
|
-
*
|
|
1200
|
-
* @see InstructRequestBase#conditionalPaths
|
|
1201
|
-
* @see InstructRequestBase#outputTypes
|
|
1202
|
-
*/
|
|
1203
|
-
relativeOutputPaths?:
|
|
1204
|
-
| {
|
|
1205
|
-
include: string[]
|
|
1206
|
-
}
|
|
1207
|
-
| {
|
|
1208
|
-
exclude: string[]
|
|
1209
|
-
}
|
|
1210
|
-
/**
|
|
1211
|
-
* Controls which types the instruction is allowed to output to.
|
|
1212
|
-
*
|
|
1213
|
-
* @see InstructRequestBase#relativeOutputPaths
|
|
1214
|
-
* @see InstructRequestBase#conditionalPaths
|
|
1215
|
-
*/
|
|
1216
|
-
outputTypes?:
|
|
1217
|
-
| {
|
|
1218
|
-
include: string[]
|
|
1219
|
-
}
|
|
1220
|
-
| {
|
|
1221
|
-
exclude: string[]
|
|
1222
|
-
}
|
|
1223
|
-
/**
|
|
1224
|
-
* When a type or field in the schema has a function set for `hidden` or `readOnly`, it is conditional.
|
|
1225
|
-
*
|
|
1226
|
-
* By default, AI Instruct will not output to conditional `readOnly` and `hidden` fields,
|
|
1227
|
-
* ie, they are considered to resolve to `readOnly: true` / `hidden: true`.
|
|
1228
|
-
*
|
|
1229
|
-
* `conditionalPaths` param allows setting the default conditional value for
|
|
1230
|
-
* `hidden` and `readOnly` to false,
|
|
1231
|
-
* or individually set `hidden` and `readOnly` state for individual document paths.
|
|
1232
|
-
*
|
|
1233
|
-
*
|
|
1234
|
-
* Note: fields and types with explicit readOnly: true or hidden: true in the schema, are not available to AI Instruct,
|
|
1235
|
-
* and cannot be changed via conditionalPaths.
|
|
1236
|
-
*
|
|
1237
|
-
* conditionalPaths state only apply to fields and types that have conditional `hidden` or `readOnly` in their schema definition.
|
|
1238
|
-
*
|
|
1239
|
-
* @see InstructRequestBase#relativeOutputPaths
|
|
1240
|
-
* @see InstructRequestBase#outputTypes
|
|
1241
|
-
*/
|
|
1242
|
-
conditionalPaths?: {
|
|
1243
|
-
defaultReadOnly?: boolean
|
|
1244
|
-
defaultHidden?: boolean
|
|
1245
|
-
paths?: {
|
|
1246
|
-
/** path here is not a relative path: it must be the full document path, regardless of `path` param on the request itself */
|
|
1247
|
-
path: string
|
|
1248
|
-
readOnly: boolean
|
|
1249
|
-
hidden: boolean
|
|
1250
|
-
}[]
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
/** @beta */
|
|
1255
|
-
export declare type InstructSyncInstruction<T extends Record<string, Any> = Record<string, Any>> = (
|
|
1256
|
-
| ExistingDocumentRequest
|
|
1257
|
-
| CreateDocumentRequest<T>
|
|
1258
|
-
) &
|
|
1259
|
-
InstructRequestBase &
|
|
1260
|
-
Sync
|
|
1261
|
-
|
|
1262
1073
|
/**
|
|
1263
1074
|
* Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
|
|
1264
1075
|
*
|
|
@@ -1626,18 +1437,6 @@ export declare type MutationSelectionQueryParams = {
|
|
|
1626
1437
|
[key: string]: Any
|
|
1627
1438
|
}
|
|
1628
1439
|
|
|
1629
|
-
/** @public */
|
|
1630
|
-
declare class ObservableAiClient {
|
|
1631
|
-
#private
|
|
1632
|
-
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
1633
|
-
instruct(request: InstructAsyncInstruction): Observable<{
|
|
1634
|
-
_id: string
|
|
1635
|
-
}>
|
|
1636
|
-
instruct<DocumentShape extends Record<string, Any>>(
|
|
1637
|
-
request: InstructSyncInstruction<DocumentShape>,
|
|
1638
|
-
): Observable<IdentifiedSanityDocumentStub & DocumentShape>
|
|
1639
|
-
}
|
|
1640
|
-
|
|
1641
1440
|
/** @internal */
|
|
1642
1441
|
export declare class ObservableAssetsClient {
|
|
1643
1442
|
#private
|
|
@@ -1815,7 +1614,6 @@ export declare class ObservableSanityClient {
|
|
|
1815
1614
|
live: LiveClient
|
|
1816
1615
|
projects: ObservableProjectsClient
|
|
1817
1616
|
users: ObservableUsersClient
|
|
1818
|
-
ai: ObservableAiClient
|
|
1819
1617
|
/**
|
|
1820
1618
|
* Instance properties
|
|
1821
1619
|
*/
|
|
@@ -2747,7 +2545,6 @@ export declare class SanityClient {
|
|
|
2747
2545
|
live: LiveClient
|
|
2748
2546
|
projects: ProjectsClient
|
|
2749
2547
|
users: UsersClient
|
|
2750
|
-
ai: AiClient
|
|
2751
2548
|
/**
|
|
2752
2549
|
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
2753
2550
|
*/
|
|
@@ -3531,29 +3328,6 @@ export declare type StudioBaseUrl =
|
|
|
3531
3328
|
/** @alpha */
|
|
3532
3329
|
export declare type StudioUrl = StudioBaseUrl | StudioBaseRoute
|
|
3533
3330
|
|
|
3534
|
-
declare interface Sync {
|
|
3535
|
-
/**
|
|
3536
|
-
* By default, skipWrite: false.
|
|
3537
|
-
* Write enabled operations will mutate the target document, and emit AI presence in the studio.
|
|
3538
|
-
*
|
|
3539
|
-
* When skipWrite: true, the api will not mutate any documents nor emit presence.
|
|
3540
|
-
* Ie, when true, no changes will be made to content-lake
|
|
3541
|
-
*
|
|
3542
|
-
* skipWrite: true is incompatible with async: true,
|
|
3543
|
-
* as skipWrite implies that you will use the return value of the operation
|
|
3544
|
-
*/
|
|
3545
|
-
skipWrite?: boolean
|
|
3546
|
-
/**
|
|
3547
|
-
* When async: true, requests responds with status 201 and {_id} as response body as soon as the request is validated.
|
|
3548
|
-
* The instruction operation will carry on in the background.
|
|
3549
|
-
*
|
|
3550
|
-
* When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
|
|
3551
|
-
*
|
|
3552
|
-
* async: true is incompatible with skipWrite: true, as async: true does not return the resulting document
|
|
3553
|
-
*/
|
|
3554
|
-
async?: false
|
|
3555
|
-
}
|
|
3556
|
-
|
|
3557
3331
|
/** @public */
|
|
3558
3332
|
export declare type SyncTag = `s1:${string}`
|
|
3559
3333
|
|
package/dist/stega.d.ts
CHANGED
|
@@ -33,18 +33,6 @@ export declare interface ActionErrorItem {
|
|
|
33
33
|
index: number
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
/** @public */
|
|
37
|
-
declare class AiClient {
|
|
38
|
-
#private
|
|
39
|
-
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
40
|
-
instruct(request: InstructAsyncInstruction): Promise<{
|
|
41
|
-
_id: string
|
|
42
|
-
}>
|
|
43
|
-
instruct<DocumentShape extends Record<string, Any>>(
|
|
44
|
-
request: InstructSyncInstruction<DocumentShape>,
|
|
45
|
-
): Promise<IdentifiedSanityDocumentStub & DocumentShape>
|
|
46
|
-
}
|
|
47
|
-
|
|
48
36
|
/** @internal */
|
|
49
37
|
export declare type AllDocumentIdsMutationOptions = BaseMutationOptions & {
|
|
50
38
|
returnFirst: false
|
|
@@ -122,18 +110,6 @@ export declare class AssetsClient {
|
|
|
122
110
|
): Promise<SanityAssetDocument | SanityImageAssetDocument>
|
|
123
111
|
}
|
|
124
112
|
|
|
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 skipWrite, as async: true does not return the resulting document
|
|
133
|
-
*/
|
|
134
|
-
async: true
|
|
135
|
-
}
|
|
136
|
-
|
|
137
113
|
/** @internal */
|
|
138
114
|
export declare type AttributeSet = {
|
|
139
115
|
[key: string]: Any
|
|
@@ -357,6 +333,8 @@ export declare interface ClientConfig {
|
|
|
357
333
|
/** @defaultValue true */
|
|
358
334
|
useCdn?: boolean
|
|
359
335
|
token?: string
|
|
336
|
+
/** @internal */
|
|
337
|
+
'~experimental_resource'?: ClientConfigResource
|
|
360
338
|
/**
|
|
361
339
|
* What perspective to use for the client. See {@link https://www.sanity.io/docs/perspectives|perspective documentation}
|
|
362
340
|
* @remarks
|
|
@@ -417,6 +395,11 @@ export declare interface ClientConfig {
|
|
|
417
395
|
stega?: StegaConfig | boolean
|
|
418
396
|
}
|
|
419
397
|
|
|
398
|
+
declare type ClientConfigResource = {
|
|
399
|
+
type: string
|
|
400
|
+
id: string
|
|
401
|
+
}
|
|
402
|
+
|
|
420
403
|
/** @public */
|
|
421
404
|
export declare class ClientError extends Error {
|
|
422
405
|
response: ErrorProps['response']
|
|
@@ -697,18 +680,6 @@ export declare type CreateAction = {
|
|
|
697
680
|
*/
|
|
698
681
|
export declare const createClient: (config: ClientConfig_2) => SanityClient
|
|
699
682
|
|
|
700
|
-
/**
|
|
701
|
-
* Instruction to create a new document
|
|
702
|
-
* @beta
|
|
703
|
-
*/
|
|
704
|
-
declare interface CreateDocumentRequest<T extends Record<string, Any> = Record<string, Any>> {
|
|
705
|
-
createDocument: {
|
|
706
|
-
/** if no _id is provided, one will be generated. _id is always returned when the requests succeed */
|
|
707
|
-
_id?: string
|
|
708
|
-
_type: string
|
|
709
|
-
} & SanityDocumentStub<T>
|
|
710
|
-
}
|
|
711
|
-
|
|
712
683
|
/** @public */
|
|
713
684
|
export declare interface CurrentSanityUser {
|
|
714
685
|
id: string
|
|
@@ -853,19 +824,6 @@ export declare type DisconnectEvent = {
|
|
|
853
824
|
reason: string
|
|
854
825
|
}
|
|
855
826
|
|
|
856
|
-
/**
|
|
857
|
-
*
|
|
858
|
-
* Includes a LLM-friendly version of the document in the instruction
|
|
859
|
-
* @beta
|
|
860
|
-
* */
|
|
861
|
-
declare interface DocumentInstructionParam {
|
|
862
|
-
type: 'document'
|
|
863
|
-
/**
|
|
864
|
-
* If omitted, implicitly uses the documentId of the instruction target
|
|
865
|
-
*/
|
|
866
|
-
documentId?: string
|
|
867
|
-
}
|
|
868
|
-
|
|
869
827
|
/**
|
|
870
828
|
* Modifies an existing draft document.
|
|
871
829
|
* It applies the given patch to the document referenced by draftId.
|
|
@@ -927,14 +885,6 @@ export declare type EventSourceEvent<Name extends string> = ServerSentEvent<Name
|
|
|
927
885
|
*/
|
|
928
886
|
export declare type EventSourceInstance = InstanceType<typeof globalThis.EventSource>
|
|
929
887
|
|
|
930
|
-
/**
|
|
931
|
-
* Instruction for an existing document.
|
|
932
|
-
* @beta
|
|
933
|
-
*/
|
|
934
|
-
declare interface ExistingDocumentRequest {
|
|
935
|
-
documentId: string
|
|
936
|
-
}
|
|
937
|
-
|
|
938
888
|
/** @public */
|
|
939
889
|
export declare type FilterDefault = (props: {
|
|
940
890
|
/**
|
|
@@ -1120,145 +1070,6 @@ export declare type InsertPatch =
|
|
|
1120
1070
|
items: Any[]
|
|
1121
1071
|
}
|
|
1122
1072
|
|
|
1123
|
-
/** @beta */
|
|
1124
|
-
export declare type InstructAsyncInstruction<T extends Record<string, Any> = Record<string, Any>> =
|
|
1125
|
-
(ExistingDocumentRequest | CreateDocumentRequest<T>) & InstructRequestBase & Async
|
|
1126
|
-
|
|
1127
|
-
/** @beta */
|
|
1128
|
-
export declare interface InstructConstantInstructionParam {
|
|
1129
|
-
type: 'constant'
|
|
1130
|
-
value: string
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
/**
|
|
1134
|
-
*
|
|
1135
|
-
* Includes a LLM-friendly version of the field value in the instruction
|
|
1136
|
-
* @beta
|
|
1137
|
-
* */
|
|
1138
|
-
export declare interface InstructFieldInstructionParam {
|
|
1139
|
-
type: 'field'
|
|
1140
|
-
/**
|
|
1141
|
-
* Examples: 'title', 'array[_key=="key"].field'
|
|
1142
|
-
*/
|
|
1143
|
-
path: string
|
|
1144
|
-
/**
|
|
1145
|
-
* If omitted, implicitly uses the documentId of the instruction target
|
|
1146
|
-
*/
|
|
1147
|
-
documentId?: string
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
/**
|
|
1151
|
-
* Includes a LLM-friendly version of GROQ query result in the instruction
|
|
1152
|
-
* @beta
|
|
1153
|
-
* */
|
|
1154
|
-
export declare interface InstructGroqInstructionParam {
|
|
1155
|
-
type: 'groq'
|
|
1156
|
-
query: string
|
|
1157
|
-
params?: Record<string, string>
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
/** @beta */
|
|
1161
|
-
export declare type InstructInstruction<T extends Record<string, Any> = Record<string, Any>> =
|
|
1162
|
-
| InstructSyncInstruction<T>
|
|
1163
|
-
| InstructAsyncInstruction<T>
|
|
1164
|
-
|
|
1165
|
-
/** @beta */
|
|
1166
|
-
export declare type InstructInstructionParam =
|
|
1167
|
-
| string
|
|
1168
|
-
| InstructConstantInstructionParam
|
|
1169
|
-
| InstructFieldInstructionParam
|
|
1170
|
-
| DocumentInstructionParam
|
|
1171
|
-
| InstructGroqInstructionParam
|
|
1172
|
-
|
|
1173
|
-
/** @beta */
|
|
1174
|
-
export declare type InstructInstructionParams = Record<string, InstructInstructionParam>
|
|
1175
|
-
|
|
1176
|
-
declare interface InstructRequestBase {
|
|
1177
|
-
/** schemaId as reported by sanity deploy / sanity schema store */
|
|
1178
|
-
schemaId: string
|
|
1179
|
-
/** string template using $variable – more on this below under "Dynamic instruction" */
|
|
1180
|
-
instruction: string
|
|
1181
|
-
/** param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable" */
|
|
1182
|
-
instructionParams?: InstructInstructionParams
|
|
1183
|
-
/**
|
|
1184
|
-
* Optional document path output target for the instruction.
|
|
1185
|
-
* When provided, the instruction will apply to this path in the document and its children.
|
|
1186
|
-
*
|
|
1187
|
-
* ## Examples
|
|
1188
|
-
* - `path: 'title'` will output to the title field in the document
|
|
1189
|
-
* - `path: 'array[_key="xx"]'` will output to the item with `_key: 'xx'` in the array field
|
|
1190
|
-
*/
|
|
1191
|
-
path?: string
|
|
1192
|
-
/**
|
|
1193
|
-
* Controls sub-paths in the document that can be output to.
|
|
1194
|
-
*
|
|
1195
|
-
* The string-paths are relative to the `path` param
|
|
1196
|
-
*
|
|
1197
|
-
* Note: these path strings are less strictly validated than the `path` param itself:
|
|
1198
|
-
* if an relative-path does not exist or is invalid, it will be silently ignored.
|
|
1199
|
-
*
|
|
1200
|
-
* @see InstructRequestBase#conditionalPaths
|
|
1201
|
-
* @see InstructRequestBase#outputTypes
|
|
1202
|
-
*/
|
|
1203
|
-
relativeOutputPaths?:
|
|
1204
|
-
| {
|
|
1205
|
-
include: string[]
|
|
1206
|
-
}
|
|
1207
|
-
| {
|
|
1208
|
-
exclude: string[]
|
|
1209
|
-
}
|
|
1210
|
-
/**
|
|
1211
|
-
* Controls which types the instruction is allowed to output to.
|
|
1212
|
-
*
|
|
1213
|
-
* @see InstructRequestBase#relativeOutputPaths
|
|
1214
|
-
* @see InstructRequestBase#conditionalPaths
|
|
1215
|
-
*/
|
|
1216
|
-
outputTypes?:
|
|
1217
|
-
| {
|
|
1218
|
-
include: string[]
|
|
1219
|
-
}
|
|
1220
|
-
| {
|
|
1221
|
-
exclude: string[]
|
|
1222
|
-
}
|
|
1223
|
-
/**
|
|
1224
|
-
* When a type or field in the schema has a function set for `hidden` or `readOnly`, it is conditional.
|
|
1225
|
-
*
|
|
1226
|
-
* By default, AI Instruct will not output to conditional `readOnly` and `hidden` fields,
|
|
1227
|
-
* ie, they are considered to resolve to `readOnly: true` / `hidden: true`.
|
|
1228
|
-
*
|
|
1229
|
-
* `conditionalPaths` param allows setting the default conditional value for
|
|
1230
|
-
* `hidden` and `readOnly` to false,
|
|
1231
|
-
* or individually set `hidden` and `readOnly` state for individual document paths.
|
|
1232
|
-
*
|
|
1233
|
-
*
|
|
1234
|
-
* Note: fields and types with explicit readOnly: true or hidden: true in the schema, are not available to AI Instruct,
|
|
1235
|
-
* and cannot be changed via conditionalPaths.
|
|
1236
|
-
*
|
|
1237
|
-
* conditionalPaths state only apply to fields and types that have conditional `hidden` or `readOnly` in their schema definition.
|
|
1238
|
-
*
|
|
1239
|
-
* @see InstructRequestBase#relativeOutputPaths
|
|
1240
|
-
* @see InstructRequestBase#outputTypes
|
|
1241
|
-
*/
|
|
1242
|
-
conditionalPaths?: {
|
|
1243
|
-
defaultReadOnly?: boolean
|
|
1244
|
-
defaultHidden?: boolean
|
|
1245
|
-
paths?: {
|
|
1246
|
-
/** path here is not a relative path: it must be the full document path, regardless of `path` param on the request itself */
|
|
1247
|
-
path: string
|
|
1248
|
-
readOnly: boolean
|
|
1249
|
-
hidden: boolean
|
|
1250
|
-
}[]
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
/** @beta */
|
|
1255
|
-
export declare type InstructSyncInstruction<T extends Record<string, Any> = Record<string, Any>> = (
|
|
1256
|
-
| ExistingDocumentRequest
|
|
1257
|
-
| CreateDocumentRequest<T>
|
|
1258
|
-
) &
|
|
1259
|
-
InstructRequestBase &
|
|
1260
|
-
Sync
|
|
1261
|
-
|
|
1262
1073
|
/**
|
|
1263
1074
|
* Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
|
|
1264
1075
|
*
|
|
@@ -1626,18 +1437,6 @@ export declare type MutationSelectionQueryParams = {
|
|
|
1626
1437
|
[key: string]: Any
|
|
1627
1438
|
}
|
|
1628
1439
|
|
|
1629
|
-
/** @public */
|
|
1630
|
-
declare class ObservableAiClient {
|
|
1631
|
-
#private
|
|
1632
|
-
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
1633
|
-
instruct(request: InstructAsyncInstruction): Observable<{
|
|
1634
|
-
_id: string
|
|
1635
|
-
}>
|
|
1636
|
-
instruct<DocumentShape extends Record<string, Any>>(
|
|
1637
|
-
request: InstructSyncInstruction<DocumentShape>,
|
|
1638
|
-
): Observable<IdentifiedSanityDocumentStub & DocumentShape>
|
|
1639
|
-
}
|
|
1640
|
-
|
|
1641
1440
|
/** @internal */
|
|
1642
1441
|
export declare class ObservableAssetsClient {
|
|
1643
1442
|
#private
|
|
@@ -1815,7 +1614,6 @@ export declare class ObservableSanityClient {
|
|
|
1815
1614
|
live: LiveClient
|
|
1816
1615
|
projects: ObservableProjectsClient
|
|
1817
1616
|
users: ObservableUsersClient
|
|
1818
|
-
ai: ObservableAiClient
|
|
1819
1617
|
/**
|
|
1820
1618
|
* Instance properties
|
|
1821
1619
|
*/
|
|
@@ -2747,7 +2545,6 @@ export declare class SanityClient {
|
|
|
2747
2545
|
live: LiveClient
|
|
2748
2546
|
projects: ProjectsClient
|
|
2749
2547
|
users: UsersClient
|
|
2750
|
-
ai: AiClient
|
|
2751
2548
|
/**
|
|
2752
2549
|
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
2753
2550
|
*/
|
|
@@ -3531,29 +3328,6 @@ export declare type StudioBaseUrl =
|
|
|
3531
3328
|
/** @alpha */
|
|
3532
3329
|
export declare type StudioUrl = StudioBaseUrl | StudioBaseRoute
|
|
3533
3330
|
|
|
3534
|
-
declare interface Sync {
|
|
3535
|
-
/**
|
|
3536
|
-
* By default, skipWrite: false.
|
|
3537
|
-
* Write enabled operations will mutate the target document, and emit AI presence in the studio.
|
|
3538
|
-
*
|
|
3539
|
-
* When skipWrite: true, the api will not mutate any documents nor emit presence.
|
|
3540
|
-
* Ie, when true, no changes will be made to content-lake
|
|
3541
|
-
*
|
|
3542
|
-
* skipWrite: true is incompatible with async: true,
|
|
3543
|
-
* as skipWrite implies that you will use the return value of the operation
|
|
3544
|
-
*/
|
|
3545
|
-
skipWrite?: boolean
|
|
3546
|
-
/**
|
|
3547
|
-
* When async: true, requests responds with status 201 and {_id} as response body as soon as the request is validated.
|
|
3548
|
-
* The instruction operation will carry on in the background.
|
|
3549
|
-
*
|
|
3550
|
-
* When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
|
|
3551
|
-
*
|
|
3552
|
-
* async: true is incompatible with skipWrite: true, as async: true does not return the resulting document
|
|
3553
|
-
*/
|
|
3554
|
-
async?: false
|
|
3555
|
-
}
|
|
3556
|
-
|
|
3557
3331
|
/** @public */
|
|
3558
3332
|
export declare type SyncTag = `s1:${string}`
|
|
3559
3333
|
|
package/package.json
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/client",
|
|
3
|
-
"version": "6.28.3-
|
|
3
|
+
"version": "6.28.3-resources.1",
|
|
4
4
|
"description": "Client for retrieving, creating and patching data from Sanity.io",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"sanity",
|
|
7
|
-
"cms",
|
|
8
|
-
"headless",
|
|
9
|
-
"realtime",
|
|
10
|
-
"content",
|
|
11
|
-
"client",
|
|
12
|
-
"fetch",
|
|
13
|
-
"api"
|
|
14
|
-
],
|
|
5
|
+
"keywords": ["sanity", "cms", "headless", "realtime", "content", "client", "fetch", "api"],
|
|
15
6
|
"homepage": "https://www.sanity.io/",
|
|
16
7
|
"bugs": {
|
|
17
8
|
"url": "https://github.com/sanity-io/client/issues"
|
|
@@ -75,19 +66,11 @@
|
|
|
75
66
|
"types": "./dist/index.d.ts",
|
|
76
67
|
"typesVersions": {
|
|
77
68
|
"*": {
|
|
78
|
-
"csm": [
|
|
79
|
-
|
|
80
|
-
],
|
|
81
|
-
"stega": [
|
|
82
|
-
"./dist/stega.d.ts"
|
|
83
|
-
]
|
|
69
|
+
"csm": ["./dist/csm.d.ts"],
|
|
70
|
+
"stega": ["./dist/stega.d.ts"]
|
|
84
71
|
}
|
|
85
72
|
},
|
|
86
|
-
"files": [
|
|
87
|
-
"dist",
|
|
88
|
-
"src",
|
|
89
|
-
"umd"
|
|
90
|
-
],
|
|
73
|
+
"files": ["dist", "src", "umd"],
|
|
91
74
|
"scripts": {
|
|
92
75
|
"benchmark": "npm test -- bench",
|
|
93
76
|
"prebuild": "npm run clean",
|
|
@@ -110,9 +93,7 @@
|
|
|
110
93
|
"browserslist": "extends @sanity/browserslist-config",
|
|
111
94
|
"prettier": {
|
|
112
95
|
"bracketSpacing": false,
|
|
113
|
-
"plugins": [
|
|
114
|
-
"prettier-plugin-packagejson"
|
|
115
|
-
],
|
|
96
|
+
"plugins": ["prettier-plugin-packagejson"],
|
|
116
97
|
"printWidth": 100,
|
|
117
98
|
"semi": false,
|
|
118
99
|
"singleQuote": true
|