Skip to content

Commit cfbb2ae

Browse files
committed
resolve conflicts
2 parents dc58ede + 84a3ec7 commit cfbb2ae

File tree

5 files changed

+135
-38
lines changed

5 files changed

+135
-38
lines changed

__TESTS__/unit/actions/Delivery.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,14 @@ describe('Tests for Transformation Action -- Delivery', () => {
215215
expect(url).toBe('https://res.cloudinary.com/demo/image/upload/q_auto/sample');
216216
});
217217

218+
it('Can use shortened quality notation', () => {
219+
const url = createNewImage('sample')
220+
.delivery(Delivery.quality('auto:best'))
221+
.toURL();
222+
223+
expect(url).toBe('https://res.cloudinary.com/demo/image/upload/q_auto:best/sample');
224+
});
225+
218226
it('Creates a cloudinaryURL with Delivery.density', () => {
219227
const url = createNewImage('sample')
220228
.delivery(Delivery.density(150))
@@ -302,4 +310,11 @@ describe('Tests for Transformation Action -- Delivery', () => {
302310

303311
expect(url).toContain('f_jpg,fl_progressive:none');
304312
});
313+
314+
it('Can use shortened format notation', () => {
315+
// f_jpg,fl_progressive
316+
const url = createNewImage('sample').delivery(format('jpg')).toString();
317+
318+
expect(url).toContain('f_jpg');
319+
});
305320
});

__TESTS__/unit/actions/Effect.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ describe('Tests for Transformation Action -- Effect', () => {
152152
expect(url).toBe('https://res.cloudinary.com/demo/image/upload/e_art:peacock/sample');
153153
});
154154

155+
it('Can use shortened artisticFilter notation', () => {
156+
const url = createNewImage('sample')
157+
.effect(Effect.artisticFilter("al_dente"))
158+
.toURL();
159+
160+
expect(url).toBe('https://res.cloudinary.com/demo/image/upload/e_art:al_dente/sample');
161+
});
162+
155163
it('Creates a cloudinaryURL with effect cartoonify:50', () => {
156164
const url = createNewImage('sample')
157165
.effect(cartoonify().lineStrength(50).blackwhite())

src/actions/delivery.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ import {FormatQualifier} from "../qualifiers/format/FormatQualifier";
1212
import {toFloatAsString} from "../internal/utils/toFloatAsString";
1313
import {DeliveryColorSpaceFromICC} from "./delivery/DeliveryColorSpaceFromICC";
1414
import {DeliveryAction} from "./delivery/DeliveryAction";
15+
import {QualityTypes} from "../types/types";
16+
import {ImageFormatType, VideoFormatType} from "../types/types";
1517

1618
export type IDeliveryAction = DeliveryAction | DeliveryColorSpaceFromICC;
1719

18-
1920
/**
2021
* @summary action
2122
* @description Defines the format of the delivered asset.
@@ -39,7 +40,7 @@ export type IDeliveryAction = DeliveryAction | DeliveryColorSpaceFromICC;
3940
* );
4041
*
4142
*/
42-
function format(format:FormatQualifier | string) :DeliveryFormat {
43+
function format(format:FormatQualifier | ImageFormatType | VideoFormatType | string) :DeliveryFormat {
4344
return new DeliveryFormat('f', format);
4445
}
4546

@@ -74,7 +75,8 @@ function dpr(dpr: string|number):DeliveryAction {
7475
* <b>Learn more:</b> {@link https://cloudinary.com/documentation/image_optimization#how_to_optimize_image_quality | Image quality}
7576
* {@link https://cloudinary.com/documentation/video_manipulation_and_delivery#quality_control | Video quality}
7677
* @memberOf Actions.Delivery
77-
* @param {string | number | Qualifiers.Quality} qualityType For a list of supported quality types see {@link Qualifiers.Quality| quality types} for
78+
* @param {QualityTypes | string | number | Qualifiers.Quality} qualityType For a list of supported quality types see
79+
* {@link Qualifiers.Quality| quality types} for
7880
* possible values.
7981
* @return {Actions.Delivery.DeliveryQualityAction}
8082
* @example
@@ -88,7 +90,7 @@ function dpr(dpr: string|number):DeliveryAction {
8890
* quality('auto'),
8991
* );
9092
*/
91-
function quality(qualityType:string | number) :DeliveryQualityAction {
93+
function quality(qualityType:QualityTypes|string | number) :DeliveryQualityAction {
9294
return new DeliveryQualityAction(qualityType);
9395
}
9496

src/actions/effect.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {FadeInEffectAction} from "./effect/leveled/fadeIn";
2424
import {RemoveBackgroundAction} from "./effect/removeBackgroundAction";
2525
import {ThemeEffect} from "./effect/theme";
2626
import {SystemColors} from "../qualifiers/color";
27+
import {ArtisticFilterType} from "../types/types";
2728

2829

2930
/**
@@ -101,10 +102,10 @@ function oilPaint(oilPaintLevel?: number):EffectActionWithStrength {
101102
* @summary action
102103
* @description Applies an artistic filter to the asset.
103104
* @memberOf Actions.Effect
104-
* @param artisticFilterType
105+
* @param {ArtisticFilterType | string} artisticFilterType
105106
* @return {Actions.Effect.SimpleEffectAction}
106107
*/
107-
function artisticFilter(artisticFilterType: string):SimpleEffectAction {
108+
function artisticFilter(artisticFilterType: ArtisticFilterType | string):SimpleEffectAction {
108109
return new SimpleEffectAction('art', artisticFilterType);
109110
}
110111

src/types/types.ts

Lines changed: 103 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import {gif, png, webp} from "../qualifiers/animatedFormat";
2-
import {ar16X9, ar1X1, ar3X1, ar3X2, ar4X3, ar5X4, ignoreInitialAspectRatio} from "../qualifiers/aspectRatio";
3-
41
export type StreamingProfiles = string | "4k" | "full_hd" | "hd" | "sd" | "full_hd_wifi" | "full_hd_lean" | "hd_lean";
52

63
export type stringOrNumber = number | string;
@@ -205,34 +202,74 @@ export type DeliveryType =
205202
| "dailymotion";
206203
/****************************** URL *************************************/
207204
export type ResourceType = string | "image" | "raw" | "video";
208-
export type ImageFormat =
209-
string
210-
| "gif"
211-
| "png"
212-
| "jpg"
213-
| "bmp"
214-
| "ico"
215-
| "pdf"
216-
| "tiff"
217-
| "eps"
218-
| "jpc"
219-
| "jp2"
220-
| "psd"
221-
| "webp"
222-
| "zip"
223-
| "svg"
224-
| "webm"
225-
| "wdp"
226-
| "hpx"
227-
| "djvu"
228-
| "ai"
229-
| "flif"
230-
| "bpg"
231-
| "miff"
232-
| "tga"
233-
| "heic"
205+
export type ImageFormatType =
206+
string |
207+
'usdz'|
208+
'jp2'|
209+
'ai'|
210+
'auto'|
211+
'bmp'|
212+
'eps'|
213+
'flif'|
214+
'gif'|
215+
'heic'|
216+
'ico'|
217+
'jpc'|
218+
'jpg'|
219+
'pdf'|
220+
'png'|
221+
'psd'|
222+
'svg'|
223+
'tiff'|
224+
'wdp'|
225+
'webp'|
226+
'arw'|
227+
'aac'|
228+
'aiff'|
229+
'amr'|
230+
'flac'|
231+
'm4a'|
232+
'mp3'|
233+
'ogg'|
234+
'opus'|
235+
'wav'|
236+
'avif'|
237+
'cr2'|
238+
'djvu'|
239+
'eps3'|
240+
'ept'|
241+
'fxb'|
242+
'gltf'|
243+
'hdp'|
244+
'heif'|
245+
'indd'|
246+
'jpe'|
247+
'jpeg'|
248+
'jxr'|
249+
'ps'|
250+
'spd'|
251+
'tga'|
252+
'tif'|
253+
'3g2'|
254+
'3gp'|
255+
'avi'|
256+
'flv'|
257+
'm2ts'|
258+
'm3u8'|
259+
'mkv'|
260+
'mov'|
261+
'mp4'|
262+
'mpd'|
263+
'mpeg'|
264+
'mts'|
265+
'mxf'|
266+
'ogv'|
267+
'ts'|
268+
'webm'|
269+
'wmv'|
270+
'glb';
234271

235-
export type VideoFormat =
272+
export type VideoFormatType =
236273
string
237274
| "auto"
238275
| "flv"
@@ -247,6 +284,29 @@ export type VideoFormat =
247284

248285
export type AnimatedFormatType = "auto" | "gif" | "webp" | "png";
249286

287+
export type ArtisticFilterType =
288+
"al_dente"|
289+
"athena"|
290+
"audrey"|
291+
"aurora"|
292+
"daguerre"|
293+
"eucalyptus"|
294+
"hairspray"|
295+
"hokusai"|
296+
"peacock"|
297+
"primavera"|
298+
"quartz"|
299+
"incognito"|
300+
"red_rock"|
301+
"sizzle"|
302+
"fes"|
303+
"linen"|
304+
"refresh"|
305+
"sonnet"|
306+
"ukulele"|
307+
"frost"|
308+
"zorro";
309+
250310
export type AspectRatioType =
251311
"1:1"|
252312
"5:4"|
@@ -290,8 +350,8 @@ export interface LegacyITransforamtionOptions {
290350
} | string;
291351
default_image?: string;
292352
density?: stringOrNumber;
293-
format?: ImageFormat;
294-
fetch_format?: ImageFormat;
353+
format?: ImageFormatType;
354+
fetch_format?: ImageFormatType;
295355
effect?: string | Array<stringOrNumber> | ImageEffect;
296356
page?: stringOrNumber;
297357
flags?: ImageFlags | [] | string;
@@ -332,3 +392,14 @@ export interface LegacyITransforamtionOptions {
332392
url_suffix?: string;
333393
[futureKey: string]: any;
334394
}
395+
396+
export type QualityTypes =
397+
'auto'|
398+
'auto:best'|
399+
'auto:eco'|
400+
'auto:good'|
401+
'auto:low'|
402+
'jpegmini'|
403+
'jpegmini:best' |
404+
'jpegmini:high' |
405+
'jpegmini:medium';

0 commit comments

Comments
 (0)