@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.
@@ -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, config) {
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, config) {
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.config(newConfig);
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
- function createClient(config) {
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