ec.fdk 0.8.0 → 0.8.2

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,i=(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 l=a=>{try{d(e.next(a))}catch(c){r(c)}},o=a=>{try{d(e.throw(a))}catch(c){r(c)}},d=a=>a.done?s(a.value):Promise.resolve(a.value).then(l,o);d((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 d;const{token:r,rawRes:l}=t;r&&(e.headers=h(i({},e.headers||{}),{Authorization:`Bearer ${r}`}));const o=yield fetch(n,e);if(!o.ok){if((d=o.headers.get("content-type"))!=null&&d.includes("application/json")){const a=yield o.json(),c=`${a.title}
2
- ${a.detail}
3
- ${a.verbose}`;throw new Error(c)}throw new Error(`unexpected fetch error: ${o.statusText}`)}return l?o:yield o.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 l=y(`api/${e}/_auth/login?clientID=rest`,t);return yield f(l,{},{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=i({size:50,page:1,_list:!0},r);const l=$(r),o=y(`api/${e}/${s}?${l}`,t),{count:d,total:a,_embedded:c}=yield f(o,n);let p=c?c[`${e}:${s}`]:[];return p=Array.isArray(p)?p:[p],{count:d,total:a,items:p}})}function X({env:n,dmShortID:t,model:e,entryID:s,token:r}){g({env:n,dmShortID:t,model:e,entryID:s});const l=$({_id:s}),o=y(`api/${t}/${e}?${l}`,n);return f(o,{token:r})}function Y(l){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 o=y(`api/${t}/${e}`,n);return yield f(o,{token:r},{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}})})}function S(d){return u(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,value:r,token:l,safePut:o=!1}){g({env:n,dmShortID:t,model:e,entryID:s,value:r});const a={"Content-Type":"application/json"};if(o){if(!("_modified"in r))throw new Error("expected _modified to be set!");a["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:l},{method:"PUT",headers:a,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 l=y(`api/${t}/${e}?_id=${s}`,n);return f(l,{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:l={}}=n;g({env:e,dmShortID:s,model:r}),n.options=i({size:50,page:1,_list:!0},l);let o=0,d,a=[];for(;d===void 0||o<d;){const c=yield P(n);for(let p of c.items)a.push(yield t(p));o+=c.items.length,d=c.total,n.options.page++}return a})}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 l=y(`api/schema/${t}/${e}`,n),o=yield f(l),d=(p=o==null?void 0:o.allOf)==null?void 0:p[1];if(typeof d.properties!="object")throw new Error(`getSchema: ${l} returned unexpected format: ${JSON.stringify(o)}`);const{properties:a}=d,c=Q(a);for(let w in c){let m=c[w];if(m.required=d.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=a._modelTitle.title,m=a._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)}:i(i(i(i(i(i(i({},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)=>i(i({},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(i({},et(n)),{value:t}));function rt(n,t){const e=O(t);return t._embedded[`${e}:${t._modelTitle}/${n}/asset`]}function ot(l){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 o=$({assetID:s}),d=y(`a/${t}/${e}?${o}`,n),{_embedded:a}=yield f(d,{token:r});return a?a["ec:dm-asset"]:void 0})}function it(n){return u(this,null,function*(){let{env:t,dmShortID:e,assetGroup:s,token:r,options:l={}}=n;g({env:t,dmShortID:e,assetGroup:s}),l=i({size:50,page:1,_list:!0},l);const o=$(l),d=y(`a/${e}/${s}?${o}`,t),{count:a,total:c,_embedded:p}=yield f(d,{token:r});let k=p?p["ec:dm-asset"]:[];return k=Array.isArray(k)?k:[k],{count:a,total:c,items:k}})}function at(d){return u(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,token:s,file:r,name:l,options:o}){g({env:n,dmShortID:t,assetGroup:e,file:r});const a=y(`a/${t}/${e}`,n),c=new FormData;return c.append("file",r,l),o&&Object.keys(o).forEach(k=>{c.append(k,o[k])}),(yield f(a,{token:s},{method:"POST",body:c}))._embedded["ec:dm-asset"]})}function ct(l){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 o=y(`a/${t}/${e}`,n),d=new FormData;return s.forEach(c=>{d.append("file",c)}),r&&Object.keys(r).forEach(c=>{d.append(c,r[c])}),(yield f(o,{},{method:"POST",body:d}))._embedded["ec:dm-asset"]})}function ut(l){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 o=y(`a/${t}/${e}/${s}`,n);yield f(o,{token:r,rawRes:!0},{method:"DELETE"})})}function lt(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 dt(n){return u(this,null,function*(){let{env:t,options:e={}}=n;g({env:t}),e=i({size:25,page:1,_list:!0},e);const s=$(e),r=y(`?${s}`,t),{count:l,total:o,_embedded:d}=yield f(r,n);let a=d?d["ec:datamanager"]:[];return a=Array.isArray(a)?a:[a],{count:l,total:o,items:a}})}function gt(n){return u(this,null,function*(){let{env:t,dmID:e,options:s={}}=n;g({env:t,dmID:e}),s=i({size:25,dataManagerID:e,page:1,_list:!0},s);const r=$(s),l=y(`model?${r}`,t),{count:o,total:d,_embedded:a}=yield f(l,n);let c=a?a["ec:model"]:[];return c=Array.isArray(c)?c:[c],{count:o,total:d,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=i({size:25,page:1,_list:!0},s);const l=$(s),o=y(`${e}?${l}`,t,r),{count:d,total:a,_embedded:c}=yield f(o,n);let p=c?c[Object.keys(c)[0]]:[];return p=Array.isArray(p)?p:[p],{count:d,total:a,items:p}})}function ft(e){return u(this,arguments,function*(n,t={}){let{env:s,route:r,options:l={},subdomain:o="datamanager"}=n;g({env:s,subdomain:o,route:r}),l=i({},l);const d=$(l),a=y(`${r}?${d}`,s,o);return f(a,n,t)})}const _=Object.freeze(Object.defineProperty({__proto__:null,assetList:it,createAsset:at,createAssets:ct,createEntry:Y,deleteAsset:ut,deleteEntry:L,deleteEntryObject:nt,dmList:dt,editEntry:S,editEntryObject:st,entryList:P,filterOptions:tt,getAsset:ot,getDatamanager:lt,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(i(i({},this.config),t))}entries(){return u(this,arguments,function*(t={}){const e=yield this.getBestToken();return C(h(i({},this.config),{options:t,token:e}))})}entryList(t){return u(this,null,function*(){const e=yield this.getBestToken();return C(h(i({},this.config),{options:t,token:e}))})}mapEntries(s){return u(this,arguments,function*(t,e={}){const r=yield this.getBestToken();return bt(h(i({},this.config),{options:e,token:r}),t)})}getEntry(t){return u(this,null,function*(){const e=yield this.getBestToken();return At(h(i({},this.config),{entryID:t,token:e}))})}editEntrySafe(t,e){return u(this,null,function*(){const s=yield this.getBestToken();return K(h(i({},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(i({},this.config),{options:t,token:e}))})}assetList(t){return u(this,null,function*(){const e=yield this.getBestToken();return I(h(i({},this.config),{options:t,token:e}))})}createAsset(t){return u(this,null,function*(){const{file:e,name:s,options:r}=t,l=yield this.getBestToken();return Ot(h(i({},this.config),{file:e,name:s,options:r,token:l}))})}createAssets(t){return u(this,null,function*(){const{files:e,options:s}=t,r=yield this.getBestToken();return jt(h(i({},this.config),{files:e,options:s,token:r}))})}deleteAsset(t){return u(this,null,function*(){const e=yield this.getBestToken();return Pt(h(i({},this.config),{token:e,assetID:t}))})}getAsset(t){return u(this,null,function*(){const e=yield this.getBestToken();return _t(h(i({},this.config),{assetID:t,token:e}))})}createEntry(t){return u(this,null,function*(){const e=yield this.getBestToken();return St(h(i({},this.config),{token:e,value:t}))})}editEntry(t,e){return u(this,null,function*(){const s=yield this.getBestToken();return K(h(i({},this.config),{entryID:t,token:s,value:e}))})}deleteEntry(t){return u(this,null,function*(){const e=yield this.getBestToken();return Lt(h(i({},this.config),{token:e,entryID:t}))})}resourceList(t){return u(this,null,function*(){const e=yield this.getBestToken();return Kt(h(i({},this.config),{options:t,token:e}))})}raw(t,e){return u(this,null,function*(){const s=yield this.getBestToken();return Nt(h(i({},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.get(t,e)}setEcToken(t){this.setToken(b(this.config),t)}setPublicToken(t){this.setToken(A(this.config),t)}loginEc(t){return Dt(i(i({},this.config),t)).then(e=>this.setToken(b(this.config),e.token))}loginPublic(t){return Bt(i(i({},this.config),t)).then(e=>this.setToken(A(this.config),e.token))}logoutPublic(){const t=this.getPublicToken();return Ft(h(i({},this.config),{token:t})).then(()=>this.removeToken(A(this.config)))}logoutEc(){const t=this.getEcToken();return qt(h(i({},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(i({},this.config),{dmID:t,token:e}))})}dmList(){return u(this,arguments,function*(t={}){const e=yield this.getBestToken();return xt(h(i({},this.config),{options:t,token:e}))})}modelList(){return u(this,arguments,function*(t={}){const e=yield this.getBestToken();return zt(h(i({},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=dt;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=lt;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;
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}
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;
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ var M = 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, i = (n, t) => {
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) => {
6
6
  for (var e in t || (t = {}))
7
7
  Q.call(t, e) && v(n, e, t[e]);
8
8
  if (B)
@@ -11,39 +11,39 @@ var v = (n, t, e) => t in n ? M(n, t, { enumerable: !0, configurable: !0, writab
11
11
  return n;
12
12
  }, g = (n, t) => V(n, H(t));
13
13
  var u = (n, t, e) => new Promise((s, r) => {
14
- var l = (a) => {
14
+ var d = (o) => {
15
15
  try {
16
- d(e.next(a));
16
+ l(e.next(o));
17
17
  } catch (c) {
18
18
  r(c);
19
19
  }
20
- }, o = (a) => {
20
+ }, i = (o) => {
21
21
  try {
22
- d(e.throw(a));
22
+ l(e.throw(o));
23
23
  } catch (c) {
24
24
  r(c);
25
25
  }
26
- }, d = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(l, o);
27
- d((e = e.apply(n, t)).next());
26
+ }, l = (o) => o.done ? s(o.value) : Promise.resolve(o.value).then(d, i);
27
+ l((e = e.apply(n, t)).next());
28
28
  });
29
29
  function p(s) {
30
30
  return u(this, arguments, function* (n, t = {}, e = {}) {
31
- var d;
32
- const { token: r, rawRes: l } = t;
33
- r && (e.headers = g(i({}, e.headers || {}), {
31
+ var l;
32
+ const { token: r, rawRes: d } = t;
33
+ r && (e.headers = g(a({}, e.headers || {}), {
34
34
  Authorization: `Bearer ${r}`
35
35
  }));
36
- const o = yield fetch(n, e);
37
- if (!o.ok) {
38
- if ((d = o.headers.get("content-type")) != null && d.includes("application/json")) {
39
- const a = yield o.json(), c = `${a.title}
40
- ${a.detail}
41
- ${a.verbose}`;
36
+ const i = yield fetch(n, e);
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}
40
+ ${o.detail}
41
+ ${o.verbose}`;
42
42
  throw new Error(c);
43
43
  }
44
- throw new Error(`unexpected fetch error: ${o.statusText}`);
44
+ throw new Error(`unexpected fetch error: ${i.statusText}`);
45
45
  }
46
- return l ? o : yield o.json();
46
+ return d ? i : yield i.json();
47
47
  });
48
48
  }
49
49
  const A = {
@@ -96,9 +96,9 @@ function X(n) {
96
96
  return u(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 l = y(`api/${e}/_auth/login?clientID=rest`, t);
99
+ const d = y(`api/${e}/_auth/login?clientID=rest`, t);
100
100
  return yield p(
101
- l,
101
+ d,
102
102
  {},
103
103
  {
104
104
  method: "POST",
@@ -204,10 +204,10 @@ function rt(n) {
204
204
  function F(n) {
205
205
  return u(this, null, function* () {
206
206
  let { env: t, dmShortID: e, model: s, options: r = {} } = n;
207
- h({ env: t, dmShortID: e, model: s }), r = i({ size: 50, page: 1, _list: !0 }, r);
208
- const l = k(r), o = y(`api/${e}/${s}?${l}`, t), { count: d, total: a, _embedded: c } = yield p(o, 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
209
  let f = c ? c[`${e}:${s}`] : [];
210
- return f = Array.isArray(f) ? f : [f], { count: d, total: a, items: f };
210
+ return f = Array.isArray(f) ? f : [f], { count: l, total: o, items: f };
211
211
  });
212
212
  }
213
213
  function ot({
@@ -218,10 +218,10 @@ function ot({
218
218
  token: r
219
219
  }) {
220
220
  h({ env: n, dmShortID: t, model: e, entryID: s });
221
- const l = k({ _id: s }), o = y(`api/${t}/${e}?${l}`, n);
222
- return p(o, { token: r });
221
+ const d = k({ _id: s }), i = y(`api/${t}/${e}?${d}`, n);
222
+ return p(i, { token: r });
223
223
  }
224
- function it(l) {
224
+ function it(d) {
225
225
  return u(this, arguments, function* ({
226
226
  env: n,
227
227
  dmShortID: t,
@@ -230,9 +230,9 @@ function it(l) {
230
230
  token: r
231
231
  }) {
232
232
  h({ env: n, dmShortID: t, model: e, value: s });
233
- const o = y(`api/${t}/${e}`, n);
233
+ const i = y(`api/${t}/${e}`, n);
234
234
  return yield p(
235
- o,
235
+ i,
236
236
  { token: r },
237
237
  {
238
238
  method: "POST",
@@ -244,32 +244,32 @@ function it(l) {
244
244
  );
245
245
  });
246
246
  }
247
- function K(d) {
247
+ function K(l) {
248
248
  return u(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: l,
255
- safePut: o = !1
254
+ token: d,
255
+ safePut: i = !1
256
256
  }) {
257
257
  h({ env: n, dmShortID: t, model: e, entryID: s, value: r });
258
- const a = {
258
+ const o = {
259
259
  "Content-Type": "application/json"
260
260
  };
261
- if (o) {
261
+ if (i) {
262
262
  if (!("_modified" in r))
263
263
  throw new Error("expected _modified to be set!");
264
- a["If-Unmodified-Since"] = new Date(r._modified).toUTCString();
264
+ o["If-Unmodified-Since"] = new Date(r._modified).toUTCString();
265
265
  }
266
266
  const c = y(`api/${t}/${e}?_id=${s}`, n);
267
267
  return r = st(r), r = C(r), yield p(
268
268
  c,
269
- { token: l },
269
+ { token: d },
270
270
  {
271
271
  method: "PUT",
272
- headers: a,
272
+ headers: o,
273
273
  body: JSON.stringify(r)
274
274
  }
275
275
  );
@@ -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 l = y(`api/${t}/${e}?_id=${s}`, n);
286
+ const d = y(`api/${t}/${e}?_id=${s}`, n);
287
287
  return p(
288
- l,
288
+ d,
289
289
  { token: r, rawRes: !0 },
290
290
  {
291
291
  method: "DELETE",
@@ -297,31 +297,31 @@ function N({
297
297
  }
298
298
  function at(n, t) {
299
299
  return u(this, null, function* () {
300
- let { env: e, dmShortID: s, model: r, options: l = {} } = n;
301
- h({ env: e, dmShortID: s, model: r }), n.options = i({ size: 50, page: 1, _list: !0 }, l);
302
- let o = 0, d, a = [];
303
- for (; d === void 0 || o < d; ) {
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
304
  const c = yield F(n);
305
305
  for (let f of c.items)
306
- a.push(yield t(f));
307
- o += c.items.length, d = c.total, n.options.page++;
306
+ o.push(yield t(f));
307
+ i += c.items.length, l = c.total, n.options.page++;
308
308
  }
309
- return a;
309
+ return o;
310
310
  });
311
311
  }
312
312
  function ct(r) {
313
313
  return u(this, arguments, function* ({ env: n, dmShortID: t, model: e, withMetadata: s }) {
314
314
  var f, $, j, S, L;
315
315
  h({ env: n, dmShortID: t, model: e });
316
- const l = y(`api/schema/${t}/${e}`, n), o = yield p(l), d = (f = o == null ? void 0 : o.allOf) == null ? void 0 : f[1];
317
- if (typeof d.properties != "object")
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")
318
318
  throw new Error(
319
- `getSchema: ${l} returned unexpected format: ${JSON.stringify(o)}`
319
+ `getSchema: ${d} returned unexpected format: ${JSON.stringify(i)}`
320
320
  );
321
- const { properties: a } = d, c = C(a);
321
+ const { properties: o } = l, c = C(o);
322
322
  for (let w in c) {
323
323
  let m = c[w];
324
- if (m.required = d.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(">"))) {
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
325
  const O = m.title.split("<")[1].slice(0, -1), U = m.title.split("<")[0];
326
326
  m.type = U, O.includes(":") ? m.resource = O.split(":")[1] : m.resource = O;
327
327
  } else
@@ -329,14 +329,14 @@ function ct(r) {
329
329
  delete c[w].title;
330
330
  }
331
331
  if (s) {
332
- const w = a._modelTitle.title, m = a._modelTitleField.title;
332
+ const w = o._modelTitle.title, m = o._modelTitleField.title;
333
333
  return { properties: c, meta: { modelTitleField: m, modelTitle: w } };
334
334
  }
335
335
  return c;
336
336
  });
337
337
  }
338
338
  function I(n) {
339
- return Object.entries(n).map(([t, e]) => typeof e != "object" ? { [t]: String(e) } : i(i(i(i(i(i(i({}, 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) => i(i({}, t), e), {});
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), {});
340
340
  }
341
341
  const ut = I;
342
342
  function P(n) {
@@ -351,14 +351,14 @@ function J(n) {
351
351
  const R = (n) => {
352
352
  const t = P(n), e = J(n), s = n._modelTitle, r = n.id;
353
353
  return { dmShortID: t, env: e, model: s, entryID: r };
354
- }, lt = (n) => N(R(n)), dt = (n, t) => K(g(i({}, R(n)), {
354
+ }, dt = (n) => N(R(n)), lt = (n, t) => K(g(a({}, R(n)), {
355
355
  value: t
356
356
  }));
357
357
  function ht(n, t) {
358
358
  const e = P(t);
359
359
  return t._embedded[`${e}:${t._modelTitle}/${n}/asset`];
360
360
  }
361
- function gt(l) {
361
+ function gt(d) {
362
362
  return u(this, arguments, function* ({
363
363
  env: n,
364
364
  dmShortID: t,
@@ -367,35 +367,35 @@ function gt(l) {
367
367
  token: r
368
368
  }) {
369
369
  h({ env: n, dmShortID: t, assetGroup: e, assetID: s });
370
- const o = k({ assetID: s }), d = y(`a/${t}/${e}?${o}`, n), { _embedded: a } = yield p(d, { token: r });
371
- return a ? a["ec:dm-asset"] : void 0;
370
+ const i = k({ assetID: s }), l = y(`a/${t}/${e}?${i}`, n), { _embedded: o } = yield p(l, { token: r });
371
+ return o ? o["ec:dm-asset"] : void 0;
372
372
  });
373
373
  }
374
374
  function ft(n) {
375
375
  return u(this, null, function* () {
376
- let { env: t, dmShortID: e, assetGroup: s, token: r, options: l = {} } = n;
377
- h({ env: t, dmShortID: e, assetGroup: s }), l = i({ size: 50, page: 1, _list: !0 }, l);
378
- const o = k(l), d = y(`a/${e}/${s}?${o}`, t), { count: a, total: c, _embedded: f } = yield p(d, { token: r });
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 });
379
379
  let $ = f ? f["ec:dm-asset"] : [];
380
- return $ = Array.isArray($) ? $ : [$], { count: a, total: c, items: $ };
380
+ return $ = Array.isArray($) ? $ : [$], { count: o, total: c, items: $ };
381
381
  });
382
382
  }
383
- function pt(d) {
383
+ function pt(l) {
384
384
  return u(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: l,
391
- options: o
390
+ name: d,
391
+ options: i
392
392
  }) {
393
393
  h({ env: n, dmShortID: t, assetGroup: e, file: r });
394
- const a = y(`a/${t}/${e}`, n), c = new FormData();
395
- return c.append("file", r, l), o && Object.keys(o).forEach(($) => {
396
- c.append($, o[$]);
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[$]);
397
397
  }), (yield p(
398
- a,
398
+ o,
399
399
  { token: s },
400
400
  {
401
401
  method: "POST",
@@ -404,7 +404,7 @@ function pt(d) {
404
404
  ))._embedded["ec:dm-asset"];
405
405
  });
406
406
  }
407
- function yt(l) {
407
+ function yt(d) {
408
408
  return u(this, arguments, function* ({
409
409
  env: n,
410
410
  dmShortID: t,
@@ -413,26 +413,28 @@ function yt(l) {
413
413
  options: r
414
414
  }) {
415
415
  h({ env: n, dmShortID: t, assetGroup: e, files: s });
416
- const o = y(`a/${t}/${e}`, n), d = new FormData();
417
- return s.forEach((c) => {
418
- d.append(
416
+ const i = y(`a/${t}/${e}`, n), l = new FormData();
417
+ s.forEach((c) => {
418
+ l.append(
419
419
  "file",
420
420
  c
421
421
  /* , name */
422
422
  );
423
423
  }), r && Object.keys(r).forEach((c) => {
424
- d.append(c, r[c]);
425
- }), (yield p(
426
- o,
424
+ l.append(c, r[c]);
425
+ });
426
+ const o = yield p(
427
+ i,
427
428
  {},
428
429
  {
429
430
  method: "POST",
430
- body: d
431
+ body: l
431
432
  }
432
- ))._embedded["ec:dm-asset"];
433
+ );
434
+ return Array.isArray(o._embedded["ec:dm-asset"]) ? o._embedded["ec:dm-asset"] : [o._embedded["ec:dm-asset"]];
433
435
  });
434
436
  }
435
- function mt(l) {
437
+ function mt(d) {
436
438
  return u(this, arguments, function* ({
437
439
  env: n,
438
440
  dmShortID: t,
@@ -441,9 +443,9 @@ function mt(l) {
441
443
  token: r
442
444
  }) {
443
445
  h({ env: n, dmShortID: t, assetGroup: e, assetID: s });
444
- const o = y(`a/${t}/${e}/${s}`, n);
446
+ const i = y(`a/${t}/${e}/${s}`, n);
445
447
  yield p(
446
- o,
448
+ i,
447
449
  { token: r, rawRes: !0 },
448
450
  {
449
451
  method: "DELETE"
@@ -462,36 +464,36 @@ function $t(n) {
462
464
  function kt(n) {
463
465
  return u(this, null, function* () {
464
466
  let { env: t, options: e = {} } = n;
465
- h({ env: t }), e = i({ size: 25, page: 1, _list: !0 }, e);
466
- const s = k(e), r = y(`?${s}`, t), { count: l, total: o, _embedded: d } = yield p(r, n);
467
- let a = d ? d["ec:datamanager"] : [];
468
- return a = Array.isArray(a) ? a : [a], { count: l, total: o, items: a };
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 };
469
471
  });
470
472
  }
471
473
  function wt(n) {
472
474
  return u(this, null, function* () {
473
475
  let { env: t, dmID: e, options: s = {} } = n;
474
- h({ env: t, dmID: e }), s = i({ size: 25, dataManagerID: e, page: 1, _list: !0 }, s);
475
- const r = k(s), l = y(`model?${r}`, t), { count: o, total: d, _embedded: a } = yield p(l, n);
476
- let c = a ? a["ec:model"] : [];
477
- return c = Array.isArray(c) ? c : [c], { count: o, total: d, items: c };
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 };
478
480
  });
479
481
  }
480
482
  function Tt(n) {
481
483
  return u(this, null, function* () {
482
484
  let { env: t, resource: e, options: s = {}, subdomain: r = "datamanager" } = n;
483
- h({ env: t, subdomain: r, resource: e }), s = i({ size: 25, page: 1, _list: !0 }, s);
484
- const l = k(s), o = y(`${e}?${l}`, t, r), { count: d, total: a, _embedded: c } = yield p(o, 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);
485
487
  let f = c ? c[Object.keys(c)[0]] : [];
486
- return f = Array.isArray(f) ? f : [f], { count: d, total: a, items: f };
488
+ return f = Array.isArray(f) ? f : [f], { count: l, total: o, items: f };
487
489
  });
488
490
  }
489
491
  function Et(e) {
490
492
  return u(this, arguments, function* (n, t = {}) {
491
- let { env: s, route: r, options: l = {}, subdomain: o = "datamanager" } = n;
492
- h({ env: s, subdomain: o, route: r }), l = i({}, l);
493
- const d = k(l), a = y(`${r}?${d}`, s, o);
494
- return p(a, 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);
496
+ return p(o, n, t);
495
497
  });
496
498
  }
497
499
  const b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -502,10 +504,10 @@ const b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
502
504
  createEntry: it,
503
505
  deleteAsset: mt,
504
506
  deleteEntry: N,
505
- deleteEntryObject: lt,
507
+ deleteEntryObject: dt,
506
508
  dmList: kt,
507
509
  editEntry: K,
508
- editEntryObject: dt,
510
+ editEntryObject: lt,
509
511
  entryList: F,
510
512
  filterOptions: ut,
511
513
  getAsset: gt,
@@ -578,13 +580,13 @@ class _ {
578
580
  }
579
581
  /** @ignore */
580
582
  set(t) {
581
- return new _(i(i({}, this.config), t));
583
+ return new _(a(a({}, this.config), t));
582
584
  }
583
585
  /** @ignore */
584
586
  entries() {
585
587
  return u(this, arguments, function* (t = {}) {
586
588
  const e = yield this.getBestToken();
587
- return D(g(i({}, this.config), { options: t, token: e }));
589
+ return D(g(a({}, this.config), { options: t, token: e }));
588
590
  });
589
591
  }
590
592
  /**
@@ -603,7 +605,7 @@ class _ {
603
605
  entryList(t) {
604
606
  return u(this, null, function* () {
605
607
  const e = yield this.getBestToken();
606
- return D(g(i({}, this.config), { options: t, token: e }));
608
+ return D(g(a({}, this.config), { options: t, token: e }));
607
609
  });
608
610
  }
609
611
  /**
@@ -620,7 +622,7 @@ class _ {
620
622
  mapEntries(s) {
621
623
  return u(this, arguments, function* (t, e = {}) {
622
624
  const r = yield this.getBestToken();
623
- return bt(g(i({}, this.config), { options: e, token: r }), t);
625
+ return bt(g(a({}, this.config), { options: e, token: r }), t);
624
626
  });
625
627
  }
626
628
  /**
@@ -633,7 +635,7 @@ class _ {
633
635
  getEntry(t) {
634
636
  return u(this, null, function* () {
635
637
  const e = yield this.getBestToken();
636
- return At(g(i({}, this.config), { entryID: t, token: e }));
638
+ return At(g(a({}, this.config), { entryID: t, token: e }));
637
639
  });
638
640
  }
639
641
  /**
@@ -653,7 +655,7 @@ class _ {
653
655
  editEntrySafe(t, e) {
654
656
  return u(this, null, function* () {
655
657
  const s = yield this.getBestToken();
656
- return x(g(i({}, this.config), { entryID: t, token: s, value: e, safePut: !0 }));
658
+ return x(g(a({}, this.config), { entryID: t, token: s, value: e, safePut: !0 }));
657
659
  });
658
660
  }
659
661
  /**
@@ -672,7 +674,7 @@ class _ {
672
674
  assets(t) {
673
675
  return u(this, null, function* () {
674
676
  const e = yield this.getBestToken();
675
- return q(g(i({}, this.config), { options: t, token: e }));
677
+ return q(g(a({}, this.config), { options: t, token: e }));
676
678
  });
677
679
  }
678
680
  /**
@@ -689,7 +691,7 @@ class _ {
689
691
  assetList(t) {
690
692
  return u(this, null, function* () {
691
693
  const e = yield this.getBestToken();
692
- return q(g(i({}, this.config), { options: t, token: e }));
694
+ return q(g(a({}, this.config), { options: t, token: e }));
693
695
  });
694
696
  }
695
697
  /**
@@ -713,8 +715,8 @@ class _ {
713
715
  */
714
716
  createAsset(t) {
715
717
  return u(this, null, function* () {
716
- const { file: e, name: s, options: r } = t, l = yield this.getBestToken();
717
- return Ot(g(i({}, this.config), { file: e, name: s, options: r, token: l }));
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 }));
718
720
  });
719
721
  }
720
722
  /**
@@ -739,7 +741,7 @@ class _ {
739
741
  createAssets(t) {
740
742
  return u(this, null, function* () {
741
743
  const { files: e, options: s } = t, r = yield this.getBestToken();
742
- return Pt(g(i({}, this.config), { files: e, options: s, token: r }));
744
+ return Pt(g(a({}, this.config), { files: e, options: s, token: r }));
743
745
  });
744
746
  }
745
747
  /**
@@ -753,7 +755,7 @@ class _ {
753
755
  deleteAsset(t) {
754
756
  return u(this, null, function* () {
755
757
  const e = yield this.getBestToken();
756
- return jt(g(i({}, this.config), { token: e, assetID: t }));
758
+ return jt(g(a({}, this.config), { token: e, assetID: t }));
757
759
  });
758
760
  }
759
761
  /**
@@ -766,7 +768,7 @@ class _ {
766
768
  getAsset(t) {
767
769
  return u(this, null, function* () {
768
770
  const e = yield this.getBestToken();
769
- return _t(g(i({}, this.config), { assetID: t, token: e }));
771
+ return _t(g(a({}, this.config), { assetID: t, token: e }));
770
772
  });
771
773
  }
772
774
  /**
@@ -780,7 +782,7 @@ class _ {
780
782
  createEntry(t) {
781
783
  return u(this, null, function* () {
782
784
  const e = yield this.getBestToken();
783
- return St(g(i({}, this.config), { token: e, value: t }));
785
+ return St(g(a({}, this.config), { token: e, value: t }));
784
786
  });
785
787
  }
786
788
  /**
@@ -795,7 +797,7 @@ class _ {
795
797
  editEntry(t, e) {
796
798
  return u(this, null, function* () {
797
799
  const s = yield this.getBestToken();
798
- return x(g(i({}, this.config), { entryID: t, token: s, value: e }));
800
+ return x(g(a({}, this.config), { entryID: t, token: s, value: e }));
799
801
  });
800
802
  }
801
803
  /**
@@ -810,7 +812,7 @@ class _ {
810
812
  deleteEntry(t) {
811
813
  return u(this, null, function* () {
812
814
  const e = yield this.getBestToken();
813
- return Lt(g(i({}, this.config), { token: e, entryID: t }));
815
+ return Lt(g(a({}, this.config), { token: e, entryID: t }));
814
816
  });
815
817
  }
816
818
  /**
@@ -824,7 +826,7 @@ class _ {
824
826
  resourceList(t) {
825
827
  return u(this, null, function* () {
826
828
  const e = yield this.getBestToken();
827
- return Nt(g(i({}, this.config), { options: t, token: e }));
829
+ return Nt(g(a({}, this.config), { options: t, token: e }));
828
830
  });
829
831
  }
830
832
  /**
@@ -840,7 +842,7 @@ class _ {
840
842
  raw(t, e) {
841
843
  return u(this, null, function* () {
842
844
  const s = yield this.getBestToken();
843
- return It(g(i({}, this.config), { options: t, token: s }), e);
845
+ return It(g(a({}, this.config), { options: t, token: s }), e);
844
846
  });
845
847
  }
846
848
  /**
@@ -884,7 +886,7 @@ class _ {
884
886
  setToken(t, e) {
885
887
  if (!this.config.storageAdapter)
886
888
  throw new Error("cannot setEcToken: no storageAdapter defined!");
887
- return this.config.storageAdapter.get(t, e);
889
+ return this.config.storageAdapter.set(t, e);
888
890
  }
889
891
  /**
890
892
  * Manually set ec user token on the {@link Fdk.authStorage}. In most cases, you'd want to use {@link Fdk.token} instead!
@@ -907,7 +909,7 @@ class _ {
907
909
  * @category Auth
908
910
  */
909
911
  loginEc(t) {
910
- return Dt(i(i({}, this.config), t)).then(
912
+ return Dt(a(a({}, this.config), t)).then(
911
913
  (e) => this.setToken(T(this.config), e.token)
912
914
  );
913
915
  }
@@ -916,7 +918,7 @@ class _ {
916
918
  * @category Auth
917
919
  */
918
920
  loginPublic(t) {
919
- return vt(i(i({}, this.config), t)).then(
921
+ return vt(a(a({}, this.config), t)).then(
920
922
  (e) => this.setToken(E(this.config), e.token)
921
923
  );
922
924
  }
@@ -926,7 +928,7 @@ class _ {
926
928
  */
927
929
  logoutPublic() {
928
930
  const t = this.getPublicToken();
929
- return xt(g(i({}, this.config), { token: t })).then(
931
+ return xt(g(a({}, this.config), { token: t })).then(
930
932
  () => this.removeToken(E(this.config))
931
933
  );
932
934
  }
@@ -936,7 +938,7 @@ class _ {
936
938
  */
937
939
  logoutEc() {
938
940
  const t = this.getEcToken();
939
- return qt(g(i({}, this.config), { token: t })).then(
941
+ return qt(g(a({}, this.config), { token: t })).then(
940
942
  () => this.removeToken(T(this.config))
941
943
  );
942
944
  }
@@ -1045,7 +1047,7 @@ class _ {
1045
1047
  getDatamanager(t) {
1046
1048
  return u(this, null, function* () {
1047
1049
  const e = yield this.getBestToken();
1048
- return Kt(g(i({}, this.config), { dmID: t, token: e }));
1050
+ return Kt(g(a({}, this.config), { dmID: t, token: e }));
1049
1051
  });
1050
1052
  }
1051
1053
  /**
@@ -1059,7 +1061,7 @@ class _ {
1059
1061
  dmList() {
1060
1062
  return u(this, arguments, function* (t = {}) {
1061
1063
  const e = yield this.getBestToken();
1062
- return zt(g(i({}, this.config), { options: t, token: e }));
1064
+ return zt(g(a({}, this.config), { options: t, token: e }));
1063
1065
  });
1064
1066
  }
1065
1067
  /**
@@ -1073,7 +1075,7 @@ class _ {
1073
1075
  modelList() {
1074
1076
  return u(this, arguments, function* (t = {}) {
1075
1077
  const e = yield this.getBestToken();
1076
- return Ct(g(i({}, this.config), { options: t, token: e }));
1078
+ return Ct(g(a({}, this.config), { options: t, token: e }));
1077
1079
  });
1078
1080
  }
1079
1081
  }
@@ -1089,10 +1091,10 @@ export {
1089
1091
  it as createEntry,
1090
1092
  mt as deleteAsset,
1091
1093
  N as deleteEntry,
1092
- lt as deleteEntryObject,
1094
+ dt as deleteEntryObject,
1093
1095
  kt as dmList,
1094
1096
  K as editEntry,
1095
- dt as editEntryObject,
1097
+ lt as editEntryObject,
1096
1098
  F as entryList,
1097
1099
  h as expect,
1098
1100
  Ut as fdk,
package/dist/lib/api.d.ts CHANGED
@@ -183,7 +183,7 @@ export declare class Fdk {
183
183
  createAssets(config: {
184
184
  files: Blob[];
185
185
  options: AssetCreateOptions;
186
- }): Promise<import("src/types").AssetList>;
186
+ }): Promise<import("src/types").AssetResource[]>;
187
187
  /**
188
188
  * Deletes an asset. Expects `dmShortID` / `assetGroup` / `assetID` to be set.
189
189
  * You probably also need to provide a `token`.
@@ -30,7 +30,7 @@ export declare function createAssets({ env, dmShortID, assetGroup, files, option
30
30
  assetGroup: any;
31
31
  files: any;
32
32
  options: any;
33
- }): Promise<AssetList>;
33
+ }): Promise<AssetResource[]>;
34
34
  /**
35
35
  * @ignore
36
36
  */
@@ -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,SAAS,CAAC,CAqBrB;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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ec.fdk",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "ec frontend sdk",
5
5
  "main": "dist/index.cjs",
6
6
  "directories": {