@sanity/client 6.15.13 → 6.15.15-canary.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.
@@ -2,16 +2,17 @@ import { getIt } from "get-it";
2
2
  import { retry, jsonRequest, jsonResponse, progress, observable, debug, headers, agent } from "get-it/middleware";
3
3
  import { Observable, from, lastValueFrom } from "rxjs";
4
4
  import { combineLatestWith, map, filter } from "rxjs/operators";
5
+ var __defProp$3 = Object.defineProperty, __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __publicField$3 = (obj, key, value) => (__defNormalProp$3(obj, typeof key != "symbol" ? key + "" : key, value), value);
5
6
  class ClientError extends Error {
6
7
  constructor(res) {
7
8
  const props = extractErrorProps(res);
8
- super(props.message), this.statusCode = 400, Object.assign(this, props);
9
+ super(props.message), __publicField$3(this, "response"), __publicField$3(this, "statusCode", 400), __publicField$3(this, "responseBody"), __publicField$3(this, "details"), Object.assign(this, props);
9
10
  }
10
11
  }
11
12
  class ServerError extends Error {
12
13
  constructor(res) {
13
14
  const props = extractErrorProps(res);
14
- super(props.message), this.statusCode = 500, Object.assign(this, props);
15
+ super(props.message), __publicField$3(this, "response"), __publicField$3(this, "statusCode", 500), __publicField$3(this, "responseBody"), __publicField$3(this, "details"), Object.assign(this, props);
15
16
  }
16
17
  }
17
18
  function extractErrorProps(res) {
@@ -152,7 +153,7 @@ const VALID_ASSET_TYPES = ["image", "file"], VALID_INSERT_LOCATIONS = ["before",
152
153
  );
153
154
  return tag;
154
155
  };
155
- var __accessCheck$6 = (obj, member, msg) => {
156
+ var __defProp$2 = Object.defineProperty, __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __publicField$2 = (obj, key, value) => (__defNormalProp$2(obj, typeof key != "symbol" ? key + "" : key, value), value), __accessCheck$6 = (obj, member, msg) => {
156
157
  if (!member.has(obj))
157
158
  throw TypeError("Cannot " + msg);
158
159
  }, __privateGet$6 = (obj, member, getter) => (__accessCheck$6(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$6 = (obj, member, value) => {
@@ -162,7 +163,7 @@ var __accessCheck$6 = (obj, member, msg) => {
162
163
  }, __privateSet$6 = (obj, member, value, setter) => (__accessCheck$6(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
163
164
  class BasePatch {
164
165
  constructor(selection, operations = {}) {
165
- this.selection = selection, this.operations = operations;
166
+ __publicField$2(this, "selection"), __publicField$2(this, "operations"), this.selection = selection, this.operations = operations;
166
167
  }
167
168
  /**
168
169
  * Sets the given attributes to the document. Does NOT merge objects.
@@ -337,7 +338,7 @@ const _Patch = class _Patch2 extends BasePatch {
337
338
  };
338
339
  _client2$5 = /* @__PURE__ */ new WeakMap();
339
340
  let Patch = _Patch;
340
- var __accessCheck$5 = (obj, member, msg) => {
341
+ var __defProp$1 = Object.defineProperty, __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __publicField$1 = (obj, key, value) => (__defNormalProp$1(obj, typeof key != "symbol" ? key + "" : key, value), value), __accessCheck$5 = (obj, member, msg) => {
341
342
  if (!member.has(obj))
342
343
  throw TypeError("Cannot " + msg);
343
344
  }, __privateGet$5 = (obj, member, getter) => (__accessCheck$5(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$5 = (obj, member, value) => {
@@ -348,7 +349,7 @@ var __accessCheck$5 = (obj, member, msg) => {
348
349
  const defaultMutateOptions = { returnDocuments: !1 };
349
350
  class BaseTransaction {
350
351
  constructor(operations = [], transactionId) {
351
- this.operations = operations, this.trxId = transactionId;
352
+ __publicField$1(this, "operations"), __publicField$1(this, "trxId"), this.operations = operations, this.trxId = transactionId;
352
353
  }
353
354
  /**
354
355
  * Creates a new Sanity document. If `_id` is provided and already exists, the mutation will fail. If no `_id` is given, one will automatically be generated by the database.
@@ -1158,7 +1159,7 @@ class UsersClient {
1158
1159
  }
1159
1160
  }
1160
1161
  _client2 = /* @__PURE__ */ new WeakMap(), _httpRequest2$1 = /* @__PURE__ */ new WeakMap();
1161
- var __accessCheck = (obj, member, msg) => {
1162
+ var __defProp = Object.defineProperty, __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __publicField = (obj, key, value) => (__defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value), value), __accessCheck = (obj, member, msg) => {
1162
1163
  if (!member.has(obj))
1163
1164
  throw TypeError("Cannot " + msg);
1164
1165
  }, __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => {
@@ -1168,7 +1169,7 @@ var __accessCheck = (obj, member, msg) => {
1168
1169
  }, __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value), _clientConfig, _httpRequest;
1169
1170
  const _ObservableSanityClient = class _ObservableSanityClient2 {
1170
1171
  constructor(httpRequest, config = defaultConfig) {
1171
- __privateAdd(this, _clientConfig, void 0), __privateAdd(this, _httpRequest, void 0), this.listen = _listen, this.config(config), __privateSet(this, _httpRequest, httpRequest), this.assets = new ObservableAssetsClient(this, __privateGet(this, _httpRequest)), this.datasets = new ObservableDatasetsClient(this, __privateGet(this, _httpRequest)), this.projects = new ObservableProjectsClient(this, __privateGet(this, _httpRequest)), this.users = new ObservableUsersClient(this, __privateGet(this, _httpRequest));
1172
+ __publicField(this, "assets"), __publicField(this, "datasets"), __publicField(this, "projects"), __publicField(this, "users"), __privateAdd(this, _clientConfig, void 0), __privateAdd(this, _httpRequest, void 0), __publicField(this, "listen", _listen), this.config(config), __privateSet(this, _httpRequest, httpRequest), this.assets = new ObservableAssetsClient(this, __privateGet(this, _httpRequest)), this.datasets = new ObservableDatasetsClient(this, __privateGet(this, _httpRequest)), this.projects = new ObservableProjectsClient(this, __privateGet(this, _httpRequest)), this.users = new ObservableUsersClient(this, __privateGet(this, _httpRequest));
1172
1173
  }
1173
1174
  /**
1174
1175
  * Clone the client - returns a new instance
@@ -1297,7 +1298,7 @@ let ObservableSanityClient = _ObservableSanityClient;
1297
1298
  var _clientConfig2, _httpRequest2;
1298
1299
  const _SanityClient = class _SanityClient2 {
1299
1300
  constructor(httpRequest, config = defaultConfig) {
1300
- __privateAdd(this, _clientConfig2, void 0), __privateAdd(this, _httpRequest2, void 0), this.listen = _listen, this.config(config), __privateSet(this, _httpRequest2, httpRequest), this.assets = new AssetsClient(this, __privateGet(this, _httpRequest2)), this.datasets = new DatasetsClient(this, __privateGet(this, _httpRequest2)), this.projects = new ProjectsClient(this, __privateGet(this, _httpRequest2)), this.users = new UsersClient(this, __privateGet(this, _httpRequest2)), this.observable = new ObservableSanityClient(httpRequest, config);
1301
+ __publicField(this, "assets"), __publicField(this, "datasets"), __publicField(this, "projects"), __publicField(this, "users"), __publicField(this, "observable"), __privateAdd(this, _clientConfig2, void 0), __privateAdd(this, _httpRequest2, void 0), __publicField(this, "listen", _listen), this.config(config), __privateSet(this, _httpRequest2, httpRequest), this.assets = new AssetsClient(this, __privateGet(this, _httpRequest2)), this.datasets = new DatasetsClient(this, __privateGet(this, _httpRequest2)), this.projects = new ProjectsClient(this, __privateGet(this, _httpRequest2)), this.users = new UsersClient(this, __privateGet(this, _httpRequest2)), this.observable = new ObservableSanityClient(httpRequest, config);
1301
1302
  }
1302
1303
  /**
1303
1304
  * Clone the client - returns a new instance
@@ -1455,7 +1456,7 @@ function defineCreateClientExports(envMiddleware, ClassConstructor) {
1455
1456
  config
1456
1457
  ) };
1457
1458
  }
1458
- var name = "@sanity/client", version = "6.15.13";
1459
+ var name = "@sanity/client", version = "6.15.15-canary.0";
1459
1460
  const middleware = [
1460
1461
  debug({ verbose: !0, namespace: "sanity:client" }),
1461
1462
  headers({ "User-Agent": `${name} ${version}` }),