@sanity/client 6.28.0-instruct.0 → 6.28.0-resources-projects.0

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.
@@ -110,129 +110,6 @@ export declare class AssetsClient {
110
110
  ): Promise<SanityAssetDocument | SanityImageAssetDocument>
111
111
  }
112
112
 
113
- /** @beta */
114
- export declare type AssistAsyncInstruction<T extends Record<string, Any> = Record<string, Any>> = (
115
- | ExistingDocumentRequest
116
- | CreateDocumentRequest<T>
117
- ) &
118
- AssistRequestBase &
119
- Async
120
-
121
- /** @public */
122
- declare class AssistClient {
123
- #private
124
- constructor(client: SanityClient, httpRequest: HttpRequest)
125
- instruct(request: AssistAsyncInstruction): Promise<{
126
- _id: string
127
- }>
128
- instruct<DocumentShape extends Record<string, Any>>(
129
- request: AssistSyncInstruction<DocumentShape>,
130
- ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
131
- }
132
-
133
- /** @beta */
134
- export declare type AssistInstruction<T extends Record<string, Any> = Record<string, Any>> =
135
- | AssistSyncInstruction<T>
136
- | AssistAsyncInstruction<T>
137
-
138
- declare interface AssistRequestBase {
139
- /** schemaId as reported by sanity deploy / sanity schema store */
140
- schemaId: string
141
- /** string template using $variable – more on this below under "Dynamic instruction" */
142
- instruction: string
143
- /** param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable" */
144
- instructionParams?: InstructionParams
145
- /**
146
- * Optional document path output target for the instruction.
147
- * When provided, the instruction will apply to this path in the document and its children.
148
- *
149
- * ## Examples
150
- * - `path: 'title'` will output to the title field in the document
151
- * - `path: 'array[_key="xx"]'` will output to the item with `_key: 'xx'` in the array field
152
- */
153
- path?: string
154
- /**
155
- * Controls sub-paths in the document that can be output to.
156
- *
157
- * The string-paths are relative to the `path` param
158
- *
159
- * Note: these path strings are less strictly validated than the `path` param itself:
160
- * if an relative-path does not exist or is invalid, it will be silently ignored.
161
- *
162
- * @see AssistRequestBase#conditionalPaths
163
- * @see AssistRequestBase#outputTypes
164
- */
165
- relativeOutputPaths?:
166
- | {
167
- include: string[]
168
- }
169
- | {
170
- exclude: string[]
171
- }
172
- /**
173
- * Controls which types the instruction is allowed to output to.
174
- *
175
- * @see AssistRequestBase#relativeOutputPaths
176
- * @see AssistRequestBase#conditionalPaths
177
- */
178
- outputTypes?:
179
- | {
180
- include: string[]
181
- }
182
- | {
183
- exclude: string[]
184
- }
185
- /**
186
- * When a type or field in the schema has a function set for `hidden` or `readOnly`, it is conditional.
187
- *
188
- * By default, AI Assist will not output to conditional `readOnly` and `hidden` fields,
189
- * ie, they are considered to resolve to `readOnly: true` / `hidden: true`.
190
- *
191
- * `conditionalPaths` param allows setting the default conditional value for
192
- * `hidden` and `readOnly` to false,
193
- * or individually set `hidden` and `readOnly` state for individual document paths.
194
- *
195
- *
196
- * Note: fields and types with explicit readOnly: true or hidden: true in the schema, are not available to AI Assist,
197
- * and cannot be changed via conditionalPaths.
198
- *
199
- * conditionalPaths state only apply to fields and types that have conditional `hidden` or `readOnly` in their schema definition.
200
- *
201
- * @see AssistRequestBase#relativeOutputPaths
202
- * @see AssistRequestBase#outputTypes
203
- */
204
- conditionalPaths?: {
205
- defaultReadOnly?: boolean
206
- defaultHidden?: boolean
207
- paths?: {
208
- /** path here is not a relative path: it must be the full document path, regardless of `path` param on the request itself */
209
- path: string
210
- readOnly: boolean
211
- hidden: boolean
212
- }[]
213
- }
214
- }
215
-
216
- /** @beta */
217
- export declare type AssistSyncInstruction<T extends Record<string, Any> = Record<string, Any>> = (
218
- | ExistingDocumentRequest
219
- | CreateDocumentRequest<T>
220
- ) &
221
- AssistRequestBase &
222
- Sync
223
-
224
- declare interface Async {
225
- /**
226
- * When async: true, requests responds with status 201 and {_id} as response body as soon as the request is validated.
227
- * The instruction operation will carry on in the background.
228
- *
229
- * When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
230
- *
231
- * async: true is incompatible with skipWrite, as async: true does not return the resulting document
232
- */
233
- async: true
234
- }
235
-
236
113
  /** @internal */
237
114
  export declare type AttributeSet = {
238
115
  [key: string]: Any
@@ -505,6 +382,19 @@ export declare interface ClientConfig {
505
382
  * Options for how, if enabled, Content Source Maps are encoded into query results using steganography
506
383
  */
507
384
  stega?: StegaConfig | boolean
385
+ /**
386
+ * @deprecated Don't use
387
+ */
388
+ experimental_resource?:
389
+ | {
390
+ type: 'projects'
391
+ id: string
392
+ dataset: string
393
+ }
394
+ | {
395
+ type: string
396
+ id: string
397
+ }
508
398
  }
509
399
 
510
400
  /** @public */
@@ -569,12 +459,6 @@ export declare class ConnectionFailedError extends Error {
569
459
  readonly name = 'ConnectionFailedError'
570
460
  }
571
461
 
572
- /** @beta */
573
- export declare interface ConstantInstructionParam {
574
- type: 'constant'
575
- value: string
576
- }
577
-
578
462
  /** @public */
579
463
  export declare interface ContentSourceMap {
580
464
  mappings: ContentSourceMapMappings
@@ -793,18 +677,6 @@ export declare type CreateAction = {
793
677
  */
794
678
  export declare const createClient: (config: ClientConfig_2) => SanityClient
795
679
 
796
- /**
797
- * Instruction to create a new document
798
- * @beta
799
- */
800
- declare interface CreateDocumentRequest<T extends Record<string, Any> = Record<string, Any>> {
801
- createDocument: {
802
- /** if no _id is provided, one will be generated. _id is always returned when the requests succeed */
803
- _id?: string
804
- _type: string
805
- } & SanityDocumentStub<T>
806
- }
807
-
808
680
  /** @internal */
809
681
  export declare interface CurrentSanityUser {
810
682
  id: string
@@ -1010,20 +882,6 @@ export declare type EventSourceEvent<Name extends string> = ServerSentEvent<Name
1010
882
  */
1011
883
  export declare type EventSourceInstance = InstanceType<typeof globalThis.EventSource>
1012
884
 
1013
- /**
1014
- * Instruction for an existing document.
1015
- * @beta
1016
- */
1017
- declare interface ExistingDocumentRequest {
1018
- documentId: string
1019
- }
1020
-
1021
- /** @beta */
1022
- export declare interface FieldInstructionParam {
1023
- type: 'field'
1024
- path: string
1025
- }
1026
-
1027
885
  /** @public */
1028
886
  export declare type FilterDefault = (props: {
1029
887
  /**
@@ -1139,13 +997,6 @@ export declare type FirstDocumentMutationOptions = BaseMutationOptions & {
1139
997
  returnDocuments?: true
1140
998
  }
1141
999
 
1142
- /** @beta */
1143
- export declare interface GroqInstructionParam {
1144
- type: 'groq'
1145
- query: string
1146
- params?: Record<string, string>
1147
- }
1148
-
1149
1000
  /** @public */
1150
1001
  export declare type HttpRequest = {
1151
1002
  (options: RequestOptions, requester: Requester): ReturnType<Requester>
@@ -1216,16 +1067,6 @@ export declare type InsertPatch =
1216
1067
  items: Any[]
1217
1068
  }
1218
1069
 
1219
- /** @beta */
1220
- export declare type InstructionParam =
1221
- | string
1222
- | ConstantInstructionParam
1223
- | FieldInstructionParam
1224
- | GroqInstructionParam
1225
-
1226
- /** @beta */
1227
- export declare type InstructionParams = Record<string, InstructionParam>
1228
-
1229
1070
  /**
1230
1071
  * Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
1231
1072
  *
@@ -1642,18 +1483,6 @@ export declare class ObservableAssetsClient {
1642
1483
  >
1643
1484
  }
1644
1485
 
1645
- /** @public */
1646
- declare class ObservableAssistClient {
1647
- #private
1648
- constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
1649
- instruct(request: AssistAsyncInstruction): Observable<{
1650
- _id: string
1651
- }>
1652
- instruct<DocumentShape extends Record<string, Any>>(
1653
- request: AssistSyncInstruction<DocumentShape>,
1654
- ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
1655
- }
1656
-
1657
1486
  /** @internal */
1658
1487
  export declare class ObservableDatasetsClient {
1659
1488
  #private
@@ -1777,7 +1606,6 @@ export declare class ObservableSanityClient {
1777
1606
  live: LiveClient
1778
1607
  projects: ObservableProjectsClient
1779
1608
  users: ObservableUsersClient
1780
- assist: ObservableAssistClient
1781
1609
  /**
1782
1610
  * Instance properties
1783
1611
  */
@@ -2709,7 +2537,6 @@ export declare class SanityClient {
2709
2537
  live: LiveClient
2710
2538
  projects: ProjectsClient
2711
2539
  users: UsersClient
2712
- assist: AssistClient
2713
2540
  /**
2714
2541
  * Observable version of the Sanity client, with the same configuration as the promise-based one
2715
2542
  */
@@ -3493,29 +3320,6 @@ export declare type StudioBaseUrl =
3493
3320
  /** @alpha */
3494
3321
  export declare type StudioUrl = StudioBaseUrl | StudioBaseRoute
3495
3322
 
3496
- declare interface Sync {
3497
- /**
3498
- * By default, skipWrite: false.
3499
- * Write enabled operations will mutate the target document, and emit AI presence in the studio.
3500
- *
3501
- * When skipWrite: true, the api will not mutate any documents nor emit presence.
3502
- * Ie, when true, no changes will be made to content-lake
3503
- *
3504
- * skipWrite: true is incompatible with async: true,
3505
- * as skipWrite implies that you will use the return value of the operation
3506
- */
3507
- skipWrite?: boolean
3508
- /**
3509
- * When async: true, requests responds with status 201 and {_id} as response body as soon as the request is validated.
3510
- * The instruction operation will carry on in the background.
3511
- *
3512
- * When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
3513
- *
3514
- * async: true is incompatible with skipWrite: true, as async: true does not return the resulting document
3515
- */
3516
- async?: false
3517
- }
3518
-
3519
3323
  /** @public */
3520
3324
  export declare type SyncTag = `s1:${string}`
3521
3325
 
@@ -110,129 +110,6 @@ export declare class AssetsClient {
110
110
  ): Promise<SanityAssetDocument | SanityImageAssetDocument>
111
111
  }
112
112
 
113
- /** @beta */
114
- export declare type AssistAsyncInstruction<T extends Record<string, Any> = Record<string, Any>> = (
115
- | ExistingDocumentRequest
116
- | CreateDocumentRequest<T>
117
- ) &
118
- AssistRequestBase &
119
- Async
120
-
121
- /** @public */
122
- declare class AssistClient {
123
- #private
124
- constructor(client: SanityClient, httpRequest: HttpRequest)
125
- instruct(request: AssistAsyncInstruction): Promise<{
126
- _id: string
127
- }>
128
- instruct<DocumentShape extends Record<string, Any>>(
129
- request: AssistSyncInstruction<DocumentShape>,
130
- ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
131
- }
132
-
133
- /** @beta */
134
- export declare type AssistInstruction<T extends Record<string, Any> = Record<string, Any>> =
135
- | AssistSyncInstruction<T>
136
- | AssistAsyncInstruction<T>
137
-
138
- declare interface AssistRequestBase {
139
- /** schemaId as reported by sanity deploy / sanity schema store */
140
- schemaId: string
141
- /** string template using $variable – more on this below under "Dynamic instruction" */
142
- instruction: string
143
- /** param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable" */
144
- instructionParams?: InstructionParams
145
- /**
146
- * Optional document path output target for the instruction.
147
- * When provided, the instruction will apply to this path in the document and its children.
148
- *
149
- * ## Examples
150
- * - `path: 'title'` will output to the title field in the document
151
- * - `path: 'array[_key="xx"]'` will output to the item with `_key: 'xx'` in the array field
152
- */
153
- path?: string
154
- /**
155
- * Controls sub-paths in the document that can be output to.
156
- *
157
- * The string-paths are relative to the `path` param
158
- *
159
- * Note: these path strings are less strictly validated than the `path` param itself:
160
- * if an relative-path does not exist or is invalid, it will be silently ignored.
161
- *
162
- * @see AssistRequestBase#conditionalPaths
163
- * @see AssistRequestBase#outputTypes
164
- */
165
- relativeOutputPaths?:
166
- | {
167
- include: string[]
168
- }
169
- | {
170
- exclude: string[]
171
- }
172
- /**
173
- * Controls which types the instruction is allowed to output to.
174
- *
175
- * @see AssistRequestBase#relativeOutputPaths
176
- * @see AssistRequestBase#conditionalPaths
177
- */
178
- outputTypes?:
179
- | {
180
- include: string[]
181
- }
182
- | {
183
- exclude: string[]
184
- }
185
- /**
186
- * When a type or field in the schema has a function set for `hidden` or `readOnly`, it is conditional.
187
- *
188
- * By default, AI Assist will not output to conditional `readOnly` and `hidden` fields,
189
- * ie, they are considered to resolve to `readOnly: true` / `hidden: true`.
190
- *
191
- * `conditionalPaths` param allows setting the default conditional value for
192
- * `hidden` and `readOnly` to false,
193
- * or individually set `hidden` and `readOnly` state for individual document paths.
194
- *
195
- *
196
- * Note: fields and types with explicit readOnly: true or hidden: true in the schema, are not available to AI Assist,
197
- * and cannot be changed via conditionalPaths.
198
- *
199
- * conditionalPaths state only apply to fields and types that have conditional `hidden` or `readOnly` in their schema definition.
200
- *
201
- * @see AssistRequestBase#relativeOutputPaths
202
- * @see AssistRequestBase#outputTypes
203
- */
204
- conditionalPaths?: {
205
- defaultReadOnly?: boolean
206
- defaultHidden?: boolean
207
- paths?: {
208
- /** path here is not a relative path: it must be the full document path, regardless of `path` param on the request itself */
209
- path: string
210
- readOnly: boolean
211
- hidden: boolean
212
- }[]
213
- }
214
- }
215
-
216
- /** @beta */
217
- export declare type AssistSyncInstruction<T extends Record<string, Any> = Record<string, Any>> = (
218
- | ExistingDocumentRequest
219
- | CreateDocumentRequest<T>
220
- ) &
221
- AssistRequestBase &
222
- Sync
223
-
224
- declare interface Async {
225
- /**
226
- * When async: true, requests responds with status 201 and {_id} as response body as soon as the request is validated.
227
- * The instruction operation will carry on in the background.
228
- *
229
- * When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
230
- *
231
- * async: true is incompatible with skipWrite, as async: true does not return the resulting document
232
- */
233
- async: true
234
- }
235
-
236
113
  /** @internal */
237
114
  export declare type AttributeSet = {
238
115
  [key: string]: Any
@@ -505,6 +382,19 @@ export declare interface ClientConfig {
505
382
  * Options for how, if enabled, Content Source Maps are encoded into query results using steganography
506
383
  */
507
384
  stega?: StegaConfig | boolean
385
+ /**
386
+ * @deprecated Don't use
387
+ */
388
+ experimental_resource?:
389
+ | {
390
+ type: 'projects'
391
+ id: string
392
+ dataset: string
393
+ }
394
+ | {
395
+ type: string
396
+ id: string
397
+ }
508
398
  }
509
399
 
510
400
  /** @public */
@@ -569,12 +459,6 @@ export declare class ConnectionFailedError extends Error {
569
459
  readonly name = 'ConnectionFailedError'
570
460
  }
571
461
 
572
- /** @beta */
573
- export declare interface ConstantInstructionParam {
574
- type: 'constant'
575
- value: string
576
- }
577
-
578
462
  /** @public */
579
463
  export declare interface ContentSourceMap {
580
464
  mappings: ContentSourceMapMappings
@@ -793,18 +677,6 @@ export declare type CreateAction = {
793
677
  */
794
678
  export declare const createClient: (config: ClientConfig_2) => SanityClient
795
679
 
796
- /**
797
- * Instruction to create a new document
798
- * @beta
799
- */
800
- declare interface CreateDocumentRequest<T extends Record<string, Any> = Record<string, Any>> {
801
- createDocument: {
802
- /** if no _id is provided, one will be generated. _id is always returned when the requests succeed */
803
- _id?: string
804
- _type: string
805
- } & SanityDocumentStub<T>
806
- }
807
-
808
680
  /** @internal */
809
681
  export declare interface CurrentSanityUser {
810
682
  id: string
@@ -1010,20 +882,6 @@ export declare type EventSourceEvent<Name extends string> = ServerSentEvent<Name
1010
882
  */
1011
883
  export declare type EventSourceInstance = InstanceType<typeof globalThis.EventSource>
1012
884
 
1013
- /**
1014
- * Instruction for an existing document.
1015
- * @beta
1016
- */
1017
- declare interface ExistingDocumentRequest {
1018
- documentId: string
1019
- }
1020
-
1021
- /** @beta */
1022
- export declare interface FieldInstructionParam {
1023
- type: 'field'
1024
- path: string
1025
- }
1026
-
1027
885
  /** @public */
1028
886
  export declare type FilterDefault = (props: {
1029
887
  /**
@@ -1139,13 +997,6 @@ export declare type FirstDocumentMutationOptions = BaseMutationOptions & {
1139
997
  returnDocuments?: true
1140
998
  }
1141
999
 
1142
- /** @beta */
1143
- export declare interface GroqInstructionParam {
1144
- type: 'groq'
1145
- query: string
1146
- params?: Record<string, string>
1147
- }
1148
-
1149
1000
  /** @public */
1150
1001
  export declare type HttpRequest = {
1151
1002
  (options: RequestOptions, requester: Requester): ReturnType<Requester>
@@ -1216,16 +1067,6 @@ export declare type InsertPatch =
1216
1067
  items: Any[]
1217
1068
  }
1218
1069
 
1219
- /** @beta */
1220
- export declare type InstructionParam =
1221
- | string
1222
- | ConstantInstructionParam
1223
- | FieldInstructionParam
1224
- | GroqInstructionParam
1225
-
1226
- /** @beta */
1227
- export declare type InstructionParams = Record<string, InstructionParam>
1228
-
1229
1070
  /**
1230
1071
  * Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
1231
1072
  *
@@ -1642,18 +1483,6 @@ export declare class ObservableAssetsClient {
1642
1483
  >
1643
1484
  }
1644
1485
 
1645
- /** @public */
1646
- declare class ObservableAssistClient {
1647
- #private
1648
- constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
1649
- instruct(request: AssistAsyncInstruction): Observable<{
1650
- _id: string
1651
- }>
1652
- instruct<DocumentShape extends Record<string, Any>>(
1653
- request: AssistSyncInstruction<DocumentShape>,
1654
- ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
1655
- }
1656
-
1657
1486
  /** @internal */
1658
1487
  export declare class ObservableDatasetsClient {
1659
1488
  #private
@@ -1777,7 +1606,6 @@ export declare class ObservableSanityClient {
1777
1606
  live: LiveClient
1778
1607
  projects: ObservableProjectsClient
1779
1608
  users: ObservableUsersClient
1780
- assist: ObservableAssistClient
1781
1609
  /**
1782
1610
  * Instance properties
1783
1611
  */
@@ -2709,7 +2537,6 @@ export declare class SanityClient {
2709
2537
  live: LiveClient
2710
2538
  projects: ProjectsClient
2711
2539
  users: UsersClient
2712
- assist: AssistClient
2713
2540
  /**
2714
2541
  * Observable version of the Sanity client, with the same configuration as the promise-based one
2715
2542
  */
@@ -3493,29 +3320,6 @@ export declare type StudioBaseUrl =
3493
3320
  /** @alpha */
3494
3321
  export declare type StudioUrl = StudioBaseUrl | StudioBaseRoute
3495
3322
 
3496
- declare interface Sync {
3497
- /**
3498
- * By default, skipWrite: false.
3499
- * Write enabled operations will mutate the target document, and emit AI presence in the studio.
3500
- *
3501
- * When skipWrite: true, the api will not mutate any documents nor emit presence.
3502
- * Ie, when true, no changes will be made to content-lake
3503
- *
3504
- * skipWrite: true is incompatible with async: true,
3505
- * as skipWrite implies that you will use the return value of the operation
3506
- */
3507
- skipWrite?: boolean
3508
- /**
3509
- * When async: true, requests responds with status 201 and {_id} as response body as soon as the request is validated.
3510
- * The instruction operation will carry on in the background.
3511
- *
3512
- * When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
3513
- *
3514
- * async: true is incompatible with skipWrite: true, as async: true does not return the resulting document
3515
- */
3516
- async?: false
3517
- }
3518
-
3519
3323
  /** @public */
3520
3324
  export declare type SyncTag = `s1:${string}`
3521
3325