@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.
package/dist/index.d.cts CHANGED
@@ -41,18 +41,6 @@ export declare interface ActionErrorItem {
41
41
  index: number
42
42
  }
43
43
 
44
- /** @public */
45
- declare class AiClient {
46
- #private
47
- constructor(client: SanityClient, httpRequest: HttpRequest)
48
- instruct(request: InstructAsyncInstruction): Promise<{
49
- _id: string
50
- }>
51
- instruct<DocumentShape extends Record<string, Any>>(
52
- request: InstructSyncInstruction<DocumentShape>,
53
- ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
54
- }
55
-
56
44
  /** @internal */
57
45
  export declare type AllDocumentIdsMutationOptions = BaseMutationOptions & {
58
46
  returnFirst: false
@@ -1453,18 +1441,6 @@ export declare type MutationSelectionQueryParams = {
1453
1441
  [key: string]: Any
1454
1442
  }
1455
1443
 
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
1444
  /** @internal */
1469
1445
  export declare class ObservableAssetsClient {
1470
1446
  #private
@@ -1642,7 +1618,6 @@ export declare class ObservableSanityClient {
1642
1618
  live: LiveClient
1643
1619
  projects: ObservableProjectsClient
1644
1620
  users: ObservableUsersClient
1645
- ai: ObservableAiClient
1646
1621
  /**
1647
1622
  * Instance properties
1648
1623
  */
@@ -2137,6 +2112,12 @@ export declare class ObservableSanityClient {
2137
2112
  * @param path - Path to append after the operation
2138
2113
  */
2139
2114
  getDataUrl(operation: string, path?: string): string
2115
+ instruct(request: InstructAsyncInstruction): Observable<{
2116
+ _id: string
2117
+ }>
2118
+ instruct<DocumentShape extends Record<string, Any>>(
2119
+ request: InstructSyncInstruction<DocumentShape>,
2120
+ ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
2140
2121
  }
2141
2122
 
2142
2123
  /** @public */
@@ -2562,7 +2543,6 @@ export declare class SanityClient {
2562
2543
  live: LiveClient
2563
2544
  projects: ProjectsClient
2564
2545
  users: UsersClient
2565
- ai: AiClient
2566
2546
  /**
2567
2547
  * Observable version of the Sanity client, with the same configuration as the promise-based one
2568
2548
  */
@@ -3077,6 +3057,12 @@ export declare class SanityClient {
3077
3057
  * @param path - Path to append after the operation
3078
3058
  */
3079
3059
  getDataUrl(operation: string, path?: string): string
3060
+ instruct(request: InstructAsyncInstruction): Promise<{
3061
+ _id: string
3062
+ }>
3063
+ instruct<DocumentShape extends Record<string, Any>>(
3064
+ request: InstructSyncInstruction<DocumentShape>,
3065
+ ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
3080
3066
  }
3081
3067
 
3082
3068
  /** @internal */
package/dist/index.d.ts CHANGED
@@ -41,18 +41,6 @@ export declare interface ActionErrorItem {
41
41
  index: number
42
42
  }
43
43
 
44
- /** @public */
45
- declare class AiClient {
46
- #private
47
- constructor(client: SanityClient, httpRequest: HttpRequest)
48
- instruct(request: InstructAsyncInstruction): Promise<{
49
- _id: string
50
- }>
51
- instruct<DocumentShape extends Record<string, Any>>(
52
- request: InstructSyncInstruction<DocumentShape>,
53
- ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
54
- }
55
-
56
44
  /** @internal */
57
45
  export declare type AllDocumentIdsMutationOptions = BaseMutationOptions & {
58
46
  returnFirst: false
@@ -1453,18 +1441,6 @@ export declare type MutationSelectionQueryParams = {
1453
1441
  [key: string]: Any
1454
1442
  }
1455
1443
 
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
1444
  /** @internal */
1469
1445
  export declare class ObservableAssetsClient {
1470
1446
  #private
@@ -1642,7 +1618,6 @@ export declare class ObservableSanityClient {
1642
1618
  live: LiveClient
1643
1619
  projects: ObservableProjectsClient
1644
1620
  users: ObservableUsersClient
1645
- ai: ObservableAiClient
1646
1621
  /**
1647
1622
  * Instance properties
1648
1623
  */
@@ -2137,6 +2112,12 @@ export declare class ObservableSanityClient {
2137
2112
  * @param path - Path to append after the operation
2138
2113
  */
2139
2114
  getDataUrl(operation: string, path?: string): string
2115
+ instruct(request: InstructAsyncInstruction): Observable<{
2116
+ _id: string
2117
+ }>
2118
+ instruct<DocumentShape extends Record<string, Any>>(
2119
+ request: InstructSyncInstruction<DocumentShape>,
2120
+ ): Observable<IdentifiedSanityDocumentStub & DocumentShape>
2140
2121
  }
2141
2122
 
2142
2123
  /** @public */
@@ -2562,7 +2543,6 @@ export declare class SanityClient {
2562
2543
  live: LiveClient
2563
2544
  projects: ProjectsClient
2564
2545
  users: UsersClient
2565
- ai: AiClient
2566
2546
  /**
2567
2547
  * Observable version of the Sanity client, with the same configuration as the promise-based one
2568
2548
  */
@@ -3077,6 +3057,12 @@ export declare class SanityClient {
3077
3057
  * @param path - Path to append after the operation
3078
3058
  */
3079
3059
  getDataUrl(operation: string, path?: string): string
3060
+ instruct(request: InstructAsyncInstruction): Promise<{
3061
+ _id: string
3062
+ }>
3063
+ instruct<DocumentShape extends Record<string, Any>>(
3064
+ request: InstructSyncInstruction<DocumentShape>,
3065
+ ): Promise<IdentifiedSanityDocumentStub & DocumentShape>
3080
3066
  }
3081
3067
 
3082
3068
  /** @internal */
package/dist/index.js CHANGED
@@ -778,42 +778,6 @@ function _createAbortError(signal) {
778
778
  const error = new Error(signal?.reason ?? "The operation was aborted.");
779
779
  return error.name = "AbortError", error;
780
780
  }
781
- function _instruct(client, httpRequest, request) {
782
- const dataset2 = hasDataset(client.config());
783
- return _request(client, httpRequest, {
784
- method: "POST",
785
- uri: `/assist/tasks/instruct/${dataset2}`,
786
- body: request
787
- });
788
- }
789
- class ObservableAiClient {
790
- #client;
791
- #httpRequest;
792
- constructor(client, httpRequest) {
793
- this.#client = client, this.#httpRequest = httpRequest;
794
- }
795
- /**
796
- * Run an ad-hoc instruction for a target document.
797
- * @param request instruction request
798
- */
799
- instruct(request) {
800
- return _instruct(this.#client, this.#httpRequest, request);
801
- }
802
- }
803
- class AiClient {
804
- #client;
805
- #httpRequest;
806
- constructor(client, httpRequest) {
807
- this.#client = client, this.#httpRequest = httpRequest;
808
- }
809
- /**
810
- * Run an ad-hoc instruction for a target document.
811
- * @param request instruction request
812
- */
813
- instruct(request) {
814
- return lastValueFrom(_instruct(this.#client, this.#httpRequest, request));
815
- }
816
- }
817
781
  class ObservableAssetsClient {
818
782
  #client;
819
783
  #httpRequest;
@@ -1124,6 +1088,14 @@ function _modify(client, httpRequest, method, name2, options) {
1124
1088
  tag: null
1125
1089
  });
1126
1090
  }
1091
+ function _instruct(client, httpRequest, request) {
1092
+ const dataset2 = hasDataset(client.config());
1093
+ return _request(client, httpRequest, {
1094
+ method: "POST",
1095
+ uri: `/assist/tasks/instruct/${dataset2}`,
1096
+ body: request
1097
+ });
1098
+ }
1127
1099
  class ObservableProjectsClient {
1128
1100
  #client;
1129
1101
  #httpRequest;
@@ -1208,7 +1180,6 @@ class ObservableSanityClient {
1208
1180
  live;
1209
1181
  projects;
1210
1182
  users;
1211
- ai;
1212
1183
  /**
1213
1184
  * Private properties
1214
1185
  */
@@ -1219,7 +1190,7 @@ class ObservableSanityClient {
1219
1190
  */
1220
1191
  listen = _listen;
1221
1192
  constructor(httpRequest, config = defaultConfig) {
1222
- 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);
1193
+ 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);
1223
1194
  }
1224
1195
  /**
1225
1196
  * Clone the client - returns a new instance
@@ -1351,6 +1322,13 @@ class ObservableSanityClient {
1351
1322
  getDataUrl(operation, path) {
1352
1323
  return _getDataUrl(this, operation, path);
1353
1324
  }
1325
+ /**
1326
+ * Run an ad-hoc instruction for a target document.
1327
+ * @param request instruction request
1328
+ */
1329
+ instruct(request) {
1330
+ return _instruct(this, this.#httpRequest, request);
1331
+ }
1354
1332
  }
1355
1333
  class SanityClient {
1356
1334
  assets;
@@ -1358,7 +1336,6 @@ class SanityClient {
1358
1336
  live;
1359
1337
  projects;
1360
1338
  users;
1361
- ai;
1362
1339
  /**
1363
1340
  * Observable version of the Sanity client, with the same configuration as the promise-based one
1364
1341
  */
@@ -1373,7 +1350,7 @@ class SanityClient {
1373
1350
  */
1374
1351
  listen = _listen;
1375
1352
  constructor(httpRequest, config = defaultConfig) {
1376
- 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);
1353
+ 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);
1377
1354
  }
1378
1355
  /**
1379
1356
  * Clone the client - returns a new instance
@@ -1529,6 +1506,13 @@ class SanityClient {
1529
1506
  getDataUrl(operation, path) {
1530
1507
  return _getDataUrl(this, operation, path);
1531
1508
  }
1509
+ /**
1510
+ * Run an ad-hoc instruction for a target document.
1511
+ * @param request instruction request
1512
+ */
1513
+ instruct(request) {
1514
+ return lastValueFrom(_instruct(this, this.#httpRequest, request));
1515
+ }
1532
1516
  }
1533
1517
  function defineCreateClientExports(envMiddleware, ClassConstructor) {
1534
1518
  return { requester: defineHttpRequest(envMiddleware), createClient: (config) => {
@@ -1549,7 +1533,7 @@ function defineDeprecatedCreateClient(createClient2) {
1549
1533
  return printNoDefaultExport(), createClient2(config);
1550
1534
  };
1551
1535
  }
1552
- var name = "@sanity/client", version = "6.28.3-instruct.1";
1536
+ var name = "@sanity/client", version = "6.28.3-instruct.2";
1553
1537
  const middleware = [
1554
1538
  debug({ verbose: !0, namespace: "sanity:client" }),
1555
1539
  headers({ "User-Agent": `${name} ${version}` }),