@bytescale/sdk 3.0.0-alpha.1 → 3.0.0-alpha.4

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.
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytescale/sdk",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0-alpha.4",
4
4
  "description": "Bytescale JavaScript SDK",
5
5
  "author": "Bytescale <hello@bytescale.com> (https://www.bytescale.com)",
6
6
  "license": "MIT",
@@ -37,7 +37,7 @@ describe("UrlBuilder", () => {
37
37
  const actual = new UrlBuilder().url({
38
38
  accountId: "1234abc",
39
39
  filePath: "/example.jpg",
40
- options: { transformation: { type: "preset", preset: "thumbnail" } }
40
+ options: { transformation: "preset", transformationPreset: "thumbnail" }
41
41
  });
42
42
  const expected = "https://upcdn.io/1234abc/thumbnail/example.jpg";
43
43
  expect(actual).toEqual(expected);
@@ -47,7 +47,7 @@ describe("UrlBuilder", () => {
47
47
  const actual = new UrlBuilder().url({
48
48
  accountId: "1234abc",
49
49
  filePath: "/example.jpg",
50
- options: { transformation: { type: "preset", preset: "thumbnail", params: { artifact: "/foo" } } }
50
+ options: { transformation: "preset", transformationPreset: "thumbnail", artifact: "/foo" }
51
51
  });
52
52
  const expected = "https://upcdn.io/1234abc/thumbnail/example.jpg?artifact=%2Ffoo";
53
53
  expect(actual).toEqual(expected);
@@ -57,9 +57,7 @@ describe("UrlBuilder", () => {
57
57
  const actual = new UrlBuilder().url({
58
58
  accountId: "1234abc",
59
59
  filePath: "/example.jpg",
60
- options: {
61
- transformation: { type: "preset", preset: "thumbnail", params: { large: false, artifact: "/foo" } }
62
- }
60
+ options: { transformation: "preset", transformationPreset: "thumbnail", artifact: "/foo", large: false }
63
61
  });
64
62
  const expected = "https://upcdn.io/1234abc/thumbnail/example.jpg?large=false&artifact=%2Ffoo";
65
63
  expect(actual).toEqual(expected);
@@ -70,8 +68,10 @@ describe("UrlBuilder", () => {
70
68
  accountId: "1234abc",
71
69
  filePath: "/example.jpg",
72
70
  options: {
73
- // cachePermanently is rewritten to cache_perm
74
- transformation: { type: "preset", preset: "thumbnail", params: { cachePermanently: false, artifact: "/foo" } }
71
+ transformation: "preset",
72
+ transformationPreset: "thumbnail",
73
+ artifact: "/foo",
74
+ cachePermanently: false
75
75
  }
76
76
  });
77
77
  const expected = "https://upcdn.io/1234abc/thumbnail/example.jpg?cache_perm=false&artifact=%2Ffoo";
@@ -83,9 +83,7 @@ describe("UrlBuilder", () => {
83
83
  accountId: "1234abc",
84
84
  filePath: "/example.jpg",
85
85
  options: {
86
- transformation: {
87
- type: "image"
88
- }
86
+ transformation: "image"
89
87
  }
90
88
  });
91
89
  const expected = "https://upcdn.io/1234abc/image/example.jpg";
@@ -97,11 +95,9 @@ describe("UrlBuilder", () => {
97
95
  accountId: "1234abc",
98
96
  filePath: "/example.jpg",
99
97
  options: {
100
- transformation: {
101
- type: "image",
102
- params: {
103
- w: 42
104
- }
98
+ transformation: "image",
99
+ transformationParams: {
100
+ w: 42
105
101
  }
106
102
  }
107
103
  });
@@ -114,17 +110,20 @@ describe("UrlBuilder", () => {
114
110
  accountId: "1234abc",
115
111
  filePath: "/example.jpg",
116
112
  options: {
117
- transformation: {
118
- type: "image",
119
- params: {
120
- w: 42,
121
- h: 50
122
- }
113
+ transformation: "image",
114
+ transformationParams: {
115
+ w: 42,
116
+ h: 50
123
117
  },
118
+ cachePermanently: "auto",
119
+ artifact: "/foo",
120
+ large: true,
121
+ version: "50",
124
122
  auth: true
125
123
  }
126
124
  });
127
- const expected = "https://upcdn.io/1234abc/image/example.jpg?auth=true&w=42&h=50";
125
+ const expected =
126
+ "https://upcdn.io/1234abc/image/example.jpg?w=42&h=50&auth=true&version=50&cache_perm=auto&large=true&artifact=%2Ffoo";
128
127
  expect(actual).toEqual(expected);
129
128
  });
130
129
 
@@ -133,18 +132,16 @@ describe("UrlBuilder", () => {
133
132
  accountId: "1234abc",
134
133
  filePath: "/example.jpg",
135
134
  options: {
136
- transformation: {
137
- type: "image",
138
- params: {
139
- w: null,
140
- h: undefined,
141
- r: 52
142
- }
135
+ transformation: "image",
136
+ transformationParams: {
137
+ w: undefined,
138
+ h: null,
139
+ r: 52
143
140
  },
144
141
  auth: true
145
142
  }
146
143
  });
147
- const expected = "https://upcdn.io/1234abc/image/example.jpg?auth=true&r=52";
144
+ const expected = "https://upcdn.io/1234abc/image/example.jpg?r=52&auth=true";
148
145
  expect(actual).toEqual(expected);
149
146
  });
150
147
 
@@ -153,12 +150,10 @@ describe("UrlBuilder", () => {
153
150
  accountId: "1234abc",
154
151
  filePath: "/example.jpg",
155
152
  options: {
156
- transformation: {
157
- type: "image",
158
- params: {
159
- w: 42,
160
- h: 50
161
- }
153
+ transformation: "image",
154
+ transformationParams: {
155
+ w: 42,
156
+ h: 50
162
157
  }
163
158
  }
164
159
  });