@bytescale/sdk 1.0.0-alpha.1

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.
@@ -0,0 +1,3946 @@
1
+ /******/ (function() { // webpackBootstrap
2
+ /******/ "use strict";
3
+ /******/ var __webpack_modules__ = ({});
4
+ /************************************************************************/
5
+ /******/ // The module cache
6
+ /******/ var __webpack_module_cache__ = {};
7
+ /******/
8
+ /******/ // The require function
9
+ /******/ function __webpack_require__(moduleId) {
10
+ /******/ // Check if module is in cache
11
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
12
+ /******/ if (cachedModule !== undefined) {
13
+ /******/ return cachedModule.exports;
14
+ /******/ }
15
+ /******/ // Create a new module (and put it into the cache)
16
+ /******/ var module = __webpack_module_cache__[moduleId] = {
17
+ /******/ // no module.id needed
18
+ /******/ // no module.loaded needed
19
+ /******/ exports: {}
20
+ /******/ };
21
+ /******/
22
+ /******/ // Execute the module function
23
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/ // expose the modules object (__webpack_modules__)
30
+ /******/ __webpack_require__.m = __webpack_modules__;
31
+ /******/
32
+ /************************************************************************/
33
+ /******/ /* webpack/runtime/create fake namespace object */
34
+ /******/ !function() {
35
+ /******/ var getProto = Object.getPrototypeOf ? function(obj) { return Object.getPrototypeOf(obj); } : function(obj) { return obj.__proto__; };
36
+ /******/ var leafPrototypes;
37
+ /******/ // create a fake namespace object
38
+ /******/ // mode & 1: value is a module id, require it
39
+ /******/ // mode & 2: merge all properties of value into the ns
40
+ /******/ // mode & 4: return value when already ns object
41
+ /******/ // mode & 16: return value when it's Promise-like
42
+ /******/ // mode & 8|1: behave like require
43
+ /******/ __webpack_require__.t = function(value, mode) {
44
+ /******/ if(mode & 1) value = this(value);
45
+ /******/ if(mode & 8) return value;
46
+ /******/ if(typeof value === 'object' && value) {
47
+ /******/ if((mode & 4) && value.__esModule) return value;
48
+ /******/ if((mode & 16) && typeof value.then === 'function') return value;
49
+ /******/ }
50
+ /******/ var ns = Object.create(null);
51
+ /******/ __webpack_require__.r(ns);
52
+ /******/ var def = {};
53
+ /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
54
+ /******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {
55
+ /******/ Object.getOwnPropertyNames(current).forEach(function(key) { def[key] = function() { return value[key]; }; });
56
+ /******/ }
57
+ /******/ def['default'] = function() { return value; };
58
+ /******/ __webpack_require__.d(ns, def);
59
+ /******/ return ns;
60
+ /******/ };
61
+ /******/ }();
62
+ /******/
63
+ /******/ /* webpack/runtime/define property getters */
64
+ /******/ !function() {
65
+ /******/ // define getter functions for harmony exports
66
+ /******/ __webpack_require__.d = function(exports, definition) {
67
+ /******/ for(var key in definition) {
68
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
69
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
70
+ /******/ }
71
+ /******/ }
72
+ /******/ };
73
+ /******/ }();
74
+ /******/
75
+ /******/ /* webpack/runtime/ensure chunk */
76
+ /******/ !function() {
77
+ /******/ __webpack_require__.f = {};
78
+ /******/ // This file contains only the entry chunk.
79
+ /******/ // The chunk loading function for additional chunks
80
+ /******/ __webpack_require__.e = function(chunkId) {
81
+ /******/ return Promise.all(Object.keys(__webpack_require__.f).reduce(function(promises, key) {
82
+ /******/ __webpack_require__.f[key](chunkId, promises);
83
+ /******/ return promises;
84
+ /******/ }, []));
85
+ /******/ };
86
+ /******/ }();
87
+ /******/
88
+ /******/ /* webpack/runtime/get javascript chunk filename */
89
+ /******/ !function() {
90
+ /******/ // This function allow to reference async chunks
91
+ /******/ __webpack_require__.u = function(chunkId) {
92
+ /******/ // return url for filenames based on template
93
+ /******/ return "" + chunkId + ".main.js";
94
+ /******/ };
95
+ /******/ }();
96
+ /******/
97
+ /******/ /* webpack/runtime/global */
98
+ /******/ !function() {
99
+ /******/ __webpack_require__.g = (function() {
100
+ /******/ if (typeof globalThis === 'object') return globalThis;
101
+ /******/ try {
102
+ /******/ return this || new Function('return this')();
103
+ /******/ } catch (e) {
104
+ /******/ if (typeof window === 'object') return window;
105
+ /******/ }
106
+ /******/ })();
107
+ /******/ }();
108
+ /******/
109
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
110
+ /******/ !function() {
111
+ /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
112
+ /******/ }();
113
+ /******/
114
+ /******/ /* webpack/runtime/load script */
115
+ /******/ !function() {
116
+ /******/ var inProgress = {};
117
+ /******/ var dataWebpackPrefix = "@bytescale/sdk:";
118
+ /******/ // loadScript function to load a script via script tag
119
+ /******/ __webpack_require__.l = function(url, done, key, chunkId) {
120
+ /******/ if(inProgress[url]) { inProgress[url].push(done); return; }
121
+ /******/ var script, needAttach;
122
+ /******/ if(key !== undefined) {
123
+ /******/ var scripts = document.getElementsByTagName("script");
124
+ /******/ for(var i = 0; i < scripts.length; i++) {
125
+ /******/ var s = scripts[i];
126
+ /******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
127
+ /******/ }
128
+ /******/ }
129
+ /******/ if(!script) {
130
+ /******/ needAttach = true;
131
+ /******/ script = document.createElement('script');
132
+ /******/
133
+ /******/ script.charset = 'utf-8';
134
+ /******/ script.timeout = 120;
135
+ /******/ if (__webpack_require__.nc) {
136
+ /******/ script.setAttribute("nonce", __webpack_require__.nc);
137
+ /******/ }
138
+ /******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
139
+ /******/ script.src = url;
140
+ /******/ }
141
+ /******/ inProgress[url] = [done];
142
+ /******/ var onScriptComplete = function(prev, event) {
143
+ /******/ // avoid mem leaks in IE.
144
+ /******/ script.onerror = script.onload = null;
145
+ /******/ clearTimeout(timeout);
146
+ /******/ var doneFns = inProgress[url];
147
+ /******/ delete inProgress[url];
148
+ /******/ script.parentNode && script.parentNode.removeChild(script);
149
+ /******/ doneFns && doneFns.forEach(function(fn) { return fn(event); });
150
+ /******/ if(prev) return prev(event);
151
+ /******/ };
152
+ /******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
153
+ /******/ script.onerror = onScriptComplete.bind(null, script.onerror);
154
+ /******/ script.onload = onScriptComplete.bind(null, script.onload);
155
+ /******/ needAttach && document.head.appendChild(script);
156
+ /******/ };
157
+ /******/ }();
158
+ /******/
159
+ /******/ /* webpack/runtime/make namespace object */
160
+ /******/ !function() {
161
+ /******/ // define __esModule on exports
162
+ /******/ __webpack_require__.r = function(exports) {
163
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
164
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
165
+ /******/ }
166
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
167
+ /******/ };
168
+ /******/ }();
169
+ /******/
170
+ /******/ /* webpack/runtime/publicPath */
171
+ /******/ !function() {
172
+ /******/ var scriptUrl;
173
+ /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
174
+ /******/ var document = __webpack_require__.g.document;
175
+ /******/ if (!scriptUrl && document) {
176
+ /******/ if (document.currentScript)
177
+ /******/ scriptUrl = document.currentScript.src
178
+ /******/ if (!scriptUrl) {
179
+ /******/ var scripts = document.getElementsByTagName("script");
180
+ /******/ if(scripts.length) scriptUrl = scripts[scripts.length - 1].src
181
+ /******/ }
182
+ /******/ }
183
+ /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
184
+ /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
185
+ /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
186
+ /******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
187
+ /******/ __webpack_require__.p = scriptUrl;
188
+ /******/ }();
189
+ /******/
190
+ /******/ /* webpack/runtime/jsonp chunk loading */
191
+ /******/ !function() {
192
+ /******/ // no baseURI
193
+ /******/
194
+ /******/ // object to store loaded and loading chunks
195
+ /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
196
+ /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
197
+ /******/ var installedChunks = {
198
+ /******/ "main": 0
199
+ /******/ };
200
+ /******/
201
+ /******/ __webpack_require__.f.j = function(chunkId, promises) {
202
+ /******/ // JSONP chunk loading for javascript
203
+ /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
204
+ /******/ if(installedChunkData !== 0) { // 0 means "already installed".
205
+ /******/
206
+ /******/ // a Promise means "currently loading".
207
+ /******/ if(installedChunkData) {
208
+ /******/ promises.push(installedChunkData[2]);
209
+ /******/ } else {
210
+ /******/ if(true) { // all chunks have JS
211
+ /******/ // setup Promise in chunk cache
212
+ /******/ var promise = new Promise(function(resolve, reject) { installedChunkData = installedChunks[chunkId] = [resolve, reject]; });
213
+ /******/ promises.push(installedChunkData[2] = promise);
214
+ /******/
215
+ /******/ // start chunk loading
216
+ /******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
217
+ /******/ // create error before stack unwound to get useful stacktrace later
218
+ /******/ var error = new Error();
219
+ /******/ var loadingEnded = function(event) {
220
+ /******/ if(__webpack_require__.o(installedChunks, chunkId)) {
221
+ /******/ installedChunkData = installedChunks[chunkId];
222
+ /******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
223
+ /******/ if(installedChunkData) {
224
+ /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
225
+ /******/ var realSrc = event && event.target && event.target.src;
226
+ /******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
227
+ /******/ error.name = 'ChunkLoadError';
228
+ /******/ error.type = errorType;
229
+ /******/ error.request = realSrc;
230
+ /******/ installedChunkData[1](error);
231
+ /******/ }
232
+ /******/ }
233
+ /******/ };
234
+ /******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
235
+ /******/ } else installedChunks[chunkId] = 0;
236
+ /******/ }
237
+ /******/ }
238
+ /******/ };
239
+ /******/
240
+ /******/ // no prefetching
241
+ /******/
242
+ /******/ // no preloaded
243
+ /******/
244
+ /******/ // no HMR
245
+ /******/
246
+ /******/ // no HMR manifest
247
+ /******/
248
+ /******/ // no on chunks loaded
249
+ /******/
250
+ /******/ // install a JSONP callback for chunk loading
251
+ /******/ var webpackJsonpCallback = function(parentChunkLoadingFunction, data) {
252
+ /******/ var chunkIds = data[0];
253
+ /******/ var moreModules = data[1];
254
+ /******/ var runtime = data[2];
255
+ /******/ // add "moreModules" to the modules object,
256
+ /******/ // then flag all "chunkIds" as loaded and fire callback
257
+ /******/ var moduleId, chunkId, i = 0;
258
+ /******/ if(chunkIds.some(function(id) { return installedChunks[id] !== 0; })) {
259
+ /******/ for(moduleId in moreModules) {
260
+ /******/ if(__webpack_require__.o(moreModules, moduleId)) {
261
+ /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
262
+ /******/ }
263
+ /******/ }
264
+ /******/ if(runtime) var result = runtime(__webpack_require__);
265
+ /******/ }
266
+ /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
267
+ /******/ for(;i < chunkIds.length; i++) {
268
+ /******/ chunkId = chunkIds[i];
269
+ /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
270
+ /******/ installedChunks[chunkId][0]();
271
+ /******/ }
272
+ /******/ installedChunks[chunkId] = 0;
273
+ /******/ }
274
+ /******/
275
+ /******/ }
276
+ /******/
277
+ /******/ var chunkLoadingGlobal = self["webpackChunk_bytescale_sdk"] = self["webpackChunk_bytescale_sdk"] || [];
278
+ /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
279
+ /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
280
+ /******/ }();
281
+ /******/
282
+ /************************************************************************/
283
+ var __webpack_exports__ = {};
284
+ // ESM COMPAT FLAG
285
+ __webpack_require__.r(__webpack_exports__);
286
+
287
+ // EXPORTS
288
+ __webpack_require__.d(__webpack_exports__, {
289
+ "AccountJobStatus": function() { return /* reexport */ AccountJobStatus; },
290
+ "AccountJobType": function() { return /* reexport */ AccountJobType; },
291
+ "AsyncResponseJobDocsEnum": function() { return /* reexport */ AsyncResponseJobDocsEnum; },
292
+ "AwsRegion": function() { return /* reexport */ AwsRegion; },
293
+ "BASE_PATH": function() { return /* reexport */ BASE_PATH; },
294
+ "BaseAPI": function() { return /* reexport */ BaseAPI; },
295
+ "BinaryResult": function() { return /* reexport */ BinaryResult; },
296
+ "COLLECTION_FORMATS": function() { return /* reexport */ COLLECTION_FORMATS; },
297
+ "CancelledError": function() { return /* reexport */ CancelledError; },
298
+ "ChunkedStream": function() { return /* reexport */ ChunkedStream; },
299
+ "Configuration": function() { return /* reexport */ Configuration; },
300
+ "DefaultConfig": function() { return /* reexport */ DefaultConfig; },
301
+ "DigitalOceanStorageTypeEnum": function() { return /* reexport */ DigitalOceanStorageTypeEnum; },
302
+ "FetchError": function() { return /* reexport */ FetchError; },
303
+ "FileApi": function() { return /* reexport */ FileApi; },
304
+ "FileCopyStatus": function() { return /* reexport */ FileCopyStatus; },
305
+ "FileSummaryTypeEnum": function() { return /* reexport */ FileSummaryTypeEnum; },
306
+ "FolderApi": function() { return /* reexport */ FolderApi; },
307
+ "FolderDetailsTypeEnum": function() { return /* reexport */ FolderDetailsTypeEnum; },
308
+ "FolderSettingsStorageLayerSummaryStorageLayerTypeEnum": function() { return /* reexport */ FolderSettingsStorageLayerSummaryStorageLayerTypeEnum; },
309
+ "FolderSummaryTypeEnum": function() { return /* reexport */ FolderSummaryTypeEnum; },
310
+ "GoogleStorageTypeEnum": function() { return /* reexport */ GoogleStorageTypeEnum; },
311
+ "InternalStorageV1TypeEnum": function() { return /* reexport */ InternalStorageV1TypeEnum; },
312
+ "InternalStorageV2TypeEnum": function() { return /* reexport */ InternalStorageV2TypeEnum; },
313
+ "JSONApiResponse": function() { return /* reexport */ JSONApiResponse; },
314
+ "JobApi": function() { return /* reexport */ JobApi; },
315
+ "JobSummaryJobDocsEnum": function() { return /* reexport */ JobSummaryJobDocsEnum; },
316
+ "MultipartUploadProtocol": function() { return /* reexport */ MultipartUploadProtocol; },
317
+ "ObjectSummaryTypeEnum": function() { return /* reexport */ ObjectSummaryTypeEnum; },
318
+ "PathPermissionScope": function() { return /* reexport */ PathPermissionScope; },
319
+ "PickDigitalOceanStorageExcludeKeyofDigitalOceanStorageCredentialsTypeEnum": function() { return /* reexport */ PickDigitalOceanStorageExcludeKeyofDigitalOceanStorageCredentialsTypeEnum; },
320
+ "PickGoogleStorageExcludeKeyofGoogleStorageCredentialsTypeEnum": function() { return /* reexport */ PickGoogleStorageExcludeKeyofGoogleStorageCredentialsTypeEnum; },
321
+ "PickR2StorageExcludeKeyofR2StorageCredentialsTypeEnum": function() { return /* reexport */ PickR2StorageExcludeKeyofR2StorageCredentialsTypeEnum; },
322
+ "PickS3StorageExcludeKeyofS3StorageCredentialsTypeEnum": function() { return /* reexport */ PickS3StorageExcludeKeyofS3StorageCredentialsTypeEnum; },
323
+ "ProcessFileCachePermEnum": function() { return /* reexport */ ProcessFileCachePermEnum; },
324
+ "R2StorageTypeEnum": function() { return /* reexport */ R2StorageTypeEnum; },
325
+ "RequiredError": function() { return /* reexport */ RequiredError; },
326
+ "ResponseError": function() { return /* reexport */ ResponseError; },
327
+ "S3StorageTypeEnum": function() { return /* reexport */ S3StorageTypeEnum; },
328
+ "SpecifiedFieldValueFolderDescriptionOrNullSetEnum": function() { return /* reexport */ SpecifiedFieldValueFolderDescriptionOrNullSetEnum; },
329
+ "SpecifiedFieldValuePublicPermissionsArrayOrNullSetEnum": function() { return /* reexport */ SpecifiedFieldValuePublicPermissionsArrayOrNullSetEnum; },
330
+ "SpecifiedFieldValueStorageLayerUpdateOrNullSetEnum": function() { return /* reexport */ SpecifiedFieldValueStorageLayerUpdateOrNullSetEnum; },
331
+ "SpecifiedFieldValueStorageLayerUpdateOrNullValueTypeEnum": function() { return /* reexport */ SpecifiedFieldValueStorageLayerUpdateOrNullValueTypeEnum; },
332
+ "StorageLayerSummaryTypeEnum": function() { return /* reexport */ StorageLayerSummaryTypeEnum; },
333
+ "StorageLayerUpdateTypeEnum": function() { return /* reexport */ StorageLayerUpdateTypeEnum; },
334
+ "TagConditionAllTypeEnum": function() { return /* reexport */ TagConditionAllTypeEnum; },
335
+ "TagConditionAndTypeEnum": function() { return /* reexport */ TagConditionAndTypeEnum; },
336
+ "TagConditionAnyTypeEnum": function() { return /* reexport */ TagConditionAnyTypeEnum; },
337
+ "TagConditionEqualsTypeEnum": function() { return /* reexport */ TagConditionEqualsTypeEnum; },
338
+ "TagConditionNotTypeEnum": function() { return /* reexport */ TagConditionNotTypeEnum; },
339
+ "TagConditionOrTypeEnum": function() { return /* reexport */ TagConditionOrTypeEnum; },
340
+ "TagConditionTypeEnum": function() { return /* reexport */ TagConditionTypeEnum; },
341
+ "TextApiResponse": function() { return /* reexport */ TextApiResponse; },
342
+ "UnspecifiedFieldValueSetEnum": function() { return /* reexport */ UnspecifiedFieldValueSetEnum; },
343
+ "UpdatableFieldFolderDescriptionOrNullSetEnum": function() { return /* reexport */ UpdatableFieldFolderDescriptionOrNullSetEnum; },
344
+ "UpdatableFieldPublicPermissionsArrayOrNullSetEnum": function() { return /* reexport */ UpdatableFieldPublicPermissionsArrayOrNullSetEnum; },
345
+ "UpdatableFieldStorageLayerUpdateOrNullSetEnum": function() { return /* reexport */ UpdatableFieldStorageLayerUpdateOrNullSetEnum; },
346
+ "UploadApi": function() { return /* reexport */ UploadApi; },
347
+ "UploadApiError": function() { return /* reexport */ UploadApiError; },
348
+ "UploadManager": function() { return /* reexport */ UploadManager; },
349
+ "VoidApiResponse": function() { return /* reexport */ VoidApiResponse; },
350
+ "WebStorageTypeEnum": function() { return /* reexport */ WebStorageTypeEnum; },
351
+ "canConsumeForm": function() { return /* reexport */ canConsumeForm; },
352
+ "querystring": function() { return /* reexport */ querystring; }
353
+ });
354
+
355
+ ;// CONCATENATED MODULE: ./src/gen/runtime.ts
356
+ 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); }
357
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
358
+ 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); }
359
+ 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); }; }
360
+ 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); }
361
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
362
+ 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); }
363
+ 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); }
364
+ function _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; } }
365
+ function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
366
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
367
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
368
+ function _invoke(body, then) {
369
+ var result = body();
370
+ if (result && result.then) {
371
+ return result.then(then);
372
+ }
373
+ return then(result);
374
+ }
375
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
376
+ 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."); }
377
+ 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); }
378
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
379
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
380
+ 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; }
381
+ function _await(value, then, direct) {
382
+ if (direct) {
383
+ return then ? then(value) : value;
384
+ }
385
+ if (!value || !value.then) {
386
+ value = Promise.resolve(value);
387
+ }
388
+ return then ? value.then(then) : value;
389
+ }
390
+ function _empty() {}
391
+ function _invokeIgnored(body) {
392
+ var result = body();
393
+ if (result && result.then) {
394
+ return result.then(_empty);
395
+ }
396
+ }
397
+ var _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator")) : "@@iterator";
398
+ function _settle(pact, state, value) {
399
+ if (!pact.s) {
400
+ if (value instanceof _Pact) {
401
+ if (value.s) {
402
+ if (state & 1) {
403
+ state = value.s;
404
+ }
405
+ value = value.v;
406
+ } else {
407
+ value.o = _settle.bind(null, pact, state);
408
+ return;
409
+ }
410
+ }
411
+ if (value && value.then) {
412
+ value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
413
+ return;
414
+ }
415
+ pact.s = state;
416
+ pact.v = value;
417
+ var observer = pact.o;
418
+ if (observer) {
419
+ observer(pact);
420
+ }
421
+ }
422
+ }
423
+ var _Pact = /*#__PURE__*/function () {
424
+ function _Pact() {}
425
+ _Pact.prototype.then = function (onFulfilled, onRejected) {
426
+ var result = new _Pact();
427
+ var state = this.s;
428
+ if (state) {
429
+ var callback = state & 1 ? onFulfilled : onRejected;
430
+ if (callback) {
431
+ try {
432
+ _settle(result, 1, callback(this.v));
433
+ } catch (e) {
434
+ _settle(result, 2, e);
435
+ }
436
+ return result;
437
+ } else {
438
+ return this;
439
+ }
440
+ }
441
+ this.o = function (_this) {
442
+ try {
443
+ var value = _this.v;
444
+ if (_this.s & 1) {
445
+ _settle(result, 1, onFulfilled ? onFulfilled(value) : value);
446
+ } else if (onRejected) {
447
+ _settle(result, 1, onRejected(value));
448
+ } else {
449
+ _settle(result, 2, value);
450
+ }
451
+ } catch (e) {
452
+ _settle(result, 2, e);
453
+ }
454
+ };
455
+ return result;
456
+ };
457
+ return _Pact;
458
+ }();
459
+ function _isSettledPact(thenable) {
460
+ return thenable instanceof _Pact && thenable.s & 1;
461
+ }
462
+ function _forTo(array, body, check) {
463
+ var i = -1,
464
+ pact,
465
+ reject;
466
+ function _cycle(result) {
467
+ try {
468
+ while (++i < array.length && (!check || !check())) {
469
+ result = body(i);
470
+ if (result && result.then) {
471
+ if (_isSettledPact(result)) {
472
+ result = result.v;
473
+ } else {
474
+ result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
475
+ return;
476
+ }
477
+ }
478
+ }
479
+ if (pact) {
480
+ _settle(pact, 1, result);
481
+ } else {
482
+ pact = result;
483
+ }
484
+ } catch (e) {
485
+ _settle(pact || (pact = new _Pact()), 2, e);
486
+ }
487
+ }
488
+ _cycle();
489
+ return pact;
490
+ }
491
+ function _forOf(target, body, check) {
492
+ if (typeof target[_iteratorSymbol] === "function") {
493
+ var _cycle = function _cycle(result) {
494
+ try {
495
+ while (!(step = iterator.next()).done && (!check || !check())) {
496
+ result = body(step.value);
497
+ if (result && result.then) {
498
+ if (_isSettledPact(result)) {
499
+ result = result.v;
500
+ } else {
501
+ result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
502
+ return;
503
+ }
504
+ }
505
+ }
506
+ if (pact) {
507
+ _settle(pact, 1, result);
508
+ } else {
509
+ pact = result;
510
+ }
511
+ } catch (e) {
512
+ _settle(pact || (pact = new _Pact()), 2, e);
513
+ }
514
+ };
515
+ var iterator = target[_iteratorSymbol](),
516
+ step,
517
+ pact,
518
+ reject;
519
+ _cycle();
520
+ if (iterator["return"]) {
521
+ var _fixup = function _fixup(value) {
522
+ try {
523
+ if (!step.done) {
524
+ iterator["return"]();
525
+ }
526
+ } catch (e) {}
527
+ return value;
528
+ };
529
+ if (pact && pact.then) {
530
+ return pact.then(_fixup, function (e) {
531
+ throw _fixup(e);
532
+ });
533
+ }
534
+ _fixup();
535
+ }
536
+ return pact;
537
+ }
538
+ // No support for Symbol.iterator
539
+ if (!("length" in target)) {
540
+ throw new TypeError("Object is not iterable");
541
+ }
542
+ // Handle live collections properly
543
+ var values = [];
544
+ for (var i = 0; i < target.length; i++) {
545
+ values.push(target[i]);
546
+ }
547
+ return _forTo(values, function (i) {
548
+ return body(values[i]);
549
+ }, check);
550
+ }
551
+ function _continue(value, then) {
552
+ return value && value.then ? value.then(then) : then(value);
553
+ }
554
+ function _catch(body, recover) {
555
+ try {
556
+ var result = body();
557
+ } catch (e) {
558
+ return recover(e);
559
+ }
560
+ if (result && result.then) {
561
+ return result.then(void 0, recover);
562
+ }
563
+ return result;
564
+ }
565
+ function _async(f) {
566
+ return function () {
567
+ for (var args = [], i = 0; i < arguments.length; i++) {
568
+ args[i] = arguments[i];
569
+ }
570
+ try {
571
+ return Promise.resolve(f.apply(this, args));
572
+ } catch (e) {
573
+ return Promise.reject(e);
574
+ }
575
+ };
576
+ }
577
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
578
+ 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); } }
579
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
580
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
581
+ 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); }
582
+ /**
583
+ * @bytescale/bytescale-api
584
+ * Bytescale API
585
+ *
586
+ * The version of the OpenAPI document: 2.0.0
587
+ * Contact: hello@bytescale.com
588
+ *
589
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
590
+ * https://openapi-generator.tech
591
+ * Do not edit the class manually.
592
+ */
593
+ var BASE_PATH = "https://api.bytescale.com".replace(/\/+$/, "");
594
+ var Configuration = /*#__PURE__*/function () {
595
+ function Configuration() {
596
+ var configuration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
597
+ _classCallCheck(this, Configuration);
598
+ this.configuration = configuration;
599
+ }
600
+ _createClass(Configuration, [{
601
+ key: "config",
602
+ set: function set(configuration) {
603
+ this.configuration = configuration;
604
+ }
605
+ }, {
606
+ key: "basePath",
607
+ get: function get() {
608
+ return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
609
+ }
610
+ }, {
611
+ key: "fetchApi",
612
+ get: function get() {
613
+ return this.configuration.fetchApi;
614
+ }
615
+ }, {
616
+ key: "middleware",
617
+ get: function get() {
618
+ return this.configuration.middleware || [];
619
+ }
620
+ }, {
621
+ key: "queryParamsStringify",
622
+ get: function get() {
623
+ return this.configuration.queryParamsStringify || querystring;
624
+ }
625
+ }, {
626
+ key: "username",
627
+ get: function get() {
628
+ return this.configuration.username;
629
+ }
630
+ }, {
631
+ key: "password",
632
+ get: function get() {
633
+ return this.configuration.password;
634
+ }
635
+ }, {
636
+ key: "apiKey",
637
+ get: function get() {
638
+ var apiKey = this.configuration.apiKey;
639
+ if (apiKey) {
640
+ return typeof apiKey === "function" ? apiKey : function (name) {
641
+ return name === "Authorization" ? "Bearer ".concat(apiKey) : apiKey;
642
+ };
643
+ }
644
+ return undefined;
645
+ }
646
+ }, {
647
+ key: "accessToken",
648
+ get: function get() {
649
+ var accessToken = this.configuration.accessToken;
650
+ if (accessToken) {
651
+ return typeof accessToken === "function" ? accessToken : function () {
652
+ return _await(accessToken);
653
+ };
654
+ }
655
+ return undefined;
656
+ }
657
+ }, {
658
+ key: "headers",
659
+ get: function get() {
660
+ return this.configuration.headers;
661
+ }
662
+ }, {
663
+ key: "credentials",
664
+ get: function get() {
665
+ return this.configuration.credentials;
666
+ }
667
+ }]);
668
+ return Configuration;
669
+ }();
670
+ var DefaultConfig = new Configuration();
671
+ /**
672
+ * This is the base class for all generated API classes.
673
+ */
674
+ var BaseAPI = /*#__PURE__*/function () {
675
+ function BaseAPI() {
676
+ var _this = this;
677
+ var configuration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DefaultConfig;
678
+ _classCallCheck(this, BaseAPI);
679
+ this.configuration = configuration;
680
+ this.fetchApi = _async(function (url, init) {
681
+ var fetchParams = {
682
+ url: url,
683
+ init: init
684
+ };
685
+ return _continue(_forOf(_this.middleware, function (middleware) {
686
+ return _invokeIgnored(function () {
687
+ if (middleware.pre) {
688
+ return _await(middleware.pre(Object.assign({
689
+ fetch: _this.fetchApi
690
+ }, fetchParams)), function (_middleware$pre) {
691
+ fetchParams = _middleware$pre || fetchParams;
692
+ });
693
+ }
694
+ });
695
+ }), function () {
696
+ var _exit = false;
697
+ var response = undefined;
698
+ return _continue(_catch(function () {
699
+ return _await((_this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init), function (_temp) {
700
+ response = _temp;
701
+ });
702
+ }, function (e) {
703
+ return _continue(_forOf(_this.middleware, function (middleware) {
704
+ return _invokeIgnored(function () {
705
+ if (middleware.onError) {
706
+ return _await(middleware.onError({
707
+ fetch: _this.fetchApi,
708
+ url: fetchParams.url,
709
+ init: fetchParams.init,
710
+ error: e,
711
+ response: response ? response.clone() : undefined
712
+ }), function (_middleware$onError) {
713
+ response = _middleware$onError || response;
714
+ });
715
+ }
716
+ });
717
+ }), function () {
718
+ if (response === undefined) {
719
+ if (e instanceof Error) {
720
+ throw new FetchError(e, "The request failed and the interceptors did not return an alternative response");
721
+ } else {
722
+ throw e;
723
+ }
724
+ }
725
+ });
726
+ }), function (_result) {
727
+ return _exit ? _result : _continue(_forOf(_this.middleware, function (middleware) {
728
+ return _invokeIgnored(function () {
729
+ if (middleware.post) {
730
+ return _await(middleware.post({
731
+ fetch: _this.fetchApi,
732
+ url: fetchParams.url,
733
+ init: fetchParams.init,
734
+ response: response.clone()
735
+ }), function (_middleware$post) {
736
+ response = _middleware$post || response;
737
+ });
738
+ }
739
+ });
740
+ }), function () {
741
+ return response;
742
+ });
743
+ });
744
+ });
745
+ });
746
+ this.middleware = configuration.middleware;
747
+ }
748
+ _createClass(BaseAPI, [{
749
+ key: "withMiddleware",
750
+ value: function withMiddleware() {
751
+ var _next$middleware;
752
+ var next = this.clone();
753
+ next.middleware = (_next$middleware = next.middleware).concat.apply(_next$middleware, arguments);
754
+ return next;
755
+ }
756
+ }, {
757
+ key: "withPreMiddleware",
758
+ value: function withPreMiddleware() {
759
+ for (var _len = arguments.length, preMiddlewares = new Array(_len), _key = 0; _key < _len; _key++) {
760
+ preMiddlewares[_key] = arguments[_key];
761
+ }
762
+ var middlewares = preMiddlewares.map(function (pre) {
763
+ return {
764
+ pre: pre
765
+ };
766
+ });
767
+ return this.withMiddleware.apply(this, _toConsumableArray(middlewares));
768
+ }
769
+ }, {
770
+ key: "withPostMiddleware",
771
+ value: function withPostMiddleware() {
772
+ for (var _len2 = arguments.length, postMiddlewares = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
773
+ postMiddlewares[_key2] = arguments[_key2];
774
+ }
775
+ var middlewares = postMiddlewares.map(function (post) {
776
+ return {
777
+ post: post
778
+ };
779
+ });
780
+ return this.withMiddleware.apply(this, _toConsumableArray(middlewares));
781
+ }
782
+ }, {
783
+ key: "request",
784
+ value: function request(context, initOverrides, operationBasePathOverride) {
785
+ try {
786
+ var _this3 = this;
787
+ var _a;
788
+ return _await(_this3.createFetchParams(context, initOverrides, operationBasePathOverride), function (_ref) {
789
+ var url = _ref.url,
790
+ init = _ref.init;
791
+ return _await(_this3.fetchApi(url, init), function (response) {
792
+ var _exit2 = false;
793
+ return response && response.status >= 200 && response.status < 300 ? response : _invoke(function () {
794
+ if (response !== undefined) {
795
+ var jsonError = undefined;
796
+ return _continue(_catch(function () {
797
+ return _await(response.json(), function (_response$json) {
798
+ jsonError = _response$json;
799
+ });
800
+ }, _empty), function () {
801
+ if (typeof ((_a = jsonError === null || jsonError === void 0 ? void 0 : jsonError.error) === null || _a === void 0 ? void 0 : _a.code) === "string") {
802
+ throw new UploadApiError(jsonError);
803
+ }
804
+ });
805
+ }
806
+ }, function (_result2) {
807
+ if (_exit2) return _result2;
808
+ throw new ResponseError(response, "Response returned an error code");
809
+ });
810
+ });
811
+ });
812
+ } catch (e) {
813
+ return Promise.reject(e);
814
+ }
815
+ }
816
+ }, {
817
+ key: "createFetchParams",
818
+ value: function createFetchParams(context, initOverrides, operationBasePathOverride) {
819
+ try {
820
+ var _this5 = this;
821
+ var url = (operationBasePathOverride !== null && operationBasePathOverride !== void 0 ? operationBasePathOverride : _this5.configuration.basePath) + context.path;
822
+ if (context.query !== undefined && Object.keys(context.query).length !== 0) {
823
+ // only add the querystring to the URL if there are query parameters.
824
+ // this is done to avoid urls ending with a "?" character which buggy webservers
825
+ // do not handle correctly sometimes.
826
+ url += "?" + _this5.configuration.queryParamsStringify(context.query);
827
+ }
828
+ var headers = Object.assign({}, _this5.configuration.headers, context.headers);
829
+ Object.keys(headers).forEach(function (key) {
830
+ return headers[key] === undefined ? delete headers[key] : {};
831
+ });
832
+ var initOverrideFn = typeof initOverrides === "function" ? initOverrides : function () {
833
+ return _await(initOverrides);
834
+ };
835
+ var initParams = {
836
+ method: context.method,
837
+ headers: headers,
838
+ body: context.body,
839
+ credentials: _this5.configuration.credentials
840
+ };
841
+ var _Object$assign2 = Object.assign({}, initParams);
842
+ return _await(initOverrideFn({
843
+ init: initParams,
844
+ context: context
845
+ }), function (_initOverrideFn) {
846
+ var overriddenInit = Object.assign(_Object$assign2, _initOverrideFn);
847
+ var init = Object.assign(Object.assign({}, overriddenInit), {
848
+ body: isFormData(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob(overriddenInit.body) ? overriddenInit.body : JSON.stringify(overriddenInit.body)
849
+ });
850
+ return {
851
+ url: url,
852
+ init: init
853
+ };
854
+ });
855
+ } catch (e) {
856
+ return Promise.reject(e);
857
+ }
858
+ }
859
+ /**
860
+ * Create a shallow clone of `this` by constructing a new instance
861
+ * and then shallow cloning data members.
862
+ */
863
+ }, {
864
+ key: "clone",
865
+ value: function clone() {
866
+ var constructor = this.constructor;
867
+ var next = new constructor(this.configuration);
868
+ next.middleware = this.middleware.slice();
869
+ return next;
870
+ }
871
+ }]);
872
+ return BaseAPI;
873
+ }();
874
+ function isBlob(value) {
875
+ return typeof Blob !== "undefined" && value instanceof Blob;
876
+ }
877
+ function isFormData(value) {
878
+ return typeof FormData !== "undefined" && value instanceof FormData;
879
+ }
880
+ var UploadApiError = /*#__PURE__*/function (_Error) {
881
+ _inherits(UploadApiError, _Error);
882
+ var _super = _createSuper(UploadApiError);
883
+ function UploadApiError(response) {
884
+ var _this6;
885
+ _classCallCheck(this, UploadApiError);
886
+ _this6 = _super.call(this, response.error.message);
887
+ _this6.name = "UploadApiError";
888
+ _this6.errorCode = response.error.code;
889
+ _this6.details = response.error.details;
890
+ return _this6;
891
+ }
892
+ return _createClass(UploadApiError);
893
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
894
+ var ResponseError = /*#__PURE__*/function (_Error2) {
895
+ _inherits(ResponseError, _Error2);
896
+ var _super2 = _createSuper(ResponseError);
897
+ function ResponseError(response, msg) {
898
+ var _this7;
899
+ _classCallCheck(this, ResponseError);
900
+ _this7 = _super2.call(this, msg);
901
+ _this7.response = response;
902
+ _this7.name = "ResponseError";
903
+ return _this7;
904
+ }
905
+ return _createClass(ResponseError);
906
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
907
+ var FetchError = /*#__PURE__*/function (_Error3) {
908
+ _inherits(FetchError, _Error3);
909
+ var _super3 = _createSuper(FetchError);
910
+ function FetchError(cause, msg) {
911
+ var _this8;
912
+ _classCallCheck(this, FetchError);
913
+ _this8 = _super3.call(this, msg);
914
+ _this8.cause = cause;
915
+ _this8.name = "FetchError";
916
+ return _this8;
917
+ }
918
+ return _createClass(FetchError);
919
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
920
+ var RequiredError = /*#__PURE__*/function (_Error4) {
921
+ _inherits(RequiredError, _Error4);
922
+ var _super4 = _createSuper(RequiredError);
923
+ function RequiredError(field, msg) {
924
+ var _this9;
925
+ _classCallCheck(this, RequiredError);
926
+ _this9 = _super4.call(this, msg);
927
+ _this9.field = field;
928
+ _this9.name = "RequiredError";
929
+ return _this9;
930
+ }
931
+ return _createClass(RequiredError);
932
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
933
+ var COLLECTION_FORMATS = {
934
+ csv: ",",
935
+ ssv: " ",
936
+ tsv: "\t",
937
+ pipes: "|"
938
+ };
939
+ function querystring(params) {
940
+ var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
941
+ return Object.keys(params).map(function (key) {
942
+ return querystringSingleKey(key, params[key], prefix);
943
+ }).filter(function (part) {
944
+ return part.length > 0;
945
+ }).join("&");
946
+ }
947
+ function querystringSingleKey(key, value) {
948
+ var keyPrefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
949
+ var fullKey = keyPrefix + (keyPrefix.length ? "[".concat(key, "]") : key);
950
+ if (value instanceof Array) {
951
+ var multiValue = value.map(function (singleValue) {
952
+ return encodeURIComponent(String(singleValue));
953
+ }).join("&".concat(encodeURIComponent(fullKey), "="));
954
+ return "".concat(encodeURIComponent(fullKey), "=").concat(multiValue);
955
+ }
956
+ if (value instanceof Set) {
957
+ var valueAsArray = Array.from(value);
958
+ return querystringSingleKey(key, valueAsArray, keyPrefix);
959
+ }
960
+ if (value instanceof Date) {
961
+ return "".concat(encodeURIComponent(fullKey), "=").concat(encodeURIComponent(value.toISOString()));
962
+ }
963
+ if (value instanceof Object) {
964
+ return querystring(value, fullKey);
965
+ }
966
+ return "".concat(encodeURIComponent(fullKey), "=").concat(encodeURIComponent(String(value)));
967
+ }
968
+ function canConsumeForm(consumes) {
969
+ var _iterator = _createForOfIteratorHelper(consumes),
970
+ _step;
971
+ try {
972
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
973
+ var consume = _step.value;
974
+ if ("multipart/form-data" === consume.contentType) {
975
+ return true;
976
+ }
977
+ }
978
+ } catch (err) {
979
+ _iterator.e(err);
980
+ } finally {
981
+ _iterator.f();
982
+ }
983
+ return false;
984
+ }
985
+ var JSONApiResponse = /*#__PURE__*/function () {
986
+ function JSONApiResponse(raw) {
987
+ var transformer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (jsonValue) {
988
+ return jsonValue;
989
+ };
990
+ _classCallCheck(this, JSONApiResponse);
991
+ this.raw = raw;
992
+ this.transformer = transformer;
993
+ }
994
+ _createClass(JSONApiResponse, [{
995
+ key: "value",
996
+ value: function value() {
997
+ try {
998
+ var _this11 = this;
999
+ var _transformer2 = _this11.transformer;
1000
+ return _await(_this11.raw.json(), function (_this10$raw$json) {
1001
+ return _transformer2.call(_this11, _this10$raw$json);
1002
+ });
1003
+ } catch (e) {
1004
+ return Promise.reject(e);
1005
+ }
1006
+ }
1007
+ }]);
1008
+ return JSONApiResponse;
1009
+ }();
1010
+ var VoidApiResponse = /*#__PURE__*/function () {
1011
+ function VoidApiResponse(raw) {
1012
+ _classCallCheck(this, VoidApiResponse);
1013
+ this.raw = raw;
1014
+ }
1015
+ _createClass(VoidApiResponse, [{
1016
+ key: "value",
1017
+ value: function value() {
1018
+ return _await(undefined);
1019
+ }
1020
+ }]);
1021
+ return VoidApiResponse;
1022
+ }();
1023
+ var BinaryResult = /*#__PURE__*/function () {
1024
+ function BinaryResult(raw) {
1025
+ _classCallCheck(this, BinaryResult);
1026
+ this.raw = raw;
1027
+ }
1028
+ _createClass(BinaryResult, [{
1029
+ key: "stream",
1030
+ value: function stream() {
1031
+ if (this.raw.bodyUsed) {
1032
+ throw new Error("Response body has already been consumed.");
1033
+ }
1034
+ if (this.raw.body === null) {
1035
+ throw new Error("Response body does not exist.");
1036
+ }
1037
+ return this.raw.body;
1038
+ }
1039
+ }, {
1040
+ key: "text",
1041
+ value: function text() {
1042
+ try {
1043
+ var _this13 = this;
1044
+ return _await(_this13.raw.text());
1045
+ } catch (e) {
1046
+ return Promise.reject(e);
1047
+ }
1048
+ }
1049
+ }, {
1050
+ key: "blob",
1051
+ value: function blob() {
1052
+ try {
1053
+ var _this15 = this;
1054
+ return _await(_this15.raw.blob());
1055
+ } catch (e) {
1056
+ return Promise.reject(e);
1057
+ }
1058
+ }
1059
+ }, {
1060
+ key: "json",
1061
+ value: function json() {
1062
+ try {
1063
+ var _this17 = this;
1064
+ return _await(_this17.raw.json());
1065
+ } catch (e) {
1066
+ return Promise.reject(e);
1067
+ }
1068
+ }
1069
+ }]);
1070
+ return BinaryResult;
1071
+ }();
1072
+ var TextApiResponse = /*#__PURE__*/function () {
1073
+ function TextApiResponse(raw) {
1074
+ _classCallCheck(this, TextApiResponse);
1075
+ this.raw = raw;
1076
+ }
1077
+ _createClass(TextApiResponse, [{
1078
+ key: "value",
1079
+ value: function value() {
1080
+ try {
1081
+ var _this19 = this;
1082
+ return _await(_this19.raw.text());
1083
+ } catch (e) {
1084
+ return Promise.reject(e);
1085
+ }
1086
+ }
1087
+ }]);
1088
+ return TextApiResponse;
1089
+ }();
1090
+ ;// CONCATENATED MODULE: ./src/gen/apis/FileApi.ts
1091
+ 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); }
1092
+ function FileApi_await(value, then, direct) {
1093
+ if (direct) {
1094
+ return then ? then(value) : value;
1095
+ }
1096
+ if (!value || !value.then) {
1097
+ value = Promise.resolve(value);
1098
+ }
1099
+ return then ? value.then(then) : value;
1100
+ }
1101
+ function FileApi_empty() {}
1102
+ function _awaitIgnored(value, direct) {
1103
+ if (!direct) {
1104
+ return value && value.then ? value.then(FileApi_empty) : Promise.resolve();
1105
+ }
1106
+ }
1107
+ function FileApi_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1108
+ function FileApi_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, FileApi_toPropertyKey(descriptor.key), descriptor); } }
1109
+ function FileApi_createClass(Constructor, protoProps, staticProps) { if (protoProps) FileApi_defineProperties(Constructor.prototype, protoProps); if (staticProps) FileApi_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
1110
+ function FileApi_toPropertyKey(arg) { var key = FileApi_toPrimitive(arg, "string"); return FileApi_typeof(key) === "symbol" ? key : String(key); }
1111
+ function FileApi_toPrimitive(input, hint) { if (FileApi_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (FileApi_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1112
+ function FileApi_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) FileApi_setPrototypeOf(subClass, superClass); }
1113
+ function FileApi_setPrototypeOf(o, p) { FileApi_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return FileApi_setPrototypeOf(o, p); }
1114
+ function FileApi_createSuper(Derived) { var hasNativeReflectConstruct = FileApi_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = FileApi_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = FileApi_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return FileApi_possibleConstructorReturn(this, result); }; }
1115
+ function FileApi_possibleConstructorReturn(self, call) { if (call && (FileApi_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 FileApi_assertThisInitialized(self); }
1116
+ function FileApi_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1117
+ function FileApi_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; } }
1118
+ function FileApi_getPrototypeOf(o) { FileApi_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return FileApi_getPrototypeOf(o); }
1119
+ /* tslint:disable */
1120
+ /* eslint-disable */
1121
+ /**
1122
+ * @bytescale/bytescale-api
1123
+ * Bytescale API
1124
+ *
1125
+ * The version of the OpenAPI document: 2.0.0
1126
+ * Contact: hello@bytescale.com
1127
+ *
1128
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1129
+ * https://openapi-generator.tech
1130
+ * Do not edit the class manually.
1131
+ */
1132
+ // @ts-ignore
1133
+
1134
+ /**
1135
+ *
1136
+ */
1137
+ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1138
+ FileApi_inherits(FileApi, _runtime$BaseAPI);
1139
+ var _super = FileApi_createSuper(FileApi);
1140
+ function FileApi() {
1141
+ FileApi_classCallCheck(this, FileApi);
1142
+ return _super.apply(this, arguments);
1143
+ }
1144
+ FileApi_createClass(FileApi, [{
1145
+ key: "copyFileWithHttpInfo",
1146
+ value:
1147
+ /**
1148
+ * Copies a file synchronously.
1149
+ */
1150
+ function copyFileWithHttpInfo(requestParameters, initOverrides) {
1151
+ try {
1152
+ var _this2 = this;
1153
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
1154
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling copyFile.");
1155
+ }
1156
+ if (requestParameters.copyFileRequest === null || requestParameters.copyFileRequest === undefined) {
1157
+ throw new RequiredError("copyFileRequest", "Required parameter requestParameters.copyFileRequest was null or undefined when calling copyFile.");
1158
+ }
1159
+ var queryParameters = {};
1160
+ var headerParameters = {};
1161
+ headerParameters["Content-Type"] = "application/json";
1162
+ if (_this2.configuration && _this2.configuration.apiKey) {
1163
+ headerParameters["Authorization"] = _this2.configuration.apiKey("Authorization"); // authorization-header authentication
1164
+ }
1165
+
1166
+ var operationBasePathOverride = [][0];
1167
+ return FileApi_await(_this2.request({
1168
+ path: "/v2/accounts/{accountId}/files/copy".replace("{".concat("accountId", "}"),
1169
+ // @ts-ignore
1170
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))),
1171
+ method: "POST",
1172
+ headers: headerParameters,
1173
+ query: queryParameters,
1174
+ body: requestParameters.copyFileRequest
1175
+ }, initOverrides, operationBasePathOverride), function (response) {
1176
+ return new JSONApiResponse(response);
1177
+ });
1178
+ } catch (e) {
1179
+ return Promise.reject(e);
1180
+ }
1181
+ }
1182
+ /**
1183
+ * Copies a file synchronously.
1184
+ */
1185
+ }, {
1186
+ key: "copyFile",
1187
+ value: function copyFile(requestParameters, initOverrides) {
1188
+ try {
1189
+ var _this4 = this;
1190
+ return FileApi_await(_this4.copyFileWithHttpInfo(requestParameters, initOverrides), function (response) {
1191
+ return FileApi_await(response.value());
1192
+ });
1193
+ } catch (e) {
1194
+ return Promise.reject(e);
1195
+ }
1196
+ }
1197
+ /**
1198
+ * Copies multiple files asynchronously.
1199
+ */
1200
+ }, {
1201
+ key: "copyFileBatchWithHttpInfo",
1202
+ value: function copyFileBatchWithHttpInfo(requestParameters, initOverrides) {
1203
+ try {
1204
+ var _this6 = this;
1205
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
1206
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling copyFileBatch.");
1207
+ }
1208
+ if (requestParameters.copyFileBatchRequest === null || requestParameters.copyFileBatchRequest === undefined) {
1209
+ throw new RequiredError("copyFileBatchRequest", "Required parameter requestParameters.copyFileBatchRequest was null or undefined when calling copyFileBatch.");
1210
+ }
1211
+ var queryParameters = {};
1212
+ var headerParameters = {};
1213
+ headerParameters["Content-Type"] = "application/json";
1214
+ if (_this6.configuration && _this6.configuration.apiKey) {
1215
+ headerParameters["Authorization"] = _this6.configuration.apiKey("Authorization"); // authorization-header authentication
1216
+ }
1217
+
1218
+ var operationBasePathOverride = [][0];
1219
+ return FileApi_await(_this6.request({
1220
+ path: "/v2/accounts/{accountId}/files/copy/batch".replace("{".concat("accountId", "}"),
1221
+ // @ts-ignore
1222
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))),
1223
+ method: "POST",
1224
+ headers: headerParameters,
1225
+ query: queryParameters,
1226
+ body: requestParameters.copyFileBatchRequest
1227
+ }, initOverrides, operationBasePathOverride), function (response) {
1228
+ return new JSONApiResponse(response);
1229
+ });
1230
+ } catch (e) {
1231
+ return Promise.reject(e);
1232
+ }
1233
+ }
1234
+ /**
1235
+ * Copies multiple files asynchronously.
1236
+ */
1237
+ }, {
1238
+ key: "copyFileBatch",
1239
+ value: function copyFileBatch(requestParameters, initOverrides) {
1240
+ try {
1241
+ var _this8 = this;
1242
+ return FileApi_await(_this8.copyFileBatchWithHttpInfo(requestParameters, initOverrides), function (response) {
1243
+ return FileApi_await(response.value());
1244
+ });
1245
+ } catch (e) {
1246
+ return Promise.reject(e);
1247
+ }
1248
+ }
1249
+ /**
1250
+ * Deletes a file synchronously.
1251
+ */
1252
+ }, {
1253
+ key: "deleteFileWithHttpInfo",
1254
+ value: function deleteFileWithHttpInfo(requestParameters, initOverrides) {
1255
+ try {
1256
+ var _this10 = this;
1257
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
1258
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling deleteFile.");
1259
+ }
1260
+ if (requestParameters.filePath === null || requestParameters.filePath === undefined) {
1261
+ throw new RequiredError("filePath", "Required parameter requestParameters.filePath was null or undefined when calling deleteFile.");
1262
+ }
1263
+ var queryParameters = {};
1264
+ if (requestParameters.filePath !== undefined) {
1265
+ queryParameters["filePath"] = requestParameters.filePath;
1266
+ }
1267
+ var headerParameters = {};
1268
+ if (_this10.configuration && _this10.configuration.apiKey) {
1269
+ headerParameters["Authorization"] = _this10.configuration.apiKey("Authorization"); // authorization-header authentication
1270
+ }
1271
+
1272
+ var operationBasePathOverride = [][0];
1273
+ return FileApi_await(_this10.request({
1274
+ path: "/v2/accounts/{accountId}/files".replace("{".concat("accountId", "}"),
1275
+ // @ts-ignore
1276
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))),
1277
+ method: "DELETE",
1278
+ headers: headerParameters,
1279
+ query: queryParameters
1280
+ }, initOverrides, operationBasePathOverride), function (response) {
1281
+ return new VoidApiResponse(response);
1282
+ });
1283
+ } catch (e) {
1284
+ return Promise.reject(e);
1285
+ }
1286
+ }
1287
+ /**
1288
+ * Deletes a file synchronously.
1289
+ */
1290
+ }, {
1291
+ key: "deleteFile",
1292
+ value: function deleteFile(requestParameters, initOverrides) {
1293
+ try {
1294
+ var _this12 = this;
1295
+ return _awaitIgnored(_this12.deleteFileWithHttpInfo(requestParameters, initOverrides));
1296
+ } catch (e) {
1297
+ return Promise.reject(e);
1298
+ }
1299
+ }
1300
+ /**
1301
+ * Deletes multiple files asynchronously.
1302
+ */
1303
+ }, {
1304
+ key: "deleteFileBatchWithHttpInfo",
1305
+ value: function deleteFileBatchWithHttpInfo(requestParameters, initOverrides) {
1306
+ try {
1307
+ var _this14 = this;
1308
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
1309
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling deleteFileBatch.");
1310
+ }
1311
+ if (requestParameters.deleteFileBatchRequest === null || requestParameters.deleteFileBatchRequest === undefined) {
1312
+ throw new RequiredError("deleteFileBatchRequest", "Required parameter requestParameters.deleteFileBatchRequest was null or undefined when calling deleteFileBatch.");
1313
+ }
1314
+ var queryParameters = {};
1315
+ var headerParameters = {};
1316
+ headerParameters["Content-Type"] = "application/json";
1317
+ if (_this14.configuration && _this14.configuration.apiKey) {
1318
+ headerParameters["Authorization"] = _this14.configuration.apiKey("Authorization"); // authorization-header authentication
1319
+ }
1320
+
1321
+ var operationBasePathOverride = [][0];
1322
+ return FileApi_await(_this14.request({
1323
+ path: "/v2/accounts/{accountId}/files/batch".replace("{".concat("accountId", "}"),
1324
+ // @ts-ignore
1325
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))),
1326
+ method: "DELETE",
1327
+ headers: headerParameters,
1328
+ query: queryParameters,
1329
+ body: requestParameters.deleteFileBatchRequest
1330
+ }, initOverrides, operationBasePathOverride), function (response) {
1331
+ return new JSONApiResponse(response);
1332
+ });
1333
+ } catch (e) {
1334
+ return Promise.reject(e);
1335
+ }
1336
+ }
1337
+ /**
1338
+ * Deletes multiple files asynchronously.
1339
+ */
1340
+ }, {
1341
+ key: "deleteFileBatch",
1342
+ value: function deleteFileBatch(requestParameters, initOverrides) {
1343
+ try {
1344
+ var _this16 = this;
1345
+ return FileApi_await(_this16.deleteFileBatchWithHttpInfo(requestParameters, initOverrides), function (response) {
1346
+ return FileApi_await(response.value());
1347
+ });
1348
+ } catch (e) {
1349
+ return Promise.reject(e);
1350
+ }
1351
+ }
1352
+ /**
1353
+ * Downloads a file in its original/unprocessed state.
1354
+ */
1355
+ }, {
1356
+ key: "downloadFileWithHttpInfo",
1357
+ value: function downloadFileWithHttpInfo(requestParameters, initOverrides) {
1358
+ try {
1359
+ var _this18 = this;
1360
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
1361
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling downloadFile.");
1362
+ }
1363
+ if (requestParameters.filePath === null || requestParameters.filePath === undefined) {
1364
+ throw new RequiredError("filePath", "Required parameter requestParameters.filePath was null or undefined when calling downloadFile.");
1365
+ }
1366
+ var queryParameters = {};
1367
+ if (requestParameters.cache !== undefined) {
1368
+ queryParameters["cache"] = requestParameters.cache;
1369
+ }
1370
+ if (requestParameters.cacheTtl !== undefined) {
1371
+ queryParameters["cache_ttl"] = requestParameters.cacheTtl;
1372
+ }
1373
+ if (requestParameters.version !== undefined) {
1374
+ queryParameters["version"] = requestParameters.version;
1375
+ }
1376
+ var headerParameters = {};
1377
+ if (_this18.configuration && _this18.configuration.apiKey) {
1378
+ headerParameters["Authorization"] = _this18.configuration.apiKey("Authorization"); // authorization-header authentication
1379
+ }
1380
+
1381
+ var operationBasePathOverride = ["https://upcdn.io"][0];
1382
+ return FileApi_await(_this18.request({
1383
+ path: "/{accountId}/raw{filePath}".replace("{".concat("accountId", "}"),
1384
+ // @ts-ignore
1385
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))).replace("{".concat("filePath", "}"),
1386
+ // @ts-ignore
1387
+ true ? String(requestParameters.filePath) : 0),
1388
+ method: "GET",
1389
+ headers: headerParameters,
1390
+ query: queryParameters
1391
+ }, initOverrides, operationBasePathOverride), function (response) {
1392
+ return new BinaryResult(response);
1393
+ });
1394
+ } catch (e) {
1395
+ return Promise.reject(e);
1396
+ }
1397
+ }
1398
+ /**
1399
+ * Downloads a file in its original/unprocessed state.
1400
+ */
1401
+ }, {
1402
+ key: "downloadFile",
1403
+ value: function downloadFile(requestParameters, initOverrides) {
1404
+ try {
1405
+ var _this20 = this;
1406
+ return FileApi_await(_this20.downloadFileWithHttpInfo(requestParameters, initOverrides));
1407
+ } catch (e) {
1408
+ return Promise.reject(e);
1409
+ }
1410
+ }
1411
+ /**
1412
+ * Gets the full details (e.g. metadata, tags, etc.) for a file.
1413
+ */
1414
+ }, {
1415
+ key: "getFileDetailsWithHttpInfo",
1416
+ value: function getFileDetailsWithHttpInfo(requestParameters, initOverrides) {
1417
+ try {
1418
+ var _this22 = this;
1419
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
1420
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling getFileDetails.");
1421
+ }
1422
+ if (requestParameters.filePath === null || requestParameters.filePath === undefined) {
1423
+ throw new RequiredError("filePath", "Required parameter requestParameters.filePath was null or undefined when calling getFileDetails.");
1424
+ }
1425
+ var queryParameters = {};
1426
+ if (requestParameters.filePath !== undefined) {
1427
+ queryParameters["filePath"] = requestParameters.filePath;
1428
+ }
1429
+ var headerParameters = {};
1430
+ if (_this22.configuration && _this22.configuration.apiKey) {
1431
+ headerParameters["Authorization"] = _this22.configuration.apiKey("Authorization"); // authorization-header authentication
1432
+ }
1433
+
1434
+ var operationBasePathOverride = [][0];
1435
+ return FileApi_await(_this22.request({
1436
+ path: "/v2/accounts/{accountId}/files/details".replace("{".concat("accountId", "}"),
1437
+ // @ts-ignore
1438
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))),
1439
+ method: "GET",
1440
+ headers: headerParameters,
1441
+ query: queryParameters
1442
+ }, initOverrides, operationBasePathOverride), function (response) {
1443
+ return new JSONApiResponse(response);
1444
+ });
1445
+ } catch (e) {
1446
+ return Promise.reject(e);
1447
+ }
1448
+ }
1449
+ /**
1450
+ * Gets the full details (e.g. metadata, tags, etc.) for a file.
1451
+ */
1452
+ }, {
1453
+ key: "getFileDetails",
1454
+ value: function getFileDetails(requestParameters, initOverrides) {
1455
+ try {
1456
+ var _this24 = this;
1457
+ return FileApi_await(_this24.getFileDetailsWithHttpInfo(requestParameters, initOverrides), function (response) {
1458
+ return FileApi_await(response.value());
1459
+ });
1460
+ } catch (e) {
1461
+ return Promise.reject(e);
1462
+ }
1463
+ }
1464
+ /**
1465
+ * Processes a file and returns the result.
1466
+ */
1467
+ }, {
1468
+ key: "processFileWithHttpInfo",
1469
+ value: function processFileWithHttpInfo(requestParameters, initOverrides) {
1470
+ try {
1471
+ var _this26 = this;
1472
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
1473
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling processFile.");
1474
+ }
1475
+ if (requestParameters.filePath === null || requestParameters.filePath === undefined) {
1476
+ throw new RequiredError("filePath", "Required parameter requestParameters.filePath was null or undefined when calling processFile.");
1477
+ }
1478
+ if (requestParameters.transformation === null || requestParameters.transformation === undefined) {
1479
+ throw new RequiredError("transformation", "Required parameter requestParameters.transformation was null or undefined when calling processFile.");
1480
+ }
1481
+ var queryParameters = {};
1482
+ if (requestParameters.artifact !== undefined) {
1483
+ queryParameters["artifact"] = requestParameters.artifact;
1484
+ }
1485
+ if (requestParameters.cache !== undefined) {
1486
+ queryParameters["cache"] = requestParameters.cache;
1487
+ }
1488
+ if (requestParameters.cachePerm !== undefined) {
1489
+ queryParameters["cache_perm"] = requestParameters.cachePerm;
1490
+ }
1491
+ if (requestParameters.cacheTtl !== undefined) {
1492
+ queryParameters["cache_ttl"] = requestParameters.cacheTtl;
1493
+ }
1494
+ if (requestParameters.large !== undefined) {
1495
+ queryParameters["large"] = requestParameters.large;
1496
+ }
1497
+ if (requestParameters.version !== undefined) {
1498
+ queryParameters["version"] = requestParameters.version;
1499
+ }
1500
+ var headerParameters = {};
1501
+ if (_this26.configuration && _this26.configuration.apiKey) {
1502
+ headerParameters["Authorization"] = _this26.configuration.apiKey("Authorization"); // authorization-header authentication
1503
+ }
1504
+
1505
+ var operationBasePathOverride = ["https://upcdn.io"][0];
1506
+ return FileApi_await(_this26.request({
1507
+ path: "/{accountId}/{transformation}{filePath}".replace("{".concat("accountId", "}"),
1508
+ // @ts-ignore
1509
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))).replace("{".concat("filePath", "}"),
1510
+ // @ts-ignore
1511
+ true ? String(requestParameters.filePath) : 0).replace("{".concat("transformation", "}"),
1512
+ // @ts-ignore
1513
+ false ? 0 : encodeURIComponent(String(requestParameters.transformation))),
1514
+ method: "GET",
1515
+ headers: headerParameters,
1516
+ query: queryParameters
1517
+ }, initOverrides, operationBasePathOverride), function (response) {
1518
+ return new BinaryResult(response);
1519
+ });
1520
+ } catch (e) {
1521
+ return Promise.reject(e);
1522
+ }
1523
+ }
1524
+ /**
1525
+ * Processes a file and returns the result.
1526
+ */
1527
+ }, {
1528
+ key: "processFile",
1529
+ value: function processFile(requestParameters, initOverrides) {
1530
+ try {
1531
+ var _this28 = this;
1532
+ return FileApi_await(_this28.processFileWithHttpInfo(requestParameters, initOverrides));
1533
+ } catch (e) {
1534
+ return Promise.reject(e);
1535
+ }
1536
+ }
1537
+ /**
1538
+ * Processes a file and saves the result.
1539
+ */
1540
+ }, {
1541
+ key: "processFileAndSaveWithHttpInfo",
1542
+ value: function processFileAndSaveWithHttpInfo(requestParameters, initOverrides) {
1543
+ try {
1544
+ var _this30 = this;
1545
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
1546
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling processFileAndSave.");
1547
+ }
1548
+ if (requestParameters.filePath === null || requestParameters.filePath === undefined) {
1549
+ throw new RequiredError("filePath", "Required parameter requestParameters.filePath was null or undefined when calling processFileAndSave.");
1550
+ }
1551
+ if (requestParameters.transformation === null || requestParameters.transformation === undefined) {
1552
+ throw new RequiredError("transformation", "Required parameter requestParameters.transformation was null or undefined when calling processFileAndSave.");
1553
+ }
1554
+ if (requestParameters.processFileAndSaveRequest === null || requestParameters.processFileAndSaveRequest === undefined) {
1555
+ throw new RequiredError("processFileAndSaveRequest", "Required parameter requestParameters.processFileAndSaveRequest was null or undefined when calling processFileAndSave.");
1556
+ }
1557
+ var queryParameters = {};
1558
+ var headerParameters = {};
1559
+ headerParameters["Content-Type"] = "application/json";
1560
+ if (_this30.configuration && _this30.configuration.apiKey) {
1561
+ headerParameters["Authorization"] = _this30.configuration.apiKey("Authorization"); // authorization-header authentication
1562
+ }
1563
+
1564
+ var operationBasePathOverride = ["https://upcdn.io"][0];
1565
+ return FileApi_await(_this30.request({
1566
+ path: "/{accountId}/save/{transformation}{filePath}".replace("{".concat("accountId", "}"),
1567
+ // @ts-ignore
1568
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))).replace("{".concat("filePath", "}"),
1569
+ // @ts-ignore
1570
+ true ? String(requestParameters.filePath) : 0).replace("{".concat("transformation", "}"),
1571
+ // @ts-ignore
1572
+ false ? 0 : encodeURIComponent(String(requestParameters.transformation))),
1573
+ method: "POST",
1574
+ headers: headerParameters,
1575
+ query: queryParameters,
1576
+ body: requestParameters.processFileAndSaveRequest
1577
+ }, initOverrides, operationBasePathOverride), function (response) {
1578
+ return new JSONApiResponse(response);
1579
+ });
1580
+ } catch (e) {
1581
+ return Promise.reject(e);
1582
+ }
1583
+ }
1584
+ /**
1585
+ * Processes a file and saves the result.
1586
+ */
1587
+ }, {
1588
+ key: "processFileAndSave",
1589
+ value: function processFileAndSave(requestParameters, initOverrides) {
1590
+ try {
1591
+ var _this32 = this;
1592
+ return FileApi_await(_this32.processFileAndSaveWithHttpInfo(requestParameters, initOverrides), function (response) {
1593
+ return FileApi_await(response.value());
1594
+ });
1595
+ } catch (e) {
1596
+ return Promise.reject(e);
1597
+ }
1598
+ }
1599
+ }]);
1600
+ return FileApi;
1601
+ }(BaseAPI);
1602
+ /**
1603
+ * @export
1604
+ */
1605
+ var ProcessFileCachePermEnum = {
1606
+ Auto: "auto",
1607
+ False: "false",
1608
+ True: "true"
1609
+ };
1610
+ ;// CONCATENATED MODULE: ./src/gen/apis/FolderApi.ts
1611
+ 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); }
1612
+ function FolderApi_await(value, then, direct) {
1613
+ if (direct) {
1614
+ return then ? then(value) : value;
1615
+ }
1616
+ if (!value || !value.then) {
1617
+ value = Promise.resolve(value);
1618
+ }
1619
+ return then ? value.then(then) : value;
1620
+ }
1621
+ function FolderApi_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1622
+ function FolderApi_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, FolderApi_toPropertyKey(descriptor.key), descriptor); } }
1623
+ function FolderApi_createClass(Constructor, protoProps, staticProps) { if (protoProps) FolderApi_defineProperties(Constructor.prototype, protoProps); if (staticProps) FolderApi_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
1624
+ function FolderApi_toPropertyKey(arg) { var key = FolderApi_toPrimitive(arg, "string"); return FolderApi_typeof(key) === "symbol" ? key : String(key); }
1625
+ function FolderApi_toPrimitive(input, hint) { if (FolderApi_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (FolderApi_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1626
+ function FolderApi_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) FolderApi_setPrototypeOf(subClass, superClass); }
1627
+ function FolderApi_setPrototypeOf(o, p) { FolderApi_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return FolderApi_setPrototypeOf(o, p); }
1628
+ function FolderApi_createSuper(Derived) { var hasNativeReflectConstruct = FolderApi_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = FolderApi_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = FolderApi_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return FolderApi_possibleConstructorReturn(this, result); }; }
1629
+ function FolderApi_possibleConstructorReturn(self, call) { if (call && (FolderApi_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 FolderApi_assertThisInitialized(self); }
1630
+ function FolderApi_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1631
+ function FolderApi_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; } }
1632
+ function FolderApi_getPrototypeOf(o) { FolderApi_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return FolderApi_getPrototypeOf(o); }
1633
+ /* tslint:disable */
1634
+ /* eslint-disable */
1635
+ /**
1636
+ * @bytescale/bytescale-api
1637
+ * Bytescale API
1638
+ *
1639
+ * The version of the OpenAPI document: 2.0.0
1640
+ * Contact: hello@bytescale.com
1641
+ *
1642
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1643
+ * https://openapi-generator.tech
1644
+ * Do not edit the class manually.
1645
+ */
1646
+ // @ts-ignore
1647
+
1648
+ /**
1649
+ *
1650
+ */
1651
+ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1652
+ FolderApi_inherits(FolderApi, _runtime$BaseAPI);
1653
+ var _super = FolderApi_createSuper(FolderApi);
1654
+ function FolderApi() {
1655
+ FolderApi_classCallCheck(this, FolderApi);
1656
+ return _super.apply(this, arguments);
1657
+ }
1658
+ FolderApi_createClass(FolderApi, [{
1659
+ key: "copyFolderWithHttpInfo",
1660
+ value:
1661
+ /**
1662
+ * Copies a folder asynchronously. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles```, ```includeOverriddenStorage``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1663
+ */
1664
+ function copyFolderWithHttpInfo(requestParameters, initOverrides) {
1665
+ try {
1666
+ var _this2 = this;
1667
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
1668
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling copyFolder.");
1669
+ }
1670
+ if (requestParameters.copyFolderRequest === null || requestParameters.copyFolderRequest === undefined) {
1671
+ throw new RequiredError("copyFolderRequest", "Required parameter requestParameters.copyFolderRequest was null or undefined when calling copyFolder.");
1672
+ }
1673
+ var queryParameters = {};
1674
+ var headerParameters = {};
1675
+ headerParameters["Content-Type"] = "application/json";
1676
+ if (_this2.configuration && _this2.configuration.apiKey) {
1677
+ headerParameters["Authorization"] = _this2.configuration.apiKey("Authorization"); // authorization-header authentication
1678
+ }
1679
+
1680
+ var operationBasePathOverride = [][0];
1681
+ return FolderApi_await(_this2.request({
1682
+ path: "/v2/accounts/{accountId}/folders/copy".replace("{".concat("accountId", "}"),
1683
+ // @ts-ignore
1684
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))),
1685
+ method: "POST",
1686
+ headers: headerParameters,
1687
+ query: queryParameters,
1688
+ body: requestParameters.copyFolderRequest
1689
+ }, initOverrides, operationBasePathOverride), function (response) {
1690
+ return new JSONApiResponse(response);
1691
+ });
1692
+ } catch (e) {
1693
+ return Promise.reject(e);
1694
+ }
1695
+ }
1696
+ /**
1697
+ * Copies a folder asynchronously. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles```, ```includeOverriddenStorage``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1698
+ */
1699
+ }, {
1700
+ key: "copyFolder",
1701
+ value: function copyFolder(requestParameters, initOverrides) {
1702
+ try {
1703
+ var _this4 = this;
1704
+ return FolderApi_await(_this4.copyFolderWithHttpInfo(requestParameters, initOverrides), function (response) {
1705
+ return FolderApi_await(response.value());
1706
+ });
1707
+ } catch (e) {
1708
+ return Promise.reject(e);
1709
+ }
1710
+ }
1711
+ /**
1712
+ * Copies multiple folders asynchronously. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles```, ```includeOverriddenStorage``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1713
+ */
1714
+ }, {
1715
+ key: "copyFolderBatchWithHttpInfo",
1716
+ value: function copyFolderBatchWithHttpInfo(requestParameters, initOverrides) {
1717
+ try {
1718
+ var _this6 = this;
1719
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
1720
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling copyFolderBatch.");
1721
+ }
1722
+ if (requestParameters.copyFolderBatchRequest === null || requestParameters.copyFolderBatchRequest === undefined) {
1723
+ throw new RequiredError("copyFolderBatchRequest", "Required parameter requestParameters.copyFolderBatchRequest was null or undefined when calling copyFolderBatch.");
1724
+ }
1725
+ var queryParameters = {};
1726
+ var headerParameters = {};
1727
+ headerParameters["Content-Type"] = "application/json";
1728
+ if (_this6.configuration && _this6.configuration.apiKey) {
1729
+ headerParameters["Authorization"] = _this6.configuration.apiKey("Authorization"); // authorization-header authentication
1730
+ }
1731
+
1732
+ var operationBasePathOverride = [][0];
1733
+ return FolderApi_await(_this6.request({
1734
+ path: "/v2/accounts/{accountId}/folders/copy/batch".replace("{".concat("accountId", "}"),
1735
+ // @ts-ignore
1736
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))),
1737
+ method: "POST",
1738
+ headers: headerParameters,
1739
+ query: queryParameters,
1740
+ body: requestParameters.copyFolderBatchRequest
1741
+ }, initOverrides, operationBasePathOverride), function (response) {
1742
+ return new JSONApiResponse(response);
1743
+ });
1744
+ } catch (e) {
1745
+ return Promise.reject(e);
1746
+ }
1747
+ }
1748
+ /**
1749
+ * Copies multiple folders asynchronously. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles```, ```includeOverriddenStorage``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1750
+ */
1751
+ }, {
1752
+ key: "copyFolderBatch",
1753
+ value: function copyFolderBatch(requestParameters, initOverrides) {
1754
+ try {
1755
+ var _this8 = this;
1756
+ return FolderApi_await(_this8.copyFolderBatchWithHttpInfo(requestParameters, initOverrides), function (response) {
1757
+ return FolderApi_await(response.value());
1758
+ });
1759
+ } catch (e) {
1760
+ return Promise.reject(e);
1761
+ }
1762
+ }
1763
+ /**
1764
+ * Deletes a folder asynchronously. If the folder has overridden storage settings, then no files will be deleted. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1765
+ */
1766
+ }, {
1767
+ key: "deleteFolderWithHttpInfo",
1768
+ value: function deleteFolderWithHttpInfo(requestParameters, initOverrides) {
1769
+ try {
1770
+ var _this10 = this;
1771
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
1772
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling deleteFolder.");
1773
+ }
1774
+ if (requestParameters.deleteFolderRequest === null || requestParameters.deleteFolderRequest === undefined) {
1775
+ throw new RequiredError("deleteFolderRequest", "Required parameter requestParameters.deleteFolderRequest was null or undefined when calling deleteFolder.");
1776
+ }
1777
+ var queryParameters = {};
1778
+ var headerParameters = {};
1779
+ headerParameters["Content-Type"] = "application/json";
1780
+ if (_this10.configuration && _this10.configuration.apiKey) {
1781
+ headerParameters["Authorization"] = _this10.configuration.apiKey("Authorization"); // authorization-header authentication
1782
+ }
1783
+
1784
+ var operationBasePathOverride = [][0];
1785
+ return FolderApi_await(_this10.request({
1786
+ path: "/v2/accounts/{accountId}/folders".replace("{".concat("accountId", "}"),
1787
+ // @ts-ignore
1788
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))),
1789
+ method: "DELETE",
1790
+ headers: headerParameters,
1791
+ query: queryParameters,
1792
+ body: requestParameters.deleteFolderRequest
1793
+ }, initOverrides, operationBasePathOverride), function (response) {
1794
+ return new JSONApiResponse(response);
1795
+ });
1796
+ } catch (e) {
1797
+ return Promise.reject(e);
1798
+ }
1799
+ }
1800
+ /**
1801
+ * Deletes a folder asynchronously. If the folder has overridden storage settings, then no files will be deleted. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1802
+ */
1803
+ }, {
1804
+ key: "deleteFolder",
1805
+ value: function deleteFolder(requestParameters, initOverrides) {
1806
+ try {
1807
+ var _this12 = this;
1808
+ return FolderApi_await(_this12.deleteFolderWithHttpInfo(requestParameters, initOverrides), function (response) {
1809
+ return FolderApi_await(response.value());
1810
+ });
1811
+ } catch (e) {
1812
+ return Promise.reject(e);
1813
+ }
1814
+ }
1815
+ /**
1816
+ * Deletes multiple folders asynchronously. If the folder has overridden storage settings, then no files will be deleted. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1817
+ */
1818
+ }, {
1819
+ key: "deleteFolderBatchWithHttpInfo",
1820
+ value: function deleteFolderBatchWithHttpInfo(requestParameters, initOverrides) {
1821
+ try {
1822
+ var _this14 = this;
1823
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
1824
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling deleteFolderBatch.");
1825
+ }
1826
+ if (requestParameters.deleteFolderBatchRequest === null || requestParameters.deleteFolderBatchRequest === undefined) {
1827
+ throw new RequiredError("deleteFolderBatchRequest", "Required parameter requestParameters.deleteFolderBatchRequest was null or undefined when calling deleteFolderBatch.");
1828
+ }
1829
+ var queryParameters = {};
1830
+ var headerParameters = {};
1831
+ headerParameters["Content-Type"] = "application/json";
1832
+ if (_this14.configuration && _this14.configuration.apiKey) {
1833
+ headerParameters["Authorization"] = _this14.configuration.apiKey("Authorization"); // authorization-header authentication
1834
+ }
1835
+
1836
+ var operationBasePathOverride = [][0];
1837
+ return FolderApi_await(_this14.request({
1838
+ path: "/v2/accounts/{accountId}/folders/batch".replace("{".concat("accountId", "}"),
1839
+ // @ts-ignore
1840
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))),
1841
+ method: "DELETE",
1842
+ headers: headerParameters,
1843
+ query: queryParameters,
1844
+ body: requestParameters.deleteFolderBatchRequest
1845
+ }, initOverrides, operationBasePathOverride), function (response) {
1846
+ return new JSONApiResponse(response);
1847
+ });
1848
+ } catch (e) {
1849
+ return Promise.reject(e);
1850
+ }
1851
+ }
1852
+ /**
1853
+ * Deletes multiple folders asynchronously. If the folder has overridden storage settings, then no files will be deleted. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1854
+ */
1855
+ }, {
1856
+ key: "deleteFolderBatch",
1857
+ value: function deleteFolderBatch(requestParameters, initOverrides) {
1858
+ try {
1859
+ var _this16 = this;
1860
+ return FolderApi_await(_this16.deleteFolderBatchWithHttpInfo(requestParameters, initOverrides), function (response) {
1861
+ return FolderApi_await(response.value());
1862
+ });
1863
+ } catch (e) {
1864
+ return Promise.reject(e);
1865
+ }
1866
+ }
1867
+ /**
1868
+ * Gets the full details (e.g. permission, storage layer, etc.) for a folder. Returns an empty object if no settings have been configured for this folder.
1869
+ */
1870
+ }, {
1871
+ key: "getFolderDetailsWithHttpInfo",
1872
+ value: function getFolderDetailsWithHttpInfo(requestParameters, initOverrides) {
1873
+ try {
1874
+ var _this18 = this;
1875
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
1876
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling getFolderDetails.");
1877
+ }
1878
+ if (requestParameters.folderPath === null || requestParameters.folderPath === undefined) {
1879
+ throw new RequiredError("folderPath", "Required parameter requestParameters.folderPath was null or undefined when calling getFolderDetails.");
1880
+ }
1881
+ var queryParameters = {};
1882
+ if (requestParameters.folderPath !== undefined) {
1883
+ queryParameters["folderPath"] = requestParameters.folderPath;
1884
+ }
1885
+ var headerParameters = {};
1886
+ if (_this18.configuration && _this18.configuration.apiKey) {
1887
+ headerParameters["Authorization"] = _this18.configuration.apiKey("Authorization"); // authorization-header authentication
1888
+ }
1889
+
1890
+ var operationBasePathOverride = [][0];
1891
+ return FolderApi_await(_this18.request({
1892
+ path: "/v2/accounts/{accountId}/folders".replace("{".concat("accountId", "}"),
1893
+ // @ts-ignore
1894
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))),
1895
+ method: "GET",
1896
+ headers: headerParameters,
1897
+ query: queryParameters
1898
+ }, initOverrides, operationBasePathOverride), function (response) {
1899
+ return new JSONApiResponse(response);
1900
+ });
1901
+ } catch (e) {
1902
+ return Promise.reject(e);
1903
+ }
1904
+ }
1905
+ /**
1906
+ * Gets the full details (e.g. permission, storage layer, etc.) for a folder. Returns an empty object if no settings have been configured for this folder.
1907
+ */
1908
+ }, {
1909
+ key: "getFolderDetails",
1910
+ value: function getFolderDetails(requestParameters, initOverrides) {
1911
+ try {
1912
+ var _this20 = this;
1913
+ return FolderApi_await(_this20.getFolderDetailsWithHttpInfo(requestParameters, initOverrides), function (response) {
1914
+ return FolderApi_await(response.value());
1915
+ });
1916
+ } catch (e) {
1917
+ return Promise.reject(e);
1918
+ }
1919
+ }
1920
+ /**
1921
+ * Lists the folder\'s contents. The result may be paginated: subsequent pages can be requested by passing the ```cursor``` from the response into the ```cursor``` request parameter. Pagination is complete when the response includes `isPaginationComplete=true`.
1922
+ */
1923
+ }, {
1924
+ key: "listFolderWithHttpInfo",
1925
+ value: function listFolderWithHttpInfo(requestParameters, initOverrides) {
1926
+ try {
1927
+ var _this22 = this;
1928
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
1929
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling listFolder.");
1930
+ }
1931
+ if (requestParameters.folderPath === null || requestParameters.folderPath === undefined) {
1932
+ throw new RequiredError("folderPath", "Required parameter requestParameters.folderPath was null or undefined when calling listFolder.");
1933
+ }
1934
+ var queryParameters = {};
1935
+ if (requestParameters.cursor !== undefined) {
1936
+ queryParameters["cursor"] = requestParameters.cursor;
1937
+ }
1938
+ if (requestParameters.dryRun !== undefined) {
1939
+ queryParameters["dryRun"] = requestParameters.dryRun;
1940
+ }
1941
+ if (requestParameters.folderPath !== undefined) {
1942
+ queryParameters["folderPath"] = requestParameters.folderPath;
1943
+ }
1944
+ if (requestParameters.includeFiles !== undefined) {
1945
+ queryParameters["includeFiles"] = requestParameters.includeFiles;
1946
+ }
1947
+ if (requestParameters.includeOverriddenStorage !== undefined) {
1948
+ queryParameters["includeOverriddenStorage"] = requestParameters.includeOverriddenStorage;
1949
+ }
1950
+ if (requestParameters.includePhysicalFolders !== undefined) {
1951
+ queryParameters["includePhysicalFolders"] = requestParameters.includePhysicalFolders;
1952
+ }
1953
+ if (requestParameters.includeVirtualFolders !== undefined) {
1954
+ queryParameters["includeVirtualFolders"] = requestParameters.includeVirtualFolders;
1955
+ }
1956
+ if (requestParameters.limit !== undefined) {
1957
+ queryParameters["limit"] = requestParameters.limit;
1958
+ }
1959
+ if (requestParameters.recursive !== undefined) {
1960
+ queryParameters["recursive"] = requestParameters.recursive;
1961
+ }
1962
+ var headerParameters = {};
1963
+ if (_this22.configuration && _this22.configuration.apiKey) {
1964
+ headerParameters["Authorization"] = _this22.configuration.apiKey("Authorization"); // authorization-header authentication
1965
+ }
1966
+
1967
+ var operationBasePathOverride = [][0];
1968
+ return FolderApi_await(_this22.request({
1969
+ path: "/v2/accounts/{accountId}/folders/list".replace("{".concat("accountId", "}"),
1970
+ // @ts-ignore
1971
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))),
1972
+ method: "GET",
1973
+ headers: headerParameters,
1974
+ query: queryParameters
1975
+ }, initOverrides, operationBasePathOverride), function (response) {
1976
+ return new JSONApiResponse(response);
1977
+ });
1978
+ } catch (e) {
1979
+ return Promise.reject(e);
1980
+ }
1981
+ }
1982
+ /**
1983
+ * Lists the folder\'s contents. The result may be paginated: subsequent pages can be requested by passing the ```cursor``` from the response into the ```cursor``` request parameter. Pagination is complete when the response includes `isPaginationComplete=true`.
1984
+ */
1985
+ }, {
1986
+ key: "listFolder",
1987
+ value: function listFolder(requestParameters, initOverrides) {
1988
+ try {
1989
+ var _this24 = this;
1990
+ return FolderApi_await(_this24.listFolderWithHttpInfo(requestParameters, initOverrides), function (response) {
1991
+ return FolderApi_await(response.value());
1992
+ });
1993
+ } catch (e) {
1994
+ return Promise.reject(e);
1995
+ }
1996
+ }
1997
+ /**
1998
+ * Creates or updates the folder specified by the `folderPath`. If the folder\'s ancestors do not exist, they will be created automatically (with empty FolderSettings). Note: you don\'t need to create folders before uploading files to them.
1999
+ */
2000
+ }, {
2001
+ key: "putFolderWithHttpInfo",
2002
+ value: function putFolderWithHttpInfo(requestParameters, initOverrides) {
2003
+ try {
2004
+ var _this26 = this;
2005
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
2006
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling putFolder.");
2007
+ }
2008
+ if (requestParameters.putFolderRequest === null || requestParameters.putFolderRequest === undefined) {
2009
+ throw new RequiredError("putFolderRequest", "Required parameter requestParameters.putFolderRequest was null or undefined when calling putFolder.");
2010
+ }
2011
+ var queryParameters = {};
2012
+ var headerParameters = {};
2013
+ headerParameters["Content-Type"] = "application/json";
2014
+ if (_this26.configuration && _this26.configuration.apiKey) {
2015
+ headerParameters["Authorization"] = _this26.configuration.apiKey("Authorization"); // authorization-header authentication
2016
+ }
2017
+
2018
+ var operationBasePathOverride = [][0];
2019
+ return FolderApi_await(_this26.request({
2020
+ path: "/v2/accounts/{accountId}/folders".replace("{".concat("accountId", "}"),
2021
+ // @ts-ignore
2022
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))),
2023
+ method: "PUT",
2024
+ headers: headerParameters,
2025
+ query: queryParameters,
2026
+ body: requestParameters.putFolderRequest
2027
+ }, initOverrides, operationBasePathOverride), function (response) {
2028
+ return new JSONApiResponse(response);
2029
+ });
2030
+ } catch (e) {
2031
+ return Promise.reject(e);
2032
+ }
2033
+ }
2034
+ /**
2035
+ * Creates or updates the folder specified by the `folderPath`. If the folder\'s ancestors do not exist, they will be created automatically (with empty FolderSettings). Note: you don\'t need to create folders before uploading files to them.
2036
+ */
2037
+ }, {
2038
+ key: "putFolder",
2039
+ value: function putFolder(requestParameters, initOverrides) {
2040
+ try {
2041
+ var _this28 = this;
2042
+ return FolderApi_await(_this28.putFolderWithHttpInfo(requestParameters, initOverrides), function (response) {
2043
+ return FolderApi_await(response.value());
2044
+ });
2045
+ } catch (e) {
2046
+ return Promise.reject(e);
2047
+ }
2048
+ }
2049
+ }]);
2050
+ return FolderApi;
2051
+ }(BaseAPI);
2052
+ ;// CONCATENATED MODULE: ./src/gen/apis/JobApi.ts
2053
+ 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); }
2054
+ function JobApi_await(value, then, direct) {
2055
+ if (direct) {
2056
+ return then ? then(value) : value;
2057
+ }
2058
+ if (!value || !value.then) {
2059
+ value = Promise.resolve(value);
2060
+ }
2061
+ return then ? value.then(then) : value;
2062
+ }
2063
+ function JobApi_empty() {}
2064
+ function JobApi_awaitIgnored(value, direct) {
2065
+ if (!direct) {
2066
+ return value && value.then ? value.then(JobApi_empty) : Promise.resolve();
2067
+ }
2068
+ }
2069
+ function JobApi_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2070
+ function JobApi_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, JobApi_toPropertyKey(descriptor.key), descriptor); } }
2071
+ function JobApi_createClass(Constructor, protoProps, staticProps) { if (protoProps) JobApi_defineProperties(Constructor.prototype, protoProps); if (staticProps) JobApi_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
2072
+ function JobApi_toPropertyKey(arg) { var key = JobApi_toPrimitive(arg, "string"); return JobApi_typeof(key) === "symbol" ? key : String(key); }
2073
+ function JobApi_toPrimitive(input, hint) { if (JobApi_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (JobApi_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
2074
+ function JobApi_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) JobApi_setPrototypeOf(subClass, superClass); }
2075
+ function JobApi_setPrototypeOf(o, p) { JobApi_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return JobApi_setPrototypeOf(o, p); }
2076
+ function JobApi_createSuper(Derived) { var hasNativeReflectConstruct = JobApi_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = JobApi_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = JobApi_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return JobApi_possibleConstructorReturn(this, result); }; }
2077
+ function JobApi_possibleConstructorReturn(self, call) { if (call && (JobApi_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 JobApi_assertThisInitialized(self); }
2078
+ function JobApi_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
2079
+ function JobApi_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; } }
2080
+ function JobApi_getPrototypeOf(o) { JobApi_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return JobApi_getPrototypeOf(o); }
2081
+ /* tslint:disable */
2082
+ /* eslint-disable */
2083
+ /**
2084
+ * @bytescale/bytescale-api
2085
+ * Bytescale API
2086
+ *
2087
+ * The version of the OpenAPI document: 2.0.0
2088
+ * Contact: hello@bytescale.com
2089
+ *
2090
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2091
+ * https://openapi-generator.tech
2092
+ * Do not edit the class manually.
2093
+ */
2094
+ // @ts-ignore
2095
+
2096
+ /**
2097
+ *
2098
+ */
2099
+ var JobApi = /*#__PURE__*/function (_runtime$BaseAPI) {
2100
+ JobApi_inherits(JobApi, _runtime$BaseAPI);
2101
+ var _super = JobApi_createSuper(JobApi);
2102
+ function JobApi() {
2103
+ JobApi_classCallCheck(this, JobApi);
2104
+ return _super.apply(this, arguments);
2105
+ }
2106
+ JobApi_createClass(JobApi, [{
2107
+ key: "cancelJobWithHttpInfo",
2108
+ value:
2109
+ /**
2110
+ * Cancels an in-progress background job. Requires a `secret_*` API key.
2111
+ */
2112
+ function cancelJobWithHttpInfo(requestParameters, initOverrides) {
2113
+ try {
2114
+ var _this2 = this;
2115
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
2116
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling cancelJob.");
2117
+ }
2118
+ if (requestParameters.jobId === null || requestParameters.jobId === undefined) {
2119
+ throw new RequiredError("jobId", "Required parameter requestParameters.jobId was null or undefined when calling cancelJob.");
2120
+ }
2121
+ if (requestParameters.jobType === null || requestParameters.jobType === undefined) {
2122
+ throw new RequiredError("jobType", "Required parameter requestParameters.jobType was null or undefined when calling cancelJob.");
2123
+ }
2124
+ var queryParameters = {};
2125
+ var headerParameters = {};
2126
+ if (_this2.configuration && _this2.configuration.apiKey) {
2127
+ headerParameters["Authorization"] = _this2.configuration.apiKey("Authorization"); // authorization-header authentication
2128
+ }
2129
+
2130
+ var operationBasePathOverride = [][0];
2131
+ return JobApi_await(_this2.request({
2132
+ path: "/v2/accounts/{accountId}/jobs/{jobType}/{jobId}".replace("{".concat("accountId", "}"),
2133
+ // @ts-ignore
2134
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))).replace("{".concat("jobId", "}"),
2135
+ // @ts-ignore
2136
+ false ? 0 : encodeURIComponent(String(requestParameters.jobId))).replace("{".concat("jobType", "}"),
2137
+ // @ts-ignore
2138
+ false ? 0 : encodeURIComponent(String(requestParameters.jobType))),
2139
+ method: "DELETE",
2140
+ headers: headerParameters,
2141
+ query: queryParameters
2142
+ }, initOverrides, operationBasePathOverride), function (response) {
2143
+ return new VoidApiResponse(response);
2144
+ });
2145
+ } catch (e) {
2146
+ return Promise.reject(e);
2147
+ }
2148
+ }
2149
+ /**
2150
+ * Cancels an in-progress background job. Requires a `secret_*` API key.
2151
+ */
2152
+ }, {
2153
+ key: "cancelJob",
2154
+ value: function cancelJob(requestParameters, initOverrides) {
2155
+ try {
2156
+ var _this4 = this;
2157
+ return JobApi_awaitIgnored(_this4.cancelJobWithHttpInfo(requestParameters, initOverrides));
2158
+ } catch (e) {
2159
+ return Promise.reject(e);
2160
+ }
2161
+ }
2162
+ /**
2163
+ * Gets information on a background job. Requires a `secret_*` API key.
2164
+ */
2165
+ }, {
2166
+ key: "getJobWithHttpInfo",
2167
+ value: function getJobWithHttpInfo(requestParameters, initOverrides) {
2168
+ try {
2169
+ var _this6 = this;
2170
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
2171
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling getJob.");
2172
+ }
2173
+ if (requestParameters.jobId === null || requestParameters.jobId === undefined) {
2174
+ throw new RequiredError("jobId", "Required parameter requestParameters.jobId was null or undefined when calling getJob.");
2175
+ }
2176
+ if (requestParameters.jobType === null || requestParameters.jobType === undefined) {
2177
+ throw new RequiredError("jobType", "Required parameter requestParameters.jobType was null or undefined when calling getJob.");
2178
+ }
2179
+ var queryParameters = {};
2180
+ var headerParameters = {};
2181
+ if (_this6.configuration && _this6.configuration.apiKey) {
2182
+ headerParameters["Authorization"] = _this6.configuration.apiKey("Authorization"); // authorization-header authentication
2183
+ }
2184
+
2185
+ var operationBasePathOverride = [][0];
2186
+ return JobApi_await(_this6.request({
2187
+ path: "/v2/accounts/{accountId}/jobs/{jobType}/{jobId}".replace("{".concat("accountId", "}"),
2188
+ // @ts-ignore
2189
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))).replace("{".concat("jobId", "}"),
2190
+ // @ts-ignore
2191
+ false ? 0 : encodeURIComponent(String(requestParameters.jobId))).replace("{".concat("jobType", "}"),
2192
+ // @ts-ignore
2193
+ false ? 0 : encodeURIComponent(String(requestParameters.jobType))),
2194
+ method: "GET",
2195
+ headers: headerParameters,
2196
+ query: queryParameters
2197
+ }, initOverrides, operationBasePathOverride), function (response) {
2198
+ return new JSONApiResponse(response);
2199
+ });
2200
+ } catch (e) {
2201
+ return Promise.reject(e);
2202
+ }
2203
+ }
2204
+ /**
2205
+ * Gets information on a background job. Requires a `secret_*` API key.
2206
+ */
2207
+ }, {
2208
+ key: "getJob",
2209
+ value: function getJob(requestParameters, initOverrides) {
2210
+ try {
2211
+ var _this8 = this;
2212
+ return JobApi_await(_this8.getJobWithHttpInfo(requestParameters, initOverrides), function (response) {
2213
+ return JobApi_await(response.value());
2214
+ });
2215
+ } catch (e) {
2216
+ return Promise.reject(e);
2217
+ }
2218
+ }
2219
+ /**
2220
+ * Lists the most recently issued background jobs. Requires a `secret_*` API key.
2221
+ */
2222
+ }, {
2223
+ key: "listRecentJobsWithHttpInfo",
2224
+ value: function listRecentJobsWithHttpInfo(requestParameters, initOverrides) {
2225
+ try {
2226
+ var _this10 = this;
2227
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
2228
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling listRecentJobs.");
2229
+ }
2230
+ if (requestParameters.jobType === null || requestParameters.jobType === undefined) {
2231
+ throw new RequiredError("jobType", "Required parameter requestParameters.jobType was null or undefined when calling listRecentJobs.");
2232
+ }
2233
+ var queryParameters = {};
2234
+ if (requestParameters.jobType) {
2235
+ queryParameters["jobType"] = requestParameters.jobType;
2236
+ }
2237
+ var headerParameters = {};
2238
+ if (_this10.configuration && _this10.configuration.apiKey) {
2239
+ headerParameters["Authorization"] = _this10.configuration.apiKey("Authorization"); // authorization-header authentication
2240
+ }
2241
+
2242
+ var operationBasePathOverride = [][0];
2243
+ return JobApi_await(_this10.request({
2244
+ path: "/v2/accounts/{accountId}/jobs".replace("{".concat("accountId", "}"),
2245
+ // @ts-ignore
2246
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))),
2247
+ method: "GET",
2248
+ headers: headerParameters,
2249
+ query: queryParameters
2250
+ }, initOverrides, operationBasePathOverride), function (response) {
2251
+ return new JSONApiResponse(response);
2252
+ });
2253
+ } catch (e) {
2254
+ return Promise.reject(e);
2255
+ }
2256
+ }
2257
+ /**
2258
+ * Lists the most recently issued background jobs. Requires a `secret_*` API key.
2259
+ */
2260
+ }, {
2261
+ key: "listRecentJobs",
2262
+ value: function listRecentJobs(requestParameters, initOverrides) {
2263
+ try {
2264
+ var _this12 = this;
2265
+ return JobApi_await(_this12.listRecentJobsWithHttpInfo(requestParameters, initOverrides), function (response) {
2266
+ return JobApi_await(response.value());
2267
+ });
2268
+ } catch (e) {
2269
+ return Promise.reject(e);
2270
+ }
2271
+ }
2272
+ }]);
2273
+ return JobApi;
2274
+ }(BaseAPI);
2275
+ ;// CONCATENATED MODULE: ./src/gen/apis/UploadApi.ts
2276
+ 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); }
2277
+ function UploadApi_await(value, then, direct) {
2278
+ if (direct) {
2279
+ return then ? then(value) : value;
2280
+ }
2281
+ if (!value || !value.then) {
2282
+ value = Promise.resolve(value);
2283
+ }
2284
+ return then ? value.then(then) : value;
2285
+ }
2286
+ function UploadApi_empty() {}
2287
+ function UploadApi_awaitIgnored(value, direct) {
2288
+ if (!direct) {
2289
+ return value && value.then ? value.then(UploadApi_empty) : Promise.resolve();
2290
+ }
2291
+ }
2292
+ function UploadApi_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2293
+ function UploadApi_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, UploadApi_toPropertyKey(descriptor.key), descriptor); } }
2294
+ function UploadApi_createClass(Constructor, protoProps, staticProps) { if (protoProps) UploadApi_defineProperties(Constructor.prototype, protoProps); if (staticProps) UploadApi_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
2295
+ function UploadApi_toPropertyKey(arg) { var key = UploadApi_toPrimitive(arg, "string"); return UploadApi_typeof(key) === "symbol" ? key : String(key); }
2296
+ function UploadApi_toPrimitive(input, hint) { if (UploadApi_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (UploadApi_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
2297
+ function UploadApi_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) UploadApi_setPrototypeOf(subClass, superClass); }
2298
+ function UploadApi_setPrototypeOf(o, p) { UploadApi_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return UploadApi_setPrototypeOf(o, p); }
2299
+ function UploadApi_createSuper(Derived) { var hasNativeReflectConstruct = UploadApi_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = UploadApi_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = UploadApi_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return UploadApi_possibleConstructorReturn(this, result); }; }
2300
+ function UploadApi_possibleConstructorReturn(self, call) { if (call && (UploadApi_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 UploadApi_assertThisInitialized(self); }
2301
+ function UploadApi_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
2302
+ function UploadApi_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; } }
2303
+ function UploadApi_getPrototypeOf(o) { UploadApi_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return UploadApi_getPrototypeOf(o); }
2304
+ /* tslint:disable */
2305
+ /* eslint-disable */
2306
+ /**
2307
+ * @bytescale/bytescale-api
2308
+ * Bytescale API
2309
+ *
2310
+ * The version of the OpenAPI document: 2.0.0
2311
+ * Contact: hello@bytescale.com
2312
+ *
2313
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2314
+ * https://openapi-generator.tech
2315
+ * Do not edit the class manually.
2316
+ */
2317
+ // @ts-ignore
2318
+
2319
+ /**
2320
+ *
2321
+ */
2322
+ var UploadApi = /*#__PURE__*/function (_runtime$BaseAPI) {
2323
+ UploadApi_inherits(UploadApi, _runtime$BaseAPI);
2324
+ var _super = UploadApi_createSuper(UploadApi);
2325
+ function UploadApi() {
2326
+ UploadApi_classCallCheck(this, UploadApi);
2327
+ return _super.apply(this, arguments);
2328
+ }
2329
+ UploadApi_createClass(UploadApi, [{
2330
+ key: "beginMultipartUploadWithHttpInfo",
2331
+ value:
2332
+ /**
2333
+ * Begins a new multipart file upload process.
2334
+ */
2335
+ function beginMultipartUploadWithHttpInfo(requestParameters, initOverrides) {
2336
+ try {
2337
+ var _this2 = this;
2338
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
2339
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling beginMultipartUpload.");
2340
+ }
2341
+ if (requestParameters.beginMultipartUploadRequest === null || requestParameters.beginMultipartUploadRequest === undefined) {
2342
+ throw new RequiredError("beginMultipartUploadRequest", "Required parameter requestParameters.beginMultipartUploadRequest was null or undefined when calling beginMultipartUpload.");
2343
+ }
2344
+ var queryParameters = {};
2345
+ var headerParameters = {};
2346
+ headerParameters["Content-Type"] = "application/json";
2347
+ if (_this2.configuration && _this2.configuration.apiKey) {
2348
+ headerParameters["Authorization"] = _this2.configuration.apiKey("Authorization"); // authorization-header authentication
2349
+ }
2350
+
2351
+ var operationBasePathOverride = [][0];
2352
+ return UploadApi_await(_this2.request({
2353
+ path: "/v2/accounts/{accountId}/uploads".replace("{".concat("accountId", "}"),
2354
+ // @ts-ignore
2355
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))),
2356
+ method: "POST",
2357
+ headers: headerParameters,
2358
+ query: queryParameters,
2359
+ body: requestParameters.beginMultipartUploadRequest
2360
+ }, initOverrides, operationBasePathOverride), function (response) {
2361
+ return new JSONApiResponse(response);
2362
+ });
2363
+ } catch (e) {
2364
+ return Promise.reject(e);
2365
+ }
2366
+ }
2367
+ /**
2368
+ * Begins a new multipart file upload process.
2369
+ */
2370
+ }, {
2371
+ key: "beginMultipartUpload",
2372
+ value: function beginMultipartUpload(requestParameters, initOverrides) {
2373
+ try {
2374
+ var _this4 = this;
2375
+ return UploadApi_await(_this4.beginMultipartUploadWithHttpInfo(requestParameters, initOverrides), function (response) {
2376
+ return UploadApi_await(response.value());
2377
+ });
2378
+ } catch (e) {
2379
+ return Promise.reject(e);
2380
+ }
2381
+ }
2382
+ /**
2383
+ * Marks an upload part as uploaded. You must call this endpoint after you have successfully issued a `PUT` request to the `uploadUrl` on the corresponding UploadPart.
2384
+ */
2385
+ }, {
2386
+ key: "completeUploadPartWithHttpInfo",
2387
+ value: function completeUploadPartWithHttpInfo(requestParameters, initOverrides) {
2388
+ try {
2389
+ var _this6 = this;
2390
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
2391
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling completeUploadPart.");
2392
+ }
2393
+ if (requestParameters.uploadId === null || requestParameters.uploadId === undefined) {
2394
+ throw new RequiredError("uploadId", "Required parameter requestParameters.uploadId was null or undefined when calling completeUploadPart.");
2395
+ }
2396
+ if (requestParameters.uploadPartIndex === null || requestParameters.uploadPartIndex === undefined) {
2397
+ throw new RequiredError("uploadPartIndex", "Required parameter requestParameters.uploadPartIndex was null or undefined when calling completeUploadPart.");
2398
+ }
2399
+ if (requestParameters.completeUploadPartRequest === null || requestParameters.completeUploadPartRequest === undefined) {
2400
+ throw new RequiredError("completeUploadPartRequest", "Required parameter requestParameters.completeUploadPartRequest was null or undefined when calling completeUploadPart.");
2401
+ }
2402
+ var queryParameters = {};
2403
+ var headerParameters = {};
2404
+ headerParameters["Content-Type"] = "application/json";
2405
+ if (_this6.configuration && _this6.configuration.apiKey) {
2406
+ headerParameters["Authorization"] = _this6.configuration.apiKey("Authorization"); // authorization-header authentication
2407
+ }
2408
+
2409
+ var operationBasePathOverride = [][0];
2410
+ return UploadApi_await(_this6.request({
2411
+ path: "/v2/accounts/{accountId}/uploads/{uploadId}/parts/{uploadPartIndex}".replace("{".concat("accountId", "}"),
2412
+ // @ts-ignore
2413
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))).replace("{".concat("uploadId", "}"),
2414
+ // @ts-ignore
2415
+ false ? 0 : encodeURIComponent(String(requestParameters.uploadId))).replace("{".concat("uploadPartIndex", "}"),
2416
+ // @ts-ignore
2417
+ false ? 0 : encodeURIComponent(String(requestParameters.uploadPartIndex))),
2418
+ method: "PUT",
2419
+ headers: headerParameters,
2420
+ query: queryParameters,
2421
+ body: requestParameters.completeUploadPartRequest
2422
+ }, initOverrides, operationBasePathOverride), function (response) {
2423
+ return new VoidApiResponse(response);
2424
+ });
2425
+ } catch (e) {
2426
+ return Promise.reject(e);
2427
+ }
2428
+ }
2429
+ /**
2430
+ * Marks an upload part as uploaded. You must call this endpoint after you have successfully issued a `PUT` request to the `uploadUrl` on the corresponding UploadPart.
2431
+ */
2432
+ }, {
2433
+ key: "completeUploadPart",
2434
+ value: function completeUploadPart(requestParameters, initOverrides) {
2435
+ try {
2436
+ var _this8 = this;
2437
+ return UploadApi_awaitIgnored(_this8.completeUploadPartWithHttpInfo(requestParameters, initOverrides));
2438
+ } catch (e) {
2439
+ return Promise.reject(e);
2440
+ }
2441
+ }
2442
+ /**
2443
+ * Gets a remaining upload part for a multipart file upload.
2444
+ */
2445
+ }, {
2446
+ key: "getUploadPartWithHttpInfo",
2447
+ value: function getUploadPartWithHttpInfo(requestParameters, initOverrides) {
2448
+ try {
2449
+ var _this10 = this;
2450
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
2451
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling getUploadPart.");
2452
+ }
2453
+ if (requestParameters.uploadId === null || requestParameters.uploadId === undefined) {
2454
+ throw new RequiredError("uploadId", "Required parameter requestParameters.uploadId was null or undefined when calling getUploadPart.");
2455
+ }
2456
+ if (requestParameters.uploadPartIndex === null || requestParameters.uploadPartIndex === undefined) {
2457
+ throw new RequiredError("uploadPartIndex", "Required parameter requestParameters.uploadPartIndex was null or undefined when calling getUploadPart.");
2458
+ }
2459
+ var queryParameters = {};
2460
+ var headerParameters = {};
2461
+ if (_this10.configuration && _this10.configuration.apiKey) {
2462
+ headerParameters["Authorization"] = _this10.configuration.apiKey("Authorization"); // authorization-header authentication
2463
+ }
2464
+
2465
+ var operationBasePathOverride = [][0];
2466
+ return UploadApi_await(_this10.request({
2467
+ path: "/v2/accounts/{accountId}/uploads/{uploadId}/parts/{uploadPartIndex}".replace("{".concat("accountId", "}"),
2468
+ // @ts-ignore
2469
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))).replace("{".concat("uploadId", "}"),
2470
+ // @ts-ignore
2471
+ false ? 0 : encodeURIComponent(String(requestParameters.uploadId))).replace("{".concat("uploadPartIndex", "}"),
2472
+ // @ts-ignore
2473
+ false ? 0 : encodeURIComponent(String(requestParameters.uploadPartIndex))),
2474
+ method: "GET",
2475
+ headers: headerParameters,
2476
+ query: queryParameters
2477
+ }, initOverrides, operationBasePathOverride), function (response) {
2478
+ return new JSONApiResponse(response);
2479
+ });
2480
+ } catch (e) {
2481
+ return Promise.reject(e);
2482
+ }
2483
+ }
2484
+ /**
2485
+ * Gets a remaining upload part for a multipart file upload.
2486
+ */
2487
+ }, {
2488
+ key: "getUploadPart",
2489
+ value: function getUploadPart(requestParameters, initOverrides) {
2490
+ try {
2491
+ var _this12 = this;
2492
+ return UploadApi_await(_this12.getUploadPartWithHttpInfo(requestParameters, initOverrides), function (response) {
2493
+ return UploadApi_await(response.value());
2494
+ });
2495
+ } catch (e) {
2496
+ return Promise.reject(e);
2497
+ }
2498
+ }
2499
+ /**
2500
+ * Lists the remaining upload parts for a multipart file upload. An empty array is returned when the upload is complete.
2501
+ */
2502
+ }, {
2503
+ key: "listUploadPartsWithHttpInfo",
2504
+ value: function listUploadPartsWithHttpInfo(requestParameters, initOverrides) {
2505
+ try {
2506
+ var _this14 = this;
2507
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
2508
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling listUploadParts.");
2509
+ }
2510
+ if (requestParameters.uploadId === null || requestParameters.uploadId === undefined) {
2511
+ throw new RequiredError("uploadId", "Required parameter requestParameters.uploadId was null or undefined when calling listUploadParts.");
2512
+ }
2513
+ var queryParameters = {};
2514
+ var headerParameters = {};
2515
+ if (_this14.configuration && _this14.configuration.apiKey) {
2516
+ headerParameters["Authorization"] = _this14.configuration.apiKey("Authorization"); // authorization-header authentication
2517
+ }
2518
+
2519
+ var operationBasePathOverride = [][0];
2520
+ return UploadApi_await(_this14.request({
2521
+ path: "/v2/accounts/{accountId}/uploads/{uploadId}/parts".replace("{".concat("accountId", "}"),
2522
+ // @ts-ignore
2523
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))).replace("{".concat("uploadId", "}"),
2524
+ // @ts-ignore
2525
+ false ? 0 : encodeURIComponent(String(requestParameters.uploadId))),
2526
+ method: "GET",
2527
+ headers: headerParameters,
2528
+ query: queryParameters
2529
+ }, initOverrides, operationBasePathOverride), function (response) {
2530
+ return new JSONApiResponse(response);
2531
+ });
2532
+ } catch (e) {
2533
+ return Promise.reject(e);
2534
+ }
2535
+ }
2536
+ /**
2537
+ * Lists the remaining upload parts for a multipart file upload. An empty array is returned when the upload is complete.
2538
+ */
2539
+ }, {
2540
+ key: "listUploadParts",
2541
+ value: function listUploadParts(requestParameters, initOverrides) {
2542
+ try {
2543
+ var _this16 = this;
2544
+ return UploadApi_await(_this16.listUploadPartsWithHttpInfo(requestParameters, initOverrides), function (response) {
2545
+ return UploadApi_await(response.value());
2546
+ });
2547
+ } catch (e) {
2548
+ return Promise.reject(e);
2549
+ }
2550
+ }
2551
+ /**
2552
+ * Upload from a URL with a single HTTP request:
2553
+ */
2554
+ }, {
2555
+ key: "uploadFromUrlWithHttpInfo",
2556
+ value: function uploadFromUrlWithHttpInfo(requestParameters, initOverrides) {
2557
+ try {
2558
+ var _this18 = this;
2559
+ if (requestParameters.accountId === null || requestParameters.accountId === undefined) {
2560
+ throw new RequiredError("accountId", "Required parameter requestParameters.accountId was null or undefined when calling uploadFromUrl.");
2561
+ }
2562
+ if (requestParameters.uploadFromUrlRequest === null || requestParameters.uploadFromUrlRequest === undefined) {
2563
+ throw new RequiredError("uploadFromUrlRequest", "Required parameter requestParameters.uploadFromUrlRequest was null or undefined when calling uploadFromUrl.");
2564
+ }
2565
+ var queryParameters = {};
2566
+ var headerParameters = {};
2567
+ headerParameters["Content-Type"] = "application/json";
2568
+ if (_this18.configuration && _this18.configuration.apiKey) {
2569
+ headerParameters["Authorization"] = _this18.configuration.apiKey("Authorization"); // authorization-header authentication
2570
+ }
2571
+
2572
+ var operationBasePathOverride = [][0];
2573
+ return UploadApi_await(_this18.request({
2574
+ path: "/v2/accounts/{accountId}/uploads/url".replace("{".concat("accountId", "}"),
2575
+ // @ts-ignore
2576
+ false ? 0 : encodeURIComponent(String(requestParameters.accountId))),
2577
+ method: "POST",
2578
+ headers: headerParameters,
2579
+ query: queryParameters,
2580
+ body: requestParameters.uploadFromUrlRequest
2581
+ }, initOverrides, operationBasePathOverride), function (response) {
2582
+ return new JSONApiResponse(response);
2583
+ });
2584
+ } catch (e) {
2585
+ return Promise.reject(e);
2586
+ }
2587
+ }
2588
+ /**
2589
+ * Upload from a URL with a single HTTP request:
2590
+ */
2591
+ }, {
2592
+ key: "uploadFromUrl",
2593
+ value: function uploadFromUrl(requestParameters, initOverrides) {
2594
+ try {
2595
+ var _this20 = this;
2596
+ return UploadApi_await(_this20.uploadFromUrlWithHttpInfo(requestParameters, initOverrides), function (response) {
2597
+ return UploadApi_await(response.value());
2598
+ });
2599
+ } catch (e) {
2600
+ return Promise.reject(e);
2601
+ }
2602
+ }
2603
+ }]);
2604
+ return UploadApi;
2605
+ }(BaseAPI);
2606
+ ;// CONCATENATED MODULE: ./src/gen/apis/index.ts
2607
+ /* tslint:disable */
2608
+ /* eslint-disable */
2609
+
2610
+
2611
+
2612
+
2613
+ ;// CONCATENATED MODULE: ./src/gen/models/index.ts
2614
+ /* tslint:disable */
2615
+ /* eslint-disable */
2616
+ /**
2617
+ * "Created" is only used when issuing jobs non-transactionally (which we do if we want the job to be picked up sooner).
2618
+ * In this case, a two-phase transaction is performed.
2619
+ *
2620
+ * T=0) "Created" job tracker created.
2621
+ * T=1) SQS job enqueued.
2622
+ * T=2) "Pending" is set into job tracker.
2623
+ * T=3) Response returned to use
2624
+ * T=4) SQS picks up job. If status is "Created" it fails the job attempt. This keeps going until eventually the job perm-fails, or it sees "Pending". It should typically (always?) see "Pending" on the first attempt, if T=2 succeeded.
2625
+ * T=5) SQS processes the job as normal.
2626
+ *
2627
+ * As such, the "Created" state is an internal detail, and we never expose jobs in this state to the user.
2628
+ * @export
2629
+ */
2630
+ var AccountJobStatus = {
2631
+ Created: "Created",
2632
+ Pending: "Pending",
2633
+ Running: "Running",
2634
+ Rollback: "Rollback",
2635
+ Failed: "Failed",
2636
+ Succeeded: "Succeeded",
2637
+ Cancelling: "Cancelling",
2638
+ Cancelled: "Cancelled"
2639
+ };
2640
+ /**
2641
+ * Job type.
2642
+ * @export
2643
+ */
2644
+ var AccountJobType = {
2645
+ ProcessFileJob: "ProcessFileJob",
2646
+ DeleteFolderBatchJob: "DeleteFolderBatchJob",
2647
+ DeleteFileBatchJob: "DeleteFileBatchJob",
2648
+ CopyFolderBatchJob: "CopyFolderBatchJob",
2649
+ CopyFileBatchJob: "CopyFileBatchJob"
2650
+ };
2651
+ /**
2652
+ * @export
2653
+ */
2654
+ var AsyncResponseJobDocsEnum = {
2655
+ HttpsWwwBytescaleComDocsJobApiGetJob: "https://www.bytescale.com/docs/job-api/GetJob"
2656
+ };
2657
+ /**
2658
+ * AWS Region.
2659
+ * @export
2660
+ */
2661
+ var AwsRegion = {
2662
+ UsEast2: "us-east-2",
2663
+ UsEast1: "us-east-1",
2664
+ UsWest1: "us-west-1",
2665
+ UsWest2: "us-west-2",
2666
+ AfSouth1: "af-south-1",
2667
+ ApEast1: "ap-east-1",
2668
+ ApSoutheast3: "ap-southeast-3",
2669
+ ApSouth1: "ap-south-1",
2670
+ ApNortheast3: "ap-northeast-3",
2671
+ ApNortheast2: "ap-northeast-2",
2672
+ ApSoutheast1: "ap-southeast-1",
2673
+ ApSoutheast2: "ap-southeast-2",
2674
+ ApNortheast1: "ap-northeast-1",
2675
+ CaCentral1: "ca-central-1",
2676
+ EuCentral1: "eu-central-1",
2677
+ EuWest1: "eu-west-1",
2678
+ EuWest2: "eu-west-2",
2679
+ EuSouth1: "eu-south-1",
2680
+ EuWest3: "eu-west-3",
2681
+ EuNorth1: "eu-north-1",
2682
+ MeSouth1: "me-south-1",
2683
+ SaEast1: "sa-east-1"
2684
+ };
2685
+ /**
2686
+ * @export
2687
+ */
2688
+ var DigitalOceanStorageTypeEnum = {
2689
+ DigitalOceanSpace: "DigitalOceanSpace"
2690
+ };
2691
+ /**
2692
+ * The result of the CopyFile operation.
2693
+ * @export
2694
+ */
2695
+ var FileCopyStatus = {
2696
+ Copied: "Copied",
2697
+ FileNotFound: "FileNotFound",
2698
+ SkippedDueToCondition: "SkippedDueToCondition"
2699
+ };
2700
+ /**
2701
+ * @export
2702
+ */
2703
+ var FileSummaryTypeEnum = {
2704
+ File: "File"
2705
+ };
2706
+ /**
2707
+ * @export
2708
+ */
2709
+ var FolderDetailsTypeEnum = {
2710
+ Folder: "Folder"
2711
+ };
2712
+ /**
2713
+ * @export
2714
+ */
2715
+ var FolderSettingsStorageLayerSummaryStorageLayerTypeEnum = {
2716
+ GoogleStorage: "GoogleStorage"
2717
+ };
2718
+ /**
2719
+ * @export
2720
+ */
2721
+ var FolderSummaryTypeEnum = {
2722
+ Folder: "Folder"
2723
+ };
2724
+ /**
2725
+ * @export
2726
+ */
2727
+ var GoogleStorageTypeEnum = {
2728
+ GoogleStorage: "GoogleStorage"
2729
+ };
2730
+ /**
2731
+ * @export
2732
+ */
2733
+ var InternalStorageV1TypeEnum = {
2734
+ InternalStorageV1: "InternalStorageV1"
2735
+ };
2736
+ /**
2737
+ * @export
2738
+ */
2739
+ var InternalStorageV2TypeEnum = {
2740
+ InternalStorageV2: "InternalStorageV2"
2741
+ };
2742
+ /**
2743
+ * @export
2744
+ */
2745
+ var JobSummaryJobDocsEnum = {
2746
+ HttpsWwwBytescaleComDocsJobApiGetJob: "https://www.bytescale.com/docs/job-api/GetJob"
2747
+ };
2748
+ /**
2749
+ * Multipart file upload protocol version.
2750
+ *
2751
+ * - `1.0`: this protocol version automatically downgrades to single part uploads when files are below a certain size. When this protocol is used for small files, the file exists immediately after the `PUT` request to the `uploadUrl` completes. This protocol requires more client-side code to implement, and has a known issue whereby file TTLs are ignored if the client code fails to call CompleteUploadPart.
2752
+ *
2753
+ * - `1.1`: this protocol version uses multipart uploads for all files. When this protocol is used, files only exist after the last CompleteUploadPart request is made. This protocol simplifies client code, and fixes a known issue in the `2.0` protocol for file TTLs (described above).
2754
+ * @export
2755
+ */
2756
+ var MultipartUploadProtocol = {
2757
+ _0: "1.0",
2758
+ _1: "1.1"
2759
+ };
2760
+ /**
2761
+ * @export
2762
+ */
2763
+ var ObjectSummaryTypeEnum = {
2764
+ File: "File"
2765
+ };
2766
+ /**
2767
+ * Specifies the level in the file tree, relative to the path, that these permissions apply.
2768
+ *
2769
+ * - `"This"`: Permissions apply to the current path only.
2770
+ *
2771
+ * - `"Children"`: Permissions apply to the children (files and folders) of this path only.
2772
+ *
2773
+ * - `"Grandchildren+"`: Permissions apply to the grandchildren (files and folders) of this path and their descendants only.
2774
+ * @export
2775
+ */
2776
+ var PathPermissionScope = {
2777
+ Children: "Children",
2778
+ Grandchildren: "Grandchildren+",
2779
+ This: "This"
2780
+ };
2781
+ /**
2782
+ * @export
2783
+ */
2784
+ var PickDigitalOceanStorageExcludeKeyofDigitalOceanStorageCredentialsTypeEnum = {
2785
+ DigitalOceanSpace: "DigitalOceanSpace"
2786
+ };
2787
+ /**
2788
+ * @export
2789
+ */
2790
+ var PickGoogleStorageExcludeKeyofGoogleStorageCredentialsTypeEnum = {
2791
+ GoogleStorage: "GoogleStorage"
2792
+ };
2793
+ /**
2794
+ * @export
2795
+ */
2796
+ var PickR2StorageExcludeKeyofR2StorageCredentialsTypeEnum = {
2797
+ R2: "R2"
2798
+ };
2799
+ /**
2800
+ * @export
2801
+ */
2802
+ var PickS3StorageExcludeKeyofS3StorageCredentialsTypeEnum = {
2803
+ S3: "S3"
2804
+ };
2805
+ /**
2806
+ * @export
2807
+ */
2808
+ var R2StorageTypeEnum = {
2809
+ R2: "R2"
2810
+ };
2811
+ /**
2812
+ * @export
2813
+ */
2814
+ var S3StorageTypeEnum = {
2815
+ S3: "S3"
2816
+ };
2817
+ /**
2818
+ * @export
2819
+ */
2820
+ var SpecifiedFieldValueFolderDescriptionOrNullSetEnum = {
2821
+ True: true
2822
+ };
2823
+ /**
2824
+ * @export
2825
+ */
2826
+ var SpecifiedFieldValuePublicPermissionsArrayOrNullSetEnum = {
2827
+ True: true
2828
+ };
2829
+ /**
2830
+ * @export
2831
+ */
2832
+ var SpecifiedFieldValueStorageLayerUpdateOrNullSetEnum = {
2833
+ True: true
2834
+ };
2835
+ /**
2836
+ * @export
2837
+ */
2838
+ var SpecifiedFieldValueStorageLayerUpdateOrNullValueTypeEnum = {
2839
+ GoogleStorage: "GoogleStorage"
2840
+ };
2841
+ /**
2842
+ * @export
2843
+ */
2844
+ var StorageLayerSummaryTypeEnum = {
2845
+ GoogleStorage: "GoogleStorage"
2846
+ };
2847
+ /**
2848
+ * @export
2849
+ */
2850
+ var StorageLayerUpdateTypeEnum = {
2851
+ GoogleStorage: "GoogleStorage"
2852
+ };
2853
+ /**
2854
+ * @export
2855
+ */
2856
+ var TagConditionTypeEnum = {
2857
+ All: "All"
2858
+ };
2859
+ /**
2860
+ * @export
2861
+ */
2862
+ var TagConditionAllTypeEnum = {
2863
+ All: "All"
2864
+ };
2865
+ /**
2866
+ * @export
2867
+ */
2868
+ var TagConditionAndTypeEnum = {
2869
+ And: "And"
2870
+ };
2871
+ /**
2872
+ * @export
2873
+ */
2874
+ var TagConditionAnyTypeEnum = {
2875
+ Any: "Any"
2876
+ };
2877
+ /**
2878
+ * @export
2879
+ */
2880
+ var TagConditionEqualsTypeEnum = {
2881
+ Equals: "Equals"
2882
+ };
2883
+ /**
2884
+ * @export
2885
+ */
2886
+ var TagConditionNotTypeEnum = {
2887
+ Not: "Not"
2888
+ };
2889
+ /**
2890
+ * @export
2891
+ */
2892
+ var TagConditionOrTypeEnum = {
2893
+ Or: "Or"
2894
+ };
2895
+ /**
2896
+ * @export
2897
+ */
2898
+ var UnspecifiedFieldValueSetEnum = {
2899
+ False: false
2900
+ };
2901
+ /**
2902
+ * @export
2903
+ */
2904
+ var UpdatableFieldFolderDescriptionOrNullSetEnum = {
2905
+ True: true
2906
+ };
2907
+ /**
2908
+ * @export
2909
+ */
2910
+ var UpdatableFieldPublicPermissionsArrayOrNullSetEnum = {
2911
+ True: true
2912
+ };
2913
+ /**
2914
+ * @export
2915
+ */
2916
+ var UpdatableFieldStorageLayerUpdateOrNullSetEnum = {
2917
+ True: true
2918
+ };
2919
+ /**
2920
+ * @export
2921
+ */
2922
+ var WebStorageTypeEnum = {
2923
+ Web: "Web"
2924
+ };
2925
+ ;// CONCATENATED MODULE: ./src/gen/index.ts
2926
+ /* tslint:disable */
2927
+ /* eslint-disable */
2928
+
2929
+
2930
+
2931
+ ;// CONCATENATED MODULE: ./src/utils/NodeUtils.ts
2932
+ function NodeUtils_typeof(obj) { "@babel/helpers - typeof"; return NodeUtils_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; }, NodeUtils_typeof(obj); }
2933
+ function NodeUtils_await(value, then, direct) {
2934
+ if (direct) {
2935
+ return then ? then(value) : value;
2936
+ }
2937
+ if (!value || !value.then) {
2938
+ value = Promise.resolve(value);
2939
+ }
2940
+ return then ? value.then(then) : value;
2941
+ }
2942
+ function NodeUtils_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2943
+ function NodeUtils_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, NodeUtils_toPropertyKey(descriptor.key), descriptor); } }
2944
+ function NodeUtils_createClass(Constructor, protoProps, staticProps) { if (protoProps) NodeUtils_defineProperties(Constructor.prototype, protoProps); if (staticProps) NodeUtils_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
2945
+ function NodeUtils_toPropertyKey(arg) { var key = NodeUtils_toPrimitive(arg, "string"); return NodeUtils_typeof(key) === "symbol" ? key : String(key); }
2946
+ function NodeUtils_toPrimitive(input, hint) { if (NodeUtils_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (NodeUtils_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
2947
+ /**
2948
+ * Provides access to Node.js built-in libraries. Should only be called when we're certain we're running in Node.js.
2949
+ *
2950
+ * We import lazily to support browsers, which don't have these modules, but also won't call these methods so won't trigger the imports.
2951
+ */
2952
+ var NodeUtils = /*#__PURE__*/function () {
2953
+ function NodeUtils() {
2954
+ NodeUtils_classCallCheck(this, NodeUtils);
2955
+ }
2956
+ NodeUtils_createClass(NodeUtils, null, [{
2957
+ key: "createStream",
2958
+ value: function createStream() {
2959
+ try {
2960
+ return NodeUtils_await(__webpack_require__.e(/* import() */ "_9d47").then(__webpack_require__.t.bind(__webpack_require__, "?9d47", 23)), function (_import) {
2961
+ var streamModule = _import["default"];
2962
+ var Readable = streamModule.Readable;
2963
+ var readable = new Readable();
2964
+ readable._read = function () {}; // _read is required but you can noop it
2965
+ return readable;
2966
+ });
2967
+ } catch (e) {
2968
+ return Promise.reject(e);
2969
+ }
2970
+ }
2971
+ }, {
2972
+ key: "createBlob",
2973
+ value: function createBlob(sources, options) {
2974
+ try {
2975
+ return NodeUtils_await(__webpack_require__.e(/* import() */ "_96d8").then(__webpack_require__.t.bind(__webpack_require__, "?96d8", 23)), function (_import2) {
2976
+ var bufferModule = _import2["default"];
2977
+ var B = bufferModule.Blob;
2978
+ return new B(sources, options);
2979
+ });
2980
+ } catch (e) {
2981
+ return Promise.reject(e);
2982
+ }
2983
+ }
2984
+ }]);
2985
+ return NodeUtils;
2986
+ }();
2987
+ ;// CONCATENATED MODULE: ./src/utils/ChunkedStream.ts
2988
+ function ChunkedStream_typeof(obj) { "@babel/helpers - typeof"; return ChunkedStream_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; }, ChunkedStream_typeof(obj); }
2989
+ function ChunkedStream_invoke(body, then) {
2990
+ var result = body();
2991
+ if (result && result.then) {
2992
+ return result.then(then);
2993
+ }
2994
+ return then(result);
2995
+ }
2996
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || ChunkedStream_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2997
+ 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."); }
2998
+ function ChunkedStream_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return ChunkedStream_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 ChunkedStream_arrayLikeToArray(o, minLen); }
2999
+ function ChunkedStream_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; }
3000
+ 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; } }
3001
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
3002
+ function ChunkedStream_await(value, then, direct) {
3003
+ if (direct) {
3004
+ return then ? then(value) : value;
3005
+ }
3006
+ if (!value || !value.then) {
3007
+ value = Promise.resolve(value);
3008
+ }
3009
+ return then ? value.then(then) : value;
3010
+ }
3011
+ function ChunkedStream_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3012
+ function ChunkedStream_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, ChunkedStream_toPropertyKey(descriptor.key), descriptor); } }
3013
+ function ChunkedStream_createClass(Constructor, protoProps, staticProps) { if (protoProps) ChunkedStream_defineProperties(Constructor.prototype, protoProps); if (staticProps) ChunkedStream_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
3014
+ function ChunkedStream_toPropertyKey(arg) { var key = ChunkedStream_toPrimitive(arg, "string"); return ChunkedStream_typeof(key) === "symbol" ? key : String(key); }
3015
+ function ChunkedStream_toPrimitive(input, hint) { if (ChunkedStream_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (ChunkedStream_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
3016
+
3017
+ var ChunkedStream = /*#__PURE__*/function () {
3018
+ function ChunkedStream(source) {
3019
+ ChunkedStream_classCallCheck(this, ChunkedStream);
3020
+ this.source = source;
3021
+ this.buffer = Buffer.alloc(0);
3022
+ this.isSourceFullyConsumed = false; // true if the source stream indicates it has finished.
3023
+ this.isFinishedConsuming = false; // true if _we_ indicate we have finished reading all we want from the stream.
3024
+ this.resolver = undefined;
3025
+ }
3026
+ /**
3027
+ * If the source stream is larger than the 'size' the user is consuming (i.e. they're only wanting to upload a subset
3028
+ * of the stream) then the stream won't be resolved by the 'end' event inside 'runChunkPipeline', so calling this
3029
+ * method is necessary.
3030
+ */
3031
+ ChunkedStream_createClass(ChunkedStream, [{
3032
+ key: "finishedConsuming",
3033
+ value: function finishedConsuming() {
3034
+ this.isFinishedConsuming = true;
3035
+ if (this.resolver !== undefined) {
3036
+ this.resolver();
3037
+ }
3038
+ }
3039
+ /**
3040
+ * Promise resolves when the entire stream has finished processing, or an error occurs.
3041
+ * You must call 'take' a sufficient number of times after calling this method in order for this promise to resolve.
3042
+ */
3043
+ }, {
3044
+ key: "runChunkPipeline",
3045
+ value: function runChunkPipeline() {
3046
+ try {
3047
+ var _this2 = this;
3048
+ return ChunkedStream_await(new Promise(function (resolve, reject) {
3049
+ _this2.resolver = resolve;
3050
+ var onError = function onError(error) {
3051
+ removeListeners();
3052
+ reject(error);
3053
+ };
3054
+ var onEnd = function onEnd() {
3055
+ _this2.isSourceFullyConsumed = true;
3056
+ removeListeners();
3057
+ resolve();
3058
+ };
3059
+ var onData = function onData(buffer) {
3060
+ try {
3061
+ if (_this2.isFinishedConsuming) {
3062
+ return;
3063
+ }
3064
+ if (_this2.consumer === undefined) {
3065
+ console.warn("Stream yielded data while paused. The data will be buffered, but excessive buffering can cause memory issues.");
3066
+ _this2.buffer = Buffer.concat([_this2.buffer, buffer]);
3067
+ return;
3068
+ }
3069
+ if (_this2.consumer.bytesRemaining <= 0) {
3070
+ throw new Error("Consumer requires zero bytes, so should not be consuming from the stream.");
3071
+ }
3072
+ if (_this2.buffer.byteLength > 0) {
3073
+ throw new Error("Buffer was expected to be empty (as it should have been flushed to the consumer when '.take' was called).");
3074
+ }
3075
+ var splitResult = _this2.splitBuffer(buffer, _this2.consumer.bytesRemaining);
3076
+ if (splitResult === undefined) {
3077
+ return; // Received empty data.
3078
+ }
3079
+
3080
+ var _splitResult = _slicedToArray(splitResult, 2),
3081
+ consumed = _splitResult[0],
3082
+ remaining = _splitResult[1];
3083
+ _this2.buffer = remaining;
3084
+ _this2.consumer.bytesRemaining -= consumed.byteLength;
3085
+ _this2.consumer.stream.push(consumed);
3086
+ if (_this2.consumer.bytesRemaining === 0) {
3087
+ _this2.finishStream(_this2.consumer.stream);
3088
+ _this2.consumer = undefined;
3089
+ _this2.source.pause();
3090
+ }
3091
+ } catch (e) {
3092
+ removeListeners();
3093
+ reject(e);
3094
+ }
3095
+ };
3096
+ var removeListeners = function removeListeners() {
3097
+ _this2.source.removeListener("data", onData);
3098
+ _this2.source.removeListener("error", onError);
3099
+ _this2.source.removeListener("end", onEnd);
3100
+ };
3101
+ _this2.source.on("data", onData);
3102
+ _this2.source.on("error", onError);
3103
+ _this2.source.on("end", onEnd);
3104
+ _this2.source.pause(); // Resumed when 'take' is called.
3105
+ }));
3106
+ } catch (e) {
3107
+ return Promise.reject(e);
3108
+ }
3109
+ }
3110
+ /**
3111
+ * Only call 'take' after the previously returned stream has been fully consumed.
3112
+ */
3113
+ }, {
3114
+ key: "take",
3115
+ value: function take(bytes) {
3116
+ try {
3117
+ var _exit2 = false;
3118
+ var _this4 = this;
3119
+ var _a;
3120
+ if (_this4.consumer !== undefined) {
3121
+ throw new Error("The stream from the previous 'take' call must be fully consumed before calling 'take' again.");
3122
+ }
3123
+ return ChunkedStream_invoke(function () {
3124
+ if (bytes <= 0) {
3125
+ _exit2 = true;
3126
+ return ChunkedStream_await(_this4.emptyStream());
3127
+ }
3128
+ }, function (_result) {
3129
+ return _exit2 ? _result : ChunkedStream_await(NodeUtils.createStream(), function (readable) {
3130
+ var consumedFromBuffer = _this4.consumeFromBuffer(bytes);
3131
+ var consumedFromBufferLength = (_a = consumedFromBuffer === null || consumedFromBuffer === void 0 ? void 0 : consumedFromBuffer.length) !== null && _a !== void 0 ? _a : 0;
3132
+ var bytesToConsumeFromStream = bytes - consumedFromBufferLength;
3133
+ if (consumedFromBuffer !== undefined) {
3134
+ readable.push(consumedFromBuffer);
3135
+ }
3136
+ if (bytesToConsumeFromStream > 0) {
3137
+ if (_this4.isSourceFullyConsumed) {
3138
+ throw new Error("Stream finished processing earlier than expected. The \"size\" parameter is likely larger than the stream's actual contents.");
3139
+ }
3140
+ _this4.consumer = {
3141
+ bytesRemaining: bytesToConsumeFromStream,
3142
+ stream: readable
3143
+ };
3144
+ _this4.source.resume();
3145
+ } else {
3146
+ _this4.finishStream(readable);
3147
+ }
3148
+ return readable;
3149
+ });
3150
+ });
3151
+ } catch (e) {
3152
+ return Promise.reject(e);
3153
+ }
3154
+ }
3155
+ }, {
3156
+ key: "consumeFromBuffer",
3157
+ value: function consumeFromBuffer(bytes) {
3158
+ var splitResult = this.splitBuffer(this.buffer, bytes);
3159
+ if (splitResult === undefined) {
3160
+ return undefined;
3161
+ }
3162
+ var _splitResult2 = _slicedToArray(splitResult, 2),
3163
+ consumed = _splitResult2[0],
3164
+ remaining = _splitResult2[1];
3165
+ this.buffer = remaining;
3166
+ return consumed;
3167
+ }
3168
+ }, {
3169
+ key: "splitBuffer",
3170
+ value: function splitBuffer(buffer, maxBytes) {
3171
+ if (buffer.byteLength === 0) {
3172
+ return undefined;
3173
+ }
3174
+ var bytesToConsume = Math.min(maxBytes, buffer.byteLength);
3175
+ if (bytesToConsume === buffer.byteLength) {
3176
+ return [buffer, Buffer.alloc(0)]; // Optimization
3177
+ }
3178
+
3179
+ var consumed = buffer.subarray(0, bytesToConsume);
3180
+ var remaining = buffer.subarray(bytesToConsume);
3181
+ return [consumed, remaining];
3182
+ }
3183
+ }, {
3184
+ key: "emptyStream",
3185
+ value: function emptyStream() {
3186
+ try {
3187
+ var _this6 = this;
3188
+ return ChunkedStream_await(NodeUtils.createStream(), function (readable) {
3189
+ _this6.finishStream(readable);
3190
+ return readable;
3191
+ });
3192
+ } catch (e) {
3193
+ return Promise.reject(e);
3194
+ }
3195
+ }
3196
+ }, {
3197
+ key: "finishStream",
3198
+ value: function finishStream(readable) {
3199
+ readable.push(null);
3200
+ }
3201
+ }]);
3202
+ return ChunkedStream;
3203
+ }();
3204
+ ;// CONCATENATED MODULE: ./src/utils/Model.ts
3205
+ 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); }
3206
+ 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); } }
3207
+ 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; }
3208
+ function Model_toPropertyKey(arg) { var key = Model_toPrimitive(arg, "string"); return Model_typeof(key) === "symbol" ? key : String(key); }
3209
+ 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); }
3210
+ function Model_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3211
+ 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); }
3212
+ 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); }; }
3213
+ 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); }
3214
+ function Model_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
3215
+ 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); }
3216
+ 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); }
3217
+ 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; } }
3218
+ function Model_isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
3219
+ 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); }
3220
+ function Model_getPrototypeOf(o) { Model_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Model_getPrototypeOf(o); }
3221
+ var CancelledError = /*#__PURE__*/function (_Error) {
3222
+ Model_inherits(CancelledError, _Error);
3223
+ var _super = Model_createSuper(CancelledError);
3224
+ function CancelledError(msg) {
3225
+ var _this;
3226
+ Model_classCallCheck(this, CancelledError);
3227
+ _this = _super.call(this, msg);
3228
+ _this.msg = msg;
3229
+ _this.name = "CancelledError";
3230
+ return _this;
3231
+ }
3232
+ return Model_createClass(CancelledError);
3233
+ }( /*#__PURE__*/Model_wrapNativeSuper(Error));
3234
+ ;// CONCATENATED MODULE: ./src/utils/UploadManager.ts
3235
+ function UploadManager_typeof(obj) { "@babel/helpers - typeof"; return UploadManager_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; }, UploadManager_typeof(obj); }
3236
+ function UploadManager_async(f) {
3237
+ return function () {
3238
+ for (var args = [], i = 0; i < arguments.length; i++) {
3239
+ args[i] = arguments[i];
3240
+ }
3241
+ try {
3242
+ return Promise.resolve(f.apply(this, args));
3243
+ } catch (e) {
3244
+ return Promise.reject(e);
3245
+ }
3246
+ };
3247
+ }
3248
+ function UploadManager_empty() {}
3249
+ function UploadManager_awaitIgnored(value, direct) {
3250
+ if (!direct) {
3251
+ return value && value.then ? value.then(UploadManager_empty) : Promise.resolve();
3252
+ }
3253
+ }
3254
+ function UploadManager_invoke(body, then) {
3255
+ var result = body();
3256
+ if (result && result.then) {
3257
+ return result.then(then);
3258
+ }
3259
+ return then(result);
3260
+ }
3261
+ function UploadManager_invokeIgnored(body) {
3262
+ var result = body();
3263
+ if (result && result.then) {
3264
+ return result.then(UploadManager_empty);
3265
+ }
3266
+ }
3267
+ function UploadManager_settle(pact, state, value) {
3268
+ if (!pact.s) {
3269
+ if (value instanceof UploadManager_Pact) {
3270
+ if (value.s) {
3271
+ if (state & 1) {
3272
+ state = value.s;
3273
+ }
3274
+ value = value.v;
3275
+ } else {
3276
+ value.o = UploadManager_settle.bind(null, pact, state);
3277
+ return;
3278
+ }
3279
+ }
3280
+ if (value && value.then) {
3281
+ value.then(UploadManager_settle.bind(null, pact, state), UploadManager_settle.bind(null, pact, 2));
3282
+ return;
3283
+ }
3284
+ pact.s = state;
3285
+ pact.v = value;
3286
+ var observer = pact.o;
3287
+ if (observer) {
3288
+ observer(pact);
3289
+ }
3290
+ }
3291
+ }
3292
+ var UploadManager_Pact = /*#__PURE__*/function () {
3293
+ function _Pact() {}
3294
+ _Pact.prototype.then = function (onFulfilled, onRejected) {
3295
+ var result = new _Pact();
3296
+ var state = this.s;
3297
+ if (state) {
3298
+ var callback = state & 1 ? onFulfilled : onRejected;
3299
+ if (callback) {
3300
+ try {
3301
+ UploadManager_settle(result, 1, callback(this.v));
3302
+ } catch (e) {
3303
+ UploadManager_settle(result, 2, e);
3304
+ }
3305
+ return result;
3306
+ } else {
3307
+ return this;
3308
+ }
3309
+ }
3310
+ this.o = function (_this) {
3311
+ try {
3312
+ var value = _this.v;
3313
+ if (_this.s & 1) {
3314
+ UploadManager_settle(result, 1, onFulfilled ? onFulfilled(value) : value);
3315
+ } else if (onRejected) {
3316
+ UploadManager_settle(result, 1, onRejected(value));
3317
+ } else {
3318
+ UploadManager_settle(result, 2, value);
3319
+ }
3320
+ } catch (e) {
3321
+ UploadManager_settle(result, 2, e);
3322
+ }
3323
+ };
3324
+ return result;
3325
+ };
3326
+ return _Pact;
3327
+ }();
3328
+ function UploadManager_isSettledPact(thenable) {
3329
+ return thenable instanceof UploadManager_Pact && thenable.s & 1;
3330
+ }
3331
+ function _for(test, update, body) {
3332
+ var stage;
3333
+ for (;;) {
3334
+ var shouldContinue = test();
3335
+ if (UploadManager_isSettledPact(shouldContinue)) {
3336
+ shouldContinue = shouldContinue.v;
3337
+ }
3338
+ if (!shouldContinue) {
3339
+ return result;
3340
+ }
3341
+ if (shouldContinue.then) {
3342
+ stage = 0;
3343
+ break;
3344
+ }
3345
+ var result = body();
3346
+ if (result && result.then) {
3347
+ if (UploadManager_isSettledPact(result)) {
3348
+ result = result.s;
3349
+ } else {
3350
+ stage = 1;
3351
+ break;
3352
+ }
3353
+ }
3354
+ if (update) {
3355
+ var updateValue = update();
3356
+ if (updateValue && updateValue.then && !UploadManager_isSettledPact(updateValue)) {
3357
+ stage = 2;
3358
+ break;
3359
+ }
3360
+ }
3361
+ }
3362
+ var pact = new UploadManager_Pact();
3363
+ var reject = UploadManager_settle.bind(null, pact, 2);
3364
+ (stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);
3365
+ return pact;
3366
+ function _resumeAfterBody(value) {
3367
+ result = value;
3368
+ do {
3369
+ if (update) {
3370
+ updateValue = update();
3371
+ if (updateValue && updateValue.then && !UploadManager_isSettledPact(updateValue)) {
3372
+ updateValue.then(_resumeAfterUpdate).then(void 0, reject);
3373
+ return;
3374
+ }
3375
+ }
3376
+ shouldContinue = test();
3377
+ if (!shouldContinue || UploadManager_isSettledPact(shouldContinue) && !shouldContinue.v) {
3378
+ UploadManager_settle(pact, 1, result);
3379
+ return;
3380
+ }
3381
+ if (shouldContinue.then) {
3382
+ shouldContinue.then(_resumeAfterTest).then(void 0, reject);
3383
+ return;
3384
+ }
3385
+ result = body();
3386
+ if (UploadManager_isSettledPact(result)) {
3387
+ result = result.v;
3388
+ }
3389
+ } while (!result || !result.then);
3390
+ result.then(_resumeAfterBody).then(void 0, reject);
3391
+ }
3392
+ function _resumeAfterTest(shouldContinue) {
3393
+ if (shouldContinue) {
3394
+ result = body();
3395
+ if (result && result.then) {
3396
+ result.then(_resumeAfterBody).then(void 0, reject);
3397
+ } else {
3398
+ _resumeAfterBody(result);
3399
+ }
3400
+ } else {
3401
+ UploadManager_settle(pact, 1, result);
3402
+ }
3403
+ }
3404
+ function _resumeAfterUpdate() {
3405
+ if (shouldContinue = test()) {
3406
+ if (shouldContinue.then) {
3407
+ shouldContinue.then(_resumeAfterTest).then(void 0, reject);
3408
+ } else {
3409
+ _resumeAfterTest(shouldContinue);
3410
+ }
3411
+ } else {
3412
+ UploadManager_settle(pact, 1, result);
3413
+ }
3414
+ }
3415
+ }
3416
+ function _continueIgnored(value) {
3417
+ if (value && value.then) {
3418
+ return value.then(UploadManager_empty);
3419
+ }
3420
+ }
3421
+ function UploadManager_toConsumableArray(arr) { return UploadManager_arrayWithoutHoles(arr) || UploadManager_iterableToArray(arr) || UploadManager_unsupportedIterableToArray(arr) || UploadManager_nonIterableSpread(); }
3422
+ function UploadManager_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."); }
3423
+ function UploadManager_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return UploadManager_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 UploadManager_arrayLikeToArray(o, minLen); }
3424
+ function UploadManager_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
3425
+ function UploadManager_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return UploadManager_arrayLikeToArray(arr); }
3426
+ function UploadManager_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; }
3427
+ function UploadManager_await(value, then, direct) {
3428
+ if (direct) {
3429
+ return then ? then(value) : value;
3430
+ }
3431
+ if (!value || !value.then) {
3432
+ value = Promise.resolve(value);
3433
+ }
3434
+ return then ? value.then(then) : value;
3435
+ }
3436
+ function UploadManager_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3437
+ function UploadManager_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, UploadManager_toPropertyKey(descriptor.key), descriptor); } }
3438
+ function UploadManager_createClass(Constructor, protoProps, staticProps) { if (protoProps) UploadManager_defineProperties(Constructor.prototype, protoProps); if (staticProps) UploadManager_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
3439
+ function UploadManager_toPropertyKey(arg) { var key = UploadManager_toPrimitive(arg, "string"); return UploadManager_typeof(key) === "symbol" ? key : String(key); }
3440
+ function UploadManager_toPrimitive(input, hint) { if (UploadManager_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (UploadManager_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
3441
+
3442
+
3443
+
3444
+
3445
+ var UploadManager = /*#__PURE__*/function () {
3446
+ function UploadManager() {
3447
+ var configuration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DefaultConfig;
3448
+ UploadManager_classCallCheck(this, UploadManager);
3449
+ this.configuration = configuration;
3450
+ this.stringMimeType = "text/plain";
3451
+ this.defaultMaxConcurrentUploadParts = 4;
3452
+ this.uploadApi = new UploadApi(configuration);
3453
+ }
3454
+ UploadManager_createClass(UploadManager, [{
3455
+ key: "upload",
3456
+ value: function upload(request) {
3457
+ try {
3458
+ var _this2 = this;
3459
+ return UploadManager_await(_this2.processUploadSource(request.data), function (data) {
3460
+ var chunkedStream = _this2.getChunkedStream(data);
3461
+ return UploadManager_await(_this2.beginUpload(request, data), function (uploadInfo) {
3462
+ _this2.checkIfCancelled(request);
3463
+ var maxConcurrency = _this2.calculateMaxConcurrency(request, data);
3464
+ var partCount = uploadInfo.uploadParts.count;
3465
+ var parts = UploadManager_toConsumableArray(Array(partCount).keys());
3466
+ var runSourceStreamPump = chunkedStream === null || chunkedStream === void 0 ? void 0 : chunkedStream.runChunkPipeline();
3467
+ return UploadManager_await(_this2.mapAsync(parts, maxConcurrency, UploadManager_async(function (part) {
3468
+ return _this2.uploadPart(request, data, part, uploadInfo);
3469
+ })), function () {
3470
+ if (chunkedStream !== undefined) {
3471
+ chunkedStream.finishedConsuming();
3472
+ }
3473
+ return UploadManager_await(runSourceStreamPump, function () {
3474
+ return uploadInfo.file;
3475
+ });
3476
+ });
3477
+ });
3478
+ });
3479
+ } catch (e) {
3480
+ return Promise.reject(e);
3481
+ }
3482
+ }
3483
+ }, {
3484
+ key: "checkIfCancelled",
3485
+ value: function checkIfCancelled(request) {
3486
+ var _a;
3487
+ if (((_a = request.cancellationToken) === null || _a === void 0 ? void 0 : _a.isCancelled) === true) {
3488
+ throw new CancelledError("Upload cancelled by user.");
3489
+ }
3490
+ }
3491
+ }, {
3492
+ key: "beginUpload",
3493
+ value: function beginUpload(request, data) {
3494
+ try {
3495
+ var _this4 = this;
3496
+ var size = _this4.calculateSize(request, data);
3497
+ var mime = _this4.calculateMime(request, data);
3498
+ var originalFileName = _this4.calculateOriginalFileName(request, data);
3499
+ return UploadManager_await(_this4.uploadApi.beginMultipartUpload({
3500
+ accountId: request.accountId,
3501
+ beginMultipartUploadRequest: {
3502
+ metadata: request.metadata,
3503
+ mime: mime,
3504
+ originalFileName: originalFileName,
3505
+ path: request.path,
3506
+ protocol: "1.1",
3507
+ size: size,
3508
+ tags: request.tags
3509
+ }
3510
+ }));
3511
+ } catch (e) {
3512
+ return Promise.reject(e);
3513
+ }
3514
+ }
3515
+ }, {
3516
+ key: "uploadPart",
3517
+ value: function uploadPart(request, data, partIndex, uploadInfo) {
3518
+ try {
3519
+ var _this6 = this;
3520
+ _this6.checkIfCancelled(request);
3521
+ return UploadManager_await(_this6.getUploadPart(request, partIndex, uploadInfo), function (part) {
3522
+ _this6.checkIfCancelled(request);
3523
+ return UploadManager_await(_this6.putUploadPart(part, data), function (etag) {
3524
+ _this6.checkIfCancelled(request);
3525
+ return UploadManager_awaitIgnored(_this6.uploadApi.completeUploadPart({
3526
+ accountId: request.accountId,
3527
+ uploadId: uploadInfo.uploadId,
3528
+ uploadPartIndex: partIndex,
3529
+ completeUploadPartRequest: {
3530
+ etag: etag
3531
+ }
3532
+ }));
3533
+ });
3534
+ });
3535
+ } catch (e) {
3536
+ return Promise.reject(e);
3537
+ }
3538
+ }
3539
+ /**
3540
+ * Returns etag for the part.
3541
+ */
3542
+ }, {
3543
+ key: "putUploadPart",
3544
+ value: function putUploadPart(part, data) {
3545
+ try {
3546
+ var _this8 = this;
3547
+ var _a, _b;
3548
+ var fetchApi = (_a = _this8.configuration.fetchApi) !== null && _a !== void 0 ? _a : fetch;
3549
+ var headers = {
3550
+ // Required to prevent fetch using "Transfer-Encoding: Chunked" when body is a stream.
3551
+ "content-length": (part.range.inclusiveEnd + 1 - part.range.inclusiveStart).toString()
3552
+ };
3553
+ var _part$uploadUrl2 = part.uploadUrl,
3554
+ _coerceRequestBody2 = _this8.coerceRequestBody;
3555
+ return UploadManager_await(_this8.makeRequestBody(part, data), function (_this7$makeRequestBod) {
3556
+ return UploadManager_await(fetchApi(_part$uploadUrl2, {
3557
+ method: "PUT",
3558
+ headers: headers,
3559
+ body: _coerceRequestBody2.call(_this8, _this7$makeRequestBod)
3560
+ }), function (response) {
3561
+ var _exit = false;
3562
+ var etag = (_b = response.headers.get("etag")) !== null && _b !== void 0 ? _b : undefined;
3563
+ return UploadManager_invoke(function () {
3564
+ if (Math.floor(response.status / 100) !== 2) {
3565
+ return UploadManager_await(response.text(), function (_response$text) {
3566
+ console.error("Failed to upload part (".concat(response.status, "). Response from server:\n").concat(_response$text));
3567
+ throw new Error("Failed to upload part (".concat(response.status, ")."));
3568
+ });
3569
+ }
3570
+ }, function (_result) {
3571
+ if (_exit) return _result;
3572
+ if (etag === undefined) {
3573
+ throw new Error("No 'etag' response header found in upload part response.");
3574
+ }
3575
+ return etag;
3576
+ });
3577
+ });
3578
+ });
3579
+ } catch (e) {
3580
+ return Promise.reject(e);
3581
+ }
3582
+ }
3583
+ }, {
3584
+ key: "coerceRequestBody",
3585
+ value: function coerceRequestBody(data) {
3586
+ return data; // node-fetch supports 'NodeJS.ReadableStream'
3587
+ }
3588
+ }, {
3589
+ key: "makeRequestBody",
3590
+ value: function makeRequestBody(part, data) {
3591
+ try {
3592
+ var _this10 = this;
3593
+ return UploadManager_await(_this10.sliceDataForRequest(data, part), function (slicedData) {
3594
+ var isNodeJs = _this10.isNodeJs();
3595
+ // node-fetch requires 'NodeJS.ReadableStream' for the body.
3596
+ // browser fetch supports blobs and buffers.
3597
+ return UploadManager_await(_this10.foldDataRaw(slicedData, {
3598
+ ifBuffer: UploadManager_async(function (buffer) {
3599
+ return isNodeJs ? _this10.bufferToStream(buffer) : buffer;
3600
+ }),
3601
+ ifBlob: UploadManager_async(function (blob) {
3602
+ var _bufferToStream = isNodeJs && _this10.bufferToStream;
3603
+ return UploadManager_await(isNodeJs ? _this10.blobToBuffer(blob) : blob, function (_this10$blobToBuffer) {
3604
+ return UploadManager_await(isNodeJs ? _bufferToStream.call(_this10, _this10$blobToBuffer) : _this10$blobToBuffer, void 0, !isNodeJs);
3605
+ }, !isNodeJs);
3606
+ }),
3607
+ ifNodeJsStream: function (stream) {
3608
+ return UploadManager_await(stream);
3609
+ }
3610
+ }));
3611
+ });
3612
+ } catch (e) {
3613
+ return Promise.reject(e);
3614
+ }
3615
+ }
3616
+ }, {
3617
+ key: "bufferToStream",
3618
+ value: function bufferToStream(buffer) {
3619
+ try {
3620
+ return UploadManager_await(NodeUtils.createStream(), function (readable) {
3621
+ readable.push(buffer);
3622
+ readable.push(null);
3623
+ return readable;
3624
+ });
3625
+ } catch (e) {
3626
+ return Promise.reject(e);
3627
+ }
3628
+ }
3629
+ /**
3630
+ * Only expected to be called in Node.js environments, and as such, we can assume 'BlobLike' is not a DOM 'File' object.
3631
+ */
3632
+ }, {
3633
+ key: "blobToBuffer",
3634
+ value: function blobToBuffer(blob) {
3635
+ try {
3636
+ var _exit3 = false;
3637
+ // DOM Blob and Node.js Blob both have 'arrayBuffer' with the same signature...
3638
+ return UploadManager_invoke(function () {
3639
+ if (blob.arrayBuffer !== undefined) {
3640
+ _exit3 = true;
3641
+ var _Buffer2 = Buffer,
3642
+ _from2 = _Buffer2.from;
3643
+ return UploadManager_await(blob.arrayBuffer(), function (_blob$arrayBuffer) {
3644
+ return _from2.call(_Buffer2, _blob$arrayBuffer);
3645
+ });
3646
+ }
3647
+ }, function (_result2) {
3648
+ if (_exit3) return _result2;
3649
+ throw new Error("The provided 'data' field was treated as a BLOB, but it does not have an 'arrayBuffer' method.");
3650
+ });
3651
+ } catch (e) {
3652
+ return Promise.reject(e);
3653
+ }
3654
+ }
3655
+ }, {
3656
+ key: "sliceDataForRequest",
3657
+ value: function sliceDataForRequest(data, part) {
3658
+ try {
3659
+ var _this12 = this;
3660
+ if (part.range.inclusiveEnd === -1) {
3661
+ return "";
3662
+ }
3663
+ var start = part.range.inclusiveStart;
3664
+ var endExclusive = part.range.inclusiveEnd + 1;
3665
+ var partSize = endExclusive - start;
3666
+ return UploadManager_await(_this12.foldData(data, {
3667
+ ifBlob: UploadManager_async(function (blob) {
3668
+ return blob.slice(start, endExclusive);
3669
+ }),
3670
+ ifBuffer: UploadManager_async(function (buffer) {
3671
+ return buffer.subarray(start, endExclusive);
3672
+ }),
3673
+ ifNodeJsStream: UploadManager_async(function (stream) {
3674
+ return stream.take(partSize);
3675
+ }) // Assumes stream is read using one worker (which it is).
3676
+ }));
3677
+ } catch (e) {
3678
+ return Promise.reject(e);
3679
+ }
3680
+ }
3681
+ }, {
3682
+ key: "isNodeJs",
3683
+ value: function isNodeJs() {
3684
+ return typeof process !== "undefined" && process.versions !== undefined && process.versions.node !== undefined;
3685
+ }
3686
+ }, {
3687
+ key: "getUploadPart",
3688
+ value: function getUploadPart(request, partIndex, uploadInfo) {
3689
+ try {
3690
+ var _this14 = this;
3691
+ if (partIndex === 0) {
3692
+ return uploadInfo.uploadParts.first;
3693
+ }
3694
+ return UploadManager_await(_this14.uploadApi.getUploadPart({
3695
+ uploadId: uploadInfo.uploadId,
3696
+ accountId: request.accountId,
3697
+ uploadPartIndex: partIndex
3698
+ }));
3699
+ } catch (e) {
3700
+ return Promise.reject(e);
3701
+ }
3702
+ }
3703
+ }, {
3704
+ key: "calculateSize",
3705
+ value: function calculateSize(request, data) {
3706
+ return this.foldData(data, {
3707
+ ifBlob: function ifBlob(blob) {
3708
+ return blob.size;
3709
+ },
3710
+ ifBuffer: function ifBuffer(buffer) {
3711
+ return buffer.length;
3712
+ },
3713
+ ifNodeJsStream: function ifNodeJsStream(_) {
3714
+ if (request.size === undefined) {
3715
+ throw new Error("You must include the 'size' parameter when using a stream for the 'data' parameter.");
3716
+ }
3717
+ return request.size;
3718
+ }
3719
+ });
3720
+ }
3721
+ }, {
3722
+ key: "calculateMime",
3723
+ value: function calculateMime(request, data) {
3724
+ var _a;
3725
+ return (_a = request.mime) !== null && _a !== void 0 ? _a : this.foldData(data, {
3726
+ ifBlob: function ifBlob(blob) {
3727
+ return blob.type;
3728
+ },
3729
+ ifBuffer: function ifBuffer(_) {
3730
+ return undefined;
3731
+ },
3732
+ ifNodeJsStream: function ifNodeJsStream(_) {
3733
+ return undefined;
3734
+ }
3735
+ });
3736
+ }
3737
+ }, {
3738
+ key: "calculateOriginalFileName",
3739
+ value: function calculateOriginalFileName(request, data) {
3740
+ var _a;
3741
+ return (_a = request.originalFileName) !== null && _a !== void 0 ? _a : this.foldData(data, {
3742
+ ifBlob: function ifBlob(blob) {
3743
+ return blob.name;
3744
+ },
3745
+ ifBuffer: function ifBuffer(_) {
3746
+ return undefined;
3747
+ },
3748
+ ifNodeJsStream: function ifNodeJsStream(_) {
3749
+ return undefined;
3750
+ }
3751
+ });
3752
+ }
3753
+ }, {
3754
+ key: "calculateMaxConcurrency",
3755
+ value: function calculateMaxConcurrency(request, data) {
3756
+ var _a;
3757
+ return (_a = this.foldData(data, {
3758
+ ifBlob: function ifBlob(_) {
3759
+ return request.maxConcurrentUploadParts;
3760
+ },
3761
+ ifBuffer: function ifBuffer(_) {
3762
+ return request.maxConcurrentUploadParts;
3763
+ },
3764
+ ifNodeJsStream: function ifNodeJsStream(_) {
3765
+ return 1;
3766
+ } // Uploading from a stream concurrently is more complex, as would require buffering parts in memory, so we serialize.
3767
+ })) !== null && _a !== void 0 ? _a : this.defaultMaxConcurrentUploadParts;
3768
+ }
3769
+ }, {
3770
+ key: "getChunkedStream",
3771
+ value: function getChunkedStream(data) {
3772
+ return this.foldData(data, {
3773
+ ifBlob: function ifBlob(_) {
3774
+ return undefined;
3775
+ },
3776
+ ifBuffer: function ifBuffer(_) {
3777
+ return undefined;
3778
+ },
3779
+ ifNodeJsStream: function ifNodeJsStream(x) {
3780
+ return x;
3781
+ }
3782
+ });
3783
+ }
3784
+ }, {
3785
+ key: "foldData",
3786
+ value: function foldData(data, handle) {
3787
+ if (data instanceof ChunkedStream) {
3788
+ return handle.ifNodeJsStream(data);
3789
+ }
3790
+ if (data.subarray !== undefined) {
3791
+ return handle.ifBuffer(data);
3792
+ }
3793
+ if (data.slice !== undefined) {
3794
+ return handle.ifBlob(data);
3795
+ }
3796
+ throw new Error("Unsupported type for 'data' parameter. Please provide a String, Blob, or Readable (Node.js).");
3797
+ }
3798
+ }, {
3799
+ key: "foldDataRaw",
3800
+ value: function foldDataRaw(data, handle) {
3801
+ try {
3802
+ var _exit8 = false;
3803
+ var _this16 = this;
3804
+ return UploadManager_invoke(function () {
3805
+ if (typeof data === "string") {
3806
+ _exit8 = true;
3807
+ var _ifBlob2 = handle.ifBlob;
3808
+ return UploadManager_await(_this16.stringToBlob(data), function (_this15$stringToBlob) {
3809
+ return UploadManager_await(_ifBlob2.call(handle, _this15$stringToBlob));
3810
+ });
3811
+ }
3812
+ }, function (_result3) {
3813
+ var _exit5 = false;
3814
+ if (_exit8) return _result3;
3815
+ return UploadManager_invoke(function () {
3816
+ if (data.on !== undefined) {
3817
+ _exit5 = true;
3818
+ return UploadManager_await(handle.ifNodeJsStream(data));
3819
+ }
3820
+ }, function (_result4) {
3821
+ var _exit6 = false;
3822
+ if (_exit5) return _result4;
3823
+ return UploadManager_invoke(function () {
3824
+ if (data.subarray !== undefined) {
3825
+ _exit6 = true;
3826
+ return UploadManager_await(handle.ifBuffer(data));
3827
+ }
3828
+ }, function (_result5) {
3829
+ var _exit7 = false;
3830
+ if (_exit6) return _result5;
3831
+ return UploadManager_invoke(function () {
3832
+ if (data.slice !== undefined) {
3833
+ _exit7 = true;
3834
+ return UploadManager_await(handle.ifBlob(data));
3835
+ }
3836
+ }, function (_result6) {
3837
+ if (_exit7) return _result6;
3838
+ throw new Error("Unsupported type for 'data' parameter. Please provide a String, Blob, or Readable (Node.js).");
3839
+ });
3840
+ });
3841
+ });
3842
+ });
3843
+ } catch (e) {
3844
+ return Promise.reject(e);
3845
+ }
3846
+ }
3847
+ }, {
3848
+ key: "processUploadSource",
3849
+ value: function processUploadSource(data) {
3850
+ try {
3851
+ var _exit10 = false;
3852
+ var _this18 = this;
3853
+ return UploadManager_invoke(function () {
3854
+ if (typeof data === "string") {
3855
+ _exit10 = true;
3856
+ return UploadManager_await(_this18.stringToBlob(data));
3857
+ }
3858
+ }, function (_result7) {
3859
+ if (_exit10) return _result7;
3860
+ if (data.on !== undefined) {
3861
+ return new ChunkedStream(data);
3862
+ }
3863
+ if (data.subarray !== undefined) {
3864
+ return data;
3865
+ }
3866
+ if (data.slice !== undefined) {
3867
+ return data;
3868
+ }
3869
+ throw new Error("Unsupported type for 'data' parameter. Please provide a String, Blob, or Readable (Node.js).");
3870
+ });
3871
+ } catch (e) {
3872
+ return Promise.reject(e);
3873
+ }
3874
+ }
3875
+ }, {
3876
+ key: "stringToBlob",
3877
+ value: function stringToBlob(data) {
3878
+ try {
3879
+ var _this20 = this;
3880
+ var _a;
3881
+ var _temp2 = (_a = _this20.globalBlob(data)) !== null && _a !== void 0;
3882
+ return UploadManager_await(_temp2 ? _a : _this20.nodeJsBlob(data), void 0, _temp2);
3883
+ } catch (e) {
3884
+ return Promise.reject(e);
3885
+ }
3886
+ } // Supported by browsers & newer versions of Node.js.
3887
+ }, {
3888
+ key: "globalBlob",
3889
+ value: function globalBlob(data) {
3890
+ var B = globalThis.Blob;
3891
+ if (B === undefined) {
3892
+ return undefined;
3893
+ }
3894
+ return new B([data], {
3895
+ type: this.stringMimeType
3896
+ });
3897
+ }
3898
+ // Fallback for Node.js
3899
+ }, {
3900
+ key: "nodeJsBlob",
3901
+ value: function nodeJsBlob(data) {
3902
+ try {
3903
+ var _this22 = this;
3904
+ return UploadManager_await(NodeUtils.createBlob([data], {
3905
+ type: _this22.stringMimeType
3906
+ }));
3907
+ } catch (e) {
3908
+ return Promise.reject(e);
3909
+ }
3910
+ }
3911
+ }, {
3912
+ key: "mapAsync",
3913
+ value: function mapAsync(items, concurrency, callback) {
3914
+ try {
3915
+ var workQueue = UploadManager_toConsumableArray(items);
3916
+ return UploadManager_awaitIgnored(Promise.all(UploadManager_toConsumableArray(Array(concurrency).keys()).map(UploadManager_async(function () {
3917
+ return _continueIgnored(_for(function () {
3918
+ return workQueue.length > 0;
3919
+ }, void 0, function () {
3920
+ var work = workQueue.shift(); // IMPORTANT: use 'shift' instead of 'pop' to ensure 'items' are processed in order when 'concurrency = 1'.
3921
+ return UploadManager_invokeIgnored(function () {
3922
+ if (work !== undefined) {
3923
+ return UploadManager_awaitIgnored(callback(work));
3924
+ }
3925
+ });
3926
+ }));
3927
+ }))));
3928
+ } catch (e) {
3929
+ return Promise.reject(e);
3930
+ }
3931
+ }
3932
+ }]);
3933
+ return UploadManager;
3934
+ }();
3935
+ ;// CONCATENATED MODULE: ./src/utils/index.ts
3936
+
3937
+
3938
+
3939
+ ;// CONCATENATED MODULE: ./src/index.ts
3940
+ /* tslint:disable */
3941
+ /* eslint-disable */
3942
+
3943
+
3944
+ module.exports = __webpack_exports__;
3945
+ /******/ })()
3946
+ ;