@sanity/client 6.28.3-instruct.1 → 6.28.3-instruct.2

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.
@@ -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
@@ -1626,18 +1614,6 @@ export declare type MutationSelectionQueryParams = {
1626
1614
  [key: string]: Any
1627
1615
  }
1628
1616
 
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
1617
  /** @internal */
1642
1618
  export declare class ObservableAssetsClient {
1643
1619
  #private
@@ -1815,7 +1791,6 @@ export declare class ObservableSanityClient {
1815
1791
  live: LiveClient
1816
1792
  projects: ObservableProjectsClient
1817
1793
  users: ObservableUsersClient
1818
- ai: ObservableAiClient
1819
1794
  /**
1820
1795
  * Instance properties
1821
1796
  */
@@ -2310,6 +2285,12 @@ export declare class ObservableSanityClient {
2310
2285
  * @param path - Path to append after the operation
2311
2286
  */
2312
2287
  getDataUrl(operation: string, path?: string): string
2288
+ instruct(request: InstructAsyncInstruction): Observable<{
2289
+ _id: string
2290
+ }>
2291
+ instruct<DocumentShape extends Record<string, Any>>(
2292
+ request: InstructSyncInstruction<DocumentShape>,
2293
+ ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
2313
2294
  }
2314
2295
 
2315
2296
  /**
@@ -2747,7 +2728,6 @@ export declare class SanityClient {
2747
2728
  live: LiveClient
2748
2729
  projects: ProjectsClient
2749
2730
  users: UsersClient
2750
- ai: AiClient
2751
2731
  /**
2752
2732
  * Observable version of the Sanity client, with the same configuration as the promise-based one
2753
2733
  */
@@ -3262,6 +3242,12 @@ export declare class SanityClient {
3262
3242
  * @param path - Path to append after the operation
3263
3243
  */
3264
3244
  getDataUrl(operation: string, path?: string): string
3245
+ instruct(request: InstructAsyncInstruction): Promise<{
3246
+ _id: string
3247
+ }>
3248
+ instruct<DocumentShape extends Record<string, Any>>(
3249
+ request: InstructSyncInstruction<DocumentShape>,
3250
+ ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
3265
3251
  }
3266
3252
 
3267
3253
  /** @internal */
@@ -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
@@ -1626,18 +1614,6 @@ export declare type MutationSelectionQueryParams = {
1626
1614
  [key: string]: Any
1627
1615
  }
1628
1616
 
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
1617
  /** @internal */
1642
1618
  export declare class ObservableAssetsClient {
1643
1619
  #private
@@ -1815,7 +1791,6 @@ export declare class ObservableSanityClient {
1815
1791
  live: LiveClient
1816
1792
  projects: ObservableProjectsClient
1817
1793
  users: ObservableUsersClient
1818
- ai: ObservableAiClient
1819
1794
  /**
1820
1795
  * Instance properties
1821
1796
  */
@@ -2310,6 +2285,12 @@ export declare class ObservableSanityClient {
2310
2285
  * @param path - Path to append after the operation
2311
2286
  */
2312
2287
  getDataUrl(operation: string, path?: string): string
2288
+ instruct(request: InstructAsyncInstruction): Observable<{
2289
+ _id: string
2290
+ }>
2291
+ instruct<DocumentShape extends Record<string, Any>>(
2292
+ request: InstructSyncInstruction<DocumentShape>,
2293
+ ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
2313
2294
  }
2314
2295
 
2315
2296
  /**
@@ -2747,7 +2728,6 @@ export declare class SanityClient {
2747
2728
  live: LiveClient
2748
2729
  projects: ProjectsClient
2749
2730
  users: UsersClient
2750
- ai: AiClient
2751
2731
  /**
2752
2732
  * Observable version of the Sanity client, with the same configuration as the promise-based one
2753
2733
  */
@@ -3262,6 +3242,12 @@ export declare class SanityClient {
3262
3242
  * @param path - Path to append after the operation
3263
3243
  */
3264
3244
  getDataUrl(operation: string, path?: string): string
3245
+ instruct(request: InstructAsyncInstruction): Promise<{
3246
+ _id: string
3247
+ }>
3248
+ instruct<DocumentShape extends Record<string, Any>>(
3249
+ request: InstructSyncInstruction<DocumentShape>,
3250
+ ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
3265
3251
  }
3266
3252
 
3267
3253
  /** @internal */
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
@@ -1626,18 +1614,6 @@ export declare type MutationSelectionQueryParams = {
1626
1614
  [key: string]: Any
1627
1615
  }
1628
1616
 
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
1617
  /** @internal */
1642
1618
  export declare class ObservableAssetsClient {
1643
1619
  #private
@@ -1815,7 +1791,6 @@ export declare class ObservableSanityClient {
1815
1791
  live: LiveClient
1816
1792
  projects: ObservableProjectsClient
1817
1793
  users: ObservableUsersClient
1818
- ai: ObservableAiClient
1819
1794
  /**
1820
1795
  * Instance properties
1821
1796
  */
@@ -2310,6 +2285,12 @@ export declare class ObservableSanityClient {
2310
2285
  * @param path - Path to append after the operation
2311
2286
  */
2312
2287
  getDataUrl(operation: string, path?: string): string
2288
+ instruct(request: InstructAsyncInstruction): Observable<{
2289
+ _id: string
2290
+ }>
2291
+ instruct<DocumentShape extends Record<string, Any>>(
2292
+ request: InstructSyncInstruction<DocumentShape>,
2293
+ ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
2313
2294
  }
2314
2295
 
2315
2296
  /**
@@ -2747,7 +2728,6 @@ export declare class SanityClient {
2747
2728
  live: LiveClient
2748
2729
  projects: ProjectsClient
2749
2730
  users: UsersClient
2750
- ai: AiClient
2751
2731
  /**
2752
2732
  * Observable version of the Sanity client, with the same configuration as the promise-based one
2753
2733
  */
@@ -3262,6 +3242,12 @@ export declare class SanityClient {
3262
3242
  * @param path - Path to append after the operation
3263
3243
  */
3264
3244
  getDataUrl(operation: string, path?: string): string
3245
+ instruct(request: InstructAsyncInstruction): Promise<{
3246
+ _id: string
3247
+ }>
3248
+ instruct<DocumentShape extends Record<string, Any>>(
3249
+ request: InstructSyncInstruction<DocumentShape>,
3250
+ ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
3265
3251
  }
3266
3252
 
3267
3253
  /** @internal */
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
@@ -1626,18 +1614,6 @@ export declare type MutationSelectionQueryParams = {
1626
1614
  [key: string]: Any
1627
1615
  }
1628
1616
 
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
1617
  /** @internal */
1642
1618
  export declare class ObservableAssetsClient {
1643
1619
  #private
@@ -1815,7 +1791,6 @@ export declare class ObservableSanityClient {
1815
1791
  live: LiveClient
1816
1792
  projects: ObservableProjectsClient
1817
1793
  users: ObservableUsersClient
1818
- ai: ObservableAiClient
1819
1794
  /**
1820
1795
  * Instance properties
1821
1796
  */
@@ -2310,6 +2285,12 @@ export declare class ObservableSanityClient {
2310
2285
  * @param path - Path to append after the operation
2311
2286
  */
2312
2287
  getDataUrl(operation: string, path?: string): string
2288
+ instruct(request: InstructAsyncInstruction): Observable<{
2289
+ _id: string
2290
+ }>
2291
+ instruct<DocumentShape extends Record<string, Any>>(
2292
+ request: InstructSyncInstruction<DocumentShape>,
2293
+ ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
2313
2294
  }
2314
2295
 
2315
2296
  /**
@@ -2747,7 +2728,6 @@ export declare class SanityClient {
2747
2728
  live: LiveClient
2748
2729
  projects: ProjectsClient
2749
2730
  users: UsersClient
2750
- ai: AiClient
2751
2731
  /**
2752
2732
  * Observable version of the Sanity client, with the same configuration as the promise-based one
2753
2733
  */
@@ -3262,6 +3242,12 @@ export declare class SanityClient {
3262
3242
  * @param path - Path to append after the operation
3263
3243
  */
3264
3244
  getDataUrl(operation: string, path?: string): string
3245
+ instruct(request: InstructAsyncInstruction): Promise<{
3246
+ _id: string
3247
+ }>
3248
+ instruct<DocumentShape extends Record<string, Any>>(
3249
+ request: InstructSyncInstruction<DocumentShape>,
3250
+ ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
3265
3251
  }
3266
3252
 
3267
3253
  /** @internal */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/client",
3
- "version": "6.28.3-instruct.1",
3
+ "version": "6.28.3-instruct.2",
4
4
  "description": "Client for retrieving, creating and patching data from Sanity.io",
5
5
  "keywords": [
6
6
  "sanity",
@@ -1,6 +1,5 @@
1
1
  import {lastValueFrom, Observable} from 'rxjs'
2
2
 
3
- import {AiClient, ObservableAiClient} from './ai/AiClient'
4
3
  import {AssetsClient, ObservableAssetsClient} from './assets/AssetsClient'
5
4
  import {defaultConfig, initConfig} from './config'
6
5
  import * as dataMethods from './data/dataMethods'
@@ -9,6 +8,7 @@ import {LiveClient} from './data/live'
9
8
  import {ObservablePatch, Patch} from './data/patch'
10
9
  import {ObservableTransaction, Transaction} from './data/transaction'
11
10
  import {DatasetsClient, ObservableDatasetsClient} from './datasets/DatasetsClient'
11
+ import {_instruct} from './instruct/instruct'
12
12
  import {ObservableProjectsClient, ProjectsClient} from './projects/ProjectsClient'
13
13
  import type {
14
14
  Action,
@@ -25,6 +25,9 @@ import type {
25
25
  HttpRequest,
26
26
  IdentifiedSanityDocumentStub,
27
27
  InitializedClientConfig,
28
+ InstructAsyncInstruction,
29
+ InstructInstruction,
30
+ InstructSyncInstruction,
28
31
  MultipleActionResult,
29
32
  MultipleMutationResult,
30
33
  Mutation,
@@ -66,7 +69,6 @@ export class ObservableSanityClient {
66
69
  live: LiveClient
67
70
  projects: ObservableProjectsClient
68
71
  users: ObservableUsersClient
69
- ai: ObservableAiClient
70
72
  /**
71
73
  * Private properties
72
74
  */
@@ -88,7 +90,6 @@ export class ObservableSanityClient {
88
90
  this.live = new LiveClient(this)
89
91
  this.projects = new ObservableProjectsClient(this, this.#httpRequest)
90
92
  this.users = new ObservableUsersClient(this, this.#httpRequest)
91
- this.ai = new ObservableAiClient(this, this.#httpRequest)
92
93
  }
93
94
 
94
95
  /**
@@ -726,6 +727,27 @@ export class ObservableSanityClient {
726
727
  getDataUrl(operation: string, path?: string): string {
727
728
  return dataMethods._getDataUrl(this, operation, path)
728
729
  }
730
+
731
+ instruct(request: InstructAsyncInstruction): Observable<{_id: string}>
732
+
733
+ instruct<DocumentShape extends Record<string, Any>>(
734
+ request: InstructSyncInstruction<DocumentShape>,
735
+ ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
736
+
737
+ /**
738
+ * Run an ad-hoc instruction for a target document.
739
+ * @param request instruction request
740
+ */
741
+ instruct<
742
+ DocumentShape extends Record<string, Any>,
743
+ Req extends InstructInstruction<DocumentShape>,
744
+ >(
745
+ request: Req,
746
+ ): Observable<
747
+ Req['async'] extends true ? {_id: string} : IdentifiedSanityDocumentStub & DocumentShape
748
+ > {
749
+ return _instruct(this, this.#httpRequest, request)
750
+ }
729
751
  }
730
752
 
731
753
  /** @public */
@@ -735,7 +757,6 @@ export class SanityClient {
735
757
  live: LiveClient
736
758
  projects: ProjectsClient
737
759
  users: UsersClient
738
- ai: AiClient
739
760
 
740
761
  /**
741
762
  * Observable version of the Sanity client, with the same configuration as the promise-based one
@@ -763,7 +784,6 @@ export class SanityClient {
763
784
  this.live = new LiveClient(this)
764
785
  this.projects = new ProjectsClient(this, this.#httpRequest)
765
786
  this.users = new UsersClient(this, this.#httpRequest)
766
- this.ai = new AiClient(this, this.#httpRequest)
767
787
 
768
788
  this.observable = new ObservableSanityClient(httpRequest, config)
769
789
  }
@@ -1432,4 +1452,25 @@ export class SanityClient {
1432
1452
  getDataUrl(operation: string, path?: string): string {
1433
1453
  return dataMethods._getDataUrl(this, operation, path)
1434
1454
  }
1455
+
1456
+ instruct(request: InstructAsyncInstruction): Promise<{_id: string}>
1457
+
1458
+ instruct<DocumentShape extends Record<string, Any>>(
1459
+ request: InstructSyncInstruction<DocumentShape>,
1460
+ ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
1461
+
1462
+ /**
1463
+ * Run an ad-hoc instruction for a target document.
1464
+ * @param request instruction request
1465
+ */
1466
+ instruct<
1467
+ DocumentShape extends Record<string, Any>,
1468
+ Req extends InstructInstruction<DocumentShape>,
1469
+ >(
1470
+ request: Req,
1471
+ ): Promise<
1472
+ Req['async'] extends true ? {_id: string} : IdentifiedSanityDocumentStub & DocumentShape
1473
+ > {
1474
+ return lastValueFrom(_instruct(this, this.#httpRequest, request))
1475
+ }
1435
1476
  }
@@ -0,0 +1,24 @@
1
+ import {type Observable} from 'rxjs'
2
+
3
+ import {_request} from '../data/dataMethods'
4
+ import type {ObservableSanityClient, SanityClient} from '../SanityClient'
5
+ import type {Any, HttpRequest, IdentifiedSanityDocumentStub, InstructInstruction} from '../types'
6
+ import {hasDataset} from '../validators'
7
+
8
+ export function _instruct<
9
+ DocumentShape extends Record<string, Any>,
10
+ Req extends InstructInstruction<DocumentShape>,
11
+ >(
12
+ client: SanityClient | ObservableSanityClient,
13
+ httpRequest: HttpRequest,
14
+ request: Req,
15
+ ): Observable<
16
+ Req['async'] extends true ? {_id: string} : IdentifiedSanityDocumentStub & DocumentShape
17
+ > {
18
+ const dataset = hasDataset(client.config())
19
+ return _request(client, httpRequest, {
20
+ method: 'POST',
21
+ uri: `/assist/tasks/instruct/${dataset}`,
22
+ body: request,
23
+ })
24
+ }
package/src/types.ts CHANGED
@@ -1345,7 +1345,7 @@ export type {
1345
1345
  InstructInstructionParam,
1346
1346
  InstructInstructionParams,
1347
1347
  InstructSyncInstruction,
1348
- } from './ai/types'
1348
+ } from './instruct/types'
1349
1349
  export type {
1350
1350
  ContentSourceMapParsedPath,
1351
1351
  ContentSourceMapParsedPathKeyedSegment,
@@ -2823,42 +2823,6 @@ ${selectionOpts}`);
2823
2823
  const error = new Error(signal?.reason ?? "The operation was aborted.");
2824
2824
  return error.name = "AbortError", error;
2825
2825
  }
2826
- function _instruct(client, httpRequest, request) {
2827
- const dataset2 = hasDataset(client.config());
2828
- return _request(client, httpRequest, {
2829
- method: "POST",
2830
- uri: `/assist/tasks/instruct/${dataset2}`,
2831
- body: request
2832
- });
2833
- }
2834
- class ObservableAiClient {
2835
- #client;
2836
- #httpRequest;
2837
- constructor(client, httpRequest) {
2838
- this.#client = client, this.#httpRequest = httpRequest;
2839
- }
2840
- /**
2841
- * Run an ad-hoc instruction for a target document.
2842
- * @param request instruction request
2843
- */
2844
- instruct(request) {
2845
- return _instruct(this.#client, this.#httpRequest, request);
2846
- }
2847
- }
2848
- class AiClient {
2849
- #client;
2850
- #httpRequest;
2851
- constructor(client, httpRequest) {
2852
- this.#client = client, this.#httpRequest = httpRequest;
2853
- }
2854
- /**
2855
- * Run an ad-hoc instruction for a target document.
2856
- * @param request instruction request
2857
- */
2858
- instruct(request) {
2859
- return lastValueFrom(_instruct(this.#client, this.#httpRequest, request));
2860
- }
2861
- }
2862
2826
  class ObservableAssetsClient {
2863
2827
  #client;
2864
2828
  #httpRequest;
@@ -3169,6 +3133,14 @@ ${selectionOpts}`);
3169
3133
  tag: null
3170
3134
  });
3171
3135
  }
3136
+ function _instruct(client, httpRequest, request) {
3137
+ const dataset2 = hasDataset(client.config());
3138
+ return _request(client, httpRequest, {
3139
+ method: "POST",
3140
+ uri: `/assist/tasks/instruct/${dataset2}`,
3141
+ body: request
3142
+ });
3143
+ }
3172
3144
  class ObservableProjectsClient {
3173
3145
  #client;
3174
3146
  #httpRequest;
@@ -3253,7 +3225,6 @@ ${selectionOpts}`);
3253
3225
  live;
3254
3226
  projects;
3255
3227
  users;
3256
- ai;
3257
3228
  /**
3258
3229
  * Private properties
3259
3230
  */
@@ -3264,7 +3235,7 @@ ${selectionOpts}`);
3264
3235
  */
3265
3236
  listen = _listen;
3266
3237
  constructor(httpRequest, config = defaultConfig) {
3267
- this.config(config), this.#httpRequest = httpRequest, this.assets = new ObservableAssetsClient(this, this.#httpRequest), this.datasets = new ObservableDatasetsClient(this, this.#httpRequest), this.live = new LiveClient(this), this.projects = new ObservableProjectsClient(this, this.#httpRequest), this.users = new ObservableUsersClient(this, this.#httpRequest), this.ai = new ObservableAiClient(this, this.#httpRequest);
3238
+ this.config(config), this.#httpRequest = httpRequest, this.assets = new ObservableAssetsClient(this, this.#httpRequest), this.datasets = new ObservableDatasetsClient(this, this.#httpRequest), this.live = new LiveClient(this), this.projects = new ObservableProjectsClient(this, this.#httpRequest), this.users = new ObservableUsersClient(this, this.#httpRequest);
3268
3239
  }
3269
3240
  /**
3270
3241
  * Clone the client - returns a new instance
@@ -3396,6 +3367,13 @@ ${selectionOpts}`);
3396
3367
  getDataUrl(operation, path) {
3397
3368
  return _getDataUrl(this, operation, path);
3398
3369
  }
3370
+ /**
3371
+ * Run an ad-hoc instruction for a target document.
3372
+ * @param request instruction request
3373
+ */
3374
+ instruct(request) {
3375
+ return _instruct(this, this.#httpRequest, request);
3376
+ }
3399
3377
  }
3400
3378
  class SanityClient {
3401
3379
  assets;
@@ -3403,7 +3381,6 @@ ${selectionOpts}`);
3403
3381
  live;
3404
3382
  projects;
3405
3383
  users;
3406
- ai;
3407
3384
  /**
3408
3385
  * Observable version of the Sanity client, with the same configuration as the promise-based one
3409
3386
  */
@@ -3418,7 +3395,7 @@ ${selectionOpts}`);
3418
3395
  */
3419
3396
  listen = _listen;
3420
3397
  constructor(httpRequest, config = defaultConfig) {
3421
- this.config(config), this.#httpRequest = httpRequest, this.assets = new AssetsClient(this, this.#httpRequest), this.datasets = new DatasetsClient(this, this.#httpRequest), this.live = new LiveClient(this), this.projects = new ProjectsClient(this, this.#httpRequest), this.users = new UsersClient(this, this.#httpRequest), this.ai = new AiClient(this, this.#httpRequest), this.observable = new ObservableSanityClient(httpRequest, config);
3398
+ this.config(config), this.#httpRequest = httpRequest, this.assets = new AssetsClient(this, this.#httpRequest), this.datasets = new DatasetsClient(this, this.#httpRequest), this.live = new LiveClient(this), this.projects = new ProjectsClient(this, this.#httpRequest), this.users = new UsersClient(this, this.#httpRequest), this.observable = new ObservableSanityClient(httpRequest, config);
3422
3399
  }
3423
3400
  /**
3424
3401
  * Clone the client - returns a new instance
@@ -3574,6 +3551,13 @@ ${selectionOpts}`);
3574
3551
  getDataUrl(operation, path) {
3575
3552
  return _getDataUrl(this, operation, path);
3576
3553
  }
3554
+ /**
3555
+ * Run an ad-hoc instruction for a target document.
3556
+ * @param request instruction request
3557
+ */
3558
+ instruct(request) {
3559
+ return lastValueFrom(_instruct(this, this.#httpRequest, request));
3560
+ }
3577
3561
  }
3578
3562
  function defineCreateClientExports(envMiddleware2, ClassConstructor) {
3579
3563
  return { requester: defineHttpRequest(envMiddleware2), createClient: (config) => {