@bytescale/sdk 3.9.0 → 3.10.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/dist/browser/cjs/main.js +86 -215
- package/dist/browser/esm/main.mjs +86 -215
- package/dist/node/cjs/main.js +85 -214
- package/dist/node/esm/main.mjs +85 -214
- package/dist/types/private/AuthSessionState.d.ts +2 -2
- package/dist/types/private/FairMutex.d.ts +19 -0
- package/dist/worker/cjs/main.js +85 -214
- package/dist/worker/esm/main.mjs +85 -214
- package/package.json +1 -1
- package/dist/types/private/Mutex.d.ts +0 -16
package/dist/browser/cjs/main.js
CHANGED
|
@@ -58,7 +58,7 @@ __lib_require__.d(__lib_exports__, {
|
|
|
58
58
|
"querystring": function() { return /* reexport */ querystring; }
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
;// CONCATENATED MODULE: ./src/private/
|
|
61
|
+
;// CONCATENATED MODULE: ./src/private/FairMutex.ts
|
|
62
62
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
63
63
|
function _call(body, then, direct) {
|
|
64
64
|
if (direct) {
|
|
@@ -101,157 +101,12 @@ function _awaitIgnored(value, direct) {
|
|
|
101
101
|
return value && value.then ? value.then(_empty) : Promise.resolve();
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (state & 1) {
|
|
109
|
-
state = value.s;
|
|
110
|
-
}
|
|
111
|
-
value = value.v;
|
|
112
|
-
} else {
|
|
113
|
-
value.o = _settle.bind(null, pact, state);
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (value && value.then) {
|
|
118
|
-
value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
pact.s = state;
|
|
122
|
-
pact.v = value;
|
|
123
|
-
var observer = pact.o;
|
|
124
|
-
if (observer) {
|
|
125
|
-
observer(pact);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
var _Pact = /*#__PURE__*/function () {
|
|
130
|
-
function _Pact() {}
|
|
131
|
-
_Pact.prototype.then = function (onFulfilled, onRejected) {
|
|
132
|
-
var result = new _Pact();
|
|
133
|
-
var state = this.s;
|
|
134
|
-
if (state) {
|
|
135
|
-
var callback = state & 1 ? onFulfilled : onRejected;
|
|
136
|
-
if (callback) {
|
|
137
|
-
try {
|
|
138
|
-
_settle(result, 1, callback(this.v));
|
|
139
|
-
} catch (e) {
|
|
140
|
-
_settle(result, 2, e);
|
|
141
|
-
}
|
|
142
|
-
return result;
|
|
143
|
-
} else {
|
|
144
|
-
return this;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
this.o = function (_this) {
|
|
148
|
-
try {
|
|
149
|
-
var value = _this.v;
|
|
150
|
-
if (_this.s & 1) {
|
|
151
|
-
_settle(result, 1, onFulfilled ? onFulfilled(value) : value);
|
|
152
|
-
} else if (onRejected) {
|
|
153
|
-
_settle(result, 1, onRejected(value));
|
|
154
|
-
} else {
|
|
155
|
-
_settle(result, 2, value);
|
|
156
|
-
}
|
|
157
|
-
} catch (e) {
|
|
158
|
-
_settle(result, 2, e);
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
return result;
|
|
162
|
-
};
|
|
163
|
-
return _Pact;
|
|
164
|
-
}();
|
|
165
|
-
function _isSettledPact(thenable) {
|
|
166
|
-
return thenable instanceof _Pact && thenable.s & 1;
|
|
167
|
-
}
|
|
168
|
-
function _for(test, update, body) {
|
|
169
|
-
var stage;
|
|
170
|
-
for (;;) {
|
|
171
|
-
var shouldContinue = test();
|
|
172
|
-
if (_isSettledPact(shouldContinue)) {
|
|
173
|
-
shouldContinue = shouldContinue.v;
|
|
174
|
-
}
|
|
175
|
-
if (!shouldContinue) {
|
|
176
|
-
return result;
|
|
177
|
-
}
|
|
178
|
-
if (shouldContinue.then) {
|
|
179
|
-
stage = 0;
|
|
180
|
-
break;
|
|
181
|
-
}
|
|
182
|
-
var result = body();
|
|
183
|
-
if (result && result.then) {
|
|
184
|
-
if (_isSettledPact(result)) {
|
|
185
|
-
result = result.s;
|
|
186
|
-
} else {
|
|
187
|
-
stage = 1;
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
if (update) {
|
|
192
|
-
var updateValue = update();
|
|
193
|
-
if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
|
|
194
|
-
stage = 2;
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
var pact = new _Pact();
|
|
200
|
-
var reject = _settle.bind(null, pact, 2);
|
|
201
|
-
(stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);
|
|
202
|
-
return pact;
|
|
203
|
-
function _resumeAfterBody(value) {
|
|
204
|
-
result = value;
|
|
205
|
-
do {
|
|
206
|
-
if (update) {
|
|
207
|
-
updateValue = update();
|
|
208
|
-
if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
|
|
209
|
-
updateValue.then(_resumeAfterUpdate).then(void 0, reject);
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
shouldContinue = test();
|
|
214
|
-
if (!shouldContinue || _isSettledPact(shouldContinue) && !shouldContinue.v) {
|
|
215
|
-
_settle(pact, 1, result);
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
if (shouldContinue.then) {
|
|
219
|
-
shouldContinue.then(_resumeAfterTest).then(void 0, reject);
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
result = body();
|
|
223
|
-
if (_isSettledPact(result)) {
|
|
224
|
-
result = result.v;
|
|
225
|
-
}
|
|
226
|
-
} while (!result || !result.then);
|
|
227
|
-
result.then(_resumeAfterBody).then(void 0, reject);
|
|
228
|
-
}
|
|
229
|
-
function _resumeAfterTest(shouldContinue) {
|
|
230
|
-
if (shouldContinue) {
|
|
231
|
-
result = body();
|
|
232
|
-
if (result && result.then) {
|
|
233
|
-
result.then(_resumeAfterBody).then(void 0, reject);
|
|
234
|
-
} else {
|
|
235
|
-
_resumeAfterBody(result);
|
|
236
|
-
}
|
|
237
|
-
} else {
|
|
238
|
-
_settle(pact, 1, result);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
function _resumeAfterUpdate() {
|
|
242
|
-
if (shouldContinue = test()) {
|
|
243
|
-
if (shouldContinue.then) {
|
|
244
|
-
shouldContinue.then(_resumeAfterTest).then(void 0, reject);
|
|
245
|
-
} else {
|
|
246
|
-
_resumeAfterTest(shouldContinue);
|
|
247
|
-
}
|
|
248
|
-
} else {
|
|
249
|
-
_settle(pact, 1, result);
|
|
250
|
-
}
|
|
104
|
+
function _invoke(body, then) {
|
|
105
|
+
var result = body();
|
|
106
|
+
if (result && result.then) {
|
|
107
|
+
return result.then(then);
|
|
251
108
|
}
|
|
252
|
-
|
|
253
|
-
function _continue(value, then) {
|
|
254
|
-
return value && value.then ? value.then(then) : then(value);
|
|
109
|
+
return then(result);
|
|
255
110
|
}
|
|
256
111
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
257
112
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
@@ -259,28 +114,31 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
259
114
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
260
115
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
261
116
|
/**
|
|
262
|
-
* A lightweight mutex. (Other libraries contain too many features and we want to keep size down).
|
|
117
|
+
* A lightweight fair mutex. (Other libraries contain too many features and we want to keep size down).
|
|
263
118
|
*
|
|
264
119
|
* Characteristics:
|
|
265
120
|
* - Non-reentrant.
|
|
266
|
-
* -
|
|
121
|
+
* - Fair.
|
|
122
|
+
* - This means multiple callers awaiting 'lock' will be granted the mutex in the order they requested it.
|
|
123
|
+
* - This is important, as in React, developers calling 'AuthManager.endAuthSession' in a 'useEffect' cleanup need it
|
|
124
|
+
* to take effect immediately, such that subsequent 'AuthManager.beginAuthSession' calls will always succeed.
|
|
267
125
|
* - When calling `safe` consecutively with no 'awaits' in-between, the current context will synchronously acquire
|
|
268
126
|
* the mutex every time.
|
|
269
127
|
*/
|
|
270
|
-
var
|
|
271
|
-
function
|
|
272
|
-
_classCallCheck(this,
|
|
273
|
-
this.
|
|
274
|
-
this.
|
|
128
|
+
var FairMutex = /*#__PURE__*/function () {
|
|
129
|
+
function FairMutex() {
|
|
130
|
+
_classCallCheck(this, FairMutex);
|
|
131
|
+
this.locked = false;
|
|
132
|
+
this.queue = [];
|
|
275
133
|
}
|
|
276
|
-
_createClass(
|
|
134
|
+
_createClass(FairMutex, [{
|
|
277
135
|
key: "safe",
|
|
278
136
|
value: function safe(callback) {
|
|
279
137
|
try {
|
|
280
138
|
var _this2 = this;
|
|
281
|
-
return _await(_this2.
|
|
139
|
+
return _await(_this2.lock(), function () {
|
|
282
140
|
return _finallyRethrows(callback, function (_wasThrown, _result) {
|
|
283
|
-
_this2.
|
|
141
|
+
_this2.unlock();
|
|
284
142
|
return _rethrow(_wasThrown, _result);
|
|
285
143
|
});
|
|
286
144
|
});
|
|
@@ -289,37 +147,48 @@ var Mutex = /*#__PURE__*/function () {
|
|
|
289
147
|
}
|
|
290
148
|
}
|
|
291
149
|
}, {
|
|
292
|
-
key: "
|
|
293
|
-
value: function
|
|
150
|
+
key: "lock",
|
|
151
|
+
value: function lock() {
|
|
294
152
|
try {
|
|
153
|
+
var _exit2 = false;
|
|
295
154
|
var _this4 = this;
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
155
|
+
return _invoke(function () {
|
|
156
|
+
if (_this4.locked) {
|
|
157
|
+
var unlockNext;
|
|
158
|
+
var lockPromise = new Promise(function (resolve) {
|
|
159
|
+
unlockNext = resolve;
|
|
160
|
+
});
|
|
161
|
+
if (unlockNext === undefined) {
|
|
162
|
+
throw new Error("unlockNext was undefined");
|
|
163
|
+
}
|
|
164
|
+
_this4.queue.push({
|
|
165
|
+
resolve: unlockNext
|
|
166
|
+
});
|
|
167
|
+
return _awaitIgnored(lockPromise);
|
|
168
|
+
}
|
|
169
|
+
}, function (_result2) {
|
|
170
|
+
if (_exit2) return _result2;
|
|
171
|
+
_this4.locked = true;
|
|
306
172
|
});
|
|
307
173
|
} catch (e) {
|
|
308
174
|
return Promise.reject(e);
|
|
309
175
|
}
|
|
310
176
|
}
|
|
311
177
|
}, {
|
|
312
|
-
key: "
|
|
313
|
-
value: function
|
|
314
|
-
if (this.
|
|
315
|
-
throw new Error("
|
|
178
|
+
key: "unlock",
|
|
179
|
+
value: function unlock() {
|
|
180
|
+
if (!this.locked) {
|
|
181
|
+
throw new Error("Mutex is not locked.");
|
|
182
|
+
}
|
|
183
|
+
var nextInQueue = this.queue.shift();
|
|
184
|
+
if (nextInQueue !== undefined) {
|
|
185
|
+
nextInQueue.resolve();
|
|
186
|
+
} else {
|
|
187
|
+
this.locked = false;
|
|
316
188
|
}
|
|
317
|
-
this.resolver();
|
|
318
|
-
this.resolver = undefined;
|
|
319
|
-
this.mutex = undefined;
|
|
320
189
|
}
|
|
321
190
|
}]);
|
|
322
|
-
return
|
|
191
|
+
return FairMutex;
|
|
323
192
|
}();
|
|
324
193
|
;// CONCATENATED MODULE: ./src/private/AuthSessionState.ts
|
|
325
194
|
function AuthSessionState_typeof(obj) { "@babel/helpers - typeof"; return AuthSessionState_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, AuthSessionState_typeof(obj); }
|
|
@@ -355,7 +224,7 @@ var AuthSessionState = /*#__PURE__*/function () {
|
|
|
355
224
|
var key = AuthSessionState.mutexKey;
|
|
356
225
|
var mutex = window[key];
|
|
357
226
|
if (mutex === undefined) {
|
|
358
|
-
mutex = new
|
|
227
|
+
mutex = new FairMutex();
|
|
359
228
|
window[key] = mutex;
|
|
360
229
|
}
|
|
361
230
|
return mutex;
|
|
@@ -408,10 +277,10 @@ function _catch(body, recover) {
|
|
|
408
277
|
return result;
|
|
409
278
|
}
|
|
410
279
|
function runtime_empty() {}
|
|
411
|
-
function
|
|
280
|
+
function _continue(value, then) {
|
|
412
281
|
return value && value.then ? value.then(then) : then(value);
|
|
413
282
|
}
|
|
414
|
-
function
|
|
283
|
+
function runtime_invoke(body, then) {
|
|
415
284
|
var result = body();
|
|
416
285
|
if (result && result.then) {
|
|
417
286
|
return result.then(then);
|
|
@@ -602,7 +471,7 @@ var BaseAPI = /*#__PURE__*/function () {
|
|
|
602
471
|
var _exit3 = false;
|
|
603
472
|
var _a, _b;
|
|
604
473
|
var response;
|
|
605
|
-
return
|
|
474
|
+
return _continue(_catch(function () {
|
|
606
475
|
return runtime_await(BytescaleApiClientConfigUtils.getFetchApi(config)(url, Object.assign(Object.assign({}, init), {
|
|
607
476
|
// This is specifically added to cater for Next.js's Fetch implementation, which caches POST requests...
|
|
608
477
|
//
|
|
@@ -622,10 +491,10 @@ var BaseAPI = /*#__PURE__*/function () {
|
|
|
622
491
|
}), function (_result) {
|
|
623
492
|
var _exit2 = false;
|
|
624
493
|
if (_exit3) return _result;
|
|
625
|
-
return response.status >= 200 && response.status < 300 ? response :
|
|
494
|
+
return response.status >= 200 && response.status < 300 ? response : runtime_invoke(function () {
|
|
626
495
|
if (config.isBytescaleApi) {
|
|
627
496
|
var jsonError = undefined;
|
|
628
|
-
return
|
|
497
|
+
return _continue(_catch(function () {
|
|
629
498
|
return runtime_await(response.json(), function (_response$json) {
|
|
630
499
|
jsonError = _response$json;
|
|
631
500
|
});
|
|
@@ -1831,21 +1700,21 @@ function _invokeIgnored(body) {
|
|
|
1831
1700
|
return result.then(UploadManagerBase_empty);
|
|
1832
1701
|
}
|
|
1833
1702
|
}
|
|
1834
|
-
function
|
|
1703
|
+
function _settle(pact, state, value) {
|
|
1835
1704
|
if (!pact.s) {
|
|
1836
|
-
if (value instanceof
|
|
1705
|
+
if (value instanceof _Pact) {
|
|
1837
1706
|
if (value.s) {
|
|
1838
1707
|
if (state & 1) {
|
|
1839
1708
|
state = value.s;
|
|
1840
1709
|
}
|
|
1841
1710
|
value = value.v;
|
|
1842
1711
|
} else {
|
|
1843
|
-
value.o =
|
|
1712
|
+
value.o = _settle.bind(null, pact, state);
|
|
1844
1713
|
return;
|
|
1845
1714
|
}
|
|
1846
1715
|
}
|
|
1847
1716
|
if (value && value.then) {
|
|
1848
|
-
value.then(
|
|
1717
|
+
value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
|
|
1849
1718
|
return;
|
|
1850
1719
|
}
|
|
1851
1720
|
pact.s = state;
|
|
@@ -1856,7 +1725,7 @@ function UploadManagerBase_settle(pact, state, value) {
|
|
|
1856
1725
|
}
|
|
1857
1726
|
}
|
|
1858
1727
|
}
|
|
1859
|
-
var
|
|
1728
|
+
var _Pact = /*#__PURE__*/function () {
|
|
1860
1729
|
function _Pact() {}
|
|
1861
1730
|
_Pact.prototype.then = function (onFulfilled, onRejected) {
|
|
1862
1731
|
var result = new _Pact();
|
|
@@ -1865,9 +1734,9 @@ var UploadManagerBase_Pact = /*#__PURE__*/function () {
|
|
|
1865
1734
|
var callback = state & 1 ? onFulfilled : onRejected;
|
|
1866
1735
|
if (callback) {
|
|
1867
1736
|
try {
|
|
1868
|
-
|
|
1737
|
+
_settle(result, 1, callback(this.v));
|
|
1869
1738
|
} catch (e) {
|
|
1870
|
-
|
|
1739
|
+
_settle(result, 2, e);
|
|
1871
1740
|
}
|
|
1872
1741
|
return result;
|
|
1873
1742
|
} else {
|
|
@@ -1878,28 +1747,28 @@ var UploadManagerBase_Pact = /*#__PURE__*/function () {
|
|
|
1878
1747
|
try {
|
|
1879
1748
|
var value = _this.v;
|
|
1880
1749
|
if (_this.s & 1) {
|
|
1881
|
-
|
|
1750
|
+
_settle(result, 1, onFulfilled ? onFulfilled(value) : value);
|
|
1882
1751
|
} else if (onRejected) {
|
|
1883
|
-
|
|
1752
|
+
_settle(result, 1, onRejected(value));
|
|
1884
1753
|
} else {
|
|
1885
|
-
|
|
1754
|
+
_settle(result, 2, value);
|
|
1886
1755
|
}
|
|
1887
1756
|
} catch (e) {
|
|
1888
|
-
|
|
1757
|
+
_settle(result, 2, e);
|
|
1889
1758
|
}
|
|
1890
1759
|
};
|
|
1891
1760
|
return result;
|
|
1892
1761
|
};
|
|
1893
1762
|
return _Pact;
|
|
1894
1763
|
}();
|
|
1895
|
-
function
|
|
1896
|
-
return thenable instanceof
|
|
1764
|
+
function _isSettledPact(thenable) {
|
|
1765
|
+
return thenable instanceof _Pact && thenable.s & 1;
|
|
1897
1766
|
}
|
|
1898
|
-
function
|
|
1767
|
+
function _for(test, update, body) {
|
|
1899
1768
|
var stage;
|
|
1900
1769
|
for (;;) {
|
|
1901
1770
|
var shouldContinue = test();
|
|
1902
|
-
if (
|
|
1771
|
+
if (_isSettledPact(shouldContinue)) {
|
|
1903
1772
|
shouldContinue = shouldContinue.v;
|
|
1904
1773
|
}
|
|
1905
1774
|
if (!shouldContinue) {
|
|
@@ -1911,7 +1780,7 @@ function UploadManagerBase_for(test, update, body) {
|
|
|
1911
1780
|
}
|
|
1912
1781
|
var result = body();
|
|
1913
1782
|
if (result && result.then) {
|
|
1914
|
-
if (
|
|
1783
|
+
if (_isSettledPact(result)) {
|
|
1915
1784
|
result = result.s;
|
|
1916
1785
|
} else {
|
|
1917
1786
|
stage = 1;
|
|
@@ -1920,14 +1789,14 @@ function UploadManagerBase_for(test, update, body) {
|
|
|
1920
1789
|
}
|
|
1921
1790
|
if (update) {
|
|
1922
1791
|
var updateValue = update();
|
|
1923
|
-
if (updateValue && updateValue.then && !
|
|
1792
|
+
if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
|
|
1924
1793
|
stage = 2;
|
|
1925
1794
|
break;
|
|
1926
1795
|
}
|
|
1927
1796
|
}
|
|
1928
1797
|
}
|
|
1929
|
-
var pact = new
|
|
1930
|
-
var reject =
|
|
1798
|
+
var pact = new _Pact();
|
|
1799
|
+
var reject = _settle.bind(null, pact, 2);
|
|
1931
1800
|
(stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);
|
|
1932
1801
|
return pact;
|
|
1933
1802
|
function _resumeAfterBody(value) {
|
|
@@ -1935,14 +1804,14 @@ function UploadManagerBase_for(test, update, body) {
|
|
|
1935
1804
|
do {
|
|
1936
1805
|
if (update) {
|
|
1937
1806
|
updateValue = update();
|
|
1938
|
-
if (updateValue && updateValue.then && !
|
|
1807
|
+
if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
|
|
1939
1808
|
updateValue.then(_resumeAfterUpdate).then(void 0, reject);
|
|
1940
1809
|
return;
|
|
1941
1810
|
}
|
|
1942
1811
|
}
|
|
1943
1812
|
shouldContinue = test();
|
|
1944
|
-
if (!shouldContinue ||
|
|
1945
|
-
|
|
1813
|
+
if (!shouldContinue || _isSettledPact(shouldContinue) && !shouldContinue.v) {
|
|
1814
|
+
_settle(pact, 1, result);
|
|
1946
1815
|
return;
|
|
1947
1816
|
}
|
|
1948
1817
|
if (shouldContinue.then) {
|
|
@@ -1950,7 +1819,7 @@ function UploadManagerBase_for(test, update, body) {
|
|
|
1950
1819
|
return;
|
|
1951
1820
|
}
|
|
1952
1821
|
result = body();
|
|
1953
|
-
if (
|
|
1822
|
+
if (_isSettledPact(result)) {
|
|
1954
1823
|
result = result.v;
|
|
1955
1824
|
}
|
|
1956
1825
|
} while (!result || !result.then);
|
|
@@ -1965,7 +1834,7 @@ function UploadManagerBase_for(test, update, body) {
|
|
|
1965
1834
|
_resumeAfterBody(result);
|
|
1966
1835
|
}
|
|
1967
1836
|
} else {
|
|
1968
|
-
|
|
1837
|
+
_settle(pact, 1, result);
|
|
1969
1838
|
}
|
|
1970
1839
|
}
|
|
1971
1840
|
function _resumeAfterUpdate() {
|
|
@@ -1976,7 +1845,7 @@ function UploadManagerBase_for(test, update, body) {
|
|
|
1976
1845
|
_resumeAfterTest(shouldContinue);
|
|
1977
1846
|
}
|
|
1978
1847
|
} else {
|
|
1979
|
-
|
|
1848
|
+
_settle(pact, 1, result);
|
|
1980
1849
|
}
|
|
1981
1850
|
}
|
|
1982
1851
|
}
|
|
@@ -2090,7 +1959,9 @@ var UploadManagerBase = /*#__PURE__*/function () {
|
|
|
2090
1959
|
size = _ref$value.size,
|
|
2091
1960
|
type = _ref$value.type;
|
|
2092
1961
|
return {
|
|
2093
|
-
|
|
1962
|
+
// Some browsers/OSs return 'type: ""' for files with unknown MIME types, like HEICs, which causes a validation
|
|
1963
|
+
// error from the Bytescale API as "" is not a valid MIME type, so we coalesce to undefined here.
|
|
1964
|
+
mime: type === "" ? undefined : type,
|
|
2094
1965
|
size: size,
|
|
2095
1966
|
originalFileName: name,
|
|
2096
1967
|
maxConcurrentUploadParts: undefined
|
|
@@ -2278,7 +2149,7 @@ var UploadManagerBase = /*#__PURE__*/function () {
|
|
|
2278
2149
|
try {
|
|
2279
2150
|
var workQueue = UploadManagerBase_toConsumableArray(items);
|
|
2280
2151
|
return UploadManagerBase_awaitIgnored(Promise.all(UploadManagerBase_toConsumableArray(Array(concurrency).keys()).map(_async(function () {
|
|
2281
|
-
return _continueIgnored(
|
|
2152
|
+
return _continueIgnored(_for(function () {
|
|
2282
2153
|
return workQueue.length > 0;
|
|
2283
2154
|
}, void 0, function () {
|
|
2284
2155
|
var work = workQueue.shift(); // IMPORTANT: use 'shift' instead of 'pop' to ensure 'items' are processed in order when 'concurrency = 1'.
|
|
@@ -2618,7 +2489,7 @@ var AuthManagerImpl = /*#__PURE__*/function () {
|
|
|
2618
2489
|
return AuthManagerBrowser_await(_this2.authSessionMutex.safe(AuthManagerBrowser_async(function () {
|
|
2619
2490
|
// We check both 'session' and 'sessionDisposing' here, as we don't want to call 'beginAuthSession' until the session is fully disposed.
|
|
2620
2491
|
if (_this2.isAuthSessionActive()) {
|
|
2621
|
-
throw new Error("Auth session already active
|
|
2492
|
+
throw new Error("Auth session already active. Please call 'await endAuthSession()' and then call 'await beginAuthSession(...)' to start a new auth session.");
|
|
2622
2493
|
}
|
|
2623
2494
|
AuthSessionState.setSession(newSession);
|
|
2624
2495
|
return AuthManagerBrowser_await();
|