@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.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.cjs
CHANGED
|
@@ -795,42 +795,6 @@ function _createAbortError(signal) {
|
|
|
795
795
|
const error = new Error(signal?.reason ?? "The operation was aborted.");
|
|
796
796
|
return error.name = "AbortError", error;
|
|
797
797
|
}
|
|
798
|
-
function _instruct(client, httpRequest, request) {
|
|
799
|
-
const dataset = config.hasDataset(client.config());
|
|
800
|
-
return _request(client, httpRequest, {
|
|
801
|
-
method: "POST",
|
|
802
|
-
uri: `/assist/tasks/instruct/${dataset}`,
|
|
803
|
-
body: request
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
class ObservableAiClient {
|
|
807
|
-
#client;
|
|
808
|
-
#httpRequest;
|
|
809
|
-
constructor(client, httpRequest) {
|
|
810
|
-
this.#client = client, this.#httpRequest = httpRequest;
|
|
811
|
-
}
|
|
812
|
-
/**
|
|
813
|
-
* Run an ad-hoc instruction for a target document.
|
|
814
|
-
* @param request instruction request
|
|
815
|
-
*/
|
|
816
|
-
instruct(request) {
|
|
817
|
-
return _instruct(this.#client, this.#httpRequest, request);
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
class AiClient {
|
|
821
|
-
#client;
|
|
822
|
-
#httpRequest;
|
|
823
|
-
constructor(client, httpRequest) {
|
|
824
|
-
this.#client = client, this.#httpRequest = httpRequest;
|
|
825
|
-
}
|
|
826
|
-
/**
|
|
827
|
-
* Run an ad-hoc instruction for a target document.
|
|
828
|
-
* @param request instruction request
|
|
829
|
-
*/
|
|
830
|
-
instruct(request) {
|
|
831
|
-
return rxjs.lastValueFrom(_instruct(this.#client, this.#httpRequest, request));
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
798
|
class ObservableAssetsClient {
|
|
835
799
|
#client;
|
|
836
800
|
#httpRequest;
|
|
@@ -1141,6 +1105,14 @@ function _modify(client, httpRequest, method, name2, options) {
|
|
|
1141
1105
|
tag: null
|
|
1142
1106
|
});
|
|
1143
1107
|
}
|
|
1108
|
+
function _instruct(client, httpRequest, request) {
|
|
1109
|
+
const dataset = config.hasDataset(client.config());
|
|
1110
|
+
return _request(client, httpRequest, {
|
|
1111
|
+
method: "POST",
|
|
1112
|
+
uri: `/assist/tasks/instruct/${dataset}`,
|
|
1113
|
+
body: request
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1144
1116
|
class ObservableProjectsClient {
|
|
1145
1117
|
#client;
|
|
1146
1118
|
#httpRequest;
|
|
@@ -1225,7 +1197,6 @@ class ObservableSanityClient {
|
|
|
1225
1197
|
live;
|
|
1226
1198
|
projects;
|
|
1227
1199
|
users;
|
|
1228
|
-
ai;
|
|
1229
1200
|
/**
|
|
1230
1201
|
* Private properties
|
|
1231
1202
|
*/
|
|
@@ -1236,7 +1207,7 @@ class ObservableSanityClient {
|
|
|
1236
1207
|
*/
|
|
1237
1208
|
listen = _listen;
|
|
1238
1209
|
constructor(httpRequest, config$1 = config.defaultConfig) {
|
|
1239
|
-
this.config(config$1), 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)
|
|
1210
|
+
this.config(config$1), 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);
|
|
1240
1211
|
}
|
|
1241
1212
|
/**
|
|
1242
1213
|
* Clone the client - returns a new instance
|
|
@@ -1368,6 +1339,13 @@ class ObservableSanityClient {
|
|
|
1368
1339
|
getDataUrl(operation, path) {
|
|
1369
1340
|
return _getDataUrl(this, operation, path);
|
|
1370
1341
|
}
|
|
1342
|
+
/**
|
|
1343
|
+
* Run an ad-hoc instruction for a target document.
|
|
1344
|
+
* @param request instruction request
|
|
1345
|
+
*/
|
|
1346
|
+
instruct(request) {
|
|
1347
|
+
return _instruct(this, this.#httpRequest, request);
|
|
1348
|
+
}
|
|
1371
1349
|
}
|
|
1372
1350
|
class SanityClient {
|
|
1373
1351
|
assets;
|
|
@@ -1375,7 +1353,6 @@ class SanityClient {
|
|
|
1375
1353
|
live;
|
|
1376
1354
|
projects;
|
|
1377
1355
|
users;
|
|
1378
|
-
ai;
|
|
1379
1356
|
/**
|
|
1380
1357
|
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
1381
1358
|
*/
|
|
@@ -1390,7 +1367,7 @@ class SanityClient {
|
|
|
1390
1367
|
*/
|
|
1391
1368
|
listen = _listen;
|
|
1392
1369
|
constructor(httpRequest, config$1 = config.defaultConfig) {
|
|
1393
|
-
this.config(config$1), 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.
|
|
1370
|
+
this.config(config$1), 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$1);
|
|
1394
1371
|
}
|
|
1395
1372
|
/**
|
|
1396
1373
|
* Clone the client - returns a new instance
|
|
@@ -1546,6 +1523,13 @@ class SanityClient {
|
|
|
1546
1523
|
getDataUrl(operation, path) {
|
|
1547
1524
|
return _getDataUrl(this, operation, path);
|
|
1548
1525
|
}
|
|
1526
|
+
/**
|
|
1527
|
+
* Run an ad-hoc instruction for a target document.
|
|
1528
|
+
* @param request instruction request
|
|
1529
|
+
*/
|
|
1530
|
+
instruct(request) {
|
|
1531
|
+
return rxjs.lastValueFrom(_instruct(this, this.#httpRequest, request));
|
|
1532
|
+
}
|
|
1549
1533
|
}
|
|
1550
1534
|
function defineCreateClientExports(envMiddleware, ClassConstructor) {
|
|
1551
1535
|
return { requester: defineHttpRequest(envMiddleware), createClient: (config2) => {
|
|
@@ -1566,7 +1550,7 @@ function defineDeprecatedCreateClient(createClient2) {
|
|
|
1566
1550
|
return config.printNoDefaultExport(), createClient2(config$1);
|
|
1567
1551
|
};
|
|
1568
1552
|
}
|
|
1569
|
-
var name = "@sanity/client", version = "6.28.3-instruct.
|
|
1553
|
+
var name = "@sanity/client", version = "6.28.3-instruct.2";
|
|
1570
1554
|
const middleware = [
|
|
1571
1555
|
middleware$1.debug({ verbose: !0, namespace: "sanity:client" }),
|
|
1572
1556
|
middleware$1.headers({ "User-Agent": `${name} ${version}` }),
|