ec.fdk 0.8.2 → 0.8.3

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.
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var yt=Object.defineProperty,mt=Object.defineProperties;var kt=Object.getOwnPropertyDescriptors;var x=Object.getOwnPropertySymbols;var $t=Object.prototype.hasOwnProperty,wt=Object.prototype.propertyIsEnumerable;var z=(n,t,e)=>t in n?yt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,a=(n,t)=>{for(var e in t||(t={}))$t.call(t,e)&&z(n,e,t[e]);if(x)for(var e of x(t))wt.call(t,e)&&z(n,e,t[e]);return n},h=(n,t)=>mt(n,kt(t));var u=(n,t,e)=>new Promise((s,r)=>{var d=o=>{try{l(e.next(o))}catch(c){r(c)}},i=o=>{try{l(e.throw(o))}catch(c){r(c)}},l=o=>o.done?s(o.value):Promise.resolve(o.value).then(d,i);l((e=e.apply(n,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function f(s){return u(this,arguments,function*(n,t={},e={}){var l;const{token:r,rawRes:d}=t;r&&(e.headers=h(a({},e.headers||{}),{Authorization:`Bearer ${r}`}));const i=yield fetch(n,e);if(!i.ok){if((l=i.headers.get("content-type"))!=null&&l.includes("application/json")){const o=yield i.json(),c=`${o.title}
1
+ "use strict";var mt=Object.defineProperty,kt=Object.defineProperties;var $t=Object.getOwnPropertyDescriptors;var F=Object.getOwnPropertySymbols;var wt=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable;var z=(n,t,e)=>t in n?mt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,a=(n,t)=>{for(var e in t||(t={}))wt.call(t,e)&&z(n,e,t[e]);if(F)for(var e of F(t))Et.call(t,e)&&z(n,e,t[e]);return n},g=(n,t)=>kt(n,$t(t));var l=(n,t,e)=>new Promise((s,r)=>{var u=o=>{try{d(e.next(o))}catch(c){r(c)}},i=o=>{try{d(e.throw(o))}catch(c){r(c)}},d=o=>o.done?s(o.value):Promise.resolve(o.value).then(u,i);d((e=e.apply(n,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function p(s){return l(this,arguments,function*(n,t={},e={}){var d;const{token:r,rawRes:u}=t;r&&(e.headers=g(a({},e.headers||{}),{Authorization:`Bearer ${r}`}));const i=yield fetch(n,e);if(!i.ok){if((d=i.headers.get("content-type"))!=null&&d.includes("application/json")){const o=yield i.json(),c=`${o.title}
2
2
  ${o.detail}
3
- ${o.verbose}`;throw new Error(c)}throw new Error(`unexpected fetch error: ${i.statusText}`)}return d?i:yield i.json()})}const E={datamanager:{live:"https://datamanager.entrecode.de/",stage:"https://datamanager.cachena.entrecode.de/"},accounts:{live:"https://accounts.entrecode.de/",stage:"https://accounts.cachena.entrecode.de/"},appserver:{live:"https://appserver.entrecode.de/",stage:"https://appserver.cachena.entrecode.de/"},"dm-history":{live:"https://dm-history.entrecode.de/",stage:"https://dm-history.cachena.entrecode.de/"}};function y(n,t="stage",e="datamanager"){const s=E[e];if(!s)throw new Error(`subdomain "${e}" not found. Try one of ${Object.keys(E).join(", ")}`);const r=s[t];if(!r)throw new Error(`env "${t}" not found. Try one of ${Object.keys(s[t]).join(", ")}`);return r+n}function $(n,t=!0){return Object.entries(n).sort((e,s)=>e[0].localeCompare(s[0])).map(([e,s])=>`${e}=${s}`).join("&")}function g(n){Object.entries(n).forEach(([t,e])=>{if(e===void 0)throw new Error(`expected ${t} to be set!`)})}const N={stage:"https://accounts.cachena.entrecode.de/",live:"https://accounts.entrecode.de/"};function J(n){return u(this,null,function*(){let{env:t,dmShortID:e,email:s,password:r}=n;g({env:t,dmShortID:e,email:s,password:r});const d=y(`api/${e}/_auth/login?clientID=rest`,t);return yield f(d,{},{method:"POST",body:JSON.stringify({email:s,password:r}),headers:{"Content-Type":"application/json"}})})}function R(n){return u(this,null,function*(){let{env:t,email:e,password:s}=n;g({env:t,email:e,password:s});const r=`${N[t]}auth/login?clientID=rest`;return yield f(r,{},{method:"POST",body:JSON.stringify({email:e,password:s}),headers:{"Content-Type":"application/json"}})})}function U(n){return u(this,null,function*(){let{dmShortID:t,env:e,token:s}=n;g({dmShortID:t,env:e,token:s});const r=y(`api/${t}/_auth/logout?clientID=rest&token=${s}`,e);return yield f(r,{rawRes:!0},{method:"POST"})})}function M(n){return u(this,null,function*(){let{env:t,token:e}=n;g({env:t,token:e});const s=`${N[t]}auth/logout?clientID=rest`;return yield f(s,{rawRes:!0,token:e},{method:"POST"})})}function V({dmShortID:n}){return g({dmShortID:n}),n}function H({env:n}){return g({env:n}),n}let Et=["created","creator","id","modified","private","_created","_creator","_embedded","_entryTitle","_id","_links","_modelTitle","_modelTitleField","_modified"];function Q(n){let t={};for(let e in n)Et.includes(e)||(t[e]=n[e]);return t}function Tt(n){return JSON.parse(JSON.stringify(n))}function W(n){return u(this,null,function*(){let{env:t,dmShortID:e}=n;g({env:t,dmShortID:e});const s=y(`api/${e}`,t);return f(s,n)})}function P(n){return u(this,null,function*(){let{env:t,dmShortID:e,model:s,options:r={}}=n;g({env:t,dmShortID:e,model:s}),r=a({size:50,page:1,_list:!0},r);const d=$(r),i=y(`api/${e}/${s}?${d}`,t),{count:l,total:o,_embedded:c}=yield f(i,n);let p=c?c[`${e}:${s}`]:[];return p=Array.isArray(p)?p:[p],{count:l,total:o,items:p}})}function X({env:n,dmShortID:t,model:e,entryID:s,token:r}){g({env:n,dmShortID:t,model:e,entryID:s});const d=$({_id:s}),i=y(`api/${t}/${e}?${d}`,n);return f(i,{token:r})}function Y(d){return u(this,arguments,function*({env:n,dmShortID:t,model:e,value:s,token:r}){g({env:n,dmShortID:t,model:e,value:s});const i=y(`api/${t}/${e}`,n);return yield f(i,{token:r},{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}})})}function S(l){return u(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,value:r,token:d,safePut:i=!1}){g({env:n,dmShortID:t,model:e,entryID:s,value:r});const o={"Content-Type":"application/json"};if(i){if(!("_modified"in r))throw new Error("expected _modified to be set!");o["If-Unmodified-Since"]=new Date(r._modified).toUTCString()}const c=y(`api/${t}/${e}?_id=${s}`,n);return r=Tt(r),r=Q(r),yield f(c,{token:d},{method:"PUT",headers:o,body:JSON.stringify(r)})})}function L({env:n,dmShortID:t,model:e,entryID:s,token:r}){g({env:n,dmShortID:t,model:e,entryID:s});const d=y(`api/${t}/${e}?_id=${s}`,n);return f(d,{token:r,rawRes:!0},{method:"DELETE",headers:{"Content-Type":"application/json"}})}function Z(n,t){return u(this,null,function*(){let{env:e,dmShortID:s,model:r,options:d={}}=n;g({env:e,dmShortID:s,model:r}),n.options=a({size:50,page:1,_list:!0},d);let i=0,l,o=[];for(;l===void 0||i<l;){const c=yield P(n);for(let p of c.items)o.push(yield t(p));i+=c.items.length,l=c.total,n.options.page++}return o})}function G(r){return u(this,arguments,function*({env:n,dmShortID:t,model:e,withMetadata:s}){var p,k,D,q,F;g({env:n,dmShortID:t,model:e});const d=y(`api/schema/${t}/${e}`,n),i=yield f(d),l=(p=i==null?void 0:i.allOf)==null?void 0:p[1];if(typeof l.properties!="object")throw new Error(`getSchema: ${d} returned unexpected format: ${JSON.stringify(i)}`);const{properties:o}=l,c=Q(o);for(let w in c){let m=c[w];if(m.required=l.required.includes(w),(k=c[w])!=null&&k.oneOf&&((D=c[w])==null||delete D.oneOf),(q=m.title)!=null&&q.includes("<")&&((F=m.title)!=null&&F.includes(">"))){const j=m.title.split("<")[1].slice(0,-1),pt=m.title.split("<")[0];m.type=pt,j.includes(":")?m.resource=j.split(":")[1]:m.resource=j}else["asset","entry","assets","entries"].includes(m.title)?(m.type=m.title,m.resource=null):m.type=m.title;delete c[w].title}if(s){const w=o._modelTitle.title,m=o._modelTitleField.title;return{properties:c,meta:{modelTitleField:m,modelTitle:w}}}return c})}function v(n){return Object.entries(n).map(([t,e])=>typeof e!="object"?{[t]:String(e)}:a(a(a(a(a(a(a({},e.sort&&{sort:Array.isArray(e)?e.join(","):e}),e.search&&{[t+"~"]:e.search}),e.notNull&&{[t+"!"]:""}),e.null&&{[t]:""}),e.any&&{[t]:e.any.join(",")}),e.from&&{[t+"From"]:e.from}),e.to&&{[t+"To"]:e.to})).reduce((t,e)=>a(a({},t),e),{})}const tt=v;function O(n){return n._links.collection.href.split("/").slice(-2)[0]}function B(n){const t=n._links.collection.href.split("api/")[0];return Object.keys(E.datamanager).find(s=>E.datamanager[s]===t)}const et=n=>{const t=O(n),e=B(n),s=n._modelTitle,r=n.id;return{dmShortID:t,env:e,model:s,entryID:r}},nt=n=>L(et(n)),st=(n,t)=>S(h(a({},et(n)),{value:t}));function rt(n,t){const e=O(t);return t._embedded[`${e}:${t._modelTitle}/${n}/asset`]}function ot(d){return u(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){g({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=$({assetID:s}),l=y(`a/${t}/${e}?${i}`,n),{_embedded:o}=yield f(l,{token:r});return o?o["ec:dm-asset"]:void 0})}function it(n){return u(this,null,function*(){let{env:t,dmShortID:e,assetGroup:s,token:r,options:d={}}=n;g({env:t,dmShortID:e,assetGroup:s}),d=a({size:50,page:1,_list:!0},d);const i=$(d),l=y(`a/${e}/${s}?${i}`,t),{count:o,total:c,_embedded:p}=yield f(l,{token:r});let k=p?p["ec:dm-asset"]:[];return k=Array.isArray(k)?k:[k],{count:o,total:c,items:k}})}function at(l){return u(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,token:s,file:r,name:d,options:i}){g({env:n,dmShortID:t,assetGroup:e,file:r});const o=y(`a/${t}/${e}`,n),c=new FormData;return c.append("file",r,d),i&&Object.keys(i).forEach(k=>{c.append(k,i[k])}),(yield f(o,{token:s},{method:"POST",body:c}))._embedded["ec:dm-asset"]})}function ct(d){return u(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,files:s,options:r}){g({env:n,dmShortID:t,assetGroup:e,files:s});const i=y(`a/${t}/${e}`,n),l=new FormData;s.forEach(c=>{l.append("file",c)}),r&&Object.keys(r).forEach(c=>{l.append(c,r[c])});const o=yield f(i,{},{method:"POST",body:l});return Array.isArray(o._embedded["ec:dm-asset"])?o._embedded["ec:dm-asset"]:[o._embedded["ec:dm-asset"]]})}function ut(d){return u(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){g({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=y(`a/${t}/${e}/${s}`,n);yield f(i,{token:r,rawRes:!0},{method:"DELETE"})})}function dt(n){return u(this,null,function*(){let{env:t,dmID:e,token:s}=n;g({env:t,dmID:e});const r=y(`?dataManagerID=${e}`,t);return f(r,{token:s})})}function lt(n){return u(this,null,function*(){let{env:t,options:e={}}=n;g({env:t}),e=a({size:25,page:1,_list:!0},e);const s=$(e),r=y(`?${s}`,t),{count:d,total:i,_embedded:l}=yield f(r,n);let o=l?l["ec:datamanager"]:[];return o=Array.isArray(o)?o:[o],{count:d,total:i,items:o}})}function gt(n){return u(this,null,function*(){let{env:t,dmID:e,options:s={}}=n;g({env:t,dmID:e}),s=a({size:25,dataManagerID:e,page:1,_list:!0},s);const r=$(s),d=y(`model?${r}`,t),{count:i,total:l,_embedded:o}=yield f(d,n);let c=o?o["ec:model"]:[];return c=Array.isArray(c)?c:[c],{count:i,total:l,items:c}})}function ht(n){return u(this,null,function*(){let{env:t,resource:e,options:s={},subdomain:r="datamanager"}=n;g({env:t,subdomain:r,resource:e}),s=a({size:25,page:1,_list:!0},s);const d=$(s),i=y(`${e}?${d}`,t,r),{count:l,total:o,_embedded:c}=yield f(i,n);let p=c?c[Object.keys(c)[0]]:[];return p=Array.isArray(p)?p:[p],{count:l,total:o,items:p}})}function ft(e){return u(this,arguments,function*(n,t={}){let{env:s,route:r,options:d={},subdomain:i="datamanager"}=n;g({env:s,subdomain:i,route:r}),d=a({},d);const l=$(d),o=y(`${r}?${l}`,s,i);return f(o,n,t)})}const _=Object.freeze(Object.defineProperty({__proto__:null,assetList:it,createAsset:at,createAssets:ct,createEntry:Y,deleteAsset:ut,deleteEntry:L,deleteEntryObject:nt,dmList:lt,editEntry:S,editEntryObject:st,entryList:P,filterOptions:tt,getAsset:ot,getDatamanager:dt,getEcAuthKey:H,getEntry:X,getEntryAsset:rt,getEntryEnv:B,getEntryShortID:O,getPublicAuthKey:V,getSchema:G,loginEc:R,loginPublic:J,logoutEc:M,logoutPublic:U,mapEntries:Z,modelList:gt,publicApi:W,raw:ft,resourceList:ht,sdkOptions:v},Symbol.toStringTag,{value:"Module"})),{entryList:C,mapEntries:bt,getEntry:At,getAsset:_t,assetList:I,createAsset:Ot,createAssets:jt,deleteAsset:Pt,createEntry:St,editEntry:K,deleteEntry:Lt,getSchema:vt,loginPublic:Bt,loginEc:Dt,logoutEc:qt,logoutPublic:Ft,getEcAuthKey:b,getPublicAuthKey:A,dmList:xt,modelList:zt,publicApi:Ct,getDatamanager:It,resourceList:Kt,raw:Nt}=_;function Jt(n){const{action:t}=n;if(g({action:t}),!_[t])throw new Error(`"${t}" does not exist! try one of ${Object.keys(_).join(", ")}`);return _[t](n)}class T{constructor(t={}){if(!t.storageAdapter){let e=new Map;t.storageAdapter={get:s=>e.get(s),set:(s,r)=>e.set(s,r),remove:s=>e.delete(s)}}this.config=t}set(t){return new T(a(a({},this.config),t))}entries(){return u(this,arguments,function*(t={}){const e=yield this.getBestToken();return C(h(a({},this.config),{options:t,token:e}))})}entryList(t){return u(this,null,function*(){const e=yield this.getBestToken();return C(h(a({},this.config),{options:t,token:e}))})}mapEntries(s){return u(this,arguments,function*(t,e={}){const r=yield this.getBestToken();return bt(h(a({},this.config),{options:e,token:r}),t)})}getEntry(t){return u(this,null,function*(){const e=yield this.getBestToken();return At(h(a({},this.config),{entryID:t,token:e}))})}editEntrySafe(t,e){return u(this,null,function*(){const s=yield this.getBestToken();return K(h(a({},this.config),{entryID:t,token:s,value:e,safePut:!0}))})}getSchema(){return u(this,null,function*(){return vt(this.config)})}assets(t){return u(this,null,function*(){const e=yield this.getBestToken();return I(h(a({},this.config),{options:t,token:e}))})}assetList(t){return u(this,null,function*(){const e=yield this.getBestToken();return I(h(a({},this.config),{options:t,token:e}))})}createAsset(t){return u(this,null,function*(){const{file:e,name:s,options:r}=t,d=yield this.getBestToken();return Ot(h(a({},this.config),{file:e,name:s,options:r,token:d}))})}createAssets(t){return u(this,null,function*(){const{files:e,options:s}=t,r=yield this.getBestToken();return jt(h(a({},this.config),{files:e,options:s,token:r}))})}deleteAsset(t){return u(this,null,function*(){const e=yield this.getBestToken();return Pt(h(a({},this.config),{token:e,assetID:t}))})}getAsset(t){return u(this,null,function*(){const e=yield this.getBestToken();return _t(h(a({},this.config),{assetID:t,token:e}))})}createEntry(t){return u(this,null,function*(){const e=yield this.getBestToken();return St(h(a({},this.config),{token:e,value:t}))})}editEntry(t,e){return u(this,null,function*(){const s=yield this.getBestToken();return K(h(a({},this.config),{entryID:t,token:s,value:e}))})}deleteEntry(t){return u(this,null,function*(){const e=yield this.getBestToken();return Lt(h(a({},this.config),{token:e,entryID:t}))})}resourceList(t){return u(this,null,function*(){const e=yield this.getBestToken();return Kt(h(a({},this.config),{options:t,token:e}))})}raw(t,e){return u(this,null,function*(){const s=yield this.getBestToken();return Nt(h(a({},this.config),{options:t,token:s}),e)})}storageAdapter(t){return this.set({storageAdapter:t})}removeToken(t){if(!this.config.storageAdapter)throw new Error("cannot removeToken: no storageAdapter defined!");const{remove:e}=this.config.storageAdapter;e(t)}getToken(t){if(!this.config.storageAdapter)throw new Error("cannot getAuth: no storageAdapter defined!");const{get:e}=this.config.storageAdapter;return e(t)}getPublicToken(){return this.config.token||this.getToken(A(this.config))}getEcToken(){return this.config.token||this.getToken(b(this.config))}setToken(t,e){if(!this.config.storageAdapter)throw new Error("cannot setEcToken: no storageAdapter defined!");return this.config.storageAdapter.set(t,e)}setEcToken(t){this.setToken(b(this.config),t)}setPublicToken(t){this.setToken(A(this.config),t)}loginEc(t){return Dt(a(a({},this.config),t)).then(e=>this.setToken(b(this.config),e.token))}loginPublic(t){return Bt(a(a({},this.config),t)).then(e=>this.setToken(A(this.config),e.token))}logoutPublic(){const t=this.getPublicToken();return Ft(h(a({},this.config),{token:t})).then(()=>this.removeToken(A(this.config)))}logoutEc(){const t=this.getEcToken();return qt(h(a({},this.config),{token:t})).then(()=>this.removeToken(b(this.config)))}hasPublicToken(){return!!this.getPublicToken()}hasEcToken(){return!!this.getEcToken()}hasAnyToken(){return!!this.getEcToken()||!!this.getPublicToken()}getBestToken(){try{return this.getEcToken()||this.getPublicToken()}catch(t){return}}model(t){return this.set({model:t})}token(t){return this.set({token:t})}dmShortID(t){return this.set({dmShortID:t})}dm(t){return this.dmShortID(t)}dmID(t){return this.set({dmID:t})}assetGroup(t){return this.set({assetGroup:t})}assetgroup(t){return this.assetGroup(t)}subdomain(t){return this.set({subdomain:t})}resource(t){return this.set({resource:t})}route(t){return this.set({route:t})}publicApi(){return Ct(this.config)}getDatamanager(t){return u(this,null,function*(){const e=yield this.getBestToken();return It(h(a({},this.config),{dmID:t,token:e}))})}dmList(){return u(this,arguments,function*(t={}){const e=yield this.getBestToken();return xt(h(a({},this.config),{options:t,token:e}))})}modelList(){return u(this,arguments,function*(t={}){const e=yield this.getBestToken();return zt(h(a({},this.config),{options:t,token:e}))})}}const Rt=n=>new T({env:n}),Ut=n=>new T({env:n});exports.Fdk=T;exports.act=Jt;exports.apiURL=y;exports.apis=E;exports.assetList=it;exports.createAsset=at;exports.createAssets=ct;exports.createEntry=Y;exports.deleteAsset=ut;exports.deleteEntry=L;exports.deleteEntryObject=nt;exports.dmList=lt;exports.editEntry=S;exports.editEntryObject=st;exports.entryList=P;exports.expect=g;exports.fdk=Rt;exports.fetcher=f;exports.filterOptions=tt;exports.getAsset=ot;exports.getDatamanager=dt;exports.getEcAuthKey=H;exports.getEntry=X;exports.getEntryAsset=rt;exports.getEntryEnv=B;exports.getEntryShortID=O;exports.getPublicAuthKey=V;exports.getSchema=G;exports.loginEc=R;exports.loginPublic=J;exports.logoutEc=M;exports.logoutPublic=U;exports.mapEntries=Z;exports.modelList=gt;exports.publicApi=W;exports.query=$;exports.raw=ft;exports.resourceList=ht;exports.sdk=Ut;exports.sdkOptions=v;
3
+ ${o.verbose}`;throw new Error(c)}throw new Error(`unexpected fetch error: ${i.statusText}`)}return u?i:yield i.json()})}const T={datamanager:{live:"https://datamanager.entrecode.de/",stage:"https://datamanager.cachena.entrecode.de/"},accounts:{live:"https://accounts.entrecode.de/",stage:"https://accounts.cachena.entrecode.de/"},appserver:{live:"https://appserver.entrecode.de/",stage:"https://appserver.cachena.entrecode.de/"},"dm-history":{live:"https://dm-history.entrecode.de/",stage:"https://dm-history.cachena.entrecode.de/"}};function y(n,t="stage",e="datamanager"){const s=T[e];if(!s)throw new Error(`subdomain "${e}" not found. Try one of ${Object.keys(T).join(", ")}`);const r=s[t];if(!r)throw new Error(`env "${t}" not found. Try one of ${Object.keys(s[t]).join(", ")}`);return r+n}function $(n,t=!0){return Object.entries(n).sort((e,s)=>e[0].localeCompare(s[0])).map(([e,s])=>`${e}=${s}`).join("&")}function h(n){Object.entries(n).forEach(([t,e])=>{if(e===void 0)throw new Error(`expected ${t} to be set!`)})}const N={stage:"https://accounts.cachena.entrecode.de/",live:"https://accounts.entrecode.de/"};function J(n){return l(this,null,function*(){let{env:t,dmShortID:e,email:s,password:r}=n;h({env:t,dmShortID:e,email:s,password:r});const u=y(`api/${e}/_auth/login?clientID=rest`,t);return yield p(u,{},{method:"POST",body:JSON.stringify({email:s,password:r}),headers:{"Content-Type":"application/json"}})})}function M(n){return l(this,null,function*(){let{env:t,email:e,password:s}=n;h({env:t,email:e,password:s});const r=`${N[t]}auth/login?clientID=rest`;return yield p(r,{},{method:"POST",body:JSON.stringify({email:e,password:s}),headers:{"Content-Type":"application/json"}})})}function R(n){return l(this,null,function*(){let{dmShortID:t,env:e,token:s}=n;h({dmShortID:t,env:e,token:s});const r=y(`api/${t}/_auth/logout?clientID=rest&token=${s}`,e);return yield p(r,{rawRes:!0},{method:"POST"})})}function U(n){return l(this,null,function*(){let{env:t,token:e}=n;h({env:t,token:e});const s=`${N[t]}auth/logout?clientID=rest`;return yield p(s,{rawRes:!0,token:e},{method:"POST"})})}function V({dmShortID:n}){return h({dmShortID:n}),n}function H({env:n}){return h({env:n}),n}let Tt=["created","creator","id","modified","private","_created","_creator","_embedded","_entryTitle","_id","_links","_modelTitle","_modelTitleField","_modified"];function Q(n){let t={};for(let e in n)Tt.includes(e)||(t[e]=n[e]);return t}function bt(n){return JSON.parse(JSON.stringify(n))}function W(n){return l(this,null,function*(){let{env:t,dmShortID:e}=n;h({env:t,dmShortID:e});const s=y(`api/${e}`,t);return p(s,n)})}function S(n){return l(this,null,function*(){let{env:t,dmShortID:e,model:s,options:r={}}=n;h({env:t,dmShortID:e,model:s}),r=a({size:50,page:1,_list:!0},r);const u=$(r),i=y(`api/${e}/${s}?${u}`,t),{count:d,total:o,_embedded:c}=yield p(i,n);let f=c?c[`${e}:${s}`]:[];return f=Array.isArray(f)?f:[f],{count:d,total:o,items:f}})}function X({env:n,dmShortID:t,model:e,entryID:s,token:r}){h({env:n,dmShortID:t,model:e,entryID:s});const u=$({_id:s}),i=y(`api/${t}/${e}?${u}`,n);return p(i,{token:r})}function Y(u){return l(this,arguments,function*({env:n,dmShortID:t,model:e,value:s,token:r}){h({env:n,dmShortID:t,model:e,value:s});const i=y(`api/${t}/${e}`,n);return yield p(i,{token:r},{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}})})}function L(d){return l(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,value:r,token:u,safePut:i=!1}){h({env:n,dmShortID:t,model:e,entryID:s,value:r});const o={"Content-Type":"application/json"};if(i){if(!("_modified"in r))throw new Error("expected _modified to be set!");o["If-Unmodified-Since"]=new Date(r._modified).toUTCString()}const c=y(`api/${t}/${e}?_id=${s}`,n);return r=bt(r),r=Q(r),yield p(c,{token:u},{method:"PUT",headers:o,body:JSON.stringify(r)})})}function B({env:n,dmShortID:t,model:e,entryID:s,token:r}){h({env:n,dmShortID:t,model:e,entryID:s});const u=y(`api/${t}/${e}?_id=${s}`,n);return p(u,{token:r,rawRes:!0},{method:"DELETE",headers:{"Content-Type":"application/json"}})}function Z(n,t){return l(this,null,function*(){let{env:e,dmShortID:s,model:r,options:u={}}=n;h({env:e,dmShortID:s,model:r}),n.options=a({size:50,page:1,_list:!0},u);let i=0,d,o=[];for(;d===void 0||i<d;){const c=yield S(n);for(let f of c.items)o.push(yield t(f));i+=c.items.length,d=c.total,n.options.page++}return o})}function G(r){return l(this,arguments,function*({env:n,dmShortID:t,model:e,withMetadata:s}){var f,k,E,q,x;h({env:n,dmShortID:t,model:e});const u=y(`api/schema/${t}/${e}`,n),i=yield p(u),d=(f=i==null?void 0:i.allOf)==null?void 0:f[1];if(typeof d.properties!="object")throw new Error(`getSchema: ${u} returned unexpected format: ${JSON.stringify(i)}`);const{properties:o}=d,c=Q(o);for(let w in c){let m=c[w];if(m.required=d.required.includes(w),(k=c[w])!=null&&k.oneOf&&((E=c[w])==null||delete E.oneOf),(q=m.title)!=null&&q.includes("<")&&((x=m.title)!=null&&x.includes(">"))){const P=m.title.split("<")[1].slice(0,-1),yt=m.title.split("<")[0];m.type=yt,P.includes(":")?m.resource=P.split(":")[1]:m.resource=P}else["asset","entry","assets","entries"].includes(m.title)?(m.type=m.title,m.resource=null):m.type=m.title;delete c[w].title}if(s){const w=o._modelTitle.title,m=o._modelTitleField.title;return{properties:c,meta:{modelTitleField:m,modelTitle:w}}}return c})}function v(n){return Object.entries(n).map(([t,e])=>typeof e!="object"?{[t]:String(e)}:a(a(a(a(a(a(a({},e.sort&&{sort:Array.isArray(e)?e.join(","):e}),e.search&&{[t+"~"]:e.search}),e.notNull&&{[t+"!"]:""}),e.null&&{[t]:""}),e.any&&{[t]:e.any.join(",")}),e.from&&{[t+"From"]:e.from}),e.to&&{[t+"To"]:e.to})).reduce((t,e)=>a(a({},t),e),{})}const tt=v;function j(n){return n._links.collection.href.split("/").slice(-2)[0]}function D(n){const t=n._links.collection.href.split("api/")[0];return Object.keys(T.datamanager).find(s=>T.datamanager[s]===t)}const et=n=>{const t=j(n),e=D(n),s=n._modelTitle,r=n.id;return{dmShortID:t,env:e,model:s,entryID:r}},nt=n=>B(et(n)),st=(n,t)=>L(g(a({},et(n)),{value:t}));function rt(n,t){const e=j(t);return t._embedded[`${e}:${t._modelTitle}/${n}/asset`]}function ot(u){return l(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){h({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=$({assetID:s}),d=y(`a/${t}/${e}?${i}`,n),{_embedded:o}=yield p(d,{token:r});return o?o["ec:dm-asset"]:void 0})}function it(n){return l(this,null,function*(){let{env:t,dmShortID:e,assetGroup:s,token:r,options:u={}}=n;h({env:t,dmShortID:e,assetGroup:s}),u=a({size:50,page:1,_list:!0},u);const i=$(u),d=y(`a/${e}/${s}?${i}`,t),{count:o,total:c,_embedded:f}=yield p(d,{token:r});let k=f?f["ec:dm-asset"]:[];return k=Array.isArray(k)?k:[k],{count:o,total:c,items:k}})}function ct(d){return l(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,token:s,file:r,name:u,options:i}){h({env:n,dmShortID:t,assetGroup:e,file:r});const o=y(`a/${t}/${e}`,n),c=new FormData;return c.append("file",r,u),i&&Object.keys(i).forEach(k=>{c.append(k,i[k])}),(yield p(o,{token:s},{method:"POST",body:c}))._embedded["ec:dm-asset"]})}function at(u){return l(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,files:s,options:r}){h({env:n,dmShortID:t,assetGroup:e,files:s});const i=y(`a/${t}/${e}`,n),d=new FormData;s.forEach(c=>{d.append("file",c)}),r&&Object.keys(r).forEach(c=>{d.append(c,r[c])});const o=yield p(i,{},{method:"POST",body:d});return Array.isArray(o._embedded["ec:dm-asset"])?o._embedded["ec:dm-asset"]:[o._embedded["ec:dm-asset"]]})}function ut(u){return l(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){h({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=y(`a/${t}/${e}/${s}`,n);yield p(i,{token:r,rawRes:!0},{method:"DELETE"})})}function lt(n,t,e=!1){var i,d,o;let s,r;const u=e?n==null?void 0:n.thumbnails:n==null?void 0:n.fileVariants;return u==null||u.forEach(c=>{const{resolution:{width:f,height:k}}=c,E=Math.abs(Math.max(f,k)-t);(!r||E<r)&&(r=E,s=c)}),(o=(d=s==null?void 0:s.url)!=null?d:(i=n==null?void 0:n.file)==null?void 0:i.url)!=null?o:null}function dt(n){return l(this,null,function*(){let{env:t,dmID:e,token:s}=n;h({env:t,dmID:e});const r=y(`?dataManagerID=${e}`,t);return p(r,{token:s})})}function ht(n){return l(this,null,function*(){let{env:t,options:e={}}=n;h({env:t}),e=a({size:25,page:1,_list:!0},e);const s=$(e),r=y(`?${s}`,t),{count:u,total:i,_embedded:d}=yield p(r,n);let o=d?d["ec:datamanager"]:[];return o=Array.isArray(o)?o:[o],{count:u,total:i,items:o}})}function gt(n){return l(this,null,function*(){let{env:t,dmID:e,options:s={}}=n;h({env:t,dmID:e}),s=a({size:25,dataManagerID:e,page:1,_list:!0},s);const r=$(s),u=y(`model?${r}`,t),{count:i,total:d,_embedded:o}=yield p(u,n);let c=o?o["ec:model"]:[];return c=Array.isArray(c)?c:[c],{count:i,total:d,items:c}})}function ft(n){return l(this,null,function*(){let{env:t,resource:e,options:s={},subdomain:r="datamanager"}=n;h({env:t,subdomain:r,resource:e}),s=a({size:25,page:1,_list:!0},s);const u=$(s),i=y(`${e}?${u}`,t,r),{count:d,total:o,_embedded:c}=yield p(i,n);let f=c?c[Object.keys(c)[0]]:[];return f=Array.isArray(f)?f:[f],{count:d,total:o,items:f}})}function pt(e){return l(this,arguments,function*(n,t={}){let{env:s,route:r,options:u={},subdomain:i="datamanager"}=n;h({env:s,subdomain:i,route:r}),u=a({},u);const d=$(u),o=y(`${r}?${d}`,s,i);return p(o,n,t)})}const O=Object.freeze(Object.defineProperty({__proto__:null,assetList:it,createAsset:ct,createAssets:at,createEntry:Y,deleteAsset:ut,deleteEntry:B,deleteEntryObject:nt,dmList:ht,editEntry:L,editEntryObject:st,entryList:S,fileVariant:lt,filterOptions:tt,getAsset:ot,getDatamanager:dt,getEcAuthKey:H,getEntry:X,getEntryAsset:rt,getEntryEnv:D,getEntryShortID:j,getPublicAuthKey:V,getSchema:G,loginEc:M,loginPublic:J,logoutEc:U,logoutPublic:R,mapEntries:Z,modelList:gt,publicApi:W,raw:pt,resourceList:ft,sdkOptions:v},Symbol.toStringTag,{value:"Module"})),{entryList:C,mapEntries:At,getEntry:_t,getAsset:Ot,assetList:I,createAsset:jt,createAssets:Pt,deleteAsset:St,createEntry:Lt,editEntry:K,deleteEntry:Bt,getSchema:vt,loginPublic:Dt,loginEc:qt,logoutEc:xt,logoutPublic:Ft,getEcAuthKey:A,getPublicAuthKey:_,dmList:zt,modelList:Ct,publicApi:It,getDatamanager:Kt,resourceList:Nt,raw:Jt}=O;function Mt(n){const{action:t}=n;if(h({action:t}),!O[t])throw new Error(`"${t}" does not exist! try one of ${Object.keys(O).join(", ")}`);return O[t](n)}class b{constructor(t={}){if(!t.storageAdapter){let e=new Map;t.storageAdapter={get:s=>e.get(s),set:(s,r)=>e.set(s,r),remove:s=>e.delete(s)}}this.config=t}set(t){return new b(a(a({},this.config),t))}entries(){return l(this,arguments,function*(t={}){const e=yield this.getBestToken();return C(g(a({},this.config),{options:t,token:e}))})}entryList(t){return l(this,null,function*(){const e=yield this.getBestToken();return C(g(a({},this.config),{options:t,token:e}))})}mapEntries(s){return l(this,arguments,function*(t,e={}){const r=yield this.getBestToken();return At(g(a({},this.config),{options:e,token:r}),t)})}getEntry(t){return l(this,null,function*(){const e=yield this.getBestToken();return _t(g(a({},this.config),{entryID:t,token:e}))})}editEntrySafe(t,e){return l(this,null,function*(){const s=yield this.getBestToken();return K(g(a({},this.config),{entryID:t,token:s,value:e,safePut:!0}))})}getSchema(){return l(this,null,function*(){return vt(this.config)})}assets(t){return l(this,null,function*(){const e=yield this.getBestToken();return I(g(a({},this.config),{options:t,token:e}))})}assetList(t){return l(this,null,function*(){const e=yield this.getBestToken();return I(g(a({},this.config),{options:t,token:e}))})}createAsset(t){return l(this,null,function*(){const{file:e,name:s,options:r}=t,u=yield this.getBestToken();return jt(g(a({},this.config),{file:e,name:s,options:r,token:u}))})}createAssets(t){return l(this,null,function*(){const{files:e,options:s}=t,r=yield this.getBestToken();return Pt(g(a({},this.config),{files:e,options:s,token:r}))})}deleteAsset(t){return l(this,null,function*(){const e=yield this.getBestToken();return St(g(a({},this.config),{token:e,assetID:t}))})}getAsset(t){return l(this,null,function*(){const e=yield this.getBestToken();return Ot(g(a({},this.config),{assetID:t,token:e}))})}createEntry(t){return l(this,null,function*(){const e=yield this.getBestToken();return Lt(g(a({},this.config),{token:e,value:t}))})}editEntry(t,e){return l(this,null,function*(){const s=yield this.getBestToken();return K(g(a({},this.config),{entryID:t,token:s,value:e}))})}deleteEntry(t){return l(this,null,function*(){const e=yield this.getBestToken();return Bt(g(a({},this.config),{token:e,entryID:t}))})}resourceList(t){return l(this,null,function*(){const e=yield this.getBestToken();return Nt(g(a({},this.config),{options:t,token:e}))})}raw(t,e){return l(this,null,function*(){const s=yield this.getBestToken();return Jt(g(a({},this.config),{options:t,token:s}),e)})}storageAdapter(t){return this.set({storageAdapter:t})}removeToken(t){if(!this.config.storageAdapter)throw new Error("cannot removeToken: no storageAdapter defined!");const{remove:e}=this.config.storageAdapter;e(t)}getToken(t){if(!this.config.storageAdapter)throw new Error("cannot getAuth: no storageAdapter defined!");const{get:e}=this.config.storageAdapter;return e(t)}getPublicToken(){return this.config.token||this.getToken(_(this.config))}getEcToken(){return this.config.token||this.getToken(A(this.config))}setToken(t,e){if(!this.config.storageAdapter)throw new Error("cannot setEcToken: no storageAdapter defined!");return this.config.storageAdapter.set(t,e)}setEcToken(t){this.setToken(A(this.config),t)}setPublicToken(t){this.setToken(_(this.config),t)}loginEc(t){return qt(a(a({},this.config),t)).then(e=>this.setToken(A(this.config),e.token))}loginPublic(t){return Dt(a(a({},this.config),t)).then(e=>this.setToken(_(this.config),e.token))}logoutPublic(){const t=this.getPublicToken();return Ft(g(a({},this.config),{token:t})).then(()=>this.removeToken(_(this.config)))}logoutEc(){const t=this.getEcToken();return xt(g(a({},this.config),{token:t})).then(()=>this.removeToken(A(this.config)))}hasPublicToken(){return!!this.getPublicToken()}hasEcToken(){return!!this.getEcToken()}hasAnyToken(){return!!this.getEcToken()||!!this.getPublicToken()}getBestToken(){try{return this.getEcToken()||this.getPublicToken()}catch(t){return}}model(t){return this.set({model:t})}token(t){return this.set({token:t})}dmShortID(t){return this.set({dmShortID:t})}dm(t){return this.dmShortID(t)}dmID(t){return this.set({dmID:t})}assetGroup(t){return this.set({assetGroup:t})}assetgroup(t){return this.assetGroup(t)}subdomain(t){return this.set({subdomain:t})}resource(t){return this.set({resource:t})}route(t){return this.set({route:t})}publicApi(){return It(this.config)}getDatamanager(t){return l(this,null,function*(){const e=yield this.getBestToken();return Kt(g(a({},this.config),{dmID:t,token:e}))})}dmList(){return l(this,arguments,function*(t={}){const e=yield this.getBestToken();return zt(g(a({},this.config),{options:t,token:e}))})}modelList(){return l(this,arguments,function*(t={}){const e=yield this.getBestToken();return Ct(g(a({},this.config),{options:t,token:e}))})}}const Rt=n=>new b({env:n}),Ut=n=>new b({env:n});exports.Fdk=b;exports.act=Mt;exports.apiURL=y;exports.apis=T;exports.assetList=it;exports.createAsset=ct;exports.createAssets=at;exports.createEntry=Y;exports.deleteAsset=ut;exports.deleteEntry=B;exports.deleteEntryObject=nt;exports.dmList=ht;exports.editEntry=L;exports.editEntryObject=st;exports.entryList=S;exports.expect=h;exports.fdk=Rt;exports.fetcher=p;exports.fileVariant=lt;exports.filterOptions=tt;exports.getAsset=ot;exports.getDatamanager=dt;exports.getEcAuthKey=H;exports.getEntry=X;exports.getEntryAsset=rt;exports.getEntryEnv=D;exports.getEntryShortID=j;exports.getPublicAuthKey=V;exports.getSchema=G;exports.loginEc=M;exports.loginPublic=J;exports.logoutEc=U;exports.logoutPublic=R;exports.mapEntries=Z;exports.modelList=gt;exports.publicApi=W;exports.query=$;exports.raw=pt;exports.resourceList=ft;exports.sdk=Ut;exports.sdkOptions=v;
package/dist/index.mjs CHANGED
@@ -1,52 +1,52 @@
1
- var M = Object.defineProperty, V = Object.defineProperties;
1
+ var U = Object.defineProperty, V = Object.defineProperties;
2
2
  var H = Object.getOwnPropertyDescriptors;
3
3
  var B = Object.getOwnPropertySymbols;
4
4
  var Q = Object.prototype.hasOwnProperty, W = Object.prototype.propertyIsEnumerable;
5
- var v = (n, t, e) => t in n ? M(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, a = (n, t) => {
5
+ var D = (n, t, e) => t in n ? U(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, c = (n, t) => {
6
6
  for (var e in t || (t = {}))
7
- Q.call(t, e) && v(n, e, t[e]);
7
+ Q.call(t, e) && D(n, e, t[e]);
8
8
  if (B)
9
9
  for (var e of B(t))
10
- W.call(t, e) && v(n, e, t[e]);
10
+ W.call(t, e) && D(n, e, t[e]);
11
11
  return n;
12
12
  }, g = (n, t) => V(n, H(t));
13
- var u = (n, t, e) => new Promise((s, r) => {
14
- var d = (o) => {
13
+ var l = (n, t, e) => new Promise((s, r) => {
14
+ var u = (o) => {
15
15
  try {
16
- l(e.next(o));
17
- } catch (c) {
18
- r(c);
16
+ d(e.next(o));
17
+ } catch (a) {
18
+ r(a);
19
19
  }
20
20
  }, i = (o) => {
21
21
  try {
22
- l(e.throw(o));
23
- } catch (c) {
24
- r(c);
22
+ d(e.throw(o));
23
+ } catch (a) {
24
+ r(a);
25
25
  }
26
- }, l = (o) => o.done ? s(o.value) : Promise.resolve(o.value).then(d, i);
27
- l((e = e.apply(n, t)).next());
26
+ }, d = (o) => o.done ? s(o.value) : Promise.resolve(o.value).then(u, i);
27
+ d((e = e.apply(n, t)).next());
28
28
  });
29
29
  function p(s) {
30
- return u(this, arguments, function* (n, t = {}, e = {}) {
31
- var l;
32
- const { token: r, rawRes: d } = t;
33
- r && (e.headers = g(a({}, e.headers || {}), {
30
+ return l(this, arguments, function* (n, t = {}, e = {}) {
31
+ var d;
32
+ const { token: r, rawRes: u } = t;
33
+ r && (e.headers = g(c({}, e.headers || {}), {
34
34
  Authorization: `Bearer ${r}`
35
35
  }));
36
36
  const i = yield fetch(n, e);
37
37
  if (!i.ok) {
38
- if ((l = i.headers.get("content-type")) != null && l.includes("application/json")) {
39
- const o = yield i.json(), c = `${o.title}
38
+ if ((d = i.headers.get("content-type")) != null && d.includes("application/json")) {
39
+ const o = yield i.json(), a = `${o.title}
40
40
  ${o.detail}
41
41
  ${o.verbose}`;
42
- throw new Error(c);
42
+ throw new Error(a);
43
43
  }
44
44
  throw new Error(`unexpected fetch error: ${i.statusText}`);
45
45
  }
46
- return d ? i : yield i.json();
46
+ return u ? i : yield i.json();
47
47
  });
48
48
  }
49
- const A = {
49
+ const _ = {
50
50
  datamanager: {
51
51
  live: "https://datamanager.entrecode.de/",
52
52
  stage: "https://datamanager.cachena.entrecode.de/"
@@ -65,10 +65,10 @@ const A = {
65
65
  }
66
66
  };
67
67
  function y(n, t = "stage", e = "datamanager") {
68
- const s = A[e];
68
+ const s = _[e];
69
69
  if (!s)
70
70
  throw new Error(
71
- `subdomain "${e}" not found. Try one of ${Object.keys(A).join(
71
+ `subdomain "${e}" not found. Try one of ${Object.keys(_).join(
72
72
  ", "
73
73
  )}`
74
74
  );
@@ -93,12 +93,12 @@ const z = {
93
93
  live: "https://accounts.entrecode.de/"
94
94
  };
95
95
  function X(n) {
96
- return u(this, null, function* () {
96
+ return l(this, null, function* () {
97
97
  let { env: t, dmShortID: e, email: s, password: r } = n;
98
98
  h({ env: t, dmShortID: e, email: s, password: r });
99
- const d = y(`api/${e}/_auth/login?clientID=rest`, t);
99
+ const u = y(`api/${e}/_auth/login?clientID=rest`, t);
100
100
  return yield p(
101
- d,
101
+ u,
102
102
  {},
103
103
  {
104
104
  method: "POST",
@@ -111,7 +111,7 @@ function X(n) {
111
111
  });
112
112
  }
113
113
  function Y(n) {
114
- return u(this, null, function* () {
114
+ return l(this, null, function* () {
115
115
  let { env: t, email: e, password: s } = n;
116
116
  h({ env: t, email: e, password: s });
117
117
  const r = `${z[t]}auth/login?clientID=rest`;
@@ -129,7 +129,7 @@ function Y(n) {
129
129
  });
130
130
  }
131
131
  function Z(n) {
132
- return u(this, null, function* () {
132
+ return l(this, null, function* () {
133
133
  let { dmShortID: t, env: e, token: s } = n;
134
134
  h({ dmShortID: t, env: e, token: s });
135
135
  const r = y(
@@ -146,7 +146,7 @@ function Z(n) {
146
146
  });
147
147
  }
148
148
  function G(n) {
149
- return u(this, null, function* () {
149
+ return l(this, null, function* () {
150
150
  let { env: t, token: e } = n;
151
151
  h({ env: t, token: e });
152
152
  const s = `${z[t]}auth/logout?clientID=rest`;
@@ -194,7 +194,7 @@ function st(n) {
194
194
  return JSON.parse(JSON.stringify(n));
195
195
  }
196
196
  function rt(n) {
197
- return u(this, null, function* () {
197
+ return l(this, null, function* () {
198
198
  let { env: t, dmShortID: e } = n;
199
199
  h({ env: t, dmShortID: e });
200
200
  const s = y(`api/${e}`, t);
@@ -202,12 +202,12 @@ function rt(n) {
202
202
  });
203
203
  }
204
204
  function F(n) {
205
- return u(this, null, function* () {
205
+ return l(this, null, function* () {
206
206
  let { env: t, dmShortID: e, model: s, options: r = {} } = n;
207
- h({ env: t, dmShortID: e, model: s }), r = a({ size: 50, page: 1, _list: !0 }, r);
208
- const d = k(r), i = y(`api/${e}/${s}?${d}`, t), { count: l, total: o, _embedded: c } = yield p(i, n);
209
- let f = c ? c[`${e}:${s}`] : [];
210
- return f = Array.isArray(f) ? f : [f], { count: l, total: o, items: f };
207
+ h({ env: t, dmShortID: e, model: s }), r = c({ size: 50, page: 1, _list: !0 }, r);
208
+ const u = k(r), i = y(`api/${e}/${s}?${u}`, t), { count: d, total: o, _embedded: a } = yield p(i, n);
209
+ let f = a ? a[`${e}:${s}`] : [];
210
+ return f = Array.isArray(f) ? f : [f], { count: d, total: o, items: f };
211
211
  });
212
212
  }
213
213
  function ot({
@@ -218,11 +218,11 @@ function ot({
218
218
  token: r
219
219
  }) {
220
220
  h({ env: n, dmShortID: t, model: e, entryID: s });
221
- const d = k({ _id: s }), i = y(`api/${t}/${e}?${d}`, n);
221
+ const u = k({ _id: s }), i = y(`api/${t}/${e}?${u}`, n);
222
222
  return p(i, { token: r });
223
223
  }
224
- function it(d) {
225
- return u(this, arguments, function* ({
224
+ function it(u) {
225
+ return l(this, arguments, function* ({
226
226
  env: n,
227
227
  dmShortID: t,
228
228
  model: e,
@@ -244,14 +244,14 @@ function it(d) {
244
244
  );
245
245
  });
246
246
  }
247
- function K(l) {
248
- return u(this, arguments, function* ({
247
+ function K(d) {
248
+ return l(this, arguments, function* ({
249
249
  env: n,
250
250
  dmShortID: t,
251
251
  model: e,
252
252
  entryID: s,
253
253
  value: r,
254
- token: d,
254
+ token: u,
255
255
  safePut: i = !1
256
256
  }) {
257
257
  h({ env: n, dmShortID: t, model: e, entryID: s, value: r });
@@ -263,10 +263,10 @@ function K(l) {
263
263
  throw new Error("expected _modified to be set!");
264
264
  o["If-Unmodified-Since"] = new Date(r._modified).toUTCString();
265
265
  }
266
- const c = y(`api/${t}/${e}?_id=${s}`, n);
266
+ const a = y(`api/${t}/${e}?_id=${s}`, n);
267
267
  return r = st(r), r = C(r), yield p(
268
- c,
269
- { token: d },
268
+ a,
269
+ { token: u },
270
270
  {
271
271
  method: "PUT",
272
272
  headers: o,
@@ -283,9 +283,9 @@ function N({
283
283
  token: r
284
284
  }) {
285
285
  h({ env: n, dmShortID: t, model: e, entryID: s });
286
- const d = y(`api/${t}/${e}?_id=${s}`, n);
286
+ const u = y(`api/${t}/${e}?_id=${s}`, n);
287
287
  return p(
288
- d,
288
+ u,
289
289
  { token: r, rawRes: !0 },
290
290
  {
291
291
  method: "DELETE",
@@ -296,70 +296,70 @@ function N({
296
296
  );
297
297
  }
298
298
  function at(n, t) {
299
- return u(this, null, function* () {
300
- let { env: e, dmShortID: s, model: r, options: d = {} } = n;
301
- h({ env: e, dmShortID: s, model: r }), n.options = a({ size: 50, page: 1, _list: !0 }, d);
302
- let i = 0, l, o = [];
303
- for (; l === void 0 || i < l; ) {
304
- const c = yield F(n);
305
- for (let f of c.items)
299
+ return l(this, null, function* () {
300
+ let { env: e, dmShortID: s, model: r, options: u = {} } = n;
301
+ h({ env: e, dmShortID: s, model: r }), n.options = c({ size: 50, page: 1, _list: !0 }, u);
302
+ let i = 0, d, o = [];
303
+ for (; d === void 0 || i < d; ) {
304
+ const a = yield F(n);
305
+ for (let f of a.items)
306
306
  o.push(yield t(f));
307
- i += c.items.length, l = c.total, n.options.page++;
307
+ i += a.items.length, d = a.total, n.options.page++;
308
308
  }
309
309
  return o;
310
310
  });
311
311
  }
312
312
  function ct(r) {
313
- return u(this, arguments, function* ({ env: n, dmShortID: t, model: e, withMetadata: s }) {
314
- var f, $, j, S, L;
313
+ return l(this, arguments, function* ({ env: n, dmShortID: t, model: e, withMetadata: s }) {
314
+ var f, $, T, S, L;
315
315
  h({ env: n, dmShortID: t, model: e });
316
- const d = y(`api/schema/${t}/${e}`, n), i = yield p(d), l = (f = i == null ? void 0 : i.allOf) == null ? void 0 : f[1];
317
- if (typeof l.properties != "object")
316
+ const u = y(`api/schema/${t}/${e}`, n), i = yield p(u), d = (f = i == null ? void 0 : i.allOf) == null ? void 0 : f[1];
317
+ if (typeof d.properties != "object")
318
318
  throw new Error(
319
- `getSchema: ${d} returned unexpected format: ${JSON.stringify(i)}`
319
+ `getSchema: ${u} returned unexpected format: ${JSON.stringify(i)}`
320
320
  );
321
- const { properties: o } = l, c = C(o);
322
- for (let w in c) {
323
- let m = c[w];
324
- if (m.required = l.required.includes(w), ($ = c[w]) != null && $.oneOf && ((j = c[w]) == null || delete j.oneOf), (S = m.title) != null && S.includes("<") && ((L = m.title) != null && L.includes(">"))) {
325
- const O = m.title.split("<")[1].slice(0, -1), U = m.title.split("<")[0];
326
- m.type = U, O.includes(":") ? m.resource = O.split(":")[1] : m.resource = O;
321
+ const { properties: o } = d, a = C(o);
322
+ for (let w in a) {
323
+ let m = a[w];
324
+ if (m.required = d.required.includes(w), ($ = a[w]) != null && $.oneOf && ((T = a[w]) == null || delete T.oneOf), (S = m.title) != null && S.includes("<") && ((L = m.title) != null && L.includes(">"))) {
325
+ const P = m.title.split("<")[1].slice(0, -1), R = m.title.split("<")[0];
326
+ m.type = R, P.includes(":") ? m.resource = P.split(":")[1] : m.resource = P;
327
327
  } else
328
328
  ["asset", "entry", "assets", "entries"].includes(m.title) ? (m.type = m.title, m.resource = null) : m.type = m.title;
329
- delete c[w].title;
329
+ delete a[w].title;
330
330
  }
331
331
  if (s) {
332
332
  const w = o._modelTitle.title, m = o._modelTitleField.title;
333
- return { properties: c, meta: { modelTitleField: m, modelTitle: w } };
333
+ return { properties: a, meta: { modelTitleField: m, modelTitle: w } };
334
334
  }
335
- return c;
335
+ return a;
336
336
  });
337
337
  }
338
338
  function I(n) {
339
- return Object.entries(n).map(([t, e]) => typeof e != "object" ? { [t]: String(e) } : a(a(a(a(a(a(a({}, e.sort && { sort: Array.isArray(e) ? e.join(",") : e }), e.search && { [t + "~"]: e.search }), e.notNull && { [t + "!"]: "" }), e.null && { [t]: "" }), e.any && { [t]: e.any.join(",") }), e.from && { [t + "From"]: e.from }), e.to && { [t + "To"]: e.to })).reduce((t, e) => a(a({}, t), e), {});
339
+ return Object.entries(n).map(([t, e]) => typeof e != "object" ? { [t]: String(e) } : c(c(c(c(c(c(c({}, e.sort && { sort: Array.isArray(e) ? e.join(",") : e }), e.search && { [t + "~"]: e.search }), e.notNull && { [t + "!"]: "" }), e.null && { [t]: "" }), e.any && { [t]: e.any.join(",") }), e.from && { [t + "From"]: e.from }), e.to && { [t + "To"]: e.to })).reduce((t, e) => c(c({}, t), e), {});
340
340
  }
341
341
  const ut = I;
342
- function P(n) {
342
+ function j(n) {
343
343
  return n._links.collection.href.split("/").slice(-2)[0];
344
344
  }
345
345
  function J(n) {
346
346
  const t = n._links.collection.href.split("api/")[0];
347
- return Object.keys(A.datamanager).find(
348
- (s) => A.datamanager[s] === t
347
+ return Object.keys(_.datamanager).find(
348
+ (s) => _.datamanager[s] === t
349
349
  );
350
350
  }
351
- const R = (n) => {
352
- const t = P(n), e = J(n), s = n._modelTitle, r = n.id;
351
+ const M = (n) => {
352
+ const t = j(n), e = J(n), s = n._modelTitle, r = n.id;
353
353
  return { dmShortID: t, env: e, model: s, entryID: r };
354
- }, dt = (n) => N(R(n)), lt = (n, t) => K(g(a({}, R(n)), {
354
+ }, lt = (n) => N(M(n)), dt = (n, t) => K(g(c({}, M(n)), {
355
355
  value: t
356
356
  }));
357
357
  function ht(n, t) {
358
- const e = P(t);
358
+ const e = j(t);
359
359
  return t._embedded[`${e}:${t._modelTitle}/${n}/asset`];
360
360
  }
361
- function gt(d) {
362
- return u(this, arguments, function* ({
361
+ function gt(u) {
362
+ return l(this, arguments, function* ({
363
363
  env: n,
364
364
  dmShortID: t,
365
365
  assetGroup: e,
@@ -367,45 +367,45 @@ function gt(d) {
367
367
  token: r
368
368
  }) {
369
369
  h({ env: n, dmShortID: t, assetGroup: e, assetID: s });
370
- const i = k({ assetID: s }), l = y(`a/${t}/${e}?${i}`, n), { _embedded: o } = yield p(l, { token: r });
370
+ const i = k({ assetID: s }), d = y(`a/${t}/${e}?${i}`, n), { _embedded: o } = yield p(d, { token: r });
371
371
  return o ? o["ec:dm-asset"] : void 0;
372
372
  });
373
373
  }
374
374
  function ft(n) {
375
- return u(this, null, function* () {
376
- let { env: t, dmShortID: e, assetGroup: s, token: r, options: d = {} } = n;
377
- h({ env: t, dmShortID: e, assetGroup: s }), d = a({ size: 50, page: 1, _list: !0 }, d);
378
- const i = k(d), l = y(`a/${e}/${s}?${i}`, t), { count: o, total: c, _embedded: f } = yield p(l, { token: r });
375
+ return l(this, null, function* () {
376
+ let { env: t, dmShortID: e, assetGroup: s, token: r, options: u = {} } = n;
377
+ h({ env: t, dmShortID: e, assetGroup: s }), u = c({ size: 50, page: 1, _list: !0 }, u);
378
+ const i = k(u), d = y(`a/${e}/${s}?${i}`, t), { count: o, total: a, _embedded: f } = yield p(d, { token: r });
379
379
  let $ = f ? f["ec:dm-asset"] : [];
380
- return $ = Array.isArray($) ? $ : [$], { count: o, total: c, items: $ };
380
+ return $ = Array.isArray($) ? $ : [$], { count: o, total: a, items: $ };
381
381
  });
382
382
  }
383
- function pt(l) {
384
- return u(this, arguments, function* ({
383
+ function pt(d) {
384
+ return l(this, arguments, function* ({
385
385
  env: n,
386
386
  dmShortID: t,
387
387
  assetGroup: e,
388
388
  token: s,
389
389
  file: r,
390
- name: d,
390
+ name: u,
391
391
  options: i
392
392
  }) {
393
393
  h({ env: n, dmShortID: t, assetGroup: e, file: r });
394
- const o = y(`a/${t}/${e}`, n), c = new FormData();
395
- return c.append("file", r, d), i && Object.keys(i).forEach(($) => {
396
- c.append($, i[$]);
394
+ const o = y(`a/${t}/${e}`, n), a = new FormData();
395
+ return a.append("file", r, u), i && Object.keys(i).forEach(($) => {
396
+ a.append($, i[$]);
397
397
  }), (yield p(
398
398
  o,
399
399
  { token: s },
400
400
  {
401
401
  method: "POST",
402
- body: c
402
+ body: a
403
403
  }
404
404
  ))._embedded["ec:dm-asset"];
405
405
  });
406
406
  }
407
- function yt(d) {
408
- return u(this, arguments, function* ({
407
+ function yt(u) {
408
+ return l(this, arguments, function* ({
409
409
  env: n,
410
410
  dmShortID: t,
411
411
  assetGroup: e,
@@ -413,29 +413,29 @@ function yt(d) {
413
413
  options: r
414
414
  }) {
415
415
  h({ env: n, dmShortID: t, assetGroup: e, files: s });
416
- const i = y(`a/${t}/${e}`, n), l = new FormData();
417
- s.forEach((c) => {
418
- l.append(
416
+ const i = y(`a/${t}/${e}`, n), d = new FormData();
417
+ s.forEach((a) => {
418
+ d.append(
419
419
  "file",
420
- c
420
+ a
421
421
  /* , name */
422
422
  );
423
- }), r && Object.keys(r).forEach((c) => {
424
- l.append(c, r[c]);
423
+ }), r && Object.keys(r).forEach((a) => {
424
+ d.append(a, r[a]);
425
425
  });
426
426
  const o = yield p(
427
427
  i,
428
428
  {},
429
429
  {
430
430
  method: "POST",
431
- body: l
431
+ body: d
432
432
  }
433
433
  );
434
434
  return Array.isArray(o._embedded["ec:dm-asset"]) ? o._embedded["ec:dm-asset"] : [o._embedded["ec:dm-asset"]];
435
435
  });
436
436
  }
437
- function mt(d) {
438
- return u(this, arguments, function* ({
437
+ function mt(u) {
438
+ return l(this, arguments, function* ({
439
439
  env: n,
440
440
  dmShortID: t,
441
441
  assetGroup: e,
@@ -453,50 +453,61 @@ function mt(d) {
453
453
  );
454
454
  });
455
455
  }
456
- function $t(n) {
457
- return u(this, null, function* () {
456
+ function $t(n, t, e = !1) {
457
+ var i, d, o;
458
+ let s, r;
459
+ const u = e ? n == null ? void 0 : n.thumbnails : n == null ? void 0 : n.fileVariants;
460
+ return u == null || u.forEach((a) => {
461
+ const {
462
+ resolution: { width: f, height: $ }
463
+ } = a, T = Math.abs(Math.max(f, $) - t);
464
+ (!r || T < r) && (r = T, s = a);
465
+ }), (o = (d = s == null ? void 0 : s.url) != null ? d : (i = n == null ? void 0 : n.file) == null ? void 0 : i.url) != null ? o : null;
466
+ }
467
+ function kt(n) {
468
+ return l(this, null, function* () {
458
469
  let { env: t, dmID: e, token: s } = n;
459
470
  h({ env: t, dmID: e });
460
471
  const r = y(`?dataManagerID=${e}`, t);
461
472
  return p(r, { token: s });
462
473
  });
463
474
  }
464
- function kt(n) {
465
- return u(this, null, function* () {
475
+ function wt(n) {
476
+ return l(this, null, function* () {
466
477
  let { env: t, options: e = {} } = n;
467
- h({ env: t }), e = a({ size: 25, page: 1, _list: !0 }, e);
468
- const s = k(e), r = y(`?${s}`, t), { count: d, total: i, _embedded: l } = yield p(r, n);
469
- let o = l ? l["ec:datamanager"] : [];
470
- return o = Array.isArray(o) ? o : [o], { count: d, total: i, items: o };
478
+ h({ env: t }), e = c({ size: 25, page: 1, _list: !0 }, e);
479
+ const s = k(e), r = y(`?${s}`, t), { count: u, total: i, _embedded: d } = yield p(r, n);
480
+ let o = d ? d["ec:datamanager"] : [];
481
+ return o = Array.isArray(o) ? o : [o], { count: u, total: i, items: o };
471
482
  });
472
483
  }
473
- function wt(n) {
474
- return u(this, null, function* () {
484
+ function Tt(n) {
485
+ return l(this, null, function* () {
475
486
  let { env: t, dmID: e, options: s = {} } = n;
476
- h({ env: t, dmID: e }), s = a({ size: 25, dataManagerID: e, page: 1, _list: !0 }, s);
477
- const r = k(s), d = y(`model?${r}`, t), { count: i, total: l, _embedded: o } = yield p(d, n);
478
- let c = o ? o["ec:model"] : [];
479
- return c = Array.isArray(c) ? c : [c], { count: i, total: l, items: c };
487
+ h({ env: t, dmID: e }), s = c({ size: 25, dataManagerID: e, page: 1, _list: !0 }, s);
488
+ const r = k(s), u = y(`model?${r}`, t), { count: i, total: d, _embedded: o } = yield p(u, n);
489
+ let a = o ? o["ec:model"] : [];
490
+ return a = Array.isArray(a) ? a : [a], { count: i, total: d, items: a };
480
491
  });
481
492
  }
482
- function Tt(n) {
483
- return u(this, null, function* () {
493
+ function Et(n) {
494
+ return l(this, null, function* () {
484
495
  let { env: t, resource: e, options: s = {}, subdomain: r = "datamanager" } = n;
485
- h({ env: t, subdomain: r, resource: e }), s = a({ size: 25, page: 1, _list: !0 }, s);
486
- const d = k(s), i = y(`${e}?${d}`, t, r), { count: l, total: o, _embedded: c } = yield p(i, n);
487
- let f = c ? c[Object.keys(c)[0]] : [];
488
- return f = Array.isArray(f) ? f : [f], { count: l, total: o, items: f };
496
+ h({ env: t, subdomain: r, resource: e }), s = c({ size: 25, page: 1, _list: !0 }, s);
497
+ const u = k(s), i = y(`${e}?${u}`, t, r), { count: d, total: o, _embedded: a } = yield p(i, n);
498
+ let f = a ? a[Object.keys(a)[0]] : [];
499
+ return f = Array.isArray(f) ? f : [f], { count: d, total: o, items: f };
489
500
  });
490
501
  }
491
- function Et(e) {
492
- return u(this, arguments, function* (n, t = {}) {
493
- let { env: s, route: r, options: d = {}, subdomain: i = "datamanager" } = n;
494
- h({ env: s, subdomain: i, route: r }), d = a({}, d);
495
- const l = k(d), o = y(`${r}?${l}`, s, i);
502
+ function bt(e) {
503
+ return l(this, arguments, function* (n, t = {}) {
504
+ let { env: s, route: r, options: u = {}, subdomain: i = "datamanager" } = n;
505
+ h({ env: s, subdomain: i, route: r }), u = c({}, u);
506
+ const d = k(u), o = y(`${r}?${d}`, s, i);
496
507
  return p(o, n, t);
497
508
  });
498
509
  }
499
- const b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
510
+ const A = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
500
511
  __proto__: null,
501
512
  assetList: ft,
502
513
  createAsset: pt,
@@ -504,19 +515,20 @@ const b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
504
515
  createEntry: it,
505
516
  deleteAsset: mt,
506
517
  deleteEntry: N,
507
- deleteEntryObject: dt,
508
- dmList: kt,
518
+ deleteEntryObject: lt,
519
+ dmList: wt,
509
520
  editEntry: K,
510
- editEntryObject: lt,
521
+ editEntryObject: dt,
511
522
  entryList: F,
523
+ fileVariant: $t,
512
524
  filterOptions: ut,
513
525
  getAsset: gt,
514
- getDatamanager: $t,
526
+ getDatamanager: kt,
515
527
  getEcAuthKey: et,
516
528
  getEntry: ot,
517
529
  getEntryAsset: ht,
518
530
  getEntryEnv: J,
519
- getEntryShortID: P,
531
+ getEntryShortID: j,
520
532
  getPublicAuthKey: tt,
521
533
  getSchema: ct,
522
534
  loginEc: Y,
@@ -524,48 +536,48 @@ const b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
524
536
  logoutEc: G,
525
537
  logoutPublic: Z,
526
538
  mapEntries: at,
527
- modelList: wt,
539
+ modelList: Tt,
528
540
  publicApi: rt,
529
- raw: Et,
530
- resourceList: Tt,
541
+ raw: bt,
542
+ resourceList: Et,
531
543
  sdkOptions: I
532
544
  }, Symbol.toStringTag, { value: "Module" })), {
533
- entryList: D,
534
- mapEntries: bt,
535
- getEntry: At,
536
- getAsset: _t,
545
+ entryList: v,
546
+ mapEntries: At,
547
+ getEntry: _t,
548
+ getAsset: Ot,
537
549
  assetList: q,
538
- createAsset: Ot,
539
- createAssets: Pt,
540
- deleteAsset: jt,
541
- createEntry: St,
550
+ createAsset: Pt,
551
+ createAssets: jt,
552
+ deleteAsset: St,
553
+ createEntry: Lt,
542
554
  editEntry: x,
543
- deleteEntry: Lt,
544
- getSchema: Bt,
555
+ deleteEntry: Bt,
556
+ getSchema: Dt,
545
557
  loginPublic: vt,
546
- loginEc: Dt,
547
- logoutEc: qt,
548
- logoutPublic: xt,
549
- getEcAuthKey: T,
550
- getPublicAuthKey: E,
551
- dmList: zt,
552
- modelList: Ct,
553
- publicApi: Ft,
554
- getDatamanager: Kt,
555
- resourceList: Nt,
556
- raw: It
557
- } = b;
558
+ loginEc: qt,
559
+ logoutEc: xt,
560
+ logoutPublic: zt,
561
+ getEcAuthKey: E,
562
+ getPublicAuthKey: b,
563
+ dmList: Ct,
564
+ modelList: Ft,
565
+ publicApi: Kt,
566
+ getDatamanager: Nt,
567
+ resourceList: It,
568
+ raw: Jt
569
+ } = A;
558
570
  function Rt(n) {
559
571
  const { action: t } = n;
560
- if (h({ action: t }), !b[t])
572
+ if (h({ action: t }), !A[t])
561
573
  throw new Error(
562
- `"${t}" does not exist! try one of ${Object.keys(b).join(
574
+ `"${t}" does not exist! try one of ${Object.keys(A).join(
563
575
  ", "
564
576
  )}`
565
577
  );
566
- return b[t](n);
578
+ return A[t](n);
567
579
  }
568
- class _ {
580
+ class O {
569
581
  /** @ignore */
570
582
  constructor(t = {}) {
571
583
  if (!t.storageAdapter) {
@@ -580,13 +592,13 @@ class _ {
580
592
  }
581
593
  /** @ignore */
582
594
  set(t) {
583
- return new _(a(a({}, this.config), t));
595
+ return new O(c(c({}, this.config), t));
584
596
  }
585
597
  /** @ignore */
586
598
  entries() {
587
- return u(this, arguments, function* (t = {}) {
599
+ return l(this, arguments, function* (t = {}) {
588
600
  const e = yield this.getBestToken();
589
- return D(g(a({}, this.config), { options: t, token: e }));
601
+ return v(g(c({}, this.config), { options: t, token: e }));
590
602
  });
591
603
  }
592
604
  /**
@@ -603,9 +615,9 @@ class _ {
603
615
  * const secrets = await fdk("stage").token(token).dm("83cc6374").model("secret").entryList()
604
616
  */
605
617
  entryList(t) {
606
- return u(this, null, function* () {
618
+ return l(this, null, function* () {
607
619
  const e = yield this.getBestToken();
608
- return D(g(a({}, this.config), { options: t, token: e }));
620
+ return v(g(c({}, this.config), { options: t, token: e }));
609
621
  });
610
622
  }
611
623
  /**
@@ -620,9 +632,9 @@ class _ {
620
632
  * console.log("res", res);
621
633
  */
622
634
  mapEntries(s) {
623
- return u(this, arguments, function* (t, e = {}) {
635
+ return l(this, arguments, function* (t, e = {}) {
624
636
  const r = yield this.getBestToken();
625
- return bt(g(a({}, this.config), { options: e, token: r }), t);
637
+ return At(g(c({}, this.config), { options: e, token: r }), t);
626
638
  });
627
639
  }
628
640
  /**
@@ -633,9 +645,9 @@ class _ {
633
645
  * const muffin = await fdk("stage").dm("83cc6374").model("muffin").getEntry("1gOtzWvrdq")
634
646
  */
635
647
  getEntry(t) {
636
- return u(this, null, function* () {
648
+ return l(this, null, function* () {
637
649
  const e = yield this.getBestToken();
638
- return At(g(a({}, this.config), { entryID: t, token: e }));
650
+ return _t(g(c({}, this.config), { entryID: t, token: e }));
639
651
  });
640
652
  }
641
653
  /**
@@ -653,9 +665,9 @@ class _ {
653
665
  * .editEntrySafe("1gOtzWvrdq", { name: "test", _modified: "2020-01-01T00:00:00.000Z"})
654
666
  */
655
667
  editEntrySafe(t, e) {
656
- return u(this, null, function* () {
668
+ return l(this, null, function* () {
657
669
  const s = yield this.getBestToken();
658
- return x(g(a({}, this.config), { entryID: t, token: s, value: e, safePut: !0 }));
670
+ return x(g(c({}, this.config), { entryID: t, token: s, value: e, safePut: !0 }));
659
671
  });
660
672
  }
661
673
  /**
@@ -666,15 +678,15 @@ class _ {
666
678
  * const muffin = await fdk("stage").dm("83cc6374").model("muffin").getSchema()
667
679
  */
668
680
  getSchema() {
669
- return u(this, null, function* () {
670
- return Bt(this.config);
681
+ return l(this, null, function* () {
682
+ return Dt(this.config);
671
683
  });
672
684
  }
673
685
  /** @ignore */
674
686
  assets(t) {
675
- return u(this, null, function* () {
687
+ return l(this, null, function* () {
676
688
  const e = yield this.getBestToken();
677
- return q(g(a({}, this.config), { options: t, token: e }));
689
+ return q(g(c({}, this.config), { options: t, token: e }));
678
690
  });
679
691
  }
680
692
  /**
@@ -689,9 +701,9 @@ class _ {
689
701
  * const files = await fdk("stage").token(token).dm("83cc6374").assetGroup("avatars").assetList()
690
702
  */
691
703
  assetList(t) {
692
- return u(this, null, function* () {
704
+ return l(this, null, function* () {
693
705
  const e = yield this.getBestToken();
694
- return q(g(a({}, this.config), { options: t, token: e }));
706
+ return q(g(c({}, this.config), { options: t, token: e }));
695
707
  });
696
708
  }
697
709
  /**
@@ -714,9 +726,9 @@ class _ {
714
726
  * .createAsset({ file, name: "venndiagram.png" });
715
727
  */
716
728
  createAsset(t) {
717
- return u(this, null, function* () {
718
- const { file: e, name: s, options: r } = t, d = yield this.getBestToken();
719
- return Ot(g(a({}, this.config), { file: e, name: s, options: r, token: d }));
729
+ return l(this, null, function* () {
730
+ const { file: e, name: s, options: r } = t, u = yield this.getBestToken();
731
+ return Pt(g(c({}, this.config), { file: e, name: s, options: r, token: u }));
720
732
  });
721
733
  }
722
734
  /**
@@ -739,9 +751,9 @@ class _ {
739
751
  * .createAsset({ files });
740
752
  */
741
753
  createAssets(t) {
742
- return u(this, null, function* () {
754
+ return l(this, null, function* () {
743
755
  const { files: e, options: s } = t, r = yield this.getBestToken();
744
- return Pt(g(a({}, this.config), { files: e, options: s, token: r }));
756
+ return jt(g(c({}, this.config), { files: e, options: s, token: r }));
745
757
  });
746
758
  }
747
759
  /**
@@ -753,9 +765,9 @@ class _ {
753
765
  * await ecadmin.assetgroup("test").deleteAsset('xxxx');
754
766
  */
755
767
  deleteAsset(t) {
756
- return u(this, null, function* () {
768
+ return l(this, null, function* () {
757
769
  const e = yield this.getBestToken();
758
- return jt(g(a({}, this.config), { token: e, assetID: t }));
770
+ return St(g(c({}, this.config), { token: e, assetID: t }));
759
771
  });
760
772
  }
761
773
  /**
@@ -766,9 +778,9 @@ class _ {
766
778
  * const asset = await fdk("stage").dm("83cc6374").assetgroup("test").getAsset("tP-ZxpZZTGmbPnET-wArAQ")
767
779
  */
768
780
  getAsset(t) {
769
- return u(this, null, function* () {
781
+ return l(this, null, function* () {
770
782
  const e = yield this.getBestToken();
771
- return _t(g(a({}, this.config), { assetID: t, token: e }));
783
+ return Ot(g(c({}, this.config), { assetID: t, token: e }));
772
784
  });
773
785
  }
774
786
  /**
@@ -780,9 +792,9 @@ class _ {
780
792
  * const entry = await fdk("stage").dm("83cc6374").model("muffin").createEntry({ name: 'test' })
781
793
  */
782
794
  createEntry(t) {
783
- return u(this, null, function* () {
795
+ return l(this, null, function* () {
784
796
  const e = yield this.getBestToken();
785
- return St(g(a({}, this.config), { token: e, value: t }));
797
+ return Lt(g(c({}, this.config), { token: e, value: t }));
786
798
  });
787
799
  }
788
800
  /**
@@ -795,9 +807,9 @@ class _ {
795
807
  * const entry = await fdk("stage").dm("83cc6374").model("muffin").editEntry("1gOtzWvrdq", { name: "test" })
796
808
  */
797
809
  editEntry(t, e) {
798
- return u(this, null, function* () {
810
+ return l(this, null, function* () {
799
811
  const s = yield this.getBestToken();
800
- return x(g(a({}, this.config), { entryID: t, token: s, value: e }));
812
+ return x(g(c({}, this.config), { entryID: t, token: s, value: e }));
801
813
  });
802
814
  }
803
815
  /**
@@ -810,9 +822,9 @@ class _ {
810
822
  * await fdk("stage").dm("83cc6374").model("muffin").deleteEntry("1gOtzWvrdq")
811
823
  */
812
824
  deleteEntry(t) {
813
- return u(this, null, function* () {
825
+ return l(this, null, function* () {
814
826
  const e = yield this.getBestToken();
815
- return Lt(g(a({}, this.config), { token: e, entryID: t }));
827
+ return Bt(g(c({}, this.config), { token: e, entryID: t }));
816
828
  });
817
829
  }
818
830
  /**
@@ -824,9 +836,9 @@ class _ {
824
836
  * const res = await fdk("stage").resource("template").resourceList()
825
837
  */
826
838
  resourceList(t) {
827
- return u(this, null, function* () {
839
+ return l(this, null, function* () {
828
840
  const e = yield this.getBestToken();
829
- return Nt(g(a({}, this.config), { options: t, token: e }));
841
+ return It(g(c({}, this.config), { options: t, token: e }));
830
842
  });
831
843
  }
832
844
  /**
@@ -840,9 +852,9 @@ class _ {
840
852
  * const res = await fdk("stage").route("stats").raw()
841
853
  */
842
854
  raw(t, e) {
843
- return u(this, null, function* () {
855
+ return l(this, null, function* () {
844
856
  const s = yield this.getBestToken();
845
- return It(g(a({}, this.config), { options: t, token: s }), e);
857
+ return Jt(g(c({}, this.config), { options: t, token: s }), e);
846
858
  });
847
859
  }
848
860
  /**
@@ -876,11 +888,11 @@ class _ {
876
888
  }
877
889
  /** @ignore */
878
890
  getPublicToken() {
879
- return this.config.token || this.getToken(E(this.config));
891
+ return this.config.token || this.getToken(b(this.config));
880
892
  }
881
893
  /** @ignore */
882
894
  getEcToken() {
883
- return this.config.token || this.getToken(T(this.config));
895
+ return this.config.token || this.getToken(E(this.config));
884
896
  }
885
897
  /** @ignore */
886
898
  setToken(t, e) {
@@ -894,7 +906,7 @@ class _ {
894
906
  * @ignore
895
907
  */
896
908
  setEcToken(t) {
897
- this.setToken(T(this.config), t);
909
+ this.setToken(E(this.config), t);
898
910
  }
899
911
  /**
900
912
  * Manually set public user token on the {@link Fdk.authStorage}. In most cases, you'd want to use {@link Fdk.token} instead!
@@ -902,15 +914,15 @@ class _ {
902
914
  * @ignore
903
915
  */
904
916
  setPublicToken(t) {
905
- this.setToken(E(this.config), t);
917
+ this.setToken(b(this.config), t);
906
918
  }
907
919
  /**
908
920
  * Login with the given ec user. Only needed when using manual auth.
909
921
  * @category Auth
910
922
  */
911
923
  loginEc(t) {
912
- return Dt(a(a({}, this.config), t)).then(
913
- (e) => this.setToken(T(this.config), e.token)
924
+ return qt(c(c({}, this.config), t)).then(
925
+ (e) => this.setToken(E(this.config), e.token)
914
926
  );
915
927
  }
916
928
  /**
@@ -918,8 +930,8 @@ class _ {
918
930
  * @category Auth
919
931
  */
920
932
  loginPublic(t) {
921
- return vt(a(a({}, this.config), t)).then(
922
- (e) => this.setToken(E(this.config), e.token)
933
+ return vt(c(c({}, this.config), t)).then(
934
+ (e) => this.setToken(b(this.config), e.token)
923
935
  );
924
936
  }
925
937
  /**
@@ -928,8 +940,8 @@ class _ {
928
940
  */
929
941
  logoutPublic() {
930
942
  const t = this.getPublicToken();
931
- return xt(g(a({}, this.config), { token: t })).then(
932
- () => this.removeToken(E(this.config))
943
+ return zt(g(c({}, this.config), { token: t })).then(
944
+ () => this.removeToken(b(this.config))
933
945
  );
934
946
  }
935
947
  /**
@@ -938,8 +950,8 @@ class _ {
938
950
  */
939
951
  logoutEc() {
940
952
  const t = this.getEcToken();
941
- return qt(g(a({}, this.config), { token: t })).then(
942
- () => this.removeToken(T(this.config))
953
+ return xt(g(c({}, this.config), { token: t })).then(
954
+ () => this.removeToken(E(this.config))
943
955
  );
944
956
  }
945
957
  /** @ignore */
@@ -1038,16 +1050,16 @@ class _ {
1038
1050
  * @category Entries
1039
1051
  */
1040
1052
  publicApi() {
1041
- return Ft(this.config);
1053
+ return Kt(this.config);
1042
1054
  }
1043
1055
  /**
1044
1056
  * Loads a DatamanagerResource by its long id. Requires token.
1045
1057
  * @category Admin
1046
1058
  */
1047
1059
  getDatamanager(t) {
1048
- return u(this, null, function* () {
1060
+ return l(this, null, function* () {
1049
1061
  const e = yield this.getBestToken();
1050
- return Kt(g(a({}, this.config), { dmID: t, token: e }));
1062
+ return Nt(g(c({}, this.config), { dmID: t, token: e }));
1051
1063
  });
1052
1064
  }
1053
1065
  /**
@@ -1059,9 +1071,9 @@ class _ {
1059
1071
  * const dms = await fdk("stage").dmList()
1060
1072
  */
1061
1073
  dmList() {
1062
- return u(this, arguments, function* (t = {}) {
1074
+ return l(this, arguments, function* (t = {}) {
1063
1075
  const e = yield this.getBestToken();
1064
- return zt(g(a({}, this.config), { options: t, token: e }));
1076
+ return Ct(g(c({}, this.config), { options: t, token: e }));
1065
1077
  });
1066
1078
  }
1067
1079
  /**
@@ -1073,40 +1085,41 @@ class _ {
1073
1085
  * const models = await fdk("stage").dmID("254a03f1-cb76-4f1e-a52a-bbd4180ca10c").modelList()
1074
1086
  */
1075
1087
  modelList() {
1076
- return u(this, arguments, function* (t = {}) {
1088
+ return l(this, arguments, function* (t = {}) {
1077
1089
  const e = yield this.getBestToken();
1078
- return Ct(g(a({}, this.config), { options: t, token: e }));
1090
+ return Ft(g(c({}, this.config), { options: t, token: e }));
1079
1091
  });
1080
1092
  }
1081
1093
  }
1082
- const Ut = (n) => new _({ env: n }), Mt = (n) => new _({ env: n });
1094
+ const Ut = (n) => new O({ env: n }), Vt = (n) => new O({ env: n });
1083
1095
  export {
1084
- _ as Fdk,
1096
+ O as Fdk,
1085
1097
  Rt as act,
1086
1098
  y as apiURL,
1087
- A as apis,
1099
+ _ as apis,
1088
1100
  ft as assetList,
1089
1101
  pt as createAsset,
1090
1102
  yt as createAssets,
1091
1103
  it as createEntry,
1092
1104
  mt as deleteAsset,
1093
1105
  N as deleteEntry,
1094
- dt as deleteEntryObject,
1095
- kt as dmList,
1106
+ lt as deleteEntryObject,
1107
+ wt as dmList,
1096
1108
  K as editEntry,
1097
- lt as editEntryObject,
1109
+ dt as editEntryObject,
1098
1110
  F as entryList,
1099
1111
  h as expect,
1100
1112
  Ut as fdk,
1101
1113
  p as fetcher,
1114
+ $t as fileVariant,
1102
1115
  ut as filterOptions,
1103
1116
  gt as getAsset,
1104
- $t as getDatamanager,
1117
+ kt as getDatamanager,
1105
1118
  et as getEcAuthKey,
1106
1119
  ot as getEntry,
1107
1120
  ht as getEntryAsset,
1108
1121
  J as getEntryEnv,
1109
- P as getEntryShortID,
1122
+ j as getEntryShortID,
1110
1123
  tt as getPublicAuthKey,
1111
1124
  ct as getSchema,
1112
1125
  Y as loginEc,
@@ -1114,11 +1127,11 @@ export {
1114
1127
  G as logoutEc,
1115
1128
  Z as logoutPublic,
1116
1129
  at as mapEntries,
1117
- wt as modelList,
1130
+ Tt as modelList,
1118
1131
  rt as publicApi,
1119
1132
  k as query,
1120
- Et as raw,
1121
- Tt as resourceList,
1122
- Mt as sdk,
1133
+ bt as raw,
1134
+ Et as resourceList,
1135
+ Vt as sdk,
1123
1136
  I as sdkOptions
1124
1137
  };
@@ -41,4 +41,19 @@ export declare function deleteAsset({ env, dmShortID, assetGroup, assetID, token
41
41
  assetID: any;
42
42
  token: any;
43
43
  }): Promise<void>;
44
+ /**
45
+ * Loads entry list. Expects `dmShortID` / `model` to be set.
46
+ * If the model is not public, you also need to provide a `token`.
47
+ *
48
+ * @param {AssetResouce} asset asset in question.
49
+ * @param {number} size in px to find closest match (larger side)
50
+ * @param {boolean} thumb if true, returns a thumbnail (width = height)
51
+ * @category Assets
52
+ * @example
53
+ * const asset = await ecadmin
54
+ * .assetgroup("test")
55
+ * .getAsset("tP-ZxpZZTGmbPnET-wArAQ");
56
+ * const variant = fileVariant(asset, 128, false);
57
+ */
58
+ export declare function fileVariant(asset: AssetResource, size: number, thumb?: boolean): any;
44
59
  //# sourceMappingURL=assets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/lib/assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAGrD,cAAc;AACd,wBAAsB,QAAQ,CAAC,EAC7B,GAAG,EACH,SAAS,EACT,UAAU,EACV,OAAO,EACP,KAAK,GACN;;;;;;CAAA,GAAG,OAAO,CAAC,aAAa,CAAC,CAMzB;AAED,cAAc;AACd,wBAAsB,SAAS,CAAC,MAAM,KAAA,GAAG,OAAO,CAAC,SAAS,CAAC,CAW1D;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,EAChC,GAAG,EACH,SAAS,EACT,UAAU,EACV,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,OAAO,GACR;;;;;;;;CAAA,GAAG,OAAO,CAAC,aAAa,CAAC,CAqBzB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,EACjC,GAAG,EACH,SAAS,EACT,UAAU,EACV,KAAK,EACL,OAAO,GACR;;;;;;CAAA,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAwB3B;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,EAChC,GAAG,EACH,SAAS,EACT,UAAU,EACV,OAAO,EACP,KAAK,GACN;;;;;;CAAA,iBAUA"}
1
+ {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/lib/assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAGrD,cAAc;AACd,wBAAsB,QAAQ,CAAC,EAC7B,GAAG,EACH,SAAS,EACT,UAAU,EACV,OAAO,EACP,KAAK,GACN;;;;;;CAAA,GAAG,OAAO,CAAC,aAAa,CAAC,CAMzB;AAED,cAAc;AACd,wBAAsB,SAAS,CAAC,MAAM,KAAA,GAAG,OAAO,CAAC,SAAS,CAAC,CAW1D;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,EAChC,GAAG,EACH,SAAS,EACT,UAAU,EACV,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,OAAO,GACR;;;;;;;;CAAA,GAAG,OAAO,CAAC,aAAa,CAAC,CAqBzB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,EACjC,GAAG,EACH,SAAS,EACT,UAAU,EACV,KAAK,EACL,OAAO,GACR;;;;;;CAAA,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAwB3B;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,EAChC,GAAG,EACH,SAAS,EACT,UAAU,EACV,OAAO,EACP,KAAK,GACN;;;;;;CAAA,iBAUA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,UAAQ,OAc5E"}
package/dist/types.d.ts CHANGED
@@ -14,6 +14,7 @@ export type AssetResource = {
14
14
  duplicates: number;
15
15
  file: AssetFile;
16
16
  fileVariants: AssetFile[];
17
+ thumbnails?: any[];
17
18
  };
18
19
  export type EntryResource = Record<string, any> & {
19
20
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,IAAI,CAAC;IACd,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,IAAI,EAAE,CAAC,MAAM,GAAG,GAAG,CAAC,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY,EAAE,SAAS,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAChD,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,IAAI,CAAC;IACf,QAAQ,EAA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AG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7B,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ec.fdk",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "description": "ec frontend sdk",
5
5
  "main": "dist/index.cjs",
6
6
  "directories": {