@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.d.cts
CHANGED
|
@@ -39,18 +39,6 @@ export declare interface ActionErrorItem {
|
|
|
39
39
|
index: number
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
/** @public */
|
|
43
|
-
declare class AiClient {
|
|
44
|
-
#private
|
|
45
|
-
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
46
|
-
instruct(request: InstructAsyncInstruction): Promise<{
|
|
47
|
-
_id: string
|
|
48
|
-
}>
|
|
49
|
-
instruct<DocumentShape extends Record<string, Any>>(
|
|
50
|
-
request: InstructSyncInstruction<DocumentShape>,
|
|
51
|
-
): Promise<IdentifiedSanityDocumentStub & DocumentShape>
|
|
52
|
-
}
|
|
53
|
-
|
|
54
42
|
/** @internal */
|
|
55
43
|
export declare type AllDocumentIdsMutationOptions = BaseMutationOptions & {
|
|
56
44
|
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.browser.d.ts
CHANGED
|
@@ -39,18 +39,6 @@ export declare interface ActionErrorItem {
|
|
|
39
39
|
index: number
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
/** @public */
|
|
43
|
-
declare class AiClient {
|
|
44
|
-
#private
|
|
45
|
-
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
46
|
-
instruct(request: InstructAsyncInstruction): Promise<{
|
|
47
|
-
_id: string
|
|
48
|
-
}>
|
|
49
|
-
instruct<DocumentShape extends Record<string, Any>>(
|
|
50
|
-
request: InstructSyncInstruction<DocumentShape>,
|
|
51
|
-
): Promise<IdentifiedSanityDocumentStub & DocumentShape>
|
|
52
|
-
}
|
|
53
|
-
|
|
54
42
|
/** @internal */
|
|
55
43
|
export declare type AllDocumentIdsMutationOptions = BaseMutationOptions & {
|
|
56
44
|
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.browser.js
CHANGED
|
@@ -915,42 +915,6 @@ function _createAbortError(signal) {
|
|
|
915
915
|
const error = new Error(signal?.reason ?? "The operation was aborted.");
|
|
916
916
|
return error.name = "AbortError", error;
|
|
917
917
|
}
|
|
918
|
-
function _instruct(client, httpRequest, request) {
|
|
919
|
-
const dataset2 = hasDataset(client.config());
|
|
920
|
-
return _request(client, httpRequest, {
|
|
921
|
-
method: "POST",
|
|
922
|
-
uri: `/assist/tasks/instruct/${dataset2}`,
|
|
923
|
-
body: request
|
|
924
|
-
});
|
|
925
|
-
}
|
|
926
|
-
class ObservableAiClient {
|
|
927
|
-
#client;
|
|
928
|
-
#httpRequest;
|
|
929
|
-
constructor(client, httpRequest) {
|
|
930
|
-
this.#client = client, this.#httpRequest = httpRequest;
|
|
931
|
-
}
|
|
932
|
-
/**
|
|
933
|
-
* Run an ad-hoc instruction for a target document.
|
|
934
|
-
* @param request instruction request
|
|
935
|
-
*/
|
|
936
|
-
instruct(request) {
|
|
937
|
-
return _instruct(this.#client, this.#httpRequest, request);
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
class AiClient {
|
|
941
|
-
#client;
|
|
942
|
-
#httpRequest;
|
|
943
|
-
constructor(client, httpRequest) {
|
|
944
|
-
this.#client = client, this.#httpRequest = httpRequest;
|
|
945
|
-
}
|
|
946
|
-
/**
|
|
947
|
-
* Run an ad-hoc instruction for a target document.
|
|
948
|
-
* @param request instruction request
|
|
949
|
-
*/
|
|
950
|
-
instruct(request) {
|
|
951
|
-
return lastValueFrom(_instruct(this.#client, this.#httpRequest, request));
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
918
|
class ObservableAssetsClient {
|
|
955
919
|
#client;
|
|
956
920
|
#httpRequest;
|
|
@@ -1261,6 +1225,14 @@ function _modify(client, httpRequest, method, name, options) {
|
|
|
1261
1225
|
tag: null
|
|
1262
1226
|
});
|
|
1263
1227
|
}
|
|
1228
|
+
function _instruct(client, httpRequest, request) {
|
|
1229
|
+
const dataset2 = hasDataset(client.config());
|
|
1230
|
+
return _request(client, httpRequest, {
|
|
1231
|
+
method: "POST",
|
|
1232
|
+
uri: `/instruct/${dataset2}`,
|
|
1233
|
+
body: request
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1264
1236
|
class ObservableProjectsClient {
|
|
1265
1237
|
#client;
|
|
1266
1238
|
#httpRequest;
|
|
@@ -1345,7 +1317,6 @@ class ObservableSanityClient {
|
|
|
1345
1317
|
live;
|
|
1346
1318
|
projects;
|
|
1347
1319
|
users;
|
|
1348
|
-
ai;
|
|
1349
1320
|
/**
|
|
1350
1321
|
* Private properties
|
|
1351
1322
|
*/
|
|
@@ -1356,7 +1327,7 @@ class ObservableSanityClient {
|
|
|
1356
1327
|
*/
|
|
1357
1328
|
listen = _listen;
|
|
1358
1329
|
constructor(httpRequest, config = defaultConfig) {
|
|
1359
|
-
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)
|
|
1330
|
+
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);
|
|
1360
1331
|
}
|
|
1361
1332
|
/**
|
|
1362
1333
|
* Clone the client - returns a new instance
|
|
@@ -1488,6 +1459,13 @@ class ObservableSanityClient {
|
|
|
1488
1459
|
getDataUrl(operation, path) {
|
|
1489
1460
|
return _getDataUrl(this, operation, path);
|
|
1490
1461
|
}
|
|
1462
|
+
/**
|
|
1463
|
+
* Run an ad-hoc instruction for a target document.
|
|
1464
|
+
* @param request instruction request
|
|
1465
|
+
*/
|
|
1466
|
+
instruct(request) {
|
|
1467
|
+
return _instruct(this, this.#httpRequest, request);
|
|
1468
|
+
}
|
|
1491
1469
|
}
|
|
1492
1470
|
class SanityClient {
|
|
1493
1471
|
assets;
|
|
@@ -1495,7 +1473,6 @@ class SanityClient {
|
|
|
1495
1473
|
live;
|
|
1496
1474
|
projects;
|
|
1497
1475
|
users;
|
|
1498
|
-
ai;
|
|
1499
1476
|
/**
|
|
1500
1477
|
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
1501
1478
|
*/
|
|
@@ -1510,7 +1487,7 @@ class SanityClient {
|
|
|
1510
1487
|
*/
|
|
1511
1488
|
listen = _listen;
|
|
1512
1489
|
constructor(httpRequest, config = defaultConfig) {
|
|
1513
|
-
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.
|
|
1490
|
+
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);
|
|
1514
1491
|
}
|
|
1515
1492
|
/**
|
|
1516
1493
|
* Clone the client - returns a new instance
|
|
@@ -1666,6 +1643,13 @@ class SanityClient {
|
|
|
1666
1643
|
getDataUrl(operation, path) {
|
|
1667
1644
|
return _getDataUrl(this, operation, path);
|
|
1668
1645
|
}
|
|
1646
|
+
/**
|
|
1647
|
+
* Run an ad-hoc instruction for a target document.
|
|
1648
|
+
* @param request instruction request
|
|
1649
|
+
*/
|
|
1650
|
+
instruct(request) {
|
|
1651
|
+
return lastValueFrom(_instruct(this, this.#httpRequest, request));
|
|
1652
|
+
}
|
|
1669
1653
|
}
|
|
1670
1654
|
function defineCreateClientExports(envMiddleware2, ClassConstructor) {
|
|
1671
1655
|
return { requester: defineHttpRequest(envMiddleware2), createClient: (config) => {
|