Skip to content
This repository was archived by the owner on Apr 8, 2021. It is now read-only.

Commit fccd451

Browse files
author
Amir Tocker
committed
Version 2.4.0
1 parent 06a5ce4 commit fccd451

File tree

6 files changed

+85
-44
lines changed

6 files changed

+85
-44
lines changed

cloudinary-core-shrinkwrap.js

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ var slice = [].slice,
2626
return results;
2727
}
2828
})(this, function() {
29-
/**
29+
/*
3030
* @license
3131
* Lodash (Custom Build) <https://lodash.com/>
32-
* Build: 'lodash include="isFunction,isElement,trim,assign,isString,isArray,isEmpty,merge,cloneDeep,compact,includes,difference,functions,identity,isPlainObject" exports="none" iife="var lodash = _ = (function() {%output%; \nreturn lodash;\n}.call(this));" --output build/lodash-shrinkwrap.js --development'
32+
* Build: 'lodash include="assign,cloneDeep,compact,difference,functions,identity,includes,isArray,isElement,isEmpty,isFunction,isPlainObject,isString,merge,trim" exports="none" iife="var lodash = _ = (function() {%output%; \nreturn lodash;\n}.call(this));" --output build/lodash-shrinkwrap.js --development'
3333
* Copyright JS Foundation and other contributors <https://js.foundation/>
3434
* Released under MIT license <https://lodash.com/license>
3535
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@@ -7403,7 +7403,7 @@ var slice = [].slice,
74037403

74047404
})(HtmlTag);
74057405
Cloudinary = (function() {
7406-
var AKAMAI_SHARED_CDN, CF_SHARED_CDN, DEFAULT_POSTER_OPTIONS, DEFAULT_VIDEO_SOURCE_TYPES, OLD_AKAMAI_SHARED_CDN, SHARED_CDN, VERSION, absolutize, applyBreakpoints, cdnSubdomainNumber, closestAbove, cloudinaryUrlPrefix, defaultBreakpoints, finalizeResourceType, findContainerWidth, maxWidth, updateDpr;
7406+
var AKAMAI_SHARED_CDN, CF_SHARED_CDN, DEFAULT_POSTER_OPTIONS, DEFAULT_VIDEO_SOURCE_TYPES, OLD_AKAMAI_SHARED_CDN, SEO_TYPES, SHARED_CDN, VERSION, absolutize, applyBreakpoints, cdnSubdomainNumber, closestAbove, cloudinaryUrlPrefix, defaultBreakpoints, finalizeResourceType, findContainerWidth, maxWidth, updateDpr;
74077407

74087408
VERSION = "2.4.0";
74097409

@@ -7422,6 +7422,14 @@ var slice = [].slice,
74227422

74237423
DEFAULT_VIDEO_SOURCE_TYPES = ['webm', 'mp4', 'ogv'];
74247424

7425+
SEO_TYPES = {
7426+
"image/upload": "images",
7427+
"image/private": "private_images",
7428+
"image/authenticated": "authenticated_images",
7429+
"raw/upload": "files",
7430+
"video/upload": "videos"
7431+
};
7432+
74257433

74267434
/**
74277435
* @const {Object} Cloudinary.DEFAULT_IMAGE_PARAMS
@@ -7529,7 +7537,13 @@ var slice = [].slice,
75297537
*/
75307538

75317539
finalizeResourceType = function(resourceType, type, urlSuffix, useRootPath, shorten) {
7532-
var options;
7540+
var key, options;
7541+
if (resourceType == null) {
7542+
resourceType = "image";
7543+
}
7544+
if (type == null) {
7545+
type = "upload";
7546+
}
75337547
if (Util.isPlainObject(resourceType)) {
75347548
options = resourceType;
75357549
resourceType = options.resource_type;
@@ -7542,17 +7556,17 @@ var slice = [].slice,
75427556
type = 'upload';
75437557
}
75447558
if (urlSuffix != null) {
7545-
if (resourceType === 'image' && type === 'upload') {
7546-
resourceType = "images";
7547-
type = null;
7548-
} else if (resourceType === 'image' && type === 'private') {
7549-
resourceType = 'private_images';
7550-
type = null;
7551-
} else if (resourceType === 'raw' && type === 'upload') {
7552-
resourceType = 'files';
7553-
type = null;
7554-
} else {
7555-
throw new Error("URL Suffix only supported for image/upload and raw/upload");
7559+
resourceType = SEO_TYPES[resourceType + "/" + type];
7560+
type = null;
7561+
if (resourceType == null) {
7562+
throw new Error("URL Suffix only supported for " + (((function() {
7563+
var results;
7564+
results = [];
7565+
for (key in SEO_TYPES) {
7566+
results.push(key);
7567+
}
7568+
return results;
7569+
})()).join(', ')));
75567570
}
75577571
}
75587572
if (useRootPath) {
@@ -7617,9 +7631,6 @@ var slice = [].slice,
76177631
if (!options.cloud_name) {
76187632
throw 'Unknown cloud_name';
76197633
}
7620-
if (options.url_suffix && !options.private_cdn) {
7621-
throw 'URL Suffix only supported in private CDN';
7622-
}
76237634
if (publicId.search('/') >= 0 && !publicId.match(/^v[0-9]+/) && !publicId.match(/^https?:\//) && !((ref = options.version) != null ? ref.toString() : void 0)) {
76247635
options.version = 1;
76257636
}

cloudinary-core-shrinkwrap.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cloudinary-core-shrinkwrap.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cloudinary-core.js

Lines changed: 49 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,30 @@ var slice = [].slice,
1010
hasProp = {}.hasOwnProperty;
1111

1212
(function(root, factory) {
13-
var name, ref, results, value;
13+
var factoryWrapper, name, ref, results, value;
14+
factoryWrapper = function(assign, cloneDeep, compact, difference, functions, identity, includes, isArray, isElement, isEmpty, isFunction, isPlainObject, isString, merge, trim) {
15+
return factory({
16+
assign: assign,
17+
cloneDeep: cloneDeep,
18+
compact: compact,
19+
difference: difference,
20+
functions: functions,
21+
identity: identity,
22+
includes: includes,
23+
isArray: isArray,
24+
isElement: isElement,
25+
isEmpty: isEmpty,
26+
isFunction: isFunction,
27+
isPlainObject: isPlainObject,
28+
isString: isString,
29+
merge: merge,
30+
trim: trim
31+
});
32+
};
1433
if ((typeof define === 'function') && define.amd) {
15-
return define(['lodash'], factory);
34+
return define(['lodash/assign', 'lodash/cloneDeep', 'lodash/compact', 'lodash/difference', 'lodash/functions', 'lodash/identity', 'lodash/includes', 'lodash/isArray', 'lodash/isElement', 'lodash/isEmpty', 'lodash/isFunction', 'lodash/isPlainObject', 'lodash/isString', 'lodash/merge', 'lodash/trim'], factoryWrapper);
1635
} else if (typeof exports === 'object') {
17-
return module.exports = factory(require('lodash'));
36+
return module.exports = factoryWrapper(require('lodash/assign'), require('lodash/cloneDeep'), require('lodash/compact'), require('lodash/difference'), require('lodash/functions'), require('lodash/identity'), require('lodash/includes'), require('lodash/isArray'), require('lodash/isElement'), require('lodash/isEmpty'), require('lodash/isFunction'), require('lodash/isPlainObject'), require('lodash/isString'), require('lodash/merge'), require('lodash/trim'));
1837
} else {
1938
root.cloudinary || (root.cloudinary = {});
2039
ref = factory(_);
@@ -3560,7 +3579,7 @@ var slice = [].slice,
35603579

35613580
})(HtmlTag);
35623581
Cloudinary = (function() {
3563-
var AKAMAI_SHARED_CDN, CF_SHARED_CDN, DEFAULT_POSTER_OPTIONS, DEFAULT_VIDEO_SOURCE_TYPES, OLD_AKAMAI_SHARED_CDN, SHARED_CDN, VERSION, absolutize, applyBreakpoints, cdnSubdomainNumber, closestAbove, cloudinaryUrlPrefix, defaultBreakpoints, finalizeResourceType, findContainerWidth, maxWidth, updateDpr;
3582+
var AKAMAI_SHARED_CDN, CF_SHARED_CDN, DEFAULT_POSTER_OPTIONS, DEFAULT_VIDEO_SOURCE_TYPES, OLD_AKAMAI_SHARED_CDN, SEO_TYPES, SHARED_CDN, VERSION, absolutize, applyBreakpoints, cdnSubdomainNumber, closestAbove, cloudinaryUrlPrefix, defaultBreakpoints, finalizeResourceType, findContainerWidth, maxWidth, updateDpr;
35643583

35653584
VERSION = "2.4.0";
35663585

@@ -3579,6 +3598,14 @@ var slice = [].slice,
35793598

35803599
DEFAULT_VIDEO_SOURCE_TYPES = ['webm', 'mp4', 'ogv'];
35813600

3601+
SEO_TYPES = {
3602+
"image/upload": "images",
3603+
"image/private": "private_images",
3604+
"image/authenticated": "authenticated_images",
3605+
"raw/upload": "files",
3606+
"video/upload": "videos"
3607+
};
3608+
35823609

35833610
/**
35843611
* @const {Object} Cloudinary.DEFAULT_IMAGE_PARAMS
@@ -3686,7 +3713,13 @@ var slice = [].slice,
36863713
*/
36873714

36883715
finalizeResourceType = function(resourceType, type, urlSuffix, useRootPath, shorten) {
3689-
var options;
3716+
var key, options;
3717+
if (resourceType == null) {
3718+
resourceType = "image";
3719+
}
3720+
if (type == null) {
3721+
type = "upload";
3722+
}
36903723
if (Util.isPlainObject(resourceType)) {
36913724
options = resourceType;
36923725
resourceType = options.resource_type;
@@ -3699,17 +3732,17 @@ var slice = [].slice,
36993732
type = 'upload';
37003733
}
37013734
if (urlSuffix != null) {
3702-
if (resourceType === 'image' && type === 'upload') {
3703-
resourceType = "images";
3704-
type = null;
3705-
} else if (resourceType === 'image' && type === 'private') {
3706-
resourceType = 'private_images';
3707-
type = null;
3708-
} else if (resourceType === 'raw' && type === 'upload') {
3709-
resourceType = 'files';
3710-
type = null;
3711-
} else {
3712-
throw new Error("URL Suffix only supported for image/upload and raw/upload");
3735+
resourceType = SEO_TYPES[resourceType + "/" + type];
3736+
type = null;
3737+
if (resourceType == null) {
3738+
throw new Error("URL Suffix only supported for " + (((function() {
3739+
var results;
3740+
results = [];
3741+
for (key in SEO_TYPES) {
3742+
results.push(key);
3743+
}
3744+
return results;
3745+
})()).join(', ')));
37133746
}
37143747
}
37153748
if (useRootPath) {
@@ -3774,9 +3807,6 @@ var slice = [].slice,
37743807
if (!options.cloud_name) {
37753808
throw 'Unknown cloud_name';
37763809
}
3777-
if (options.url_suffix && !options.private_cdn) {
3778-
throw 'URL Suffix only supported in private CDN';
3779-
}
37803810
if (publicId.search('/') >= 0 && !publicId.match(/^v[0-9]+/) && !publicId.match(/^https?:\//) && !((ref = options.version) != null ? ref.toString() : void 0)) {
37813811
options.version = 1;
37823812
}

cloudinary-core.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cloudinary-core.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)