@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/index.browser.d.cts
CHANGED
|
@@ -39,18 +39,6 @@ export declare interface ActionErrorItem {
|
|
|
39
39
|
index: number
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
/** @public */
|
|
43
|
-
declare class AiClient {
|
|
44
|
-
#private
|
|
45
|
-
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
46
|
-
instruct(request: InstructAsyncInstruction): Promise<{
|
|
47
|
-
_id: string
|
|
48
|
-
}>
|
|
49
|
-
instruct<DocumentShape extends Record<string, Any>>(
|
|
50
|
-
request: InstructSyncInstruction<DocumentShape>,
|
|
51
|
-
): Promise<IdentifiedSanityDocumentStub & DocumentShape>
|
|
52
|
-
}
|
|
53
|
-
|
|
54
42
|
/** @internal */
|
|
55
43
|
export declare type AllDocumentIdsMutationOptions = BaseMutationOptions & {
|
|
56
44
|
returnFirst: false
|
|
@@ -69,12 +57,6 @@ export declare type AllDocumentsMutationOptions = BaseMutationOptions & {
|
|
|
69
57
|
*/
|
|
70
58
|
export declare type Any = any
|
|
71
59
|
|
|
72
|
-
/**
|
|
73
|
-
* Used to tag types that is set to `any` as a temporary measure, but should be replaced with proper typings in the future
|
|
74
|
-
* @internal
|
|
75
|
-
*/
|
|
76
|
-
declare type Any_2 = any
|
|
77
|
-
|
|
78
60
|
/** @internal */
|
|
79
61
|
export declare interface ApiError {
|
|
80
62
|
error: string
|
|
@@ -134,18 +116,6 @@ export declare class AssetsClient {
|
|
|
134
116
|
): Promise<SanityAssetDocument | SanityImageAssetDocument>
|
|
135
117
|
}
|
|
136
118
|
|
|
137
|
-
declare interface Async {
|
|
138
|
-
/**
|
|
139
|
-
* When async: true, requests responds with status 201 and {_id} as response body as soon as the request is validated.
|
|
140
|
-
* The instruction operation will carry on in the background.
|
|
141
|
-
*
|
|
142
|
-
* When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
|
|
143
|
-
*
|
|
144
|
-
* async: true is incompatible with skipWrite, as async: true does not return the resulting document
|
|
145
|
-
*/
|
|
146
|
-
async: true
|
|
147
|
-
}
|
|
148
|
-
|
|
149
119
|
/** @internal */
|
|
150
120
|
export declare type AttributeSet = {
|
|
151
121
|
[key: string]: Any
|
|
@@ -369,6 +339,8 @@ export declare interface ClientConfig {
|
|
|
369
339
|
/** @defaultValue true */
|
|
370
340
|
useCdn?: boolean
|
|
371
341
|
token?: string
|
|
342
|
+
/** @internal */
|
|
343
|
+
'~experimental_resource'?: ClientConfigResource
|
|
372
344
|
/**
|
|
373
345
|
* What perspective to use for the client. See {@link https://www.sanity.io/docs/perspectives|perspective documentation}
|
|
374
346
|
* @remarks
|
|
@@ -429,6 +401,11 @@ export declare interface ClientConfig {
|
|
|
429
401
|
stega?: StegaConfig | boolean
|
|
430
402
|
}
|
|
431
403
|
|
|
404
|
+
declare type ClientConfigResource = {
|
|
405
|
+
type: string
|
|
406
|
+
id: string
|
|
407
|
+
}
|
|
408
|
+
|
|
432
409
|
/** @public */
|
|
433
410
|
export declare class ClientError extends Error {
|
|
434
411
|
response: ErrorProps['response']
|
|
@@ -604,18 +581,6 @@ export declare type CreateAction = {
|
|
|
604
581
|
/** @public */
|
|
605
582
|
export declare const createClient: (config: ClientConfig) => SanityClient
|
|
606
583
|
|
|
607
|
-
/**
|
|
608
|
-
* Instruction to create a new document
|
|
609
|
-
* @beta
|
|
610
|
-
*/
|
|
611
|
-
declare interface CreateDocumentRequest<T extends Record<string, Any_2> = Record<string, Any_2>> {
|
|
612
|
-
createDocument: {
|
|
613
|
-
/** if no _id is provided, one will be generated. _id is always returned when the requests succeed */
|
|
614
|
-
_id?: string
|
|
615
|
-
_type: string
|
|
616
|
-
} & SanityDocumentStub_2<T>
|
|
617
|
-
}
|
|
618
|
-
|
|
619
584
|
/** @public */
|
|
620
585
|
export declare interface CurrentSanityUser {
|
|
621
586
|
id: string
|
|
@@ -767,19 +732,6 @@ export declare type DisconnectEvent = {
|
|
|
767
732
|
reason: string
|
|
768
733
|
}
|
|
769
734
|
|
|
770
|
-
/**
|
|
771
|
-
*
|
|
772
|
-
* Includes a LLM-friendly version of the document in the instruction
|
|
773
|
-
* @beta
|
|
774
|
-
* */
|
|
775
|
-
declare interface DocumentInstructionParam {
|
|
776
|
-
type: 'document'
|
|
777
|
-
/**
|
|
778
|
-
* If omitted, implicitly uses the documentId of the instruction target
|
|
779
|
-
*/
|
|
780
|
-
documentId?: string
|
|
781
|
-
}
|
|
782
|
-
|
|
783
735
|
/**
|
|
784
736
|
* Modifies an existing draft document.
|
|
785
737
|
* It applies the given patch to the document referenced by draftId.
|
|
@@ -822,14 +774,6 @@ export declare type EventSourceEvent<Name extends string> = ServerSentEvent<Name
|
|
|
822
774
|
*/
|
|
823
775
|
export declare type EventSourceInstance = InstanceType<typeof globalThis.EventSource>
|
|
824
776
|
|
|
825
|
-
/**
|
|
826
|
-
* Instruction for an existing document.
|
|
827
|
-
* @beta
|
|
828
|
-
*/
|
|
829
|
-
declare interface ExistingDocumentRequest {
|
|
830
|
-
documentId: string
|
|
831
|
-
}
|
|
832
|
-
|
|
833
777
|
/** @public */
|
|
834
778
|
export declare type FilterDefault = (props: {
|
|
835
779
|
/**
|
|
@@ -956,143 +900,6 @@ export declare type InsertPatch =
|
|
|
956
900
|
items: Any[]
|
|
957
901
|
}
|
|
958
902
|
|
|
959
|
-
/** @beta */
|
|
960
|
-
export declare type InstructAsyncInstruction<
|
|
961
|
-
T extends Record<string, Any_2> = Record<string, Any_2>,
|
|
962
|
-
> = (ExistingDocumentRequest | CreateDocumentRequest<T>) & InstructRequestBase & Async
|
|
963
|
-
|
|
964
|
-
/** @beta */
|
|
965
|
-
export declare interface InstructConstantInstructionParam {
|
|
966
|
-
type: 'constant'
|
|
967
|
-
value: string
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
/**
|
|
971
|
-
*
|
|
972
|
-
* Includes a LLM-friendly version of the field value in the instruction
|
|
973
|
-
* @beta
|
|
974
|
-
* */
|
|
975
|
-
export declare interface InstructFieldInstructionParam {
|
|
976
|
-
type: 'field'
|
|
977
|
-
/**
|
|
978
|
-
* Examples: 'title', 'array[_key=="key"].field'
|
|
979
|
-
*/
|
|
980
|
-
path: string
|
|
981
|
-
/**
|
|
982
|
-
* If omitted, implicitly uses the documentId of the instruction target
|
|
983
|
-
*/
|
|
984
|
-
documentId?: string
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
/**
|
|
988
|
-
* Includes a LLM-friendly version of GROQ query result in the instruction
|
|
989
|
-
* @beta
|
|
990
|
-
* */
|
|
991
|
-
export declare interface InstructGroqInstructionParam {
|
|
992
|
-
type: 'groq'
|
|
993
|
-
query: string
|
|
994
|
-
params?: Record<string, string>
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
/** @beta */
|
|
998
|
-
export declare type InstructInstruction<T extends Record<string, Any_2> = Record<string, Any_2>> =
|
|
999
|
-
| InstructSyncInstruction<T>
|
|
1000
|
-
| InstructAsyncInstruction<T>
|
|
1001
|
-
|
|
1002
|
-
/** @beta */
|
|
1003
|
-
export declare type InstructInstructionParam =
|
|
1004
|
-
| string
|
|
1005
|
-
| InstructConstantInstructionParam
|
|
1006
|
-
| InstructFieldInstructionParam
|
|
1007
|
-
| DocumentInstructionParam
|
|
1008
|
-
| InstructGroqInstructionParam
|
|
1009
|
-
|
|
1010
|
-
/** @beta */
|
|
1011
|
-
export declare type InstructInstructionParams = Record<string, InstructInstructionParam>
|
|
1012
|
-
|
|
1013
|
-
declare interface InstructRequestBase {
|
|
1014
|
-
/** schemaId as reported by sanity deploy / sanity schema store */
|
|
1015
|
-
schemaId: string
|
|
1016
|
-
/** string template using $variable – more on this below under "Dynamic instruction" */
|
|
1017
|
-
instruction: string
|
|
1018
|
-
/** param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable" */
|
|
1019
|
-
instructionParams?: InstructInstructionParams
|
|
1020
|
-
/**
|
|
1021
|
-
* Optional document path output target for the instruction.
|
|
1022
|
-
* When provided, the instruction will apply to this path in the document and its children.
|
|
1023
|
-
*
|
|
1024
|
-
* ## Examples
|
|
1025
|
-
* - `path: 'title'` will output to the title field in the document
|
|
1026
|
-
* - `path: 'array[_key="xx"]'` will output to the item with `_key: 'xx'` in the array field
|
|
1027
|
-
*/
|
|
1028
|
-
path?: string
|
|
1029
|
-
/**
|
|
1030
|
-
* Controls sub-paths in the document that can be output to.
|
|
1031
|
-
*
|
|
1032
|
-
* The string-paths are relative to the `path` param
|
|
1033
|
-
*
|
|
1034
|
-
* Note: these path strings are less strictly validated than the `path` param itself:
|
|
1035
|
-
* if an relative-path does not exist or is invalid, it will be silently ignored.
|
|
1036
|
-
*
|
|
1037
|
-
* @see InstructRequestBase#conditionalPaths
|
|
1038
|
-
* @see InstructRequestBase#outputTypes
|
|
1039
|
-
*/
|
|
1040
|
-
relativeOutputPaths?:
|
|
1041
|
-
| {
|
|
1042
|
-
include: string[]
|
|
1043
|
-
}
|
|
1044
|
-
| {
|
|
1045
|
-
exclude: string[]
|
|
1046
|
-
}
|
|
1047
|
-
/**
|
|
1048
|
-
* Controls which types the instruction is allowed to output to.
|
|
1049
|
-
*
|
|
1050
|
-
* @see InstructRequestBase#relativeOutputPaths
|
|
1051
|
-
* @see InstructRequestBase#conditionalPaths
|
|
1052
|
-
*/
|
|
1053
|
-
outputTypes?:
|
|
1054
|
-
| {
|
|
1055
|
-
include: string[]
|
|
1056
|
-
}
|
|
1057
|
-
| {
|
|
1058
|
-
exclude: string[]
|
|
1059
|
-
}
|
|
1060
|
-
/**
|
|
1061
|
-
* When a type or field in the schema has a function set for `hidden` or `readOnly`, it is conditional.
|
|
1062
|
-
*
|
|
1063
|
-
* By default, AI Instruct will not output to conditional `readOnly` and `hidden` fields,
|
|
1064
|
-
* ie, they are considered to resolve to `readOnly: true` / `hidden: true`.
|
|
1065
|
-
*
|
|
1066
|
-
* `conditionalPaths` param allows setting the default conditional value for
|
|
1067
|
-
* `hidden` and `readOnly` to false,
|
|
1068
|
-
* or individually set `hidden` and `readOnly` state for individual document paths.
|
|
1069
|
-
*
|
|
1070
|
-
*
|
|
1071
|
-
* Note: fields and types with explicit readOnly: true or hidden: true in the schema, are not available to AI Instruct,
|
|
1072
|
-
* and cannot be changed via conditionalPaths.
|
|
1073
|
-
*
|
|
1074
|
-
* conditionalPaths state only apply to fields and types that have conditional `hidden` or `readOnly` in their schema definition.
|
|
1075
|
-
*
|
|
1076
|
-
* @see InstructRequestBase#relativeOutputPaths
|
|
1077
|
-
* @see InstructRequestBase#outputTypes
|
|
1078
|
-
*/
|
|
1079
|
-
conditionalPaths?: {
|
|
1080
|
-
defaultReadOnly?: boolean
|
|
1081
|
-
defaultHidden?: boolean
|
|
1082
|
-
paths?: {
|
|
1083
|
-
/** path here is not a relative path: it must be the full document path, regardless of `path` param on the request itself */
|
|
1084
|
-
path: string
|
|
1085
|
-
readOnly: boolean
|
|
1086
|
-
hidden: boolean
|
|
1087
|
-
}[]
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
/** @beta */
|
|
1092
|
-
export declare type InstructSyncInstruction<
|
|
1093
|
-
T extends Record<string, Any_2> = Record<string, Any_2>,
|
|
1094
|
-
> = (ExistingDocumentRequest | CreateDocumentRequest<T>) & InstructRequestBase & Sync
|
|
1095
|
-
|
|
1096
903
|
/**
|
|
1097
904
|
* Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
|
|
1098
905
|
*
|
|
@@ -1453,18 +1260,6 @@ export declare type MutationSelectionQueryParams = {
|
|
|
1453
1260
|
[key: string]: Any
|
|
1454
1261
|
}
|
|
1455
1262
|
|
|
1456
|
-
/** @public */
|
|
1457
|
-
declare class ObservableAiClient {
|
|
1458
|
-
#private
|
|
1459
|
-
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
1460
|
-
instruct(request: InstructAsyncInstruction): Observable<{
|
|
1461
|
-
_id: string
|
|
1462
|
-
}>
|
|
1463
|
-
instruct<DocumentShape extends Record<string, Any>>(
|
|
1464
|
-
request: InstructSyncInstruction<DocumentShape>,
|
|
1465
|
-
): Observable<IdentifiedSanityDocumentStub & DocumentShape>
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
1263
|
/** @internal */
|
|
1469
1264
|
export declare class ObservableAssetsClient {
|
|
1470
1265
|
#private
|
|
@@ -1642,7 +1437,6 @@ export declare class ObservableSanityClient {
|
|
|
1642
1437
|
live: LiveClient
|
|
1643
1438
|
projects: ObservableProjectsClient
|
|
1644
1439
|
users: ObservableUsersClient
|
|
1645
|
-
ai: ObservableAiClient
|
|
1646
1440
|
/**
|
|
1647
1441
|
* Instance properties
|
|
1648
1442
|
*/
|
|
@@ -2562,7 +2356,6 @@ export declare class SanityClient {
|
|
|
2562
2356
|
live: LiveClient
|
|
2563
2357
|
projects: ProjectsClient
|
|
2564
2358
|
users: UsersClient
|
|
2565
|
-
ai: AiClient
|
|
2566
2359
|
/**
|
|
2567
2360
|
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
2568
2361
|
*/
|
|
@@ -3101,13 +2894,6 @@ export declare type SanityDocumentStub<T extends Record<string, Any> = Record<st
|
|
|
3101
2894
|
_type: string
|
|
3102
2895
|
}
|
|
3103
2896
|
|
|
3104
|
-
/** @public */
|
|
3105
|
-
declare type SanityDocumentStub_2<T extends Record<string, Any_2> = Record<string, Any_2>> = {
|
|
3106
|
-
[P in keyof T]: T[P]
|
|
3107
|
-
} & {
|
|
3108
|
-
_type: string
|
|
3109
|
-
}
|
|
3110
|
-
|
|
3111
2897
|
/** @internal */
|
|
3112
2898
|
export declare interface SanityImageAssetDocument extends SanityAssetDocument {
|
|
3113
2899
|
metadata: {
|
|
@@ -3284,29 +3070,6 @@ export {StudioBaseUrl}
|
|
|
3284
3070
|
|
|
3285
3071
|
export {StudioUrl}
|
|
3286
3072
|
|
|
3287
|
-
declare interface Sync {
|
|
3288
|
-
/**
|
|
3289
|
-
* By default, skipWrite: false.
|
|
3290
|
-
* Write enabled operations will mutate the target document, and emit AI presence in the studio.
|
|
3291
|
-
*
|
|
3292
|
-
* When skipWrite: true, the api will not mutate any documents nor emit presence.
|
|
3293
|
-
* Ie, when true, no changes will be made to content-lake
|
|
3294
|
-
*
|
|
3295
|
-
* skipWrite: true is incompatible with async: true,
|
|
3296
|
-
* as skipWrite implies that you will use the return value of the operation
|
|
3297
|
-
*/
|
|
3298
|
-
skipWrite?: boolean
|
|
3299
|
-
/**
|
|
3300
|
-
* When async: true, requests responds with status 201 and {_id} as response body as soon as the request is validated.
|
|
3301
|
-
* The instruction operation will carry on in the background.
|
|
3302
|
-
*
|
|
3303
|
-
* When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
|
|
3304
|
-
*
|
|
3305
|
-
* async: true is incompatible with skipWrite: true, as async: true does not return the resulting document
|
|
3306
|
-
*/
|
|
3307
|
-
async?: false
|
|
3308
|
-
}
|
|
3309
|
-
|
|
3310
3073
|
/** @public */
|
|
3311
3074
|
export declare type SyncTag = `s1:${string}`
|
|
3312
3075
|
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -39,18 +39,6 @@ export declare interface ActionErrorItem {
|
|
|
39
39
|
index: number
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
/** @public */
|
|
43
|
-
declare class AiClient {
|
|
44
|
-
#private
|
|
45
|
-
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
46
|
-
instruct(request: InstructAsyncInstruction): Promise<{
|
|
47
|
-
_id: string
|
|
48
|
-
}>
|
|
49
|
-
instruct<DocumentShape extends Record<string, Any>>(
|
|
50
|
-
request: InstructSyncInstruction<DocumentShape>,
|
|
51
|
-
): Promise<IdentifiedSanityDocumentStub & DocumentShape>
|
|
52
|
-
}
|
|
53
|
-
|
|
54
42
|
/** @internal */
|
|
55
43
|
export declare type AllDocumentIdsMutationOptions = BaseMutationOptions & {
|
|
56
44
|
returnFirst: false
|
|
@@ -69,12 +57,6 @@ export declare type AllDocumentsMutationOptions = BaseMutationOptions & {
|
|
|
69
57
|
*/
|
|
70
58
|
export declare type Any = any
|
|
71
59
|
|
|
72
|
-
/**
|
|
73
|
-
* Used to tag types that is set to `any` as a temporary measure, but should be replaced with proper typings in the future
|
|
74
|
-
* @internal
|
|
75
|
-
*/
|
|
76
|
-
declare type Any_2 = any
|
|
77
|
-
|
|
78
60
|
/** @internal */
|
|
79
61
|
export declare interface ApiError {
|
|
80
62
|
error: string
|
|
@@ -134,18 +116,6 @@ export declare class AssetsClient {
|
|
|
134
116
|
): Promise<SanityAssetDocument | SanityImageAssetDocument>
|
|
135
117
|
}
|
|
136
118
|
|
|
137
|
-
declare interface Async {
|
|
138
|
-
/**
|
|
139
|
-
* When async: true, requests responds with status 201 and {_id} as response body as soon as the request is validated.
|
|
140
|
-
* The instruction operation will carry on in the background.
|
|
141
|
-
*
|
|
142
|
-
* When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
|
|
143
|
-
*
|
|
144
|
-
* async: true is incompatible with skipWrite, as async: true does not return the resulting document
|
|
145
|
-
*/
|
|
146
|
-
async: true
|
|
147
|
-
}
|
|
148
|
-
|
|
149
119
|
/** @internal */
|
|
150
120
|
export declare type AttributeSet = {
|
|
151
121
|
[key: string]: Any
|
|
@@ -369,6 +339,8 @@ export declare interface ClientConfig {
|
|
|
369
339
|
/** @defaultValue true */
|
|
370
340
|
useCdn?: boolean
|
|
371
341
|
token?: string
|
|
342
|
+
/** @internal */
|
|
343
|
+
'~experimental_resource'?: ClientConfigResource
|
|
372
344
|
/**
|
|
373
345
|
* What perspective to use for the client. See {@link https://www.sanity.io/docs/perspectives|perspective documentation}
|
|
374
346
|
* @remarks
|
|
@@ -429,6 +401,11 @@ export declare interface ClientConfig {
|
|
|
429
401
|
stega?: StegaConfig | boolean
|
|
430
402
|
}
|
|
431
403
|
|
|
404
|
+
declare type ClientConfigResource = {
|
|
405
|
+
type: string
|
|
406
|
+
id: string
|
|
407
|
+
}
|
|
408
|
+
|
|
432
409
|
/** @public */
|
|
433
410
|
export declare class ClientError extends Error {
|
|
434
411
|
response: ErrorProps['response']
|
|
@@ -604,18 +581,6 @@ export declare type CreateAction = {
|
|
|
604
581
|
/** @public */
|
|
605
582
|
export declare const createClient: (config: ClientConfig) => SanityClient
|
|
606
583
|
|
|
607
|
-
/**
|
|
608
|
-
* Instruction to create a new document
|
|
609
|
-
* @beta
|
|
610
|
-
*/
|
|
611
|
-
declare interface CreateDocumentRequest<T extends Record<string, Any_2> = Record<string, Any_2>> {
|
|
612
|
-
createDocument: {
|
|
613
|
-
/** if no _id is provided, one will be generated. _id is always returned when the requests succeed */
|
|
614
|
-
_id?: string
|
|
615
|
-
_type: string
|
|
616
|
-
} & SanityDocumentStub_2<T>
|
|
617
|
-
}
|
|
618
|
-
|
|
619
584
|
/** @public */
|
|
620
585
|
export declare interface CurrentSanityUser {
|
|
621
586
|
id: string
|
|
@@ -767,19 +732,6 @@ export declare type DisconnectEvent = {
|
|
|
767
732
|
reason: string
|
|
768
733
|
}
|
|
769
734
|
|
|
770
|
-
/**
|
|
771
|
-
*
|
|
772
|
-
* Includes a LLM-friendly version of the document in the instruction
|
|
773
|
-
* @beta
|
|
774
|
-
* */
|
|
775
|
-
declare interface DocumentInstructionParam {
|
|
776
|
-
type: 'document'
|
|
777
|
-
/**
|
|
778
|
-
* If omitted, implicitly uses the documentId of the instruction target
|
|
779
|
-
*/
|
|
780
|
-
documentId?: string
|
|
781
|
-
}
|
|
782
|
-
|
|
783
735
|
/**
|
|
784
736
|
* Modifies an existing draft document.
|
|
785
737
|
* It applies the given patch to the document referenced by draftId.
|
|
@@ -822,14 +774,6 @@ export declare type EventSourceEvent<Name extends string> = ServerSentEvent<Name
|
|
|
822
774
|
*/
|
|
823
775
|
export declare type EventSourceInstance = InstanceType<typeof globalThis.EventSource>
|
|
824
776
|
|
|
825
|
-
/**
|
|
826
|
-
* Instruction for an existing document.
|
|
827
|
-
* @beta
|
|
828
|
-
*/
|
|
829
|
-
declare interface ExistingDocumentRequest {
|
|
830
|
-
documentId: string
|
|
831
|
-
}
|
|
832
|
-
|
|
833
777
|
/** @public */
|
|
834
778
|
export declare type FilterDefault = (props: {
|
|
835
779
|
/**
|
|
@@ -956,143 +900,6 @@ export declare type InsertPatch =
|
|
|
956
900
|
items: Any[]
|
|
957
901
|
}
|
|
958
902
|
|
|
959
|
-
/** @beta */
|
|
960
|
-
export declare type InstructAsyncInstruction<
|
|
961
|
-
T extends Record<string, Any_2> = Record<string, Any_2>,
|
|
962
|
-
> = (ExistingDocumentRequest | CreateDocumentRequest<T>) & InstructRequestBase & Async
|
|
963
|
-
|
|
964
|
-
/** @beta */
|
|
965
|
-
export declare interface InstructConstantInstructionParam {
|
|
966
|
-
type: 'constant'
|
|
967
|
-
value: string
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
/**
|
|
971
|
-
*
|
|
972
|
-
* Includes a LLM-friendly version of the field value in the instruction
|
|
973
|
-
* @beta
|
|
974
|
-
* */
|
|
975
|
-
export declare interface InstructFieldInstructionParam {
|
|
976
|
-
type: 'field'
|
|
977
|
-
/**
|
|
978
|
-
* Examples: 'title', 'array[_key=="key"].field'
|
|
979
|
-
*/
|
|
980
|
-
path: string
|
|
981
|
-
/**
|
|
982
|
-
* If omitted, implicitly uses the documentId of the instruction target
|
|
983
|
-
*/
|
|
984
|
-
documentId?: string
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
/**
|
|
988
|
-
* Includes a LLM-friendly version of GROQ query result in the instruction
|
|
989
|
-
* @beta
|
|
990
|
-
* */
|
|
991
|
-
export declare interface InstructGroqInstructionParam {
|
|
992
|
-
type: 'groq'
|
|
993
|
-
query: string
|
|
994
|
-
params?: Record<string, string>
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
/** @beta */
|
|
998
|
-
export declare type InstructInstruction<T extends Record<string, Any_2> = Record<string, Any_2>> =
|
|
999
|
-
| InstructSyncInstruction<T>
|
|
1000
|
-
| InstructAsyncInstruction<T>
|
|
1001
|
-
|
|
1002
|
-
/** @beta */
|
|
1003
|
-
export declare type InstructInstructionParam =
|
|
1004
|
-
| string
|
|
1005
|
-
| InstructConstantInstructionParam
|
|
1006
|
-
| InstructFieldInstructionParam
|
|
1007
|
-
| DocumentInstructionParam
|
|
1008
|
-
| InstructGroqInstructionParam
|
|
1009
|
-
|
|
1010
|
-
/** @beta */
|
|
1011
|
-
export declare type InstructInstructionParams = Record<string, InstructInstructionParam>
|
|
1012
|
-
|
|
1013
|
-
declare interface InstructRequestBase {
|
|
1014
|
-
/** schemaId as reported by sanity deploy / sanity schema store */
|
|
1015
|
-
schemaId: string
|
|
1016
|
-
/** string template using $variable – more on this below under "Dynamic instruction" */
|
|
1017
|
-
instruction: string
|
|
1018
|
-
/** param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable" */
|
|
1019
|
-
instructionParams?: InstructInstructionParams
|
|
1020
|
-
/**
|
|
1021
|
-
* Optional document path output target for the instruction.
|
|
1022
|
-
* When provided, the instruction will apply to this path in the document and its children.
|
|
1023
|
-
*
|
|
1024
|
-
* ## Examples
|
|
1025
|
-
* - `path: 'title'` will output to the title field in the document
|
|
1026
|
-
* - `path: 'array[_key="xx"]'` will output to the item with `_key: 'xx'` in the array field
|
|
1027
|
-
*/
|
|
1028
|
-
path?: string
|
|
1029
|
-
/**
|
|
1030
|
-
* Controls sub-paths in the document that can be output to.
|
|
1031
|
-
*
|
|
1032
|
-
* The string-paths are relative to the `path` param
|
|
1033
|
-
*
|
|
1034
|
-
* Note: these path strings are less strictly validated than the `path` param itself:
|
|
1035
|
-
* if an relative-path does not exist or is invalid, it will be silently ignored.
|
|
1036
|
-
*
|
|
1037
|
-
* @see InstructRequestBase#conditionalPaths
|
|
1038
|
-
* @see InstructRequestBase#outputTypes
|
|
1039
|
-
*/
|
|
1040
|
-
relativeOutputPaths?:
|
|
1041
|
-
| {
|
|
1042
|
-
include: string[]
|
|
1043
|
-
}
|
|
1044
|
-
| {
|
|
1045
|
-
exclude: string[]
|
|
1046
|
-
}
|
|
1047
|
-
/**
|
|
1048
|
-
* Controls which types the instruction is allowed to output to.
|
|
1049
|
-
*
|
|
1050
|
-
* @see InstructRequestBase#relativeOutputPaths
|
|
1051
|
-
* @see InstructRequestBase#conditionalPaths
|
|
1052
|
-
*/
|
|
1053
|
-
outputTypes?:
|
|
1054
|
-
| {
|
|
1055
|
-
include: string[]
|
|
1056
|
-
}
|
|
1057
|
-
| {
|
|
1058
|
-
exclude: string[]
|
|
1059
|
-
}
|
|
1060
|
-
/**
|
|
1061
|
-
* When a type or field in the schema has a function set for `hidden` or `readOnly`, it is conditional.
|
|
1062
|
-
*
|
|
1063
|
-
* By default, AI Instruct will not output to conditional `readOnly` and `hidden` fields,
|
|
1064
|
-
* ie, they are considered to resolve to `readOnly: true` / `hidden: true`.
|
|
1065
|
-
*
|
|
1066
|
-
* `conditionalPaths` param allows setting the default conditional value for
|
|
1067
|
-
* `hidden` and `readOnly` to false,
|
|
1068
|
-
* or individually set `hidden` and `readOnly` state for individual document paths.
|
|
1069
|
-
*
|
|
1070
|
-
*
|
|
1071
|
-
* Note: fields and types with explicit readOnly: true or hidden: true in the schema, are not available to AI Instruct,
|
|
1072
|
-
* and cannot be changed via conditionalPaths.
|
|
1073
|
-
*
|
|
1074
|
-
* conditionalPaths state only apply to fields and types that have conditional `hidden` or `readOnly` in their schema definition.
|
|
1075
|
-
*
|
|
1076
|
-
* @see InstructRequestBase#relativeOutputPaths
|
|
1077
|
-
* @see InstructRequestBase#outputTypes
|
|
1078
|
-
*/
|
|
1079
|
-
conditionalPaths?: {
|
|
1080
|
-
defaultReadOnly?: boolean
|
|
1081
|
-
defaultHidden?: boolean
|
|
1082
|
-
paths?: {
|
|
1083
|
-
/** path here is not a relative path: it must be the full document path, regardless of `path` param on the request itself */
|
|
1084
|
-
path: string
|
|
1085
|
-
readOnly: boolean
|
|
1086
|
-
hidden: boolean
|
|
1087
|
-
}[]
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
/** @beta */
|
|
1092
|
-
export declare type InstructSyncInstruction<
|
|
1093
|
-
T extends Record<string, Any_2> = Record<string, Any_2>,
|
|
1094
|
-
> = (ExistingDocumentRequest | CreateDocumentRequest<T>) & InstructRequestBase & Sync
|
|
1095
|
-
|
|
1096
903
|
/**
|
|
1097
904
|
* Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
|
|
1098
905
|
*
|
|
@@ -1453,18 +1260,6 @@ export declare type MutationSelectionQueryParams = {
|
|
|
1453
1260
|
[key: string]: Any
|
|
1454
1261
|
}
|
|
1455
1262
|
|
|
1456
|
-
/** @public */
|
|
1457
|
-
declare class ObservableAiClient {
|
|
1458
|
-
#private
|
|
1459
|
-
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
1460
|
-
instruct(request: InstructAsyncInstruction): Observable<{
|
|
1461
|
-
_id: string
|
|
1462
|
-
}>
|
|
1463
|
-
instruct<DocumentShape extends Record<string, Any>>(
|
|
1464
|
-
request: InstructSyncInstruction<DocumentShape>,
|
|
1465
|
-
): Observable<IdentifiedSanityDocumentStub & DocumentShape>
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
1263
|
/** @internal */
|
|
1469
1264
|
export declare class ObservableAssetsClient {
|
|
1470
1265
|
#private
|
|
@@ -1642,7 +1437,6 @@ export declare class ObservableSanityClient {
|
|
|
1642
1437
|
live: LiveClient
|
|
1643
1438
|
projects: ObservableProjectsClient
|
|
1644
1439
|
users: ObservableUsersClient
|
|
1645
|
-
ai: ObservableAiClient
|
|
1646
1440
|
/**
|
|
1647
1441
|
* Instance properties
|
|
1648
1442
|
*/
|
|
@@ -2562,7 +2356,6 @@ export declare class SanityClient {
|
|
|
2562
2356
|
live: LiveClient
|
|
2563
2357
|
projects: ProjectsClient
|
|
2564
2358
|
users: UsersClient
|
|
2565
|
-
ai: AiClient
|
|
2566
2359
|
/**
|
|
2567
2360
|
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
2568
2361
|
*/
|
|
@@ -3101,13 +2894,6 @@ export declare type SanityDocumentStub<T extends Record<string, Any> = Record<st
|
|
|
3101
2894
|
_type: string
|
|
3102
2895
|
}
|
|
3103
2896
|
|
|
3104
|
-
/** @public */
|
|
3105
|
-
declare type SanityDocumentStub_2<T extends Record<string, Any_2> = Record<string, Any_2>> = {
|
|
3106
|
-
[P in keyof T]: T[P]
|
|
3107
|
-
} & {
|
|
3108
|
-
_type: string
|
|
3109
|
-
}
|
|
3110
|
-
|
|
3111
2897
|
/** @internal */
|
|
3112
2898
|
export declare interface SanityImageAssetDocument extends SanityAssetDocument {
|
|
3113
2899
|
metadata: {
|
|
@@ -3284,29 +3070,6 @@ export {StudioBaseUrl}
|
|
|
3284
3070
|
|
|
3285
3071
|
export {StudioUrl}
|
|
3286
3072
|
|
|
3287
|
-
declare interface Sync {
|
|
3288
|
-
/**
|
|
3289
|
-
* By default, skipWrite: false.
|
|
3290
|
-
* Write enabled operations will mutate the target document, and emit AI presence in the studio.
|
|
3291
|
-
*
|
|
3292
|
-
* When skipWrite: true, the api will not mutate any documents nor emit presence.
|
|
3293
|
-
* Ie, when true, no changes will be made to content-lake
|
|
3294
|
-
*
|
|
3295
|
-
* skipWrite: true is incompatible with async: true,
|
|
3296
|
-
* as skipWrite implies that you will use the return value of the operation
|
|
3297
|
-
*/
|
|
3298
|
-
skipWrite?: boolean
|
|
3299
|
-
/**
|
|
3300
|
-
* When async: true, requests responds with status 201 and {_id} as response body as soon as the request is validated.
|
|
3301
|
-
* The instruction operation will carry on in the background.
|
|
3302
|
-
*
|
|
3303
|
-
* When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
|
|
3304
|
-
*
|
|
3305
|
-
* async: true is incompatible with skipWrite: true, as async: true does not return the resulting document
|
|
3306
|
-
*/
|
|
3307
|
-
async?: false
|
|
3308
|
-
}
|
|
3309
|
-
|
|
3310
3073
|
/** @public */
|
|
3311
3074
|
export declare type SyncTag = `s1:${string}`
|
|
3312
3075
|
|