@sanity/client 6.28.3-instruct.1 → 6.28.3-instruct.3
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.browser.cjs +24 -40
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +12 -26
- package/dist/index.browser.d.ts +12 -26
- package/dist/index.browser.js +24 -40
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +25 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -26
- package/dist/index.d.ts +12 -26
- package/dist/index.js +25 -41
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +12 -26
- package/dist/stega.browser.d.ts +12 -26
- package/dist/stega.d.cts +12 -26
- package/dist/stega.d.ts +12 -26
- package/package.json +1 -1
- package/src/SanityClient.ts +46 -5
- package/src/instruct/instruct.ts +24 -0
- package/src/types.ts +1 -1
- package/umd/sanityClient.js +24 -40
- package/umd/sanityClient.min.js +2 -2
- package/src/ai/AiClient.ts +0 -93
- /package/src/{ai → instruct}/types.ts +0 -0
package/dist/index.browser.cjs
CHANGED
|
@@ -933,42 +933,6 @@ function _createAbortError(signal) {
|
|
|
933
933
|
const error = new Error(signal?.reason ?? "The operation was aborted.");
|
|
934
934
|
return error.name = "AbortError", error;
|
|
935
935
|
}
|
|
936
|
-
function _instruct(client, httpRequest, request) {
|
|
937
|
-
const dataset2 = hasDataset(client.config());
|
|
938
|
-
return _request(client, httpRequest, {
|
|
939
|
-
method: "POST",
|
|
940
|
-
uri: `/assist/tasks/instruct/${dataset2}`,
|
|
941
|
-
body: request
|
|
942
|
-
});
|
|
943
|
-
}
|
|
944
|
-
class ObservableAiClient {
|
|
945
|
-
#client;
|
|
946
|
-
#httpRequest;
|
|
947
|
-
constructor(client, httpRequest) {
|
|
948
|
-
this.#client = client, this.#httpRequest = httpRequest;
|
|
949
|
-
}
|
|
950
|
-
/**
|
|
951
|
-
* Run an ad-hoc instruction for a target document.
|
|
952
|
-
* @param request instruction request
|
|
953
|
-
*/
|
|
954
|
-
instruct(request) {
|
|
955
|
-
return _instruct(this.#client, this.#httpRequest, request);
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
class AiClient {
|
|
959
|
-
#client;
|
|
960
|
-
#httpRequest;
|
|
961
|
-
constructor(client, httpRequest) {
|
|
962
|
-
this.#client = client, this.#httpRequest = httpRequest;
|
|
963
|
-
}
|
|
964
|
-
/**
|
|
965
|
-
* Run an ad-hoc instruction for a target document.
|
|
966
|
-
* @param request instruction request
|
|
967
|
-
*/
|
|
968
|
-
instruct(request) {
|
|
969
|
-
return rxjs.lastValueFrom(_instruct(this.#client, this.#httpRequest, request));
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
936
|
class ObservableAssetsClient {
|
|
973
937
|
#client;
|
|
974
938
|
#httpRequest;
|
|
@@ -1279,6 +1243,14 @@ function _modify(client, httpRequest, method, name, options) {
|
|
|
1279
1243
|
tag: null
|
|
1280
1244
|
});
|
|
1281
1245
|
}
|
|
1246
|
+
function _instruct(client, httpRequest, request) {
|
|
1247
|
+
const dataset2 = hasDataset(client.config());
|
|
1248
|
+
return _request(client, httpRequest, {
|
|
1249
|
+
method: "POST",
|
|
1250
|
+
uri: `/instruct/${dataset2}`,
|
|
1251
|
+
body: request
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1282
1254
|
class ObservableProjectsClient {
|
|
1283
1255
|
#client;
|
|
1284
1256
|
#httpRequest;
|
|
@@ -1363,7 +1335,6 @@ class ObservableSanityClient {
|
|
|
1363
1335
|
live;
|
|
1364
1336
|
projects;
|
|
1365
1337
|
users;
|
|
1366
|
-
ai;
|
|
1367
1338
|
/**
|
|
1368
1339
|
* Private properties
|
|
1369
1340
|
*/
|
|
@@ -1374,7 +1345,7 @@ class ObservableSanityClient {
|
|
|
1374
1345
|
*/
|
|
1375
1346
|
listen = _listen;
|
|
1376
1347
|
constructor(httpRequest, config = defaultConfig) {
|
|
1377
|
-
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)
|
|
1348
|
+
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);
|
|
1378
1349
|
}
|
|
1379
1350
|
/**
|
|
1380
1351
|
* Clone the client - returns a new instance
|
|
@@ -1506,6 +1477,13 @@ class ObservableSanityClient {
|
|
|
1506
1477
|
getDataUrl(operation, path) {
|
|
1507
1478
|
return _getDataUrl(this, operation, path);
|
|
1508
1479
|
}
|
|
1480
|
+
/**
|
|
1481
|
+
* Run an ad-hoc instruction for a target document.
|
|
1482
|
+
* @param request instruction request
|
|
1483
|
+
*/
|
|
1484
|
+
instruct(request) {
|
|
1485
|
+
return _instruct(this, this.#httpRequest, request);
|
|
1486
|
+
}
|
|
1509
1487
|
}
|
|
1510
1488
|
class SanityClient {
|
|
1511
1489
|
assets;
|
|
@@ -1513,7 +1491,6 @@ class SanityClient {
|
|
|
1513
1491
|
live;
|
|
1514
1492
|
projects;
|
|
1515
1493
|
users;
|
|
1516
|
-
ai;
|
|
1517
1494
|
/**
|
|
1518
1495
|
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
1519
1496
|
*/
|
|
@@ -1528,7 +1505,7 @@ class SanityClient {
|
|
|
1528
1505
|
*/
|
|
1529
1506
|
listen = _listen;
|
|
1530
1507
|
constructor(httpRequest, config = defaultConfig) {
|
|
1531
|
-
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.
|
|
1508
|
+
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);
|
|
1532
1509
|
}
|
|
1533
1510
|
/**
|
|
1534
1511
|
* Clone the client - returns a new instance
|
|
@@ -1684,6 +1661,13 @@ class SanityClient {
|
|
|
1684
1661
|
getDataUrl(operation, path) {
|
|
1685
1662
|
return _getDataUrl(this, operation, path);
|
|
1686
1663
|
}
|
|
1664
|
+
/**
|
|
1665
|
+
* Run an ad-hoc instruction for a target document.
|
|
1666
|
+
* @param request instruction request
|
|
1667
|
+
*/
|
|
1668
|
+
instruct(request) {
|
|
1669
|
+
return rxjs.lastValueFrom(_instruct(this, this.#httpRequest, request));
|
|
1670
|
+
}
|
|
1687
1671
|
}
|
|
1688
1672
|
function defineCreateClientExports(envMiddleware2, ClassConstructor) {
|
|
1689
1673
|
return { requester: defineHttpRequest(envMiddleware2), createClient: (config) => {
|