@bytescale/sdk 1.5.0 → 3.0.0-alpha.10

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.
@@ -51,7 +51,7 @@ __lib_require__.d(__lib_exports__, {
51
51
  "AuthManager": function() { return /* reexport */ AuthManager; },
52
52
  "BaseAPI": function() { return /* reexport */ BaseAPI; },
53
53
  "BinaryResult": function() { return /* reexport */ BinaryResult; },
54
- "BytescaleApiClientConfigResolver": function() { return /* reexport */ BytescaleApiClientConfigResolver; },
54
+ "BytescaleApiClientConfigUtils": function() { return /* reexport */ BytescaleApiClientConfigUtils; },
55
55
  "BytescaleApiError": function() { return /* reexport */ BytescaleApiError; },
56
56
  "CancelledError": function() { return /* reexport */ CancelledError; },
57
57
  "CommonTypesNoOp": function() { return /* reexport */ CommonTypesNoOp; },
@@ -67,16 +67,332 @@ __lib_require__.d(__lib_exports__, {
67
67
  "querystring": function() { return /* reexport */ querystring; }
68
68
  });
69
69
 
70
- ;// CONCATENATED MODULE: ./src/private/AuthSessionState.ts
70
+ ;// CONCATENATED MODULE: ./src/private/Mutex.ts
71
71
  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); }
72
+ function _call(body, then, direct) {
73
+ if (direct) {
74
+ return then ? then(body()) : body();
75
+ }
76
+ try {
77
+ var result = Promise.resolve(body());
78
+ return then ? result.then(then) : result;
79
+ } catch (e) {
80
+ return Promise.reject(e);
81
+ }
82
+ }
83
+ function _rethrow(thrown, value) {
84
+ if (thrown) throw value;
85
+ return value;
86
+ }
87
+ function _finallyRethrows(body, finalizer) {
88
+ try {
89
+ var result = body();
90
+ } catch (e) {
91
+ return finalizer(true, e);
92
+ }
93
+ if (result && result.then) {
94
+ return result.then(finalizer.bind(null, false), finalizer.bind(null, true));
95
+ }
96
+ return finalizer(false, result);
97
+ }
98
+ function _await(value, then, direct) {
99
+ if (direct) {
100
+ return then ? then(value) : value;
101
+ }
102
+ if (!value || !value.then) {
103
+ value = Promise.resolve(value);
104
+ }
105
+ return then ? value.then(then) : value;
106
+ }
107
+ function _empty() {}
108
+ function _awaitIgnored(value, direct) {
109
+ if (!direct) {
110
+ return value && value.then ? value.then(_empty) : Promise.resolve();
111
+ }
112
+ }
113
+ function _settle(pact, state, value) {
114
+ if (!pact.s) {
115
+ if (value instanceof _Pact) {
116
+ if (value.s) {
117
+ if (state & 1) {
118
+ state = value.s;
119
+ }
120
+ value = value.v;
121
+ } else {
122
+ value.o = _settle.bind(null, pact, state);
123
+ return;
124
+ }
125
+ }
126
+ if (value && value.then) {
127
+ value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
128
+ return;
129
+ }
130
+ pact.s = state;
131
+ pact.v = value;
132
+ var observer = pact.o;
133
+ if (observer) {
134
+ observer(pact);
135
+ }
136
+ }
137
+ }
138
+ var _Pact = /*#__PURE__*/function () {
139
+ function _Pact() {}
140
+ _Pact.prototype.then = function (onFulfilled, onRejected) {
141
+ var result = new _Pact();
142
+ var state = this.s;
143
+ if (state) {
144
+ var callback = state & 1 ? onFulfilled : onRejected;
145
+ if (callback) {
146
+ try {
147
+ _settle(result, 1, callback(this.v));
148
+ } catch (e) {
149
+ _settle(result, 2, e);
150
+ }
151
+ return result;
152
+ } else {
153
+ return this;
154
+ }
155
+ }
156
+ this.o = function (_this) {
157
+ try {
158
+ var value = _this.v;
159
+ if (_this.s & 1) {
160
+ _settle(result, 1, onFulfilled ? onFulfilled(value) : value);
161
+ } else if (onRejected) {
162
+ _settle(result, 1, onRejected(value));
163
+ } else {
164
+ _settle(result, 2, value);
165
+ }
166
+ } catch (e) {
167
+ _settle(result, 2, e);
168
+ }
169
+ };
170
+ return result;
171
+ };
172
+ return _Pact;
173
+ }();
174
+ function _isSettledPact(thenable) {
175
+ return thenable instanceof _Pact && thenable.s & 1;
176
+ }
177
+ function _for(test, update, body) {
178
+ var stage;
179
+ for (;;) {
180
+ var shouldContinue = test();
181
+ if (_isSettledPact(shouldContinue)) {
182
+ shouldContinue = shouldContinue.v;
183
+ }
184
+ if (!shouldContinue) {
185
+ return result;
186
+ }
187
+ if (shouldContinue.then) {
188
+ stage = 0;
189
+ break;
190
+ }
191
+ var result = body();
192
+ if (result && result.then) {
193
+ if (_isSettledPact(result)) {
194
+ result = result.s;
195
+ } else {
196
+ stage = 1;
197
+ break;
198
+ }
199
+ }
200
+ if (update) {
201
+ var updateValue = update();
202
+ if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
203
+ stage = 2;
204
+ break;
205
+ }
206
+ }
207
+ }
208
+ var pact = new _Pact();
209
+ var reject = _settle.bind(null, pact, 2);
210
+ (stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);
211
+ return pact;
212
+ function _resumeAfterBody(value) {
213
+ result = value;
214
+ do {
215
+ if (update) {
216
+ updateValue = update();
217
+ if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
218
+ updateValue.then(_resumeAfterUpdate).then(void 0, reject);
219
+ return;
220
+ }
221
+ }
222
+ shouldContinue = test();
223
+ if (!shouldContinue || _isSettledPact(shouldContinue) && !shouldContinue.v) {
224
+ _settle(pact, 1, result);
225
+ return;
226
+ }
227
+ if (shouldContinue.then) {
228
+ shouldContinue.then(_resumeAfterTest).then(void 0, reject);
229
+ return;
230
+ }
231
+ result = body();
232
+ if (_isSettledPact(result)) {
233
+ result = result.v;
234
+ }
235
+ } while (!result || !result.then);
236
+ result.then(_resumeAfterBody).then(void 0, reject);
237
+ }
238
+ function _resumeAfterTest(shouldContinue) {
239
+ if (shouldContinue) {
240
+ result = body();
241
+ if (result && result.then) {
242
+ result.then(_resumeAfterBody).then(void 0, reject);
243
+ } else {
244
+ _resumeAfterBody(result);
245
+ }
246
+ } else {
247
+ _settle(pact, 1, result);
248
+ }
249
+ }
250
+ function _resumeAfterUpdate() {
251
+ if (shouldContinue = test()) {
252
+ if (shouldContinue.then) {
253
+ shouldContinue.then(_resumeAfterTest).then(void 0, reject);
254
+ } else {
255
+ _resumeAfterTest(shouldContinue);
256
+ }
257
+ } else {
258
+ _settle(pact, 1, result);
259
+ }
260
+ }
261
+ }
262
+ function _continue(value, then) {
263
+ return value && value.then ? value.then(then) : then(value);
264
+ }
265
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
72
266
  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); } }
73
267
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
74
268
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
75
269
  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); }
76
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
77
- var AuthSessionState = /*#__PURE__*/_createClass(function AuthSessionState() {
78
- _classCallCheck(this, AuthSessionState);
79
- });
270
+ /**
271
+ * A lightweight mutex. (Other libraries contain too many features and we want to keep the size upload-js down).
272
+ *
273
+ * Characteristics:
274
+ * - Non-reentrant.
275
+ * - Unfair. (Multiple callers awaiting 'acquire' will be granted the mutex in no order.)
276
+ * - When calling `safe` consecutively with no 'awaits' in-between, the current context will synchronously acquire
277
+ * the mutex every time.
278
+ */
279
+ var Mutex = /*#__PURE__*/function () {
280
+ function Mutex() {
281
+ _classCallCheck(this, Mutex);
282
+ this.mutex = undefined;
283
+ this.resolver = undefined;
284
+ }
285
+ _createClass(Mutex, [{
286
+ key: "safe",
287
+ value: function safe(callback) {
288
+ try {
289
+ var _this2 = this;
290
+ return _await(_this2.acquire(), function () {
291
+ return _finallyRethrows(callback, function (_wasThrown, _result) {
292
+ _this2.release();
293
+ return _rethrow(_wasThrown, _result);
294
+ });
295
+ });
296
+ } catch (e) {
297
+ return Promise.reject(e);
298
+ }
299
+ }
300
+ }, {
301
+ key: "acquire",
302
+ value: function acquire() {
303
+ try {
304
+ var _this4 = this;
305
+ // Loop necessary for when multiple calls are made to 'acquire' before a 'release' is called, else the call to
306
+ // 'release' will resume every caller currently waiting on 'acquire'.
307
+ return _continue(_for(function () {
308
+ return _this4.mutex !== undefined;
309
+ }, void 0, function () {
310
+ return _awaitIgnored(_this4.mutex);
311
+ }), function () {
312
+ _this4.mutex = new Promise(function (resolve) {
313
+ _this4.resolver = resolve;
314
+ });
315
+ });
316
+ } catch (e) {
317
+ return Promise.reject(e);
318
+ }
319
+ }
320
+ }, {
321
+ key: "release",
322
+ value: function release() {
323
+ if (this.resolver === undefined) {
324
+ throw new Error("Unable to release mutex: already released.");
325
+ }
326
+ this.resolver();
327
+ this.resolver = undefined;
328
+ this.mutex = undefined;
329
+ }
330
+ }]);
331
+ return Mutex;
332
+ }();
333
+ ;// CONCATENATED MODULE: ./src/private/AuthSessionState.ts
334
+ 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); }
335
+ function AuthSessionState_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
336
+ function AuthSessionState_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, AuthSessionState_toPropertyKey(descriptor.key), descriptor); } }
337
+ function AuthSessionState_createClass(Constructor, protoProps, staticProps) { if (protoProps) AuthSessionState_defineProperties(Constructor.prototype, protoProps); if (staticProps) AuthSessionState_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
338
+ function AuthSessionState_toPropertyKey(arg) { var key = AuthSessionState_toPrimitive(arg, "string"); return AuthSessionState_typeof(key) === "symbol" ? key : String(key); }
339
+ function AuthSessionState_toPrimitive(input, hint) { if (AuthSessionState_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (AuthSessionState_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
340
+
341
+ /**
342
+ * Maintains a global session state, even across package versions.
343
+ *
344
+ * This is to allow users to start auth sessions via the Bytescale JavaScript SDK, where due to versioning or other
345
+ * bundling issues, the Bytescale Upload Widget has been bundled with a different Bytescale JavaScript SDK. In this
346
+ * scenario, the user wouldn't be able to start an auth session with the Bytescale Upload Widget. Therefore, we use
347
+ * global state (i.e. on the window) to ensure the session state can be shared between the user's instance of the
348
+ * Bytescale JavaScript SDK and the Upload Widget's version of the Bytescale JavaScript SDK.
349
+ *
350
+ * Users also frequently have problems caused by them not keeping track of *Api and *Manager instances correctly, so
351
+ * making this global prevents a lot of common mistakes.
352
+ */
353
+ var AuthSessionState = /*#__PURE__*/function () {
354
+ function AuthSessionState() {
355
+ AuthSessionState_classCallCheck(this, AuthSessionState);
356
+ }
357
+ AuthSessionState_createClass(AuthSessionState, null, [{
358
+ key: "getMutex",
359
+ value:
360
+ /**
361
+ * Called in the browser only.
362
+ */
363
+ function getMutex() {
364
+ var key = AuthSessionState.mutexKey;
365
+ var mutex = window[key];
366
+ if (mutex === undefined) {
367
+ mutex = new Mutex();
368
+ window[key] = mutex;
369
+ }
370
+ return mutex;
371
+ }
372
+ /**
373
+ * Called in the browser only.
374
+ */
375
+ }, {
376
+ key: "setSession",
377
+ value: function setSession(session) {
378
+ window[AuthSessionState.stateKey] = session;
379
+ }
380
+ /**
381
+ * Called in the browser and in Node.js (so we check the env before calling env-specific code).
382
+ */
383
+ }, {
384
+ key: "getSession",
385
+ value: function getSession() {
386
+ if (typeof window === "undefined") {
387
+ return undefined;
388
+ }
389
+ return window[AuthSessionState.stateKey];
390
+ }
391
+ }]);
392
+ return AuthSessionState;
393
+ }();
394
+ AuthSessionState.stateKey = "BytescaleSessionState";
395
+ AuthSessionState.mutexKey = "BytescaleSessionStateMutex";
80
396
  ;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
81
397
  function runtime_typeof(obj) { "@babel/helpers - typeof"; return runtime_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; }, runtime_typeof(obj); }
82
398
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
@@ -100,8 +416,8 @@ function _catch(body, recover) {
100
416
  }
101
417
  return result;
102
418
  }
103
- function _empty() {}
104
- function _continue(value, then) {
419
+ function runtime_empty() {}
420
+ function runtime_continue(value, then) {
105
421
  return value && value.then ? value.then(then) : then(value);
106
422
  }
107
423
  function _invoke(body, then) {
@@ -112,7 +428,7 @@ function _invoke(body, then) {
112
428
  return then(result);
113
429
  }
114
430
  function _defineProperty(obj, key, value) { key = runtime_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
115
- function _await(value, then, direct) {
431
+ function runtime_await(value, then, direct) {
116
432
  if (direct) {
117
433
  return then ? then(value) : value;
118
434
  }
@@ -127,21 +443,21 @@ function runtime_createClass(Constructor, protoProps, staticProps) { if (protoPr
127
443
  function runtime_toPropertyKey(arg) { var key = runtime_toPrimitive(arg, "string"); return runtime_typeof(key) === "symbol" ? key : String(key); }
128
444
  function runtime_toPrimitive(input, hint) { if (runtime_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (runtime_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
129
445
 
130
- var BytescaleApiClientConfigResolver = /*#__PURE__*/function () {
131
- function BytescaleApiClientConfigResolver() {
132
- runtime_classCallCheck(this, BytescaleApiClientConfigResolver);
446
+ var BytescaleApiClientConfigUtils = /*#__PURE__*/function () {
447
+ function BytescaleApiClientConfigUtils() {
448
+ runtime_classCallCheck(this, BytescaleApiClientConfigUtils);
133
449
  }
134
- runtime_createClass(BytescaleApiClientConfigResolver, null, [{
450
+ runtime_createClass(BytescaleApiClientConfigUtils, null, [{
135
451
  key: "getApiUrl",
136
452
  value: function getApiUrl(config) {
137
453
  var _a;
138
- return (_a = config.apiUrl) !== null && _a !== void 0 ? _a : BytescaleApiClientConfigResolver.defaultApiUrl;
454
+ return (_a = config.apiUrl) !== null && _a !== void 0 ? _a : BytescaleApiClientConfigUtils.defaultApiUrl;
139
455
  }
140
456
  }, {
141
457
  key: "getCdnUrl",
142
458
  value: function getCdnUrl(config) {
143
459
  var _a;
144
- return (_a = config.cdnUrl) !== null && _a !== void 0 ? _a : BytescaleApiClientConfigResolver.defaultCdnUrl;
460
+ return (_a = config.cdnUrl) !== null && _a !== void 0 ? _a : BytescaleApiClientConfigUtils.defaultCdnUrl;
145
461
  }
146
462
  }, {
147
463
  key: "getFetchApi",
@@ -149,11 +465,48 @@ var BytescaleApiClientConfigResolver = /*#__PURE__*/function () {
149
465
  var _a;
150
466
  return (_a = config.fetchApi) !== null && _a !== void 0 ? _a : fetch;
151
467
  }
468
+ }, {
469
+ key: "getAccountId",
470
+ value: function getAccountId(config) {
471
+ var _a, _b;
472
+ var accountId;
473
+ if (BytescaleApiClientConfigUtils.specialApiKeys.includes(config.apiKey)) {
474
+ accountId = BytescaleApiClientConfigUtils.specialApiKeyAccountId;
475
+ } else {
476
+ accountId = (_b = (_a = config.apiKey.split("_")[1]) === null || _a === void 0 ? void 0 : _a.substr(0, BytescaleApiClientConfigUtils.accountIdLength)) !== null && _b !== void 0 ? _b : "";
477
+ if (accountId.length !== BytescaleApiClientConfigUtils.accountIdLength) {
478
+ throw new Error("Invalid Bytescale API key.");
479
+ }
480
+ }
481
+ return accountId;
482
+ }
483
+ }, {
484
+ key: "validate",
485
+ value: function validate(config) {
486
+ var _a;
487
+ // Defensive programming, for users not using TypeScript. Mainly because this is used by UploadWidget users.
488
+ if ((config !== null && config !== void 0 ? config : undefined) === undefined) {
489
+ throw new Error("Config parameter required.");
490
+ }
491
+ if (((_a = config.apiKey) !== null && _a !== void 0 ? _a : undefined) === undefined) {
492
+ throw new Error("Please provide an API key via the 'apiKey' config parameter.");
493
+ }
494
+ if (config.apiKey.trim() !== config.apiKey) {
495
+ // We do not support API keys with whitespace (by trimming ourselves) because otherwise we'd need to support this
496
+ // everywhere in perpetuity (since removing the trimming would be a breaking change).
497
+ throw new Error("API key needs trimming (whitespace detected).");
498
+ }
499
+ // This performs futher validation on the API key...
500
+ BytescaleApiClientConfigUtils.getAccountId(config);
501
+ }
152
502
  }]);
153
- return BytescaleApiClientConfigResolver;
503
+ return BytescaleApiClientConfigUtils;
154
504
  }();
155
- BytescaleApiClientConfigResolver.defaultApiUrl = "https://api.bytescale.com";
156
- BytescaleApiClientConfigResolver.defaultCdnUrl = "https://upcdn.io";
505
+ BytescaleApiClientConfigUtils.defaultApiUrl = "https://api.bytescale.com";
506
+ BytescaleApiClientConfigUtils.defaultCdnUrl = "https://upcdn.io";
507
+ BytescaleApiClientConfigUtils.specialApiKeys = ["free", "demo"];
508
+ BytescaleApiClientConfigUtils.specialApiKeyAccountId = "W142hJk";
509
+ BytescaleApiClientConfigUtils.accountIdLength = 7; // Sync with: upload/shared/**/AccountIdUtils
157
510
  /**
158
511
  * This is the base class for all generated API classes.
159
512
  */
@@ -161,22 +514,24 @@ var BaseAPI = /*#__PURE__*/function () {
161
514
  function BaseAPI(config) {
162
515
  runtime_classCallCheck(this, BaseAPI);
163
516
  this.config = config;
517
+ BytescaleApiClientConfigUtils.validate(config);
164
518
  }
165
519
  runtime_createClass(BaseAPI, [{
166
520
  key: "request",
167
521
  value: function request(context, initOverrides, baseUrlOverride) {
168
522
  try {
169
523
  var _this2 = this;
170
- var _a, _b;
524
+ var _a;
171
525
  var apiKey = _this2.config.apiKey;
172
526
  context.headers["Authorization"] = "Bearer ".concat(apiKey); // authorization-header authentication
173
- if (((_a = AuthSessionState.session) === null || _a === void 0 ? void 0 : _a.accessToken) !== undefined) {
174
- context.headers["Authorization-Token"] = AuthSessionState.session.accessToken;
527
+ var session = AuthSessionState.getSession();
528
+ if ((session === null || session === void 0 ? void 0 : session.accessToken) !== undefined) {
529
+ context.headers["Authorization-Token"] = session.accessToken;
175
530
  }
176
531
  // Key: any possible value for 'baseUrlOverride'
177
532
  // Value: user-overridden value for that base URL from the config.
178
- var nonDefaultBasePaths = _defineProperty({}, BytescaleApiClientConfigResolver.defaultCdnUrl, BytescaleApiClientConfigResolver.getCdnUrl(_this2.config));
179
- return _await(_this2.createFetchParams(context, initOverrides, baseUrlOverride === undefined ? undefined : (_b = nonDefaultBasePaths[baseUrlOverride]) !== null && _b !== void 0 ? _b : baseUrlOverride), function (_ref) {
533
+ var nonDefaultBasePaths = _defineProperty({}, BytescaleApiClientConfigUtils.defaultCdnUrl, BytescaleApiClientConfigUtils.getCdnUrl(_this2.config));
534
+ return runtime_await(_this2.createFetchParams(context, initOverrides, baseUrlOverride === undefined ? undefined : (_a = nonDefaultBasePaths[baseUrlOverride]) !== null && _a !== void 0 ? _a : baseUrlOverride), function (_ref) {
180
535
  var url = _ref.url,
181
536
  init = _ref.init;
182
537
  return _this2.doFetch(url, init, true);
@@ -196,8 +551,8 @@ var BaseAPI = /*#__PURE__*/function () {
196
551
  var _this4 = this;
197
552
  var _a, _b;
198
553
  var response;
199
- return _continue(_catch(function () {
200
- return _await(BytescaleApiClientConfigResolver.getFetchApi(_this4.config)(url, init), function (_BytescaleApiClientCo) {
554
+ return runtime_continue(_catch(function () {
555
+ return runtime_await(BytescaleApiClientConfigUtils.getFetchApi(_this4.config)(url, init), function (_BytescaleApiClientCo) {
201
556
  response = _BytescaleApiClientCo;
202
557
  });
203
558
  }, function (e) {
@@ -210,11 +565,11 @@ var BaseAPI = /*#__PURE__*/function () {
210
565
  return response.status >= 200 && response.status < 300 ? response : _invoke(function () {
211
566
  if (isBytescaleApi) {
212
567
  var jsonError = undefined;
213
- return _continue(_catch(function () {
214
- return _await(response.json(), function (_response$json) {
568
+ return runtime_continue(_catch(function () {
569
+ return runtime_await(response.json(), function (_response$json) {
215
570
  jsonError = _response$json;
216
571
  });
217
- }, _empty), function () {
572
+ }, runtime_empty), function () {
218
573
  if (typeof ((_a = jsonError === null || jsonError === void 0 ? void 0 : jsonError.error) === null || _a === void 0 ? void 0 : _a.code) === "string") {
219
574
  throw new BytescaleApiError(jsonError);
220
575
  }
@@ -251,7 +606,7 @@ var BaseAPI = /*#__PURE__*/function () {
251
606
  value: function createFetchParams(context, initOverrides, baseUrlOverride) {
252
607
  try {
253
608
  var _this6 = this;
254
- var url = (baseUrlOverride !== null && baseUrlOverride !== void 0 ? baseUrlOverride : BytescaleApiClientConfigResolver.getApiUrl(_this6.config)) + context.path;
609
+ var url = (baseUrlOverride !== null && baseUrlOverride !== void 0 ? baseUrlOverride : BytescaleApiClientConfigUtils.getApiUrl(_this6.config)) + context.path;
255
610
  if (context.query !== undefined && Object.keys(context.query).length !== 0) {
256
611
  // only add the querystring to the URL if there are query parameters.
257
612
  // this is done to avoid urls ending with a "?" character which buggy webservers
@@ -260,13 +615,13 @@ var BaseAPI = /*#__PURE__*/function () {
260
615
  }
261
616
  var configHeaders = _this6.config.headers;
262
617
  var _Object$assign3 = Object.assign({}, context.headers);
263
- return _await(configHeaders === undefined ? {} : configHeaders(), function (_configHeaders) {
618
+ return runtime_await(configHeaders === undefined ? {} : configHeaders(), function (_configHeaders) {
264
619
  var headers = Object.assign(_Object$assign3, _configHeaders);
265
620
  Object.keys(headers).forEach(function (key) {
266
621
  return headers[key] === undefined ? delete headers[key] : {};
267
622
  });
268
623
  var initOverrideFn = typeof initOverrides === "function" ? initOverrides : function () {
269
- return _await(initOverrides);
624
+ return runtime_await(initOverrides);
270
625
  };
271
626
  var initParams = {
272
627
  method: context.method,
@@ -274,7 +629,7 @@ var BaseAPI = /*#__PURE__*/function () {
274
629
  body: context.body
275
630
  };
276
631
  var _Object$assign2 = Object.assign({}, initParams);
277
- return _await(initOverrideFn({
632
+ return runtime_await(initOverrideFn({
278
633
  init: initParams,
279
634
  context: context
280
635
  }), function (_initOverrideFn) {
@@ -295,9 +650,6 @@ var BaseAPI = /*#__PURE__*/function () {
295
650
  }]);
296
651
  return BaseAPI;
297
652
  }();
298
- BaseAPI.specialApiKeys = ["free", "demo"];
299
- BaseAPI.specialApiKeyAccountId = "W142hJk";
300
- BaseAPI.accountIdLength = 7; // Sync with: upload/shared/**/AccountIdUtils
301
653
  var CancelledError = /*#__PURE__*/function (_Error) {
302
654
  _inherits(CancelledError, _Error);
303
655
  var _super = _createSuper(CancelledError);
@@ -347,7 +699,7 @@ var JSONApiResponse = /*#__PURE__*/function () {
347
699
  value: function value() {
348
700
  try {
349
701
  var _this10 = this;
350
- return _await(_this10.raw.json());
702
+ return runtime_await(_this10.raw.json());
351
703
  } catch (e) {
352
704
  return Promise.reject(e);
353
705
  }
@@ -363,7 +715,7 @@ var VoidApiResponse = /*#__PURE__*/function () {
363
715
  runtime_createClass(VoidApiResponse, [{
364
716
  key: "value",
365
717
  value: function value() {
366
- return _await(undefined);
718
+ return runtime_await(undefined);
367
719
  }
368
720
  }]);
369
721
  return VoidApiResponse;
@@ -389,7 +741,7 @@ var BinaryResult = /*#__PURE__*/function () {
389
741
  value: function text() {
390
742
  try {
391
743
  var _this12 = this;
392
- return _await(_this12.raw.text());
744
+ return runtime_await(_this12.raw.text());
393
745
  } catch (e) {
394
746
  return Promise.reject(e);
395
747
  }
@@ -399,7 +751,7 @@ var BinaryResult = /*#__PURE__*/function () {
399
751
  value: function blob() {
400
752
  try {
401
753
  var _this14 = this;
402
- return _await(_this14.raw.blob());
754
+ return runtime_await(_this14.raw.blob());
403
755
  } catch (e) {
404
756
  return Promise.reject(e);
405
757
  }
@@ -409,7 +761,7 @@ var BinaryResult = /*#__PURE__*/function () {
409
761
  value: function json() {
410
762
  try {
411
763
  var _this16 = this;
412
- return _await(_this16.raw.json());
764
+ return runtime_await(_this16.raw.json());
413
765
  } catch (e) {
414
766
  return Promise.reject(e);
415
767
  }
@@ -455,9 +807,6 @@ function FileApi_getPrototypeOf(o) { FileApi_getPrototypeOf = Object.setPrototyp
455
807
  */
456
808
  // @ts-ignore
457
809
 
458
- /**
459
- *
460
- */
461
810
  var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
462
811
  FileApi_inherits(FileApi, _runtime$BaseAPI);
463
812
  var _super = FileApi_createSuper(FileApi);
@@ -756,9 +1105,6 @@ function FolderApi_getPrototypeOf(o) { FolderApi_getPrototypeOf = Object.setProt
756
1105
  */
757
1106
  // @ts-ignore
758
1107
 
759
- /**
760
- *
761
- */
762
1108
  var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
763
1109
  FolderApi_inherits(FolderApi, _runtime$BaseAPI);
764
1110
  var _super = FolderApi_createSuper(FolderApi);
@@ -1016,9 +1362,6 @@ function JobApi_getPrototypeOf(o) { JobApi_getPrototypeOf = Object.setPrototypeO
1016
1362
  */
1017
1363
  // @ts-ignore
1018
1364
 
1019
- /**
1020
- *
1021
- */
1022
1365
  var JobApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1023
1366
  JobApi_inherits(JobApi, _runtime$BaseAPI);
1024
1367
  var _super = JobApi_createSuper(JobApi);
@@ -1151,9 +1494,6 @@ function UploadApi_getPrototypeOf(o) { UploadApi_getPrototypeOf = Object.setProt
1151
1494
  */
1152
1495
  // @ts-ignore
1153
1496
 
1154
- /**
1155
- *
1156
- */
1157
1497
  var UploadApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1158
1498
  UploadApi_inherits(UploadApi, _runtime$BaseAPI);
1159
1499
  var _super = UploadApi_createSuper(UploadApi);
@@ -1349,7 +1689,7 @@ var UrlBuilder = /*#__PURE__*/function () {
1349
1689
  function UrlBuilder(config) {
1350
1690
  UrlBuilder_classCallCheck(this, UrlBuilder);
1351
1691
  var _a;
1352
- this.cdnUrl = (_a = config === null || config === void 0 ? void 0 : config.cdnUrl) !== null && _a !== void 0 ? _a : BytescaleApiClientConfigResolver.defaultCdnUrl;
1692
+ this.cdnUrl = (_a = config === null || config === void 0 ? void 0 : config.cdnUrl) !== null && _a !== void 0 ? _a : BytescaleApiClientConfigUtils.defaultCdnUrl;
1353
1693
  }
1354
1694
  /**
1355
1695
  * Builds a URL to either a raw file or a transformed file.
@@ -1374,7 +1714,7 @@ var UrlBuilder = /*#__PURE__*/function () {
1374
1714
  key: "url",
1375
1715
  value: function url(params) {
1376
1716
  var _a;
1377
- return ((_a = params.options) === null || _a === void 0 ? void 0 : _a.transformation) === undefined ? this.raw(params) : this.transformation(params, params.options.transformation);
1717
+ return ((_a = params.options) === null || _a === void 0 ? void 0 : _a.transformation) === undefined ? this.raw(params) : this.transformation(params, params.options);
1378
1718
  }
1379
1719
  }, {
1380
1720
  key: "raw",
@@ -1388,18 +1728,25 @@ var UrlBuilder = /*#__PURE__*/function () {
1388
1728
  key: "transformation",
1389
1729
  value: function transformation(params, trans) {
1390
1730
  var _a;
1391
- var baseUrl = this.getBaseUrl(params, trans.type === "preset" ? trans.preset : trans.type);
1392
- var transParams = this.getTransformationParams(trans, {
1393
- cachePermanently: "cache_perm"
1394
- });
1731
+ var baseUrl = this.getBaseUrl(params, trans.transformation === "preset" ? trans.transformationPreset : trans.transformation);
1732
+ var transParams = trans.transformation === "preset" ? [] : this.getTransformationParams(trans);
1395
1733
  var commonParams = this.getCommonQueryParams((_a = params.options) !== null && _a !== void 0 ? _a : {});
1396
- return this.addQueryParams(baseUrl, [].concat(_toConsumableArray(commonParams), _toConsumableArray(transParams)));
1734
+ var transCommonParams = this.getCommonTransformationQueryParams(trans);
1735
+ // This format puts "artifact" at the end, which isn't required, but is convention.
1736
+ return this.addQueryParams(baseUrl, [].concat(_toConsumableArray(transParams), _toConsumableArray(commonParams), _toConsumableArray(transCommonParams)));
1397
1737
  }
1398
1738
  }, {
1399
1739
  key: "getBaseUrl",
1400
1740
  value: function getBaseUrl(params, prefix) {
1401
1741
  return "".concat(this.cdnUrl, "/").concat(params.accountId, "/").concat(prefix).concat(params.filePath);
1402
1742
  }
1743
+ }, {
1744
+ key: "getCommonTransformationQueryParams",
1745
+ value: function getCommonTransformationQueryParams(trans) {
1746
+ return this.makeQueryParams(["cachePermanently", "large", "artifact"], {
1747
+ cachePermanently: "cache_perm"
1748
+ })(trans);
1749
+ }
1403
1750
  }, {
1404
1751
  key: "getCommonQueryParams",
1405
1752
  value: function getCommonQueryParams(params) {
@@ -1425,8 +1772,9 @@ var UrlBuilder = /*#__PURE__*/function () {
1425
1772
  }
1426
1773
  }, {
1427
1774
  key: "getTransformationParams",
1428
- value: function getTransformationParams(trans, keyRewrites) {
1429
- if (trans.params === undefined) {
1775
+ value: function getTransformationParams(trans) {
1776
+ var params = trans.transformationParams;
1777
+ if (params === undefined) {
1430
1778
  return [];
1431
1779
  }
1432
1780
  var serializeObj = function serializeObj(obj) {
@@ -1434,11 +1782,10 @@ var UrlBuilder = /*#__PURE__*/function () {
1434
1782
  var _ref2 = _slicedToArray(_ref, 2),
1435
1783
  key = _ref2[0],
1436
1784
  value = _ref2[1];
1437
- var _a;
1438
- return [(_a = keyRewrites[key]) !== null && _a !== void 0 ? _a : key, value.toString()];
1785
+ return [key, value.toString()];
1439
1786
  });
1440
1787
  };
1441
- return Array.isArray(trans.params) ? trans.params.flatMap(serializeObj) : serializeObj(trans.params);
1788
+ return Array.isArray(params) ? params.flatMap(serializeObj) : serializeObj(params);
1442
1789
  }
1443
1790
  }, {
1444
1791
  key: "addQueryParams",
@@ -1486,21 +1833,21 @@ function _invokeIgnored(body) {
1486
1833
  return result.then(UploadManagerBase_empty);
1487
1834
  }
1488
1835
  }
1489
- function _settle(pact, state, value) {
1836
+ function UploadManagerBase_settle(pact, state, value) {
1490
1837
  if (!pact.s) {
1491
- if (value instanceof _Pact) {
1838
+ if (value instanceof UploadManagerBase_Pact) {
1492
1839
  if (value.s) {
1493
1840
  if (state & 1) {
1494
1841
  state = value.s;
1495
1842
  }
1496
1843
  value = value.v;
1497
1844
  } else {
1498
- value.o = _settle.bind(null, pact, state);
1845
+ value.o = UploadManagerBase_settle.bind(null, pact, state);
1499
1846
  return;
1500
1847
  }
1501
1848
  }
1502
1849
  if (value && value.then) {
1503
- value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
1850
+ value.then(UploadManagerBase_settle.bind(null, pact, state), UploadManagerBase_settle.bind(null, pact, 2));
1504
1851
  return;
1505
1852
  }
1506
1853
  pact.s = state;
@@ -1511,7 +1858,7 @@ function _settle(pact, state, value) {
1511
1858
  }
1512
1859
  }
1513
1860
  }
1514
- var _Pact = /*#__PURE__*/function () {
1861
+ var UploadManagerBase_Pact = /*#__PURE__*/function () {
1515
1862
  function _Pact() {}
1516
1863
  _Pact.prototype.then = function (onFulfilled, onRejected) {
1517
1864
  var result = new _Pact();
@@ -1520,9 +1867,9 @@ var _Pact = /*#__PURE__*/function () {
1520
1867
  var callback = state & 1 ? onFulfilled : onRejected;
1521
1868
  if (callback) {
1522
1869
  try {
1523
- _settle(result, 1, callback(this.v));
1870
+ UploadManagerBase_settle(result, 1, callback(this.v));
1524
1871
  } catch (e) {
1525
- _settle(result, 2, e);
1872
+ UploadManagerBase_settle(result, 2, e);
1526
1873
  }
1527
1874
  return result;
1528
1875
  } else {
@@ -1533,28 +1880,28 @@ var _Pact = /*#__PURE__*/function () {
1533
1880
  try {
1534
1881
  var value = _this.v;
1535
1882
  if (_this.s & 1) {
1536
- _settle(result, 1, onFulfilled ? onFulfilled(value) : value);
1883
+ UploadManagerBase_settle(result, 1, onFulfilled ? onFulfilled(value) : value);
1537
1884
  } else if (onRejected) {
1538
- _settle(result, 1, onRejected(value));
1885
+ UploadManagerBase_settle(result, 1, onRejected(value));
1539
1886
  } else {
1540
- _settle(result, 2, value);
1887
+ UploadManagerBase_settle(result, 2, value);
1541
1888
  }
1542
1889
  } catch (e) {
1543
- _settle(result, 2, e);
1890
+ UploadManagerBase_settle(result, 2, e);
1544
1891
  }
1545
1892
  };
1546
1893
  return result;
1547
1894
  };
1548
1895
  return _Pact;
1549
1896
  }();
1550
- function _isSettledPact(thenable) {
1551
- return thenable instanceof _Pact && thenable.s & 1;
1897
+ function UploadManagerBase_isSettledPact(thenable) {
1898
+ return thenable instanceof UploadManagerBase_Pact && thenable.s & 1;
1552
1899
  }
1553
- function _for(test, update, body) {
1900
+ function UploadManagerBase_for(test, update, body) {
1554
1901
  var stage;
1555
1902
  for (;;) {
1556
1903
  var shouldContinue = test();
1557
- if (_isSettledPact(shouldContinue)) {
1904
+ if (UploadManagerBase_isSettledPact(shouldContinue)) {
1558
1905
  shouldContinue = shouldContinue.v;
1559
1906
  }
1560
1907
  if (!shouldContinue) {
@@ -1566,7 +1913,7 @@ function _for(test, update, body) {
1566
1913
  }
1567
1914
  var result = body();
1568
1915
  if (result && result.then) {
1569
- if (_isSettledPact(result)) {
1916
+ if (UploadManagerBase_isSettledPact(result)) {
1570
1917
  result = result.s;
1571
1918
  } else {
1572
1919
  stage = 1;
@@ -1575,14 +1922,14 @@ function _for(test, update, body) {
1575
1922
  }
1576
1923
  if (update) {
1577
1924
  var updateValue = update();
1578
- if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
1925
+ if (updateValue && updateValue.then && !UploadManagerBase_isSettledPact(updateValue)) {
1579
1926
  stage = 2;
1580
1927
  break;
1581
1928
  }
1582
1929
  }
1583
1930
  }
1584
- var pact = new _Pact();
1585
- var reject = _settle.bind(null, pact, 2);
1931
+ var pact = new UploadManagerBase_Pact();
1932
+ var reject = UploadManagerBase_settle.bind(null, pact, 2);
1586
1933
  (stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);
1587
1934
  return pact;
1588
1935
  function _resumeAfterBody(value) {
@@ -1590,14 +1937,14 @@ function _for(test, update, body) {
1590
1937
  do {
1591
1938
  if (update) {
1592
1939
  updateValue = update();
1593
- if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
1940
+ if (updateValue && updateValue.then && !UploadManagerBase_isSettledPact(updateValue)) {
1594
1941
  updateValue.then(_resumeAfterUpdate).then(void 0, reject);
1595
1942
  return;
1596
1943
  }
1597
1944
  }
1598
1945
  shouldContinue = test();
1599
- if (!shouldContinue || _isSettledPact(shouldContinue) && !shouldContinue.v) {
1600
- _settle(pact, 1, result);
1946
+ if (!shouldContinue || UploadManagerBase_isSettledPact(shouldContinue) && !shouldContinue.v) {
1947
+ UploadManagerBase_settle(pact, 1, result);
1601
1948
  return;
1602
1949
  }
1603
1950
  if (shouldContinue.then) {
@@ -1605,7 +1952,7 @@ function _for(test, update, body) {
1605
1952
  return;
1606
1953
  }
1607
1954
  result = body();
1608
- if (_isSettledPact(result)) {
1955
+ if (UploadManagerBase_isSettledPact(result)) {
1609
1956
  result = result.v;
1610
1957
  }
1611
1958
  } while (!result || !result.then);
@@ -1620,7 +1967,7 @@ function _for(test, update, body) {
1620
1967
  _resumeAfterBody(result);
1621
1968
  }
1622
1969
  } else {
1623
- _settle(pact, 1, result);
1970
+ UploadManagerBase_settle(pact, 1, result);
1624
1971
  }
1625
1972
  }
1626
1973
  function _resumeAfterUpdate() {
@@ -1631,7 +1978,7 @@ function _for(test, update, body) {
1631
1978
  _resumeAfterTest(shouldContinue);
1632
1979
  }
1633
1980
  } else {
1634
- _settle(pact, 1, result);
1981
+ UploadManagerBase_settle(pact, 1, result);
1635
1982
  }
1636
1983
  }
1637
1984
  }
@@ -1647,7 +1994,7 @@ function UploadManagerBase_iterableToArray(iter) { if (typeof Symbol !== "undefi
1647
1994
  function UploadManagerBase_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return UploadManagerBase_arrayLikeToArray(arr); }
1648
1995
  function UploadManagerBase_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1649
1996
  function UploadManagerBase_empty() {}
1650
- function _awaitIgnored(value, direct) {
1997
+ function UploadManagerBase_awaitIgnored(value, direct) {
1651
1998
  if (!direct) {
1652
1999
  return value && value.then ? value.then(UploadManagerBase_empty) : Promise.resolve();
1653
2000
  }
@@ -1661,11 +2008,11 @@ function UploadManagerBase_await(value, then, direct) {
1661
2008
  }
1662
2009
  return then ? value.then(then) : value;
1663
2010
  }
1664
- function _rethrow(thrown, value) {
2011
+ function UploadManagerBase_rethrow(thrown, value) {
1665
2012
  if (thrown) throw value;
1666
2013
  return value;
1667
2014
  }
1668
- function _finallyRethrows(body, finalizer) {
2015
+ function UploadManagerBase_finallyRethrows(body, finalizer) {
1669
2016
  try {
1670
2017
  var result = body();
1671
2018
  } catch (e) {
@@ -1716,15 +2063,15 @@ var UploadManagerBase = /*#__PURE__*/function () {
1716
2063
  cancel = _this2$makeCancellati.cancel,
1717
2064
  addCancellationHandler = _this2$makeCancellati.addCancellationHandler;
1718
2065
  var intervalHandle = setInterval(_this2.onIntervalTick(request, cancel), _this2.intervalMs);
1719
- return UploadManagerBase_continue(_finallyRethrows(function () {
2066
+ return UploadManagerBase_continue(UploadManagerBase_finallyRethrows(function () {
1720
2067
  return UploadManagerBase_await(_this2.mapAsync(parts, preUploadInfo.maxConcurrentUploadParts, _async(function (part) {
1721
2068
  return _this2.uploadPart(request, source, part, uploadInfo, onProgress, addCancellationHandler);
1722
2069
  })), function () {
1723
- return _awaitIgnored(_this2.postUpload(init));
2070
+ return UploadManagerBase_awaitIgnored(_this2.postUpload(init));
1724
2071
  });
1725
2072
  }, function (_wasThrown, _result) {
1726
2073
  clearInterval(intervalHandle);
1727
- return _rethrow(_wasThrown, _result);
2074
+ return UploadManagerBase_rethrow(_wasThrown, _result);
1728
2075
  }), function () {
1729
2076
  return uploadInfo.file;
1730
2077
  });
@@ -1838,7 +2185,7 @@ var UploadManagerBase = /*#__PURE__*/function () {
1838
2185
  _this7.assertNotCancelled(request);
1839
2186
  return UploadManagerBase_await(_this7.putUploadPart(part, source, onProgress, addCancellationHandler), function (etag) {
1840
2187
  _this7.assertNotCancelled(request);
1841
- return _awaitIgnored(_this7.uploadApi.completeUploadPart({
2188
+ return UploadManagerBase_awaitIgnored(_this7.uploadApi.completeUploadPart({
1842
2189
  accountId: request.accountId,
1843
2190
  uploadId: uploadInfo.uploadId,
1844
2191
  uploadPartIndex: partIndex,
@@ -1910,14 +2257,14 @@ var UploadManagerBase = /*#__PURE__*/function () {
1910
2257
  value: function mapAsync(items, concurrency, callback) {
1911
2258
  try {
1912
2259
  var workQueue = UploadManagerBase_toConsumableArray(items);
1913
- return _awaitIgnored(Promise.all(UploadManagerBase_toConsumableArray(Array(concurrency).keys()).map(_async(function () {
1914
- return _continueIgnored(_for(function () {
2260
+ return UploadManagerBase_awaitIgnored(Promise.all(UploadManagerBase_toConsumableArray(Array(concurrency).keys()).map(_async(function () {
2261
+ return _continueIgnored(UploadManagerBase_for(function () {
1915
2262
  return workQueue.length > 0;
1916
2263
  }, void 0, function () {
1917
2264
  var work = workQueue.shift(); // IMPORTANT: use 'shift' instead of 'pop' to ensure 'items' are processed in order when 'concurrency = 1'.
1918
2265
  return _invokeIgnored(function () {
1919
2266
  if (work !== undefined) {
1920
- return _awaitIgnored(callback(work));
2267
+ return UploadManagerBase_awaitIgnored(callback(work));
1921
2268
  }
1922
2269
  });
1923
2270
  }));
@@ -2624,7 +2971,7 @@ var AuthManager = /*#__PURE__*/function () {
2624
2971
  var __lib_exports__AuthManager = __lib_exports__.AuthManager;
2625
2972
  var __lib_exports__BaseAPI = __lib_exports__.BaseAPI;
2626
2973
  var __lib_exports__BinaryResult = __lib_exports__.BinaryResult;
2627
- var __lib_exports__BytescaleApiClientConfigResolver = __lib_exports__.BytescaleApiClientConfigResolver;
2974
+ var __lib_exports__BytescaleApiClientConfigUtils = __lib_exports__.BytescaleApiClientConfigUtils;
2628
2975
  var __lib_exports__BytescaleApiError = __lib_exports__.BytescaleApiError;
2629
2976
  var __lib_exports__CancelledError = __lib_exports__.CancelledError;
2630
2977
  var __lib_exports__CommonTypesNoOp = __lib_exports__.CommonTypesNoOp;
@@ -2638,4 +2985,4 @@ var __lib_exports__UrlBuilder = __lib_exports__.UrlBuilder;
2638
2985
  var __lib_exports__UrlBuilderTypesNoOp = __lib_exports__.UrlBuilderTypesNoOp;
2639
2986
  var __lib_exports__VoidApiResponse = __lib_exports__.VoidApiResponse;
2640
2987
  var __lib_exports__querystring = __lib_exports__.querystring;
2641
- export { __lib_exports__AuthManager as AuthManager, __lib_exports__BaseAPI as BaseAPI, __lib_exports__BinaryResult as BinaryResult, __lib_exports__BytescaleApiClientConfigResolver as BytescaleApiClientConfigResolver, __lib_exports__BytescaleApiError as BytescaleApiError, __lib_exports__CancelledError as CancelledError, __lib_exports__CommonTypesNoOp as CommonTypesNoOp, __lib_exports__FileApi as FileApi, __lib_exports__FolderApi as FolderApi, __lib_exports__JSONApiResponse as JSONApiResponse, __lib_exports__JobApi as JobApi, __lib_exports__UploadApi as UploadApi, __lib_exports__UploadManager as UploadManager, __lib_exports__UrlBuilder as UrlBuilder, __lib_exports__UrlBuilderTypesNoOp as UrlBuilderTypesNoOp, __lib_exports__VoidApiResponse as VoidApiResponse, __lib_exports__querystring as querystring };
2988
+ export { __lib_exports__AuthManager as AuthManager, __lib_exports__BaseAPI as BaseAPI, __lib_exports__BinaryResult as BinaryResult, __lib_exports__BytescaleApiClientConfigUtils as BytescaleApiClientConfigUtils, __lib_exports__BytescaleApiError as BytescaleApiError, __lib_exports__CancelledError as CancelledError, __lib_exports__CommonTypesNoOp as CommonTypesNoOp, __lib_exports__FileApi as FileApi, __lib_exports__FolderApi as FolderApi, __lib_exports__JSONApiResponse as JSONApiResponse, __lib_exports__JobApi as JobApi, __lib_exports__UploadApi as UploadApi, __lib_exports__UploadManager as UploadManager, __lib_exports__UrlBuilder as UrlBuilder, __lib_exports__UrlBuilderTypesNoOp as UrlBuilderTypesNoOp, __lib_exports__VoidApiResponse as VoidApiResponse, __lib_exports__querystring as querystring };