@sanity/client 3.3.3-esm.0 → 3.3.3-esm.5
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/sanityClient.browser.mjs +252 -163
- package/dist/sanityClient.browser.mjs.map +4 -4
- package/lib/assets/assetsClient.js +4 -3
- package/lib/auth/authClient.js +3 -2
- package/lib/config.js +40 -28
- package/lib/data/dataMethods.js +4 -3
- package/lib/data/listen.js +8 -6
- package/lib/data/patch.js +20 -17
- package/lib/data/transaction.js +5 -4
- package/lib/datasets/datasetsClient.js +3 -2
- package/lib/generateHelpUrl.js +8 -2
- package/lib/http/errors.js +10 -6
- package/lib/http/nodeMiddleware.js +8 -6
- package/lib/http/request.js +8 -14
- package/lib/http/requestOptions.js +3 -3
- package/lib/projects/projectsClient.js +3 -2
- package/lib/sanityClient.js +15 -7
- package/lib/users/usersClient.js +3 -2
- package/lib/util/observable-modern.js +29 -0
- package/lib/util/observable.js +24 -13
- package/package.json +14 -6
- package/umd/sanityClient.js +161 -90
- package/umd/sanityClient.min.js +1 -1
|
@@ -1,29 +1,118 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
});
|
|
9
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __esm = (fn, res) => function __init() {
|
|
8
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
|
+
};
|
|
10
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
10
11
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
12
|
};
|
|
13
|
+
var __export = (target, all) => {
|
|
14
|
+
for (var name in all)
|
|
15
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
12
30
|
|
|
13
|
-
//
|
|
14
|
-
var
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
// node_modules/object-assign/index.js
|
|
32
|
+
var require_object_assign = __commonJS({
|
|
33
|
+
"node_modules/object-assign/index.js"(exports, module) {
|
|
34
|
+
"use strict";
|
|
35
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
36
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
37
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
38
|
+
function toObject(val) {
|
|
39
|
+
if (val === null || val === void 0) {
|
|
40
|
+
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
41
|
+
}
|
|
42
|
+
return Object(val);
|
|
43
|
+
}
|
|
44
|
+
function shouldUseNative() {
|
|
45
|
+
try {
|
|
46
|
+
if (!Object.assign) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
var test1 = new String("abc");
|
|
50
|
+
test1[5] = "de";
|
|
51
|
+
if (Object.getOwnPropertyNames(test1)[0] === "5") {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
var test2 = {};
|
|
55
|
+
for (var i = 0; i < 10; i++) {
|
|
56
|
+
test2["_" + String.fromCharCode(i)] = i;
|
|
57
|
+
}
|
|
58
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
|
|
59
|
+
return test2[n];
|
|
60
|
+
});
|
|
61
|
+
if (order2.join("") !== "0123456789") {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
var test3 = {};
|
|
65
|
+
"abcdefghijklmnopqrst".split("").forEach(function(letter) {
|
|
66
|
+
test3[letter] = letter;
|
|
67
|
+
});
|
|
68
|
+
if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
return true;
|
|
72
|
+
} catch (err) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
module.exports = shouldUseNative() ? Object.assign : function(target, source) {
|
|
77
|
+
var from;
|
|
78
|
+
var to = toObject(target);
|
|
79
|
+
var symbols;
|
|
80
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
81
|
+
from = Object(arguments[s]);
|
|
82
|
+
for (var key in from) {
|
|
83
|
+
if (hasOwnProperty.call(from, key)) {
|
|
84
|
+
to[key] = from[key];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (getOwnPropertySymbols) {
|
|
88
|
+
symbols = getOwnPropertySymbols(from);
|
|
89
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
90
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
91
|
+
to[symbols[i]] = from[symbols[i]];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return to;
|
|
23
97
|
};
|
|
24
98
|
}
|
|
25
99
|
});
|
|
26
100
|
|
|
101
|
+
// src/util/observable-modern.js
|
|
102
|
+
var observable_modern_exports = {};
|
|
103
|
+
__export(observable_modern_exports, {
|
|
104
|
+
Observable: () => Observable,
|
|
105
|
+
filter: () => filter,
|
|
106
|
+
map: () => map
|
|
107
|
+
});
|
|
108
|
+
import { Observable } from "rxjs-v7/internal/Observable";
|
|
109
|
+
import { filter } from "rxjs-v7/internal/operators/filter";
|
|
110
|
+
import { map } from "rxjs-v7/internal/operators/map";
|
|
111
|
+
var init_observable_modern = __esm({
|
|
112
|
+
"src/util/observable-modern.js"() {
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
|
|
27
116
|
// src/util/getSelection.js
|
|
28
117
|
var require_getSelection = __commonJS({
|
|
29
118
|
"src/util/getSelection.js"(exports, module) {
|
|
@@ -117,50 +206,49 @@ var require_validators = __commonJS({
|
|
|
117
206
|
// src/data/patch.js
|
|
118
207
|
var require_patch = __commonJS({
|
|
119
208
|
"src/data/patch.js"(exports, module) {
|
|
120
|
-
var assign = __require("object-assign");
|
|
121
209
|
var getSelection = require_getSelection();
|
|
122
|
-
var
|
|
123
|
-
var validateObject =
|
|
124
|
-
var validateInsert =
|
|
210
|
+
var validate2 = require_validators();
|
|
211
|
+
var validateObject = validate2.validateObject;
|
|
212
|
+
var validateInsert = validate2.validateInsert;
|
|
125
213
|
function Patch(selection, operations = {}, client = null) {
|
|
126
214
|
this.selection = selection;
|
|
127
|
-
this.operations = assign({}, operations);
|
|
215
|
+
this.operations = Object.assign({}, operations);
|
|
128
216
|
this.client = client;
|
|
129
217
|
}
|
|
130
|
-
assign(Patch.prototype, {
|
|
218
|
+
Object.assign(Patch.prototype, {
|
|
131
219
|
clone() {
|
|
132
|
-
return new Patch(this.selection, assign({}, this.operations), this.client);
|
|
220
|
+
return new Patch(this.selection, Object.assign({}, this.operations), this.client);
|
|
133
221
|
},
|
|
134
222
|
set(props) {
|
|
135
|
-
return this.
|
|
223
|
+
return this.assign("set", props);
|
|
136
224
|
},
|
|
137
225
|
diffMatchPatch(props) {
|
|
138
226
|
validateObject("diffMatchPatch", props);
|
|
139
|
-
return this.
|
|
227
|
+
return this.assign("diffMatchPatch", props);
|
|
140
228
|
},
|
|
141
229
|
unset(attrs) {
|
|
142
230
|
if (!Array.isArray(attrs)) {
|
|
143
231
|
throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");
|
|
144
232
|
}
|
|
145
|
-
this.operations = assign({}, this.operations, { unset: attrs });
|
|
233
|
+
this.operations = Object.assign({}, this.operations, { unset: attrs });
|
|
146
234
|
return this;
|
|
147
235
|
},
|
|
148
236
|
setIfMissing(props) {
|
|
149
|
-
return this.
|
|
237
|
+
return this.assign("setIfMissing", props);
|
|
150
238
|
},
|
|
151
239
|
replace(props) {
|
|
152
240
|
validateObject("replace", props);
|
|
153
241
|
return this._set("set", { $: props });
|
|
154
242
|
},
|
|
155
243
|
inc(props) {
|
|
156
|
-
return this.
|
|
244
|
+
return this.assign("inc", props);
|
|
157
245
|
},
|
|
158
246
|
dec(props) {
|
|
159
|
-
return this.
|
|
247
|
+
return this.assign("dec", props);
|
|
160
248
|
},
|
|
161
249
|
insert(at, selector, items) {
|
|
162
250
|
validateInsert(at, selector, items);
|
|
163
|
-
return this.
|
|
251
|
+
return this.assign("insert", { [at]: selector, items });
|
|
164
252
|
},
|
|
165
253
|
append(selector, items) {
|
|
166
254
|
return this.insert("after", `${selector}[-1]`, items);
|
|
@@ -181,7 +269,7 @@ var require_patch = __commonJS({
|
|
|
181
269
|
return this;
|
|
182
270
|
},
|
|
183
271
|
serialize() {
|
|
184
|
-
return assign(getSelection(this.selection), this.operations);
|
|
272
|
+
return Object.assign(getSelection(this.selection), this.operations);
|
|
185
273
|
},
|
|
186
274
|
toJSON() {
|
|
187
275
|
return this.serialize();
|
|
@@ -193,7 +281,7 @@ var require_patch = __commonJS({
|
|
|
193
281
|
);
|
|
194
282
|
}
|
|
195
283
|
const returnFirst = typeof this.selection === "string";
|
|
196
|
-
const opts = assign({ returnFirst, returnDocuments: true }, options);
|
|
284
|
+
const opts = Object.assign({ returnFirst, returnDocuments: true }, options);
|
|
197
285
|
return this.client.mutate({ patch: this.serialize() }, opts);
|
|
198
286
|
},
|
|
199
287
|
reset() {
|
|
@@ -201,12 +289,12 @@ var require_patch = __commonJS({
|
|
|
201
289
|
return this;
|
|
202
290
|
},
|
|
203
291
|
_set(op, props) {
|
|
204
|
-
return this.
|
|
292
|
+
return this.assign(op, props, false);
|
|
205
293
|
},
|
|
206
|
-
|
|
294
|
+
assign(op, props, merge = true) {
|
|
207
295
|
validateObject(op, props);
|
|
208
|
-
this.operations = assign({}, this.operations, {
|
|
209
|
-
[op]: assign({}, merge && this.operations[op] || {}, props)
|
|
296
|
+
this.operations = Object.assign({}, this.operations, {
|
|
297
|
+
[op]: Object.assign({}, merge && this.operations[op] || {}, props)
|
|
210
298
|
});
|
|
211
299
|
return this;
|
|
212
300
|
}
|
|
@@ -218,7 +306,6 @@ var require_patch = __commonJS({
|
|
|
218
306
|
// src/data/transaction.js
|
|
219
307
|
var require_transaction = __commonJS({
|
|
220
308
|
"src/data/transaction.js"(exports, module) {
|
|
221
|
-
var assign = __require("object-assign");
|
|
222
309
|
var validators = require_validators();
|
|
223
310
|
var Patch = require_patch();
|
|
224
311
|
var defaultMutateOptions = { returnDocuments: false };
|
|
@@ -227,7 +314,7 @@ var require_transaction = __commonJS({
|
|
|
227
314
|
this.operations = operations;
|
|
228
315
|
this.client = client;
|
|
229
316
|
}
|
|
230
|
-
assign(Transaction.prototype, {
|
|
317
|
+
Object.assign(Transaction.prototype, {
|
|
231
318
|
clone() {
|
|
232
319
|
return new Transaction(this.operations.slice(0), this.client, this.trxId);
|
|
233
320
|
},
|
|
@@ -264,7 +351,7 @@ var require_transaction = __commonJS({
|
|
|
264
351
|
}
|
|
265
352
|
return this._add({ patch: patch.serialize() });
|
|
266
353
|
}
|
|
267
|
-
return this._add({ patch: assign({ id: documentId }, patchOps) });
|
|
354
|
+
return this._add({ patch: Object.assign({ id: documentId }, patchOps) });
|
|
268
355
|
},
|
|
269
356
|
transactionId(id) {
|
|
270
357
|
if (!id) {
|
|
@@ -287,7 +374,7 @@ var require_transaction = __commonJS({
|
|
|
287
374
|
}
|
|
288
375
|
return this.client.mutate(
|
|
289
376
|
this.serialize(),
|
|
290
|
-
assign({ transactionId: this.trxId }, defaultMutateOptions, options || {})
|
|
377
|
+
Object.assign({ transactionId: this.trxId }, defaultMutateOptions, options || {})
|
|
291
378
|
);
|
|
292
379
|
},
|
|
293
380
|
reset() {
|
|
@@ -346,11 +433,10 @@ var require_defaults = __commonJS({
|
|
|
346
433
|
});
|
|
347
434
|
|
|
348
435
|
// src/data/listen.js
|
|
436
|
+
import polyfilledEventSource from "@sanity/eventsource";
|
|
349
437
|
var require_listen = __commonJS({
|
|
350
438
|
"src/data/listen.js"(exports, module) {
|
|
351
|
-
var
|
|
352
|
-
var { Observable } = require_observable();
|
|
353
|
-
var polyfilledEventSource = __require("@sanity/eventsource");
|
|
439
|
+
var { Observable: Observable2 } = (init_observable_modern(), __toCommonJS(observable_modern_exports));
|
|
354
440
|
var pick = require_pick();
|
|
355
441
|
var defaults = require_defaults();
|
|
356
442
|
var encodeQueryString = require_encodeQueryString();
|
|
@@ -374,7 +460,7 @@ var require_listen = __commonJS({
|
|
|
374
460
|
const qs = encodeQueryString({ query, params, options: listenOpts, tag });
|
|
375
461
|
const uri = `${url}${this.getDataUrl("listen", qs)}`;
|
|
376
462
|
if (uri.length > MAX_URL_LENGTH) {
|
|
377
|
-
return new
|
|
463
|
+
return new Observable2((observer) => observer.error(new Error("Query too large for listener")));
|
|
378
464
|
}
|
|
379
465
|
const listenFor = options.events ? options.events : ["mutation"];
|
|
380
466
|
const shouldEmitReconnect = listenFor.indexOf("reconnect") !== -1;
|
|
@@ -387,7 +473,7 @@ var require_listen = __commonJS({
|
|
|
387
473
|
Authorization: `Bearer ${token}`
|
|
388
474
|
};
|
|
389
475
|
}
|
|
390
|
-
return new
|
|
476
|
+
return new Observable2((observer) => {
|
|
391
477
|
let es = getEventSource();
|
|
392
478
|
let reconnectTimer;
|
|
393
479
|
let stopped = false;
|
|
@@ -450,7 +536,7 @@ var require_listen = __commonJS({
|
|
|
450
536
|
function parseEvent(event) {
|
|
451
537
|
try {
|
|
452
538
|
const data = event.data && JSON.parse(event.data) || {};
|
|
453
|
-
return assign({ type: event.type }, data);
|
|
539
|
+
return Object.assign({ type: event.type }, data);
|
|
454
540
|
} catch (err) {
|
|
455
541
|
return err;
|
|
456
542
|
}
|
|
@@ -477,8 +563,7 @@ var require_listen = __commonJS({
|
|
|
477
563
|
// src/data/dataMethods.js
|
|
478
564
|
var require_dataMethods = __commonJS({
|
|
479
565
|
"src/data/dataMethods.js"(exports, module) {
|
|
480
|
-
var
|
|
481
|
-
var { map, filter } = require_observable();
|
|
566
|
+
var { map: map2, filter: filter2 } = (init_observable_modern(), __toCommonJS(observable_modern_exports));
|
|
482
567
|
var validators = require_validators();
|
|
483
568
|
var getSelection = require_getSelection();
|
|
484
569
|
var encodeQueryString = require_encodeQueryString();
|
|
@@ -505,7 +590,7 @@ var require_dataMethods = __commonJS({
|
|
|
505
590
|
indexed[attr(doc)] = doc;
|
|
506
591
|
return indexed;
|
|
507
592
|
}, /* @__PURE__ */ Object.create(null));
|
|
508
|
-
var toPromise = (
|
|
593
|
+
var toPromise = (observable2) => observable2.toPromise();
|
|
509
594
|
var getQuerySizeLimit = 11264;
|
|
510
595
|
module.exports = {
|
|
511
596
|
listen,
|
|
@@ -518,27 +603,27 @@ var require_dataMethods = __commonJS({
|
|
|
518
603
|
},
|
|
519
604
|
fetch(query, params, options = {}) {
|
|
520
605
|
const mapResponse = options.filterResponse === false ? (res) => res : (res) => res.result;
|
|
521
|
-
const
|
|
522
|
-
return this.isPromiseAPI() ? toPromise(
|
|
606
|
+
const observable2 = this._dataRequest("query", { query, params }, options).pipe(map2(mapResponse));
|
|
607
|
+
return this.isPromiseAPI() ? toPromise(observable2) : observable2;
|
|
523
608
|
},
|
|
524
609
|
getDocument(id, opts = {}) {
|
|
525
610
|
const options = { uri: this.getDataUrl("doc", id), json: true, tag: opts.tag };
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
|
|
611
|
+
const observable2 = this._requestObservable(options).pipe(
|
|
612
|
+
filter2(isResponse),
|
|
613
|
+
map2((event) => event.body.documents && event.body.documents[0])
|
|
529
614
|
);
|
|
530
|
-
return this.isPromiseAPI() ? toPromise(
|
|
615
|
+
return this.isPromiseAPI() ? toPromise(observable2) : observable2;
|
|
531
616
|
},
|
|
532
617
|
getDocuments(ids, opts = {}) {
|
|
533
618
|
const options = { uri: this.getDataUrl("doc", ids.join(",")), json: true, tag: opts.tag };
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
|
|
619
|
+
const observable2 = this._requestObservable(options).pipe(
|
|
620
|
+
filter2(isResponse),
|
|
621
|
+
map2((event) => {
|
|
537
622
|
const indexed = indexBy(event.body.documents || [], (doc) => doc._id);
|
|
538
623
|
return ids.map((id) => indexed[id] || null);
|
|
539
624
|
})
|
|
540
625
|
);
|
|
541
|
-
return this.isPromiseAPI() ? toPromise(
|
|
626
|
+
return this.isPromiseAPI() ? toPromise(observable2) : observable2;
|
|
542
627
|
},
|
|
543
628
|
create(doc, options) {
|
|
544
629
|
return this._create(doc, "create", options);
|
|
@@ -592,9 +677,9 @@ var require_dataMethods = __commonJS({
|
|
|
592
677
|
canUseCdn: isQuery
|
|
593
678
|
};
|
|
594
679
|
return this._requestObservable(reqOptions).pipe(
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
680
|
+
filter2(isResponse),
|
|
681
|
+
map2(getBody),
|
|
682
|
+
map2((res) => {
|
|
598
683
|
if (!isMutation) {
|
|
599
684
|
return res;
|
|
600
685
|
}
|
|
@@ -614,7 +699,7 @@ var require_dataMethods = __commonJS({
|
|
|
614
699
|
},
|
|
615
700
|
_create(doc, op, options = {}) {
|
|
616
701
|
const mutation = { [op]: doc };
|
|
617
|
-
const opts = assign({ returnFirst: true, returnDocuments: true }, options);
|
|
702
|
+
const opts = Object.assign({ returnFirst: true, returnDocuments: true }, options);
|
|
618
703
|
return this.dataRequest("mutate", { mutations: [mutation] }, opts);
|
|
619
704
|
}
|
|
620
705
|
};
|
|
@@ -624,12 +709,11 @@ var require_dataMethods = __commonJS({
|
|
|
624
709
|
// src/datasets/datasetsClient.js
|
|
625
710
|
var require_datasetsClient = __commonJS({
|
|
626
711
|
"src/datasets/datasetsClient.js"(exports, module) {
|
|
627
|
-
var
|
|
628
|
-
var validate = require_validators();
|
|
712
|
+
var validate2 = require_validators();
|
|
629
713
|
function DatasetsClient(client) {
|
|
630
714
|
this.request = client.request.bind(client);
|
|
631
715
|
}
|
|
632
|
-
assign(DatasetsClient.prototype, {
|
|
716
|
+
Object.assign(DatasetsClient.prototype, {
|
|
633
717
|
create(name, options) {
|
|
634
718
|
return this._modify("PUT", name, options);
|
|
635
719
|
},
|
|
@@ -643,7 +727,7 @@ var require_datasetsClient = __commonJS({
|
|
|
643
727
|
return this.request({ uri: "/datasets" });
|
|
644
728
|
},
|
|
645
729
|
_modify(method, name, body) {
|
|
646
|
-
|
|
730
|
+
validate2.dataset(name);
|
|
647
731
|
return this.request({ method, uri: `/datasets/${name}`, body });
|
|
648
732
|
}
|
|
649
733
|
});
|
|
@@ -654,11 +738,10 @@ var require_datasetsClient = __commonJS({
|
|
|
654
738
|
// src/projects/projectsClient.js
|
|
655
739
|
var require_projectsClient = __commonJS({
|
|
656
740
|
"src/projects/projectsClient.js"(exports, module) {
|
|
657
|
-
var assign = __require("object-assign");
|
|
658
741
|
function ProjectsClient(client) {
|
|
659
742
|
this.client = client;
|
|
660
743
|
}
|
|
661
|
-
assign(ProjectsClient.prototype, {
|
|
744
|
+
Object.assign(ProjectsClient.prototype, {
|
|
662
745
|
list() {
|
|
663
746
|
return this.client.request({ uri: "/projects" });
|
|
664
747
|
},
|
|
@@ -688,8 +771,7 @@ var require_queryString = __commonJS({
|
|
|
688
771
|
// src/assets/assetsClient.js
|
|
689
772
|
var require_assetsClient = __commonJS({
|
|
690
773
|
"src/assets/assetsClient.js"(exports, module) {
|
|
691
|
-
var
|
|
692
|
-
var { map, filter } = require_observable();
|
|
774
|
+
var { map: map2, filter: filter2 } = (init_observable_modern(), __toCommonJS(observable_modern_exports));
|
|
693
775
|
var queryString = require_queryString();
|
|
694
776
|
var validators = require_validators();
|
|
695
777
|
function AssetsClient(client) {
|
|
@@ -699,7 +781,7 @@ var require_assetsClient = __commonJS({
|
|
|
699
781
|
if (typeof window === "undefined" || !(file instanceof window.File)) {
|
|
700
782
|
return opts;
|
|
701
783
|
}
|
|
702
|
-
return assign(
|
|
784
|
+
return Object.assign(
|
|
703
785
|
{
|
|
704
786
|
filename: opts.preserveFilename === false ? void 0 : file.name,
|
|
705
787
|
contentType: file.type
|
|
@@ -707,7 +789,7 @@ var require_assetsClient = __commonJS({
|
|
|
707
789
|
opts
|
|
708
790
|
);
|
|
709
791
|
}
|
|
710
|
-
assign(AssetsClient.prototype, {
|
|
792
|
+
Object.assign(AssetsClient.prototype, {
|
|
711
793
|
upload(assetType, body, opts = {}) {
|
|
712
794
|
validators.validateAssetType(assetType);
|
|
713
795
|
let meta = opts.extract || void 0;
|
|
@@ -731,7 +813,7 @@ var require_assetsClient = __commonJS({
|
|
|
731
813
|
query.sourceName = source.name;
|
|
732
814
|
query.sourceUrl = source.url;
|
|
733
815
|
}
|
|
734
|
-
const
|
|
816
|
+
const observable2 = this.client._requestObservable({
|
|
735
817
|
tag,
|
|
736
818
|
method: "POST",
|
|
737
819
|
timeout: options.timeout || 0,
|
|
@@ -740,10 +822,10 @@ var require_assetsClient = __commonJS({
|
|
|
740
822
|
query,
|
|
741
823
|
body
|
|
742
824
|
});
|
|
743
|
-
return this.client.isPromiseAPI() ?
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
).toPromise() :
|
|
825
|
+
return this.client.isPromiseAPI() ? observable2.pipe(
|
|
826
|
+
filter2((event) => event.type === "response"),
|
|
827
|
+
map2((event) => event.body.document)
|
|
828
|
+
).toPromise() : observable2;
|
|
747
829
|
},
|
|
748
830
|
delete(type, id) {
|
|
749
831
|
console.warn("client.assets.delete() is deprecated, please use client.delete(<document-id>)");
|
|
@@ -782,11 +864,10 @@ var require_assetsClient = __commonJS({
|
|
|
782
864
|
// src/users/usersClient.js
|
|
783
865
|
var require_usersClient = __commonJS({
|
|
784
866
|
"src/users/usersClient.js"(exports, module) {
|
|
785
|
-
var assign = __require("object-assign");
|
|
786
867
|
function UsersClient(client) {
|
|
787
868
|
this.client = client;
|
|
788
869
|
}
|
|
789
|
-
assign(UsersClient.prototype, {
|
|
870
|
+
Object.assign(UsersClient.prototype, {
|
|
790
871
|
getById(id) {
|
|
791
872
|
return this.client.request({ uri: `/users/${id}` });
|
|
792
873
|
}
|
|
@@ -798,11 +879,10 @@ var require_usersClient = __commonJS({
|
|
|
798
879
|
// src/auth/authClient.js
|
|
799
880
|
var require_authClient = __commonJS({
|
|
800
881
|
"src/auth/authClient.js"(exports, module) {
|
|
801
|
-
var assign = __require("object-assign");
|
|
802
882
|
function AuthClient(client) {
|
|
803
883
|
this.client = client;
|
|
804
884
|
}
|
|
805
|
-
assign(AuthClient.prototype, {
|
|
885
|
+
Object.assign(AuthClient.prototype, {
|
|
806
886
|
getLoginProviders() {
|
|
807
887
|
return this.client.request({ uri: "/auth/providers" });
|
|
808
888
|
},
|
|
@@ -815,19 +895,18 @@ var require_authClient = __commonJS({
|
|
|
815
895
|
});
|
|
816
896
|
|
|
817
897
|
// src/http/errors.js
|
|
898
|
+
import makeError from "make-error";
|
|
818
899
|
var require_errors = __commonJS({
|
|
819
900
|
"src/http/errors.js"(exports) {
|
|
820
|
-
var makeError = __require("make-error");
|
|
821
|
-
var assign = __require("object-assign");
|
|
822
901
|
function ClientError(res) {
|
|
823
902
|
const props = extractErrorProps(res);
|
|
824
903
|
ClientError.super.call(this, props.message);
|
|
825
|
-
assign(this, props);
|
|
904
|
+
Object.assign(this, props);
|
|
826
905
|
}
|
|
827
906
|
function ServerError(res) {
|
|
828
907
|
const props = extractErrorProps(res);
|
|
829
908
|
ServerError.super.call(this, props.message);
|
|
830
|
-
assign(this, props);
|
|
909
|
+
Object.assign(this, props);
|
|
831
910
|
}
|
|
832
911
|
function extractErrorProps(res) {
|
|
833
912
|
const body = res.body;
|
|
@@ -872,15 +951,11 @@ var require_browserMiddleware = __commonJS({
|
|
|
872
951
|
});
|
|
873
952
|
|
|
874
953
|
// src/http/request.js
|
|
954
|
+
import getIt from "get-it";
|
|
955
|
+
import { observable, jsonRequest, jsonResponse, progress } from "get-it/middleware";
|
|
875
956
|
var require_request = __commonJS({
|
|
876
957
|
"src/http/request.js"(exports, module) {
|
|
877
|
-
var
|
|
878
|
-
var assign = __require("object-assign");
|
|
879
|
-
var observable = __require("get-it/lib/middleware/observable");
|
|
880
|
-
var jsonRequest = __require("get-it/lib/middleware/jsonRequest");
|
|
881
|
-
var jsonResponse = __require("get-it/lib/middleware/jsonResponse");
|
|
882
|
-
var progress = __require("get-it/lib/middleware/progress");
|
|
883
|
-
var { Observable } = require_observable();
|
|
958
|
+
var { Observable: Observable2 } = (init_observable_modern(), __toCommonJS(observable_modern_exports));
|
|
884
959
|
var { ClientError, ServerError } = require_errors();
|
|
885
960
|
var httpError = {
|
|
886
961
|
onResponse: (res) => {
|
|
@@ -895,23 +970,23 @@ var require_request = __commonJS({
|
|
|
895
970
|
var printWarnings = {
|
|
896
971
|
onResponse: (res) => {
|
|
897
972
|
const warn = res.headers["x-sanity-warning"];
|
|
898
|
-
const
|
|
899
|
-
|
|
973
|
+
const warnings2 = Array.isArray(warn) ? warn : [warn];
|
|
974
|
+
warnings2.filter(Boolean).forEach((msg) => console.warn(msg));
|
|
900
975
|
return res;
|
|
901
976
|
}
|
|
902
977
|
};
|
|
903
|
-
var envSpecific = require_browserMiddleware();
|
|
978
|
+
var envSpecific = typeof EdgeRuntime === "string" ? require_browserMiddleware() : require_browserMiddleware();
|
|
904
979
|
var middleware = envSpecific.concat([
|
|
905
980
|
printWarnings,
|
|
906
981
|
jsonRequest(),
|
|
907
982
|
jsonResponse(),
|
|
908
983
|
progress(),
|
|
909
984
|
httpError,
|
|
910
|
-
observable({ implementation:
|
|
985
|
+
observable({ implementation: Observable2 })
|
|
911
986
|
]);
|
|
912
987
|
var request = getIt(middleware);
|
|
913
988
|
function httpRequest(options, requester = request) {
|
|
914
|
-
return requester(assign({ maxRedirects: 0 }, options));
|
|
989
|
+
return requester(Object.assign({ maxRedirects: 0 }, options));
|
|
915
990
|
}
|
|
916
991
|
httpRequest.defaultRequester = request;
|
|
917
992
|
httpRequest.ClientError = ClientError;
|
|
@@ -923,7 +998,6 @@ var require_request = __commonJS({
|
|
|
923
998
|
// src/http/requestOptions.js
|
|
924
999
|
var require_requestOptions = __commonJS({
|
|
925
1000
|
"src/http/requestOptions.js"(exports, module) {
|
|
926
|
-
var assign = __require("object-assign");
|
|
927
1001
|
var projectHeader = "X-Sanity-Project-ID";
|
|
928
1002
|
module.exports = (config, overrides = {}) => {
|
|
929
1003
|
const headers = {};
|
|
@@ -938,8 +1012,8 @@ var require_requestOptions = __commonJS({
|
|
|
938
1012
|
typeof overrides.withCredentials === "undefined" ? config.token || config.withCredentials : overrides.withCredentials
|
|
939
1013
|
);
|
|
940
1014
|
const timeout = typeof overrides.timeout === "undefined" ? config.timeout : overrides.timeout;
|
|
941
|
-
return assign({}, overrides, {
|
|
942
|
-
headers: assign({}, headers, overrides.headers || {}),
|
|
1015
|
+
return Object.assign({}, overrides, {
|
|
1016
|
+
headers: Object.assign({}, headers, overrides.headers || {}),
|
|
943
1017
|
timeout: typeof timeout === "undefined" ? 5 * 60 * 1e3 : timeout,
|
|
944
1018
|
proxy: overrides.proxy || config.proxy,
|
|
945
1019
|
json: true,
|
|
@@ -950,12 +1024,17 @@ var require_requestOptions = __commonJS({
|
|
|
950
1024
|
});
|
|
951
1025
|
|
|
952
1026
|
// src/generateHelpUrl.js
|
|
953
|
-
var
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
1027
|
+
var generateHelpUrl_exports = {};
|
|
1028
|
+
__export(generateHelpUrl_exports, {
|
|
1029
|
+
default: () => generateHelpUrl
|
|
1030
|
+
});
|
|
1031
|
+
function generateHelpUrl(slug) {
|
|
1032
|
+
return BASE_URL + slug;
|
|
1033
|
+
}
|
|
1034
|
+
var BASE_URL;
|
|
1035
|
+
var init_generateHelpUrl = __esm({
|
|
1036
|
+
"src/generateHelpUrl.js"() {
|
|
1037
|
+
BASE_URL = "https://docs.sanity.io/help/";
|
|
959
1038
|
}
|
|
960
1039
|
});
|
|
961
1040
|
|
|
@@ -980,51 +1059,66 @@ var require_once = __commonJS({
|
|
|
980
1059
|
// src/warnings.js
|
|
981
1060
|
var require_warnings = __commonJS({
|
|
982
1061
|
"src/warnings.js"(exports) {
|
|
983
|
-
var
|
|
1062
|
+
var generateHelpUrl2 = (init_generateHelpUrl(), __toCommonJS(generateHelpUrl_exports));
|
|
984
1063
|
var once = require_once();
|
|
985
1064
|
var createWarningPrinter = (message) => once((...args) => console.warn(message.join(" "), ...args));
|
|
986
1065
|
exports.printCdnWarning = createWarningPrinter([
|
|
987
1066
|
"You are not using the Sanity CDN. That means your data is always fresh, but the CDN is faster and",
|
|
988
|
-
`cheaper. Think about it! For more info, see ${
|
|
1067
|
+
`cheaper. Think about it! For more info, see ${generateHelpUrl2("js-client-cdn-configuration")}.`,
|
|
989
1068
|
"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating",
|
|
990
1069
|
"the client."
|
|
991
1070
|
]);
|
|
992
1071
|
exports.printBrowserTokenWarning = createWarningPrinter([
|
|
993
1072
|
"You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.",
|
|
994
|
-
`See ${
|
|
1073
|
+
`See ${generateHelpUrl2(
|
|
995
1074
|
"js-client-browser-token"
|
|
996
1075
|
)} for more information and how to hide this warning.`
|
|
997
1076
|
]);
|
|
998
1077
|
exports.printNoApiVersionSpecifiedWarning = createWarningPrinter([
|
|
999
1078
|
"Using the Sanity client without specifying an API version is deprecated.",
|
|
1000
|
-
`See ${
|
|
1079
|
+
`See ${generateHelpUrl2("js-client-api-version")}`
|
|
1001
1080
|
]);
|
|
1002
1081
|
}
|
|
1003
1082
|
});
|
|
1004
1083
|
|
|
1005
1084
|
// src/config.js
|
|
1006
|
-
var
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1085
|
+
var config_exports = {};
|
|
1086
|
+
__export(config_exports, {
|
|
1087
|
+
defaultConfig: () => defaultConfig,
|
|
1088
|
+
initConfig: () => initConfig,
|
|
1089
|
+
validateApiVersion: () => validateApiVersion
|
|
1090
|
+
});
|
|
1091
|
+
var import_validators, import_warnings, defaultCdnHost, defaultConfig, LOCALHOSTS, isLocal, validateApiVersion, initConfig;
|
|
1092
|
+
var init_config = __esm({
|
|
1093
|
+
"src/config.js"() {
|
|
1094
|
+
init_generateHelpUrl();
|
|
1095
|
+
import_validators = __toESM(require_validators());
|
|
1096
|
+
import_warnings = __toESM(require_warnings());
|
|
1097
|
+
defaultCdnHost = "apicdn.sanity.io";
|
|
1098
|
+
defaultConfig = {
|
|
1014
1099
|
apiHost: "https://api.sanity.io",
|
|
1015
1100
|
apiVersion: "1",
|
|
1016
1101
|
useProjectHostname: true,
|
|
1017
1102
|
isPromiseAPI: true
|
|
1018
1103
|
};
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1104
|
+
LOCALHOSTS = ["localhost", "127.0.0.1", "0.0.0.0"];
|
|
1105
|
+
isLocal = (host) => LOCALHOSTS.indexOf(host) !== -1;
|
|
1106
|
+
validateApiVersion = function validateApiVersion2(apiVersion) {
|
|
1107
|
+
if (apiVersion === "1" || apiVersion === "X") {
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
const apiDate = new Date(apiVersion);
|
|
1111
|
+
const apiVersionValid = /^\d{4}-\d{2}-\d{2}$/.test(apiVersion) && apiDate instanceof Date && apiDate.getTime() > 0;
|
|
1112
|
+
if (!apiVersionValid) {
|
|
1113
|
+
throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`");
|
|
1114
|
+
}
|
|
1115
|
+
};
|
|
1116
|
+
initConfig = (config, prevConfig) => {
|
|
1117
|
+
const specifiedConfig = Object.assign({}, prevConfig, config);
|
|
1024
1118
|
if (!specifiedConfig.apiVersion) {
|
|
1025
|
-
|
|
1119
|
+
import_warnings.default.printNoApiVersionSpecifiedWarning();
|
|
1026
1120
|
}
|
|
1027
|
-
const newConfig = assign({}, defaultConfig, specifiedConfig);
|
|
1121
|
+
const newConfig = Object.assign({}, defaultConfig, specifiedConfig);
|
|
1028
1122
|
const projectBased = newConfig.useProjectHostname;
|
|
1029
1123
|
if (typeof Promise === "undefined") {
|
|
1030
1124
|
const helpUrl = generateHelpUrl("js-client-promise-polyfill");
|
|
@@ -1036,23 +1130,23 @@ var require_config = __commonJS({
|
|
|
1036
1130
|
const isBrowser = typeof window !== "undefined" && window.location && window.location.hostname;
|
|
1037
1131
|
const isLocalhost = isBrowser && isLocal(window.location.hostname);
|
|
1038
1132
|
if (isBrowser && isLocalhost && newConfig.token && newConfig.ignoreBrowserTokenWarning !== true) {
|
|
1039
|
-
|
|
1133
|
+
import_warnings.default.printBrowserTokenWarning();
|
|
1040
1134
|
} else if (typeof newConfig.useCdn === "undefined") {
|
|
1041
|
-
|
|
1135
|
+
import_warnings.default.printCdnWarning();
|
|
1042
1136
|
}
|
|
1043
1137
|
if (projectBased) {
|
|
1044
|
-
|
|
1138
|
+
import_validators.default.projectId(newConfig.projectId);
|
|
1045
1139
|
}
|
|
1046
1140
|
if (newConfig.dataset) {
|
|
1047
|
-
|
|
1141
|
+
import_validators.default.dataset(newConfig.dataset);
|
|
1048
1142
|
}
|
|
1049
1143
|
if ("requestTagPrefix" in newConfig) {
|
|
1050
|
-
newConfig.requestTagPrefix = newConfig.requestTagPrefix ?
|
|
1144
|
+
newConfig.requestTagPrefix = newConfig.requestTagPrefix ? import_validators.default.requestTag(newConfig.requestTagPrefix).replace(/\.+$/, "") : void 0;
|
|
1051
1145
|
}
|
|
1052
1146
|
newConfig.apiVersion = `${newConfig.apiVersion}`.replace(/^v/, "");
|
|
1053
1147
|
newConfig.isDefaultApi = newConfig.apiHost === defaultConfig.apiHost;
|
|
1054
1148
|
newConfig.useCdn = Boolean(newConfig.useCdn) && !newConfig.withCredentials;
|
|
1055
|
-
|
|
1149
|
+
validateApiVersion(newConfig.apiVersion);
|
|
1056
1150
|
const hostParts = newConfig.apiHost.split("://", 2);
|
|
1057
1151
|
const protocol = hostParts[0];
|
|
1058
1152
|
const host = hostParts[1];
|
|
@@ -1066,24 +1160,14 @@ var require_config = __commonJS({
|
|
|
1066
1160
|
}
|
|
1067
1161
|
return newConfig;
|
|
1068
1162
|
};
|
|
1069
|
-
exports.validateApiVersion = function validateApiVersion(apiVersion) {
|
|
1070
|
-
if (apiVersion === "1" || apiVersion === "X") {
|
|
1071
|
-
return;
|
|
1072
|
-
}
|
|
1073
|
-
const apiDate = new Date(apiVersion);
|
|
1074
|
-
const apiVersionValid = /^\d{4}-\d{2}-\d{2}$/.test(apiVersion) && apiDate instanceof Date && apiDate.getTime() > 0;
|
|
1075
|
-
if (!apiVersionValid) {
|
|
1076
|
-
throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`");
|
|
1077
|
-
}
|
|
1078
|
-
};
|
|
1079
1163
|
}
|
|
1080
1164
|
});
|
|
1081
1165
|
|
|
1082
1166
|
// src/sanityClient.js
|
|
1083
1167
|
var require_sanityClient = __commonJS({
|
|
1084
1168
|
"src/sanityClient.js"(exports, module) {
|
|
1085
|
-
var
|
|
1086
|
-
var { Observable, map, filter } =
|
|
1169
|
+
var import_object_assign = __toESM(require_object_assign());
|
|
1170
|
+
var { Observable: Observable2, map: map2, filter: filter2 } = (init_observable_modern(), __toCommonJS(observable_modern_exports));
|
|
1087
1171
|
var Patch = require_patch();
|
|
1088
1172
|
var Transaction = require_transaction();
|
|
1089
1173
|
var dataMethods = require_dataMethods();
|
|
@@ -1094,10 +1178,10 @@ var require_sanityClient = __commonJS({
|
|
|
1094
1178
|
var AuthClient = require_authClient();
|
|
1095
1179
|
var httpRequest = require_request();
|
|
1096
1180
|
var getRequestOptions = require_requestOptions();
|
|
1097
|
-
var { defaultConfig, initConfig } =
|
|
1098
|
-
var
|
|
1099
|
-
var toPromise = (
|
|
1100
|
-
function SanityClient(config =
|
|
1181
|
+
var { defaultConfig: defaultConfig2, initConfig: initConfig2 } = (init_config(), __toCommonJS(config_exports));
|
|
1182
|
+
var validate2 = require_validators();
|
|
1183
|
+
var toPromise = (observable2) => observable2.toPromise();
|
|
1184
|
+
function SanityClient(config = defaultConfig2) {
|
|
1101
1185
|
if (!(this instanceof SanityClient)) {
|
|
1102
1186
|
return new SanityClient(config);
|
|
1103
1187
|
}
|
|
@@ -1108,24 +1192,24 @@ var require_sanityClient = __commonJS({
|
|
|
1108
1192
|
this.users = new UsersClient(this);
|
|
1109
1193
|
this.auth = new AuthClient(this);
|
|
1110
1194
|
if (this.clientConfig.isPromiseAPI) {
|
|
1111
|
-
const observableConfig = assign({}, this.clientConfig, { isPromiseAPI: false });
|
|
1195
|
+
const observableConfig = Object.assign({}, this.clientConfig, { isPromiseAPI: false });
|
|
1112
1196
|
this.observable = new SanityClient(observableConfig);
|
|
1113
1197
|
}
|
|
1114
1198
|
}
|
|
1115
|
-
assign(SanityClient.prototype, dataMethods);
|
|
1116
|
-
assign(SanityClient.prototype, {
|
|
1199
|
+
Object.assign(SanityClient.prototype, dataMethods);
|
|
1200
|
+
Object.assign(SanityClient.prototype, {
|
|
1117
1201
|
clone() {
|
|
1118
1202
|
return new SanityClient(this.config());
|
|
1119
1203
|
},
|
|
1120
1204
|
config(newConfig) {
|
|
1121
1205
|
if (typeof newConfig === "undefined") {
|
|
1122
|
-
return assign({}, this.clientConfig);
|
|
1206
|
+
return Object.assign({}, this.clientConfig);
|
|
1123
1207
|
}
|
|
1124
1208
|
if (this.observable) {
|
|
1125
|
-
const observableConfig = assign({}, newConfig, { isPromiseAPI: false });
|
|
1209
|
+
const observableConfig = Object.assign({}, newConfig, { isPromiseAPI: false });
|
|
1126
1210
|
this.observable.config(observableConfig);
|
|
1127
1211
|
}
|
|
1128
|
-
this.clientConfig =
|
|
1212
|
+
this.clientConfig = initConfig2(newConfig, this.clientConfig || {});
|
|
1129
1213
|
return this;
|
|
1130
1214
|
},
|
|
1131
1215
|
withConfig(newConfig) {
|
|
@@ -1144,24 +1228,24 @@ var require_sanityClient = __commonJS({
|
|
|
1144
1228
|
const useCdn = this.clientConfig.useCdn && canUseCdn;
|
|
1145
1229
|
const tag = options.tag && this.clientConfig.requestTagPrefix ? [this.clientConfig.requestTagPrefix, options.tag].join(".") : options.tag || this.clientConfig.requestTagPrefix;
|
|
1146
1230
|
if (tag) {
|
|
1147
|
-
options.query = { tag:
|
|
1231
|
+
options.query = { tag: validate2.requestTag(tag), ...options.query };
|
|
1148
1232
|
}
|
|
1149
1233
|
const reqOptions = getRequestOptions(
|
|
1150
1234
|
this.clientConfig,
|
|
1151
|
-
assign({}, options, {
|
|
1235
|
+
Object.assign({}, options, {
|
|
1152
1236
|
url: this.getUrl(uri, useCdn)
|
|
1153
1237
|
})
|
|
1154
1238
|
);
|
|
1155
|
-
return new
|
|
1239
|
+
return new Observable2(
|
|
1156
1240
|
(subscriber) => httpRequest(reqOptions, this.clientConfig.requester).subscribe(subscriber)
|
|
1157
1241
|
);
|
|
1158
1242
|
},
|
|
1159
1243
|
request(options) {
|
|
1160
|
-
const
|
|
1161
|
-
|
|
1162
|
-
|
|
1244
|
+
const observable2 = this._requestObservable(options).pipe(
|
|
1245
|
+
filter2((event) => event.type === "response"),
|
|
1246
|
+
map2((event) => event.body)
|
|
1163
1247
|
);
|
|
1164
|
-
return this.isPromiseAPI() ? toPromise(
|
|
1248
|
+
return this.isPromiseAPI() ? toPromise(observable2) : observable2;
|
|
1165
1249
|
}
|
|
1166
1250
|
});
|
|
1167
1251
|
SanityClient.Patch = Patch;
|
|
@@ -1173,4 +1257,9 @@ var require_sanityClient = __commonJS({
|
|
|
1173
1257
|
}
|
|
1174
1258
|
});
|
|
1175
1259
|
export default require_sanityClient();
|
|
1260
|
+
/*
|
|
1261
|
+
object-assign
|
|
1262
|
+
(c) Sindre Sorhus
|
|
1263
|
+
@license MIT
|
|
1264
|
+
*/
|
|
1176
1265
|
//# sourceMappingURL=sanityClient.browser.mjs.map
|