@sanity/client 6.28.0-instruct.0 → 6.28.0-resources-projects.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 +20 -2
- package/dist/_chunks-cjs/config.cjs.map +1 -1
- package/dist/_chunks-es/config.js +20 -2
- package/dist/_chunks-es/config.js.map +1 -1
- package/dist/index.browser.cjs +61 -49
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +13 -215
- package/dist/index.browser.d.ts +13 -215
- package/dist/index.browser.js +61 -49
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +42 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -204
- package/dist/index.d.ts +13 -204
- package/dist/index.js +42 -48
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +13 -209
- package/dist/stega.browser.d.ts +13 -209
- package/dist/stega.d.cts +13 -209
- package/dist/stega.d.ts +13 -209
- package/package.json +1 -1
- package/src/SanityClient.ts +10 -7
- package/src/assets/AssetsClient.ts +6 -2
- package/src/config.ts +31 -0
- package/src/data/dataMethods.ts +48 -4
- package/src/datasets/DatasetsClient.ts +22 -0
- package/src/types.ts +7 -10
- package/umd/sanityClient.js +61 -49
- package/umd/sanityClient.min.js +2 -2
- package/src/assist/AssistClient.ts +0 -87
- package/src/assist/types.ts +0 -178
package/dist/index.browser.d.cts
CHANGED
|
@@ -57,12 +57,6 @@ export declare type AllDocumentsMutationOptions = BaseMutationOptions & {
|
|
|
57
57
|
*/
|
|
58
58
|
export declare type Any = any
|
|
59
59
|
|
|
60
|
-
/**
|
|
61
|
-
* Used to tag types that is set to `any` as a temporary measure, but should be replaced with proper typings in the future
|
|
62
|
-
* @internal
|
|
63
|
-
*/
|
|
64
|
-
declare type Any_2 = any
|
|
65
|
-
|
|
66
60
|
/** @internal */
|
|
67
61
|
export declare interface ApiError {
|
|
68
62
|
error: string
|
|
@@ -122,122 +116,6 @@ export declare class AssetsClient {
|
|
|
122
116
|
): Promise<SanityAssetDocument | SanityImageAssetDocument>
|
|
123
117
|
}
|
|
124
118
|
|
|
125
|
-
/** @beta */
|
|
126
|
-
export declare type AssistAsyncInstruction<
|
|
127
|
-
T extends Record<string, Any_2> = Record<string, Any_2>,
|
|
128
|
-
> = (ExistingDocumentRequest | CreateDocumentRequest<T>) & AssistRequestBase & Async
|
|
129
|
-
|
|
130
|
-
/** @public */
|
|
131
|
-
declare class AssistClient {
|
|
132
|
-
#private
|
|
133
|
-
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
134
|
-
instruct(request: AssistAsyncInstruction): Promise<{
|
|
135
|
-
_id: string
|
|
136
|
-
}>
|
|
137
|
-
instruct<DocumentShape extends Record<string, Any>>(
|
|
138
|
-
request: AssistSyncInstruction<DocumentShape>,
|
|
139
|
-
): Promise<IdentifiedSanityDocumentStub & DocumentShape>
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/** @beta */
|
|
143
|
-
export declare type AssistInstruction<T extends Record<string, Any_2> = Record<string, Any_2>> =
|
|
144
|
-
| AssistSyncInstruction<T>
|
|
145
|
-
| AssistAsyncInstruction<T>
|
|
146
|
-
|
|
147
|
-
declare interface AssistRequestBase {
|
|
148
|
-
/** schemaId as reported by sanity deploy / sanity schema store */
|
|
149
|
-
schemaId: string
|
|
150
|
-
/** string template using $variable – more on this below under "Dynamic instruction" */
|
|
151
|
-
instruction: string
|
|
152
|
-
/** param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable" */
|
|
153
|
-
instructionParams?: InstructionParams
|
|
154
|
-
/**
|
|
155
|
-
* Optional document path output target for the instruction.
|
|
156
|
-
* When provided, the instruction will apply to this path in the document and its children.
|
|
157
|
-
*
|
|
158
|
-
* ## Examples
|
|
159
|
-
* - `path: 'title'` will output to the title field in the document
|
|
160
|
-
* - `path: 'array[_key="xx"]'` will output to the item with `_key: 'xx'` in the array field
|
|
161
|
-
*/
|
|
162
|
-
path?: string
|
|
163
|
-
/**
|
|
164
|
-
* Controls sub-paths in the document that can be output to.
|
|
165
|
-
*
|
|
166
|
-
* The string-paths are relative to the `path` param
|
|
167
|
-
*
|
|
168
|
-
* Note: these path strings are less strictly validated than the `path` param itself:
|
|
169
|
-
* if an relative-path does not exist or is invalid, it will be silently ignored.
|
|
170
|
-
*
|
|
171
|
-
* @see AssistRequestBase#conditionalPaths
|
|
172
|
-
* @see AssistRequestBase#outputTypes
|
|
173
|
-
*/
|
|
174
|
-
relativeOutputPaths?:
|
|
175
|
-
| {
|
|
176
|
-
include: string[]
|
|
177
|
-
}
|
|
178
|
-
| {
|
|
179
|
-
exclude: string[]
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Controls which types the instruction is allowed to output to.
|
|
183
|
-
*
|
|
184
|
-
* @see AssistRequestBase#relativeOutputPaths
|
|
185
|
-
* @see AssistRequestBase#conditionalPaths
|
|
186
|
-
*/
|
|
187
|
-
outputTypes?:
|
|
188
|
-
| {
|
|
189
|
-
include: string[]
|
|
190
|
-
}
|
|
191
|
-
| {
|
|
192
|
-
exclude: string[]
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* When a type or field in the schema has a function set for `hidden` or `readOnly`, it is conditional.
|
|
196
|
-
*
|
|
197
|
-
* By default, AI Assist will not output to conditional `readOnly` and `hidden` fields,
|
|
198
|
-
* ie, they are considered to resolve to `readOnly: true` / `hidden: true`.
|
|
199
|
-
*
|
|
200
|
-
* `conditionalPaths` param allows setting the default conditional value for
|
|
201
|
-
* `hidden` and `readOnly` to false,
|
|
202
|
-
* or individually set `hidden` and `readOnly` state for individual document paths.
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
* Note: fields and types with explicit readOnly: true or hidden: true in the schema, are not available to AI Assist,
|
|
206
|
-
* and cannot be changed via conditionalPaths.
|
|
207
|
-
*
|
|
208
|
-
* conditionalPaths state only apply to fields and types that have conditional `hidden` or `readOnly` in their schema definition.
|
|
209
|
-
*
|
|
210
|
-
* @see AssistRequestBase#relativeOutputPaths
|
|
211
|
-
* @see AssistRequestBase#outputTypes
|
|
212
|
-
*/
|
|
213
|
-
conditionalPaths?: {
|
|
214
|
-
defaultReadOnly?: boolean
|
|
215
|
-
defaultHidden?: boolean
|
|
216
|
-
paths?: {
|
|
217
|
-
/** path here is not a relative path: it must be the full document path, regardless of `path` param on the request itself */
|
|
218
|
-
path: string
|
|
219
|
-
readOnly: boolean
|
|
220
|
-
hidden: boolean
|
|
221
|
-
}[]
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/** @beta */
|
|
226
|
-
export declare type AssistSyncInstruction<T extends Record<string, Any_2> = Record<string, Any_2>> =
|
|
227
|
-
(ExistingDocumentRequest | CreateDocumentRequest<T>) & AssistRequestBase & Sync
|
|
228
|
-
|
|
229
|
-
declare interface Async {
|
|
230
|
-
/**
|
|
231
|
-
* When async: true, requests responds with status 201 and {_id} as response body as soon as the request is validated.
|
|
232
|
-
* The instruction operation will carry on in the background.
|
|
233
|
-
*
|
|
234
|
-
* When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
|
|
235
|
-
*
|
|
236
|
-
* async: true is incompatible with skipWrite, as async: true does not return the resulting document
|
|
237
|
-
*/
|
|
238
|
-
async: true
|
|
239
|
-
}
|
|
240
|
-
|
|
241
119
|
/** @internal */
|
|
242
120
|
export declare type AttributeSet = {
|
|
243
121
|
[key: string]: Any
|
|
@@ -510,6 +388,19 @@ export declare interface ClientConfig {
|
|
|
510
388
|
* Options for how, if enabled, Content Source Maps are encoded into query results using steganography
|
|
511
389
|
*/
|
|
512
390
|
stega?: StegaConfig | boolean
|
|
391
|
+
/**
|
|
392
|
+
* @deprecated Don't use
|
|
393
|
+
*/
|
|
394
|
+
experimental_resource?:
|
|
395
|
+
| {
|
|
396
|
+
type: 'projects'
|
|
397
|
+
id: string
|
|
398
|
+
dataset: string
|
|
399
|
+
}
|
|
400
|
+
| {
|
|
401
|
+
type: string
|
|
402
|
+
id: string
|
|
403
|
+
}
|
|
513
404
|
}
|
|
514
405
|
|
|
515
406
|
/** @public */
|
|
@@ -568,12 +459,6 @@ export declare class ConnectionFailedError extends Error {
|
|
|
568
459
|
readonly name = 'ConnectionFailedError'
|
|
569
460
|
}
|
|
570
461
|
|
|
571
|
-
/** @beta */
|
|
572
|
-
export declare interface ConstantInstructionParam {
|
|
573
|
-
type: 'constant'
|
|
574
|
-
value: string
|
|
575
|
-
}
|
|
576
|
-
|
|
577
462
|
/** @public */
|
|
578
463
|
export declare interface ContentSourceMap {
|
|
579
464
|
mappings: ContentSourceMapMappings
|
|
@@ -693,18 +578,6 @@ export declare type CreateAction = {
|
|
|
693
578
|
/** @public */
|
|
694
579
|
export declare const createClient: (config: ClientConfig) => SanityClient
|
|
695
580
|
|
|
696
|
-
/**
|
|
697
|
-
* Instruction to create a new document
|
|
698
|
-
* @beta
|
|
699
|
-
*/
|
|
700
|
-
declare interface CreateDocumentRequest<T extends Record<string, Any_2> = Record<string, Any_2>> {
|
|
701
|
-
createDocument: {
|
|
702
|
-
/** if no _id is provided, one will be generated. _id is always returned when the requests succeed */
|
|
703
|
-
_id?: string
|
|
704
|
-
_type: string
|
|
705
|
-
} & SanityDocumentStub_2<T>
|
|
706
|
-
}
|
|
707
|
-
|
|
708
581
|
/** @internal */
|
|
709
582
|
export declare interface CurrentSanityUser {
|
|
710
583
|
id: string
|
|
@@ -898,20 +771,6 @@ export declare type EventSourceEvent<Name extends string> = ServerSentEvent<Name
|
|
|
898
771
|
*/
|
|
899
772
|
export declare type EventSourceInstance = InstanceType<typeof globalThis.EventSource>
|
|
900
773
|
|
|
901
|
-
/**
|
|
902
|
-
* Instruction for an existing document.
|
|
903
|
-
* @beta
|
|
904
|
-
*/
|
|
905
|
-
declare interface ExistingDocumentRequest {
|
|
906
|
-
documentId: string
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
/** @beta */
|
|
910
|
-
export declare interface FieldInstructionParam {
|
|
911
|
-
type: 'field'
|
|
912
|
-
path: string
|
|
913
|
-
}
|
|
914
|
-
|
|
915
774
|
/** @public */
|
|
916
775
|
export declare type FilterDefault = (props: {
|
|
917
776
|
/**
|
|
@@ -978,13 +837,6 @@ export declare type FirstDocumentMutationOptions = BaseMutationOptions & {
|
|
|
978
837
|
returnDocuments?: true
|
|
979
838
|
}
|
|
980
839
|
|
|
981
|
-
/** @beta */
|
|
982
|
-
export declare interface GroqInstructionParam {
|
|
983
|
-
type: 'groq'
|
|
984
|
-
query: string
|
|
985
|
-
params?: Record<string, string>
|
|
986
|
-
}
|
|
987
|
-
|
|
988
840
|
/** @public */
|
|
989
841
|
export declare type HttpRequest = {
|
|
990
842
|
(options: RequestOptions, requester: Requester): ReturnType<Requester>
|
|
@@ -1045,16 +897,6 @@ export declare type InsertPatch =
|
|
|
1045
897
|
items: Any[]
|
|
1046
898
|
}
|
|
1047
899
|
|
|
1048
|
-
/** @beta */
|
|
1049
|
-
export declare type InstructionParam =
|
|
1050
|
-
| string
|
|
1051
|
-
| ConstantInstructionParam
|
|
1052
|
-
| FieldInstructionParam
|
|
1053
|
-
| GroqInstructionParam
|
|
1054
|
-
|
|
1055
|
-
/** @beta */
|
|
1056
|
-
export declare type InstructionParams = Record<string, InstructionParam>
|
|
1057
|
-
|
|
1058
900
|
/**
|
|
1059
901
|
* Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
|
|
1060
902
|
*
|
|
@@ -1464,18 +1306,6 @@ export declare class ObservableAssetsClient {
|
|
|
1464
1306
|
>
|
|
1465
1307
|
}
|
|
1466
1308
|
|
|
1467
|
-
/** @public */
|
|
1468
|
-
declare class ObservableAssistClient {
|
|
1469
|
-
#private
|
|
1470
|
-
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
1471
|
-
instruct(request: AssistAsyncInstruction): Observable<{
|
|
1472
|
-
_id: string
|
|
1473
|
-
}>
|
|
1474
|
-
instruct<DocumentShape extends Record<string, Any>>(
|
|
1475
|
-
request: AssistSyncInstruction<DocumentShape>,
|
|
1476
|
-
): Observable<IdentifiedSanityDocumentStub & DocumentShape>
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
1309
|
/** @internal */
|
|
1480
1310
|
export declare class ObservableDatasetsClient {
|
|
1481
1311
|
#private
|
|
@@ -1599,7 +1429,6 @@ export declare class ObservableSanityClient {
|
|
|
1599
1429
|
live: LiveClient
|
|
1600
1430
|
projects: ObservableProjectsClient
|
|
1601
1431
|
users: ObservableUsersClient
|
|
1602
|
-
assist: ObservableAssistClient
|
|
1603
1432
|
/**
|
|
1604
1433
|
* Instance properties
|
|
1605
1434
|
*/
|
|
@@ -2519,7 +2348,6 @@ export declare class SanityClient {
|
|
|
2519
2348
|
live: LiveClient
|
|
2520
2349
|
projects: ProjectsClient
|
|
2521
2350
|
users: UsersClient
|
|
2522
|
-
assist: AssistClient
|
|
2523
2351
|
/**
|
|
2524
2352
|
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
2525
2353
|
*/
|
|
@@ -3058,13 +2886,6 @@ export declare type SanityDocumentStub<T extends Record<string, Any> = Record<st
|
|
|
3058
2886
|
_type: string
|
|
3059
2887
|
}
|
|
3060
2888
|
|
|
3061
|
-
/** @public */
|
|
3062
|
-
declare type SanityDocumentStub_2<T extends Record<string, Any_2> = Record<string, Any_2>> = {
|
|
3063
|
-
[P in keyof T]: T[P]
|
|
3064
|
-
} & {
|
|
3065
|
-
_type: string
|
|
3066
|
-
}
|
|
3067
|
-
|
|
3068
2889
|
/** @internal */
|
|
3069
2890
|
export declare interface SanityImageAssetDocument extends SanityAssetDocument {
|
|
3070
2891
|
metadata: {
|
|
@@ -3241,29 +3062,6 @@ export {StudioBaseUrl}
|
|
|
3241
3062
|
|
|
3242
3063
|
export {StudioUrl}
|
|
3243
3064
|
|
|
3244
|
-
declare interface Sync {
|
|
3245
|
-
/**
|
|
3246
|
-
* By default, skipWrite: false.
|
|
3247
|
-
* Write enabled operations will mutate the target document, and emit AI presence in the studio.
|
|
3248
|
-
*
|
|
3249
|
-
* When skipWrite: true, the api will not mutate any documents nor emit presence.
|
|
3250
|
-
* Ie, when true, no changes will be made to content-lake
|
|
3251
|
-
*
|
|
3252
|
-
* skipWrite: true is incompatible with async: true,
|
|
3253
|
-
* as skipWrite implies that you will use the return value of the operation
|
|
3254
|
-
*/
|
|
3255
|
-
skipWrite?: boolean
|
|
3256
|
-
/**
|
|
3257
|
-
* When async: true, requests responds with status 201 and {_id} as response body as soon as the request is validated.
|
|
3258
|
-
* The instruction operation will carry on in the background.
|
|
3259
|
-
*
|
|
3260
|
-
* When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
|
|
3261
|
-
*
|
|
3262
|
-
* async: true is incompatible with skipWrite: true, as async: true does not return the resulting document
|
|
3263
|
-
*/
|
|
3264
|
-
async?: false
|
|
3265
|
-
}
|
|
3266
|
-
|
|
3267
3065
|
/** @public */
|
|
3268
3066
|
export declare type SyncTag = `s1:${string}`
|
|
3269
3067
|
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -57,12 +57,6 @@ export declare type AllDocumentsMutationOptions = BaseMutationOptions & {
|
|
|
57
57
|
*/
|
|
58
58
|
export declare type Any = any
|
|
59
59
|
|
|
60
|
-
/**
|
|
61
|
-
* Used to tag types that is set to `any` as a temporary measure, but should be replaced with proper typings in the future
|
|
62
|
-
* @internal
|
|
63
|
-
*/
|
|
64
|
-
declare type Any_2 = any
|
|
65
|
-
|
|
66
60
|
/** @internal */
|
|
67
61
|
export declare interface ApiError {
|
|
68
62
|
error: string
|
|
@@ -122,122 +116,6 @@ export declare class AssetsClient {
|
|
|
122
116
|
): Promise<SanityAssetDocument | SanityImageAssetDocument>
|
|
123
117
|
}
|
|
124
118
|
|
|
125
|
-
/** @beta */
|
|
126
|
-
export declare type AssistAsyncInstruction<
|
|
127
|
-
T extends Record<string, Any_2> = Record<string, Any_2>,
|
|
128
|
-
> = (ExistingDocumentRequest | CreateDocumentRequest<T>) & AssistRequestBase & Async
|
|
129
|
-
|
|
130
|
-
/** @public */
|
|
131
|
-
declare class AssistClient {
|
|
132
|
-
#private
|
|
133
|
-
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
134
|
-
instruct(request: AssistAsyncInstruction): Promise<{
|
|
135
|
-
_id: string
|
|
136
|
-
}>
|
|
137
|
-
instruct<DocumentShape extends Record<string, Any>>(
|
|
138
|
-
request: AssistSyncInstruction<DocumentShape>,
|
|
139
|
-
): Promise<IdentifiedSanityDocumentStub & DocumentShape>
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/** @beta */
|
|
143
|
-
export declare type AssistInstruction<T extends Record<string, Any_2> = Record<string, Any_2>> =
|
|
144
|
-
| AssistSyncInstruction<T>
|
|
145
|
-
| AssistAsyncInstruction<T>
|
|
146
|
-
|
|
147
|
-
declare interface AssistRequestBase {
|
|
148
|
-
/** schemaId as reported by sanity deploy / sanity schema store */
|
|
149
|
-
schemaId: string
|
|
150
|
-
/** string template using $variable – more on this below under "Dynamic instruction" */
|
|
151
|
-
instruction: string
|
|
152
|
-
/** param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable" */
|
|
153
|
-
instructionParams?: InstructionParams
|
|
154
|
-
/**
|
|
155
|
-
* Optional document path output target for the instruction.
|
|
156
|
-
* When provided, the instruction will apply to this path in the document and its children.
|
|
157
|
-
*
|
|
158
|
-
* ## Examples
|
|
159
|
-
* - `path: 'title'` will output to the title field in the document
|
|
160
|
-
* - `path: 'array[_key="xx"]'` will output to the item with `_key: 'xx'` in the array field
|
|
161
|
-
*/
|
|
162
|
-
path?: string
|
|
163
|
-
/**
|
|
164
|
-
* Controls sub-paths in the document that can be output to.
|
|
165
|
-
*
|
|
166
|
-
* The string-paths are relative to the `path` param
|
|
167
|
-
*
|
|
168
|
-
* Note: these path strings are less strictly validated than the `path` param itself:
|
|
169
|
-
* if an relative-path does not exist or is invalid, it will be silently ignored.
|
|
170
|
-
*
|
|
171
|
-
* @see AssistRequestBase#conditionalPaths
|
|
172
|
-
* @see AssistRequestBase#outputTypes
|
|
173
|
-
*/
|
|
174
|
-
relativeOutputPaths?:
|
|
175
|
-
| {
|
|
176
|
-
include: string[]
|
|
177
|
-
}
|
|
178
|
-
| {
|
|
179
|
-
exclude: string[]
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Controls which types the instruction is allowed to output to.
|
|
183
|
-
*
|
|
184
|
-
* @see AssistRequestBase#relativeOutputPaths
|
|
185
|
-
* @see AssistRequestBase#conditionalPaths
|
|
186
|
-
*/
|
|
187
|
-
outputTypes?:
|
|
188
|
-
| {
|
|
189
|
-
include: string[]
|
|
190
|
-
}
|
|
191
|
-
| {
|
|
192
|
-
exclude: string[]
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* When a type or field in the schema has a function set for `hidden` or `readOnly`, it is conditional.
|
|
196
|
-
*
|
|
197
|
-
* By default, AI Assist will not output to conditional `readOnly` and `hidden` fields,
|
|
198
|
-
* ie, they are considered to resolve to `readOnly: true` / `hidden: true`.
|
|
199
|
-
*
|
|
200
|
-
* `conditionalPaths` param allows setting the default conditional value for
|
|
201
|
-
* `hidden` and `readOnly` to false,
|
|
202
|
-
* or individually set `hidden` and `readOnly` state for individual document paths.
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
* Note: fields and types with explicit readOnly: true or hidden: true in the schema, are not available to AI Assist,
|
|
206
|
-
* and cannot be changed via conditionalPaths.
|
|
207
|
-
*
|
|
208
|
-
* conditionalPaths state only apply to fields and types that have conditional `hidden` or `readOnly` in their schema definition.
|
|
209
|
-
*
|
|
210
|
-
* @see AssistRequestBase#relativeOutputPaths
|
|
211
|
-
* @see AssistRequestBase#outputTypes
|
|
212
|
-
*/
|
|
213
|
-
conditionalPaths?: {
|
|
214
|
-
defaultReadOnly?: boolean
|
|
215
|
-
defaultHidden?: boolean
|
|
216
|
-
paths?: {
|
|
217
|
-
/** path here is not a relative path: it must be the full document path, regardless of `path` param on the request itself */
|
|
218
|
-
path: string
|
|
219
|
-
readOnly: boolean
|
|
220
|
-
hidden: boolean
|
|
221
|
-
}[]
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/** @beta */
|
|
226
|
-
export declare type AssistSyncInstruction<T extends Record<string, Any_2> = Record<string, Any_2>> =
|
|
227
|
-
(ExistingDocumentRequest | CreateDocumentRequest<T>) & AssistRequestBase & Sync
|
|
228
|
-
|
|
229
|
-
declare interface Async {
|
|
230
|
-
/**
|
|
231
|
-
* When async: true, requests responds with status 201 and {_id} as response body as soon as the request is validated.
|
|
232
|
-
* The instruction operation will carry on in the background.
|
|
233
|
-
*
|
|
234
|
-
* When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
|
|
235
|
-
*
|
|
236
|
-
* async: true is incompatible with skipWrite, as async: true does not return the resulting document
|
|
237
|
-
*/
|
|
238
|
-
async: true
|
|
239
|
-
}
|
|
240
|
-
|
|
241
119
|
/** @internal */
|
|
242
120
|
export declare type AttributeSet = {
|
|
243
121
|
[key: string]: Any
|
|
@@ -510,6 +388,19 @@ export declare interface ClientConfig {
|
|
|
510
388
|
* Options for how, if enabled, Content Source Maps are encoded into query results using steganography
|
|
511
389
|
*/
|
|
512
390
|
stega?: StegaConfig | boolean
|
|
391
|
+
/**
|
|
392
|
+
* @deprecated Don't use
|
|
393
|
+
*/
|
|
394
|
+
experimental_resource?:
|
|
395
|
+
| {
|
|
396
|
+
type: 'projects'
|
|
397
|
+
id: string
|
|
398
|
+
dataset: string
|
|
399
|
+
}
|
|
400
|
+
| {
|
|
401
|
+
type: string
|
|
402
|
+
id: string
|
|
403
|
+
}
|
|
513
404
|
}
|
|
514
405
|
|
|
515
406
|
/** @public */
|
|
@@ -568,12 +459,6 @@ export declare class ConnectionFailedError extends Error {
|
|
|
568
459
|
readonly name = 'ConnectionFailedError'
|
|
569
460
|
}
|
|
570
461
|
|
|
571
|
-
/** @beta */
|
|
572
|
-
export declare interface ConstantInstructionParam {
|
|
573
|
-
type: 'constant'
|
|
574
|
-
value: string
|
|
575
|
-
}
|
|
576
|
-
|
|
577
462
|
/** @public */
|
|
578
463
|
export declare interface ContentSourceMap {
|
|
579
464
|
mappings: ContentSourceMapMappings
|
|
@@ -693,18 +578,6 @@ export declare type CreateAction = {
|
|
|
693
578
|
/** @public */
|
|
694
579
|
export declare const createClient: (config: ClientConfig) => SanityClient
|
|
695
580
|
|
|
696
|
-
/**
|
|
697
|
-
* Instruction to create a new document
|
|
698
|
-
* @beta
|
|
699
|
-
*/
|
|
700
|
-
declare interface CreateDocumentRequest<T extends Record<string, Any_2> = Record<string, Any_2>> {
|
|
701
|
-
createDocument: {
|
|
702
|
-
/** if no _id is provided, one will be generated. _id is always returned when the requests succeed */
|
|
703
|
-
_id?: string
|
|
704
|
-
_type: string
|
|
705
|
-
} & SanityDocumentStub_2<T>
|
|
706
|
-
}
|
|
707
|
-
|
|
708
581
|
/** @internal */
|
|
709
582
|
export declare interface CurrentSanityUser {
|
|
710
583
|
id: string
|
|
@@ -898,20 +771,6 @@ export declare type EventSourceEvent<Name extends string> = ServerSentEvent<Name
|
|
|
898
771
|
*/
|
|
899
772
|
export declare type EventSourceInstance = InstanceType<typeof globalThis.EventSource>
|
|
900
773
|
|
|
901
|
-
/**
|
|
902
|
-
* Instruction for an existing document.
|
|
903
|
-
* @beta
|
|
904
|
-
*/
|
|
905
|
-
declare interface ExistingDocumentRequest {
|
|
906
|
-
documentId: string
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
/** @beta */
|
|
910
|
-
export declare interface FieldInstructionParam {
|
|
911
|
-
type: 'field'
|
|
912
|
-
path: string
|
|
913
|
-
}
|
|
914
|
-
|
|
915
774
|
/** @public */
|
|
916
775
|
export declare type FilterDefault = (props: {
|
|
917
776
|
/**
|
|
@@ -978,13 +837,6 @@ export declare type FirstDocumentMutationOptions = BaseMutationOptions & {
|
|
|
978
837
|
returnDocuments?: true
|
|
979
838
|
}
|
|
980
839
|
|
|
981
|
-
/** @beta */
|
|
982
|
-
export declare interface GroqInstructionParam {
|
|
983
|
-
type: 'groq'
|
|
984
|
-
query: string
|
|
985
|
-
params?: Record<string, string>
|
|
986
|
-
}
|
|
987
|
-
|
|
988
840
|
/** @public */
|
|
989
841
|
export declare type HttpRequest = {
|
|
990
842
|
(options: RequestOptions, requester: Requester): ReturnType<Requester>
|
|
@@ -1045,16 +897,6 @@ export declare type InsertPatch =
|
|
|
1045
897
|
items: Any[]
|
|
1046
898
|
}
|
|
1047
899
|
|
|
1048
|
-
/** @beta */
|
|
1049
|
-
export declare type InstructionParam =
|
|
1050
|
-
| string
|
|
1051
|
-
| ConstantInstructionParam
|
|
1052
|
-
| FieldInstructionParam
|
|
1053
|
-
| GroqInstructionParam
|
|
1054
|
-
|
|
1055
|
-
/** @beta */
|
|
1056
|
-
export declare type InstructionParams = Record<string, InstructionParam>
|
|
1057
|
-
|
|
1058
900
|
/**
|
|
1059
901
|
* Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
|
|
1060
902
|
*
|
|
@@ -1464,18 +1306,6 @@ export declare class ObservableAssetsClient {
|
|
|
1464
1306
|
>
|
|
1465
1307
|
}
|
|
1466
1308
|
|
|
1467
|
-
/** @public */
|
|
1468
|
-
declare class ObservableAssistClient {
|
|
1469
|
-
#private
|
|
1470
|
-
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
1471
|
-
instruct(request: AssistAsyncInstruction): Observable<{
|
|
1472
|
-
_id: string
|
|
1473
|
-
}>
|
|
1474
|
-
instruct<DocumentShape extends Record<string, Any>>(
|
|
1475
|
-
request: AssistSyncInstruction<DocumentShape>,
|
|
1476
|
-
): Observable<IdentifiedSanityDocumentStub & DocumentShape>
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
1309
|
/** @internal */
|
|
1480
1310
|
export declare class ObservableDatasetsClient {
|
|
1481
1311
|
#private
|
|
@@ -1599,7 +1429,6 @@ export declare class ObservableSanityClient {
|
|
|
1599
1429
|
live: LiveClient
|
|
1600
1430
|
projects: ObservableProjectsClient
|
|
1601
1431
|
users: ObservableUsersClient
|
|
1602
|
-
assist: ObservableAssistClient
|
|
1603
1432
|
/**
|
|
1604
1433
|
* Instance properties
|
|
1605
1434
|
*/
|
|
@@ -2519,7 +2348,6 @@ export declare class SanityClient {
|
|
|
2519
2348
|
live: LiveClient
|
|
2520
2349
|
projects: ProjectsClient
|
|
2521
2350
|
users: UsersClient
|
|
2522
|
-
assist: AssistClient
|
|
2523
2351
|
/**
|
|
2524
2352
|
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
2525
2353
|
*/
|
|
@@ -3058,13 +2886,6 @@ export declare type SanityDocumentStub<T extends Record<string, Any> = Record<st
|
|
|
3058
2886
|
_type: string
|
|
3059
2887
|
}
|
|
3060
2888
|
|
|
3061
|
-
/** @public */
|
|
3062
|
-
declare type SanityDocumentStub_2<T extends Record<string, Any_2> = Record<string, Any_2>> = {
|
|
3063
|
-
[P in keyof T]: T[P]
|
|
3064
|
-
} & {
|
|
3065
|
-
_type: string
|
|
3066
|
-
}
|
|
3067
|
-
|
|
3068
2889
|
/** @internal */
|
|
3069
2890
|
export declare interface SanityImageAssetDocument extends SanityAssetDocument {
|
|
3070
2891
|
metadata: {
|
|
@@ -3241,29 +3062,6 @@ export {StudioBaseUrl}
|
|
|
3241
3062
|
|
|
3242
3063
|
export {StudioUrl}
|
|
3243
3064
|
|
|
3244
|
-
declare interface Sync {
|
|
3245
|
-
/**
|
|
3246
|
-
* By default, skipWrite: false.
|
|
3247
|
-
* Write enabled operations will mutate the target document, and emit AI presence in the studio.
|
|
3248
|
-
*
|
|
3249
|
-
* When skipWrite: true, the api will not mutate any documents nor emit presence.
|
|
3250
|
-
* Ie, when true, no changes will be made to content-lake
|
|
3251
|
-
*
|
|
3252
|
-
* skipWrite: true is incompatible with async: true,
|
|
3253
|
-
* as skipWrite implies that you will use the return value of the operation
|
|
3254
|
-
*/
|
|
3255
|
-
skipWrite?: boolean
|
|
3256
|
-
/**
|
|
3257
|
-
* When async: true, requests responds with status 201 and {_id} as response body as soon as the request is validated.
|
|
3258
|
-
* The instruction operation will carry on in the background.
|
|
3259
|
-
*
|
|
3260
|
-
* When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
|
|
3261
|
-
*
|
|
3262
|
-
* async: true is incompatible with skipWrite: true, as async: true does not return the resulting document
|
|
3263
|
-
*/
|
|
3264
|
-
async?: false
|
|
3265
|
-
}
|
|
3266
|
-
|
|
3267
3065
|
/** @public */
|
|
3268
3066
|
export declare type SyncTag = `s1:${string}`
|
|
3269
3067
|
|