@bytescale/sdk 3.23.1 → 3.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/cjs/main.js +27 -6
- package/dist/browser/esm/main.mjs +27 -6
- package/dist/node/cjs/main.js +27 -6
- package/dist/node/esm/main.mjs +27 -6
- package/dist/types/public/shared/UrlBuilder.d.ts +5 -0
- package/dist/types/public/shared/UrlBuilderTypes.d.ts +23 -4
- package/dist/types/public/shared/generated/apis/FileApi.d.ts +10 -0
- package/dist/types/public/shared/generated/apis/FolderApi.d.ts +2 -2
- package/dist/types/public/shared/generated/models/index.d.ts +4 -9
- package/dist/worker/cjs/main.js +27 -6
- package/dist/worker/esm/main.mjs +27 -6
- package/package.json +1 -1
- package/tests/utils/RandomStream.ts +16 -1
package/dist/browser/cjs/main.js
CHANGED
|
@@ -912,6 +912,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
|
|
|
912
912
|
if (params.cache !== undefined) {
|
|
913
913
|
query["cache"] = params.cache;
|
|
914
914
|
}
|
|
915
|
+
if (params.cacheOnly !== undefined) {
|
|
916
|
+
query["cache_only"] = params.cacheOnly;
|
|
917
|
+
}
|
|
915
918
|
if (params.cachePerm !== undefined) {
|
|
916
919
|
query["cache_perm"] = params.cachePerm;
|
|
917
920
|
}
|
|
@@ -1078,7 +1081,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
|
|
|
1078
1081
|
}
|
|
1079
1082
|
}
|
|
1080
1083
|
/**
|
|
1081
|
-
* Deletes a folder asynchronously.
|
|
1084
|
+
* Deletes a folder asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter. *When deleting a folder with external storage:* if the folder at `folderPath` has overridden storage settings (like an AWS S3 bucket), no files will be deleted, regardless of the parameters you pass. Only the mapping will be removed. If the folder at `folderPath` has inherited storage settings but includes subfolders with overridden storage settings, files in those subfolders won\'t be deleted, regardless of the parameters you pass. In summary, files in folders with overridden storage are never deleted, unless you directly delete a subfolder of such a folder. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
|
|
1082
1085
|
*/
|
|
1083
1086
|
}, {
|
|
1084
1087
|
key: "deleteFolder",
|
|
@@ -1104,7 +1107,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
|
|
|
1104
1107
|
}
|
|
1105
1108
|
}
|
|
1106
1109
|
/**
|
|
1107
|
-
* Deletes multiple folders asynchronously.
|
|
1110
|
+
* Deletes multiple folders asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter. *When deleting a folder with external storage:* if the folder at `folderPath` has overridden storage settings (like an AWS S3 bucket), no files will be deleted, regardless of the parameters you pass. Only the mapping will be removed. If the folder at `folderPath` has inherited storage settings but includes subfolders with overridden storage settings, files in those subfolders won\'t be deleted, regardless of the parameters you pass. In summary, files in folders with overridden storage are never deleted, unless you directly delete a subfolder of such a folder. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
|
|
1108
1111
|
*/
|
|
1109
1112
|
}, {
|
|
1110
1113
|
key: "deleteFolderBatch",
|
|
@@ -1649,29 +1652,47 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1649
1652
|
}, {
|
|
1650
1653
|
key: "getBaseUrl",
|
|
1651
1654
|
value: function getBaseUrl(params, prefix) {
|
|
1652
|
-
var
|
|
1655
|
+
var _a, _b;
|
|
1656
|
+
var cdnUrl = (_b = (_a = params.options) === null || _a === void 0 ? void 0 : _a.cdnUrl) !== null && _b !== void 0 ? _b : BytescaleApiClientConfigUtils.defaultCdnUrl;
|
|
1653
1657
|
return "".concat(cdnUrl, "/").concat(params.accountId, "/").concat(prefix).concat(params.filePath);
|
|
1654
1658
|
}
|
|
1655
1659
|
}, {
|
|
1656
1660
|
key: "getCommonTransformationQueryParams",
|
|
1657
1661
|
value: function getCommonTransformationQueryParams(trans) {
|
|
1658
|
-
return this.makeQueryParams(
|
|
1662
|
+
return this.makeQueryParams({
|
|
1663
|
+
cacheOnly: null,
|
|
1664
|
+
cachePermanently: null,
|
|
1665
|
+
// Keep this as the last param: this is the convention for transformation URLs (although not required).
|
|
1666
|
+
artifact: null
|
|
1667
|
+
}, {
|
|
1668
|
+
cacheOnly: "cache_only",
|
|
1659
1669
|
cachePermanently: "cache_perm"
|
|
1660
1670
|
})(trans);
|
|
1661
1671
|
}
|
|
1662
1672
|
}, {
|
|
1663
1673
|
key: "getCommonQueryParams",
|
|
1664
1674
|
value: function getCommonQueryParams(params) {
|
|
1665
|
-
return this.makeQueryParams(
|
|
1675
|
+
return this.makeQueryParams({
|
|
1676
|
+
cache: null,
|
|
1677
|
+
cacheTtl: null,
|
|
1678
|
+
version: null,
|
|
1679
|
+
forceDownloadPrompt: null
|
|
1680
|
+
}, {
|
|
1666
1681
|
cacheTtl: "cache_ttl",
|
|
1667
1682
|
forceDownloadPrompt: "download"
|
|
1668
1683
|
})(params);
|
|
1669
1684
|
}
|
|
1685
|
+
/**
|
|
1686
|
+
* Masks the querystring params per the 'keys' array.
|
|
1687
|
+
*
|
|
1688
|
+
* Order sensitive: querystring params will appear per the order of the 'keys' array.
|
|
1689
|
+
*/
|
|
1670
1690
|
}, {
|
|
1671
1691
|
key: "makeQueryParams",
|
|
1672
|
-
value: function makeQueryParams(
|
|
1692
|
+
value: function makeQueryParams(keyPrototype, keyOverrides) {
|
|
1673
1693
|
return function (data) {
|
|
1674
1694
|
var result = [];
|
|
1695
|
+
var keys = Object.keys(keyPrototype);
|
|
1675
1696
|
keys.forEach(function (key) {
|
|
1676
1697
|
var _a;
|
|
1677
1698
|
var value = data[key];
|
|
@@ -897,6 +897,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
|
|
|
897
897
|
if (params.cache !== undefined) {
|
|
898
898
|
query["cache"] = params.cache;
|
|
899
899
|
}
|
|
900
|
+
if (params.cacheOnly !== undefined) {
|
|
901
|
+
query["cache_only"] = params.cacheOnly;
|
|
902
|
+
}
|
|
900
903
|
if (params.cachePerm !== undefined) {
|
|
901
904
|
query["cache_perm"] = params.cachePerm;
|
|
902
905
|
}
|
|
@@ -1063,7 +1066,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
|
|
|
1063
1066
|
}
|
|
1064
1067
|
}
|
|
1065
1068
|
/**
|
|
1066
|
-
* Deletes a folder asynchronously.
|
|
1069
|
+
* Deletes a folder asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter. *When deleting a folder with external storage:* if the folder at `folderPath` has overridden storage settings (like an AWS S3 bucket), no files will be deleted, regardless of the parameters you pass. Only the mapping will be removed. If the folder at `folderPath` has inherited storage settings but includes subfolders with overridden storage settings, files in those subfolders won\'t be deleted, regardless of the parameters you pass. In summary, files in folders with overridden storage are never deleted, unless you directly delete a subfolder of such a folder. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
|
|
1067
1070
|
*/
|
|
1068
1071
|
}, {
|
|
1069
1072
|
key: "deleteFolder",
|
|
@@ -1089,7 +1092,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
|
|
|
1089
1092
|
}
|
|
1090
1093
|
}
|
|
1091
1094
|
/**
|
|
1092
|
-
* Deletes multiple folders asynchronously.
|
|
1095
|
+
* Deletes multiple folders asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter. *When deleting a folder with external storage:* if the folder at `folderPath` has overridden storage settings (like an AWS S3 bucket), no files will be deleted, regardless of the parameters you pass. Only the mapping will be removed. If the folder at `folderPath` has inherited storage settings but includes subfolders with overridden storage settings, files in those subfolders won\'t be deleted, regardless of the parameters you pass. In summary, files in folders with overridden storage are never deleted, unless you directly delete a subfolder of such a folder. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
|
|
1093
1096
|
*/
|
|
1094
1097
|
}, {
|
|
1095
1098
|
key: "deleteFolderBatch",
|
|
@@ -1634,29 +1637,47 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1634
1637
|
}, {
|
|
1635
1638
|
key: "getBaseUrl",
|
|
1636
1639
|
value: function getBaseUrl(params, prefix) {
|
|
1637
|
-
var
|
|
1640
|
+
var _a, _b;
|
|
1641
|
+
var cdnUrl = (_b = (_a = params.options) === null || _a === void 0 ? void 0 : _a.cdnUrl) !== null && _b !== void 0 ? _b : BytescaleApiClientConfigUtils.defaultCdnUrl;
|
|
1638
1642
|
return "".concat(cdnUrl, "/").concat(params.accountId, "/").concat(prefix).concat(params.filePath);
|
|
1639
1643
|
}
|
|
1640
1644
|
}, {
|
|
1641
1645
|
key: "getCommonTransformationQueryParams",
|
|
1642
1646
|
value: function getCommonTransformationQueryParams(trans) {
|
|
1643
|
-
return this.makeQueryParams(
|
|
1647
|
+
return this.makeQueryParams({
|
|
1648
|
+
cacheOnly: null,
|
|
1649
|
+
cachePermanently: null,
|
|
1650
|
+
// Keep this as the last param: this is the convention for transformation URLs (although not required).
|
|
1651
|
+
artifact: null
|
|
1652
|
+
}, {
|
|
1653
|
+
cacheOnly: "cache_only",
|
|
1644
1654
|
cachePermanently: "cache_perm"
|
|
1645
1655
|
})(trans);
|
|
1646
1656
|
}
|
|
1647
1657
|
}, {
|
|
1648
1658
|
key: "getCommonQueryParams",
|
|
1649
1659
|
value: function getCommonQueryParams(params) {
|
|
1650
|
-
return this.makeQueryParams(
|
|
1660
|
+
return this.makeQueryParams({
|
|
1661
|
+
cache: null,
|
|
1662
|
+
cacheTtl: null,
|
|
1663
|
+
version: null,
|
|
1664
|
+
forceDownloadPrompt: null
|
|
1665
|
+
}, {
|
|
1651
1666
|
cacheTtl: "cache_ttl",
|
|
1652
1667
|
forceDownloadPrompt: "download"
|
|
1653
1668
|
})(params);
|
|
1654
1669
|
}
|
|
1670
|
+
/**
|
|
1671
|
+
* Masks the querystring params per the 'keys' array.
|
|
1672
|
+
*
|
|
1673
|
+
* Order sensitive: querystring params will appear per the order of the 'keys' array.
|
|
1674
|
+
*/
|
|
1655
1675
|
}, {
|
|
1656
1676
|
key: "makeQueryParams",
|
|
1657
|
-
value: function makeQueryParams(
|
|
1677
|
+
value: function makeQueryParams(keyPrototype, keyOverrides) {
|
|
1658
1678
|
return function (data) {
|
|
1659
1679
|
var result = [];
|
|
1680
|
+
var keys = Object.keys(keyPrototype);
|
|
1660
1681
|
keys.forEach(function (key) {
|
|
1661
1682
|
var _a;
|
|
1662
1683
|
var value = data[key];
|
package/dist/node/cjs/main.js
CHANGED
|
@@ -912,6 +912,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
|
|
|
912
912
|
if (params.cache !== undefined) {
|
|
913
913
|
query["cache"] = params.cache;
|
|
914
914
|
}
|
|
915
|
+
if (params.cacheOnly !== undefined) {
|
|
916
|
+
query["cache_only"] = params.cacheOnly;
|
|
917
|
+
}
|
|
915
918
|
if (params.cachePerm !== undefined) {
|
|
916
919
|
query["cache_perm"] = params.cachePerm;
|
|
917
920
|
}
|
|
@@ -1078,7 +1081,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
|
|
|
1078
1081
|
}
|
|
1079
1082
|
}
|
|
1080
1083
|
/**
|
|
1081
|
-
* Deletes a folder asynchronously.
|
|
1084
|
+
* Deletes a folder asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter. *When deleting a folder with external storage:* if the folder at `folderPath` has overridden storage settings (like an AWS S3 bucket), no files will be deleted, regardless of the parameters you pass. Only the mapping will be removed. If the folder at `folderPath` has inherited storage settings but includes subfolders with overridden storage settings, files in those subfolders won\'t be deleted, regardless of the parameters you pass. In summary, files in folders with overridden storage are never deleted, unless you directly delete a subfolder of such a folder. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
|
|
1082
1085
|
*/
|
|
1083
1086
|
}, {
|
|
1084
1087
|
key: "deleteFolder",
|
|
@@ -1104,7 +1107,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
|
|
|
1104
1107
|
}
|
|
1105
1108
|
}
|
|
1106
1109
|
/**
|
|
1107
|
-
* Deletes multiple folders asynchronously.
|
|
1110
|
+
* Deletes multiple folders asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter. *When deleting a folder with external storage:* if the folder at `folderPath` has overridden storage settings (like an AWS S3 bucket), no files will be deleted, regardless of the parameters you pass. Only the mapping will be removed. If the folder at `folderPath` has inherited storage settings but includes subfolders with overridden storage settings, files in those subfolders won\'t be deleted, regardless of the parameters you pass. In summary, files in folders with overridden storage are never deleted, unless you directly delete a subfolder of such a folder. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
|
|
1108
1111
|
*/
|
|
1109
1112
|
}, {
|
|
1110
1113
|
key: "deleteFolderBatch",
|
|
@@ -1649,29 +1652,47 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1649
1652
|
}, {
|
|
1650
1653
|
key: "getBaseUrl",
|
|
1651
1654
|
value: function getBaseUrl(params, prefix) {
|
|
1652
|
-
var
|
|
1655
|
+
var _a, _b;
|
|
1656
|
+
var cdnUrl = (_b = (_a = params.options) === null || _a === void 0 ? void 0 : _a.cdnUrl) !== null && _b !== void 0 ? _b : BytescaleApiClientConfigUtils.defaultCdnUrl;
|
|
1653
1657
|
return "".concat(cdnUrl, "/").concat(params.accountId, "/").concat(prefix).concat(params.filePath);
|
|
1654
1658
|
}
|
|
1655
1659
|
}, {
|
|
1656
1660
|
key: "getCommonTransformationQueryParams",
|
|
1657
1661
|
value: function getCommonTransformationQueryParams(trans) {
|
|
1658
|
-
return this.makeQueryParams(
|
|
1662
|
+
return this.makeQueryParams({
|
|
1663
|
+
cacheOnly: null,
|
|
1664
|
+
cachePermanently: null,
|
|
1665
|
+
// Keep this as the last param: this is the convention for transformation URLs (although not required).
|
|
1666
|
+
artifact: null
|
|
1667
|
+
}, {
|
|
1668
|
+
cacheOnly: "cache_only",
|
|
1659
1669
|
cachePermanently: "cache_perm"
|
|
1660
1670
|
})(trans);
|
|
1661
1671
|
}
|
|
1662
1672
|
}, {
|
|
1663
1673
|
key: "getCommonQueryParams",
|
|
1664
1674
|
value: function getCommonQueryParams(params) {
|
|
1665
|
-
return this.makeQueryParams(
|
|
1675
|
+
return this.makeQueryParams({
|
|
1676
|
+
cache: null,
|
|
1677
|
+
cacheTtl: null,
|
|
1678
|
+
version: null,
|
|
1679
|
+
forceDownloadPrompt: null
|
|
1680
|
+
}, {
|
|
1666
1681
|
cacheTtl: "cache_ttl",
|
|
1667
1682
|
forceDownloadPrompt: "download"
|
|
1668
1683
|
})(params);
|
|
1669
1684
|
}
|
|
1685
|
+
/**
|
|
1686
|
+
* Masks the querystring params per the 'keys' array.
|
|
1687
|
+
*
|
|
1688
|
+
* Order sensitive: querystring params will appear per the order of the 'keys' array.
|
|
1689
|
+
*/
|
|
1670
1690
|
}, {
|
|
1671
1691
|
key: "makeQueryParams",
|
|
1672
|
-
value: function makeQueryParams(
|
|
1692
|
+
value: function makeQueryParams(keyPrototype, keyOverrides) {
|
|
1673
1693
|
return function (data) {
|
|
1674
1694
|
var result = [];
|
|
1695
|
+
var keys = Object.keys(keyPrototype);
|
|
1675
1696
|
keys.forEach(function (key) {
|
|
1676
1697
|
var _a;
|
|
1677
1698
|
var value = data[key];
|
package/dist/node/esm/main.mjs
CHANGED
|
@@ -899,6 +899,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
|
|
|
899
899
|
if (params.cache !== undefined) {
|
|
900
900
|
query["cache"] = params.cache;
|
|
901
901
|
}
|
|
902
|
+
if (params.cacheOnly !== undefined) {
|
|
903
|
+
query["cache_only"] = params.cacheOnly;
|
|
904
|
+
}
|
|
902
905
|
if (params.cachePerm !== undefined) {
|
|
903
906
|
query["cache_perm"] = params.cachePerm;
|
|
904
907
|
}
|
|
@@ -1065,7 +1068,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
|
|
|
1065
1068
|
}
|
|
1066
1069
|
}
|
|
1067
1070
|
/**
|
|
1068
|
-
* Deletes a folder asynchronously.
|
|
1071
|
+
* Deletes a folder asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter. *When deleting a folder with external storage:* if the folder at `folderPath` has overridden storage settings (like an AWS S3 bucket), no files will be deleted, regardless of the parameters you pass. Only the mapping will be removed. If the folder at `folderPath` has inherited storage settings but includes subfolders with overridden storage settings, files in those subfolders won\'t be deleted, regardless of the parameters you pass. In summary, files in folders with overridden storage are never deleted, unless you directly delete a subfolder of such a folder. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
|
|
1069
1072
|
*/
|
|
1070
1073
|
}, {
|
|
1071
1074
|
key: "deleteFolder",
|
|
@@ -1091,7 +1094,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
|
|
|
1091
1094
|
}
|
|
1092
1095
|
}
|
|
1093
1096
|
/**
|
|
1094
|
-
* Deletes multiple folders asynchronously.
|
|
1097
|
+
* Deletes multiple folders asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter. *When deleting a folder with external storage:* if the folder at `folderPath` has overridden storage settings (like an AWS S3 bucket), no files will be deleted, regardless of the parameters you pass. Only the mapping will be removed. If the folder at `folderPath` has inherited storage settings but includes subfolders with overridden storage settings, files in those subfolders won\'t be deleted, regardless of the parameters you pass. In summary, files in folders with overridden storage are never deleted, unless you directly delete a subfolder of such a folder. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
|
|
1095
1098
|
*/
|
|
1096
1099
|
}, {
|
|
1097
1100
|
key: "deleteFolderBatch",
|
|
@@ -1636,29 +1639,47 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1636
1639
|
}, {
|
|
1637
1640
|
key: "getBaseUrl",
|
|
1638
1641
|
value: function getBaseUrl(params, prefix) {
|
|
1639
|
-
var
|
|
1642
|
+
var _a, _b;
|
|
1643
|
+
var cdnUrl = (_b = (_a = params.options) === null || _a === void 0 ? void 0 : _a.cdnUrl) !== null && _b !== void 0 ? _b : BytescaleApiClientConfigUtils.defaultCdnUrl;
|
|
1640
1644
|
return "".concat(cdnUrl, "/").concat(params.accountId, "/").concat(prefix).concat(params.filePath);
|
|
1641
1645
|
}
|
|
1642
1646
|
}, {
|
|
1643
1647
|
key: "getCommonTransformationQueryParams",
|
|
1644
1648
|
value: function getCommonTransformationQueryParams(trans) {
|
|
1645
|
-
return this.makeQueryParams(
|
|
1649
|
+
return this.makeQueryParams({
|
|
1650
|
+
cacheOnly: null,
|
|
1651
|
+
cachePermanently: null,
|
|
1652
|
+
// Keep this as the last param: this is the convention for transformation URLs (although not required).
|
|
1653
|
+
artifact: null
|
|
1654
|
+
}, {
|
|
1655
|
+
cacheOnly: "cache_only",
|
|
1646
1656
|
cachePermanently: "cache_perm"
|
|
1647
1657
|
})(trans);
|
|
1648
1658
|
}
|
|
1649
1659
|
}, {
|
|
1650
1660
|
key: "getCommonQueryParams",
|
|
1651
1661
|
value: function getCommonQueryParams(params) {
|
|
1652
|
-
return this.makeQueryParams(
|
|
1662
|
+
return this.makeQueryParams({
|
|
1663
|
+
cache: null,
|
|
1664
|
+
cacheTtl: null,
|
|
1665
|
+
version: null,
|
|
1666
|
+
forceDownloadPrompt: null
|
|
1667
|
+
}, {
|
|
1653
1668
|
cacheTtl: "cache_ttl",
|
|
1654
1669
|
forceDownloadPrompt: "download"
|
|
1655
1670
|
})(params);
|
|
1656
1671
|
}
|
|
1672
|
+
/**
|
|
1673
|
+
* Masks the querystring params per the 'keys' array.
|
|
1674
|
+
*
|
|
1675
|
+
* Order sensitive: querystring params will appear per the order of the 'keys' array.
|
|
1676
|
+
*/
|
|
1657
1677
|
}, {
|
|
1658
1678
|
key: "makeQueryParams",
|
|
1659
|
-
value: function makeQueryParams(
|
|
1679
|
+
value: function makeQueryParams(keyPrototype, keyOverrides) {
|
|
1660
1680
|
return function (data) {
|
|
1661
1681
|
var result = [];
|
|
1682
|
+
var keys = Object.keys(keyPrototype);
|
|
1662
1683
|
keys.forEach(function (key) {
|
|
1663
1684
|
var _a;
|
|
1664
1685
|
var value = data[key];
|
|
@@ -25,6 +25,11 @@ export declare class UrlBuilder {
|
|
|
25
25
|
private static getBaseUrl;
|
|
26
26
|
private static getCommonTransformationQueryParams;
|
|
27
27
|
private static getCommonQueryParams;
|
|
28
|
+
/**
|
|
29
|
+
* Masks the querystring params per the 'keys' array.
|
|
30
|
+
*
|
|
31
|
+
* Order sensitive: querystring params will appear per the order of the 'keys' array.
|
|
32
|
+
*/
|
|
28
33
|
private static makeQueryParams;
|
|
29
34
|
private static getTransformationParams;
|
|
30
35
|
private static addQueryParams;
|
|
@@ -23,11 +23,13 @@ export interface UrlBuilderParams {
|
|
|
23
23
|
export declare type UrlBuilderOptions = UrlBuilderOptionsRaw | UrlBuilderTransformationOptions;
|
|
24
24
|
export declare type UrlBuilderTransformationOptions = UrlBuilderTransformationApiOptions | UrlBuilderOptionsPreset;
|
|
25
25
|
export declare type UrlBuilderTransformationApiOptions = UrlBuilderOptionsImage | UrlBuilderOptionsVideo | UrlBuilderOptionsAudio | UrlBuilderOptionsArchive;
|
|
26
|
-
export interface UrlBuilderOptionsBase {
|
|
26
|
+
export interface UrlBuilderOptionsBase extends NonDeprecatedCommonQueryParams, DeprecatedCommonQueryParams {
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* The base URL of the Bytescale CDN. (Excludes trailing "/".)
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
cdnUrl?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface NonDeprecatedCommonQueryParams {
|
|
31
33
|
/**
|
|
32
34
|
* Specifies whether to use caching for this request, or to always re-request the file.
|
|
33
35
|
*
|
|
@@ -59,6 +61,12 @@ export interface UrlBuilderOptionsBase {
|
|
|
59
61
|
*/
|
|
60
62
|
version?: string;
|
|
61
63
|
}
|
|
64
|
+
export interface DeprecatedCommonQueryParams {
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated This field has no effect: the 'auth' querystring parameter is no-longer required by the Bytescale CDN. You may remove this field from your code.
|
|
67
|
+
*/
|
|
68
|
+
auth?: boolean;
|
|
69
|
+
}
|
|
62
70
|
export interface UrlBuilderOptionsRaw extends UrlBuilderOptionsBase {
|
|
63
71
|
transformation?: undefined;
|
|
64
72
|
}
|
|
@@ -123,7 +131,8 @@ export interface UrlBuilderOptionsTransformationApi<T> extends UrlBuilderOptions
|
|
|
123
131
|
*/
|
|
124
132
|
transformationParams?: T | T[];
|
|
125
133
|
}
|
|
126
|
-
export
|
|
134
|
+
export declare type UrlBuilderOptionsTransformation = UrlBuilderOptionsTransformationOnly & UrlBuilderOptionsBase;
|
|
135
|
+
export interface UrlBuilderOptionsTransformationOnly {
|
|
127
136
|
/**
|
|
128
137
|
* The transformation artifact to download.
|
|
129
138
|
*
|
|
@@ -134,6 +143,16 @@ export interface UrlBuilderOptionsTransformation extends UrlBuilderOptionsBase {
|
|
|
134
143
|
* Default: "/"
|
|
135
144
|
*/
|
|
136
145
|
artifact?: string;
|
|
146
|
+
/**
|
|
147
|
+
* Only serve transformations from the cache; do not perform new transformations on cache miss.
|
|
148
|
+
*
|
|
149
|
+
* If true, then if the transformation result does not exist in the cache, a 404 will be returned. No transformations will be performed.
|
|
150
|
+
*
|
|
151
|
+
* If false, then if the transformation result does not exist in the cache, a new transformation will be performed to produce the result.
|
|
152
|
+
*
|
|
153
|
+
* Default: false
|
|
154
|
+
*/
|
|
155
|
+
cacheOnly?: boolean;
|
|
137
156
|
/**
|
|
138
157
|
* Specifies whether to permanently cache the transformed result in the Bytescale CDN.
|
|
139
158
|
*
|
|
@@ -78,6 +78,16 @@ export interface ProcessFileParams {
|
|
|
78
78
|
* Default: true
|
|
79
79
|
*/
|
|
80
80
|
cache?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Only serve transformations from the cache; do not perform new transformations on cache miss.
|
|
83
|
+
*
|
|
84
|
+
* If `true`, then if the transformation result does not exist in the cache, a 404 will be returned. No transformations will be performed.
|
|
85
|
+
*
|
|
86
|
+
* If `false`, then if the transformation result does not exist in the cache, a new transformation will be performed to produce the result.
|
|
87
|
+
*
|
|
88
|
+
* Default: `false`
|
|
89
|
+
*/
|
|
90
|
+
cacheOnly?: boolean;
|
|
81
91
|
/**
|
|
82
92
|
* Specifies whether to cache the transformed result in the Bytescale CDN perma-cache.
|
|
83
93
|
*
|
|
@@ -57,11 +57,11 @@ export declare class FolderApi extends runtime.BaseAPI {
|
|
|
57
57
|
*/
|
|
58
58
|
copyFolderBatch(params: CopyFolderBatchOperationParams): Promise<AsyncResponse>;
|
|
59
59
|
/**
|
|
60
|
-
* Deletes a folder asynchronously.
|
|
60
|
+
* Deletes a folder asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter. *When deleting a folder with external storage:* if the folder at `folderPath` has overridden storage settings (like an AWS S3 bucket), no files will be deleted, regardless of the parameters you pass. Only the mapping will be removed. If the folder at `folderPath` has inherited storage settings but includes subfolders with overridden storage settings, files in those subfolders won\'t be deleted, regardless of the parameters you pass. In summary, files in folders with overridden storage are never deleted, unless you directly delete a subfolder of such a folder. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
|
|
61
61
|
*/
|
|
62
62
|
deleteFolder(params: DeleteFolderOperationParams): Promise<AsyncResponse>;
|
|
63
63
|
/**
|
|
64
|
-
* Deletes multiple folders asynchronously.
|
|
64
|
+
* Deletes multiple folders asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter. *When deleting a folder with external storage:* if the folder at `folderPath` has overridden storage settings (like an AWS S3 bucket), no files will be deleted, regardless of the parameters you pass. Only the mapping will be removed. If the folder at `folderPath` has inherited storage settings but includes subfolders with overridden storage settings, files in those subfolders won\'t be deleted, regardless of the parameters you pass. In summary, files in folders with overridden storage are never deleted, unless you directly delete a subfolder of such a folder. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
|
|
65
65
|
*/
|
|
66
66
|
deleteFolderBatch(params: DeleteFolderBatchOperationParams): Promise<AsyncResponse>;
|
|
67
67
|
/**
|
|
@@ -266,15 +266,10 @@ export interface CopyFolderRequest {
|
|
|
266
266
|
*/
|
|
267
267
|
copyFiles?: boolean;
|
|
268
268
|
/**
|
|
269
|
-
* If `true` then copies files from folders that have overridden storage settings, else skips them.
|
|
270
269
|
*
|
|
271
|
-
* If
|
|
270
|
+
* If `false` then if a file's parent folder has overridden storage settings, the file won't be copied.
|
|
272
271
|
*
|
|
273
|
-
* If
|
|
274
|
-
*
|
|
275
|
-
* In all cases, files will only be copied if `copyFiles` is also set to `true`.
|
|
276
|
-
*
|
|
277
|
-
* You can ignore this setting if your account does not use folders with overridden storage settings, such as custom AWS S3 buckets.
|
|
272
|
+
* If you don't use folders with custom storage settings (like AWS S3 buckets), you don't need to worry about this setting.
|
|
278
273
|
*
|
|
279
274
|
* Conditional: `copyVirtualFolders` and `copyOverriddenStorage` cannot both be `true`.
|
|
280
275
|
*
|
|
@@ -409,9 +404,9 @@ export interface DeleteFolderBatchRequest {
|
|
|
409
404
|
/**
|
|
410
405
|
* Request body for DeleteFolder.
|
|
411
406
|
*
|
|
412
|
-
* If the folder has overridden storage settings, then no files will be deleted.
|
|
413
|
-
*
|
|
414
407
|
* You can use ListFolder to preview the operation using the `dryRun` parameter.
|
|
408
|
+
*
|
|
409
|
+
* *When deleting a folder with external storage:* if the folder at `folderPath` has overridden storage settings (like an AWS S3 bucket), no files will be deleted, regardless of the parameters you pass. Only the mapping will be removed. If the folder at `folderPath` has inherited storage settings but includes subfolders with overridden storage settings, files in those subfolders won't be deleted, regardless of the parameters you pass. In summary, files in folders with overridden storage are never deleted, unless you directly delete a subfolder of such a folder.
|
|
415
410
|
* @export
|
|
416
411
|
* @interface DeleteFolderRequest
|
|
417
412
|
*/
|
package/dist/worker/cjs/main.js
CHANGED
|
@@ -912,6 +912,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
|
|
|
912
912
|
if (params.cache !== undefined) {
|
|
913
913
|
query["cache"] = params.cache;
|
|
914
914
|
}
|
|
915
|
+
if (params.cacheOnly !== undefined) {
|
|
916
|
+
query["cache_only"] = params.cacheOnly;
|
|
917
|
+
}
|
|
915
918
|
if (params.cachePerm !== undefined) {
|
|
916
919
|
query["cache_perm"] = params.cachePerm;
|
|
917
920
|
}
|
|
@@ -1078,7 +1081,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
|
|
|
1078
1081
|
}
|
|
1079
1082
|
}
|
|
1080
1083
|
/**
|
|
1081
|
-
* Deletes a folder asynchronously.
|
|
1084
|
+
* Deletes a folder asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter. *When deleting a folder with external storage:* if the folder at `folderPath` has overridden storage settings (like an AWS S3 bucket), no files will be deleted, regardless of the parameters you pass. Only the mapping will be removed. If the folder at `folderPath` has inherited storage settings but includes subfolders with overridden storage settings, files in those subfolders won\'t be deleted, regardless of the parameters you pass. In summary, files in folders with overridden storage are never deleted, unless you directly delete a subfolder of such a folder. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
|
|
1082
1085
|
*/
|
|
1083
1086
|
}, {
|
|
1084
1087
|
key: "deleteFolder",
|
|
@@ -1104,7 +1107,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
|
|
|
1104
1107
|
}
|
|
1105
1108
|
}
|
|
1106
1109
|
/**
|
|
1107
|
-
* Deletes multiple folders asynchronously.
|
|
1110
|
+
* Deletes multiple folders asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter. *When deleting a folder with external storage:* if the folder at `folderPath` has overridden storage settings (like an AWS S3 bucket), no files will be deleted, regardless of the parameters you pass. Only the mapping will be removed. If the folder at `folderPath` has inherited storage settings but includes subfolders with overridden storage settings, files in those subfolders won\'t be deleted, regardless of the parameters you pass. In summary, files in folders with overridden storage are never deleted, unless you directly delete a subfolder of such a folder. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
|
|
1108
1111
|
*/
|
|
1109
1112
|
}, {
|
|
1110
1113
|
key: "deleteFolderBatch",
|
|
@@ -1649,29 +1652,47 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1649
1652
|
}, {
|
|
1650
1653
|
key: "getBaseUrl",
|
|
1651
1654
|
value: function getBaseUrl(params, prefix) {
|
|
1652
|
-
var
|
|
1655
|
+
var _a, _b;
|
|
1656
|
+
var cdnUrl = (_b = (_a = params.options) === null || _a === void 0 ? void 0 : _a.cdnUrl) !== null && _b !== void 0 ? _b : BytescaleApiClientConfigUtils.defaultCdnUrl;
|
|
1653
1657
|
return "".concat(cdnUrl, "/").concat(params.accountId, "/").concat(prefix).concat(params.filePath);
|
|
1654
1658
|
}
|
|
1655
1659
|
}, {
|
|
1656
1660
|
key: "getCommonTransformationQueryParams",
|
|
1657
1661
|
value: function getCommonTransformationQueryParams(trans) {
|
|
1658
|
-
return this.makeQueryParams(
|
|
1662
|
+
return this.makeQueryParams({
|
|
1663
|
+
cacheOnly: null,
|
|
1664
|
+
cachePermanently: null,
|
|
1665
|
+
// Keep this as the last param: this is the convention for transformation URLs (although not required).
|
|
1666
|
+
artifact: null
|
|
1667
|
+
}, {
|
|
1668
|
+
cacheOnly: "cache_only",
|
|
1659
1669
|
cachePermanently: "cache_perm"
|
|
1660
1670
|
})(trans);
|
|
1661
1671
|
}
|
|
1662
1672
|
}, {
|
|
1663
1673
|
key: "getCommonQueryParams",
|
|
1664
1674
|
value: function getCommonQueryParams(params) {
|
|
1665
|
-
return this.makeQueryParams(
|
|
1675
|
+
return this.makeQueryParams({
|
|
1676
|
+
cache: null,
|
|
1677
|
+
cacheTtl: null,
|
|
1678
|
+
version: null,
|
|
1679
|
+
forceDownloadPrompt: null
|
|
1680
|
+
}, {
|
|
1666
1681
|
cacheTtl: "cache_ttl",
|
|
1667
1682
|
forceDownloadPrompt: "download"
|
|
1668
1683
|
})(params);
|
|
1669
1684
|
}
|
|
1685
|
+
/**
|
|
1686
|
+
* Masks the querystring params per the 'keys' array.
|
|
1687
|
+
*
|
|
1688
|
+
* Order sensitive: querystring params will appear per the order of the 'keys' array.
|
|
1689
|
+
*/
|
|
1670
1690
|
}, {
|
|
1671
1691
|
key: "makeQueryParams",
|
|
1672
|
-
value: function makeQueryParams(
|
|
1692
|
+
value: function makeQueryParams(keyPrototype, keyOverrides) {
|
|
1673
1693
|
return function (data) {
|
|
1674
1694
|
var result = [];
|
|
1695
|
+
var keys = Object.keys(keyPrototype);
|
|
1675
1696
|
keys.forEach(function (key) {
|
|
1676
1697
|
var _a;
|
|
1677
1698
|
var value = data[key];
|
package/dist/worker/esm/main.mjs
CHANGED
|
@@ -897,6 +897,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
|
|
|
897
897
|
if (params.cache !== undefined) {
|
|
898
898
|
query["cache"] = params.cache;
|
|
899
899
|
}
|
|
900
|
+
if (params.cacheOnly !== undefined) {
|
|
901
|
+
query["cache_only"] = params.cacheOnly;
|
|
902
|
+
}
|
|
900
903
|
if (params.cachePerm !== undefined) {
|
|
901
904
|
query["cache_perm"] = params.cachePerm;
|
|
902
905
|
}
|
|
@@ -1063,7 +1066,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
|
|
|
1063
1066
|
}
|
|
1064
1067
|
}
|
|
1065
1068
|
/**
|
|
1066
|
-
* Deletes a folder asynchronously.
|
|
1069
|
+
* Deletes a folder asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter. *When deleting a folder with external storage:* if the folder at `folderPath` has overridden storage settings (like an AWS S3 bucket), no files will be deleted, regardless of the parameters you pass. Only the mapping will be removed. If the folder at `folderPath` has inherited storage settings but includes subfolders with overridden storage settings, files in those subfolders won\'t be deleted, regardless of the parameters you pass. In summary, files in folders with overridden storage are never deleted, unless you directly delete a subfolder of such a folder. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
|
|
1067
1070
|
*/
|
|
1068
1071
|
}, {
|
|
1069
1072
|
key: "deleteFolder",
|
|
@@ -1089,7 +1092,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
|
|
|
1089
1092
|
}
|
|
1090
1093
|
}
|
|
1091
1094
|
/**
|
|
1092
|
-
* Deletes multiple folders asynchronously.
|
|
1095
|
+
* Deletes multiple folders asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter. *When deleting a folder with external storage:* if the folder at `folderPath` has overridden storage settings (like an AWS S3 bucket), no files will be deleted, regardless of the parameters you pass. Only the mapping will be removed. If the folder at `folderPath` has inherited storage settings but includes subfolders with overridden storage settings, files in those subfolders won\'t be deleted, regardless of the parameters you pass. In summary, files in folders with overridden storage are never deleted, unless you directly delete a subfolder of such a folder. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
|
|
1093
1096
|
*/
|
|
1094
1097
|
}, {
|
|
1095
1098
|
key: "deleteFolderBatch",
|
|
@@ -1634,29 +1637,47 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1634
1637
|
}, {
|
|
1635
1638
|
key: "getBaseUrl",
|
|
1636
1639
|
value: function getBaseUrl(params, prefix) {
|
|
1637
|
-
var
|
|
1640
|
+
var _a, _b;
|
|
1641
|
+
var cdnUrl = (_b = (_a = params.options) === null || _a === void 0 ? void 0 : _a.cdnUrl) !== null && _b !== void 0 ? _b : BytescaleApiClientConfigUtils.defaultCdnUrl;
|
|
1638
1642
|
return "".concat(cdnUrl, "/").concat(params.accountId, "/").concat(prefix).concat(params.filePath);
|
|
1639
1643
|
}
|
|
1640
1644
|
}, {
|
|
1641
1645
|
key: "getCommonTransformationQueryParams",
|
|
1642
1646
|
value: function getCommonTransformationQueryParams(trans) {
|
|
1643
|
-
return this.makeQueryParams(
|
|
1647
|
+
return this.makeQueryParams({
|
|
1648
|
+
cacheOnly: null,
|
|
1649
|
+
cachePermanently: null,
|
|
1650
|
+
// Keep this as the last param: this is the convention for transformation URLs (although not required).
|
|
1651
|
+
artifact: null
|
|
1652
|
+
}, {
|
|
1653
|
+
cacheOnly: "cache_only",
|
|
1644
1654
|
cachePermanently: "cache_perm"
|
|
1645
1655
|
})(trans);
|
|
1646
1656
|
}
|
|
1647
1657
|
}, {
|
|
1648
1658
|
key: "getCommonQueryParams",
|
|
1649
1659
|
value: function getCommonQueryParams(params) {
|
|
1650
|
-
return this.makeQueryParams(
|
|
1660
|
+
return this.makeQueryParams({
|
|
1661
|
+
cache: null,
|
|
1662
|
+
cacheTtl: null,
|
|
1663
|
+
version: null,
|
|
1664
|
+
forceDownloadPrompt: null
|
|
1665
|
+
}, {
|
|
1651
1666
|
cacheTtl: "cache_ttl",
|
|
1652
1667
|
forceDownloadPrompt: "download"
|
|
1653
1668
|
})(params);
|
|
1654
1669
|
}
|
|
1670
|
+
/**
|
|
1671
|
+
* Masks the querystring params per the 'keys' array.
|
|
1672
|
+
*
|
|
1673
|
+
* Order sensitive: querystring params will appear per the order of the 'keys' array.
|
|
1674
|
+
*/
|
|
1655
1675
|
}, {
|
|
1656
1676
|
key: "makeQueryParams",
|
|
1657
|
-
value: function makeQueryParams(
|
|
1677
|
+
value: function makeQueryParams(keyPrototype, keyOverrides) {
|
|
1658
1678
|
return function (data) {
|
|
1659
1679
|
var result = [];
|
|
1680
|
+
var keys = Object.keys(keyPrototype);
|
|
1660
1681
|
keys.forEach(function (key) {
|
|
1661
1682
|
var _a;
|
|
1662
1683
|
var value = data[key];
|
package/package.json
CHANGED
|
@@ -15,10 +15,21 @@ import * as Path from "path";
|
|
|
15
15
|
function createRandomStream(sizeInBytes: number): NodeJS.ReadableStream {
|
|
16
16
|
const dictionary = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split("");
|
|
17
17
|
|
|
18
|
+
// Ensure the chunk size is small enough to cause enough entropy (as we pick a new character for reach chunk).
|
|
19
|
+
const minRandomBlocks = 10;
|
|
20
|
+
const maxChunkSize = Math.min(64 * 1024, Math.ceil(sizeInBytes / minRandomBlocks));
|
|
21
|
+
|
|
18
22
|
let producedSize = 0;
|
|
19
23
|
let iteration = 0;
|
|
20
24
|
return new Readable({
|
|
21
|
-
read(
|
|
25
|
+
read(requestedReadSize) {
|
|
26
|
+
const maxRequestedReadSize = Math.min(requestedReadSize, maxChunkSize);
|
|
27
|
+
|
|
28
|
+
// This ensures streams of the same size are unique, else they would have the same contents, assuming chunk size is the same.
|
|
29
|
+
// We use 0.8-1 to prevent really small chunks, which may create inefficiencies.
|
|
30
|
+
const randomness = randomBetween(0.8, 1);
|
|
31
|
+
|
|
32
|
+
let readSize = Math.ceil(maxRequestedReadSize * randomness);
|
|
22
33
|
let shouldEnd = false;
|
|
23
34
|
|
|
24
35
|
if (producedSize + readSize >= sizeInBytes) {
|
|
@@ -48,6 +59,10 @@ function createRandomStream(sizeInBytes: number): NodeJS.ReadableStream {
|
|
|
48
59
|
});
|
|
49
60
|
}
|
|
50
61
|
|
|
62
|
+
function randomBetween(min: number, max: number): number {
|
|
63
|
+
return Math.random() * (max - min) + min;
|
|
64
|
+
}
|
|
65
|
+
|
|
51
66
|
async function writeToDisk(reader: NodeJS.ReadableStream, path: string): Promise<void> {
|
|
52
67
|
await new Promise((resolve, reject) => {
|
|
53
68
|
const writer = fs.createWriteStream(path);
|