@bytescale/sdk 3.34.0 → 3.35.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.
Files changed (26) hide show
  1. package/dist/browser/cjs/main.js +511 -448
  2. package/dist/browser/esm/main.mjs +513 -449
  3. package/dist/node/cjs/main.js +488 -431
  4. package/dist/node/esm/main.mjs +500 -438
  5. package/dist/types/private/StreamUtils.d.ts +2 -0
  6. package/dist/types/private/UploadManagerBase.d.ts +3 -2
  7. package/dist/types/private/UploadManagerBrowserWorkerBase.d.ts +1 -1
  8. package/dist/types/private/dtos/AuthSwConfigDto.d.ts +1 -1
  9. package/dist/types/private/model/AddCancellationHandler.d.ts +1 -1
  10. package/dist/types/private/model/OnPartProgress.d.ts +1 -1
  11. package/dist/types/private/model/ServiceWorkerConfig.d.ts +1 -1
  12. package/dist/types/private/model/UploadResult.d.ts +7 -0
  13. package/dist/types/private/model/UploadSourceProcessed.d.ts +4 -4
  14. package/dist/types/public/node/UploadManagerNode.d.ts +1 -1
  15. package/dist/types/public/shared/CommonTypes.d.ts +2 -1
  16. package/dist/types/public/shared/UrlBuilderTypes.d.ts +6 -6
  17. package/dist/types/public/shared/generated/apis/CacheApi.d.ts +23 -0
  18. package/dist/types/public/shared/generated/apis/FileApi.d.ts +7 -7
  19. package/dist/types/public/shared/generated/apis/JobApi.d.ts +1 -1
  20. package/dist/types/public/shared/generated/apis/UploadApi.d.ts +2 -2
  21. package/dist/types/public/shared/generated/apis/index.d.ts +1 -0
  22. package/dist/types/public/shared/generated/models/index.d.ts +139 -43
  23. package/dist/types/public/shared/generated/runtime.d.ts +8 -8
  24. package/dist/worker/cjs/main.js +455 -395
  25. package/dist/worker/esm/main.mjs +457 -396
  26. package/package.json +11 -12
@@ -1,4 +1,6 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
2
4
  import type * as stream from "stream";
3
5
  export declare class StreamUtils {
4
6
  static create(): stream.Readable;
@@ -1,9 +1,10 @@
1
- import { BytescaleApiClientConfig, FileDetails, UploadPart } from "../public/shared/generated";
1
+ import { BytescaleApiClientConfig, UploadPart } from "../public/shared/generated";
2
2
  import { UploadManagerInterface } from "./model/UploadManagerInterface";
3
3
  import { PreUploadInfo } from "./model/PreUploadInfo";
4
4
  import { UploadSourceBlob } from "./model/UploadSourceProcessed";
5
5
  import { PutUploadPartResult } from "./model/PutUploadPartResult";
6
6
  import { AddCancellationHandler } from "./model/AddCancellationHandler";
7
+ import { UploadResult } from "./model/UploadResult";
7
8
  import { UploadManagerParams, UploadSource } from "../public/shared/CommonTypes";
8
9
  /**
9
10
  * Methods common to UploadManagerNode and UploadManagerBrowser.
@@ -16,7 +17,7 @@ export declare abstract class UploadManagerBase<TSource, TInit> implements Uploa
16
17
  private readonly intervalMs;
17
18
  private readonly uploadApi;
18
19
  constructor(config: BytescaleApiClientConfig);
19
- upload(request: UploadManagerParams): Promise<FileDetails>;
20
+ upload(request: UploadManagerParams): Promise<UploadResult>;
20
21
  protected getBlobInfo({ value: { name, size, type } }: UploadSourceBlob): Partial<PreUploadInfo> & {
21
22
  size: number;
22
23
  };
@@ -3,7 +3,7 @@ import { UploadSourceProcessedBrowser, UploadSourceProcessedWorker } from "./mod
3
3
  import { PreUploadInfo } from "./model/PreUploadInfo";
4
4
  import { UploadPart } from "../public/shared/generated";
5
5
  import { UploadManagerParams, UploadSource } from "../public/shared/CommonTypes";
6
- declare type BrowserOrWorkerUploadSource = UploadSourceProcessedBrowser | UploadSourceProcessedWorker;
6
+ type BrowserOrWorkerUploadSource = UploadSourceProcessedBrowser | UploadSourceProcessedWorker;
7
7
  /**
8
8
  * The "browser" and "worker" runtimes support the same input types, but the former uses XHR and the latter uses Fetch.
9
9
  */
@@ -1,2 +1,2 @@
1
1
  import { AuthSwConfigEntryDto } from "./AuthSwConfigEntryDto";
2
- export declare type AuthSwConfigDto = AuthSwConfigEntryDto[];
2
+ export type AuthSwConfigDto = AuthSwConfigEntryDto[];
@@ -1 +1 @@
1
- export declare type AddCancellationHandler = (cancellationHandler: () => void) => void;
1
+ export type AddCancellationHandler = (cancellationHandler: () => void) => void;
@@ -1 +1 @@
1
- export declare type OnPartProgress = (bytesSentTotalForPart: number) => void;
1
+ export type OnPartProgress = (bytesSentTotalForPart: number) => void;
@@ -1,4 +1,4 @@
1
- export declare type ServiceWorkerConfig = ServiceWorkerConfigUninitialized | ServiceWorkerConfigInitialized;
1
+ export type ServiceWorkerConfig = ServiceWorkerConfigUninitialized | ServiceWorkerConfigInitialized;
2
2
  export interface ServiceWorkerConfigUninitialized {
3
3
  serviceWorkerScope: undefined;
4
4
  serviceWorkerScript: string;
@@ -0,0 +1,7 @@
1
+ import { FileDetails } from "../../public/shared/generated";
2
+ export type UploadResult = Omit<FileDetails, "etag"> & {
3
+ /**
4
+ * The file's ETag, short for "entity tag", reflects the file's version and changes whenever the file is modified.
5
+ */
6
+ etag: string;
7
+ };
@@ -17,7 +17,7 @@ export interface UploadSourceStream {
17
17
  type: "Stream";
18
18
  value: NodeChunkedStream;
19
19
  }
20
- export declare type UploadSourceProcessedIsomorphic = UploadSourceBlob | UploadSourceArrayBuffer;
21
- export declare type UploadSourceProcessedBrowser = UploadSourceProcessedIsomorphic;
22
- export declare type UploadSourceProcessedWorker = UploadSourceProcessedIsomorphic;
23
- export declare type UploadSourceProcessedNode = UploadSourceStream | UploadSourceBuffer | UploadSourceProcessedIsomorphic;
20
+ export type UploadSourceProcessedIsomorphic = UploadSourceBlob | UploadSourceArrayBuffer;
21
+ export type UploadSourceProcessedBrowser = UploadSourceProcessedIsomorphic;
22
+ export type UploadSourceProcessedWorker = UploadSourceProcessedIsomorphic;
23
+ export type UploadSourceProcessedNode = UploadSourceStream | UploadSourceBuffer | UploadSourceProcessedIsomorphic;
@@ -5,7 +5,7 @@ import { PreUploadInfo } from "../../private/model/PreUploadInfo";
5
5
  import { UploadPart } from "../shared/generated";
6
6
  import { AddCancellationHandler } from "../../private/model/AddCancellationHandler";
7
7
  import { UploadManagerParams, UploadSource } from "../shared/CommonTypes";
8
- declare type UploadManagerNodeInit = undefined | {
8
+ type UploadManagerNodeInit = undefined | {
9
9
  chunkedStream: NodeChunkedStream;
10
10
  chunkedStreamPromise: Promise<void>;
11
11
  };
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import { BeginMultipartUploadRequest } from "./generated";
3
4
  /**
4
5
  * Workaround for tsc aliases, where we cannot export implementation-less modules in our dists.
@@ -18,7 +19,7 @@ export interface UploadProgress {
18
19
  bytesTotal: number;
19
20
  progress: number;
20
21
  }
21
- export declare type UploadSource = NodeJS.ReadableStream | BlobLike | Buffer | string;
22
+ export type UploadSource = NodeJS.ReadableStream | BlobLike | Buffer | string;
22
23
  export interface UploadManagerParams extends Omit<BeginMultipartUploadRequest, "size" | "protocol"> {
23
24
  cancellationToken?: CancellationToken;
24
25
  data: UploadSource;
@@ -2,8 +2,8 @@
2
2
  * Workaround for tsc aliases, where we cannot export implementation-less modules in our dists.
3
3
  */
4
4
  export declare const UrlBuilderTypesNoOp = false;
5
- export declare type ParameterGroup = Record<string, string | number | boolean | undefined | null>;
6
- export declare type KeyValuePair = [string, string];
5
+ export type ParameterGroup = Record<string, string | number | boolean | undefined | null>;
6
+ export type KeyValuePair = [string, string];
7
7
  export interface UrlBuilderParams {
8
8
  /**
9
9
  * The account that manages the file.
@@ -20,9 +20,9 @@ export interface UrlBuilderParams {
20
20
  */
21
21
  options?: UrlBuilderOptions;
22
22
  }
23
- export declare type UrlBuilderOptions = UrlBuilderOptionsRaw | UrlBuilderTransformationOptions;
24
- export declare type UrlBuilderTransformationOptions = UrlBuilderTransformationApiOptions | UrlBuilderOptionsPreset;
25
- export declare type UrlBuilderTransformationApiOptions = UrlBuilderOptionsImage | UrlBuilderOptionsVideo | UrlBuilderOptionsAudio | UrlBuilderOptionsArchive;
23
+ export type UrlBuilderOptions = UrlBuilderOptionsRaw | UrlBuilderTransformationOptions;
24
+ export type UrlBuilderTransformationOptions = UrlBuilderTransformationApiOptions | UrlBuilderOptionsPreset;
25
+ export type UrlBuilderTransformationApiOptions = UrlBuilderOptionsImage | UrlBuilderOptionsVideo | UrlBuilderOptionsAudio | UrlBuilderOptionsArchive;
26
26
  export interface UrlBuilderOptionsBase extends NonDeprecatedCommonQueryParams, DeprecatedCommonQueryParams {
27
27
  /**
28
28
  * The base URL of the Bytescale CDN. (Excludes trailing "/".)
@@ -131,7 +131,7 @@ export interface UrlBuilderOptionsTransformationApi<T> extends UrlBuilderOptions
131
131
  */
132
132
  transformationParams?: T | T[];
133
133
  }
134
- export declare type UrlBuilderOptionsTransformation = UrlBuilderOptionsTransformationOnly & UrlBuilderOptionsBase;
134
+ export type UrlBuilderOptionsTransformation = UrlBuilderOptionsTransformationOnly & UrlBuilderOptionsBase;
135
135
  export interface UrlBuilderOptionsTransformationOnly {
136
136
  /**
137
137
  * The transformation artifact to download.
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @bytescale/api
3
+ * Bytescale API
4
+ *
5
+ * The version of the OpenAPI document: 2.0.0
6
+ * Contact: hello@bytescale.com
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import * as runtime from "../runtime";
13
+ import type { AsyncResponse, ResetCacheRequest } from "../models";
14
+ export interface ResetCacheOperationParams {
15
+ accountId: string;
16
+ resetCacheRequest: ResetCacheRequest;
17
+ }
18
+ export declare class CacheApi extends runtime.BaseAPI {
19
+ /**
20
+ * Resets the Bytescale CDN cache for a specific path, path prefix, or for your entire account. You can choose to reset the edge cache, or permanent cache, or both caches. *Warning:* Resetting the permanent cache (by setting ```resetPermanentCache: true```) may lead to a significant increase in processing time if numerous file transformations need to be re-performed upon their next request. *Recommended:* Prevent cache resets by adding a ```?v=<etag>``` querystring parameter to your URLs. This ensures your URLs change when your files change, eliminating the need for cache resets. The `etag` field is returned by GetFileDetails and all upload operations. *Example patterns:* - ```\"/_*\"``` - ```\"/raw/example.jpg\"``` - ```\"/image/example.jpg\"``` - ```\"/image/customers/abc/_*\"``` You may only use ```*``` at the end of the pattern. You must not include your account ID prefix in the pattern.
21
+ */
22
+ resetCache(params: ResetCacheOperationParams): Promise<AsyncResponse>;
23
+ }
@@ -63,12 +63,6 @@ export interface ProcessFileParams {
63
63
  * The name of the File Processing API (e.g. `image`, `video`, `audio`) or transformation preset (created in the Bytescale Dashboard) to use when processing the file.
64
64
  */
65
65
  transformation: string;
66
- /**
67
- * Some transformations output multiple files, called artifacts.
68
- *
69
- * You can download each individual transformation artifact by specifying its path with this parameter
70
- */
71
- artifact?: string;
72
66
  /**
73
67
  * Specifies whether to cache the transformed result.
74
68
  *
@@ -79,6 +73,12 @@ export interface ProcessFileParams {
79
73
  * Default: true
80
74
  */
81
75
  cache?: boolean;
76
+ /**
77
+ * Some transformations output multiple files, called artifacts.
78
+ *
79
+ * You can download each individual transformation artifact by specifying its path with this parameter
80
+ */
81
+ artifact?: string;
82
82
  /**
83
83
  * Only serve transformations from the cache; do not perform new transformations on cache miss.
84
84
  *
@@ -197,4 +197,4 @@ export declare class FileApi extends runtime.BaseAPI {
197
197
  /**
198
198
  * @export
199
199
  */
200
- export declare type ProcessFileCachePermEnum = "auto" | "false" | "true";
200
+ export type ProcessFileCachePermEnum = "auto" | "false" | "true";
@@ -35,7 +35,7 @@ export declare class JobApi extends runtime.BaseAPI {
35
35
  */
36
36
  getJob(params: GetJobParams): Promise<JobSummary>;
37
37
  /**
38
- * Lists the most recently issued background jobs. Requires a `secret_*` API key.
38
+ * Lists the 10 most recently created jobs for the specified job type(s). Requires a `secret_*` API key.
39
39
  */
40
40
  listRecentJobs(params: ListRecentJobsParams): Promise<ListRecentJobsResponse>;
41
41
  }
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from "../runtime";
13
- import type { BasicUploadResponse, BeginMultipartUploadRequest, BeginMultipartUploadResponse, CompleteUploadPartRequest, UploadFromUrlRequest, UploadPart, UploadPartList } from "../models";
13
+ import type { BasicUploadResponse, BeginMultipartUploadRequest, BeginMultipartUploadResponse, CompleteMultipartUploadResponse, CompleteUploadPartRequest, UploadFromUrlRequest, UploadPart, UploadPartList } from "../models";
14
14
  export interface BeginMultipartUploadOperationParams {
15
15
  accountId: string;
16
16
  /**
@@ -48,7 +48,7 @@ export declare class UploadApi extends runtime.BaseAPI {
48
48
  /**
49
49
  * Marks an upload part as uploaded. You must call this endpoint after you have successfully issued a `PUT` request to the `uploadUrl` on the corresponding UploadPart.
50
50
  */
51
- completeUploadPart(params: CompleteUploadPartOperationParams): Promise<void>;
51
+ completeUploadPart(params: CompleteUploadPartOperationParams): Promise<CompleteMultipartUploadResponse>;
52
52
  /**
53
53
  * Gets a remaining upload part for a multipart file upload.
54
54
  */
@@ -1,3 +1,4 @@
1
+ export * from "./CacheApi";
1
2
  export * from "./FileApi";
2
3
  export * from "./FolderApi";
3
4
  export * from "./JobApi";