@bytescale/sdk 1.5.0 → 3.0.0-alpha.10

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.
@@ -1,13 +1,30 @@
1
1
  import { AuthSession } from "./model/AuthSession";
2
+ import { Mutex } from "./Mutex";
3
+ /**
4
+ * Maintains a global session state, even across package versions.
5
+ *
6
+ * This is to allow users to start auth sessions via the Bytescale JavaScript SDK, where due to versioning or other
7
+ * bundling issues, the Bytescale Upload Widget has been bundled with a different Bytescale JavaScript SDK. In this
8
+ * scenario, the user wouldn't be able to start an auth session with the Bytescale Upload Widget. Therefore, we use
9
+ * global state (i.e. on the window) to ensure the session state can be shared between the user's instance of the
10
+ * Bytescale JavaScript SDK and the Upload Widget's version of the Bytescale JavaScript SDK.
11
+ *
12
+ * Users also frequently have problems caused by them not keeping track of *Api and *Manager instances correctly, so
13
+ * making this global prevents a lot of common mistakes.
14
+ */
2
15
  export declare class AuthSessionState {
16
+ private static readonly stateKey;
17
+ private static readonly mutexKey;
3
18
  /**
4
- * Intentionally global:
5
- *
6
- * Users frequently have problems caused by them not keeping track of *Api and *Manager instances correctly, so we
7
- * make this global as in 99.9% of cases, this is what users want, and it prevents lots of common mistakes.
8
- *
9
- * We only set this in the browser.
10
- * Never in Node.js.
19
+ * Called in the browser only.
11
20
  */
12
- static session: AuthSession | undefined;
21
+ static getMutex(): Mutex;
22
+ /**
23
+ * Called in the browser only.
24
+ */
25
+ static setSession(session: AuthSession | undefined): void;
26
+ /**
27
+ * Called in the browser and in Node.js (so we check the env before calling env-specific code).
28
+ */
29
+ static getSession(): AuthSession | undefined;
13
30
  }
@@ -7,6 +7,7 @@ export declare class AuthManager extends BaseAPI implements AuthManagerInterface
7
7
  private readonly contentTypeJson;
8
8
  private readonly contentTypeText;
9
9
  private readonly minJwtTtlSeconds;
10
+ private readonly maxJwtTtlSeconds;
10
11
  private readonly retryAuthAfterErrorSeconds;
11
12
  private readonly refreshBeforeExpirySeconds;
12
13
  constructor(config: BytescaleApiClientConfig);
@@ -25,6 +25,7 @@ export declare class UrlBuilder {
25
25
  private raw;
26
26
  private transformation;
27
27
  private getBaseUrl;
28
+ private getCommonTransformationQueryParams;
28
29
  private getCommonQueryParams;
29
30
  private makeQueryParams;
30
31
  private getTransformationParams;
@@ -26,7 +26,10 @@ export interface UrlBuilderParams {
26
26
  */
27
27
  options?: UrlBuilderOptions;
28
28
  }
29
- export interface UrlBuilderOptions {
29
+ export declare type UrlBuilderOptions = UrlBuilderOptionsRaw | UrlBuilderTransformationOptions;
30
+ export declare type UrlBuilderTransformationOptions = UrlBuilderTransformationApiOptions | UrlBuilderOptionsPreset;
31
+ export declare type UrlBuilderTransformationApiOptions = UrlBuilderOptionsImage | UrlBuilderOptionsVideo | UrlBuilderOptionsAudio | UrlBuilderOptionsArchive;
32
+ export interface UrlBuilderOptionsBase {
30
33
  /**
31
34
  * Set to 'true' to download a private file. Requires an active auth session. See AuthManager.beginAuthSession.
32
35
  *
@@ -57,7 +60,6 @@ export interface UrlBuilderOptions {
57
60
  * Default: false
58
61
  */
59
62
  forceDownloadPrompt?: boolean;
60
- transformation?: UrlBuilderParamsTransformation;
61
63
  /**
62
64
  * Downloads the latest version of your file (if you have overwritten it) when added to the URL with a unique value.
63
65
  *
@@ -67,48 +69,55 @@ export interface UrlBuilderOptions {
67
69
  */
68
70
  version?: string;
69
71
  }
70
- export declare type UrlBuilderParamsTransformation = UrlBuilderParamsTransformationPreset | UrlBuilderParamsImageTransformation | UrlBuilderParamsVideoTransformation | UrlBuilderParamsAudioTransformation | UrlBuilderParamsArchiveTransformation;
71
- export interface UrlBuilderParamsTransformationOptions {
72
+ export interface UrlBuilderOptionsRaw extends UrlBuilderOptionsBase {
73
+ transformation?: undefined;
74
+ }
75
+ export interface UrlBuilderOptionsImage extends UrlBuilderOptionsTransformationApi<ParameterGroup> {
72
76
  /**
73
- * The transformation artifact to download.
74
- *
75
- * Some transformations produce multiple files. The 'artifact' parameter is used to select which file to download.
76
- *
77
- * Must begin with: "/"
77
+ * Set to "image" to use Bytescale's Image Processing API:
78
78
  *
79
- * Default: "/"
79
+ * https://www.bytescale.com/docs/image-processing-api
80
80
  */
81
- artifact?: string;
81
+ transformation: "image";
82
+ }
83
+ export interface UrlBuilderOptionsVideo extends UrlBuilderOptionsTransformationApi<ParameterGroup> {
82
84
  /**
83
- * Specifies whether to permanently cache the transformed result in the Bytescale CDN.
84
- *
85
- * Permanently cached files can be deleted via a manual action in the Bytescale Dashboard.
86
- *
87
- * When cache=false this parameter is automatically set to false.
88
- *
89
- * When cachePermanently="auto" the permanent cache will only be used for files that take more than 1000ms to process.
90
- *
91
- * When the permanent cache is used, approximately 200ms of latency is added to the initial request. Thereafter, files will be served from the Bytescale CDN's edge cache or permanent cache, so will have minimal latency.
85
+ * Set to "video" to use Bytescale's Video Processing API:
92
86
  *
93
- * Default: Please refer to your account's default cache settings in the Bytescale Dashboard.
87
+ * https://www.bytescale.com/docs/video-processing-api
94
88
  */
95
- cachePermanently?: "auto" | boolean;
89
+ transformation: "video";
90
+ }
91
+ export interface UrlBuilderOptionsAudio extends UrlBuilderOptionsTransformationApi<ParameterGroup> {
96
92
  /**
97
- * Set to true to return transformed files over 6MB in the initial HTTP response.
93
+ * Set to "audio" to use Bytescale's Audio Processing API:
98
94
  *
99
- * By default, transformations that produce files larger than 6MB require a subsequent HTTP request to return the result: the initial HTTP request will process the file and return a JSON result instructing the requester the transformation has been performed. All subsequent requests will return the transformed file. Enable this flag to ensure the transformed file is always returned in the initial response.
95
+ * https://www.bytescale.com/docs/audio-processing-api
96
+ */
97
+ transformation: "audio";
98
+ }
99
+ export interface UrlBuilderOptionsArchive extends UrlBuilderOptionsTransformationApi<ParameterGroup> {
100
+ /**
101
+ * Set to "archive" to use Bytescale's Archive Processing API:
100
102
  *
101
- * Recommendation: set large=true only if you require transformation results over 6MB. A small amount of latency is incurred on edge cache misses when this flag is enabled. In general, we recommend adjusting your transformation parameters to keep files below this size, instead of enabling this flag.
103
+ * https://www.bytescale.com/docs/archive-processing-api
104
+ */
105
+ transformation: "archive";
106
+ }
107
+ export interface UrlBuilderOptionsPreset extends UrlBuilderOptionsTransformation {
108
+ transformation: "preset";
109
+ /**
110
+ * The name of the transformation preset, as displayed in the Bytescale Dashboard.
102
111
  *
103
- * Default: false
112
+ * To specify transformation parameters on-the-fly, set "transformation" to a File Processing API (e.g. "image", "video", "audio"), and then use the "transformationParams" field to pass parameters to the File Processing API.
104
113
  */
105
- large?: boolean;
114
+ transformationPreset: string;
106
115
  }
107
- export interface UrlBuilderParamsTransformationApiBase<T> {
116
+ export interface UrlBuilderOptionsTransformationApi<T> extends UrlBuilderOptionsTransformation {
108
117
  /**
109
- * Use the "params" field to pass parameters to the File Processing API.
118
+ * Use the "transformationParams" field to pass parameters to the File Processing API.
110
119
  *
111
- * Use the "type" field to specify which File Processing API to use:
120
+ * Use the "transformation" field to specify which File Processing API to use:
112
121
  *
113
122
  * - https://www.bytescale.com/docs/image-processing-api
114
123
  * - https://www.bytescale.com/docs/video-processing-api
@@ -122,52 +131,43 @@ export interface UrlBuilderParamsTransformationApiBase<T> {
122
131
  * Order is sensitive both within and across parameter groups for certain transformation operations, please consult
123
132
  * the documentation for the File Processing API you are using (see links above).
124
133
  */
125
- params?: (T & UrlBuilderParamsTransformationOptions) | Array<T & UrlBuilderParamsTransformationOptions>;
134
+ transformationParams?: T | T[];
126
135
  }
127
- export interface UrlBuilderParamsTransformationPreset {
128
- params?: UrlBuilderParamsTransformationOptions;
136
+ export interface UrlBuilderOptionsTransformation extends UrlBuilderOptionsBase {
129
137
  /**
130
- * The name of the transformation preset, as displayed in the Bytescale Dashboard.
138
+ * The transformation artifact to download.
131
139
  *
132
- * To specify transformation parameters on-the-fly, set "type" to a File Processing API (e.g. "image", "video", "audio"), and then use the "params" field to pass parameters to the File Processing API.
133
- */
134
- preset: string;
135
- /**
136
- * Use a transformation preset that was created in the Bytescale Dashboard.
140
+ * Some transformations produce multiple files. The 'artifact' parameter is used to select which file to download.
137
141
  *
138
- * To specify transformation parameters on-the-fly, set "type" to a File Processing API (e.g. "image", "video", "audio"), and then use the "params" field to pass parameters to the File Processing API.
139
- */
140
- type: "preset";
141
- }
142
- export interface UrlBuilderParamsImageTransformation extends UrlBuilderParamsTransformationApiBase<ParameterGroup> {
143
- /**
144
- * Set to "image" to use Bytescale's Image Processing API:
142
+ * Must begin with: "/"
145
143
  *
146
- * https://www.bytescale.com/docs/image-processing-api
144
+ * Default: "/"
147
145
  */
148
- type: "image";
149
- }
150
- export interface UrlBuilderParamsVideoTransformation extends UrlBuilderParamsTransformationApiBase<ParameterGroup> {
146
+ artifact?: string;
151
147
  /**
152
- * Set to "video" to use Bytescale's Video Processing API:
148
+ * Specifies whether to permanently cache the transformed result in the Bytescale CDN.
153
149
  *
154
- * https://www.bytescale.com/docs/video-processing-api
155
- */
156
- type: "video";
157
- }
158
- export interface UrlBuilderParamsAudioTransformation extends UrlBuilderParamsTransformationApiBase<ParameterGroup> {
159
- /**
160
- * Set to "audio" to use Bytescale's Audio Processing API:
150
+ * Permanently cached files can be deleted via a manual action in the Bytescale Dashboard.
161
151
  *
162
- * https://www.bytescale.com/docs/audio-processing-api
152
+ * When cache=false this parameter is automatically set to false.
153
+ *
154
+ * When cachePermanently="auto" the permanent cache will only be used for files that take more than 1000ms to process.
155
+ *
156
+ * When the permanent cache is used, approximately 200ms of latency is added to the initial request. Thereafter, files will be served from the Bytescale CDN's edge cache or permanent cache, so will have minimal latency.
157
+ *
158
+ * Default: Please refer to your account's default cache settings in the Bytescale Dashboard.
163
159
  */
164
- type: "audio";
165
- }
166
- export interface UrlBuilderParamsArchiveTransformation extends UrlBuilderParamsTransformationApiBase<ParameterGroup> {
160
+ cachePermanently?: "auto" | boolean;
167
161
  /**
168
- * Set to "archive" to use Bytescale's Archive Processing API:
162
+ * Only set this parameter to `true` if you expect the HTTP response body for the transformation request to be over 6MB.
169
163
  *
170
- * https://www.bytescale.com/docs/archive-processing-api
164
+ * We recommend leaving this parameter unset (so it defaults to `false`) and controlling the HTTP response body size via transformation parameters. E.g. for Image Processing API requests, you can shrink the HTTP response body by reducing the output image's dimensions and/or quality.
165
+ *
166
+ * Setting this parameter to `true` will route the request via an alternative CDN path, which allows responses over 6MB, but incurs a ~200ms latency on all CDN edge cache misses for the URL.
167
+ *
168
+ * Setting this parameter to `false` (default) results in faster routing. If a response over 6MB is returned, the initial response will be a JSON error indicating the response was too large to return. All subsequent requests to the same URL will successfully return the transformed file (forever).
169
+ *
170
+ * Default: false
171
171
  */
172
- type: "archive";
172
+ large?: boolean;
173
173
  }
@@ -30,8 +30,25 @@ export interface DeleteFileBatchOperationParams {
30
30
  export interface DownloadFileParams {
31
31
  accountId: string;
32
32
  filePath: string;
33
+ /**
34
+ * Specifies whether to cache the raw file in the Bytescale CDN.
35
+ *
36
+ * Default: true
37
+ */
33
38
  cache?: boolean;
39
+ /**
40
+ * Specifies the maximum amount of time, in seconds, the file will be cached on the user's device and in the Bytescale CDN's edge cache.
41
+ *
42
+ * Default: Please refer to your account's default cache settings in the Bytescale Dashboard.
43
+ */
34
44
  cacheTtl?: number;
45
+ /**
46
+ * Downloads the latest version of your file (if you have overwritten it) when added to the URL with a unique value.
47
+ *
48
+ * The value of the `version` parameter can be anything, e.g. an incremental number, a timestamp, etc.
49
+ *
50
+ * You only need to provide and update this value if/when you overwrite your file.
51
+ */
35
52
  version?: string;
36
53
  }
37
54
  export interface GetFileDetailsParams {
@@ -41,29 +58,113 @@ export interface GetFileDetailsParams {
41
58
  export interface ProcessFileParams {
42
59
  accountId: string;
43
60
  filePath: string;
61
+ /**
62
+ * 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.
63
+ */
44
64
  transformation: string;
65
+ /**
66
+ * Some transformations output multiple files, called artifacts.
67
+ *
68
+ * You can download each individual transformation artifact by specifying its path with this parameter
69
+ */
45
70
  artifact?: string;
71
+ /**
72
+ * Specifies whether to cache the transformed result.
73
+ *
74
+ * If set to `false` the transformation will be executed on every request.
75
+ *
76
+ * *Recommendation:* instead of disabling the cache, a more performant solution is to use the `version` parameter and to increment it each time you require an updated result.
77
+ *
78
+ * Default: true
79
+ */
46
80
  cache?: boolean;
81
+ /**
82
+ * Specifies whether to cache the transformed result in the Bytescale CDN perma-cache.
83
+ *
84
+ * Perma-caching works by storing your file permanently, or until a manual cache purge is performed.
85
+ *
86
+ * When `cache=false` this parameter is automatically set to `false`.
87
+ *
88
+ * When `cache_perm=auto` the perma-cache will only be used for files that take more than 1000ms to process.
89
+ *
90
+ * When the perma-cache is used, approximately 200ms of latency is added to the initial request. Thereafter, files will be served from the Bytescale CDN's edge cache or perma-cache, so will have minimal latency.
91
+ *
92
+ * Default: Please refer to your account's default cache settings in the Bytescale Dashboard.
93
+ */
47
94
  cachePerm?: ProcessFileCachePermEnum;
95
+ /**
96
+ * Specifies the maximum amount of time, in seconds, the transformed result will be cached on the user's device and in the Bytescale CDN's edge cache.
97
+ *
98
+ * If the file is perma-cached, then the file will not be reprocessed on edge cache misses.
99
+ *
100
+ * If the file is not perma-cached, then the file will be reprocessed on edge cache misses.
101
+ *
102
+ * For more information on perma-caching, see: `cache_perm`
103
+ *
104
+ * Default: Please refer to your account's default cache settings in the Bytescale Dashboard.
105
+ */
48
106
  cacheTtl?: number;
107
+ /**
108
+ * Only set this parameter to `true` if you expect the HTTP response body for the transformation request to be over 6MB.
109
+ *
110
+ * We recommend leaving this parameter unset (so it defaults to `false`) and controlling the HTTP response body size via transformation parameters. E.g. for Image Processing API requests, you can shrink the HTTP response body by reducing the output image's dimensions and/or quality.
111
+ *
112
+ * Setting this parameter to `true` will route the request via an alternative CDN path, which allows responses over 6MB, but incurs a ~200ms latency on all CDN edge cache misses for the URL.
113
+ *
114
+ * Setting this parameter to `false` (default) results in faster routing. If a response over 6MB is returned, the initial response will be a JSON error indicating the response was too large to return. All subsequent requests to the same URL will successfully return the transformed file (forever).
115
+ *
116
+ * Default: `false`
117
+ */
49
118
  large?: boolean;
119
+ /**
120
+ * Parameters to submit to the File Processing API (e.g. the Image Processing API).
121
+ *
122
+ * Please see the documentation for each File Processing API to determine which values can appear here:
123
+ *
124
+ * - https://www.bytescale.com/docs/image-processing-api
125
+ * - https://www.bytescale.com/docs/video-processing-api
126
+ * - https://www.bytescale.com/docs/audio-processing-api
127
+ * - https://www.bytescale.com/docs/archive-processing-api
128
+ */
50
129
  transformationParams?: {
51
130
  [key: string]: ProcessFileTransformationParamsParameterValue;
52
131
  };
132
+ /**
133
+ * Add this parameter and increment its value to force the file to be reprocessed.
134
+ *
135
+ * The Bytescale CDN caches files based on the full URL (including the querystring), meaning this parameter is useful when dealing with changes made to transformation presets. By contrast, File Processing APIs (like the Image Processing API) shouldn't ever require this parameter, since the URL/querystring naturally changes each time you adjust a parameter, causing a cache miss and the file to be reprocessed with the new querystring parameters.
136
+ *
137
+ * The value of the `version` parameter can be anything, e.g. an incremental number, a timestamp, etc.
138
+ *
139
+ * You only need to provide and update this value if/when you make changes to a transformation preset's settings.
140
+ */
53
141
  version?: string;
54
142
  }
55
143
  export interface ProcessFileAndSaveOperationParams {
56
144
  accountId: string;
57
145
  filePath: string;
146
+ /**
147
+ * 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.
148
+ */
58
149
  transformation: string;
150
+ /**
151
+ *
152
+ */
59
153
  processFileAndSaveRequest: ProcessFileAndSaveRequest;
154
+ /**
155
+ * Parameters to submit to the File Processing API (e.g. the Image Processing API).
156
+ *
157
+ * Please see the documentation for each File Processing API to determine which values can appear here:
158
+ *
159
+ * - https://www.bytescale.com/docs/image-processing-api
160
+ * - https://www.bytescale.com/docs/video-processing-api
161
+ * - https://www.bytescale.com/docs/audio-processing-api
162
+ * - https://www.bytescale.com/docs/archive-processing-api
163
+ */
60
164
  transformationParams?: {
61
165
  [key: string]: ProcessFileTransformationParamsParameterValue;
62
166
  };
63
167
  }
64
- /**
65
- *
66
- */
67
168
  export declare class FileApi extends runtime.BaseAPI {
68
169
  /**
69
170
  * Copies a file synchronously.
@@ -47,9 +47,6 @@ export interface PutFolderOperationParams {
47
47
  accountId: string;
48
48
  putFolderRequest: PutFolderRequest;
49
49
  }
50
- /**
51
- *
52
- */
53
50
  export declare class FolderApi extends runtime.BaseAPI {
54
51
  /**
55
52
  * Copies a folder asynchronously. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles```, ```includeOverriddenStorage``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
@@ -25,9 +25,6 @@ export interface ListRecentJobsParams {
25
25
  accountId: string;
26
26
  jobType: Array<AccountJobType>;
27
27
  }
28
- /**
29
- *
30
- */
31
28
  export declare class JobApi extends runtime.BaseAPI {
32
29
  /**
33
30
  * Cancels an in-progress background job. Requires a `secret_*` API key.
@@ -13,6 +13,9 @@ import * as runtime from "../runtime";
13
13
  import type { BasicUploadResponse, BeginMultipartUploadRequest, BeginMultipartUploadResponse, CompleteUploadPartRequest, UploadFromUrlRequest, UploadPart, UploadPartList } from "../models";
14
14
  export interface BeginMultipartUploadOperationParams {
15
15
  accountId: string;
16
+ /**
17
+ *
18
+ */
16
19
  beginMultipartUploadRequest: BeginMultipartUploadRequest;
17
20
  }
18
21
  export interface CompleteUploadPartOperationParams {
@@ -32,11 +35,11 @@ export interface ListUploadPartsParams {
32
35
  }
33
36
  export interface UploadFromUrlOperationParams {
34
37
  accountId: string;
38
+ /**
39
+ *
40
+ */
35
41
  uploadFromUrlRequest: UploadFromUrlRequest;
36
42
  }
37
- /**
38
- *
39
- */
40
43
  export declare class UploadApi extends runtime.BaseAPI {
41
44
  /**
42
45
  * Begins a new multipart file upload process.
@@ -1524,7 +1524,7 @@ export interface ProcessFileAndSaveRequest {
1524
1524
  */
1525
1525
  export declare type ProcessFileAndSaveResponse = ProcessFileAndSaveResponseAsync | ProcessFileAndSaveResponseSync;
1526
1526
  /**
1527
- * Response body for ProcessFileAndSave operations where the File Processing API operation is an asynchronous operation (e.g. a video transcoding job).
1527
+ * Response body for ProcessFileAndSave operations where the File Processing API operation is asynchronous (e.g. a video transcoding job).
1528
1528
  * @export
1529
1529
  * @interface ProcessFileAndSaveResponseAsync
1530
1530
  */
@@ -1617,7 +1617,7 @@ export declare type ProcessFileAndSaveResponseAsyncJobDocsEnum = "https://www.by
1617
1617
  */
1618
1618
  export declare type ProcessFileAndSaveResponseAsyncAsyncEnum = true;
1619
1619
  /**
1620
- * Response body for ProcessFileAndSave operations where the File Processing API operation is a synchronous operation (e.g. an image processing job).
1620
+ * Response body for ProcessFileAndSave operations where the File Processing API operation is synchronous (e.g. an image processing job).
1621
1621
  * @export
1622
1622
  * @interface ProcessFileAndSaveResponseSync
1623
1623
  */
@@ -1641,9 +1641,7 @@ export interface ProcessFileAndSaveResponseSync {
1641
1641
  */
1642
1642
  async: ProcessFileAndSaveResponseSyncAsyncEnum;
1643
1643
  /**
1644
- * The `filePath` of the transformed file.
1645
- *
1646
- * If the transformation outputs multiple artifacts, then each artifact's path will be a child of this path.
1644
+ * Absolute path to a file. Begins with a `/`.
1647
1645
  * @type {string}
1648
1646
  * @memberof ProcessFileAndSaveResponseSync
1649
1647
  */
@@ -1655,9 +1653,9 @@ export interface ProcessFileAndSaveResponseSync {
1655
1653
  */
1656
1654
  fileUrl: string;
1657
1655
  /**
1658
- * JSON response returned by certain transformation APIs.
1656
+ * JSON response returned by certain File Processing APIs.
1659
1657
  *
1660
- * Structure varies between transformation APIs (please consult the documentation of the individual transformation APIs).
1658
+ * Structure varies between File Processing APIs (please see the documentation of each individual File Processing API).
1661
1659
  * @type {{ [key: string]: any; }}
1662
1660
  * @memberof ProcessFileAndSaveResponseSync
1663
1661
  */
@@ -12,13 +12,13 @@ import { ErrorResponse } from "./models";
12
12
  */
13
13
  export interface BytescaleApiClientConfig {
14
14
  /**
15
- * Required for Node.js: you must provide an instance of requires("node-fetch")
15
+ * Only required for Node.js. Must be an instance of requires("node-fetch").
16
16
  *
17
17
  * Not required for the browser.
18
18
  */
19
19
  fetchApi?: FetchAPI;
20
20
  /**
21
- * Required for all environments. Must begin with "public_" or "secret_".
21
+ * Must begin with "public_" or "secret_".
22
22
  *
23
23
  * Please note: if you require JWT-based auth, you must provide an API key to this field, and then call 'AuthManager.beginAuthSession' to start a JWT-based auth session. The JWT's permissions will be merged with the API key's permissions, with precedence given to the JWT.
24
24
  */
@@ -38,21 +38,23 @@ export interface BytescaleApiClientConfig {
38
38
  */
39
39
  headers?: () => Promise<HTTPHeaders>;
40
40
  }
41
- export declare class BytescaleApiClientConfigResolver {
41
+ export declare class BytescaleApiClientConfigUtils {
42
42
  static defaultApiUrl: string;
43
43
  static defaultCdnUrl: string;
44
+ private static readonly specialApiKeys;
45
+ private static readonly specialApiKeyAccountId;
46
+ private static readonly accountIdLength;
44
47
  static getApiUrl(config: BytescaleApiClientConfig): string;
45
48
  static getCdnUrl(config: BytescaleApiClientConfig): string;
46
49
  static getFetchApi(config: BytescaleApiClientConfig): FetchAPI;
50
+ static getAccountId(config: BytescaleApiClientConfig): string;
51
+ static validate(config: BytescaleApiClientConfig): void;
47
52
  }
48
53
  /**
49
54
  * This is the base class for all generated API classes.
50
55
  */
51
56
  export declare class BaseAPI {
52
57
  protected readonly config: BytescaleApiClientConfig;
53
- protected static readonly specialApiKeys: string[];
54
- protected static readonly specialApiKeyAccountId = "W142hJk";
55
- protected static readonly accountIdLength = 7;
56
58
  constructor(config: BytescaleApiClientConfig);
57
59
  protected request(context: RequestOpts, initOverrides: RequestInit | InitOverrideFunction | undefined, baseUrlOverride: string | undefined): Promise<Response>;
58
60
  /**
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@bytescale/sdk",
3
- "version": "1.5.0",
3
+ "version": "3.0.0-alpha.10",
4
4
  "description": "Bytescale JavaScript SDK",
5
5
  "author": "Bytescale <hello@bytescale.com> (https://www.bytescale.com)",
6
6
  "license": "MIT",
7
7
  "types": "dist/types/index.d.ts",
8
8
  "main": "dist/node/cjs/main.js",
9
- "module": "dist/node/esm/main.mjs",
10
9
  "browser": "dist/browser/cjs/main.js",
11
10
  "exports": {
12
11
  ".": {
@@ -14,10 +13,7 @@
14
13
  "require": "./dist/node/cjs/main.js",
15
14
  "import": "./dist/node/esm/main.mjs"
16
15
  },
17
- "browser": {
18
- "require": "./dist/browser/cjs/main.js"
19
- },
20
- "default": "./dist/node/esm/main.mjs"
16
+ "default": "./dist/browser/cjs/main.js"
21
17
  }
22
18
  },
23
19
  "homepage": "https://www.bytescale.com/docs/sdks/javascript",