@sanity/client 6.28.4-beta.1 → 6.28.4-generate.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.
- package/dist/_chunks-cjs/config.cjs +1 -11
- package/dist/_chunks-cjs/config.cjs.map +1 -1
- package/dist/_chunks-es/config.js +1 -11
- package/dist/_chunks-es/config.js.map +1 -1
- package/dist/index.browser.cjs +45 -13
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +404 -0
- package/dist/index.browser.d.ts +404 -0
- package/dist/index.browser.js +45 -13
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +45 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +393 -0
- package/dist/index.d.ts +393 -0
- package/dist/index.js +45 -3
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +393 -0
- package/dist/stega.browser.d.ts +393 -0
- package/dist/stega.d.cts +393 -0
- package/dist/stega.d.ts +393 -0
- package/package.json +22 -22
- package/src/SanityClient.ts +13 -0
- package/src/agent/actions/AgentActionsClient.ts +74 -0
- package/src/agent/actions/generate.ts +24 -0
- package/src/agent/actions/types.ts +373 -0
- package/src/config.ts +2 -17
- package/src/types.ts +10 -0
- package/umd/sanityClient.js +45 -13
- package/umd/sanityClient.min.js +2 -2
package/dist/index.cjs
CHANGED
|
@@ -795,6 +795,42 @@ 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 _generate(client, httpRequest, request) {
|
|
799
|
+
const dataset = config.hasDataset(client.config());
|
|
800
|
+
return _request(client, httpRequest, {
|
|
801
|
+
method: "POST",
|
|
802
|
+
uri: `/agent/action/generate/${dataset}`,
|
|
803
|
+
body: request
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
class ObservableAgentsActionClient {
|
|
807
|
+
#client;
|
|
808
|
+
#httpRequest;
|
|
809
|
+
constructor(client, httpRequest) {
|
|
810
|
+
this.#client = client, this.#httpRequest = httpRequest;
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* Run an instruction to generate content in a target document.
|
|
814
|
+
* @param request instruction request
|
|
815
|
+
*/
|
|
816
|
+
generate(request) {
|
|
817
|
+
return _generate(this.#client, this.#httpRequest, request);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
class AgentActionsClient {
|
|
821
|
+
#client;
|
|
822
|
+
#httpRequest;
|
|
823
|
+
constructor(client, httpRequest) {
|
|
824
|
+
this.#client = client, this.#httpRequest = httpRequest;
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Run an instruction to generate content in a target document.
|
|
828
|
+
* @param request instruction request
|
|
829
|
+
*/
|
|
830
|
+
generate(request) {
|
|
831
|
+
return rxjs.lastValueFrom(_generate(this.#client, this.#httpRequest, request));
|
|
832
|
+
}
|
|
833
|
+
}
|
|
798
834
|
class ObservableAssetsClient {
|
|
799
835
|
#client;
|
|
800
836
|
#httpRequest;
|
|
@@ -1189,6 +1225,7 @@ class ObservableSanityClient {
|
|
|
1189
1225
|
live;
|
|
1190
1226
|
projects;
|
|
1191
1227
|
users;
|
|
1228
|
+
agent;
|
|
1192
1229
|
/**
|
|
1193
1230
|
* Private properties
|
|
1194
1231
|
*/
|
|
@@ -1199,7 +1236,9 @@ class ObservableSanityClient {
|
|
|
1199
1236
|
*/
|
|
1200
1237
|
listen = _listen;
|
|
1201
1238
|
constructor(httpRequest, config$1 = config.defaultConfig) {
|
|
1202
|
-
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)
|
|
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), this.agent = {
|
|
1240
|
+
action: new ObservableAgentsActionClient(this, this.#httpRequest)
|
|
1241
|
+
};
|
|
1203
1242
|
}
|
|
1204
1243
|
/**
|
|
1205
1244
|
* Clone the client - returns a new instance
|
|
@@ -1338,6 +1377,7 @@ class SanityClient {
|
|
|
1338
1377
|
live;
|
|
1339
1378
|
projects;
|
|
1340
1379
|
users;
|
|
1380
|
+
agent;
|
|
1341
1381
|
/**
|
|
1342
1382
|
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
1343
1383
|
*/
|
|
@@ -1352,7 +1392,9 @@ class SanityClient {
|
|
|
1352
1392
|
*/
|
|
1353
1393
|
listen = _listen;
|
|
1354
1394
|
constructor(httpRequest, config$1 = config.defaultConfig) {
|
|
1355
|
-
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.
|
|
1395
|
+
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.agent = {
|
|
1396
|
+
action: new AgentActionsClient(this, this.#httpRequest)
|
|
1397
|
+
}, this.observable = new ObservableSanityClient(httpRequest, config$1);
|
|
1356
1398
|
}
|
|
1357
1399
|
/**
|
|
1358
1400
|
* Clone the client - returns a new instance
|
|
@@ -1528,7 +1570,7 @@ function defineDeprecatedCreateClient(createClient2) {
|
|
|
1528
1570
|
return config.printNoDefaultExport(), createClient2(config$1);
|
|
1529
1571
|
};
|
|
1530
1572
|
}
|
|
1531
|
-
var name = "@sanity/client", version = "6.28.4-
|
|
1573
|
+
var name = "@sanity/client", version = "6.28.4-generate.0";
|
|
1532
1574
|
const middleware = [
|
|
1533
1575
|
middleware$1.debug({ verbose: !0, namespace: "sanity:client" }),
|
|
1534
1576
|
middleware$1.headers({ "User-Agent": `${name} ${version}` }),
|