adobe-ims-servicetoken
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
import murmurHash3 from'murmurhash3js';const hash128 = murmurHash3.x64.hash128, | ||
import murmurHash3 from'murmurhash3js';import FormData from'form-data';const hash128 = murmurHash3.x64.hash128, | ||
tokens = new Map(); | ||
@@ -45,3 +45,3 @@ | ||
method: "POST", | ||
headers: { "content-type": "multipart/form-data" }, | ||
headers: form.getHeaders(), | ||
body: form | ||
@@ -48,0 +48,0 @@ }); |
@@ -5,2 +5,2 @@ /*! | ||
*/ | ||
import e from"murmurhash3js";const t=e.x64.hash128,n=new Map;async function s({url:e="https://ims-na1.adobelogin.com/ims/token",grant_type:s="authorization_code",client_id:o="",client_secret:r="",code:a="",jwt_token:c=""}={}){const i=t(`${e}|${o}|${s}`);let p;if(!1===n.has(i)){const t=new FormData;let d;s.length>0&&t.append("grant_type",s),t.append("client_id",o),t.append("client_secret",r),a.length>0&&t.append("code",a),c.length>0&&t.append("jwt_token",c);try{d=await fetch(e,{method:"POST",headers:{"content-type":"multipart/form-data"},body:t})}catch(e){d={ok:!1,statusText:e.message||e,json:async()=>({error:d.statusText,error_description:e.message}),text:async()=>e.message||e}}const l=d.ok?await d.clone().json():await d.clone().text();if(!d.ok){const e="string"==typeof l?d.statusText:`${l?.error}: ${l?.error_description}`;throw new Error(`[${d.status}] ${e}`)}n.set(i,l.access_token),p=structuredClone(l.access_token),void 0!==l.expires_in&&setTimeout((()=>n.delete(i)),l.expires_in)}else p=structuredClone(n.get(i));return p}export{s as token};//# sourceMappingURL=adobe-ims-servicetoken.min.js.map | ||
import e from"murmurhash3js";import t from"form-data";const s=e.x64.hash128,n=new Map;async function o({url:e="https://ims-na1.adobelogin.com/ims/token",grant_type:o="authorization_code",client_id:r="",client_secret:a="",code:c="",jwt_token:i=""}={}){const d=s(`${e}|${r}|${o}`);let p;if(!1===n.has(d)){const s=new t;let l;o.length>0&&s.append("grant_type",o),s.append("client_id",r),s.append("client_secret",a),c.length>0&&s.append("code",c),i.length>0&&s.append("jwt_token",i);try{l=await fetch(e,{method:"POST",headers:s.getHeaders(),body:s})}catch(e){l={ok:!1,statusText:e.message||e,json:async()=>({error:l.statusText,error_description:e.message}),text:async()=>e.message||e}}const h=l.ok?await l.clone().json():await l.clone().text();if(!l.ok){const e="string"==typeof h?l.statusText:`${h?.error}: ${h?.error_description}`;throw new Error(`[${l.status}] ${e}`)}n.set(d,h.access_token),p=structuredClone(h.access_token),void 0!==h.expires_in&&setTimeout((()=>n.delete(d)),h.expires_in)}else p=structuredClone(n.get(d));return p}export{o as token};//# sourceMappingURL=adobe-ims-servicetoken.min.js.map |
{ | ||
"name": "adobe-ims-servicetoken", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Adobe IMS Service Token lifecycle management", | ||
@@ -43,2 +43,3 @@ "source": "src/ims.js", | ||
"dependencies": { | ||
"form-data": "^4.0.0", | ||
"murmurhash3js": "^3.0.1" | ||
@@ -45,0 +46,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
11054
148
2
+ Addedform-data@^4.0.0
+ Addedasynckit@0.4.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)