@sanity/client 8.4.0 → 8.5.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/README.md +80 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +200 -6
- package/dist/index.js.map +1 -1
- package/dist/index.node.d.ts +277 -22
- package/dist/index.node.js +150 -13
- package/dist/index.node.js.map +1 -1
- package/dist/media-library.d.ts +1 -1
- package/dist/stega.js +2 -2
- package/dist/{dist-Z8cIRxoB.js → stegaClean-YZRATV86.js} +19 -2
- package/dist/stegaClean-YZRATV86.js.map +1 -0
- package/dist/{stegaEncodeSourceMap-YR3NQ3iz.js → stegaEncodeSourceMap-Dj29aWKG.js} +2 -2
- package/dist/{stegaEncodeSourceMap-YR3NQ3iz.js.map → stegaEncodeSourceMap-Dj29aWKG.js.map} +1 -1
- package/dist/{types-DiPF0ENT.d.ts → types-CtHEe8SF.d.ts} +278 -23
- package/package.json +16 -14
- package/src/SanityClient.ts +176 -9
- package/src/agent/actions/AgentActionsClient.ts +8 -2
- package/src/assets/AssetsClient.ts +8 -2
- package/src/data/live.ts +1 -0
- package/src/datasets/DatasetsClient.ts +8 -2
- package/src/mediaLibrary/MediaLibraryVideoClient.ts +8 -2
- package/src/projects/ProjectsClient.ts +8 -2
- package/src/releases/ReleasesClient.ts +8 -2
- package/src/types.ts +49 -6
- package/src/users/UsersClient.ts +8 -2
- package/dist/dist-Z8cIRxoB.js.map +0 -1
- package/dist/stegaClean-C18wLWau.js +0 -21
- package/dist/stegaClean-C18wLWau.js.map +0 -1
package/dist/index.node.js
CHANGED
|
@@ -1373,7 +1373,10 @@ function _translate(client, httpRequest, request) {
|
|
|
1373
1373
|
body: request
|
|
1374
1374
|
});
|
|
1375
1375
|
}
|
|
1376
|
-
/**
|
|
1376
|
+
/**
|
|
1377
|
+
* @public
|
|
1378
|
+
* @inline
|
|
1379
|
+
*/
|
|
1377
1380
|
var ObservableAgentsActionClient = class {
|
|
1378
1381
|
#client;
|
|
1379
1382
|
#httpRequest;
|
|
@@ -2819,6 +2822,7 @@ function _shareReplayLatest(config) {
|
|
|
2819
2822
|
const requiredApiVersion = "2021-03-25";
|
|
2820
2823
|
/**
|
|
2821
2824
|
* @public
|
|
2825
|
+
* @inline
|
|
2822
2826
|
*/
|
|
2823
2827
|
var LiveClient = class {
|
|
2824
2828
|
#client;
|
|
@@ -2945,7 +2949,10 @@ function checkCorsObservable(url, projectId, requireCredentials, fetcher) {
|
|
|
2945
2949
|
* resolver — `undefined` covers the `globalThis.fetch` fallback.
|
|
2946
2950
|
*/
|
|
2947
2951
|
const eventsCache = /* @__PURE__ */ new Map();
|
|
2948
|
-
/**
|
|
2952
|
+
/**
|
|
2953
|
+
* @internal
|
|
2954
|
+
* @inline
|
|
2955
|
+
*/
|
|
2949
2956
|
var ObservableDatasetsClient = class {
|
|
2950
2957
|
#client;
|
|
2951
2958
|
#httpRequest;
|
|
@@ -3260,7 +3267,10 @@ function buildQueryParams(options) {
|
|
|
3260
3267
|
}
|
|
3261
3268
|
return options.expiration && (params.expiration = options.expiration), params;
|
|
3262
3269
|
}
|
|
3263
|
-
/**
|
|
3270
|
+
/**
|
|
3271
|
+
* @internal
|
|
3272
|
+
* @inline
|
|
3273
|
+
*/
|
|
3264
3274
|
var ObservableProjectsClient = class {
|
|
3265
3275
|
#client;
|
|
3266
3276
|
#httpRequest;
|
|
@@ -3387,7 +3397,10 @@ const getArgs = (releaseOrOptions, maybeOptions) => {
|
|
|
3387
3397
|
options
|
|
3388
3398
|
};
|
|
3389
3399
|
};
|
|
3390
|
-
/**
|
|
3400
|
+
/**
|
|
3401
|
+
* @public
|
|
3402
|
+
* @inline
|
|
3403
|
+
*/
|
|
3391
3404
|
var ObservableReleasesClient = class {
|
|
3392
3405
|
#client;
|
|
3393
3406
|
#httpRequest;
|
|
@@ -3842,25 +3855,64 @@ var ObservableReleasesClient = class {
|
|
|
3842
3855
|
return _request(this.#client, this.#httpRequest, { url: `/users/${id}` });
|
|
3843
3856
|
}
|
|
3844
3857
|
}, ObservableSanityClient = class ObservableSanityClient {
|
|
3858
|
+
/**
|
|
3859
|
+
* Upload, fetch and delete assets (images and files) in the configured dataset
|
|
3860
|
+
*
|
|
3861
|
+
* @category Assets
|
|
3862
|
+
*/
|
|
3845
3863
|
assets;
|
|
3864
|
+
/**
|
|
3865
|
+
* Create, list, edit and delete datasets in the configured project
|
|
3866
|
+
*
|
|
3867
|
+
* @category Projects & Datasets
|
|
3868
|
+
*/
|
|
3846
3869
|
datasets;
|
|
3870
|
+
/**
|
|
3871
|
+
* Subscribe to live content updates through the Live Content API
|
|
3872
|
+
*
|
|
3873
|
+
* @category Real-time
|
|
3874
|
+
*/
|
|
3847
3875
|
live;
|
|
3876
|
+
/**
|
|
3877
|
+
* Interact with Media Library assets
|
|
3878
|
+
*
|
|
3879
|
+
* @category Assets
|
|
3880
|
+
*/
|
|
3848
3881
|
mediaLibrary;
|
|
3882
|
+
/**
|
|
3883
|
+
* Fetch information about the projects the authenticated user has access to
|
|
3884
|
+
*
|
|
3885
|
+
* @category Projects & Datasets
|
|
3886
|
+
*/
|
|
3849
3887
|
projects;
|
|
3888
|
+
/**
|
|
3889
|
+
* Fetch information about users in the configured project
|
|
3890
|
+
*
|
|
3891
|
+
* @category Projects & Datasets
|
|
3892
|
+
*/
|
|
3850
3893
|
users;
|
|
3894
|
+
/**
|
|
3895
|
+
* Run Agent Actions - AI-powered operations to generate, transform, translate, prompt and patch documents
|
|
3896
|
+
*
|
|
3897
|
+
* @category Agent Actions
|
|
3898
|
+
*/
|
|
3851
3899
|
agent;
|
|
3852
3900
|
collaboration;
|
|
3853
3901
|
functions;
|
|
3902
|
+
/**
|
|
3903
|
+
* Create and manage content releases and their scheduled publishing
|
|
3904
|
+
*
|
|
3905
|
+
* @category Releases
|
|
3906
|
+
*/
|
|
3854
3907
|
releases;
|
|
3855
3908
|
/** @beta */
|
|
3856
3909
|
context;
|
|
3857
|
-
/**
|
|
3858
|
-
* Private properties
|
|
3859
|
-
*/
|
|
3860
3910
|
#clientConfig;
|
|
3861
3911
|
#httpRequest;
|
|
3862
3912
|
/**
|
|
3863
|
-
*
|
|
3913
|
+
* Listen to document changes matching a GROQ query, delivered as server-sent events
|
|
3914
|
+
*
|
|
3915
|
+
* @category Real-time
|
|
3864
3916
|
*/
|
|
3865
3917
|
listen = _listen$2;
|
|
3866
3918
|
constructor(httpRequest, config = defaultConfig) {
|
|
@@ -3868,6 +3920,8 @@ var ObservableReleasesClient = class {
|
|
|
3868
3920
|
}
|
|
3869
3921
|
/**
|
|
3870
3922
|
* Clone the client - returns a new instance
|
|
3923
|
+
*
|
|
3924
|
+
* @category Configuration
|
|
3871
3925
|
*/
|
|
3872
3926
|
clone() {
|
|
3873
3927
|
return new ObservableSanityClient(this.#httpRequest, this.config());
|
|
@@ -3880,6 +3934,8 @@ var ObservableReleasesClient = class {
|
|
|
3880
3934
|
/**
|
|
3881
3935
|
* Clone the client with a new (partial) configuration.
|
|
3882
3936
|
*
|
|
3937
|
+
* @category Configuration
|
|
3938
|
+
*
|
|
3883
3939
|
* @param newConfig - New client configuration properties, shallowly merged with existing configuration
|
|
3884
3940
|
*/
|
|
3885
3941
|
withConfig(newConfig) {
|
|
@@ -3915,6 +3971,8 @@ var ObservableReleasesClient = class {
|
|
|
3915
3971
|
* The order/position of documents is preserved based on the original array of IDs.
|
|
3916
3972
|
* If any of the documents are missing, they will be replaced by a `null` entry in the returned array
|
|
3917
3973
|
*
|
|
3974
|
+
* @category Querying
|
|
3975
|
+
*
|
|
3918
3976
|
* @param ids - Document IDs to fetch
|
|
3919
3977
|
* @param options - Request options
|
|
3920
3978
|
*/
|
|
@@ -3925,6 +3983,8 @@ var ObservableReleasesClient = class {
|
|
|
3925
3983
|
* Convenient and bandwidth efficient method of checking wether a set of document IDs exists.
|
|
3926
3984
|
* Returns a set of the IDs that exist.
|
|
3927
3985
|
*
|
|
3986
|
+
* @category Querying
|
|
3987
|
+
*
|
|
3928
3988
|
* @param ids - Document IDs to check
|
|
3929
3989
|
* @param options - Request options
|
|
3930
3990
|
*/
|
|
@@ -3964,6 +4024,8 @@ var ObservableReleasesClient = class {
|
|
|
3964
4024
|
* * Discarding a version with no `releaseId` will discard the draft version of the published document.
|
|
3965
4025
|
* * If the draft or release version does not exist, any error will throw.
|
|
3966
4026
|
*
|
|
4027
|
+
* @category Versions
|
|
4028
|
+
*
|
|
3967
4029
|
* @param params - Version action parameters:
|
|
3968
4030
|
* - `releaseId` - The ID of the release to discard the document from.
|
|
3969
4031
|
* - `publishedId` - The published ID of the document to discard.
|
|
@@ -4007,6 +4069,8 @@ var ObservableReleasesClient = class {
|
|
|
4007
4069
|
* @remarks
|
|
4008
4070
|
* * If the published document does not exist, an error will be thrown.
|
|
4009
4071
|
*
|
|
4072
|
+
* @category Versions
|
|
4073
|
+
*
|
|
4010
4074
|
* @param params - Version action parameters:
|
|
4011
4075
|
* - `releaseId` - The ID of the release to unpublish the document from.
|
|
4012
4076
|
* - `publishedId` - The published ID of the document to unpublish.
|
|
@@ -4039,6 +4103,8 @@ var ObservableReleasesClient = class {
|
|
|
4039
4103
|
/**
|
|
4040
4104
|
* Create a new transaction of mutations
|
|
4041
4105
|
*
|
|
4106
|
+
* @category Mutations
|
|
4107
|
+
*
|
|
4042
4108
|
* @param operations - Optional array of mutation operations to initialize the transaction instance with
|
|
4043
4109
|
*/
|
|
4044
4110
|
transaction(operations) {
|
|
@@ -4047,6 +4113,8 @@ var ObservableReleasesClient = class {
|
|
|
4047
4113
|
/**
|
|
4048
4114
|
* Perform action operations against the configured dataset
|
|
4049
4115
|
*
|
|
4116
|
+
* @category Mutations
|
|
4117
|
+
*
|
|
4050
4118
|
* @param operations - Action operation(s) to execute
|
|
4051
4119
|
* @param options - Action options
|
|
4052
4120
|
*/
|
|
@@ -4056,6 +4124,8 @@ var ObservableReleasesClient = class {
|
|
|
4056
4124
|
/**
|
|
4057
4125
|
* Perform an HTTP request against the Sanity API
|
|
4058
4126
|
*
|
|
4127
|
+
* @category HTTP
|
|
4128
|
+
*
|
|
4059
4129
|
* @param options - Request options
|
|
4060
4130
|
*/
|
|
4061
4131
|
request(options) {
|
|
@@ -4064,6 +4134,8 @@ var ObservableReleasesClient = class {
|
|
|
4064
4134
|
/**
|
|
4065
4135
|
* Get a Sanity API URL for the URI provided
|
|
4066
4136
|
*
|
|
4137
|
+
* @category HTTP
|
|
4138
|
+
*
|
|
4067
4139
|
* @param uri - URI/path to build URL for
|
|
4068
4140
|
* @param canUseCdn - Whether or not to allow using the API CDN for this route
|
|
4069
4141
|
*/
|
|
@@ -4073,6 +4145,8 @@ var ObservableReleasesClient = class {
|
|
|
4073
4145
|
/**
|
|
4074
4146
|
* Get a Sanity API URL for the data operation and path provided
|
|
4075
4147
|
*
|
|
4148
|
+
* @category HTTP
|
|
4149
|
+
*
|
|
4076
4150
|
* @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
|
|
4077
4151
|
* @param path - Path to append after the operation
|
|
4078
4152
|
*/
|
|
@@ -4080,29 +4154,70 @@ var ObservableReleasesClient = class {
|
|
|
4080
4154
|
return _getDataUrl(this, operation, path);
|
|
4081
4155
|
}
|
|
4082
4156
|
}, SanityClient = class SanityClient {
|
|
4157
|
+
/**
|
|
4158
|
+
* Upload, fetch and delete assets (images and files) in the configured dataset
|
|
4159
|
+
*
|
|
4160
|
+
* @category Assets
|
|
4161
|
+
*/
|
|
4083
4162
|
assets;
|
|
4163
|
+
/**
|
|
4164
|
+
* Create, list, edit and delete datasets in the configured project
|
|
4165
|
+
*
|
|
4166
|
+
* @category Projects & Datasets
|
|
4167
|
+
*/
|
|
4084
4168
|
datasets;
|
|
4169
|
+
/**
|
|
4170
|
+
* Subscribe to live content updates through the Live Content API
|
|
4171
|
+
*
|
|
4172
|
+
* @category Real-time
|
|
4173
|
+
*/
|
|
4085
4174
|
live;
|
|
4175
|
+
/**
|
|
4176
|
+
* Interact with Media Library assets
|
|
4177
|
+
*
|
|
4178
|
+
* @category Assets
|
|
4179
|
+
*/
|
|
4086
4180
|
mediaLibrary;
|
|
4181
|
+
/**
|
|
4182
|
+
* Fetch information about the projects the authenticated user has access to
|
|
4183
|
+
*
|
|
4184
|
+
* @category Projects & Datasets
|
|
4185
|
+
*/
|
|
4087
4186
|
projects;
|
|
4187
|
+
/**
|
|
4188
|
+
* Fetch information about users in the configured project
|
|
4189
|
+
*
|
|
4190
|
+
* @category Projects & Datasets
|
|
4191
|
+
*/
|
|
4088
4192
|
users;
|
|
4193
|
+
/**
|
|
4194
|
+
* Run Agent Actions - AI-powered operations to generate, transform, translate, prompt and patch documents
|
|
4195
|
+
*
|
|
4196
|
+
* @category Agent Actions
|
|
4197
|
+
*/
|
|
4089
4198
|
agent;
|
|
4090
4199
|
collaboration;
|
|
4091
4200
|
functions;
|
|
4201
|
+
/**
|
|
4202
|
+
* Create and manage content releases and their scheduled publishing
|
|
4203
|
+
*
|
|
4204
|
+
* @category Releases
|
|
4205
|
+
*/
|
|
4092
4206
|
releases;
|
|
4093
4207
|
/** @beta */
|
|
4094
4208
|
context;
|
|
4095
4209
|
/**
|
|
4096
4210
|
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
4211
|
+
*
|
|
4212
|
+
* @category Configuration
|
|
4097
4213
|
*/
|
|
4098
4214
|
observable;
|
|
4099
|
-
/**
|
|
4100
|
-
* Private properties
|
|
4101
|
-
*/
|
|
4102
4215
|
#clientConfig;
|
|
4103
4216
|
#httpRequest;
|
|
4104
4217
|
/**
|
|
4105
|
-
*
|
|
4218
|
+
* Listen to document changes matching a GROQ query, delivered as server-sent events
|
|
4219
|
+
*
|
|
4220
|
+
* @category Real-time
|
|
4106
4221
|
*/
|
|
4107
4222
|
listen = _listen$2;
|
|
4108
4223
|
constructor(httpRequest, config = defaultConfig) {
|
|
@@ -4110,6 +4225,8 @@ var ObservableReleasesClient = class {
|
|
|
4110
4225
|
}
|
|
4111
4226
|
/**
|
|
4112
4227
|
* Clone the client - returns a new instance
|
|
4228
|
+
*
|
|
4229
|
+
* @category Configuration
|
|
4113
4230
|
*/
|
|
4114
4231
|
clone() {
|
|
4115
4232
|
return new SanityClient(this.#httpRequest, this.config());
|
|
@@ -4122,6 +4239,8 @@ var ObservableReleasesClient = class {
|
|
|
4122
4239
|
/**
|
|
4123
4240
|
* Clone the client with a new (partial) configuration.
|
|
4124
4241
|
*
|
|
4242
|
+
* @category Configuration
|
|
4243
|
+
*
|
|
4125
4244
|
* @param newConfig - New client configuration properties, shallowly merged with existing configuration
|
|
4126
4245
|
*/
|
|
4127
4246
|
withConfig(newConfig) {
|
|
@@ -4157,6 +4276,8 @@ var ObservableReleasesClient = class {
|
|
|
4157
4276
|
* The order/position of documents is preserved based on the original array of IDs.
|
|
4158
4277
|
* If any of the documents are missing, they will be replaced by a `null` entry in the returned array
|
|
4159
4278
|
*
|
|
4279
|
+
* @category Querying
|
|
4280
|
+
*
|
|
4160
4281
|
* @param ids - Document IDs to fetch
|
|
4161
4282
|
* @param options - Request options
|
|
4162
4283
|
*/
|
|
@@ -4167,6 +4288,8 @@ var ObservableReleasesClient = class {
|
|
|
4167
4288
|
* Convenient and bandwidth efficient method of checking wether a set of document IDs exists.
|
|
4168
4289
|
* Returns a set of the IDs that exist.
|
|
4169
4290
|
*
|
|
4291
|
+
* @category Querying
|
|
4292
|
+
*
|
|
4170
4293
|
* @param ids - Document IDs to check
|
|
4171
4294
|
* @param options - Request options
|
|
4172
4295
|
*/
|
|
@@ -4206,6 +4329,8 @@ var ObservableReleasesClient = class {
|
|
|
4206
4329
|
* * Discarding a version with no `releaseId` will discard the draft version of the published document.
|
|
4207
4330
|
* * If the draft or release version does not exist, any error will throw.
|
|
4208
4331
|
*
|
|
4332
|
+
* @category Versions
|
|
4333
|
+
*
|
|
4209
4334
|
* @param params - Version action parameters:
|
|
4210
4335
|
* - `releaseId` - The ID of the release to discard the document from.
|
|
4211
4336
|
* - `publishedId` - The published ID of the document to discard.
|
|
@@ -4249,6 +4374,8 @@ var ObservableReleasesClient = class {
|
|
|
4249
4374
|
* @remarks
|
|
4250
4375
|
* * If the published document does not exist, an error will be thrown.
|
|
4251
4376
|
*
|
|
4377
|
+
* @category Versions
|
|
4378
|
+
*
|
|
4252
4379
|
* @param params - Version action parameters:
|
|
4253
4380
|
* - `releaseId` - The ID of the release to unpublish the document from.
|
|
4254
4381
|
* - `publishedId` - The published ID of the document to unpublish.
|
|
@@ -4281,6 +4408,8 @@ var ObservableReleasesClient = class {
|
|
|
4281
4408
|
/**
|
|
4282
4409
|
* Create a new transaction of mutations
|
|
4283
4410
|
*
|
|
4411
|
+
* @category Mutations
|
|
4412
|
+
*
|
|
4284
4413
|
* @param operations - Optional array of mutation operations to initialize the transaction instance with
|
|
4285
4414
|
*/
|
|
4286
4415
|
transaction(operations) {
|
|
@@ -4290,6 +4419,8 @@ var ObservableReleasesClient = class {
|
|
|
4290
4419
|
* Perform action operations against the configured dataset
|
|
4291
4420
|
* Returns a promise that resolves to the transaction result
|
|
4292
4421
|
*
|
|
4422
|
+
* @category Mutations
|
|
4423
|
+
*
|
|
4293
4424
|
* @param operations - Action operation(s) to execute
|
|
4294
4425
|
* @param options - Action options
|
|
4295
4426
|
*/
|
|
@@ -4300,6 +4431,8 @@ var ObservableReleasesClient = class {
|
|
|
4300
4431
|
* Perform a request against the Sanity API
|
|
4301
4432
|
* NOTE: Only use this for Sanity API endpoints, not for your own APIs!
|
|
4302
4433
|
*
|
|
4434
|
+
* @category HTTP
|
|
4435
|
+
*
|
|
4303
4436
|
* @param options - Request options
|
|
4304
4437
|
* @returns Promise resolving to the response body
|
|
4305
4438
|
*/
|
|
@@ -4322,6 +4455,8 @@ var ObservableReleasesClient = class {
|
|
|
4322
4455
|
/**
|
|
4323
4456
|
* Get a Sanity API URL for the URI provided
|
|
4324
4457
|
*
|
|
4458
|
+
* @category HTTP
|
|
4459
|
+
*
|
|
4325
4460
|
* @param uri - URI/path to build URL for
|
|
4326
4461
|
* @param canUseCdn - Whether or not to allow using the API CDN for this route
|
|
4327
4462
|
*/
|
|
@@ -4331,6 +4466,8 @@ var ObservableReleasesClient = class {
|
|
|
4331
4466
|
/**
|
|
4332
4467
|
* Get a Sanity API URL for the data operation and path provided
|
|
4333
4468
|
*
|
|
4469
|
+
* @category HTTP
|
|
4470
|
+
*
|
|
4334
4471
|
* @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
|
|
4335
4472
|
* @param path - Path to append after the operation
|
|
4336
4473
|
*/
|
|
@@ -4368,7 +4505,7 @@ function defineDeprecatedCreateClient(createClient) {
|
|
|
4368
4505
|
return printNoDefaultExport(), createClient(config);
|
|
4369
4506
|
};
|
|
4370
4507
|
}
|
|
4371
|
-
var name = "@sanity/client", version = "8.
|
|
4508
|
+
var name = "@sanity/client", version = "8.5.0";
|
|
4372
4509
|
const log = createDebug("sanity:client");
|
|
4373
4510
|
function isNodeReadableStream(value) {
|
|
4374
4511
|
return typeof value != "object" || !value || !("pipe" in value) ? !1 : typeof value.pipe == "function";
|