@bytescale/sdk 1.3.0 → 1.5.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.
@@ -316,33 +316,17 @@ var BytescaleApiError = /*#__PURE__*/function (_Error2) {
316
316
  return runtime_createClass(BytescaleApiError);
317
317
  }( /*#__PURE__*/_wrapNativeSuper(Error));
318
318
  function querystring(params) {
319
- var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
320
319
  return Object.keys(params).map(function (key) {
321
- return querystringSingleKey(key, params[key], prefix);
320
+ return querystringSingleKey(key, params[key]);
322
321
  }).filter(function (part) {
323
322
  return part.length > 0;
324
323
  }).join("&");
325
324
  }
326
325
  function querystringSingleKey(key, value) {
327
- var keyPrefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
328
- var fullKey = keyPrefix + (keyPrefix.length ? "[".concat(key, "]") : key);
329
- if (value instanceof Array) {
330
- var multiValue = value.map(function (singleValue) {
331
- return encodeURIComponent(String(singleValue));
332
- }).join("&".concat(encodeURIComponent(fullKey), "="));
333
- return "".concat(encodeURIComponent(fullKey), "=").concat(multiValue);
334
- }
335
- if (value instanceof Set) {
336
- var valueAsArray = Array.from(value);
337
- return querystringSingleKey(key, valueAsArray, keyPrefix);
338
- }
339
- if (value instanceof Date) {
340
- return "".concat(encodeURIComponent(fullKey), "=").concat(encodeURIComponent(value.toISOString()));
341
- }
342
326
  if (value instanceof Object) {
343
- return querystring(value, fullKey);
327
+ return querystring(value);
344
328
  }
345
- return "".concat(encodeURIComponent(fullKey), "=").concat(encodeURIComponent(String(value)));
329
+ return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(String(value)));
346
330
  }
347
331
  var JSONApiResponse = /*#__PURE__*/function () {
348
332
  function JSONApiResponse(raw) {
@@ -664,6 +648,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
664
648
  if (params.large !== undefined) {
665
649
  query["large"] = params.large;
666
650
  }
651
+ if (params.transformationParams !== undefined) {
652
+ query["transformationParams"] = params.transformationParams;
653
+ }
667
654
  if (params.version !== undefined) {
668
655
  query["version"] = params.version;
669
656
  }
@@ -695,6 +682,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
695
682
  try {
696
683
  var _this16 = this;
697
684
  var query = {};
685
+ if (params.transformationParams !== undefined) {
686
+ query["transformationParams"] = params.transformationParams;
687
+ }
698
688
  var headers = {};
699
689
  headers["Content-Type"] = "application/json";
700
690
  return FileApi_await(_this16.request({
@@ -1355,17 +1345,21 @@ var UrlBuilder = /*#__PURE__*/function () {
1355
1345
  /**
1356
1346
  * Builds a URL to either a raw file or a transformed file.
1357
1347
  *
1358
- * Example 1) Raw file:
1348
+ * Example 1) Getting a publicly-accessible raw file URL:
1359
1349
  *
1360
1350
  * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg" })
1361
1351
  *
1362
- * Example 2) Image resized to 500x500:
1352
+ * Example 2) Getting a publicly-accessible image URL, resized to 500x500:
1353
+ *
1354
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", options: { transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } } } })
1355
+ *
1356
+ * Example 3) Getting a privately-accessible image URL, resized to 500x500 (requires 'AuthManager.beginAuthSession' to be called before accessing the URL):
1363
1357
  *
1364
- * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } } })
1358
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", options: { transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } }, auth: true } })
1365
1359
  *
1366
- * Example 3) Image resized to 500x500, which is privately accessible (i.e. requires 'AuthManager.beginAuthSession' before it can be accessed):
1360
+ * Example 4) Getting a publicly-accessible image URL, resized using a transformation preset called "thumbnail" that was created manually in the Bytescale Dashboard:
1367
1361
  *
1368
- * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } }, auth: true })
1362
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", options: { transformation: { type: "preset", preset: "thumbnail" } } })
1369
1363
  */
1370
1364
  UrlBuilder_createClass(UrlBuilder, [{
1371
1365
  key: "url",
@@ -338,33 +338,17 @@ var BytescaleApiError = /*#__PURE__*/function (_Error2) {
338
338
  return runtime_createClass(BytescaleApiError);
339
339
  }( /*#__PURE__*/_wrapNativeSuper(Error));
340
340
  function querystring(params) {
341
- var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
342
341
  return Object.keys(params).map(function (key) {
343
- return querystringSingleKey(key, params[key], prefix);
342
+ return querystringSingleKey(key, params[key]);
344
343
  }).filter(function (part) {
345
344
  return part.length > 0;
346
345
  }).join("&");
347
346
  }
348
347
  function querystringSingleKey(key, value) {
349
- var keyPrefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
350
- var fullKey = keyPrefix + (keyPrefix.length ? "[".concat(key, "]") : key);
351
- if (value instanceof Array) {
352
- var multiValue = value.map(function (singleValue) {
353
- return encodeURIComponent(String(singleValue));
354
- }).join("&".concat(encodeURIComponent(fullKey), "="));
355
- return "".concat(encodeURIComponent(fullKey), "=").concat(multiValue);
356
- }
357
- if (value instanceof Set) {
358
- var valueAsArray = Array.from(value);
359
- return querystringSingleKey(key, valueAsArray, keyPrefix);
360
- }
361
- if (value instanceof Date) {
362
- return "".concat(encodeURIComponent(fullKey), "=").concat(encodeURIComponent(value.toISOString()));
363
- }
364
348
  if (value instanceof Object) {
365
- return querystring(value, fullKey);
349
+ return querystring(value);
366
350
  }
367
- return "".concat(encodeURIComponent(fullKey), "=").concat(encodeURIComponent(String(value)));
351
+ return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(String(value)));
368
352
  }
369
353
  var JSONApiResponse = /*#__PURE__*/function () {
370
354
  function JSONApiResponse(raw) {
@@ -686,6 +670,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
686
670
  if (params.large !== undefined) {
687
671
  query["large"] = params.large;
688
672
  }
673
+ if (params.transformationParams !== undefined) {
674
+ query["transformationParams"] = params.transformationParams;
675
+ }
689
676
  if (params.version !== undefined) {
690
677
  query["version"] = params.version;
691
678
  }
@@ -717,6 +704,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
717
704
  try {
718
705
  var _this16 = this;
719
706
  var query = {};
707
+ if (params.transformationParams !== undefined) {
708
+ query["transformationParams"] = params.transformationParams;
709
+ }
720
710
  var headers = {};
721
711
  headers["Content-Type"] = "application/json";
722
712
  return FileApi_await(_this16.request({
@@ -1377,17 +1367,21 @@ var UrlBuilder = /*#__PURE__*/function () {
1377
1367
  /**
1378
1368
  * Builds a URL to either a raw file or a transformed file.
1379
1369
  *
1380
- * Example 1) Raw file:
1370
+ * Example 1) Getting a publicly-accessible raw file URL:
1381
1371
  *
1382
1372
  * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg" })
1383
1373
  *
1384
- * Example 2) Image resized to 500x500:
1374
+ * Example 2) Getting a publicly-accessible image URL, resized to 500x500:
1375
+ *
1376
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", options: { transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } } } })
1377
+ *
1378
+ * Example 3) Getting a privately-accessible image URL, resized to 500x500 (requires 'AuthManager.beginAuthSession' to be called before accessing the URL):
1385
1379
  *
1386
- * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } } })
1380
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", options: { transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } }, auth: true } })
1387
1381
  *
1388
- * Example 3) Image resized to 500x500, which is privately accessible (i.e. requires 'AuthManager.beginAuthSession' before it can be accessed):
1382
+ * Example 4) Getting a publicly-accessible image URL, resized using a transformation preset called "thumbnail" that was created manually in the Bytescale Dashboard:
1389
1383
  *
1390
- * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } }, auth: true })
1384
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", options: { transformation: { type: "preset", preset: "thumbnail" } } })
1391
1385
  */
1392
1386
  UrlBuilder_createClass(UrlBuilder, [{
1393
1387
  key: "url",
@@ -325,33 +325,17 @@ var BytescaleApiError = /*#__PURE__*/function (_Error2) {
325
325
  return runtime_createClass(BytescaleApiError);
326
326
  }( /*#__PURE__*/_wrapNativeSuper(Error));
327
327
  function querystring(params) {
328
- var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
329
328
  return Object.keys(params).map(function (key) {
330
- return querystringSingleKey(key, params[key], prefix);
329
+ return querystringSingleKey(key, params[key]);
331
330
  }).filter(function (part) {
332
331
  return part.length > 0;
333
332
  }).join("&");
334
333
  }
335
334
  function querystringSingleKey(key, value) {
336
- var keyPrefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
337
- var fullKey = keyPrefix + (keyPrefix.length ? "[".concat(key, "]") : key);
338
- if (value instanceof Array) {
339
- var multiValue = value.map(function (singleValue) {
340
- return encodeURIComponent(String(singleValue));
341
- }).join("&".concat(encodeURIComponent(fullKey), "="));
342
- return "".concat(encodeURIComponent(fullKey), "=").concat(multiValue);
343
- }
344
- if (value instanceof Set) {
345
- var valueAsArray = Array.from(value);
346
- return querystringSingleKey(key, valueAsArray, keyPrefix);
347
- }
348
- if (value instanceof Date) {
349
- return "".concat(encodeURIComponent(fullKey), "=").concat(encodeURIComponent(value.toISOString()));
350
- }
351
335
  if (value instanceof Object) {
352
- return querystring(value, fullKey);
336
+ return querystring(value);
353
337
  }
354
- return "".concat(encodeURIComponent(fullKey), "=").concat(encodeURIComponent(String(value)));
338
+ return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(String(value)));
355
339
  }
356
340
  var JSONApiResponse = /*#__PURE__*/function () {
357
341
  function JSONApiResponse(raw) {
@@ -673,6 +657,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
673
657
  if (params.large !== undefined) {
674
658
  query["large"] = params.large;
675
659
  }
660
+ if (params.transformationParams !== undefined) {
661
+ query["transformationParams"] = params.transformationParams;
662
+ }
676
663
  if (params.version !== undefined) {
677
664
  query["version"] = params.version;
678
665
  }
@@ -704,6 +691,9 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
704
691
  try {
705
692
  var _this16 = this;
706
693
  var query = {};
694
+ if (params.transformationParams !== undefined) {
695
+ query["transformationParams"] = params.transformationParams;
696
+ }
707
697
  var headers = {};
708
698
  headers["Content-Type"] = "application/json";
709
699
  return FileApi_await(_this16.request({
@@ -1364,17 +1354,21 @@ var UrlBuilder = /*#__PURE__*/function () {
1364
1354
  /**
1365
1355
  * Builds a URL to either a raw file or a transformed file.
1366
1356
  *
1367
- * Example 1) Raw file:
1357
+ * Example 1) Getting a publicly-accessible raw file URL:
1368
1358
  *
1369
1359
  * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg" })
1370
1360
  *
1371
- * Example 2) Image resized to 500x500:
1361
+ * Example 2) Getting a publicly-accessible image URL, resized to 500x500:
1362
+ *
1363
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", options: { transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } } } })
1364
+ *
1365
+ * Example 3) Getting a privately-accessible image URL, resized to 500x500 (requires 'AuthManager.beginAuthSession' to be called before accessing the URL):
1372
1366
  *
1373
- * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } } })
1367
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", options: { transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } }, auth: true } })
1374
1368
  *
1375
- * Example 3) Image resized to 500x500, which is privately accessible (i.e. requires 'AuthManager.beginAuthSession' before it can be accessed):
1369
+ * Example 4) Getting a publicly-accessible image URL, resized using a transformation preset called "thumbnail" that was created manually in the Bytescale Dashboard:
1376
1370
  *
1377
- * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } }, auth: true })
1371
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", options: { transformation: { type: "preset", preset: "thumbnail" } } })
1378
1372
  */
1379
1373
  UrlBuilder_createClass(UrlBuilder, [{
1380
1374
  key: "url",
@@ -5,17 +5,21 @@ export declare class UrlBuilder {
5
5
  /**
6
6
  * Builds a URL to either a raw file or a transformed file.
7
7
  *
8
- * Example 1) Raw file:
8
+ * Example 1) Getting a publicly-accessible raw file URL:
9
9
  *
10
10
  * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg" })
11
11
  *
12
- * Example 2) Image resized to 500x500:
12
+ * Example 2) Getting a publicly-accessible image URL, resized to 500x500:
13
13
  *
14
- * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } } })
14
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", options: { transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } } } })
15
15
  *
16
- * Example 3) Image resized to 500x500, which is privately accessible (i.e. requires 'AuthManager.beginAuthSession' before it can be accessed):
16
+ * Example 3) Getting a privately-accessible image URL, resized to 500x500 (requires 'AuthManager.beginAuthSession' to be called before accessing the URL):
17
17
  *
18
- * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } }, auth: true })
18
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", options: { transformation: { type: "image", params: { w: 500, h: 500, fit: "crop" } }, auth: true } })
19
+ *
20
+ * Example 4) Getting a publicly-accessible image URL, resized using a transformation preset called "thumbnail" that was created manually in the Bytescale Dashboard:
21
+ *
22
+ * new UrlBuilder().url({ accountId: "1234abc", filePath: "/example.jpg", options: { transformation: { type: "preset", preset: "thumbnail" } } })
19
23
  */
20
24
  url(params: UrlBuilderParams): string;
21
25
  private raw;
@@ -10,7 +10,7 @@
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 } from "../models";
13
+ import type { AsyncResponse, CopyFileBatchRequest, CopyFileRequest, CopyFileResponse, DeleteFileBatchRequest, FileDetails, ProcessFileAndSaveRequest, ProcessFileAndSaveResponse, ProcessFileTransformationParamsParameterValue } from "../models";
14
14
  export interface CopyFileOperationParams {
15
15
  accountId: string;
16
16
  copyFileRequest: CopyFileRequest;
@@ -47,6 +47,9 @@ export interface ProcessFileParams {
47
47
  cachePerm?: ProcessFileCachePermEnum;
48
48
  cacheTtl?: number;
49
49
  large?: boolean;
50
+ transformationParams?: {
51
+ [key: string]: ProcessFileTransformationParamsParameterValue;
52
+ };
50
53
  version?: string;
51
54
  }
52
55
  export interface ProcessFileAndSaveOperationParams {
@@ -54,6 +57,9 @@ export interface ProcessFileAndSaveOperationParams {
54
57
  filePath: string;
55
58
  transformation: string;
56
59
  processFileAndSaveRequest: ProcessFileAndSaveRequest;
60
+ transformationParams?: {
61
+ [key: string]: ProcessFileTransformationParamsParameterValue;
62
+ };
57
63
  }
58
64
  /**
59
65
  *
@@ -1,15 +1,5 @@
1
1
  /**
2
- * "Created" is only used when issuing jobs non-transactionally (which we do if we want the job to be picked up sooner).
3
- * In this case, a two-phase transaction is performed.
4
2
  *
5
- * T=0) "Created" job tracker created.
6
- * T=1) SQS job enqueued.
7
- * T=2) "Pending" is set into job tracker.
8
- * T=3) Response returned to use
9
- * T=4) SQS picks up job. If status is "Created" it fails the job attempt. This keeps going until eventually the job perm-fails, or it sees "Pending". It should typically (always?) see "Pending" on the first attempt, if T=2 succeeded.
10
- * T=5) SQS processes the job as normal.
11
- *
12
- * As such, the "Created" state is an internal detail, and we never expose jobs in this state to the user.
13
3
  * @export
14
4
  */
15
5
  export declare type AccountJobStatus = "Created" | "Pending" | "Running" | "Rollback" | "Failed" | "Succeeded" | "Cancelling" | "Cancelled";
@@ -730,66 +720,11 @@ export interface FileDownloadGrants {
730
720
  downloadFile: Array<string>;
731
721
  }
732
722
  /**
723
+ * @type FilePathDefinition
733
724
  * The path to upload the file to.
734
725
  * @export
735
- * @interface FilePathDefinition
736
726
  */
737
- export interface FilePathDefinition {
738
- /**
739
- * The file name to upload the file with.
740
- *
741
- * Must not contain `/`.
742
- *
743
- * Supports path variables.
744
- * @type {string}
745
- * @memberof FilePathDefinition
746
- */
747
- fileName?: string;
748
- /**
749
- * The file name to upload the file with.
750
- *
751
- * Must not contain `/`.
752
- *
753
- * Supports path variables.
754
- * @type {string}
755
- * @memberof FilePathDefinition
756
- */
757
- fileNameFallback?: string;
758
- /**
759
- * If `true` then path variables like `{UTC_DATE}` in the `fileName` will be replaced. You can escape `{` characters with a `\`.
760
- *
761
- * If `false` then path variables like `{UTC_DATE}` in the `fileName` will be taken literally.
762
- *
763
- * Default: true
764
- * @type {boolean}
765
- * @memberof FilePathDefinition
766
- */
767
- fileNameVariablesEnabled?: boolean;
768
- /**
769
- * Absolute or relative path to a folder in your Bytescale account's storage.
770
- *
771
- * Relative paths are relative to the API key's default folder (configured per API key in the Bytescale Dashboard).
772
- *
773
- * Should not end with `/`.
774
- *
775
- * Does not support path traversals (e.g. `..`).
776
- *
777
- * Supports path variables.
778
- * @type {string}
779
- * @memberof FilePathDefinition
780
- */
781
- folderPath?: string;
782
- /**
783
- * If `true` then path variables like `{UTC_DATE}` in the `folderPath` will be replaced. You can escape `{` characters with a `\`.
784
- *
785
- * If `false` then path variables like `{UTC_DATE}` in the `folderPath` will be taken literally.
786
- *
787
- * Default: true
788
- * @type {boolean}
789
- * @memberof FilePathDefinition
790
- */
791
- folderPathVariablesEnabled?: boolean;
792
- }
727
+ export declare type FilePathDefinition = DynamicFilePath | string;
793
728
  /**
794
729
  * Summary information about a file (a subset of the FileDetails type).
795
730
  * @export
@@ -1290,64 +1225,11 @@ export interface ListRecentJobsResponse {
1290
1225
  */
1291
1226
  export declare type MultipartUploadProtocol = "1.0" | "1.1";
1292
1227
  /**
1228
+ * @type ObjectSummary
1293
1229
  * Summary information about a file or folder.
1294
1230
  * @export
1295
- * @interface ObjectSummary
1296
1231
  */
1297
- export interface ObjectSummary {
1298
- /**
1299
- * Absolute path to a folder. Begins with a `/`. Should not end with a `/`.
1300
- * @type {string}
1301
- * @memberof ObjectSummary
1302
- */
1303
- folderPath: string;
1304
- /**
1305
- *
1306
- * @type {FolderSettingsStorageLayerSummary}
1307
- * @memberof ObjectSummary
1308
- */
1309
- settings: FolderSettingsStorageLayerSummary;
1310
- /**
1311
- *
1312
- * @type {string}
1313
- * @memberof ObjectSummary
1314
- */
1315
- type: ObjectSummaryTypeEnum;
1316
- /**
1317
- *
1318
- * @type {boolean}
1319
- * @memberof ObjectSummary
1320
- */
1321
- virtual: boolean;
1322
- /**
1323
- * Absolute path to a file. Begins with a `/`.
1324
- * @type {string}
1325
- * @memberof ObjectSummary
1326
- */
1327
- filePath: string;
1328
- /**
1329
- * URL for a raw file hosted on the Bytescale CDN.
1330
- * @type {string}
1331
- * @memberof ObjectSummary
1332
- */
1333
- fileUrl: string;
1334
- /**
1335
- * Epoch milliseconds (since midnight 1 January 1970, UTC).
1336
- * @type {number}
1337
- * @memberof ObjectSummary
1338
- */
1339
- lastModified: number;
1340
- /**
1341
- * Size in bytes.
1342
- * @type {number}
1343
- * @memberof ObjectSummary
1344
- */
1345
- size: number;
1346
- }
1347
- /**
1348
- * @export
1349
- */
1350
- export declare type ObjectSummaryTypeEnum = "File";
1232
+ export declare type ObjectSummary = FileSummary | FolderSummary;
1351
1233
  /**
1352
1234
  * Specifies the folder settings to use when creating or updating a folder.
1353
1235
  * @export
@@ -1636,11 +1518,110 @@ export interface ProcessFileAndSaveRequest {
1636
1518
  tags?: CopyableFileDataFileTagNameArray;
1637
1519
  }
1638
1520
  /**
1521
+ * @type ProcessFileAndSaveResponse
1639
1522
  * Response body for ProcessFileAndSave.
1640
1523
  * @export
1641
- * @interface ProcessFileAndSaveResponse
1642
1524
  */
1643
- export interface ProcessFileAndSaveResponse {
1525
+ export declare type ProcessFileAndSaveResponse = ProcessFileAndSaveResponseAsync | ProcessFileAndSaveResponseSync;
1526
+ /**
1527
+ * Response body for ProcessFileAndSave operations where the File Processing API operation is an asynchronous operation (e.g. a video transcoding job).
1528
+ * @export
1529
+ * @interface ProcessFileAndSaveResponseAsync
1530
+ */
1531
+ export interface ProcessFileAndSaveResponseAsync {
1532
+ /**
1533
+ * Link to the documentation that describes how to get a job's status from its job ID.
1534
+ * @type {string}
1535
+ * @memberof ProcessFileAndSaveResponseAsync
1536
+ */
1537
+ jobDocs: ProcessFileAndSaveResponseAsyncJobDocsEnum;
1538
+ /**
1539
+ * Job ID.
1540
+ * @type {string}
1541
+ * @memberof ProcessFileAndSaveResponseAsync
1542
+ */
1543
+ jobId: string;
1544
+ /**
1545
+ *
1546
+ * @type {AccountJobType}
1547
+ * @memberof ProcessFileAndSaveResponseAsync
1548
+ */
1549
+ jobType: AccountJobType;
1550
+ /**
1551
+ * URL for the job's status.
1552
+ *
1553
+ * You can `GET` this URL to retrieve the job's status.
1554
+ *
1555
+ * You must authorize your `GET` request with a ```secret_*``` API key when accessing the URL.
1556
+ * @type {string}
1557
+ * @memberof ProcessFileAndSaveResponseAsync
1558
+ */
1559
+ jobUrl: string;
1560
+ /**
1561
+ * Your account ID.
1562
+ *
1563
+ * This is visible on the settings page:
1564
+ *
1565
+ * https://www.bytescale.com/dashboard/settings
1566
+ * @type {string}
1567
+ * @memberof ProcessFileAndSaveResponseAsync
1568
+ */
1569
+ accountId: string;
1570
+ /**
1571
+ * Epoch milliseconds (since midnight 1 January 1970, UTC).
1572
+ * @type {number}
1573
+ * @memberof ProcessFileAndSaveResponseAsync
1574
+ */
1575
+ created: number;
1576
+ /**
1577
+ *
1578
+ * @type {JobSummaryError}
1579
+ * @memberof ProcessFileAndSaveResponseAsync
1580
+ */
1581
+ error: JobSummaryError | null;
1582
+ /**
1583
+ * Epoch milliseconds (since midnight 1 January 1970, UTC).
1584
+ * @type {number}
1585
+ * @memberof ProcessFileAndSaveResponseAsync
1586
+ */
1587
+ lastUpdated: number;
1588
+ /**
1589
+ *
1590
+ * @type {AccountJobStatus}
1591
+ * @memberof ProcessFileAndSaveResponseAsync
1592
+ */
1593
+ status: AccountJobStatus;
1594
+ /**
1595
+ * An arbitrary JSON object.
1596
+ * @type {{ [key: string]: any; }}
1597
+ * @memberof ProcessFileAndSaveResponseAsync
1598
+ */
1599
+ summary: {
1600
+ [key: string]: any;
1601
+ };
1602
+ /**
1603
+ * True for asynchronous file processing operations (e.g. video transcoding).
1604
+ *
1605
+ * For asynchronous operations, the response body will contain information about the background job that's processing the file, which can then be polled via the GetJob operation.
1606
+ * @type {boolean}
1607
+ * @memberof ProcessFileAndSaveResponseAsync
1608
+ */
1609
+ async: ProcessFileAndSaveResponseAsyncAsyncEnum;
1610
+ }
1611
+ /**
1612
+ * @export
1613
+ */
1614
+ export declare type ProcessFileAndSaveResponseAsyncJobDocsEnum = "https://www.bytescale.com/docs/job-api/GetJob";
1615
+ /**
1616
+ * @export
1617
+ */
1618
+ export declare type ProcessFileAndSaveResponseAsyncAsyncEnum = true;
1619
+ /**
1620
+ * Response body for ProcessFileAndSave operations where the File Processing API operation is a synchronous operation (e.g. an image processing job).
1621
+ * @export
1622
+ * @interface ProcessFileAndSaveResponseSync
1623
+ */
1624
+ export interface ProcessFileAndSaveResponseSync {
1644
1625
  /**
1645
1626
  * Your account ID.
1646
1627
  *
@@ -1648,36 +1629,52 @@ export interface ProcessFileAndSaveResponse {
1648
1629
  *
1649
1630
  * https://www.bytescale.com/dashboard/settings
1650
1631
  * @type {string}
1651
- * @memberof ProcessFileAndSaveResponse
1632
+ * @memberof ProcessFileAndSaveResponseSync
1652
1633
  */
1653
1634
  accountId: string;
1654
1635
  /**
1655
- * The `filePath` of the transformed file.
1636
+ * False for synchronous file processing operations (e.g. image processing).
1656
1637
  *
1657
- * Transformations that produce multiple files — like the Archive Processing API running in `extract` mode — save files under this path. The `basePath` itself references a "summary file" that contains relative links to the other files produced by the transformation.
1638
+ * For synchronous operations, the response body will contain links to the transformed file.
1639
+ * @type {boolean}
1640
+ * @memberof ProcessFileAndSaveResponseSync
1641
+ */
1642
+ async: ProcessFileAndSaveResponseSyncAsyncEnum;
1643
+ /**
1644
+ * The `filePath` of the transformed file.
1658
1645
  *
1659
- * Asynchronous transformations — like the Video Processing API save a "summary file" to the `basePath` immediately. The file contains a summary of the work being performed and its current status. The file is updated periodically until the transformation completes.
1646
+ * If the transformation outputs multiple artifacts, then each artifact's path will be a child of this path.
1660
1647
  * @type {string}
1661
- * @memberof ProcessFileAndSaveResponse
1648
+ * @memberof ProcessFileAndSaveResponseSync
1662
1649
  */
1663
- basePath: string;
1650
+ filePath: string;
1664
1651
  /**
1665
1652
  * URL for an http(s) resource.
1666
1653
  * @type {string}
1667
- * @memberof ProcessFileAndSaveResponse
1654
+ * @memberof ProcessFileAndSaveResponseSync
1668
1655
  */
1669
- baseUrl: string;
1656
+ fileUrl: string;
1670
1657
  /**
1671
1658
  * JSON response returned by certain transformation APIs.
1672
1659
  *
1673
1660
  * Structure varies between transformation APIs (please consult the documentation of the individual transformation APIs).
1674
1661
  * @type {{ [key: string]: any; }}
1675
- * @memberof ProcessFileAndSaveResponse
1662
+ * @memberof ProcessFileAndSaveResponseSync
1676
1663
  */
1677
1664
  summary?: {
1678
1665
  [key: string]: any;
1679
1666
  };
1680
1667
  }
1668
+ /**
1669
+ * @export
1670
+ */
1671
+ export declare type ProcessFileAndSaveResponseSyncAsyncEnum = false;
1672
+ /**
1673
+ * @type ProcessFileTransformationParamsParameterValue
1674
+ *
1675
+ * @export
1676
+ */
1677
+ export declare type ProcessFileTransformationParamsParameterValue = boolean | number | string;
1681
1678
  /**
1682
1679
  * Permissions applied to anonymous users who attempt to download files from a folder.
1683
1680
  *
@@ -2026,222 +2023,27 @@ export interface SpecifiedFieldValueStorageLayerUpdateOrNullValue {
2026
2023
  */
2027
2024
  export declare type SpecifiedFieldValueStorageLayerUpdateOrNullValueTypeEnum = "GoogleStorage";
2028
2025
  /**
2026
+ * @type StorageLayerSummary
2029
2027
  * Storage layer summary information, describing an existing folder's storage layer.
2030
2028
  *
2031
2029
  * This data type does not contain credentials.
2032
- * @export
2033
- * @interface StorageLayerSummary
2034
- */
2035
- export interface StorageLayerSummary {
2036
- /**
2037
- * The type of this storage layer.
2038
- * @type {string}
2039
- * @memberof StorageLayerSummary
2040
- */
2041
- type: StorageLayerSummaryTypeEnum;
2042
- /**
2043
- * Base URL to proxy requests to. Should contain a trailing `/`.
2044
- *
2045
- * If `baseUrl` is set to `null`, then this folder will behave as an open reverse proxy.
2046
- *
2047
- * *Example 1:* if the `baseUrl` is `null` and the folder you're configuring the storage layer on is:
2048
- *
2049
- * `https://upcdn.io/abc1234/raw/demo`
2050
- *
2051
- * Then you can issue requests such as:
2052
- *
2053
- * `https://upcdn.io/abc1234/raw/demo/https://images.unsplash.com/example.jpg`
2054
- *
2055
- * *Example 2:* if the `baseUrl` is:
2056
- *
2057
- * `https://images.unsplash.com/`
2058
- *
2059
- * And the folder you're configuring the storage layer on is:
2060
- *
2061
- * `https://upcdn.io/abc1234/raw/demo`
2062
- *
2063
- * Then you can issue requests such as:
2064
- *
2065
- * `https://upcdn.io/abc1234/raw/demo/test/example.jpg`
2066
- *
2067
- * Which will be routed to the URL:
2068
- *
2069
- * `https://images.unsplash.com/test/example.jpg`
2070
- * @type {string}
2071
- * @memberof StorageLayerSummary
2072
- */
2073
- baseUrl: string | null;
2074
- /**
2075
- *
2076
- * @type {PickGoogleStorageExcludeKeyofGoogleStorageCredentialsBucket}
2077
- * @memberof StorageLayerSummary
2078
- */
2079
- bucket: PickGoogleStorageExcludeKeyofGoogleStorageCredentialsBucket;
2080
- /**
2081
- * If `true` then writes Google Storage objects with full `filePath` as key, prefixed with the `objectKeyPrefix`.
2082
- *
2083
- * If `false` then writes Google Storage objects using a relative `filePath` in relation to folder's path, prefixed with the `objectKeyPrefix`.
2084
- * @type {boolean}
2085
- * @memberof StorageLayerSummary
2086
- */
2087
- useAbsolutePaths: boolean;
2088
- /**
2089
- * Enables S3 transfer acceleration, providing improved file upload speeds for larger files.
2090
- *
2091
- * Note: this setting must also be enabled on the S3 bucket.
2092
- * @type {boolean}
2093
- * @memberof StorageLayerSummary
2094
- */
2095
- useTransferAcceleration: boolean;
2096
- /**
2097
- * Cloudflare Account ID.
2098
- * @type {string}
2099
- * @memberof StorageLayerSummary
2100
- */
2101
- cloudflareAccountId: string;
2102
- }
2103
- /**
2104
2030
  * @export
2105
2031
  */
2106
- export declare type StorageLayerSummaryTypeEnum = "GoogleStorage";
2032
+ export declare type StorageLayerSummary = InternalStorageV1 | InternalStorageV2 | PickDigitalOceanStorageExcludeKeyofDigitalOceanStorageCredentials | PickGoogleStorageExcludeKeyofGoogleStorageCredentials | PickR2StorageExcludeKeyofR2StorageCredentials | PickS3StorageExcludeKeyofS3StorageCredentials | WebStorage;
2107
2033
  /**
2034
+ * @type StorageLayerUpdate
2108
2035
  * Data type used to update or create a folder's storage layer.
2109
2036
  *
2110
2037
  * This data type may contain credentials.
2111
- * @export
2112
- * @interface StorageLayerUpdate
2113
- */
2114
- export interface StorageLayerUpdate {
2115
- /**
2116
- * The type of this storage layer.
2117
- * @type {string}
2118
- * @memberof StorageLayerUpdate
2119
- */
2120
- type: StorageLayerUpdateTypeEnum;
2121
- /**
2122
- * Base URL to proxy requests to. Should contain a trailing `/`.
2123
- *
2124
- * If `baseUrl` is set to `null`, then this folder will behave as an open reverse proxy.
2125
- *
2126
- * *Example 1:* if the `baseUrl` is `null` and the folder you're configuring the storage layer on is:
2127
- *
2128
- * `https://upcdn.io/abc1234/raw/demo`
2129
- *
2130
- * Then you can issue requests such as:
2131
- *
2132
- * `https://upcdn.io/abc1234/raw/demo/https://images.unsplash.com/example.jpg`
2133
- *
2134
- * *Example 2:* if the `baseUrl` is:
2135
- *
2136
- * `https://images.unsplash.com/`
2137
- *
2138
- * And the folder you're configuring the storage layer on is:
2139
- *
2140
- * `https://upcdn.io/abc1234/raw/demo`
2141
- *
2142
- * Then you can issue requests such as:
2143
- *
2144
- * `https://upcdn.io/abc1234/raw/demo/test/example.jpg`
2145
- *
2146
- * Which will be routed to the URL:
2147
- *
2148
- * `https://images.unsplash.com/test/example.jpg`
2149
- * @type {string}
2150
- * @memberof StorageLayerUpdate
2151
- */
2152
- baseUrl: string | null;
2153
- /**
2154
- *
2155
- * @type {PickGoogleStorageExcludeKeyofGoogleStorageCredentialsBucket}
2156
- * @memberof StorageLayerUpdate
2157
- */
2158
- bucket: PickGoogleStorageExcludeKeyofGoogleStorageCredentialsBucket;
2159
- /**
2160
- *
2161
- * @type {GoogleStorageCredentials}
2162
- * @memberof StorageLayerUpdate
2163
- */
2164
- credentials: GoogleStorageCredentials;
2165
- /**
2166
- * If `true` then writes Google Storage objects with full `filePath` as key, prefixed with the `objectKeyPrefix`.
2167
- *
2168
- * If `false` then writes Google Storage objects using a relative `filePath` in relation to folder's path, prefixed with the `objectKeyPrefix`.
2169
- * @type {boolean}
2170
- * @memberof StorageLayerUpdate
2171
- */
2172
- useAbsolutePaths: boolean;
2173
- /**
2174
- * Enables S3 transfer acceleration, providing improved file upload speeds for larger files.
2175
- *
2176
- * Note: this setting must also be enabled on the S3 bucket.
2177
- * @type {boolean}
2178
- * @memberof StorageLayerUpdate
2179
- */
2180
- useTransferAcceleration: boolean;
2181
- /**
2182
- * Cloudflare Account ID.
2183
- * @type {string}
2184
- * @memberof StorageLayerUpdate
2185
- */
2186
- cloudflareAccountId: string;
2187
- }
2188
- /**
2189
2038
  * @export
2190
2039
  */
2191
- export declare type StorageLayerUpdateTypeEnum = "GoogleStorage";
2040
+ export declare type StorageLayerUpdate = DigitalOceanStorage | GoogleStorage | InternalStorageV2 | R2Storage | S3Storage | WebStorage;
2192
2041
  /**
2042
+ * @type TagCondition
2193
2043
  * Expresses a condition that matches files by their tags.
2194
- * @export
2195
- * @interface TagCondition
2196
- */
2197
- export interface TagCondition {
2198
- /**
2199
- *
2200
- * @type {TagCondition}
2201
- * @memberof TagCondition
2202
- */
2203
- left: TagCondition;
2204
- /**
2205
- *
2206
- * @type {TagCondition}
2207
- * @memberof TagCondition
2208
- */
2209
- right: TagCondition;
2210
- /**
2211
- *
2212
- * @type {string}
2213
- * @memberof TagCondition
2214
- */
2215
- type: TagConditionTypeEnum;
2216
- /**
2217
- * File tag scope, e.g. for a transformation definition, a CDN download access token, or an API key's tag whitelist.
2218
- * @type {string}
2219
- * @memberof TagCondition
2220
- */
2221
- equals: string;
2222
- /**
2223
- *
2224
- * @type {TagCondition}
2225
- * @memberof TagCondition
2226
- */
2227
- condition: TagCondition;
2228
- /**
2229
- *
2230
- * @type {Array<string>}
2231
- * @memberof TagCondition
2232
- */
2233
- any: Array<string>;
2234
- /**
2235
- *
2236
- * @type {Array<string>}
2237
- * @memberof TagCondition
2238
- */
2239
- all: Array<string>;
2240
- }
2241
- /**
2242
2044
  * @export
2243
2045
  */
2244
- export declare type TagConditionTypeEnum = "All";
2046
+ export declare type TagCondition = TagConditionAll | TagConditionAnd | TagConditionAny | TagConditionEquals | TagConditionNot | TagConditionOr;
2245
2047
  /**
2246
2048
  *
2247
2049
  * @export
@@ -2410,74 +2212,23 @@ export interface UnspecifiedFieldValue {
2410
2212
  */
2411
2213
  export declare type UnspecifiedFieldValueSetEnum = false;
2412
2214
  /**
2215
+ * @type UpdatableFieldFolderDescriptionOrNull
2413
2216
  *
2414
2217
  * @export
2415
- * @interface UpdatableFieldFolderDescriptionOrNull
2416
2218
  */
2417
- export interface UpdatableFieldFolderDescriptionOrNull {
2418
- /**
2419
- * This field is always `true`.
2420
- * @type {boolean}
2421
- * @memberof UpdatableFieldFolderDescriptionOrNull
2422
- */
2423
- set: UpdatableFieldFolderDescriptionOrNullSetEnum;
2424
- /**
2425
- * The value to set into the field.
2426
- * @type {string}
2427
- * @memberof UpdatableFieldFolderDescriptionOrNull
2428
- */
2429
- value: string | null;
2430
- }
2431
- /**
2432
- * @export
2433
- */
2434
- export declare type UpdatableFieldFolderDescriptionOrNullSetEnum = true;
2219
+ export declare type UpdatableFieldFolderDescriptionOrNull = SpecifiedFieldValueFolderDescriptionOrNull | UnspecifiedFieldValue;
2435
2220
  /**
2221
+ * @type UpdatableFieldPublicPermissionsArrayOrNull
2436
2222
  *
2437
2223
  * @export
2438
- * @interface UpdatableFieldPublicPermissionsArrayOrNull
2439
2224
  */
2440
- export interface UpdatableFieldPublicPermissionsArrayOrNull {
2441
- /**
2442
- * This field is always `true`.
2443
- * @type {boolean}
2444
- * @memberof UpdatableFieldPublicPermissionsArrayOrNull
2445
- */
2446
- set: UpdatableFieldPublicPermissionsArrayOrNullSetEnum;
2447
- /**
2448
- * The value to set into the field.
2449
- * @type {Array<PublicPermissions>}
2450
- * @memberof UpdatableFieldPublicPermissionsArrayOrNull
2451
- */
2452
- value: Array<PublicPermissions> | null;
2453
- }
2454
- /**
2455
- * @export
2456
- */
2457
- export declare type UpdatableFieldPublicPermissionsArrayOrNullSetEnum = true;
2225
+ export declare type UpdatableFieldPublicPermissionsArrayOrNull = SpecifiedFieldValuePublicPermissionsArrayOrNull | UnspecifiedFieldValue;
2458
2226
  /**
2227
+ * @type UpdatableFieldStorageLayerUpdateOrNull
2459
2228
  *
2460
- * @export
2461
- * @interface UpdatableFieldStorageLayerUpdateOrNull
2462
- */
2463
- export interface UpdatableFieldStorageLayerUpdateOrNull {
2464
- /**
2465
- * This field is always `true`.
2466
- * @type {boolean}
2467
- * @memberof UpdatableFieldStorageLayerUpdateOrNull
2468
- */
2469
- set: UpdatableFieldStorageLayerUpdateOrNullSetEnum;
2470
- /**
2471
- *
2472
- * @type {SpecifiedFieldValueStorageLayerUpdateOrNullValue}
2473
- * @memberof UpdatableFieldStorageLayerUpdateOrNull
2474
- */
2475
- value: SpecifiedFieldValueStorageLayerUpdateOrNullValue | null;
2476
- }
2477
- /**
2478
2229
  * @export
2479
2230
  */
2480
- export declare type UpdatableFieldStorageLayerUpdateOrNullSetEnum = true;
2231
+ export declare type UpdatableFieldStorageLayerUpdateOrNull = SpecifiedFieldValueStorageLayerUpdateOrNull | UnspecifiedFieldValue;
2481
2232
  /**
2482
2233
  * Request body for UploadFromUrl.
2483
2234
  * @export
@@ -79,7 +79,7 @@ export declare type HTTPHeaders = {
79
79
  [key: string]: string;
80
80
  };
81
81
  export declare type HTTPQuery = {
82
- [key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery;
82
+ [key: string]: string | number | null | boolean | HTTPQuery;
83
83
  };
84
84
  export declare type HTTPBody = Json | FormData | URLSearchParams;
85
85
  export declare type HTTPRequestInit = {
@@ -98,7 +98,7 @@ export interface RequestOpts {
98
98
  query?: HTTPQuery;
99
99
  body?: HTTPBody;
100
100
  }
101
- export declare function querystring(params: HTTPQuery, prefix?: string): string;
101
+ export declare function querystring(params: HTTPQuery): string;
102
102
  export interface ApiResponse<T> {
103
103
  raw: Response;
104
104
  value(): Promise<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytescale/sdk",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "Bytescale JavaScript SDK",
5
5
  "author": "Bytescale <hello@bytescale.com> (https://www.bytescale.com)",
6
6
  "license": "MIT",