@sanity/client 5.0.0-esm.3 → 5.0.0-esm.4
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 +442 -17
- package/dist/index.browser.cjs +9 -7
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +9 -7
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +10 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +297 -213
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/package.json +24 -21
- package/src/SanityClient.ts +172 -167
- package/src/assets/AssetsClient.ts +14 -12
- package/src/auth/AuthClient.ts +2 -0
- package/src/config.ts +2 -2
- package/src/data/dataMethods.ts +4 -1
- package/src/data/listen.ts +6 -6
- package/src/data/patch.ts +34 -31
- package/src/data/transaction.ts +5 -0
- package/src/datasets/DatasetsClient.ts +2 -0
- package/src/http/errors.ts +2 -0
- package/src/http/request.ts +1 -3
- package/src/index.browser.ts +3 -3
- package/src/index.ts +3 -42
- package/src/projects/ProjectsClient.ts +2 -0
- package/src/types.ts +60 -0
- package/src/users/UsersClient.ts +2 -2
- package/src/validators.ts +4 -2
- package/umd/sanityClient.js +5449 -5470
- package/umd/sanityClient.min.js +12 -12
package/dist/index.browser.js
CHANGED
|
@@ -1274,7 +1274,8 @@ var __privateSet = (obj, member, value, setter) => {
|
|
|
1274
1274
|
};
|
|
1275
1275
|
var _clientConfig, _httpRequest, _clientConfig2, _httpRequest2;
|
|
1276
1276
|
const _ObservableSanityClient = class {
|
|
1277
|
-
constructor(httpRequest
|
|
1277
|
+
constructor(httpRequest) {
|
|
1278
|
+
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultConfig;
|
|
1278
1279
|
__privateAdd(this, _clientConfig, void 0);
|
|
1279
1280
|
__privateAdd(this, _httpRequest, void 0);
|
|
1280
1281
|
this.config(config);
|
|
@@ -1345,11 +1346,11 @@ let ObservableSanityClient = _ObservableSanityClient;
|
|
|
1345
1346
|
_clientConfig = new WeakMap();
|
|
1346
1347
|
_httpRequest = new WeakMap();
|
|
1347
1348
|
const _SanityClient = class {
|
|
1348
|
-
constructor(httpRequest
|
|
1349
|
+
constructor(httpRequest) {
|
|
1350
|
+
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultConfig;
|
|
1349
1351
|
__privateAdd(this, _clientConfig2, void 0);
|
|
1350
1352
|
__privateAdd(this, _httpRequest2, void 0);
|
|
1351
1353
|
this.listen = _listen;
|
|
1352
|
-
this.observable = new ObservableSanityClient(httpRequest, config);
|
|
1353
1354
|
this.config(config);
|
|
1354
1355
|
__privateSet(this, _httpRequest2, httpRequest);
|
|
1355
1356
|
this.assets = new AssetsClient(this, __privateGet(this, _httpRequest2));
|
|
@@ -1357,6 +1358,7 @@ const _SanityClient = class {
|
|
|
1357
1358
|
this.datasets = new DatasetsClient(this, __privateGet(this, _httpRequest2));
|
|
1358
1359
|
this.projects = new ProjectsClient(this, __privateGet(this, _httpRequest2));
|
|
1359
1360
|
this.users = new UsersClient(this, __privateGet(this, _httpRequest2));
|
|
1361
|
+
this.observable = new ObservableSanityClient(httpRequest, config);
|
|
1360
1362
|
}
|
|
1361
1363
|
clone() {
|
|
1362
1364
|
return new _SanityClient(__privateGet(this, _httpRequest2), this.config());
|
|
@@ -1370,7 +1372,9 @@ const _SanityClient = class {
|
|
|
1370
1372
|
if (__privateGet(this, _clientConfig2) && __privateGet(this, _clientConfig2).allowReconfigure === false) {
|
|
1371
1373
|
throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");
|
|
1372
1374
|
}
|
|
1373
|
-
this.observable
|
|
1375
|
+
if (this.observable) {
|
|
1376
|
+
this.observable.config(newConfig);
|
|
1377
|
+
}
|
|
1374
1378
|
__privateSet(this, _clientConfig2, initConfig(newConfig, __privateGet(this, _clientConfig2) || {}));
|
|
1375
1379
|
return this;
|
|
1376
1380
|
}
|
|
@@ -1423,8 +1427,6 @@ _clientConfig2 = new WeakMap();
|
|
|
1423
1427
|
_httpRequest2 = new WeakMap();
|
|
1424
1428
|
const httpRequest = defineHttpRequest(envMiddleware);
|
|
1425
1429
|
const requester = httpRequest.defaultRequester;
|
|
1426
|
-
|
|
1427
|
-
return new SanityClient(httpRequest, config);
|
|
1428
|
-
}
|
|
1430
|
+
const createClient = config => new SanityClient(httpRequest, config);
|
|
1429
1431
|
export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableSanityClient, ObservableTransaction, Patch, SanityClient, ServerError, Transaction, createClient, requester };
|
|
1430
1432
|
//# sourceMappingURL=index.browser.js.map
|