1- import { RESOURCE_TYPES , STORAGE_TYPES } from './constants'
1+ import { RESOURCE_TYPES , STORAGE_TYPES , ROTATION_MODES } from './constants'
22import { CldOptions , CloudConfig } from './types/CldOptions'
33import { url , extractPublicId } from './url'
44
5+ import { transform , toTransformationStr } from './transformers'
6+
57let config = { }
68
79export const getConfig = ( ) => Object . freeze ( config )
@@ -11,28 +13,43 @@ export const setConfig = (options:CloudConfig) => config = {
1113 ...options
1214}
1315
14- export const buildUrl = ( pubicId : string , { cloud = { } , transformations = { } } : CldOptions ) :string => {
16+ export const buildUrl = ( publicId : string , { cloud = { } , transformations = { } } : CldOptions ) :string => {
1517 const cloudConfig = {
1618 ...config ,
1719 ...cloud
1820 }
19- return url ( pubicId , cloudConfig , transformations )
21+ return url ( publicId , cloudConfig , transformations )
2022}
2123
22- export const buildImageUrl = ( pubicId : string , { cloud = { } , transformations = { } } : CldOptions ) :string => buildUrl ( pubicId , {
24+ export const buildImageUrl = ( publicId : string , { cloud = { } , transformations = { } } : CldOptions ) :string => buildUrl ( publicId , {
2325 cloud : {
2426 ...cloud ,
2527 resourceType : RESOURCE_TYPES . IMAGE
2628 } ,
2729 transformations
2830} )
2931
30- export const buildVideoUrl = ( pubicId : string , { cloud = { } , transformations = { } } : CldOptions ) :string => buildUrl ( pubicId , {
32+ export const buildVideoUrl = ( publicId : string , { cloud = { } , transformations = { } } : CldOptions ) :string => buildUrl ( publicId , {
3133 cloud : {
3234 ...cloud ,
3335 resourceType : RESOURCE_TYPES . VIDEO
3436 } ,
3537 transformations
3638} )
3739
38- export { RESOURCE_TYPES , extractPublicId , STORAGE_TYPES }
40+ type TransformerType = { transform : typeof transform , toString : typeof toTransformationStr }
41+
42+ const Transformer :TransformerType = { transform, toString : toTransformationStr }
43+
44+ export { RESOURCE_TYPES , extractPublicId , STORAGE_TYPES , ROTATION_MODES , Transformer }
45+
46+ export type { CldOptions , TransformerOption , TransformerVideoOption , CloudConfig , Rotation } from './types/CldOptions'
47+ export type { ResourceType } from './types/ResourceType'
48+ export type { StorageType } from './types/StorageType'
49+ export type { ResizeType , Resize } from './transformers/resize'
50+ export type { Border } from './transformers/border'
51+ export type { CustomFunction } from './transformers/customFunc'
52+ export type { Position } from './transformers/position'
53+ export type { Effect } from './transformers/effect'
54+
55+ export default buildUrl
0 commit comments