@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.
@@ -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
  });