@nomad-media/full 1.1.5 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17001,6 +17001,8 @@ async function _addTagOrCollection(AUTH_TOKEN, URL, TYPE, CONTENT_ID, CONTENT_DE
17001
17001
 
17002
17002
 
17003
17003
 
17004
+
17005
+
17004
17006
  async function _bulkUpdateMetadata(AUTH_TOKEN, URL, CONTENT_IDS, COLLECTION_IDS,
17005
17007
  RELATED_CONTENT_IDS, TAG_IDS, SCHEMA_NAME, DEBUG_MODE)
17006
17008
  {
@@ -17011,12 +17013,23 @@ async function _bulkUpdateMetadata(AUTH_TOKEN, URL, CONTENT_IDS, COLLECTION_IDS,
17011
17013
  HEADERS.append("Content-Type", "application/json");
17012
17014
  HEADERS.append("Authorization", `Bearer ${AUTH_TOKEN}`);
17013
17015
 
17016
+ const ASSET_DETAILS = await _getAssetDetails(AUTH_TOKEN, URL, CONTENT_IDS[0], "admin", DEBUG_MODE);
17017
+
17014
17018
  // Create body for the request
17015
17019
  const BODY = {
17016
- collections: COLLECTION_IDS,
17020
+ collections: [
17021
+ ...(COLLECTION_IDS ? COLLECTION_IDS : []),
17022
+ ...(ASSET_DETAILS.collections ? ASSET_DETAILS.collections.map(item => item.id) : [])
17023
+ ],
17017
17024
  contents: CONTENT_IDS,
17018
- relatedContents: RELATED_CONTENT_IDS,
17019
- tags: TAG_IDS,
17025
+ relatedContents: [
17026
+ ...(RELATED_CONTENT_IDS ? RELATED_CONTENT_IDS : []),
17027
+ ...(ASSET_DETAILS.relatedContents ? ASSET_DETAILS.relatedContents.map(item => item.id) : [])
17028
+ ],
17029
+ tags: [
17030
+ ...(TAG_IDS ? TAG_IDS : []),
17031
+ ...(ASSET_DETAILS.tags ? ASSET_DETAILS.tags.map(item => item.id) : [])
17032
+ ],
17020
17033
  schemaName: SCHEMA_NAME
17021
17034
  };
17022
17035
 
@@ -243,9 +243,9 @@ BODY: `+JSON.stringify(e,null,4));try{var s=await fetch(t,{method:"PATCH",header
243
243
  METHOD: POST
244
244
  BODY: `+JSON.stringify(e,null,4));try{var s=await fetch(r,{method:"POST",headers:t,body:JSON.stringify(e)});if(s.ok)return await s.json();throw await s.json()}catch(e){_apiExceptionHandler(e,"Adding Related Content Failed")}}async function _addTagOrCollection(e,t,i,a,n,r,o,s,l,d){l="admin"===l?t+`/api/admin/${i}/content`:t+"/api/content/"+i,t=new Headers,t.append("Content-Type","application/json"),t.append("Authorization","Bearer "+e),e={items:[{contentDefinition:n,contentId:a,name:r,createNew:s}]};e.items[0][i+"Id"]=o,d&&console.log(`URL: ${l}
245
245
  METHOD: POST
246
- BODY: `+JSON.stringify(e,null,4));try{var p=await fetch(l,{method:"POST",headers:t,body:JSON.stringify(e)});if(p.ok)return await p.json();throw await p.json()}catch(e){_apiExceptionHandler(e,"Adding Tag or Collection Failed")}}async function _bulkUpdateMetadata(e,t,i,a,n,r,o,s){var t=t+"/api/admin/content/bulk-metadata-update",l=new Headers,e=(l.append("Content-Type","application/json"),l.append("Authorization","Bearer "+e),{collections:a,contents:i,relatedContents:n,tags:r,schemaName:o});s&&console.log(`URL: ${t}
246
+ BODY: `+JSON.stringify(e,null,4));try{var p=await fetch(l,{method:"POST",headers:t,body:JSON.stringify(e)});if(p.ok)return await p.json();throw await p.json()}catch(e){_apiExceptionHandler(e,"Adding Tag or Collection Failed")}}async function _bulkUpdateMetadata(e,t,i,a,n,r,o,s){var l=t+"/api/admin/content/bulk-metadata-update",d=new Headers,e=(d.append("Content-Type","application/json"),d.append("Authorization","Bearer "+e),await _getAssetDetails(e,t,i[0],"admin",s)),t={collections:[...a||[],...e.collections?e.collections.map(e=>e.id):[]],contents:i,relatedContents:[...n||[],...e.relatedContents?e.relatedContents.map(e=>e.id):[]],tags:[...r||[],...e.tags?e.tags.map(e=>e.id):[]],schemaName:o};s&&console.log(`URL: ${l}
247
247
  METHOD: POST
248
- BODY: `+JSON.stringify(e,null,4));try{var d=await fetch(t,{method:"POST",headers:l,body:JSON.stringify(e)});if(!d.ok)throw await d.json()}catch(e){_apiExceptionHandler(e,"Bulk Update Metadata Failed")}}async function _createTagOrCollection(e,t,i,a,n){t=t+"/api/admin/"+i,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={name:a};n&&console.log(`URL: ${t}
248
+ BODY: `+JSON.stringify(t,null,4));try{var p=await fetch(l,{method:"POST",headers:d,body:JSON.stringify(t)});if(!p.ok)throw await p.json()}catch(e){_apiExceptionHandler(e,"Bulk Update Metadata Failed")}}async function _createTagOrCollection(e,t,i,a,n){t=t+"/api/admin/"+i,i=new Headers,i.append("Content-Type","application/json"),i.append("Authorization","Bearer "+e),e={name:a};n&&console.log(`URL: ${t}
249
249
  METHOD: POST
250
250
  BODY: `+JSON.stringify(e,null,4));try{var r=await fetch(t,{method:"POST",headers:i,body:JSON.stringify(e)});if(r.ok)return await r.json();throw await r.json()}catch(e){_apiExceptionHandler(e,"Adding Tag or Collection Failed")}}async function _deleteRelatedContent(e,t,i,a,n,r,o){r="admin"===r?t+"/api/admin/related/delete":t+"/api/content/related/delete",t=new Headers,t.append("Content-Type","application/json"),t.append("Authorization","Bearer "+e),e={items:[{contentDefinition:n,contentId:i,relatedContentId:a}]};o&&console.log(`URL: ${r}
251
251
  METHOD: POST
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nomad-media/full",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "Nomad Media NPM",
5
5
  "main": "dist/nomad-media-sdk.min.js",
6
6
  "type": "module",