Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update transformation types for Cloudinary Video Player #202 #215

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@
"bugs": {
"url": "https://github.com/cloudinary-community/cloudinary-util/issues"
},
"homepage": "https://github.com/cloudinary-community/cloudinary-util"
"homepage": "https://github.com/cloudinary-community/cloudinary-util",
"dependencies": {
"@cloudinary/url-gen": "1.15.0"
}
}
343 changes: 343 additions & 0 deletions packages/types/src/types/cloudinary-video-player.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import {

Check warning on line 1 in packages/types/src/types/cloudinary-video-player.ts

View workflow job for this annotation

GitHub Actions / Test (18)

TypeScript will only remove the inline type specifiers which will leave behind a side effect import at runtime. Convert this to a top-level type qualifier to properly remove the entire import

Check warning on line 1 in packages/types/src/types/cloudinary-video-player.ts

View workflow job for this annotation

GitHub Actions / Test (20)

TypeScript will only remove the inline type specifiers which will leave behind a side effect import at runtime. Convert this to a top-level type qualifier to properly remove the entire import
type Transformation,
} from "@cloudinary/url-gen";

export interface CloudinaryVideoPlayerPlaylistOptions {
/**
* Whether to auto-advance to the next video and the delay between them.
Expand Down Expand Up @@ -495,4 +499,343 @@
customData3?: string;
customData4?: string;
customData5?: string;
}

export type AudioCodecType = string | "none" | "aac" | "vorbis" | "mp3";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need all of these types copy and pasted into here now that we're using the Transformation type directly from the url-gen package? i thought we'd only relaly need to import that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be able to, for the most part, copy in all of the types from the above int othe types/cloudinary-video-player.ts file

Isn't changes are correct?
According to issue need to copy from there!
Let me know how can I proceed here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah apologies for the confusion, i thought we had decided that instead of copying in the type,s we would import it from the url-gen package, and i THINK that should be sufficient. so then you would point the video player transformation property to the imported type


export type AudioFrequency =
string
| number
| 8000
| 11025
| 16000
| 22050
| 32000
| 37800
| 44056
| 44100
| 47250
| 48000
| 88200
| 96000
| 176400
| 192000;

export type ColorSpaceType =
string
| "srgb"
| "cmyk"
|"no_cmyk"
| "keep_cmyk"
| "tinysrgb"
| "srgb:truecolor";

export type CropMode =
string
| "scale"
| "fit"
| "limit"
| "mfit"
| "fill"
| "lfill"
| "pad"
| "lpad"
| "mpad"
| "crop"
| "thumb"
| "imagga_crop"
| "imagga_scale";

export type Gravity =
string
| "north_west"
| "north"
| "north_east"
| "west"
| "center"
| "east"
| "south_west"
| "south"
| "south_east"
| "xy_center"
| "face"
| "face:center"
| "face:auto"
| "faces"
| "faces:center"
| "faces:auto"
| "body"
| "body:face"
| "adv_face"
| "adv_faces"
| "adv_eyes"
| "custom"
| "custom:face"
| "custom:faces"
| "custom:adv_face"
| "custom:adv_faces"
| "auto"
| "auto:adv_face"
| "auto:adv_faces"
| "auto:adv_eyes"
| "auto:body"
| "auto:face"
| "auto:faces"
| "auto:custom_no_override"
| "auto:none"
| "liquid"
| "ocr_text";

export type ImageEffect =
string
| "hue"
| "red"
| "green"
| "blue"
| "negate"
| "brightness"
| "auto_brightness"
| "brightness_hsb"
| "sepia"
| "grayscale"
| "blackwhite"
| "saturation"
| "colorize"
| "replace_color"
| "simulate_colorblind"
| "assist_colorblind"
| "recolor"
| "tint"
| "contrast"
| "auto_contrast"
| "auto_color"
| "vibrance"
| "noise"
| "ordered_dither"
| "pixelate_faces"
| "pixelate_region"
| "pixelate"
| "unsharp_mask"
| "sharpen"
| "blur_faces"
| "blur_region"
| "blur"
| "tilt_shift"
| "gradient_fade"
| "vignette"
| "anti_removal"
| "overlay"
| "mask"
| "multiply"
| "displace"
| "shear"
| "distort"
| "trim"
| "make_transparent"
| "shadow"
| "viesus_correct"
| "fill_light"
| "gamma"
| "improve";

export type ImageFlags =
string
| Array<string>
| "any_format"
| "attachment"
| "apng"
| "awebp"
| "clip"
| "clip_evenodd"
| "cutter"
| "force_strip"
| "force_icc"
| "getinfo"
| "ignore_aspect_ratio"
| "immutable_cache"
| "keep_attribution"
| "keep_iptc"
| "layer_apply"
| "lossy"
| "preserve_transparency"
| "png8"
| "png24"
| "png32"
| "progressive"
| "rasterize"
| "region_relative"
| "relative"
| "replace_image"
| "sanitize"
| "strip_profile"
| "text_no_trim"
| "no_overflow"
| "text_disallow_overflow"
| "tiff8_lzw"
| "tiled";

export type ImageFormatType =
string |
'usdz'|
'jp2'|
'ai'|
'auto'|
'bmp'|
'eps'|
'flif'|
'gif'|
'heic'|
'ico'|
'jpc'|
'jpg'|
'pdf'|
'png'|
'psd'|
'svg'|
'tiff'|
'wdp'|
'webp'|
'arw'|
'aac'|
'aiff'|
'amr'|
'flac'|
'm4a'|
'mp3'|
'ogg'|
'opus'|
'wav'|
'avif'|
'cr2'|
'djvu'|
'eps3'|
'ept'|
'fxb'|
'gltf'|
'hdp'|
'heif'|
'indd'|
'jpe'|
'jpeg'|
'jxr'|
'ps'|
'spd'|
'tga'|
'tif'|
'3g2'|
'3gp'|
'avi'|
'flv'|
'm2ts'|
'm3u8'|
'mkv'|
'mov'|
'mp4'|
'mpd'|
'mpeg'|
'mts'|
'mxf'|
'ogv'|
'ts'|
'webm'|
'wmv'|
'glb';

export type RotationModeType =
stringOrNumber
| Array<stringOrNumber>
| "auto_right"
| "auto_left"
| "ignore"
| "vflip"
| "hflip";

export type StreamingProfileTypes =
string
| "4k"
| "full_hd"
| "hd"
| "sd"
| "full_hd_wifi"
| "full_hd_lean"
| "hd_lean";

export type stringOrNumber = number | string;

export interface LegacyITransforamtionOptions {
transformation?: LegacyITransforamtionOptions | string | Transformation;
raw_transformation?: string;
crop?: CropMode;
width?: stringOrNumber;
height?: stringOrNumber;
size?: string;
aspect_ratio?: stringOrNumber;
gravity?: Gravity;
x?: stringOrNumber;
y?: stringOrNumber;
zoom?: stringOrNumber;
background?: string;
angle?: RotationModeType;
radius?: stringOrNumber | stringOrNumber[];
overlay?: string | Record<string, any>;
custom_function?: string | { function_type?: string | "wasm" | "remote", source?: string }
variables?: Array<string | Record<string, any>>;
if?: string;
else?: string;
end_if?: string;
dpr?: stringOrNumber;
quality?: stringOrNumber;
delay?: stringOrNumber;
// eslint-disable-next-line @typescript-eslint/ban-types
underlay?: string | Object;
color?: string;
color_space?: ColorSpaceType;
opacity?: stringOrNumber;
border?: {
width?: stringOrNumber;
color?: string;
} | string;
default_image?: string;
density?: stringOrNumber;
format?: ImageFormatType;
fetch_format?: ImageFormatType;
effect?: string | Array<stringOrNumber> | ImageEffect;
page?: stringOrNumber;
flags?: ImageFlags | [] | string;
audio_codec?: AudioCodecType;
audio_frequency?: AudioFrequency;
// eslint-disable-next-line @typescript-eslint/ban-types
video_codec?: string | Object;
bit_rate?: stringOrNumber;
fps?: string | Array<stringOrNumber>;
keyframe_interval?: string;
offset?: string,
start_offset?: stringOrNumber;
end_offset?: stringOrNumber;
duration?: stringOrNumber;
streaming_profile?: StreamingProfileTypes
video_sampling?: stringOrNumber;
cloud_name?: string;
api_key?: string;
api_secret?: string;
private_cdn?: boolean;
secure_distribution?: string;
force_version?: boolean;
ssl_detected?: boolean;
secure?: boolean;
cdn_subdomain?: boolean;
secure_cdn_subdomain?: boolean;
cname?: string;
shorten?: boolean;
sign_url?: boolean;
long_url_signature?: boolean;
use_root_path?: boolean;
// eslint-disable-next-line @typescript-eslint/ban-types
auth_token?: object;
account_id?: string;
provisioning_api_key?: string;
provisioning_api_secret?: string;
version?: stringOrNumber;
url_suffix?: string;
[futureKey: string]: any;
}
Loading
Loading