@bytescale/sdk 3.0.0-alpha.11 → 3.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -29
- package/dist/browser/cjs/main.js +96 -46
- package/dist/browser/esm/main.mjs +2771 -0
- package/dist/node/cjs/main.js +83 -57
- package/dist/node/esm/main.mjs +83 -57
- package/dist/types/index.worker.d.ts +2 -0
- package/dist/types/private/EnvChecker.d.ts +1 -1
- package/dist/types/private/StreamUtils.d.ts +1 -0
- package/dist/types/private/UploadManagerBrowserWorkerBase.d.ts +19 -0
- package/dist/types/private/UploadManagerFetchUtils.d.ts +8 -0
- package/dist/types/private/model/UploadSourceProcessed.d.ts +6 -1
- package/dist/types/public/browser/UploadManagerBrowser.d.ts +2 -11
- package/dist/types/public/worker/UploadManagerWorker.d.ts +8 -0
- package/dist/types/public/worker/index.d.ts +2 -0
- package/dist/worker/cjs/main.js +2542 -0
- package/dist/worker/esm/main.mjs +2542 -0
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -50,6 +50,8 @@
|
|
|
50
50
|
|
|
51
51
|
<hr/>
|
|
52
52
|
|
|
53
|
+
<img alt="Bytescale JavaScript SDK Example" src="https://raw.githubusercontent.com/bytescale/bytescale-javascript-sdk/main/.github/assets/bytescale-javascript-sdk.png">
|
|
54
|
+
|
|
53
55
|
## Installation
|
|
54
56
|
|
|
55
57
|
#### For Node.js:
|
|
@@ -78,21 +80,19 @@ This library is isomorphic, which means you can upload files from Node.js, or th
|
|
|
78
80
|
|
|
79
81
|
```javascript
|
|
80
82
|
import * as Bytescale from "@bytescale/sdk";
|
|
81
|
-
import
|
|
83
|
+
import nodeFetch from "node-fetch";
|
|
82
84
|
|
|
83
85
|
const uploadManager = new Bytescale.UploadManager({
|
|
84
|
-
fetchApi:
|
|
86
|
+
fetchApi: nodeFetch, // import nodeFetch from "node-fetch"; // Only required for Node.js // Errors can occur with other implementations // Try 'nodeFetch as any' for TypeScript
|
|
85
87
|
apiKey: "free" // Get API keys from: www.bytescale.com
|
|
86
88
|
});
|
|
87
89
|
|
|
88
90
|
uploadManager
|
|
89
91
|
.upload({
|
|
90
|
-
//
|
|
91
|
-
// Required:
|
|
92
|
-
// ---------
|
|
93
|
-
|
|
94
|
-
// Supported types for 'data' field:
|
|
92
|
+
// Supported types:
|
|
95
93
|
// - String
|
|
94
|
+
// - Blob
|
|
95
|
+
// - ArrayBuffer
|
|
96
96
|
// - Buffer
|
|
97
97
|
// - ReadableStream (Node.js), e.g. fs.createReadStream("file.txt")
|
|
98
98
|
data: "Hello World",
|
|
@@ -160,7 +160,7 @@ uploadManager
|
|
|
160
160
|
<script>
|
|
161
161
|
// import * as Bytescale from "@bytescale/sdk"
|
|
162
162
|
const uploadManager = new Bytescale.UploadManager({
|
|
163
|
-
apiKey: "
|
|
163
|
+
apiKey: "free" // Get API keys from: www.bytescale.com
|
|
164
164
|
});
|
|
165
165
|
|
|
166
166
|
const onFileSelected = async event => {
|
|
@@ -168,16 +168,10 @@ uploadManager
|
|
|
168
168
|
|
|
169
169
|
try {
|
|
170
170
|
const { fileUrl, filePath } = await uploadManager.upload({
|
|
171
|
-
//
|
|
172
|
-
// Required:
|
|
173
|
-
// ---------
|
|
174
|
-
|
|
175
|
-
// Your account ID (e.g. "W142hJk")
|
|
176
|
-
accountId: "YOUR_ACCOUNT_ID",
|
|
177
|
-
|
|
178
|
-
// Supported types for 'data' field:
|
|
171
|
+
// Supported types:
|
|
179
172
|
// - String
|
|
180
173
|
// - Blob
|
|
174
|
+
// - ArrayBuffer
|
|
181
175
|
// - File (i.e. from a DOM file input element)
|
|
182
176
|
data: file
|
|
183
177
|
|
|
@@ -245,16 +239,16 @@ uploadManager
|
|
|
245
239
|
|
|
246
240
|
```javascript
|
|
247
241
|
import * as Bytescale from "@bytescale/sdk";
|
|
248
|
-
import
|
|
242
|
+
import nodeFetch from "node-fetch"; // Only required for Node.js
|
|
249
243
|
|
|
250
244
|
const fileApi = new Bytescale.FileApi({
|
|
251
|
-
fetchApi:
|
|
252
|
-
apiKey: "
|
|
245
|
+
fetchApi: nodeFetch, // import nodeFetch from "node-fetch"; // Only required for Node.js // Errors can occur with other implementations // Try 'nodeFetch as any' for TypeScript
|
|
246
|
+
apiKey: "YOUR_API_KEY" // e.g. "secret_xxxxx"
|
|
253
247
|
});
|
|
254
248
|
|
|
255
249
|
fileApi
|
|
256
250
|
.downloadFile({
|
|
257
|
-
accountId: "
|
|
251
|
+
accountId: "YOUR_ACCOUNT_ID", // e.g. "W142hJk"
|
|
258
252
|
filePath: "/uploads/2022/12/25/hello_world.txt"
|
|
259
253
|
})
|
|
260
254
|
.then(response => response.text()) // .text() | .json() | .blob() | .stream()
|
|
@@ -271,15 +265,16 @@ Use the [`UrlBuilder`](#urlbuilder) to get a URL to your file (if you need a URL
|
|
|
271
265
|
```javascript
|
|
272
266
|
import * as Bytescale from "@bytescale/sdk";
|
|
273
267
|
import fetch from "node-fetch"; // Only required for Node.js
|
|
268
|
+
import fs from "fs";
|
|
274
269
|
|
|
275
270
|
const fileApi = new Bytescale.FileApi({
|
|
276
|
-
fetchApi:
|
|
277
|
-
apiKey: "
|
|
271
|
+
fetchApi: nodeFetch, // import nodeFetch from "node-fetch"; // Only required for Node.js // Errors can occur with other implementations // Try 'nodeFetch as any' for TypeScript
|
|
272
|
+
apiKey: "YOUR_API_KEY" // e.g. "secret_xxxxx"
|
|
278
273
|
});
|
|
279
274
|
|
|
280
275
|
fileApi
|
|
281
276
|
.processFile({
|
|
282
|
-
accountId: "
|
|
277
|
+
accountId: "YOUR_ACCOUNT_ID", // e.g. "W142hJk"
|
|
283
278
|
filePath: "/uploads/2022/12/25/image.jpg",
|
|
284
279
|
|
|
285
280
|
// See: https://www.bytescale.com/docs/image-processing-api
|
|
@@ -314,13 +309,13 @@ import * as Bytescale from "@bytescale/sdk";
|
|
|
314
309
|
import fetch from "node-fetch"; // Only required for Node.js
|
|
315
310
|
|
|
316
311
|
const fileApi = new Bytescale.FileApi({
|
|
317
|
-
fetchApi:
|
|
318
|
-
apiKey: "
|
|
312
|
+
fetchApi: nodeFetch, // import nodeFetch from "node-fetch"; // Only required for Node.js // Errors can occur with other implementations // Try 'nodeFetch as any' for TypeScript
|
|
313
|
+
apiKey: "YOUR_API_KEY" // e.g. "secret_xxxxx"
|
|
319
314
|
});
|
|
320
315
|
|
|
321
316
|
fileApi
|
|
322
317
|
.getFileDetails({
|
|
323
|
-
accountId: "
|
|
318
|
+
accountId: "YOUR_ACCOUNT_ID", // e.g. "W142hJk"
|
|
324
319
|
filePath: "/uploads/2022/12/25/image.jpg"
|
|
325
320
|
})
|
|
326
321
|
.then(
|
|
@@ -336,13 +331,13 @@ import * as Bytescale from "@bytescale/sdk";
|
|
|
336
331
|
import fetch from "node-fetch"; // Only required for Node.js
|
|
337
332
|
|
|
338
333
|
const folderApi = new Bytescale.FolderApi({
|
|
339
|
-
fetchApi:
|
|
340
|
-
apiKey: "
|
|
334
|
+
fetchApi: nodeFetch, // import nodeFetch from "node-fetch"; // Only required for Node.js // Errors can occur with other implementations // Try 'nodeFetch as any' for TypeScript
|
|
335
|
+
apiKey: "YOUR_API_KEY" // e.g. "secret_xxxxx"
|
|
341
336
|
});
|
|
342
337
|
|
|
343
338
|
folderApi
|
|
344
339
|
.listFolder({
|
|
345
|
-
accountId: "
|
|
340
|
+
accountId: "YOUR_ACCOUNT_ID", // e.g. "W142hJk"
|
|
346
341
|
folderPath: "/",
|
|
347
342
|
recursive: false
|
|
348
343
|
})
|
|
@@ -353,6 +348,12 @@ folderApi
|
|
|
353
348
|
);
|
|
354
349
|
```
|
|
355
350
|
|
|
351
|
+
## More Operations
|
|
352
|
+
|
|
353
|
+
For a complete list of operations, please see:
|
|
354
|
+
|
|
355
|
+
**[Bytescale JavaScript SDK Docs »](https://www.bytescale.com/docs/sdks/javascript)**
|
|
356
|
+
|
|
356
357
|
## Authorization
|
|
357
358
|
|
|
358
359
|
The Bytescale JavaScript SDK supports two types of authorization:
|
package/dist/browser/cjs/main.js
CHANGED
|
@@ -2268,9 +2268,9 @@ var UploadManagerBase = /*#__PURE__*/function () {
|
|
|
2268
2268
|
}]);
|
|
2269
2269
|
return UploadManagerBase;
|
|
2270
2270
|
}();
|
|
2271
|
-
;// CONCATENATED MODULE: ./src/
|
|
2272
|
-
function
|
|
2273
|
-
function
|
|
2271
|
+
;// CONCATENATED MODULE: ./src/private/UploadManagerBrowserWorkerBase.ts
|
|
2272
|
+
function UploadManagerBrowserWorkerBase_typeof(obj) { "@babel/helpers - typeof"; return UploadManagerBrowserWorkerBase_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; }, UploadManagerBrowserWorkerBase_typeof(obj); }
|
|
2273
|
+
function UploadManagerBrowserWorkerBase_await(value, then, direct) {
|
|
2274
2274
|
if (direct) {
|
|
2275
2275
|
return then ? then(value) : value;
|
|
2276
2276
|
}
|
|
@@ -2279,44 +2279,31 @@ function UploadManagerBrowser_await(value, then, direct) {
|
|
|
2279
2279
|
}
|
|
2280
2280
|
return then ? value.then(then) : value;
|
|
2281
2281
|
}
|
|
2282
|
-
function
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
}
|
|
2286
|
-
function
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
}
|
|
2295
|
-
return finalizer(false, result);
|
|
2296
|
-
}
|
|
2297
|
-
function UploadManagerBrowser_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2298
|
-
function UploadManagerBrowser_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, UploadManagerBrowser_toPropertyKey(descriptor.key), descriptor); } }
|
|
2299
|
-
function UploadManagerBrowser_createClass(Constructor, protoProps, staticProps) { if (protoProps) UploadManagerBrowser_defineProperties(Constructor.prototype, protoProps); if (staticProps) UploadManagerBrowser_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
2300
|
-
function UploadManagerBrowser_toPropertyKey(arg) { var key = UploadManagerBrowser_toPrimitive(arg, "string"); return UploadManagerBrowser_typeof(key) === "symbol" ? key : String(key); }
|
|
2301
|
-
function UploadManagerBrowser_toPrimitive(input, hint) { if (UploadManagerBrowser_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (UploadManagerBrowser_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
2302
|
-
function UploadManagerBrowser_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) UploadManagerBrowser_setPrototypeOf(subClass, superClass); }
|
|
2303
|
-
function UploadManagerBrowser_setPrototypeOf(o, p) { UploadManagerBrowser_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return UploadManagerBrowser_setPrototypeOf(o, p); }
|
|
2304
|
-
function UploadManagerBrowser_createSuper(Derived) { var hasNativeReflectConstruct = UploadManagerBrowser_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = UploadManagerBrowser_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = UploadManagerBrowser_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return UploadManagerBrowser_possibleConstructorReturn(this, result); }; }
|
|
2305
|
-
function UploadManagerBrowser_possibleConstructorReturn(self, call) { if (call && (UploadManagerBrowser_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 UploadManagerBrowser_assertThisInitialized(self); }
|
|
2306
|
-
function UploadManagerBrowser_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
2307
|
-
function UploadManagerBrowser_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; } }
|
|
2308
|
-
function UploadManagerBrowser_getPrototypeOf(o) { UploadManagerBrowser_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return UploadManagerBrowser_getPrototypeOf(o); }
|
|
2309
|
-
|
|
2282
|
+
function UploadManagerBrowserWorkerBase_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2283
|
+
function UploadManagerBrowserWorkerBase_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, UploadManagerBrowserWorkerBase_toPropertyKey(descriptor.key), descriptor); } }
|
|
2284
|
+
function UploadManagerBrowserWorkerBase_createClass(Constructor, protoProps, staticProps) { if (protoProps) UploadManagerBrowserWorkerBase_defineProperties(Constructor.prototype, protoProps); if (staticProps) UploadManagerBrowserWorkerBase_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
2285
|
+
function UploadManagerBrowserWorkerBase_toPropertyKey(arg) { var key = UploadManagerBrowserWorkerBase_toPrimitive(arg, "string"); return UploadManagerBrowserWorkerBase_typeof(key) === "symbol" ? key : String(key); }
|
|
2286
|
+
function UploadManagerBrowserWorkerBase_toPrimitive(input, hint) { if (UploadManagerBrowserWorkerBase_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (UploadManagerBrowserWorkerBase_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
2287
|
+
function UploadManagerBrowserWorkerBase_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) UploadManagerBrowserWorkerBase_setPrototypeOf(subClass, superClass); }
|
|
2288
|
+
function UploadManagerBrowserWorkerBase_setPrototypeOf(o, p) { UploadManagerBrowserWorkerBase_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return UploadManagerBrowserWorkerBase_setPrototypeOf(o, p); }
|
|
2289
|
+
function UploadManagerBrowserWorkerBase_createSuper(Derived) { var hasNativeReflectConstruct = UploadManagerBrowserWorkerBase_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = UploadManagerBrowserWorkerBase_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = UploadManagerBrowserWorkerBase_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return UploadManagerBrowserWorkerBase_possibleConstructorReturn(this, result); }; }
|
|
2290
|
+
function UploadManagerBrowserWorkerBase_possibleConstructorReturn(self, call) { if (call && (UploadManagerBrowserWorkerBase_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 UploadManagerBrowserWorkerBase_assertThisInitialized(self); }
|
|
2291
|
+
function UploadManagerBrowserWorkerBase_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
2292
|
+
function UploadManagerBrowserWorkerBase_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; } }
|
|
2293
|
+
function UploadManagerBrowserWorkerBase_getPrototypeOf(o) { UploadManagerBrowserWorkerBase_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return UploadManagerBrowserWorkerBase_getPrototypeOf(o); }
|
|
2310
2294
|
|
|
2311
2295
|
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2296
|
+
/**
|
|
2297
|
+
* The "browser" and "worker" runtimes support the same input types, but the former uses XHR and the latter uses Fetch.
|
|
2298
|
+
*/
|
|
2299
|
+
var UploadManagerBrowserWorkerBase = /*#__PURE__*/function (_UploadManagerBase) {
|
|
2300
|
+
UploadManagerBrowserWorkerBase_inherits(UploadManagerBrowserWorkerBase, _UploadManagerBase);
|
|
2301
|
+
var _super = UploadManagerBrowserWorkerBase_createSuper(UploadManagerBrowserWorkerBase);
|
|
2302
|
+
function UploadManagerBrowserWorkerBase() {
|
|
2303
|
+
UploadManagerBrowserWorkerBase_classCallCheck(this, UploadManagerBrowserWorkerBase);
|
|
2317
2304
|
return _super.apply(this, arguments);
|
|
2318
2305
|
}
|
|
2319
|
-
|
|
2306
|
+
UploadManagerBrowserWorkerBase_createClass(UploadManagerBrowserWorkerBase, [{
|
|
2320
2307
|
key: "processUploadSource",
|
|
2321
2308
|
value: function processUploadSource(data) {
|
|
2322
2309
|
if (typeof data === "string") {
|
|
@@ -2328,13 +2315,19 @@ var UploadManager = /*#__PURE__*/function (_UploadManagerBase) {
|
|
|
2328
2315
|
})
|
|
2329
2316
|
};
|
|
2330
2317
|
}
|
|
2318
|
+
if (data.byteLength !== undefined) {
|
|
2319
|
+
return {
|
|
2320
|
+
type: "ArrayBuffer",
|
|
2321
|
+
value: data
|
|
2322
|
+
};
|
|
2323
|
+
}
|
|
2331
2324
|
if (data.size !== undefined) {
|
|
2332
2325
|
return {
|
|
2333
2326
|
type: "Blob",
|
|
2334
2327
|
value: data
|
|
2335
2328
|
};
|
|
2336
2329
|
}
|
|
2337
|
-
throw new Error("Unsupported type for 'data' parameter. Please provide a String, Blob, or File object (from a file input element).");
|
|
2330
|
+
throw new Error("Unsupported type for 'data' parameter. Please provide a String, Blob, ArrayBuffer, or File object (from a file input element).");
|
|
2338
2331
|
}
|
|
2339
2332
|
}, {
|
|
2340
2333
|
key: "getPreUploadInfoPartial",
|
|
@@ -2342,8 +2335,15 @@ var UploadManager = /*#__PURE__*/function (_UploadManagerBase) {
|
|
|
2342
2335
|
switch (data.type) {
|
|
2343
2336
|
case "Blob":
|
|
2344
2337
|
return this.getBlobInfo(data);
|
|
2338
|
+
case "ArrayBuffer":
|
|
2339
|
+
return {
|
|
2340
|
+
mime: undefined,
|
|
2341
|
+
size: data.value.byteLength,
|
|
2342
|
+
originalFileName: undefined,
|
|
2343
|
+
maxConcurrentUploadParts: undefined
|
|
2344
|
+
};
|
|
2345
2345
|
default:
|
|
2346
|
-
assertUnreachable(data
|
|
2346
|
+
assertUnreachable(data);
|
|
2347
2347
|
}
|
|
2348
2348
|
}
|
|
2349
2349
|
}, {
|
|
@@ -2354,9 +2354,64 @@ var UploadManager = /*#__PURE__*/function (_UploadManagerBase) {
|
|
|
2354
2354
|
}, {
|
|
2355
2355
|
key: "postUpload",
|
|
2356
2356
|
value: function postUpload(_init) {
|
|
2357
|
-
return
|
|
2357
|
+
return UploadManagerBrowserWorkerBase_await();
|
|
2358
2358
|
} // NO-OP.
|
|
2359
2359
|
}, {
|
|
2360
|
+
key: "getRequestBody",
|
|
2361
|
+
value: function getRequestBody(part, blob) {
|
|
2362
|
+
return part.range.inclusiveEnd === -1 ? new Blob() : blob.value.slice(part.range.inclusiveStart, part.range.inclusiveEnd + 1);
|
|
2363
|
+
}
|
|
2364
|
+
}]);
|
|
2365
|
+
return UploadManagerBrowserWorkerBase;
|
|
2366
|
+
}(UploadManagerBase);
|
|
2367
|
+
;// CONCATENATED MODULE: ./src/public/browser/UploadManagerBrowser.ts
|
|
2368
|
+
function UploadManagerBrowser_typeof(obj) { "@babel/helpers - typeof"; return UploadManagerBrowser_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; }, UploadManagerBrowser_typeof(obj); }
|
|
2369
|
+
function UploadManagerBrowser_await(value, then, direct) {
|
|
2370
|
+
if (direct) {
|
|
2371
|
+
return then ? then(value) : value;
|
|
2372
|
+
}
|
|
2373
|
+
if (!value || !value.then) {
|
|
2374
|
+
value = Promise.resolve(value);
|
|
2375
|
+
}
|
|
2376
|
+
return then ? value.then(then) : value;
|
|
2377
|
+
}
|
|
2378
|
+
function UploadManagerBrowser_rethrow(thrown, value) {
|
|
2379
|
+
if (thrown) throw value;
|
|
2380
|
+
return value;
|
|
2381
|
+
}
|
|
2382
|
+
function UploadManagerBrowser_finallyRethrows(body, finalizer) {
|
|
2383
|
+
try {
|
|
2384
|
+
var result = body();
|
|
2385
|
+
} catch (e) {
|
|
2386
|
+
return finalizer(true, e);
|
|
2387
|
+
}
|
|
2388
|
+
if (result && result.then) {
|
|
2389
|
+
return result.then(finalizer.bind(null, false), finalizer.bind(null, true));
|
|
2390
|
+
}
|
|
2391
|
+
return finalizer(false, result);
|
|
2392
|
+
}
|
|
2393
|
+
function UploadManagerBrowser_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2394
|
+
function UploadManagerBrowser_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, UploadManagerBrowser_toPropertyKey(descriptor.key), descriptor); } }
|
|
2395
|
+
function UploadManagerBrowser_createClass(Constructor, protoProps, staticProps) { if (protoProps) UploadManagerBrowser_defineProperties(Constructor.prototype, protoProps); if (staticProps) UploadManagerBrowser_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
2396
|
+
function UploadManagerBrowser_toPropertyKey(arg) { var key = UploadManagerBrowser_toPrimitive(arg, "string"); return UploadManagerBrowser_typeof(key) === "symbol" ? key : String(key); }
|
|
2397
|
+
function UploadManagerBrowser_toPrimitive(input, hint) { if (UploadManagerBrowser_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (UploadManagerBrowser_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
2398
|
+
function UploadManagerBrowser_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) UploadManagerBrowser_setPrototypeOf(subClass, superClass); }
|
|
2399
|
+
function UploadManagerBrowser_setPrototypeOf(o, p) { UploadManagerBrowser_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return UploadManagerBrowser_setPrototypeOf(o, p); }
|
|
2400
|
+
function UploadManagerBrowser_createSuper(Derived) { var hasNativeReflectConstruct = UploadManagerBrowser_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = UploadManagerBrowser_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = UploadManagerBrowser_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return UploadManagerBrowser_possibleConstructorReturn(this, result); }; }
|
|
2401
|
+
function UploadManagerBrowser_possibleConstructorReturn(self, call) { if (call && (UploadManagerBrowser_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 UploadManagerBrowser_assertThisInitialized(self); }
|
|
2402
|
+
function UploadManagerBrowser_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
2403
|
+
function UploadManagerBrowser_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; } }
|
|
2404
|
+
function UploadManagerBrowser_getPrototypeOf(o) { UploadManagerBrowser_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return UploadManagerBrowser_getPrototypeOf(o); }
|
|
2405
|
+
|
|
2406
|
+
|
|
2407
|
+
var UploadManager = /*#__PURE__*/function (_UploadManagerBrowser) {
|
|
2408
|
+
UploadManagerBrowser_inherits(UploadManager, _UploadManagerBrowser);
|
|
2409
|
+
var _super = UploadManagerBrowser_createSuper(UploadManager);
|
|
2410
|
+
function UploadManager() {
|
|
2411
|
+
UploadManagerBrowser_classCallCheck(this, UploadManager);
|
|
2412
|
+
return _super.apply(this, arguments);
|
|
2413
|
+
}
|
|
2414
|
+
UploadManagerBrowser_createClass(UploadManager, [{
|
|
2360
2415
|
key: "doPutUploadPart",
|
|
2361
2416
|
value: function doPutUploadPart(part, contentLength, source, onProgress, addCancellationHandler) {
|
|
2362
2417
|
try {
|
|
@@ -2411,14 +2466,9 @@ var UploadManager = /*#__PURE__*/function (_UploadManagerBase) {
|
|
|
2411
2466
|
return Promise.reject(e);
|
|
2412
2467
|
}
|
|
2413
2468
|
}
|
|
2414
|
-
}, {
|
|
2415
|
-
key: "getRequestBody",
|
|
2416
|
-
value: function getRequestBody(part, blob) {
|
|
2417
|
-
return part.range.inclusiveEnd === -1 ? new Blob() : blob.value.slice(part.range.inclusiveStart, part.range.inclusiveEnd + 1);
|
|
2418
|
-
}
|
|
2419
2469
|
}]);
|
|
2420
2470
|
return UploadManager;
|
|
2421
|
-
}(
|
|
2471
|
+
}(UploadManagerBrowserWorkerBase);
|
|
2422
2472
|
;// CONCATENATED MODULE: ./src/private/ConsoleUtils.ts
|
|
2423
2473
|
function ConsoleUtils_typeof(obj) { "@babel/helpers - typeof"; return ConsoleUtils_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; }, ConsoleUtils_typeof(obj); }
|
|
2424
2474
|
function ConsoleUtils_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|