@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
@@ -48,26 +48,40 @@ var __lib_exports__ = {};
48
48
 
49
49
  // EXPORTS
50
50
  __lib_require__.d(__lib_exports__, {
51
- "BASE_PATH": function() { return /* reexport */ BASE_PATH; },
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
55
  "BytescaleApiError": function() { return /* reexport */ BytescaleApiError; },
55
56
  "CancelledError": function() { return /* reexport */ CancelledError; },
57
+ "CommonTypesNoOp": function() { return /* reexport */ CommonTypesNoOp; },
56
58
  "FileApi": function() { return /* reexport */ FileApi; },
57
59
  "FolderApi": function() { return /* reexport */ FolderApi; },
58
60
  "JSONApiResponse": function() { return /* reexport */ JSONApiResponse; },
59
61
  "JobApi": function() { return /* reexport */ JobApi; },
60
62
  "UploadApi": function() { return /* reexport */ UploadApi; },
61
63
  "UploadManager": function() { return /* reexport */ UploadManager; },
64
+ "UrlBuilder": function() { return /* reexport */ UrlBuilder; },
65
+ "UrlBuilderTypesNoOp": function() { return /* reexport */ UrlBuilderTypesNoOp; },
62
66
  "VoidApiResponse": function() { return /* reexport */ VoidApiResponse; },
63
67
  "querystring": function() { return /* reexport */ querystring; }
64
68
  });
65
69
 
66
- ;// CONCATENATED MODULE: ./src/generated/runtime.ts
70
+ ;// CONCATENATED MODULE: ./src/private/AuthSessionState.ts
67
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 _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
+ 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
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
75
+ 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
+ });
80
+ ;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
81
+ 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); }
68
82
  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); }
69
83
  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); }; }
70
- 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); }
84
+ 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); }
71
85
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
72
86
  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); }
73
87
  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); }
@@ -75,15 +89,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
75
89
  function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
76
90
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
77
91
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
78
- function _await(value, then, direct) {
79
- if (direct) {
80
- return then ? then(value) : value;
81
- }
82
- if (!value || !value.then) {
83
- value = Promise.resolve(value);
84
- }
85
- return then ? value.then(then) : value;
86
- }
87
92
  function _catch(body, recover) {
88
93
  try {
89
94
  var result = body();
@@ -95,22 +100,10 @@ function _catch(body, recover) {
95
100
  }
96
101
  return result;
97
102
  }
103
+ function _empty() {}
98
104
  function _continue(value, then) {
99
105
  return value && value.then ? value.then(then) : then(value);
100
106
  }
101
- function _async(f) {
102
- return function () {
103
- for (var args = [], i = 0; i < arguments.length; i++) {
104
- args[i] = arguments[i];
105
- }
106
- try {
107
- return Promise.resolve(f.apply(this, args));
108
- } catch (e) {
109
- return Promise.reject(e);
110
- }
111
- };
112
- }
113
- function _empty() {}
114
107
  function _invoke(body, then) {
115
108
  var result = body();
116
109
  if (result && result.then) {
@@ -118,81 +111,122 @@ function _invoke(body, then) {
118
111
  }
119
112
  return then(result);
120
113
  }
121
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
122
- 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); } }
123
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
124
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
125
- 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); }
126
- /**
127
- * @bytescale/api
128
- * Bytescale API
129
- *
130
- * The version of the OpenAPI document: 2.0.0
131
- * Contact: hello@bytescale.com
132
- *
133
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
134
- * https://openapi-generator.tech
135
- * Do not edit the class manually.
136
- */
137
- var BASE_PATH = "https://api.bytescale.com".replace(/\/+$/, "");
114
+ 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) {
116
+ if (direct) {
117
+ return then ? then(value) : value;
118
+ }
119
+ if (!value || !value.then) {
120
+ value = Promise.resolve(value);
121
+ }
122
+ return then ? value.then(then) : value;
123
+ }
124
+ function runtime_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
125
+ 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); } }
126
+ 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; }
127
+ function runtime_toPropertyKey(arg) { var key = runtime_toPrimitive(arg, "string"); return runtime_typeof(key) === "symbol" ? key : String(key); }
128
+ 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
+
130
+ var BytescaleApiClientConfigResolver = /*#__PURE__*/function () {
131
+ function BytescaleApiClientConfigResolver() {
132
+ runtime_classCallCheck(this, BytescaleApiClientConfigResolver);
133
+ }
134
+ runtime_createClass(BytescaleApiClientConfigResolver, null, [{
135
+ key: "getApiUrl",
136
+ value: function getApiUrl(config) {
137
+ var _a;
138
+ return (_a = config.apiUrl) !== null && _a !== void 0 ? _a : BytescaleApiClientConfigResolver.defaultApiUrl;
139
+ }
140
+ }, {
141
+ key: "getCdnUrl",
142
+ value: function getCdnUrl(config) {
143
+ var _a;
144
+ return (_a = config.cdnUrl) !== null && _a !== void 0 ? _a : BytescaleApiClientConfigResolver.defaultCdnUrl;
145
+ }
146
+ }, {
147
+ key: "getFetchApi",
148
+ value: function getFetchApi(config) {
149
+ var _a;
150
+ return (_a = config.fetchApi) !== null && _a !== void 0 ? _a : fetch;
151
+ }
152
+ }]);
153
+ return BytescaleApiClientConfigResolver;
154
+ }();
155
+ BytescaleApiClientConfigResolver.defaultApiUrl = "https://api.bytescale.com";
156
+ BytescaleApiClientConfigResolver.defaultCdnUrl = "https://upcdn.io";
138
157
  /**
139
158
  * This is the base class for all generated API classes.
140
159
  */
141
160
  var BaseAPI = /*#__PURE__*/function () {
142
161
  function BaseAPI(config) {
143
- var _this = this;
144
- _classCallCheck(this, BaseAPI);
162
+ runtime_classCallCheck(this, BaseAPI);
145
163
  this.config = config;
146
- this.fetchApi = _async(function (url, init) {
147
- var _exit = false;
148
- var fetchParams = {
149
- url: url,
150
- init: init
151
- };
152
- var response = undefined;
153
- return _continue(_catch(function () {
154
- return _await((_this.config.fetchApi || fetch)(fetchParams.url, fetchParams.init), function (_temp) {
155
- response = _temp;
156
- });
157
- }, function (e) {
158
- if (response === undefined) {
159
- throw e;
160
- }
161
- }), function (_result) {
162
- return _exit ? _result : response;
163
- });
164
- });
165
164
  }
166
- _createClass(BaseAPI, [{
165
+ runtime_createClass(BaseAPI, [{
167
166
  key: "request",
168
- value: function request(context, initOverrides, operationBasePathOverride) {
167
+ value: function request(context, initOverrides, baseUrlOverride) {
169
168
  try {
170
- var _this3 = this;
171
- var _a;
172
- var apiKey = _this3.config.apiKey;
169
+ var _this2 = this;
170
+ var _a, _b;
171
+ var apiKey = _this2.config.apiKey;
173
172
  context.headers["Authorization"] = "Bearer ".concat(apiKey); // authorization-header authentication
174
- return _await(_this3.createFetchParams(context, initOverrides, operationBasePathOverride), function (_ref) {
173
+ if (((_a = AuthSessionState.session) === null || _a === void 0 ? void 0 : _a.accessToken) !== undefined) {
174
+ context.headers["Authorization-Token"] = AuthSessionState.session.accessToken;
175
+ }
176
+ // Key: any possible value for 'baseUrlOverride'
177
+ // 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) {
175
180
  var url = _ref.url,
176
181
  init = _ref.init;
177
- return _await(_this3.fetchApi(url, init), function (response) {
178
- var _exit2 = false;
179
- return response && response.status >= 200 && response.status < 300 ? response : _invoke(function () {
180
- if (response !== undefined) {
181
- var jsonError = undefined;
182
- return _continue(_catch(function () {
183
- return _await(response.json(), function (_response$json) {
184
- jsonError = _response$json;
185
- });
186
- }, _empty), function () {
187
- if (typeof ((_a = jsonError === null || jsonError === void 0 ? void 0 : jsonError.error) === null || _a === void 0 ? void 0 : _a.code) === "string") {
188
- throw new BytescaleApiError(jsonError);
189
- }
182
+ return _this2.doFetch(url, init, true);
183
+ });
184
+ } catch (e) {
185
+ return Promise.reject(e);
186
+ }
187
+ }
188
+ /**
189
+ * Returns a successful response (2**) else throws an error.
190
+ */
191
+ }, {
192
+ key: "doFetch",
193
+ value: function doFetch(url, init, isBytescaleApi) {
194
+ try {
195
+ var _exit3 = false;
196
+ var _this4 = this;
197
+ var _a, _b;
198
+ var response;
199
+ return _continue(_catch(function () {
200
+ return _await(BytescaleApiClientConfigResolver.getFetchApi(_this4.config)(url, init), function (_BytescaleApiClientCo) {
201
+ response = _BytescaleApiClientCo;
202
+ });
203
+ }, function (e) {
204
+ // Network-level errors, CORS errors, or HTTP-level errors from intermediary services (e.g. AWS or the user's own infrastructure/proxies).
205
+ // 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.
206
+ 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));
207
+ }), function (_result) {
208
+ var _exit2 = false;
209
+ if (_exit3) return _result;
210
+ return response.status >= 200 && response.status < 300 ? response : _invoke(function () {
211
+ if (isBytescaleApi) {
212
+ var jsonError = undefined;
213
+ return _continue(_catch(function () {
214
+ return _await(response.json(), function (_response$json) {
215
+ jsonError = _response$json;
190
216
  });
191
- }
192
- }, function (_result2) {
193
- if (_exit2) return _result2;
194
- throw new Error("Unable to connect to the Bytescale API: please try again.");
195
- });
217
+ }, _empty), function () {
218
+ if (typeof ((_a = jsonError === null || jsonError === void 0 ? void 0 : jsonError.error) === null || _a === void 0 ? void 0 : _a.code) === "string") {
219
+ throw new BytescaleApiError(jsonError);
220
+ }
221
+ // HTTP-level errors from intermediary services (e.g. AWS or the user's own infrastructure/proxies). On the browser,
222
+ // this error is unlikely to be triggered since these errors will masqurade as CORS errors (see above) but in Node.js
223
+ // this error will appear from any intermediary service failure.
224
+ throw new Error("Unable to connect to the Bytescale API (".concat(response.status, "): please try again."));
225
+ });
226
+ }
227
+ }, function (_result2) {
228
+ if (_exit2) return _result2;
229
+ throw new Error("Failure status code (".concat(response.status, ") received for request: ").concat((_b = init.method) !== null && _b !== void 0 ? _b : "GET", " ").concat(url));
196
230
  });
197
231
  });
198
232
  } catch (e) {
@@ -214,17 +248,17 @@ var BaseAPI = /*#__PURE__*/function () {
214
248
  }
215
249
  }, {
216
250
  key: "createFetchParams",
217
- value: function createFetchParams(context, initOverrides, operationBasePathOverride) {
251
+ value: function createFetchParams(context, initOverrides, baseUrlOverride) {
218
252
  try {
219
- var _this5 = this;
220
- var url = (operationBasePathOverride !== null && operationBasePathOverride !== void 0 ? operationBasePathOverride : BASE_PATH) + context.path;
253
+ var _this6 = this;
254
+ var url = (baseUrlOverride !== null && baseUrlOverride !== void 0 ? baseUrlOverride : BytescaleApiClientConfigResolver.getApiUrl(_this6.config)) + context.path;
221
255
  if (context.query !== undefined && Object.keys(context.query).length !== 0) {
222
256
  // only add the querystring to the URL if there are query parameters.
223
257
  // this is done to avoid urls ending with a "?" character which buggy webservers
224
258
  // do not handle correctly sometimes.
225
259
  url += "?" + querystring(context.query);
226
260
  }
227
- var configHeaders = _this5.config.headers;
261
+ var configHeaders = _this6.config.headers;
228
262
  var _Object$assign3 = Object.assign({}, context.headers);
229
263
  return _await(configHeaders === undefined ? {} : configHeaders(), function (_configHeaders) {
230
264
  var headers = Object.assign(_Object$assign3, _configHeaders);
@@ -261,67 +295,59 @@ var BaseAPI = /*#__PURE__*/function () {
261
295
  }]);
262
296
  return BaseAPI;
263
297
  }();
264
- var BytescaleApiError = /*#__PURE__*/function (_Error) {
265
- _inherits(BytescaleApiError, _Error);
266
- var _super = _createSuper(BytescaleApiError);
298
+ BaseAPI.specialApiKeys = ["free", "demo"];
299
+ BaseAPI.specialApiKeyAccountId = "W142hJk";
300
+ BaseAPI.accountIdLength = 7; // Sync with: upload/shared/**/AccountIdUtils
301
+ var CancelledError = /*#__PURE__*/function (_Error) {
302
+ _inherits(CancelledError, _Error);
303
+ var _super = _createSuper(CancelledError);
304
+ function CancelledError() {
305
+ var _this7;
306
+ runtime_classCallCheck(this, CancelledError);
307
+ _this7 = _super.call(this, "Operation cancelled by caller.");
308
+ _this7.name = "CancelledError";
309
+ return _this7;
310
+ }
311
+ return runtime_createClass(CancelledError);
312
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
313
+ var BytescaleApiError = /*#__PURE__*/function (_Error2) {
314
+ _inherits(BytescaleApiError, _Error2);
315
+ var _super2 = _createSuper(BytescaleApiError);
267
316
  function BytescaleApiError(response) {
268
- var _this6;
269
- _classCallCheck(this, BytescaleApiError);
270
- _this6 = _super.call(this, response.error.message);
271
- _this6.name = "BytescaleApiError";
272
- _this6.errorCode = response.error.code;
273
- _this6.details = response.error.details;
274
- return _this6;
317
+ var _this8;
318
+ runtime_classCallCheck(this, BytescaleApiError);
319
+ _this8 = _super2.call(this, response.error.message);
320
+ _this8.name = "BytescaleApiError";
321
+ _this8.errorCode = response.error.code;
322
+ _this8.details = response.error.details;
323
+ return _this8;
275
324
  }
276
- return _createClass(BytescaleApiError);
325
+ return runtime_createClass(BytescaleApiError);
277
326
  }( /*#__PURE__*/_wrapNativeSuper(Error));
278
327
  function querystring(params) {
279
- var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
280
328
  return Object.keys(params).map(function (key) {
281
- return querystringSingleKey(key, params[key], prefix);
329
+ return querystringSingleKey(key, params[key]);
282
330
  }).filter(function (part) {
283
331
  return part.length > 0;
284
332
  }).join("&");
285
333
  }
286
334
  function querystringSingleKey(key, value) {
287
- var keyPrefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
288
- var fullKey = keyPrefix + (keyPrefix.length ? "[".concat(key, "]") : key);
289
- if (value instanceof Array) {
290
- var multiValue = value.map(function (singleValue) {
291
- return encodeURIComponent(String(singleValue));
292
- }).join("&".concat(encodeURIComponent(fullKey), "="));
293
- return "".concat(encodeURIComponent(fullKey), "=").concat(multiValue);
294
- }
295
- if (value instanceof Set) {
296
- var valueAsArray = Array.from(value);
297
- return querystringSingleKey(key, valueAsArray, keyPrefix);
298
- }
299
- if (value instanceof Date) {
300
- return "".concat(encodeURIComponent(fullKey), "=").concat(encodeURIComponent(value.toISOString()));
301
- }
302
335
  if (value instanceof Object) {
303
- return querystring(value, fullKey);
336
+ return querystring(value);
304
337
  }
305
- return "".concat(encodeURIComponent(fullKey), "=").concat(encodeURIComponent(String(value)));
338
+ return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(String(value)));
306
339
  }
307
340
  var JSONApiResponse = /*#__PURE__*/function () {
308
341
  function JSONApiResponse(raw) {
309
- var transformer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (jsonValue) {
310
- return jsonValue;
311
- };
312
- _classCallCheck(this, JSONApiResponse);
342
+ runtime_classCallCheck(this, JSONApiResponse);
313
343
  this.raw = raw;
314
- this.transformer = transformer;
315
344
  }
316
- _createClass(JSONApiResponse, [{
345
+ runtime_createClass(JSONApiResponse, [{
317
346
  key: "value",
318
347
  value: function value() {
319
348
  try {
320
- var _this8 = this;
321
- var _transformer2 = _this8.transformer;
322
- return _await(_this8.raw.json(), function (_this7$raw$json) {
323
- return _transformer2.call(_this8, _this7$raw$json);
324
- });
349
+ var _this10 = this;
350
+ return _await(_this10.raw.json());
325
351
  } catch (e) {
326
352
  return Promise.reject(e);
327
353
  }
@@ -331,10 +357,10 @@ var JSONApiResponse = /*#__PURE__*/function () {
331
357
  }();
332
358
  var VoidApiResponse = /*#__PURE__*/function () {
333
359
  function VoidApiResponse(raw) {
334
- _classCallCheck(this, VoidApiResponse);
360
+ runtime_classCallCheck(this, VoidApiResponse);
335
361
  this.raw = raw;
336
362
  }
337
- _createClass(VoidApiResponse, [{
363
+ runtime_createClass(VoidApiResponse, [{
338
364
  key: "value",
339
365
  value: function value() {
340
366
  return _await(undefined);
@@ -344,10 +370,10 @@ var VoidApiResponse = /*#__PURE__*/function () {
344
370
  }();
345
371
  var BinaryResult = /*#__PURE__*/function () {
346
372
  function BinaryResult(raw) {
347
- _classCallCheck(this, BinaryResult);
373
+ runtime_classCallCheck(this, BinaryResult);
348
374
  this.raw = raw;
349
375
  }
350
- _createClass(BinaryResult, [{
376
+ runtime_createClass(BinaryResult, [{
351
377
  key: "stream",
352
378
  value: function stream() {
353
379
  if (this.raw.bodyUsed) {
@@ -362,8 +388,8 @@ var BinaryResult = /*#__PURE__*/function () {
362
388
  key: "text",
363
389
  value: function text() {
364
390
  try {
365
- var _this10 = this;
366
- return _await(_this10.raw.text());
391
+ var _this12 = this;
392
+ return _await(_this12.raw.text());
367
393
  } catch (e) {
368
394
  return Promise.reject(e);
369
395
  }
@@ -372,8 +398,8 @@ var BinaryResult = /*#__PURE__*/function () {
372
398
  key: "blob",
373
399
  value: function blob() {
374
400
  try {
375
- var _this12 = this;
376
- return _await(_this12.raw.blob());
401
+ var _this14 = this;
402
+ return _await(_this14.raw.blob());
377
403
  } catch (e) {
378
404
  return Promise.reject(e);
379
405
  }
@@ -382,8 +408,8 @@ var BinaryResult = /*#__PURE__*/function () {
382
408
  key: "json",
383
409
  value: function json() {
384
410
  try {
385
- var _this14 = this;
386
- return _await(_this14.raw.json());
411
+ var _this16 = this;
412
+ return _await(_this16.raw.json());
387
413
  } catch (e) {
388
414
  return Promise.reject(e);
389
415
  }
@@ -391,7 +417,7 @@ var BinaryResult = /*#__PURE__*/function () {
391
417
  }]);
392
418
  return BinaryResult;
393
419
  }();
394
- ;// CONCATENATED MODULE: ./src/generated/apis/FileApi.ts
420
+ ;// CONCATENATED MODULE: ./src/public/shared/generated/apis/FileApi.ts
395
421
  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); }
396
422
  function FileApi_await(value, then, direct) {
397
423
  if (direct) {
@@ -631,6 +657,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
631
657
  if (params.large !== undefined) {
632
658
  query["large"] = params.large;
633
659
  }
660
+ if (params.transformationParams !== undefined) {
661
+ query["transformationParams"] = params.transformationParams;
662
+ }
634
663
  if (params.version !== undefined) {
635
664
  query["version"] = params.version;
636
665
  }
@@ -662,6 +691,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
662
691
  try {
663
692
  var _this16 = this;
664
693
  var query = {};
694
+ if (params.transformationParams !== undefined) {
695
+ query["transformationParams"] = params.transformationParams;
696
+ }
665
697
  var headers = {};
666
698
  headers["Content-Type"] = "application/json";
667
699
  return FileApi_await(_this16.request({
@@ -686,7 +718,7 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
686
718
  }]);
687
719
  return FileApi;
688
720
  }(BaseAPI);
689
- ;// CONCATENATED MODULE: ./src/generated/apis/FolderApi.ts
721
+ ;// CONCATENATED MODULE: ./src/public/shared/generated/apis/FolderApi.ts
690
722
  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); }
691
723
  function FolderApi_await(value, then, direct) {
692
724
  if (direct) {
@@ -946,7 +978,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
946
978
  }]);
947
979
  return FolderApi;
948
980
  }(BaseAPI);
949
- ;// CONCATENATED MODULE: ./src/generated/apis/JobApi.ts
981
+ ;// CONCATENATED MODULE: ./src/public/shared/generated/apis/JobApi.ts
950
982
  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); }
951
983
  function JobApi_await(value, then, direct) {
952
984
  if (direct) {
@@ -1081,7 +1113,7 @@ var JobApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1081
1113
  }]);
1082
1114
  return JobApi;
1083
1115
  }(BaseAPI);
1084
- ;// CONCATENATED MODULE: ./src/generated/apis/UploadApi.ts
1116
+ ;// CONCATENATED MODULE: ./src/public/shared/generated/apis/UploadApi.ts
1085
1117
  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); }
1086
1118
  function UploadApi_await(value, then, direct) {
1087
1119
  if (direct) {
@@ -1269,53 +1301,174 @@ var UploadApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1269
1301
  }]);
1270
1302
  return UploadApi;
1271
1303
  }(BaseAPI);
1272
- ;// CONCATENATED MODULE: ./src/generated/apis/index.ts
1304
+ ;// CONCATENATED MODULE: ./src/public/shared/generated/apis/index.ts
1273
1305
  /* tslint:disable */
1274
1306
  /* eslint-disable */
1275
1307
 
1276
1308
 
1277
1309
 
1278
1310
 
1279
- ;// CONCATENATED MODULE: ./src/generated/index.ts
1311
+ ;// CONCATENATED MODULE: ./src/public/shared/generated/index.ts
1280
1312
  /* tslint:disable */
1281
1313
  /* eslint-disable */
1282
1314
 
1283
1315
 
1284
1316
 
1285
- ;// CONCATENATED MODULE: ./src/uploads/public/shared/Model.ts
1286
- 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); }
1287
- 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); } }
1288
- 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; }
1289
- function Model_toPropertyKey(arg) { var key = Model_toPrimitive(arg, "string"); return Model_typeof(key) === "symbol" ? key : String(key); }
1290
- 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); }
1291
- function Model_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1292
- 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); }
1293
- 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); }; }
1294
- 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); }
1295
- function Model_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1296
- 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); }
1297
- 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); }
1298
- 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; } }
1299
- function Model_isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
1300
- 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); }
1301
- function Model_getPrototypeOf(o) { Model_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Model_getPrototypeOf(o); }
1302
- var CancelledError = /*#__PURE__*/function (_Error) {
1303
- Model_inherits(CancelledError, _Error);
1304
- var _super = Model_createSuper(CancelledError);
1305
- function CancelledError() {
1306
- var _this;
1307
- Model_classCallCheck(this, CancelledError);
1308
- _this = _super.call(this, "Upload cancelled by user.");
1309
- _this.name = "CancelledError";
1310
- return _this;
1317
+ ;// CONCATENATED MODULE: ./src/public/shared/CommonTypes.ts
1318
+ /**
1319
+ * Workaround for tsc aliases, where we cannot export implementation-less libs in our dists.
1320
+ */
1321
+ var CommonTypesNoOp = false;
1322
+ ;// CONCATENATED MODULE: ./src/private/TypeUtils.ts
1323
+ function assertUnreachable(x) {
1324
+ throw new Error("Didn't expect to get here: ".concat(JSON.stringify(x)));
1325
+ }
1326
+ function isDefinedEntry(object) {
1327
+ return object[1] !== undefined && object[1] !== null;
1328
+ }
1329
+ ;// CONCATENATED MODULE: ./src/public/shared/UrlBuilder.ts
1330
+ 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); }
1331
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1332
+ 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."); }
1333
+ 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; } }
1334
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1335
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1336
+ 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."); }
1337
+ 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); }
1338
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1339
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1340
+ 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; }
1341
+ function UrlBuilder_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1342
+ 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); } }
1343
+ 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; }
1344
+ function UrlBuilder_toPropertyKey(arg) { var key = UrlBuilder_toPrimitive(arg, "string"); return UrlBuilder_typeof(key) === "symbol" ? key : String(key); }
1345
+ 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); }
1346
+
1347
+
1348
+ var UrlBuilder = /*#__PURE__*/function () {
1349
+ function UrlBuilder(config) {
1350
+ UrlBuilder_classCallCheck(this, UrlBuilder);
1351
+ var _a;
1352
+ this.cdnUrl = (_a = config === null || config === void 0 ? void 0 : config.cdnUrl) !== null && _a !== void 0 ? _a : BytescaleApiClientConfigResolver.defaultCdnUrl;
1311
1353
  }
1312
- return Model_createClass(CancelledError);
1313
- }( /*#__PURE__*/Model_wrapNativeSuper(Error));
1314
- ;// CONCATENATED MODULE: ./src/uploads/public/shared/index.ts
1354
+ /**
1355
+ * Builds a URL to either a raw file or a transformed file.
1356
+ *
1357
+ * Example 1) Getting a publicly-accessible raw file URL:
1358
+ *
1359
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg" })
1360
+ *
1361
+ * Example 2) Getting a publicly-accessible image URL, resized to 500x500:
1362
+ *
1363
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", options: { transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } } } })
1364
+ *
1365
+ * Example 3) Getting a privately-accessible image URL, resized to 500x500 (requires 'AuthManager.beginAuthSession' to be called before accessing the URL):
1366
+ *
1367
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", options: { transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } }, auth: true } })
1368
+ *
1369
+ * Example 4) Getting a publicly-accessible image URL, resized using a transformation preset called "thumbnail" that was created manually in the Bytescale Dashboard:
1370
+ *
1371
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", options: { transformation: { type: "preset", preset: "thumbnail" } } })
1372
+ */
1373
+ UrlBuilder_createClass(UrlBuilder, [{
1374
+ key: "url",
1375
+ value: function url(params) {
1376
+ 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);
1378
+ }
1379
+ }, {
1380
+ key: "raw",
1381
+ value: function raw(params) {
1382
+ var _a;
1383
+ var baseUrl = this.getBaseUrl(params, "raw");
1384
+ var commonParams = this.getCommonQueryParams((_a = params.options) !== null && _a !== void 0 ? _a : {});
1385
+ return this.addQueryParams(baseUrl, commonParams);
1386
+ }
1387
+ }, {
1388
+ key: "transformation",
1389
+ value: function transformation(params, trans) {
1390
+ 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
+ });
1395
+ var commonParams = this.getCommonQueryParams((_a = params.options) !== null && _a !== void 0 ? _a : {});
1396
+ return this.addQueryParams(baseUrl, [].concat(_toConsumableArray(commonParams), _toConsumableArray(transParams)));
1397
+ }
1398
+ }, {
1399
+ key: "getBaseUrl",
1400
+ value: function getBaseUrl(params, prefix) {
1401
+ return "".concat(this.cdnUrl, "/").concat(params.accountId, "/").concat(prefix).concat(params.filePath);
1402
+ }
1403
+ }, {
1404
+ key: "getCommonQueryParams",
1405
+ value: function getCommonQueryParams(params) {
1406
+ return this.makeQueryParams(["auth", "cache", "cacheTtl", "version", "forceDownloadPrompt"], {
1407
+ cacheTtl: "cache_ttl",
1408
+ forceDownloadPrompt: "download"
1409
+ })(params);
1410
+ }
1411
+ }, {
1412
+ key: "makeQueryParams",
1413
+ value: function makeQueryParams(keys, keyOverrides) {
1414
+ return function (data) {
1415
+ var result = [];
1416
+ keys.forEach(function (key) {
1417
+ var _a;
1418
+ var value = data[key];
1419
+ if (value !== undefined) {
1420
+ result.push([(_a = keyOverrides[key]) !== null && _a !== void 0 ? _a : key, value.toString()]);
1421
+ }
1422
+ });
1423
+ return result;
1424
+ };
1425
+ }
1426
+ }, {
1427
+ key: "getTransformationParams",
1428
+ value: function getTransformationParams(trans, keyRewrites) {
1429
+ if (trans.params === undefined) {
1430
+ return [];
1431
+ }
1432
+ var serializeObj = function serializeObj(obj) {
1433
+ return Object.entries(obj).filter(isDefinedEntry).map(function (_ref) {
1434
+ var _ref2 = _slicedToArray(_ref, 2),
1435
+ key = _ref2[0],
1436
+ value = _ref2[1];
1437
+ var _a;
1438
+ return [(_a = keyRewrites[key]) !== null && _a !== void 0 ? _a : key, value.toString()];
1439
+ });
1440
+ };
1441
+ return Array.isArray(trans.params) ? trans.params.flatMap(serializeObj) : serializeObj(trans.params);
1442
+ }
1443
+ }, {
1444
+ key: "addQueryParams",
1445
+ value: function addQueryParams(baseUrl, params) {
1446
+ if (params.length === 0) {
1447
+ return baseUrl;
1448
+ }
1449
+ return "".concat(baseUrl, "?").concat(params.map(function (_ref3) {
1450
+ var _ref4 = _slicedToArray(_ref3, 2),
1451
+ key = _ref4[0],
1452
+ value = _ref4[1];
1453
+ return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value));
1454
+ }).join("&"));
1455
+ }
1456
+ }]);
1457
+ return UrlBuilder;
1458
+ }();
1459
+ ;// CONCATENATED MODULE: ./src/public/shared/UrlBuilderTypes.ts
1460
+ /**
1461
+ * Workaround for tsc aliases, where we cannot export implementation-less libs in our dists.
1462
+ */
1463
+ var UrlBuilderTypesNoOp = false;
1464
+ ;// CONCATENATED MODULE: ./src/public/shared/index.ts
1315
1465
 
1316
- ;// CONCATENATED MODULE: ./src/uploads/private/UploadManagerBase.ts
1466
+
1467
+
1468
+
1469
+ ;// CONCATENATED MODULE: ./src/private/UploadManagerBase.ts
1317
1470
  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); }
1318
- function UploadManagerBase_async(f) {
1471
+ function _async(f) {
1319
1472
  return function () {
1320
1473
  for (var args = [], i = 0; i < arguments.length; i++) {
1321
1474
  args[i] = arguments[i];
@@ -1487,12 +1640,12 @@ function _continueIgnored(value) {
1487
1640
  return value.then(UploadManagerBase_empty);
1488
1641
  }
1489
1642
  }
1490
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1491
- 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."); }
1492
- 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); }
1493
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1494
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1495
- 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; }
1643
+ function UploadManagerBase_toConsumableArray(arr) { return UploadManagerBase_arrayWithoutHoles(arr) || UploadManagerBase_iterableToArray(arr) || UploadManagerBase_unsupportedIterableToArray(arr) || UploadManagerBase_nonIterableSpread(); }
1644
+ 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."); }
1645
+ 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); }
1646
+ function UploadManagerBase_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1647
+ function UploadManagerBase_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return UploadManagerBase_arrayLikeToArray(arr); }
1648
+ 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; }
1496
1649
  function UploadManagerBase_empty() {}
1497
1650
  function _awaitIgnored(value, direct) {
1498
1651
  if (!direct) {
@@ -1532,7 +1685,6 @@ function UploadManagerBase_createClass(Constructor, protoProps, staticProps) { i
1532
1685
  function UploadManagerBase_toPropertyKey(arg) { var key = UploadManagerBase_toPrimitive(arg, "string"); return UploadManagerBase_typeof(key) === "symbol" ? key : String(key); }
1533
1686
  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); }
1534
1687
 
1535
-
1536
1688
  /**
1537
1689
  * Methods common to UploadManagerNode and UploadManagerBrowser.
1538
1690
  */
@@ -1559,13 +1711,13 @@ var UploadManagerBase = /*#__PURE__*/function () {
1559
1711
  onProgress(0);
1560
1712
  return UploadManagerBase_await(_this2.beginUpload(request, preUploadInfo), function (uploadInfo) {
1561
1713
  var partCount = uploadInfo.uploadParts.count;
1562
- var parts = _toConsumableArray(Array(partCount).keys());
1714
+ var parts = UploadManagerBase_toConsumableArray(Array(partCount).keys());
1563
1715
  var _this2$makeCancellati = _this2.makeCancellationMethods(),
1564
1716
  cancel = _this2$makeCancellati.cancel,
1565
1717
  addCancellationHandler = _this2$makeCancellati.addCancellationHandler;
1566
1718
  var intervalHandle = setInterval(_this2.onIntervalTick(request, cancel), _this2.intervalMs);
1567
1719
  return UploadManagerBase_continue(_finallyRethrows(function () {
1568
- return UploadManagerBase_await(_this2.mapAsync(parts, preUploadInfo.maxConcurrentUploadParts, UploadManagerBase_async(function (part) {
1720
+ return UploadManagerBase_await(_this2.mapAsync(parts, preUploadInfo.maxConcurrentUploadParts, _async(function (part) {
1569
1721
  return _this2.uploadPart(request, source, part, uploadInfo, onProgress, addCancellationHandler);
1570
1722
  })), function () {
1571
1723
  return _awaitIgnored(_this2.postUpload(init));
@@ -1757,8 +1909,8 @@ var UploadManagerBase = /*#__PURE__*/function () {
1757
1909
  key: "mapAsync",
1758
1910
  value: function mapAsync(items, concurrency, callback) {
1759
1911
  try {
1760
- var workQueue = _toConsumableArray(items);
1761
- return _awaitIgnored(Promise.all(_toConsumableArray(Array(concurrency).keys()).map(UploadManagerBase_async(function () {
1912
+ var workQueue = UploadManagerBase_toConsumableArray(items);
1913
+ return _awaitIgnored(Promise.all(UploadManagerBase_toConsumableArray(Array(concurrency).keys()).map(_async(function () {
1762
1914
  return _continueIgnored(_for(function () {
1763
1915
  return workQueue.length > 0;
1764
1916
  }, void 0, function () {
@@ -1781,7 +1933,7 @@ var UploadManagerBase = /*#__PURE__*/function () {
1781
1933
  var x = y => { var x = {}; __lib_require__.d(x, y); return x; }
1782
1934
  var y = x => () => x
1783
1935
  var external_stream_namespaceObject = x({ ["Readable"]: () => __WEBPACK_EXTERNAL_MODULE_stream__.Readable });
1784
- ;// CONCATENATED MODULE: ./src/uploads/private/StreamUtils.ts
1936
+ ;// CONCATENATED MODULE: ./src/private/StreamUtils.ts
1785
1937
  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); }
1786
1938
  function StreamUtils_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1787
1939
  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); } }
@@ -1823,14 +1975,14 @@ var StreamUtils = /*#__PURE__*/function () {
1823
1975
  }]);
1824
1976
  return StreamUtils;
1825
1977
  }();
1826
- ;// CONCATENATED MODULE: ./src/uploads/private/NodeChunkedStream.ts
1978
+ ;// CONCATENATED MODULE: ./src/private/NodeChunkedStream.ts
1827
1979
  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); }
1828
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || NodeChunkedStream_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1829
- 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."); }
1980
+ function NodeChunkedStream_slicedToArray(arr, i) { return NodeChunkedStream_arrayWithHoles(arr) || NodeChunkedStream_iterableToArrayLimit(arr, i) || NodeChunkedStream_unsupportedIterableToArray(arr, i) || NodeChunkedStream_nonIterableRest(); }
1981
+ 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."); }
1830
1982
  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); }
1831
1983
  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; }
1832
- 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; } }
1833
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1984
+ 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; } }
1985
+ function NodeChunkedStream_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1834
1986
  function NodeChunkedStream_await(value, then, direct) {
1835
1987
  if (direct) {
1836
1988
  return then ? then(value) : value;
@@ -1918,7 +2070,7 @@ var NodeChunkedStream = /*#__PURE__*/function () {
1918
2070
  return; // Received empty data.
1919
2071
  }
1920
2072
 
1921
- var _splitResult = _slicedToArray(splitResult, 2),
2073
+ var _splitResult = NodeChunkedStream_slicedToArray(splitResult, 2),
1922
2074
  consumed = _splitResult[0],
1923
2075
  remaining = _splitResult[1];
1924
2076
  _this2.buffer = remaining;
@@ -1989,7 +2141,7 @@ var NodeChunkedStream = /*#__PURE__*/function () {
1989
2141
  if (splitResult === undefined) {
1990
2142
  return undefined;
1991
2143
  }
1992
- var _splitResult2 = _slicedToArray(splitResult, 2),
2144
+ var _splitResult2 = NodeChunkedStream_slicedToArray(splitResult, 2),
1993
2145
  consumed = _splitResult2[0],
1994
2146
  remaining = _splitResult2[1];
1995
2147
  this.buffer = remaining;
@@ -2013,15 +2165,11 @@ var NodeChunkedStream = /*#__PURE__*/function () {
2013
2165
  }]);
2014
2166
  return NodeChunkedStream;
2015
2167
  }();
2016
- ;// CONCATENATED MODULE: ./src/uploads/private/TypeUtils.ts
2017
- function assertUnreachable(x) {
2018
- throw new Error("Didn't expect to get here: ".concat(JSON.stringify(x)));
2019
- }
2020
2168
  ;// CONCATENATED MODULE: external "buffer"
2021
2169
  var external_buffer_x = y => { var x = {}; __lib_require__.d(x, y); return x; }
2022
2170
  var external_buffer_y = x => () => x
2023
2171
  var external_buffer_namespaceObject = external_buffer_x({ ["Blob"]: () => __WEBPACK_EXTERNAL_MODULE_buffer__.Blob });
2024
- ;// CONCATENATED MODULE: ./src/uploads/public/node/UploadManagerNode.ts
2172
+ ;// CONCATENATED MODULE: ./src/public/node/UploadManagerNode.ts
2025
2173
  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); }
2026
2174
  function UploadManagerNode_empty() {}
2027
2175
  function UploadManagerNode_awaitIgnored(value, direct) {
@@ -2400,25 +2548,94 @@ var UploadManager = /*#__PURE__*/function (_UploadManagerBase) {
2400
2548
  }]);
2401
2549
  return UploadManager;
2402
2550
  }(UploadManagerBase);
2403
- ;// CONCATENATED MODULE: ./src/uploads/public/node/index.ts
2551
+ ;// CONCATENATED MODULE: ./src/private/EnvChecker.ts
2552
+ 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); }
2553
+ function EnvChecker_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2554
+ 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); } }
2555
+ 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; }
2556
+ function EnvChecker_toPropertyKey(arg) { var key = EnvChecker_toPrimitive(arg, "string"); return EnvChecker_typeof(key) === "symbol" ? key : String(key); }
2557
+ 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); }
2558
+ var EnvChecker = /*#__PURE__*/function () {
2559
+ function EnvChecker() {
2560
+ EnvChecker_classCallCheck(this, EnvChecker);
2561
+ }
2562
+ EnvChecker_createClass(EnvChecker, null, [{
2563
+ key: "isNodeJs",
2564
+ value: function isNodeJs() {
2565
+ return typeof process !== "undefined" && process.versions !== undefined && process.versions.node !== undefined;
2566
+ }
2567
+ }, {
2568
+ key: "methodRequiresBrowser",
2569
+ value: function methodRequiresBrowser(methodName) {
2570
+ if (EnvChecker.isNodeJs()) {
2571
+ return new Error("You must call '".concat(methodName, "' in the browser. (You are currently in Node.js.)"));
2572
+ }
2573
+ 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."));
2574
+ }
2575
+ }]);
2576
+ return EnvChecker;
2577
+ }();
2578
+ ;// CONCATENATED MODULE: ./src/public/node/AuthManagerNode.ts
2579
+ 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); }
2580
+ function AuthManagerNode_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2581
+ 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); } }
2582
+ 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; }
2583
+ function AuthManagerNode_toPropertyKey(arg) { var key = AuthManagerNode_toPrimitive(arg, "string"); return AuthManagerNode_typeof(key) === "symbol" ? key : String(key); }
2584
+ 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); }
2585
+
2586
+ var AuthManager = /*#__PURE__*/function () {
2587
+ function AuthManager() {
2588
+ AuthManagerNode_classCallCheck(this, AuthManager);
2589
+ }
2590
+ AuthManagerNode_createClass(AuthManager, [{
2591
+ key: "beginAuthSession",
2592
+ value: function beginAuthSession(_authUrl, _authHeaders) {
2593
+ try {
2594
+ throw EnvChecker.methodRequiresBrowser("beginAuthSession");
2595
+ } catch (e) {
2596
+ return Promise.reject(e);
2597
+ }
2598
+ }
2599
+ }, {
2600
+ key: "endAuthSession",
2601
+ value: function endAuthSession() {
2602
+ try {
2603
+ throw EnvChecker.methodRequiresBrowser("endAuthSession");
2604
+ } catch (e) {
2605
+ return Promise.reject(e);
2606
+ }
2607
+ }
2608
+ }, {
2609
+ key: "isAuthSessionActive",
2610
+ value: function isAuthSessionActive() {
2611
+ return false;
2612
+ }
2613
+ }]);
2614
+ return AuthManager;
2615
+ }();
2616
+ ;// CONCATENATED MODULE: ./src/public/node/index.ts
2617
+
2404
2618
 
2405
2619
  ;// CONCATENATED MODULE: ./src/index.node.ts
2406
2620
  /* tslint:disable */
2407
2621
  /* eslint-disable */
2408
2622
 
2409
2623
 
2410
-
2411
- var __lib_exports__BASE_PATH = __lib_exports__.BASE_PATH;
2624
+ var __lib_exports__AuthManager = __lib_exports__.AuthManager;
2412
2625
  var __lib_exports__BaseAPI = __lib_exports__.BaseAPI;
2413
2626
  var __lib_exports__BinaryResult = __lib_exports__.BinaryResult;
2627
+ var __lib_exports__BytescaleApiClientConfigResolver = __lib_exports__.BytescaleApiClientConfigResolver;
2414
2628
  var __lib_exports__BytescaleApiError = __lib_exports__.BytescaleApiError;
2415
2629
  var __lib_exports__CancelledError = __lib_exports__.CancelledError;
2630
+ var __lib_exports__CommonTypesNoOp = __lib_exports__.CommonTypesNoOp;
2416
2631
  var __lib_exports__FileApi = __lib_exports__.FileApi;
2417
2632
  var __lib_exports__FolderApi = __lib_exports__.FolderApi;
2418
2633
  var __lib_exports__JSONApiResponse = __lib_exports__.JSONApiResponse;
2419
2634
  var __lib_exports__JobApi = __lib_exports__.JobApi;
2420
2635
  var __lib_exports__UploadApi = __lib_exports__.UploadApi;
2421
2636
  var __lib_exports__UploadManager = __lib_exports__.UploadManager;
2637
+ var __lib_exports__UrlBuilder = __lib_exports__.UrlBuilder;
2638
+ var __lib_exports__UrlBuilderTypesNoOp = __lib_exports__.UrlBuilderTypesNoOp;
2422
2639
  var __lib_exports__VoidApiResponse = __lib_exports__.VoidApiResponse;
2423
2640
  var __lib_exports__querystring = __lib_exports__.querystring;
2424
- export { __lib_exports__BASE_PATH as BASE_PATH, __lib_exports__BaseAPI as BaseAPI, __lib_exports__BinaryResult as BinaryResult, __lib_exports__BytescaleApiError as BytescaleApiError, __lib_exports__CancelledError as CancelledError, __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__VoidApiResponse as VoidApiResponse, __lib_exports__querystring as 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 };