@bytescale/sdk 3.0.0-alpha.14 → 3.0.0-alpha.15
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 +5 -5
- package/dist/browser/cjs/main.js +11 -2
- package/dist/browser/esm/main.mjs +11 -2
- package/dist/node/cjs/main.js +13 -3
- package/dist/node/esm/main.mjs +13 -3
- package/dist/types/private/Mutex.d.ts +1 -1
- package/dist/worker/cjs/main.js +13 -3
- package/dist/worker/esm/main.mjs +13 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ import * as Bytescale from "@bytescale/sdk";
|
|
|
83
83
|
import nodeFetch from "node-fetch";
|
|
84
84
|
|
|
85
85
|
const uploadManager = new Bytescale.UploadManager({
|
|
86
|
-
fetchApi: nodeFetch, // import nodeFetch from "node-fetch"; // Only required for Node.js
|
|
86
|
+
fetchApi: nodeFetch, // import nodeFetch from "node-fetch"; // Only required for Node.js. TypeScript: 'nodeFetch as any' may be necessary.
|
|
87
87
|
apiKey: "free" // Get API keys from: www.bytescale.com
|
|
88
88
|
});
|
|
89
89
|
|
|
@@ -242,7 +242,7 @@ import * as Bytescale from "@bytescale/sdk";
|
|
|
242
242
|
import nodeFetch from "node-fetch"; // Only required for Node.js
|
|
243
243
|
|
|
244
244
|
const fileApi = new Bytescale.FileApi({
|
|
245
|
-
fetchApi: nodeFetch, // import nodeFetch from "node-fetch"; // Only required for Node.js
|
|
245
|
+
fetchApi: nodeFetch, // import nodeFetch from "node-fetch"; // Only required for Node.js. TypeScript: 'nodeFetch as any' may be necessary.
|
|
246
246
|
apiKey: "YOUR_API_KEY" // e.g. "secret_xxxxx"
|
|
247
247
|
});
|
|
248
248
|
|
|
@@ -268,7 +268,7 @@ import fetch from "node-fetch"; // Only required for Node.js
|
|
|
268
268
|
import fs from "fs";
|
|
269
269
|
|
|
270
270
|
const fileApi = new Bytescale.FileApi({
|
|
271
|
-
fetchApi: nodeFetch, // import nodeFetch from "node-fetch"; // Only required for Node.js
|
|
271
|
+
fetchApi: nodeFetch, // import nodeFetch from "node-fetch"; // Only required for Node.js. TypeScript: 'nodeFetch as any' may be necessary.
|
|
272
272
|
apiKey: "YOUR_API_KEY" // e.g. "secret_xxxxx"
|
|
273
273
|
});
|
|
274
274
|
|
|
@@ -309,7 +309,7 @@ import * as Bytescale from "@bytescale/sdk";
|
|
|
309
309
|
import fetch from "node-fetch"; // Only required for Node.js
|
|
310
310
|
|
|
311
311
|
const fileApi = new Bytescale.FileApi({
|
|
312
|
-
fetchApi: nodeFetch, // import nodeFetch from "node-fetch"; // Only required for Node.js
|
|
312
|
+
fetchApi: nodeFetch, // import nodeFetch from "node-fetch"; // Only required for Node.js. TypeScript: 'nodeFetch as any' may be necessary.
|
|
313
313
|
apiKey: "YOUR_API_KEY" // e.g. "secret_xxxxx"
|
|
314
314
|
});
|
|
315
315
|
|
|
@@ -331,7 +331,7 @@ import * as Bytescale from "@bytescale/sdk";
|
|
|
331
331
|
import fetch from "node-fetch"; // Only required for Node.js
|
|
332
332
|
|
|
333
333
|
const folderApi = new Bytescale.FolderApi({
|
|
334
|
-
fetchApi: nodeFetch, // import nodeFetch from "node-fetch"; // Only required for Node.js
|
|
334
|
+
fetchApi: nodeFetch, // import nodeFetch from "node-fetch"; // Only required for Node.js. TypeScript: 'nodeFetch as any' may be necessary.
|
|
335
335
|
apiKey: "YOUR_API_KEY" // e.g. "secret_xxxxx"
|
|
336
336
|
});
|
|
337
337
|
|
package/dist/browser/cjs/main.js
CHANGED
|
@@ -259,7 +259,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
259
259
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
260
260
|
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); }
|
|
261
261
|
/**
|
|
262
|
-
* A lightweight mutex. (Other libraries contain too many features and we want to keep
|
|
262
|
+
* A lightweight mutex. (Other libraries contain too many features and we want to keep size down).
|
|
263
263
|
*
|
|
264
264
|
* Characteristics:
|
|
265
265
|
* - Non-reentrant.
|
|
@@ -543,7 +543,16 @@ var BaseAPI = /*#__PURE__*/function () {
|
|
|
543
543
|
var _a, _b;
|
|
544
544
|
var response;
|
|
545
545
|
return runtime_continue(_catch(function () {
|
|
546
|
-
return runtime_await(BytescaleApiClientConfigUtils.getFetchApi(_this4.config)(url, init),
|
|
546
|
+
return runtime_await(BytescaleApiClientConfigUtils.getFetchApi(_this4.config)(url, Object.assign(Object.assign({}, init), {
|
|
547
|
+
// This is specifically added to cater for Next.js's Fetch implementation, which caches POST requests...
|
|
548
|
+
//
|
|
549
|
+
// "fetch requests that use the POST method are also automatically cached."
|
|
550
|
+
// - https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#caching-data
|
|
551
|
+
//
|
|
552
|
+
// However, this is probably a good idea, even for all GET requests, as if the user is refreshing a JWT
|
|
553
|
+
// or downloading a file via 'FileApi.downloadFile', then they'll likely want the latest.
|
|
554
|
+
cache: "no-store"
|
|
555
|
+
})), function (_BytescaleApiClientCo) {
|
|
547
556
|
response = _BytescaleApiClientCo;
|
|
548
557
|
});
|
|
549
558
|
}, function (e) {
|
|
@@ -244,7 +244,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
244
244
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
245
245
|
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); }
|
|
246
246
|
/**
|
|
247
|
-
* A lightweight mutex. (Other libraries contain too many features and we want to keep
|
|
247
|
+
* A lightweight mutex. (Other libraries contain too many features and we want to keep size down).
|
|
248
248
|
*
|
|
249
249
|
* Characteristics:
|
|
250
250
|
* - Non-reentrant.
|
|
@@ -528,7 +528,16 @@ var BaseAPI = /*#__PURE__*/function () {
|
|
|
528
528
|
var _a, _b;
|
|
529
529
|
var response;
|
|
530
530
|
return runtime_continue(_catch(function () {
|
|
531
|
-
return runtime_await(BytescaleApiClientConfigUtils.getFetchApi(_this4.config)(url, init),
|
|
531
|
+
return runtime_await(BytescaleApiClientConfigUtils.getFetchApi(_this4.config)(url, Object.assign(Object.assign({}, init), {
|
|
532
|
+
// This is specifically added to cater for Next.js's Fetch implementation, which caches POST requests...
|
|
533
|
+
//
|
|
534
|
+
// "fetch requests that use the POST method are also automatically cached."
|
|
535
|
+
// - https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#caching-data
|
|
536
|
+
//
|
|
537
|
+
// However, this is probably a good idea, even for all GET requests, as if the user is refreshing a JWT
|
|
538
|
+
// or downloading a file via 'FileApi.downloadFile', then they'll likely want the latest.
|
|
539
|
+
cache: "no-store"
|
|
540
|
+
})), function (_BytescaleApiClientCo) {
|
|
532
541
|
response = _BytescaleApiClientCo;
|
|
533
542
|
});
|
|
534
543
|
}, function (e) {
|
package/dist/node/cjs/main.js
CHANGED
|
@@ -259,7 +259,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
259
259
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
260
260
|
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); }
|
|
261
261
|
/**
|
|
262
|
-
* A lightweight mutex. (Other libraries contain too many features and we want to keep
|
|
262
|
+
* A lightweight mutex. (Other libraries contain too many features and we want to keep size down).
|
|
263
263
|
*
|
|
264
264
|
* Characteristics:
|
|
265
265
|
* - Non-reentrant.
|
|
@@ -543,7 +543,16 @@ var BaseAPI = /*#__PURE__*/function () {
|
|
|
543
543
|
var _a, _b;
|
|
544
544
|
var response;
|
|
545
545
|
return runtime_continue(_catch(function () {
|
|
546
|
-
return runtime_await(BytescaleApiClientConfigUtils.getFetchApi(_this4.config)(url, init),
|
|
546
|
+
return runtime_await(BytescaleApiClientConfigUtils.getFetchApi(_this4.config)(url, Object.assign(Object.assign({}, init), {
|
|
547
|
+
// This is specifically added to cater for Next.js's Fetch implementation, which caches POST requests...
|
|
548
|
+
//
|
|
549
|
+
// "fetch requests that use the POST method are also automatically cached."
|
|
550
|
+
// - https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#caching-data
|
|
551
|
+
//
|
|
552
|
+
// However, this is probably a good idea, even for all GET requests, as if the user is refreshing a JWT
|
|
553
|
+
// or downloading a file via 'FileApi.downloadFile', then they'll likely want the latest.
|
|
554
|
+
cache: "no-store"
|
|
555
|
+
})), function (_BytescaleApiClientCo) {
|
|
547
556
|
response = _BytescaleApiClientCo;
|
|
548
557
|
});
|
|
549
558
|
}, function (e) {
|
|
@@ -2571,7 +2580,8 @@ var UploadManagerFetchUtils = /*#__PURE__*/function () {
|
|
|
2571
2580
|
method: "PUT",
|
|
2572
2581
|
headers: headers,
|
|
2573
2582
|
body: content,
|
|
2574
|
-
signal: signal
|
|
2583
|
+
signal: signal,
|
|
2584
|
+
cache: "no-store" // Required for Next.js's Fetch implementation, which caches POST/PUT requests by default.
|
|
2575
2585
|
}), function (response) {
|
|
2576
2586
|
return {
|
|
2577
2587
|
etag: (_a = response.headers.get("etag")) !== null && _a !== void 0 ? _a : undefined,
|
package/dist/node/esm/main.mjs
CHANGED
|
@@ -246,7 +246,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
246
246
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
247
247
|
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); }
|
|
248
248
|
/**
|
|
249
|
-
* A lightweight mutex. (Other libraries contain too many features and we want to keep
|
|
249
|
+
* A lightweight mutex. (Other libraries contain too many features and we want to keep size down).
|
|
250
250
|
*
|
|
251
251
|
* Characteristics:
|
|
252
252
|
* - Non-reentrant.
|
|
@@ -530,7 +530,16 @@ var BaseAPI = /*#__PURE__*/function () {
|
|
|
530
530
|
var _a, _b;
|
|
531
531
|
var response;
|
|
532
532
|
return runtime_continue(_catch(function () {
|
|
533
|
-
return runtime_await(BytescaleApiClientConfigUtils.getFetchApi(_this4.config)(url, init),
|
|
533
|
+
return runtime_await(BytescaleApiClientConfigUtils.getFetchApi(_this4.config)(url, Object.assign(Object.assign({}, init), {
|
|
534
|
+
// This is specifically added to cater for Next.js's Fetch implementation, which caches POST requests...
|
|
535
|
+
//
|
|
536
|
+
// "fetch requests that use the POST method are also automatically cached."
|
|
537
|
+
// - https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#caching-data
|
|
538
|
+
//
|
|
539
|
+
// However, this is probably a good idea, even for all GET requests, as if the user is refreshing a JWT
|
|
540
|
+
// or downloading a file via 'FileApi.downloadFile', then they'll likely want the latest.
|
|
541
|
+
cache: "no-store"
|
|
542
|
+
})), function (_BytescaleApiClientCo) {
|
|
534
543
|
response = _BytescaleApiClientCo;
|
|
535
544
|
});
|
|
536
545
|
}, function (e) {
|
|
@@ -2562,7 +2571,8 @@ var UploadManagerFetchUtils = /*#__PURE__*/function () {
|
|
|
2562
2571
|
method: "PUT",
|
|
2563
2572
|
headers: headers,
|
|
2564
2573
|
body: content,
|
|
2565
|
-
signal: signal
|
|
2574
|
+
signal: signal,
|
|
2575
|
+
cache: "no-store" // Required for Next.js's Fetch implementation, which caches POST/PUT requests by default.
|
|
2566
2576
|
}), function (response) {
|
|
2567
2577
|
return {
|
|
2568
2578
|
etag: (_a = response.headers.get("etag")) !== null && _a !== void 0 ? _a : undefined,
|
package/dist/worker/cjs/main.js
CHANGED
|
@@ -259,7 +259,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
259
259
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
260
260
|
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); }
|
|
261
261
|
/**
|
|
262
|
-
* A lightweight mutex. (Other libraries contain too many features and we want to keep
|
|
262
|
+
* A lightweight mutex. (Other libraries contain too many features and we want to keep size down).
|
|
263
263
|
*
|
|
264
264
|
* Characteristics:
|
|
265
265
|
* - Non-reentrant.
|
|
@@ -543,7 +543,16 @@ var BaseAPI = /*#__PURE__*/function () {
|
|
|
543
543
|
var _a, _b;
|
|
544
544
|
var response;
|
|
545
545
|
return runtime_continue(_catch(function () {
|
|
546
|
-
return runtime_await(BytescaleApiClientConfigUtils.getFetchApi(_this4.config)(url, init),
|
|
546
|
+
return runtime_await(BytescaleApiClientConfigUtils.getFetchApi(_this4.config)(url, Object.assign(Object.assign({}, init), {
|
|
547
|
+
// This is specifically added to cater for Next.js's Fetch implementation, which caches POST requests...
|
|
548
|
+
//
|
|
549
|
+
// "fetch requests that use the POST method are also automatically cached."
|
|
550
|
+
// - https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#caching-data
|
|
551
|
+
//
|
|
552
|
+
// However, this is probably a good idea, even for all GET requests, as if the user is refreshing a JWT
|
|
553
|
+
// or downloading a file via 'FileApi.downloadFile', then they'll likely want the latest.
|
|
554
|
+
cache: "no-store"
|
|
555
|
+
})), function (_BytescaleApiClientCo) {
|
|
547
556
|
response = _BytescaleApiClientCo;
|
|
548
557
|
});
|
|
549
558
|
}, function (e) {
|
|
@@ -2426,7 +2435,8 @@ var UploadManagerFetchUtils = /*#__PURE__*/function () {
|
|
|
2426
2435
|
method: "PUT",
|
|
2427
2436
|
headers: headers,
|
|
2428
2437
|
body: content,
|
|
2429
|
-
signal: signal
|
|
2438
|
+
signal: signal,
|
|
2439
|
+
cache: "no-store" // Required for Next.js's Fetch implementation, which caches POST/PUT requests by default.
|
|
2430
2440
|
}), function (response) {
|
|
2431
2441
|
return {
|
|
2432
2442
|
etag: (_a = response.headers.get("etag")) !== null && _a !== void 0 ? _a : undefined,
|
package/dist/worker/esm/main.mjs
CHANGED
|
@@ -244,7 +244,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
244
244
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
245
245
|
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); }
|
|
246
246
|
/**
|
|
247
|
-
* A lightweight mutex. (Other libraries contain too many features and we want to keep
|
|
247
|
+
* A lightweight mutex. (Other libraries contain too many features and we want to keep size down).
|
|
248
248
|
*
|
|
249
249
|
* Characteristics:
|
|
250
250
|
* - Non-reentrant.
|
|
@@ -528,7 +528,16 @@ var BaseAPI = /*#__PURE__*/function () {
|
|
|
528
528
|
var _a, _b;
|
|
529
529
|
var response;
|
|
530
530
|
return runtime_continue(_catch(function () {
|
|
531
|
-
return runtime_await(BytescaleApiClientConfigUtils.getFetchApi(_this4.config)(url, init),
|
|
531
|
+
return runtime_await(BytescaleApiClientConfigUtils.getFetchApi(_this4.config)(url, Object.assign(Object.assign({}, init), {
|
|
532
|
+
// This is specifically added to cater for Next.js's Fetch implementation, which caches POST requests...
|
|
533
|
+
//
|
|
534
|
+
// "fetch requests that use the POST method are also automatically cached."
|
|
535
|
+
// - https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#caching-data
|
|
536
|
+
//
|
|
537
|
+
// However, this is probably a good idea, even for all GET requests, as if the user is refreshing a JWT
|
|
538
|
+
// or downloading a file via 'FileApi.downloadFile', then they'll likely want the latest.
|
|
539
|
+
cache: "no-store"
|
|
540
|
+
})), function (_BytescaleApiClientCo) {
|
|
532
541
|
response = _BytescaleApiClientCo;
|
|
533
542
|
});
|
|
534
543
|
}, function (e) {
|
|
@@ -2411,7 +2420,8 @@ var UploadManagerFetchUtils = /*#__PURE__*/function () {
|
|
|
2411
2420
|
method: "PUT",
|
|
2412
2421
|
headers: headers,
|
|
2413
2422
|
body: content,
|
|
2414
|
-
signal: signal
|
|
2423
|
+
signal: signal,
|
|
2424
|
+
cache: "no-store" // Required for Next.js's Fetch implementation, which caches POST/PUT requests by default.
|
|
2415
2425
|
}), function (response) {
|
|
2416
2426
|
return {
|
|
2417
2427
|
etag: (_a = response.headers.get("etag")) !== null && _a !== void 0 ? _a : undefined,
|