@bytescale/sdk 3.24.0 → 3.26.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.
@@ -600,6 +600,7 @@ function querystring(params) {
600
600
  }
601
601
  function querystringSingleKey(key, value) {
602
602
  if (value instanceof Object) {
603
+ // Matches 'array' or 'object' (which we want).
603
604
  return querystring(value);
604
605
  }
605
606
  return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(String(value)));
@@ -912,6 +913,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
912
913
  if (params.cache !== undefined) {
913
914
  query["cache"] = params.cache;
914
915
  }
916
+ if (params.cacheOnly !== undefined) {
917
+ query["cache_only"] = params.cacheOnly;
918
+ }
915
919
  if (params.cachePerm !== undefined) {
916
920
  query["cache_perm"] = params.cachePerm;
917
921
  }
@@ -1078,7 +1082,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1078
1082
  }
1079
1083
  }
1080
1084
  /**
1081
- * 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 using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1085
+ * 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
1086
  */
1083
1087
  }, {
1084
1088
  key: "deleteFolder",
@@ -1104,7 +1108,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1104
1108
  }
1105
1109
  }
1106
1110
  /**
1107
- * 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 using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1111
+ * 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
1112
  */
1109
1113
  }, {
1110
1114
  key: "deleteFolderBatch",
@@ -1656,23 +1660,40 @@ var UrlBuilder = /*#__PURE__*/function () {
1656
1660
  }, {
1657
1661
  key: "getCommonTransformationQueryParams",
1658
1662
  value: function getCommonTransformationQueryParams(trans) {
1659
- return this.makeQueryParams(["cachePermanently", "artifact"], {
1663
+ return this.makeQueryParams({
1664
+ cacheOnly: null,
1665
+ cachePermanently: null,
1666
+ // Keep this as the last param: this is the convention for transformation URLs (although not required).
1667
+ artifact: null
1668
+ }, {
1669
+ cacheOnly: "cache_only",
1660
1670
  cachePermanently: "cache_perm"
1661
1671
  })(trans);
1662
1672
  }
1663
1673
  }, {
1664
1674
  key: "getCommonQueryParams",
1665
1675
  value: function getCommonQueryParams(params) {
1666
- return this.makeQueryParams(["cache", "cacheTtl", "version", "forceDownloadPrompt"], {
1676
+ return this.makeQueryParams({
1677
+ cache: null,
1678
+ cacheTtl: null,
1679
+ version: null,
1680
+ forceDownloadPrompt: null
1681
+ }, {
1667
1682
  cacheTtl: "cache_ttl",
1668
1683
  forceDownloadPrompt: "download"
1669
1684
  })(params);
1670
1685
  }
1686
+ /**
1687
+ * Masks the querystring params per the 'keys' array.
1688
+ *
1689
+ * Order sensitive: querystring params will appear per the order of the 'keys' array.
1690
+ */
1671
1691
  }, {
1672
1692
  key: "makeQueryParams",
1673
- value: function makeQueryParams(keys, keyOverrides) {
1693
+ value: function makeQueryParams(keyPrototype, keyOverrides) {
1674
1694
  return function (data) {
1675
1695
  var result = [];
1696
+ var keys = Object.keys(keyPrototype);
1676
1697
  keys.forEach(function (key) {
1677
1698
  var _a;
1678
1699
  var value = data[key];
@@ -585,6 +585,7 @@ function querystring(params) {
585
585
  }
586
586
  function querystringSingleKey(key, value) {
587
587
  if (value instanceof Object) {
588
+ // Matches 'array' or 'object' (which we want).
588
589
  return querystring(value);
589
590
  }
590
591
  return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(String(value)));
@@ -897,6 +898,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
897
898
  if (params.cache !== undefined) {
898
899
  query["cache"] = params.cache;
899
900
  }
901
+ if (params.cacheOnly !== undefined) {
902
+ query["cache_only"] = params.cacheOnly;
903
+ }
900
904
  if (params.cachePerm !== undefined) {
901
905
  query["cache_perm"] = params.cachePerm;
902
906
  }
@@ -1063,7 +1067,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1063
1067
  }
1064
1068
  }
1065
1069
  /**
1066
- * 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 using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1070
+ * 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
1071
  */
1068
1072
  }, {
1069
1073
  key: "deleteFolder",
@@ -1089,7 +1093,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1089
1093
  }
1090
1094
  }
1091
1095
  /**
1092
- * 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 using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1096
+ * 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
1097
  */
1094
1098
  }, {
1095
1099
  key: "deleteFolderBatch",
@@ -1641,23 +1645,40 @@ var UrlBuilder = /*#__PURE__*/function () {
1641
1645
  }, {
1642
1646
  key: "getCommonTransformationQueryParams",
1643
1647
  value: function getCommonTransformationQueryParams(trans) {
1644
- return this.makeQueryParams(["cachePermanently", "artifact"], {
1648
+ return this.makeQueryParams({
1649
+ cacheOnly: null,
1650
+ cachePermanently: null,
1651
+ // Keep this as the last param: this is the convention for transformation URLs (although not required).
1652
+ artifact: null
1653
+ }, {
1654
+ cacheOnly: "cache_only",
1645
1655
  cachePermanently: "cache_perm"
1646
1656
  })(trans);
1647
1657
  }
1648
1658
  }, {
1649
1659
  key: "getCommonQueryParams",
1650
1660
  value: function getCommonQueryParams(params) {
1651
- return this.makeQueryParams(["cache", "cacheTtl", "version", "forceDownloadPrompt"], {
1661
+ return this.makeQueryParams({
1662
+ cache: null,
1663
+ cacheTtl: null,
1664
+ version: null,
1665
+ forceDownloadPrompt: null
1666
+ }, {
1652
1667
  cacheTtl: "cache_ttl",
1653
1668
  forceDownloadPrompt: "download"
1654
1669
  })(params);
1655
1670
  }
1671
+ /**
1672
+ * Masks the querystring params per the 'keys' array.
1673
+ *
1674
+ * Order sensitive: querystring params will appear per the order of the 'keys' array.
1675
+ */
1656
1676
  }, {
1657
1677
  key: "makeQueryParams",
1658
- value: function makeQueryParams(keys, keyOverrides) {
1678
+ value: function makeQueryParams(keyPrototype, keyOverrides) {
1659
1679
  return function (data) {
1660
1680
  var result = [];
1681
+ var keys = Object.keys(keyPrototype);
1661
1682
  keys.forEach(function (key) {
1662
1683
  var _a;
1663
1684
  var value = data[key];
@@ -600,6 +600,7 @@ function querystring(params) {
600
600
  }
601
601
  function querystringSingleKey(key, value) {
602
602
  if (value instanceof Object) {
603
+ // Matches 'array' or 'object' (which we want).
603
604
  return querystring(value);
604
605
  }
605
606
  return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(String(value)));
@@ -912,6 +913,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
912
913
  if (params.cache !== undefined) {
913
914
  query["cache"] = params.cache;
914
915
  }
916
+ if (params.cacheOnly !== undefined) {
917
+ query["cache_only"] = params.cacheOnly;
918
+ }
915
919
  if (params.cachePerm !== undefined) {
916
920
  query["cache_perm"] = params.cachePerm;
917
921
  }
@@ -1078,7 +1082,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1078
1082
  }
1079
1083
  }
1080
1084
  /**
1081
- * 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 using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1085
+ * 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
1086
  */
1083
1087
  }, {
1084
1088
  key: "deleteFolder",
@@ -1104,7 +1108,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1104
1108
  }
1105
1109
  }
1106
1110
  /**
1107
- * 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 using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1111
+ * 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
1112
  */
1109
1113
  }, {
1110
1114
  key: "deleteFolderBatch",
@@ -1656,23 +1660,40 @@ var UrlBuilder = /*#__PURE__*/function () {
1656
1660
  }, {
1657
1661
  key: "getCommonTransformationQueryParams",
1658
1662
  value: function getCommonTransformationQueryParams(trans) {
1659
- return this.makeQueryParams(["cachePermanently", "artifact"], {
1663
+ return this.makeQueryParams({
1664
+ cacheOnly: null,
1665
+ cachePermanently: null,
1666
+ // Keep this as the last param: this is the convention for transformation URLs (although not required).
1667
+ artifact: null
1668
+ }, {
1669
+ cacheOnly: "cache_only",
1660
1670
  cachePermanently: "cache_perm"
1661
1671
  })(trans);
1662
1672
  }
1663
1673
  }, {
1664
1674
  key: "getCommonQueryParams",
1665
1675
  value: function getCommonQueryParams(params) {
1666
- return this.makeQueryParams(["cache", "cacheTtl", "version", "forceDownloadPrompt"], {
1676
+ return this.makeQueryParams({
1677
+ cache: null,
1678
+ cacheTtl: null,
1679
+ version: null,
1680
+ forceDownloadPrompt: null
1681
+ }, {
1667
1682
  cacheTtl: "cache_ttl",
1668
1683
  forceDownloadPrompt: "download"
1669
1684
  })(params);
1670
1685
  }
1686
+ /**
1687
+ * Masks the querystring params per the 'keys' array.
1688
+ *
1689
+ * Order sensitive: querystring params will appear per the order of the 'keys' array.
1690
+ */
1671
1691
  }, {
1672
1692
  key: "makeQueryParams",
1673
- value: function makeQueryParams(keys, keyOverrides) {
1693
+ value: function makeQueryParams(keyPrototype, keyOverrides) {
1674
1694
  return function (data) {
1675
1695
  var result = [];
1696
+ var keys = Object.keys(keyPrototype);
1676
1697
  keys.forEach(function (key) {
1677
1698
  var _a;
1678
1699
  var value = data[key];
@@ -587,6 +587,7 @@ function querystring(params) {
587
587
  }
588
588
  function querystringSingleKey(key, value) {
589
589
  if (value instanceof Object) {
590
+ // Matches 'array' or 'object' (which we want).
590
591
  return querystring(value);
591
592
  }
592
593
  return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(String(value)));
@@ -899,6 +900,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
899
900
  if (params.cache !== undefined) {
900
901
  query["cache"] = params.cache;
901
902
  }
903
+ if (params.cacheOnly !== undefined) {
904
+ query["cache_only"] = params.cacheOnly;
905
+ }
902
906
  if (params.cachePerm !== undefined) {
903
907
  query["cache_perm"] = params.cachePerm;
904
908
  }
@@ -1065,7 +1069,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1065
1069
  }
1066
1070
  }
1067
1071
  /**
1068
- * 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 using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1072
+ * 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
1073
  */
1070
1074
  }, {
1071
1075
  key: "deleteFolder",
@@ -1091,7 +1095,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1091
1095
  }
1092
1096
  }
1093
1097
  /**
1094
- * 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 using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1098
+ * 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
1099
  */
1096
1100
  }, {
1097
1101
  key: "deleteFolderBatch",
@@ -1643,23 +1647,40 @@ var UrlBuilder = /*#__PURE__*/function () {
1643
1647
  }, {
1644
1648
  key: "getCommonTransformationQueryParams",
1645
1649
  value: function getCommonTransformationQueryParams(trans) {
1646
- return this.makeQueryParams(["cachePermanently", "artifact"], {
1650
+ return this.makeQueryParams({
1651
+ cacheOnly: null,
1652
+ cachePermanently: null,
1653
+ // Keep this as the last param: this is the convention for transformation URLs (although not required).
1654
+ artifact: null
1655
+ }, {
1656
+ cacheOnly: "cache_only",
1647
1657
  cachePermanently: "cache_perm"
1648
1658
  })(trans);
1649
1659
  }
1650
1660
  }, {
1651
1661
  key: "getCommonQueryParams",
1652
1662
  value: function getCommonQueryParams(params) {
1653
- return this.makeQueryParams(["cache", "cacheTtl", "version", "forceDownloadPrompt"], {
1663
+ return this.makeQueryParams({
1664
+ cache: null,
1665
+ cacheTtl: null,
1666
+ version: null,
1667
+ forceDownloadPrompt: null
1668
+ }, {
1654
1669
  cacheTtl: "cache_ttl",
1655
1670
  forceDownloadPrompt: "download"
1656
1671
  })(params);
1657
1672
  }
1673
+ /**
1674
+ * Masks the querystring params per the 'keys' array.
1675
+ *
1676
+ * Order sensitive: querystring params will appear per the order of the 'keys' array.
1677
+ */
1658
1678
  }, {
1659
1679
  key: "makeQueryParams",
1660
- value: function makeQueryParams(keys, keyOverrides) {
1680
+ value: function makeQueryParams(keyPrototype, keyOverrides) {
1661
1681
  return function (data) {
1662
1682
  var result = [];
1683
+ var keys = Object.keys(keyPrototype);
1663
1684
  keys.forEach(function (key) {
1664
1685
  var _a;
1665
1686
  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
- * @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.
28
+ * The base URL of the Bytescale CDN. (Excludes trailing "/".)
29
29
  */
30
- auth?: boolean;
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
  *
@@ -42,10 +44,6 @@ export interface UrlBuilderOptionsBase {
42
44
  * Default: Please refer to your account's default cache settings in the Bytescale Dashboard.
43
45
  */
44
46
  cacheTtl?: number;
45
- /**
46
- * The base URL of the Bytescale CDN. (Excludes trailing "/".)
47
- */
48
- cdnUrl?: string;
49
47
  /**
50
48
  * Forces the browser to display a download prompt for the file, instead of displaying the file in the browser.
51
49
  *
@@ -63,6 +61,12 @@ export interface UrlBuilderOptionsBase {
63
61
  */
64
62
  version?: string;
65
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
+ }
66
70
  export interface UrlBuilderOptionsRaw extends UrlBuilderOptionsBase {
67
71
  transformation?: undefined;
68
72
  }
@@ -127,7 +131,8 @@ export interface UrlBuilderOptionsTransformationApi<T> extends UrlBuilderOptions
127
131
  */
128
132
  transformationParams?: T | T[];
129
133
  }
130
- export interface UrlBuilderOptionsTransformation extends UrlBuilderOptionsBase {
134
+ export declare type UrlBuilderOptionsTransformation = UrlBuilderOptionsTransformationOnly & UrlBuilderOptionsBase;
135
+ export interface UrlBuilderOptionsTransformationOnly {
131
136
  /**
132
137
  * The transformation artifact to download.
133
138
  *
@@ -138,6 +143,16 @@ export interface UrlBuilderOptionsTransformation extends UrlBuilderOptionsBase {
138
143
  * Default: "/"
139
144
  */
140
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;
141
156
  /**
142
157
  * Specifies whether to permanently cache the transformed result in the Bytescale CDN.
143
158
  *
@@ -10,7 +10,8 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from "../runtime";
13
- import type { AsyncResponse, CopyFileBatchRequest, CopyFileRequest, CopyFileResponse, DeleteFileBatchRequest, FileDetails, ProcessFileAndSaveRequest, ProcessFileAndSaveResponse, ProcessFileTransformationParamsParameterValue } from "../models";
13
+ import type { AsyncResponse, CopyFileBatchRequest, CopyFileRequest, CopyFileResponse, DeleteFileBatchRequest, FileDetails, ProcessFileAndSaveRequest, ProcessFileAndSaveResponse } from "../models";
14
+ import type { ProcessFileTransformationParamsParameter } from "../models";
14
15
  export interface CopyFileOperationParams {
15
16
  accountId: string;
16
17
  copyFileRequest: CopyFileRequest;
@@ -78,6 +79,16 @@ export interface ProcessFileParams {
78
79
  * Default: true
79
80
  */
80
81
  cache?: boolean;
82
+ /**
83
+ * Only serve transformations from the cache; do not perform new transformations on cache miss.
84
+ *
85
+ * If `true`, then if the transformation result does not exist in the cache, a 404 will be returned. No transformations will be performed.
86
+ *
87
+ * If `false`, then if the transformation result does not exist in the cache, a new transformation will be performed to produce the result.
88
+ *
89
+ * Default: `false`
90
+ */
91
+ cacheOnly?: boolean;
81
92
  /**
82
93
  * Specifies whether to cache the transformed result in the Bytescale CDN perma-cache.
83
94
  *
@@ -114,9 +125,7 @@ export interface ProcessFileParams {
114
125
  * - https://www.bytescale.com/docs/audio-processing-api
115
126
  * - https://www.bytescale.com/docs/archive-processing-api
116
127
  */
117
- transformationParams?: {
118
- [key: string]: ProcessFileTransformationParamsParameterValue;
119
- };
128
+ transformationParams?: ProcessFileTransformationParamsParameter;
120
129
  /**
121
130
  * Add this parameter and increment its value to force the file to be reprocessed.
122
131
  *
@@ -149,9 +158,7 @@ export interface ProcessFileAndSaveOperationParams {
149
158
  * - https://www.bytescale.com/docs/audio-processing-api
150
159
  * - https://www.bytescale.com/docs/archive-processing-api
151
160
  */
152
- transformationParams?: {
153
- [key: string]: ProcessFileTransformationParamsParameterValue;
154
- };
161
+ transformationParams?: ProcessFileTransformationParamsParameter;
155
162
  }
156
163
  export declare class FileApi extends runtime.BaseAPI {
157
164
  /**
@@ -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. If the folder has overridden storage settings, then no files will be deleted. You can use ListFolder to preview the operation using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
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. If the folder has overridden storage settings, then no files will be deleted. You can use ListFolder to preview the operation using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
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 the `source` folder overrides its storage settings, then its files will only be copied if this flag is `true`.
270
+ * If `false` then if a file's parent folder has overridden storage settings, the file won't be copied.
272
271
  *
273
- * If the `source` folder inherits its storage settings, then its files will be copied regardless of this flag.
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
  */
@@ -1591,11 +1586,21 @@ export interface ProcessFileAndSaveResponseSync {
1591
1586
  */
1592
1587
  export declare type ProcessFileAndSaveResponseSyncAsyncEnum = false;
1593
1588
  /**
1594
- * @type ProcessFileTransformationParamsParameterValue
1589
+ * @type ProcessFileTransformationParamsParameter
1590
+ *
1591
+ * @export
1592
+ */
1593
+ export declare type ProcessFileTransformationParamsParameter = Array<{
1594
+ [key: string]: ProcessFileTransformationParamsParameterOneOfValue;
1595
+ }> | {
1596
+ [key: string]: ProcessFileTransformationParamsParameterOneOfValue;
1597
+ };
1598
+ /**
1599
+ * @type ProcessFileTransformationParamsParameterOneOfValue
1595
1600
  *
1596
1601
  * @export
1597
1602
  */
1598
- export declare type ProcessFileTransformationParamsParameterValue = boolean | number | string;
1603
+ export declare type ProcessFileTransformationParamsParameterOneOfValue = boolean | number | string;
1599
1604
  /**
1600
1605
  * Permissions applied to anonymous users who attempt to download files from a folder.
1601
1606
  *
@@ -600,6 +600,7 @@ function querystring(params) {
600
600
  }
601
601
  function querystringSingleKey(key, value) {
602
602
  if (value instanceof Object) {
603
+ // Matches 'array' or 'object' (which we want).
603
604
  return querystring(value);
604
605
  }
605
606
  return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(String(value)));
@@ -912,6 +913,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
912
913
  if (params.cache !== undefined) {
913
914
  query["cache"] = params.cache;
914
915
  }
916
+ if (params.cacheOnly !== undefined) {
917
+ query["cache_only"] = params.cacheOnly;
918
+ }
915
919
  if (params.cachePerm !== undefined) {
916
920
  query["cache_perm"] = params.cachePerm;
917
921
  }
@@ -1078,7 +1082,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1078
1082
  }
1079
1083
  }
1080
1084
  /**
1081
- * 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 using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1085
+ * 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
1086
  */
1083
1087
  }, {
1084
1088
  key: "deleteFolder",
@@ -1104,7 +1108,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1104
1108
  }
1105
1109
  }
1106
1110
  /**
1107
- * 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 using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1111
+ * 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
1112
  */
1109
1113
  }, {
1110
1114
  key: "deleteFolderBatch",
@@ -1656,23 +1660,40 @@ var UrlBuilder = /*#__PURE__*/function () {
1656
1660
  }, {
1657
1661
  key: "getCommonTransformationQueryParams",
1658
1662
  value: function getCommonTransformationQueryParams(trans) {
1659
- return this.makeQueryParams(["cachePermanently", "artifact"], {
1663
+ return this.makeQueryParams({
1664
+ cacheOnly: null,
1665
+ cachePermanently: null,
1666
+ // Keep this as the last param: this is the convention for transformation URLs (although not required).
1667
+ artifact: null
1668
+ }, {
1669
+ cacheOnly: "cache_only",
1660
1670
  cachePermanently: "cache_perm"
1661
1671
  })(trans);
1662
1672
  }
1663
1673
  }, {
1664
1674
  key: "getCommonQueryParams",
1665
1675
  value: function getCommonQueryParams(params) {
1666
- return this.makeQueryParams(["cache", "cacheTtl", "version", "forceDownloadPrompt"], {
1676
+ return this.makeQueryParams({
1677
+ cache: null,
1678
+ cacheTtl: null,
1679
+ version: null,
1680
+ forceDownloadPrompt: null
1681
+ }, {
1667
1682
  cacheTtl: "cache_ttl",
1668
1683
  forceDownloadPrompt: "download"
1669
1684
  })(params);
1670
1685
  }
1686
+ /**
1687
+ * Masks the querystring params per the 'keys' array.
1688
+ *
1689
+ * Order sensitive: querystring params will appear per the order of the 'keys' array.
1690
+ */
1671
1691
  }, {
1672
1692
  key: "makeQueryParams",
1673
- value: function makeQueryParams(keys, keyOverrides) {
1693
+ value: function makeQueryParams(keyPrototype, keyOverrides) {
1674
1694
  return function (data) {
1675
1695
  var result = [];
1696
+ var keys = Object.keys(keyPrototype);
1676
1697
  keys.forEach(function (key) {
1677
1698
  var _a;
1678
1699
  var value = data[key];
@@ -585,6 +585,7 @@ function querystring(params) {
585
585
  }
586
586
  function querystringSingleKey(key, value) {
587
587
  if (value instanceof Object) {
588
+ // Matches 'array' or 'object' (which we want).
588
589
  return querystring(value);
589
590
  }
590
591
  return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(String(value)));
@@ -897,6 +898,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
897
898
  if (params.cache !== undefined) {
898
899
  query["cache"] = params.cache;
899
900
  }
901
+ if (params.cacheOnly !== undefined) {
902
+ query["cache_only"] = params.cacheOnly;
903
+ }
900
904
  if (params.cachePerm !== undefined) {
901
905
  query["cache_perm"] = params.cachePerm;
902
906
  }
@@ -1063,7 +1067,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1063
1067
  }
1064
1068
  }
1065
1069
  /**
1066
- * 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 using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1070
+ * 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
1071
  */
1068
1072
  }, {
1069
1073
  key: "deleteFolder",
@@ -1089,7 +1093,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1089
1093
  }
1090
1094
  }
1091
1095
  /**
1092
- * 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 using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1096
+ * 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
1097
  */
1094
1098
  }, {
1095
1099
  key: "deleteFolderBatch",
@@ -1641,23 +1645,40 @@ var UrlBuilder = /*#__PURE__*/function () {
1641
1645
  }, {
1642
1646
  key: "getCommonTransformationQueryParams",
1643
1647
  value: function getCommonTransformationQueryParams(trans) {
1644
- return this.makeQueryParams(["cachePermanently", "artifact"], {
1648
+ return this.makeQueryParams({
1649
+ cacheOnly: null,
1650
+ cachePermanently: null,
1651
+ // Keep this as the last param: this is the convention for transformation URLs (although not required).
1652
+ artifact: null
1653
+ }, {
1654
+ cacheOnly: "cache_only",
1645
1655
  cachePermanently: "cache_perm"
1646
1656
  })(trans);
1647
1657
  }
1648
1658
  }, {
1649
1659
  key: "getCommonQueryParams",
1650
1660
  value: function getCommonQueryParams(params) {
1651
- return this.makeQueryParams(["cache", "cacheTtl", "version", "forceDownloadPrompt"], {
1661
+ return this.makeQueryParams({
1662
+ cache: null,
1663
+ cacheTtl: null,
1664
+ version: null,
1665
+ forceDownloadPrompt: null
1666
+ }, {
1652
1667
  cacheTtl: "cache_ttl",
1653
1668
  forceDownloadPrompt: "download"
1654
1669
  })(params);
1655
1670
  }
1671
+ /**
1672
+ * Masks the querystring params per the 'keys' array.
1673
+ *
1674
+ * Order sensitive: querystring params will appear per the order of the 'keys' array.
1675
+ */
1656
1676
  }, {
1657
1677
  key: "makeQueryParams",
1658
- value: function makeQueryParams(keys, keyOverrides) {
1678
+ value: function makeQueryParams(keyPrototype, keyOverrides) {
1659
1679
  return function (data) {
1660
1680
  var result = [];
1681
+ var keys = Object.keys(keyPrototype);
1661
1682
  keys.forEach(function (key) {
1662
1683
  var _a;
1663
1684
  var value = data[key];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytescale/sdk",
3
- "version": "3.24.0",
3
+ "version": "3.26.0",
4
4
  "description": "Bytescale JavaScript SDK",
5
5
  "author": "Bytescale <hello@bytescale.com> (https://www.bytescale.com)",
6
6
  "license": "MIT",