Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cloudinary/cloudinary_npm
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.5.1
Choose a base ref
...
head repository: cloudinary/cloudinary_npm
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.6.0
Choose a head ref
  • 7 commits
  • 30 files changed
  • 6 contributors

Commits on Mar 4, 2025

  1. chore: dev dependencies cleanup + new node version support in CI

    * chore: upgraded nyc and jsdoc
    
    * chore: include node 20+22 in CI
    
    * chore: ignore vscode files
    
    * chore: using mock-fs@4.14.0
    
    * fix: fixed specs
    
    * fix: fixed specs
    
    * fix: fixed specs
    cloudinary-pkoniu authored Mar 4, 2025

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    addaleax Anna Henningsen
    Copy the full SHA
    82acfdb View commit details
  2. Minor typo fix (#703)

    dannyv-cloudinary authored Mar 4, 2025

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    addaleax Anna Henningsen
    Copy the full SHA
    c072e37 View commit details
  3. feat: Add support for DELETE /resources/backup/:asset_id (#700)

    * feat: Add support for DELETE /resources/backup/:asset_id
    
    * Remove testing bloat
    
    ---------
    
    Co-authored-by: cloudinary-pkoniu <patryk.konior@cloudinary.com>
    dannyv-cloudinary and cloudinary-pkoniu authored Mar 4, 2025

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    addaleax Anna Henningsen
    Copy the full SHA
    d6c51e2 View commit details
  4. fix: metadata field datasource type (#693)

    rChaoz authored Mar 4, 2025

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    addaleax Anna Henningsen
    Copy the full SHA
    265ccb8 View commit details
  5. Updated Sample Projects (#698)

    * Updated basic sample project
    
    -> Made changes to its README
    -> Updated the necessary dependencies
    -> Optimized the code to current standards
    
    * Updated photo album app
    
    * Improved code consistency and readability
    
    -> Used template literals
    -> Improved indentations around promise handling
    -> Switched from 'var' to 'const'
    aarya-16 authored Mar 4, 2025

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    addaleax Anna Henningsen
    Copy the full SHA
    25e04e6 View commit details

Commits on Mar 7, 2025

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    addaleax Anna Henningsen
    Copy the full SHA
    64bdc9d View commit details

Commits on Mar 11, 2025

  1. Version 2.6.0

    cloudinary-bot committed Mar 11, 2025

    Unverified

    The email in this signature doesn’t match the committer email.
    Copy the full SHA
    ad90190 View commit details
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -14,3 +14,4 @@ coverage
tools/cloudinary_url.sh
package-lock.json
npm-debug.log
.vscode/
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
language: node_js
nvm:
dist: focal
matrix:
include:
@@ -15,6 +14,11 @@ matrix:
script: npm run test-with-temp-cloud
- node_js: "18"
script: npm run test-with-temp-cloud
- node_js: "20"
script: npm run test-with-temp-cloud
- node_js: "22"
script: npm run test-with-temp-cloud


notifications:
email:
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
2.6.0 / 2025-03-11
==================

* chore: bumped jsdoc
* fix: defaults for related asset methods and proper content_type
* chore: Updated Sample Projects (#698)
* fix: metadata field datasource type (#693)
* feat: Add support for DELETE /resources/backup/:asset_id (#700)
* chore: dev dependencies cleanup
* chore: new node version support in CI

2.5.1 / 2024-10-08
==================

24 changes: 22 additions & 2 deletions lib/api.js
Original file line number Diff line number Diff line change
@@ -178,6 +178,18 @@ exports.delete_all_resources = function delete_all_resources(callback, options =
}), callback, options);
};

exports.delete_backed_up_assets = (assetId, versionIds, callback, options = {}) => {
const params = deleteBackupParams(versionIds);

return call_api('delete', ['resources', 'backup', assetId], params, callback, options);
}

const deleteBackupParams = (versionIds = []) => {
return {
"version_ids[]": Array.isArray(versionIds) ? versionIds : [versionIds]
};
};

const createRelationParams = (publicIds = []) => {
return {
assets_to_relate: Array.isArray(publicIds) ? publicIds : [publicIds]
@@ -192,21 +204,29 @@ const deleteRelationParams = (publicIds = []) => {

exports.add_related_assets = (publicId, assetsToRelate, callback, options = {}) => {
const params = createRelationParams(assetsToRelate);
return call_api('post', ['resources', 'related_assets', options.resource_type, options.type, publicId], params, callback, options);
const resourceType = options.resource_type || 'image';
const type = options.type || 'upload';
options.content_type = 'json';
return call_api('post', ['resources', 'related_assets', resourceType, type, publicId], params, callback, options);
};

exports.add_related_assets_by_asset_id = (assetId, assetsToRelate, callback, options = {}) => {
const params = createRelationParams(assetsToRelate);
options.content_type = 'json';
return call_api('post', ['resources', 'related_assets', assetId], params, callback, options);
};

exports.delete_related_assets = (publicId, assetsToUnrelate, callback, options = {}) => {
const params = deleteRelationParams(assetsToUnrelate);
return call_api('delete', ['resources', 'related_assets', options.resource_type, options.type, publicId], params, callback, options);
const resourceType = options.resource_type || 'image';
const type = options.type || 'upload';
options.content_type = 'json';
return call_api('delete', ['resources', 'related_assets', resourceType, type, publicId], params, callback, options);
};

exports.delete_related_assets_by_asset_id = (assetId, assetsToUnrelate, callback, options = {}) => {
const params = deleteRelationParams(assetsToUnrelate);
options.content_type = 'json';
return call_api('delete', ['resources', 'related_assets', assetId], params, callback, options);
};

3 changes: 2 additions & 1 deletion lib/utils/analytics/getSDKVersions.js
Original file line number Diff line number Diff line change
@@ -26,7 +26,8 @@ function getSDKVersions(useSDKVersion = 'default', useNodeVersion = 'default') {
const sdkSemver = useSDKVersion === 'default' ? readSdkSemver() : useSDKVersion;

// allow to pass a custom techVersion (Node version)
const techVersion = useNodeVersion === 'default' ? process.versions.node : useNodeVersion;
const version = process.version.slice(1);
const techVersion = useNodeVersion === 'default' ? version : useNodeVersion;

const product = 'A';

1 change: 1 addition & 0 deletions lib/v2/api.js
Original file line number Diff line number Diff line change
@@ -75,5 +75,6 @@ v1_adapters(exports, api, {
add_related_assets_by_asset_id: 2,
delete_related_assets: 2,
delete_related_assets_by_asset_id: 2,
delete_backed_up_assets: 2,
config: 0
});
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"author": "Cloudinary <info@cloudinary.com>",
"name": "cloudinary",
"description": "Cloudinary NPM for node.js integration",
"version": "2.5.1",
"version": "2.6.0",
"homepage": "https://cloudinary.com",
"license": "MIT",
"repository": {
@@ -15,9 +15,9 @@
"q": "^1.5.1"
},
"devDependencies": {
"@types/expect.js": "^0.3.29",
"@types/mocha": "^7.0.2",
"@types/node": "^13.5.0",
"@types/expect.js": "^0.3.29",
"date-fns": "^2.16.1",
"dotenv": "4.x",
"dtslint": "^0.9.1",
@@ -26,12 +26,11 @@
"eslint-plugin-import": "^2.20.2",
"expect.js": "0.3.x",
"glob": "^7.1.6",
"jsdoc": "3.5.5",
"jsdoc": "^4.0.4",
"jsdom": "^9.12.0",
"jsdom-global": "2.1.1",
"mocha": "^6.2.3",
"mock-fs": "^4.12.0",
"nyc": "^13.3.0",
"nyc": "^14.1.1",
"rimraf": "^3.0.0",
"sinon": "^6.1.4",
"typescript": "^3.7.5",
Loading