@bytescale/sdk 1.2.0 → 1.4.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.
Files changed (48) hide show
  1. package/dist/browser/cjs/main.js +904 -198
  2. package/dist/node/cjs/main.js +418 -205
  3. package/dist/node/esm/main.mjs +424 -207
  4. package/dist/types/index.d.ts +2 -0
  5. package/dist/types/private/AuthSessionState.d.ts +13 -0
  6. package/dist/types/private/ConsoleUtils.d.ts +5 -0
  7. package/dist/types/private/EnvChecker.d.ts +4 -0
  8. package/dist/types/private/Mutex.d.ts +16 -0
  9. package/dist/types/private/TypeUtils.d.ts +2 -0
  10. package/dist/types/{uploads/private → private}/UploadManagerBase.d.ts +2 -2
  11. package/dist/types/private/dtos/SetAccessTokenRequestDto.d.ts +6 -0
  12. package/dist/types/private/dtos/SetAccessTokenResponseDto.d.ts +7 -0
  13. package/dist/types/private/model/AuthManagerInterface.d.ts +44 -0
  14. package/dist/types/private/model/AuthSession.d.ts +7 -0
  15. package/dist/types/private/model/UploadManagerInterface.d.ts +5 -0
  16. package/dist/types/{uploads/private → private}/model/UploadSourceProcessed.d.ts +1 -1
  17. package/dist/types/public/browser/AuthManagerBrowser.d.ts +20 -0
  18. package/dist/types/{uploads/public → public}/browser/UploadManagerBrowser.d.ts +2 -2
  19. package/dist/types/{uploads/public → public}/browser/index.d.ts +1 -0
  20. package/dist/types/public/node/AuthManagerNode.d.ts +6 -0
  21. package/dist/types/{uploads/public → public}/node/UploadManagerNode.d.ts +2 -2
  22. package/dist/types/{uploads/public → public}/node/index.d.ts +1 -0
  23. package/dist/types/{uploads/public/shared/Model.d.ts → public/shared/CommonTypes.d.ts} +3 -9
  24. package/dist/types/public/shared/UrlBuilder.d.ts +32 -0
  25. package/dist/types/public/shared/UrlBuilderTypes.d.ts +173 -0
  26. package/dist/types/{generated → public/shared/generated}/apis/FileApi.d.ts +7 -1
  27. package/dist/types/{generated → public/shared/generated}/models/index.d.ts +6 -10
  28. package/dist/types/{generated → public/shared/generated}/runtime.d.ts +46 -16
  29. package/dist/types/public/shared/index.d.ts +4 -0
  30. package/package.json +2 -2
  31. package/tests/ChunkedStream.test.ts +1 -1
  32. package/tests/UrlBuilder.test.ts +168 -0
  33. package/dist/types/index.browser.d.ts +0 -3
  34. package/dist/types/index.node.d.ts +0 -3
  35. package/dist/types/uploads/private/TypeUtils.d.ts +0 -1
  36. package/dist/types/uploads/private/model/UploadManagerInterface.d.ts +0 -5
  37. package/dist/types/uploads/public/shared/index.d.ts +0 -1
  38. /package/dist/types/{uploads/private → private}/NodeChunkedStream.d.ts +0 -0
  39. /package/dist/types/{uploads/private → private}/StreamUtils.d.ts +0 -0
  40. /package/dist/types/{uploads/private → private}/model/AddCancellationHandler.d.ts +0 -0
  41. /package/dist/types/{uploads/private → private}/model/OnPartProgress.d.ts +0 -0
  42. /package/dist/types/{uploads/private → private}/model/PreUploadInfo.d.ts +0 -0
  43. /package/dist/types/{uploads/private → private}/model/PutUploadPartResult.d.ts +0 -0
  44. /package/dist/types/{generated → public/shared/generated}/apis/FolderApi.d.ts +0 -0
  45. /package/dist/types/{generated → public/shared/generated}/apis/JobApi.d.ts +0 -0
  46. /package/dist/types/{generated → public/shared/generated}/apis/UploadApi.d.ts +0 -0
  47. /package/dist/types/{generated → public/shared/generated}/apis/index.d.ts +0 -0
  48. /package/dist/types/{generated → public/shared/generated}/index.d.ts +0 -0
@@ -61,26 +61,40 @@ __lib_require__.r(__lib_exports__);
61
61
 
62
62
  // EXPORTS
63
63
  __lib_require__.d(__lib_exports__, {
64
- "BASE_PATH": function() { return /* reexport */ BASE_PATH; },
64
+ "AuthManager": function() { return /* reexport */ AuthManager; },
65
65
  "BaseAPI": function() { return /* reexport */ BaseAPI; },
66
66
  "BinaryResult": function() { return /* reexport */ BinaryResult; },
67
+ "BytescaleApiClientConfigResolver": function() { return /* reexport */ BytescaleApiClientConfigResolver; },
67
68
  "BytescaleApiError": function() { return /* reexport */ BytescaleApiError; },
68
69
  "CancelledError": function() { return /* reexport */ CancelledError; },
70
+ "CommonTypesNoOp": function() { return /* reexport */ CommonTypesNoOp; },
69
71
  "FileApi": function() { return /* reexport */ FileApi; },
70
72
  "FolderApi": function() { return /* reexport */ FolderApi; },
71
73
  "JSONApiResponse": function() { return /* reexport */ JSONApiResponse; },
72
74
  "JobApi": function() { return /* reexport */ JobApi; },
73
75
  "UploadApi": function() { return /* reexport */ UploadApi; },
74
76
  "UploadManager": function() { return /* reexport */ UploadManager; },
77
+ "UrlBuilder": function() { return /* reexport */ UrlBuilder; },
78
+ "UrlBuilderTypesNoOp": function() { return /* reexport */ UrlBuilderTypesNoOp; },
75
79
  "VoidApiResponse": function() { return /* reexport */ VoidApiResponse; },
76
80
  "querystring": function() { return /* reexport */ querystring; }
77
81
  });
78
82
 
79
- ;// CONCATENATED MODULE: ./src/generated/runtime.ts
83
+ ;// CONCATENATED MODULE: ./src/private/AuthSessionState.ts
80
84
  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); }
85
+ 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); } }
86
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
87
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
88
+ 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); }
89
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
90
+ var AuthSessionState = /*#__PURE__*/_createClass(function AuthSessionState() {
91
+ _classCallCheck(this, AuthSessionState);
92
+ });
93
+ ;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
94
+ 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); }
81
95
  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); }
82
96
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
83
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
97
+ function _possibleConstructorReturn(self, call) { if (call && (runtime_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
84
98
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
85
99
  function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
86
100
  function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
@@ -88,15 +102,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
88
102
  function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
89
103
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
90
104
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
91
- function _await(value, then, direct) {
92
- if (direct) {
93
- return then ? then(value) : value;
94
- }
95
- if (!value || !value.then) {
96
- value = Promise.resolve(value);
97
- }
98
- return then ? value.then(then) : value;
99
- }
100
105
  function _catch(body, recover) {
101
106
  try {
102
107
  var result = body();
@@ -108,22 +113,10 @@ function _catch(body, recover) {
108
113
  }
109
114
  return result;
110
115
  }
116
+ function _empty() {}
111
117
  function _continue(value, then) {
112
118
  return value && value.then ? value.then(then) : then(value);
113
119
  }
114
- function _async(f) {
115
- return function () {
116
- for (var args = [], i = 0; i < arguments.length; i++) {
117
- args[i] = arguments[i];
118
- }
119
- try {
120
- return Promise.resolve(f.apply(this, args));
121
- } catch (e) {
122
- return Promise.reject(e);
123
- }
124
- };
125
- }
126
- function _empty() {}
127
120
  function _invoke(body, then) {
128
121
  var result = body();
129
122
  if (result && result.then) {
@@ -131,81 +124,122 @@ function _invoke(body, then) {
131
124
  }
132
125
  return then(result);
133
126
  }
134
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
135
- 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); } }
136
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
137
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
138
- 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); }
139
- /**
140
- * @bytescale/api
141
- * Bytescale API
142
- *
143
- * The version of the OpenAPI document: 2.0.0
144
- * Contact: hello@bytescale.com
145
- *
146
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
147
- * https://openapi-generator.tech
148
- * Do not edit the class manually.
149
- */
150
- var BASE_PATH = "https://api.bytescale.com".replace(/\/+$/, "");
127
+ 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; }
128
+ function _await(value, then, direct) {
129
+ if (direct) {
130
+ return then ? then(value) : value;
131
+ }
132
+ if (!value || !value.then) {
133
+ value = Promise.resolve(value);
134
+ }
135
+ return then ? value.then(then) : value;
136
+ }
137
+ function runtime_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
138
+ function runtime_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, runtime_toPropertyKey(descriptor.key), descriptor); } }
139
+ function runtime_createClass(Constructor, protoProps, staticProps) { if (protoProps) runtime_defineProperties(Constructor.prototype, protoProps); if (staticProps) runtime_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
140
+ function runtime_toPropertyKey(arg) { var key = runtime_toPrimitive(arg, "string"); return runtime_typeof(key) === "symbol" ? key : String(key); }
141
+ 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); }
142
+
143
+ var BytescaleApiClientConfigResolver = /*#__PURE__*/function () {
144
+ function BytescaleApiClientConfigResolver() {
145
+ runtime_classCallCheck(this, BytescaleApiClientConfigResolver);
146
+ }
147
+ runtime_createClass(BytescaleApiClientConfigResolver, null, [{
148
+ key: "getApiUrl",
149
+ value: function getApiUrl(config) {
150
+ var _a;
151
+ return (_a = config.apiUrl) !== null && _a !== void 0 ? _a : BytescaleApiClientConfigResolver.defaultApiUrl;
152
+ }
153
+ }, {
154
+ key: "getCdnUrl",
155
+ value: function getCdnUrl(config) {
156
+ var _a;
157
+ return (_a = config.cdnUrl) !== null && _a !== void 0 ? _a : BytescaleApiClientConfigResolver.defaultCdnUrl;
158
+ }
159
+ }, {
160
+ key: "getFetchApi",
161
+ value: function getFetchApi(config) {
162
+ var _a;
163
+ return (_a = config.fetchApi) !== null && _a !== void 0 ? _a : fetch;
164
+ }
165
+ }]);
166
+ return BytescaleApiClientConfigResolver;
167
+ }();
168
+ BytescaleApiClientConfigResolver.defaultApiUrl = "https://api.bytescale.com";
169
+ BytescaleApiClientConfigResolver.defaultCdnUrl = "https://upcdn.io";
151
170
  /**
152
171
  * This is the base class for all generated API classes.
153
172
  */
154
173
  var BaseAPI = /*#__PURE__*/function () {
155
174
  function BaseAPI(config) {
156
- var _this = this;
157
- _classCallCheck(this, BaseAPI);
175
+ runtime_classCallCheck(this, BaseAPI);
158
176
  this.config = config;
159
- this.fetchApi = _async(function (url, init) {
160
- var _exit = false;
161
- var fetchParams = {
162
- url: url,
163
- init: init
164
- };
165
- var response = undefined;
166
- return _continue(_catch(function () {
167
- return _await((_this.config.fetchApi || fetch)(fetchParams.url, fetchParams.init), function (_temp) {
168
- response = _temp;
169
- });
170
- }, function (e) {
171
- if (response === undefined) {
172
- throw e;
173
- }
174
- }), function (_result) {
175
- return _exit ? _result : response;
176
- });
177
- });
178
177
  }
179
- _createClass(BaseAPI, [{
178
+ runtime_createClass(BaseAPI, [{
180
179
  key: "request",
181
- value: function request(context, initOverrides, operationBasePathOverride) {
180
+ value: function request(context, initOverrides, baseUrlOverride) {
182
181
  try {
183
- var _this3 = this;
184
- var _a;
185
- var apiKey = _this3.config.apiKey;
182
+ var _this2 = this;
183
+ var _a, _b;
184
+ var apiKey = _this2.config.apiKey;
186
185
  context.headers["Authorization"] = "Bearer ".concat(apiKey); // authorization-header authentication
187
- return _await(_this3.createFetchParams(context, initOverrides, operationBasePathOverride), function (_ref) {
186
+ if (((_a = AuthSessionState.session) === null || _a === void 0 ? void 0 : _a.accessToken) !== undefined) {
187
+ context.headers["Authorization-Token"] = AuthSessionState.session.accessToken;
188
+ }
189
+ // Key: any possible value for 'baseUrlOverride'
190
+ // Value: user-overridden value for that base URL from the config.
191
+ var nonDefaultBasePaths = _defineProperty({}, BytescaleApiClientConfigResolver.defaultCdnUrl, BytescaleApiClientConfigResolver.getCdnUrl(_this2.config));
192
+ return _await(_this2.createFetchParams(context, initOverrides, baseUrlOverride === undefined ? undefined : (_b = nonDefaultBasePaths[baseUrlOverride]) !== null && _b !== void 0 ? _b : baseUrlOverride), function (_ref) {
188
193
  var url = _ref.url,
189
194
  init = _ref.init;
190
- return _await(_this3.fetchApi(url, init), function (response) {
191
- var _exit2 = false;
192
- return response && response.status >= 200 && response.status < 300 ? response : _invoke(function () {
193
- if (response !== undefined) {
194
- var jsonError = undefined;
195
- return _continue(_catch(function () {
196
- return _await(response.json(), function (_response$json) {
197
- jsonError = _response$json;
198
- });
199
- }, _empty), function () {
200
- if (typeof ((_a = jsonError === null || jsonError === void 0 ? void 0 : jsonError.error) === null || _a === void 0 ? void 0 : _a.code) === "string") {
201
- throw new BytescaleApiError(jsonError);
202
- }
195
+ return _this2.doFetch(url, init, true);
196
+ });
197
+ } catch (e) {
198
+ return Promise.reject(e);
199
+ }
200
+ }
201
+ /**
202
+ * Returns a successful response (2**) else throws an error.
203
+ */
204
+ }, {
205
+ key: "doFetch",
206
+ value: function doFetch(url, init, isBytescaleApi) {
207
+ try {
208
+ var _exit3 = false;
209
+ var _this4 = this;
210
+ var _a, _b;
211
+ var response;
212
+ return _continue(_catch(function () {
213
+ return _await(BytescaleApiClientConfigResolver.getFetchApi(_this4.config)(url, init), function (_BytescaleApiClientCo) {
214
+ response = _BytescaleApiClientCo;
215
+ });
216
+ }, function (e) {
217
+ // Network-level errors, CORS errors, or HTTP-level errors from intermediary services (e.g. AWS or the user's own infrastructure/proxies).
218
+ // HTTP-level errors from external services (e.g. AWS or the user's own proxy) will appear as CORS errors as their response headers won't include the appropriate CORS values.
219
+ throw new Error(isBytescaleApi ? "Unable to resolve the Bytescale API: ".concat(e.message, " If the problem persists, and your network connection is OK, then please contact support@bytescale.com and provide: (a) time of failed request in UTC (b) screenshot of failed network response header + body (c) screenshot of failed network request header + body (d) browser and OS version.") : "Unable to resolve URL (".concat(url, "): ").concat(e.message));
220
+ }), function (_result) {
221
+ var _exit2 = false;
222
+ if (_exit3) return _result;
223
+ return response.status >= 200 && response.status < 300 ? response : _invoke(function () {
224
+ if (isBytescaleApi) {
225
+ var jsonError = undefined;
226
+ return _continue(_catch(function () {
227
+ return _await(response.json(), function (_response$json) {
228
+ jsonError = _response$json;
203
229
  });
204
- }
205
- }, function (_result2) {
206
- if (_exit2) return _result2;
207
- throw new Error("Unable to connect to the Bytescale API: please try again.");
208
- });
230
+ }, _empty), function () {
231
+ if (typeof ((_a = jsonError === null || jsonError === void 0 ? void 0 : jsonError.error) === null || _a === void 0 ? void 0 : _a.code) === "string") {
232
+ throw new BytescaleApiError(jsonError);
233
+ }
234
+ // HTTP-level errors from intermediary services (e.g. AWS or the user's own infrastructure/proxies). On the browser,
235
+ // this error is unlikely to be triggered since these errors will masqurade as CORS errors (see above) but in Node.js
236
+ // this error will appear from any intermediary service failure.
237
+ throw new Error("Unable to connect to the Bytescale API (".concat(response.status, "): please try again."));
238
+ });
239
+ }
240
+ }, function (_result2) {
241
+ if (_exit2) return _result2;
242
+ throw new Error("Failure status code (".concat(response.status, ") received for request: ").concat((_b = init.method) !== null && _b !== void 0 ? _b : "GET", " ").concat(url));
209
243
  });
210
244
  });
211
245
  } catch (e) {
@@ -227,17 +261,17 @@ var BaseAPI = /*#__PURE__*/function () {
227
261
  }
228
262
  }, {
229
263
  key: "createFetchParams",
230
- value: function createFetchParams(context, initOverrides, operationBasePathOverride) {
264
+ value: function createFetchParams(context, initOverrides, baseUrlOverride) {
231
265
  try {
232
- var _this5 = this;
233
- var url = (operationBasePathOverride !== null && operationBasePathOverride !== void 0 ? operationBasePathOverride : BASE_PATH) + context.path;
266
+ var _this6 = this;
267
+ var url = (baseUrlOverride !== null && baseUrlOverride !== void 0 ? baseUrlOverride : BytescaleApiClientConfigResolver.getApiUrl(_this6.config)) + context.path;
234
268
  if (context.query !== undefined && Object.keys(context.query).length !== 0) {
235
269
  // only add the querystring to the URL if there are query parameters.
236
270
  // this is done to avoid urls ending with a "?" character which buggy webservers
237
271
  // do not handle correctly sometimes.
238
272
  url += "?" + querystring(context.query);
239
273
  }
240
- var configHeaders = _this5.config.headers;
274
+ var configHeaders = _this6.config.headers;
241
275
  var _Object$assign3 = Object.assign({}, context.headers);
242
276
  return _await(configHeaders === undefined ? {} : configHeaders(), function (_configHeaders) {
243
277
  var headers = Object.assign(_Object$assign3, _configHeaders);
@@ -274,67 +308,59 @@ var BaseAPI = /*#__PURE__*/function () {
274
308
  }]);
275
309
  return BaseAPI;
276
310
  }();
277
- var BytescaleApiError = /*#__PURE__*/function (_Error) {
278
- _inherits(BytescaleApiError, _Error);
279
- var _super = _createSuper(BytescaleApiError);
311
+ BaseAPI.specialApiKeys = ["free", "demo"];
312
+ BaseAPI.specialApiKeyAccountId = "W142hJk";
313
+ BaseAPI.accountIdLength = 7; // Sync with: upload/shared/**/AccountIdUtils
314
+ var CancelledError = /*#__PURE__*/function (_Error) {
315
+ _inherits(CancelledError, _Error);
316
+ var _super = _createSuper(CancelledError);
317
+ function CancelledError() {
318
+ var _this7;
319
+ runtime_classCallCheck(this, CancelledError);
320
+ _this7 = _super.call(this, "Operation cancelled by caller.");
321
+ _this7.name = "CancelledError";
322
+ return _this7;
323
+ }
324
+ return runtime_createClass(CancelledError);
325
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
326
+ var BytescaleApiError = /*#__PURE__*/function (_Error2) {
327
+ _inherits(BytescaleApiError, _Error2);
328
+ var _super2 = _createSuper(BytescaleApiError);
280
329
  function BytescaleApiError(response) {
281
- var _this6;
282
- _classCallCheck(this, BytescaleApiError);
283
- _this6 = _super.call(this, response.error.message);
284
- _this6.name = "BytescaleApiError";
285
- _this6.errorCode = response.error.code;
286
- _this6.details = response.error.details;
287
- return _this6;
330
+ var _this8;
331
+ runtime_classCallCheck(this, BytescaleApiError);
332
+ _this8 = _super2.call(this, response.error.message);
333
+ _this8.name = "BytescaleApiError";
334
+ _this8.errorCode = response.error.code;
335
+ _this8.details = response.error.details;
336
+ return _this8;
288
337
  }
289
- return _createClass(BytescaleApiError);
338
+ return runtime_createClass(BytescaleApiError);
290
339
  }( /*#__PURE__*/_wrapNativeSuper(Error));
291
340
  function querystring(params) {
292
- var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
293
341
  return Object.keys(params).map(function (key) {
294
- return querystringSingleKey(key, params[key], prefix);
342
+ return querystringSingleKey(key, params[key]);
295
343
  }).filter(function (part) {
296
344
  return part.length > 0;
297
345
  }).join("&");
298
346
  }
299
347
  function querystringSingleKey(key, value) {
300
- var keyPrefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
301
- var fullKey = keyPrefix + (keyPrefix.length ? "[".concat(key, "]") : key);
302
- if (value instanceof Array) {
303
- var multiValue = value.map(function (singleValue) {
304
- return encodeURIComponent(String(singleValue));
305
- }).join("&".concat(encodeURIComponent(fullKey), "="));
306
- return "".concat(encodeURIComponent(fullKey), "=").concat(multiValue);
307
- }
308
- if (value instanceof Set) {
309
- var valueAsArray = Array.from(value);
310
- return querystringSingleKey(key, valueAsArray, keyPrefix);
311
- }
312
- if (value instanceof Date) {
313
- return "".concat(encodeURIComponent(fullKey), "=").concat(encodeURIComponent(value.toISOString()));
314
- }
315
348
  if (value instanceof Object) {
316
- return querystring(value, fullKey);
349
+ return querystring(value);
317
350
  }
318
- return "".concat(encodeURIComponent(fullKey), "=").concat(encodeURIComponent(String(value)));
351
+ return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(String(value)));
319
352
  }
320
353
  var JSONApiResponse = /*#__PURE__*/function () {
321
354
  function JSONApiResponse(raw) {
322
- var transformer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (jsonValue) {
323
- return jsonValue;
324
- };
325
- _classCallCheck(this, JSONApiResponse);
355
+ runtime_classCallCheck(this, JSONApiResponse);
326
356
  this.raw = raw;
327
- this.transformer = transformer;
328
357
  }
329
- _createClass(JSONApiResponse, [{
358
+ runtime_createClass(JSONApiResponse, [{
330
359
  key: "value",
331
360
  value: function value() {
332
361
  try {
333
- var _this8 = this;
334
- var _transformer2 = _this8.transformer;
335
- return _await(_this8.raw.json(), function (_this7$raw$json) {
336
- return _transformer2.call(_this8, _this7$raw$json);
337
- });
362
+ var _this10 = this;
363
+ return _await(_this10.raw.json());
338
364
  } catch (e) {
339
365
  return Promise.reject(e);
340
366
  }
@@ -344,10 +370,10 @@ var JSONApiResponse = /*#__PURE__*/function () {
344
370
  }();
345
371
  var VoidApiResponse = /*#__PURE__*/function () {
346
372
  function VoidApiResponse(raw) {
347
- _classCallCheck(this, VoidApiResponse);
373
+ runtime_classCallCheck(this, VoidApiResponse);
348
374
  this.raw = raw;
349
375
  }
350
- _createClass(VoidApiResponse, [{
376
+ runtime_createClass(VoidApiResponse, [{
351
377
  key: "value",
352
378
  value: function value() {
353
379
  return _await(undefined);
@@ -357,10 +383,10 @@ var VoidApiResponse = /*#__PURE__*/function () {
357
383
  }();
358
384
  var BinaryResult = /*#__PURE__*/function () {
359
385
  function BinaryResult(raw) {
360
- _classCallCheck(this, BinaryResult);
386
+ runtime_classCallCheck(this, BinaryResult);
361
387
  this.raw = raw;
362
388
  }
363
- _createClass(BinaryResult, [{
389
+ runtime_createClass(BinaryResult, [{
364
390
  key: "stream",
365
391
  value: function stream() {
366
392
  if (this.raw.bodyUsed) {
@@ -375,8 +401,8 @@ var BinaryResult = /*#__PURE__*/function () {
375
401
  key: "text",
376
402
  value: function text() {
377
403
  try {
378
- var _this10 = this;
379
- return _await(_this10.raw.text());
404
+ var _this12 = this;
405
+ return _await(_this12.raw.text());
380
406
  } catch (e) {
381
407
  return Promise.reject(e);
382
408
  }
@@ -385,8 +411,8 @@ var BinaryResult = /*#__PURE__*/function () {
385
411
  key: "blob",
386
412
  value: function blob() {
387
413
  try {
388
- var _this12 = this;
389
- return _await(_this12.raw.blob());
414
+ var _this14 = this;
415
+ return _await(_this14.raw.blob());
390
416
  } catch (e) {
391
417
  return Promise.reject(e);
392
418
  }
@@ -395,8 +421,8 @@ var BinaryResult = /*#__PURE__*/function () {
395
421
  key: "json",
396
422
  value: function json() {
397
423
  try {
398
- var _this14 = this;
399
- return _await(_this14.raw.json());
424
+ var _this16 = this;
425
+ return _await(_this16.raw.json());
400
426
  } catch (e) {
401
427
  return Promise.reject(e);
402
428
  }
@@ -404,7 +430,7 @@ var BinaryResult = /*#__PURE__*/function () {
404
430
  }]);
405
431
  return BinaryResult;
406
432
  }();
407
- ;// CONCATENATED MODULE: ./src/generated/apis/FileApi.ts
433
+ ;// CONCATENATED MODULE: ./src/public/shared/generated/apis/FileApi.ts
408
434
  function FileApi_typeof(obj) { "@babel/helpers - typeof"; return FileApi_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; }, FileApi_typeof(obj); }
409
435
  function FileApi_await(value, then, direct) {
410
436
  if (direct) {
@@ -644,6 +670,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
644
670
  if (params.large !== undefined) {
645
671
  query["large"] = params.large;
646
672
  }
673
+ if (params.transformationParams !== undefined) {
674
+ query["transformationParams"] = params.transformationParams;
675
+ }
647
676
  if (params.version !== undefined) {
648
677
  query["version"] = params.version;
649
678
  }
@@ -675,6 +704,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
675
704
  try {
676
705
  var _this16 = this;
677
706
  var query = {};
707
+ if (params.transformationParams !== undefined) {
708
+ query["transformationParams"] = params.transformationParams;
709
+ }
678
710
  var headers = {};
679
711
  headers["Content-Type"] = "application/json";
680
712
  return FileApi_await(_this16.request({
@@ -699,7 +731,7 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
699
731
  }]);
700
732
  return FileApi;
701
733
  }(BaseAPI);
702
- ;// CONCATENATED MODULE: ./src/generated/apis/FolderApi.ts
734
+ ;// CONCATENATED MODULE: ./src/public/shared/generated/apis/FolderApi.ts
703
735
  function FolderApi_typeof(obj) { "@babel/helpers - typeof"; return FolderApi_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; }, FolderApi_typeof(obj); }
704
736
  function FolderApi_await(value, then, direct) {
705
737
  if (direct) {
@@ -959,7 +991,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
959
991
  }]);
960
992
  return FolderApi;
961
993
  }(BaseAPI);
962
- ;// CONCATENATED MODULE: ./src/generated/apis/JobApi.ts
994
+ ;// CONCATENATED MODULE: ./src/public/shared/generated/apis/JobApi.ts
963
995
  function JobApi_typeof(obj) { "@babel/helpers - typeof"; return JobApi_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; }, JobApi_typeof(obj); }
964
996
  function JobApi_await(value, then, direct) {
965
997
  if (direct) {
@@ -1094,7 +1126,7 @@ var JobApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1094
1126
  }]);
1095
1127
  return JobApi;
1096
1128
  }(BaseAPI);
1097
- ;// CONCATENATED MODULE: ./src/generated/apis/UploadApi.ts
1129
+ ;// CONCATENATED MODULE: ./src/public/shared/generated/apis/UploadApi.ts
1098
1130
  function UploadApi_typeof(obj) { "@babel/helpers - typeof"; return UploadApi_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; }, UploadApi_typeof(obj); }
1099
1131
  function UploadApi_await(value, then, direct) {
1100
1132
  if (direct) {
@@ -1282,53 +1314,174 @@ var UploadApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1282
1314
  }]);
1283
1315
  return UploadApi;
1284
1316
  }(BaseAPI);
1285
- ;// CONCATENATED MODULE: ./src/generated/apis/index.ts
1317
+ ;// CONCATENATED MODULE: ./src/public/shared/generated/apis/index.ts
1286
1318
  /* tslint:disable */
1287
1319
  /* eslint-disable */
1288
1320
 
1289
1321
 
1290
1322
 
1291
1323
 
1292
- ;// CONCATENATED MODULE: ./src/generated/index.ts
1324
+ ;// CONCATENATED MODULE: ./src/public/shared/generated/index.ts
1293
1325
  /* tslint:disable */
1294
1326
  /* eslint-disable */
1295
1327
 
1296
1328
 
1297
1329
 
1298
- ;// CONCATENATED MODULE: ./src/uploads/public/shared/Model.ts
1299
- function Model_typeof(obj) { "@babel/helpers - typeof"; return Model_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; }, Model_typeof(obj); }
1300
- function Model_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, Model_toPropertyKey(descriptor.key), descriptor); } }
1301
- function Model_createClass(Constructor, protoProps, staticProps) { if (protoProps) Model_defineProperties(Constructor.prototype, protoProps); if (staticProps) Model_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
1302
- function Model_toPropertyKey(arg) { var key = Model_toPrimitive(arg, "string"); return Model_typeof(key) === "symbol" ? key : String(key); }
1303
- function Model_toPrimitive(input, hint) { if (Model_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (Model_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1304
- function Model_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1305
- function Model_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) Model_setPrototypeOf(subClass, superClass); }
1306
- function Model_createSuper(Derived) { var hasNativeReflectConstruct = Model_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Model_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Model_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Model_possibleConstructorReturn(this, result); }; }
1307
- function Model_possibleConstructorReturn(self, call) { if (call && (Model_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Model_assertThisInitialized(self); }
1308
- function Model_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1309
- function Model_wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; Model_wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !Model_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return Model_construct(Class, arguments, Model_getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return Model_setPrototypeOf(Wrapper, Class); }; return Model_wrapNativeSuper(Class); }
1310
- function Model_construct(Parent, args, Class) { if (Model_isNativeReflectConstruct()) { Model_construct = Reflect.construct.bind(); } else { Model_construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) Model_setPrototypeOf(instance, Class.prototype); return instance; }; } return Model_construct.apply(null, arguments); }
1311
- function Model_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1312
- function Model_isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
1313
- function Model_setPrototypeOf(o, p) { Model_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Model_setPrototypeOf(o, p); }
1314
- function Model_getPrototypeOf(o) { Model_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Model_getPrototypeOf(o); }
1315
- var CancelledError = /*#__PURE__*/function (_Error) {
1316
- Model_inherits(CancelledError, _Error);
1317
- var _super = Model_createSuper(CancelledError);
1318
- function CancelledError() {
1319
- var _this;
1320
- Model_classCallCheck(this, CancelledError);
1321
- _this = _super.call(this, "Upload cancelled by user.");
1322
- _this.name = "CancelledError";
1323
- return _this;
1330
+ ;// CONCATENATED MODULE: ./src/public/shared/CommonTypes.ts
1331
+ /**
1332
+ * Workaround for tsc aliases, where we cannot export implementation-less modules in our dists.
1333
+ */
1334
+ var CommonTypesNoOp = false;
1335
+ ;// CONCATENATED MODULE: ./src/private/TypeUtils.ts
1336
+ function assertUnreachable(x) {
1337
+ throw new Error("Didn't expect to get here: ".concat(JSON.stringify(x)));
1338
+ }
1339
+ function isDefinedEntry(object) {
1340
+ return object[1] !== undefined && object[1] !== null;
1341
+ }
1342
+ ;// CONCATENATED MODULE: ./src/public/shared/UrlBuilder.ts
1343
+ function UrlBuilder_typeof(obj) { "@babel/helpers - typeof"; return UrlBuilder_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; }, UrlBuilder_typeof(obj); }
1344
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1345
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1346
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
1347
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1348
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1349
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1350
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
1351
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1352
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1353
+ function _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; }
1354
+ function UrlBuilder_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1355
+ function UrlBuilder_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, UrlBuilder_toPropertyKey(descriptor.key), descriptor); } }
1356
+ function UrlBuilder_createClass(Constructor, protoProps, staticProps) { if (protoProps) UrlBuilder_defineProperties(Constructor.prototype, protoProps); if (staticProps) UrlBuilder_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
1357
+ function UrlBuilder_toPropertyKey(arg) { var key = UrlBuilder_toPrimitive(arg, "string"); return UrlBuilder_typeof(key) === "symbol" ? key : String(key); }
1358
+ function UrlBuilder_toPrimitive(input, hint) { if (UrlBuilder_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (UrlBuilder_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1359
+
1360
+
1361
+ var UrlBuilder = /*#__PURE__*/function () {
1362
+ function UrlBuilder(config) {
1363
+ UrlBuilder_classCallCheck(this, UrlBuilder);
1364
+ var _a;
1365
+ this.cdnUrl = (_a = config === null || config === void 0 ? void 0 : config.cdnUrl) !== null && _a !== void 0 ? _a : BytescaleApiClientConfigResolver.defaultCdnUrl;
1324
1366
  }
1325
- return Model_createClass(CancelledError);
1326
- }( /*#__PURE__*/Model_wrapNativeSuper(Error));
1327
- ;// CONCATENATED MODULE: ./src/uploads/public/shared/index.ts
1367
+ /**
1368
+ * Builds a URL to either a raw file or a transformed file.
1369
+ *
1370
+ * Example 1) Getting a publicly-accessible raw file URL:
1371
+ *
1372
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg" })
1373
+ *
1374
+ * Example 2) Getting a publicly-accessible image URL, resized to 500x500:
1375
+ *
1376
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", options: { transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } } } })
1377
+ *
1378
+ * Example 3) Getting a privately-accessible image URL, resized to 500x500 (requires 'AuthManager.beginAuthSession' to be called before accessing the URL):
1379
+ *
1380
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", options: { transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } }, auth: true } })
1381
+ *
1382
+ * Example 4) Getting a publicly-accessible image URL, resized using a transformation preset called "thumbnail" that was created manually in the Bytescale Dashboard:
1383
+ *
1384
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", options: { transformation: { type: "preset", preset: "thumbnail" } } })
1385
+ */
1386
+ UrlBuilder_createClass(UrlBuilder, [{
1387
+ key: "url",
1388
+ value: function url(params) {
1389
+ var _a;
1390
+ return ((_a = params.options) === null || _a === void 0 ? void 0 : _a.transformation) === undefined ? this.raw(params) : this.transformation(params, params.options.transformation);
1391
+ }
1392
+ }, {
1393
+ key: "raw",
1394
+ value: function raw(params) {
1395
+ var _a;
1396
+ var baseUrl = this.getBaseUrl(params, "raw");
1397
+ var commonParams = this.getCommonQueryParams((_a = params.options) !== null && _a !== void 0 ? _a : {});
1398
+ return this.addQueryParams(baseUrl, commonParams);
1399
+ }
1400
+ }, {
1401
+ key: "transformation",
1402
+ value: function transformation(params, trans) {
1403
+ var _a;
1404
+ var baseUrl = this.getBaseUrl(params, trans.type === "preset" ? trans.preset : trans.type);
1405
+ var transParams = this.getTransformationParams(trans, {
1406
+ cachePermanently: "cache_perm"
1407
+ });
1408
+ var commonParams = this.getCommonQueryParams((_a = params.options) !== null && _a !== void 0 ? _a : {});
1409
+ return this.addQueryParams(baseUrl, [].concat(_toConsumableArray(commonParams), _toConsumableArray(transParams)));
1410
+ }
1411
+ }, {
1412
+ key: "getBaseUrl",
1413
+ value: function getBaseUrl(params, prefix) {
1414
+ return "".concat(this.cdnUrl, "/").concat(params.accountId, "/").concat(prefix).concat(params.filePath);
1415
+ }
1416
+ }, {
1417
+ key: "getCommonQueryParams",
1418
+ value: function getCommonQueryParams(params) {
1419
+ return this.makeQueryParams(["auth", "cache", "cacheTtl", "version", "forceDownloadPrompt"], {
1420
+ cacheTtl: "cache_ttl",
1421
+ forceDownloadPrompt: "download"
1422
+ })(params);
1423
+ }
1424
+ }, {
1425
+ key: "makeQueryParams",
1426
+ value: function makeQueryParams(keys, keyOverrides) {
1427
+ return function (data) {
1428
+ var result = [];
1429
+ keys.forEach(function (key) {
1430
+ var _a;
1431
+ var value = data[key];
1432
+ if (value !== undefined) {
1433
+ result.push([(_a = keyOverrides[key]) !== null && _a !== void 0 ? _a : key, value.toString()]);
1434
+ }
1435
+ });
1436
+ return result;
1437
+ };
1438
+ }
1439
+ }, {
1440
+ key: "getTransformationParams",
1441
+ value: function getTransformationParams(trans, keyRewrites) {
1442
+ if (trans.params === undefined) {
1443
+ return [];
1444
+ }
1445
+ var serializeObj = function serializeObj(obj) {
1446
+ return Object.entries(obj).filter(isDefinedEntry).map(function (_ref) {
1447
+ var _ref2 = _slicedToArray(_ref, 2),
1448
+ key = _ref2[0],
1449
+ value = _ref2[1];
1450
+ var _a;
1451
+ return [(_a = keyRewrites[key]) !== null && _a !== void 0 ? _a : key, value.toString()];
1452
+ });
1453
+ };
1454
+ return Array.isArray(trans.params) ? trans.params.flatMap(serializeObj) : serializeObj(trans.params);
1455
+ }
1456
+ }, {
1457
+ key: "addQueryParams",
1458
+ value: function addQueryParams(baseUrl, params) {
1459
+ if (params.length === 0) {
1460
+ return baseUrl;
1461
+ }
1462
+ return "".concat(baseUrl, "?").concat(params.map(function (_ref3) {
1463
+ var _ref4 = _slicedToArray(_ref3, 2),
1464
+ key = _ref4[0],
1465
+ value = _ref4[1];
1466
+ return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value));
1467
+ }).join("&"));
1468
+ }
1469
+ }]);
1470
+ return UrlBuilder;
1471
+ }();
1472
+ ;// CONCATENATED MODULE: ./src/public/shared/UrlBuilderTypes.ts
1473
+ /**
1474
+ * Workaround for tsc aliases, where we cannot export implementation-less modules in our dists.
1475
+ */
1476
+ var UrlBuilderTypesNoOp = false;
1477
+ ;// CONCATENATED MODULE: ./src/public/shared/index.ts
1328
1478
 
1329
- ;// CONCATENATED MODULE: ./src/uploads/private/UploadManagerBase.ts
1479
+
1480
+
1481
+
1482
+ ;// CONCATENATED MODULE: ./src/private/UploadManagerBase.ts
1330
1483
  function UploadManagerBase_typeof(obj) { "@babel/helpers - typeof"; return UploadManagerBase_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; }, UploadManagerBase_typeof(obj); }
1331
- function UploadManagerBase_async(f) {
1484
+ function _async(f) {
1332
1485
  return function () {
1333
1486
  for (var args = [], i = 0; i < arguments.length; i++) {
1334
1487
  args[i] = arguments[i];
@@ -1500,12 +1653,12 @@ function _continueIgnored(value) {
1500
1653
  return value.then(UploadManagerBase_empty);
1501
1654
  }
1502
1655
  }
1503
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1504
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1505
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
1506
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1507
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1508
- function _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; }
1656
+ function UploadManagerBase_toConsumableArray(arr) { return UploadManagerBase_arrayWithoutHoles(arr) || UploadManagerBase_iterableToArray(arr) || UploadManagerBase_unsupportedIterableToArray(arr) || UploadManagerBase_nonIterableSpread(); }
1657
+ function UploadManagerBase_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1658
+ function UploadManagerBase_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return UploadManagerBase_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return UploadManagerBase_arrayLikeToArray(o, minLen); }
1659
+ function UploadManagerBase_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1660
+ function UploadManagerBase_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return UploadManagerBase_arrayLikeToArray(arr); }
1661
+ 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; }
1509
1662
  function UploadManagerBase_empty() {}
1510
1663
  function _awaitIgnored(value, direct) {
1511
1664
  if (!direct) {
@@ -1545,7 +1698,6 @@ function UploadManagerBase_createClass(Constructor, protoProps, staticProps) { i
1545
1698
  function UploadManagerBase_toPropertyKey(arg) { var key = UploadManagerBase_toPrimitive(arg, "string"); return UploadManagerBase_typeof(key) === "symbol" ? key : String(key); }
1546
1699
  function UploadManagerBase_toPrimitive(input, hint) { if (UploadManagerBase_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (UploadManagerBase_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1547
1700
 
1548
-
1549
1701
  /**
1550
1702
  * Methods common to UploadManagerNode and UploadManagerBrowser.
1551
1703
  */
@@ -1572,13 +1724,13 @@ var UploadManagerBase = /*#__PURE__*/function () {
1572
1724
  onProgress(0);
1573
1725
  return UploadManagerBase_await(_this2.beginUpload(request, preUploadInfo), function (uploadInfo) {
1574
1726
  var partCount = uploadInfo.uploadParts.count;
1575
- var parts = _toConsumableArray(Array(partCount).keys());
1727
+ var parts = UploadManagerBase_toConsumableArray(Array(partCount).keys());
1576
1728
  var _this2$makeCancellati = _this2.makeCancellationMethods(),
1577
1729
  cancel = _this2$makeCancellati.cancel,
1578
1730
  addCancellationHandler = _this2$makeCancellati.addCancellationHandler;
1579
1731
  var intervalHandle = setInterval(_this2.onIntervalTick(request, cancel), _this2.intervalMs);
1580
1732
  return UploadManagerBase_continue(_finallyRethrows(function () {
1581
- return UploadManagerBase_await(_this2.mapAsync(parts, preUploadInfo.maxConcurrentUploadParts, UploadManagerBase_async(function (part) {
1733
+ return UploadManagerBase_await(_this2.mapAsync(parts, preUploadInfo.maxConcurrentUploadParts, _async(function (part) {
1582
1734
  return _this2.uploadPart(request, source, part, uploadInfo, onProgress, addCancellationHandler);
1583
1735
  })), function () {
1584
1736
  return _awaitIgnored(_this2.postUpload(init));
@@ -1770,8 +1922,8 @@ var UploadManagerBase = /*#__PURE__*/function () {
1770
1922
  key: "mapAsync",
1771
1923
  value: function mapAsync(items, concurrency, callback) {
1772
1924
  try {
1773
- var workQueue = _toConsumableArray(items);
1774
- return _awaitIgnored(Promise.all(_toConsumableArray(Array(concurrency).keys()).map(UploadManagerBase_async(function () {
1925
+ var workQueue = UploadManagerBase_toConsumableArray(items);
1926
+ return _awaitIgnored(Promise.all(UploadManagerBase_toConsumableArray(Array(concurrency).keys()).map(_async(function () {
1775
1927
  return _continueIgnored(_for(function () {
1776
1928
  return workQueue.length > 0;
1777
1929
  }, void 0, function () {
@@ -1792,7 +1944,7 @@ var UploadManagerBase = /*#__PURE__*/function () {
1792
1944
  }();
1793
1945
  ;// CONCATENATED MODULE: external "stream"
1794
1946
  var external_stream_namespaceObject = require("stream");
1795
- ;// CONCATENATED MODULE: ./src/uploads/private/StreamUtils.ts
1947
+ ;// CONCATENATED MODULE: ./src/private/StreamUtils.ts
1796
1948
  function StreamUtils_typeof(obj) { "@babel/helpers - typeof"; return StreamUtils_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; }, StreamUtils_typeof(obj); }
1797
1949
  function StreamUtils_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1798
1950
  function StreamUtils_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, StreamUtils_toPropertyKey(descriptor.key), descriptor); } }
@@ -1834,14 +1986,14 @@ var StreamUtils = /*#__PURE__*/function () {
1834
1986
  }]);
1835
1987
  return StreamUtils;
1836
1988
  }();
1837
- ;// CONCATENATED MODULE: ./src/uploads/private/NodeChunkedStream.ts
1989
+ ;// CONCATENATED MODULE: ./src/private/NodeChunkedStream.ts
1838
1990
  function NodeChunkedStream_typeof(obj) { "@babel/helpers - typeof"; return NodeChunkedStream_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; }, NodeChunkedStream_typeof(obj); }
1839
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || NodeChunkedStream_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1840
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1991
+ function NodeChunkedStream_slicedToArray(arr, i) { return NodeChunkedStream_arrayWithHoles(arr) || NodeChunkedStream_iterableToArrayLimit(arr, i) || NodeChunkedStream_unsupportedIterableToArray(arr, i) || NodeChunkedStream_nonIterableRest(); }
1992
+ function NodeChunkedStream_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1841
1993
  function NodeChunkedStream_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return NodeChunkedStream_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return NodeChunkedStream_arrayLikeToArray(o, minLen); }
1842
1994
  function NodeChunkedStream_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; }
1843
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
1844
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1995
+ function NodeChunkedStream_iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
1996
+ function NodeChunkedStream_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1845
1997
  function NodeChunkedStream_await(value, then, direct) {
1846
1998
  if (direct) {
1847
1999
  return then ? then(value) : value;
@@ -1929,7 +2081,7 @@ var NodeChunkedStream = /*#__PURE__*/function () {
1929
2081
  return; // Received empty data.
1930
2082
  }
1931
2083
 
1932
- var _splitResult = _slicedToArray(splitResult, 2),
2084
+ var _splitResult = NodeChunkedStream_slicedToArray(splitResult, 2),
1933
2085
  consumed = _splitResult[0],
1934
2086
  remaining = _splitResult[1];
1935
2087
  _this2.buffer = remaining;
@@ -2000,7 +2152,7 @@ var NodeChunkedStream = /*#__PURE__*/function () {
2000
2152
  if (splitResult === undefined) {
2001
2153
  return undefined;
2002
2154
  }
2003
- var _splitResult2 = _slicedToArray(splitResult, 2),
2155
+ var _splitResult2 = NodeChunkedStream_slicedToArray(splitResult, 2),
2004
2156
  consumed = _splitResult2[0],
2005
2157
  remaining = _splitResult2[1];
2006
2158
  this.buffer = remaining;
@@ -2024,13 +2176,9 @@ var NodeChunkedStream = /*#__PURE__*/function () {
2024
2176
  }]);
2025
2177
  return NodeChunkedStream;
2026
2178
  }();
2027
- ;// CONCATENATED MODULE: ./src/uploads/private/TypeUtils.ts
2028
- function assertUnreachable(x) {
2029
- throw new Error("Didn't expect to get here: ".concat(JSON.stringify(x)));
2030
- }
2031
2179
  ;// CONCATENATED MODULE: external "buffer"
2032
2180
  var external_buffer_namespaceObject = require("buffer");
2033
- ;// CONCATENATED MODULE: ./src/uploads/public/node/UploadManagerNode.ts
2181
+ ;// CONCATENATED MODULE: ./src/public/node/UploadManagerNode.ts
2034
2182
  function UploadManagerNode_typeof(obj) { "@babel/helpers - typeof"; return UploadManagerNode_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; }, UploadManagerNode_typeof(obj); }
2035
2183
  function UploadManagerNode_empty() {}
2036
2184
  function UploadManagerNode_awaitIgnored(value, direct) {
@@ -2409,14 +2557,79 @@ var UploadManager = /*#__PURE__*/function (_UploadManagerBase) {
2409
2557
  }]);
2410
2558
  return UploadManager;
2411
2559
  }(UploadManagerBase);
2412
- ;// CONCATENATED MODULE: ./src/uploads/public/node/index.ts
2560
+ ;// CONCATENATED MODULE: ./src/private/EnvChecker.ts
2561
+ function EnvChecker_typeof(obj) { "@babel/helpers - typeof"; return EnvChecker_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; }, EnvChecker_typeof(obj); }
2562
+ function EnvChecker_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2563
+ function EnvChecker_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, EnvChecker_toPropertyKey(descriptor.key), descriptor); } }
2564
+ function EnvChecker_createClass(Constructor, protoProps, staticProps) { if (protoProps) EnvChecker_defineProperties(Constructor.prototype, protoProps); if (staticProps) EnvChecker_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
2565
+ function EnvChecker_toPropertyKey(arg) { var key = EnvChecker_toPrimitive(arg, "string"); return EnvChecker_typeof(key) === "symbol" ? key : String(key); }
2566
+ function EnvChecker_toPrimitive(input, hint) { if (EnvChecker_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (EnvChecker_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
2567
+ var EnvChecker = /*#__PURE__*/function () {
2568
+ function EnvChecker() {
2569
+ EnvChecker_classCallCheck(this, EnvChecker);
2570
+ }
2571
+ EnvChecker_createClass(EnvChecker, null, [{
2572
+ key: "isNodeJs",
2573
+ value: function isNodeJs() {
2574
+ return typeof process !== "undefined" && process.versions !== undefined && process.versions.node !== undefined;
2575
+ }
2576
+ }, {
2577
+ key: "methodRequiresBrowser",
2578
+ value: function methodRequiresBrowser(methodName) {
2579
+ if (EnvChecker.isNodeJs()) {
2580
+ return new Error("You must call '".concat(methodName, "' in the browser. (You are currently in Node.js.)"));
2581
+ }
2582
+ return new Error("The '".concat(methodName, "' method cannot be called because you have bundled the Node.js implementation of the Bytescale JavaScript SDK into your client-side code. Please ensure your bundling tool (Webpack, Rollup, etc.) is honouring the \"browser\" field of the \"package.json\" file for this package, as this will allow the browser implementation of the Bytescale JavaScript SDK to be included in your client-side code."));
2583
+ }
2584
+ }]);
2585
+ return EnvChecker;
2586
+ }();
2587
+ ;// CONCATENATED MODULE: ./src/public/node/AuthManagerNode.ts
2588
+ function AuthManagerNode_typeof(obj) { "@babel/helpers - typeof"; return AuthManagerNode_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; }, AuthManagerNode_typeof(obj); }
2589
+ function AuthManagerNode_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2590
+ function AuthManagerNode_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, AuthManagerNode_toPropertyKey(descriptor.key), descriptor); } }
2591
+ function AuthManagerNode_createClass(Constructor, protoProps, staticProps) { if (protoProps) AuthManagerNode_defineProperties(Constructor.prototype, protoProps); if (staticProps) AuthManagerNode_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
2592
+ function AuthManagerNode_toPropertyKey(arg) { var key = AuthManagerNode_toPrimitive(arg, "string"); return AuthManagerNode_typeof(key) === "symbol" ? key : String(key); }
2593
+ function AuthManagerNode_toPrimitive(input, hint) { if (AuthManagerNode_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (AuthManagerNode_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
2594
+
2595
+ var AuthManager = /*#__PURE__*/function () {
2596
+ function AuthManager() {
2597
+ AuthManagerNode_classCallCheck(this, AuthManager);
2598
+ }
2599
+ AuthManagerNode_createClass(AuthManager, [{
2600
+ key: "beginAuthSession",
2601
+ value: function beginAuthSession(_authUrl, _authHeaders) {
2602
+ try {
2603
+ throw EnvChecker.methodRequiresBrowser("beginAuthSession");
2604
+ } catch (e) {
2605
+ return Promise.reject(e);
2606
+ }
2607
+ }
2608
+ }, {
2609
+ key: "endAuthSession",
2610
+ value: function endAuthSession() {
2611
+ try {
2612
+ throw EnvChecker.methodRequiresBrowser("endAuthSession");
2613
+ } catch (e) {
2614
+ return Promise.reject(e);
2615
+ }
2616
+ }
2617
+ }, {
2618
+ key: "isAuthSessionActive",
2619
+ value: function isAuthSessionActive() {
2620
+ return false;
2621
+ }
2622
+ }]);
2623
+ return AuthManager;
2624
+ }();
2625
+ ;// CONCATENATED MODULE: ./src/public/node/index.ts
2626
+
2413
2627
 
2414
2628
  ;// CONCATENATED MODULE: ./src/index.node.ts
2415
2629
  /* tslint:disable */
2416
2630
  /* eslint-disable */
2417
2631
 
2418
2632
 
2419
-
2420
2633
  module.exports = __lib_exports__;
2421
2634
  /******/ })()
2422
2635
  ;