ec.fdk 0.7.3 → 0.8.1

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/README.md CHANGED
@@ -212,6 +212,6 @@ api.assetGroup(group).getAsset(img);
212
212
 
213
213
  0. `cd packages/ec.fdk`
214
214
  1. bump version in `packages/ec.fdk/package.json`
215
- 2. run `pnpm docs` to regenerate docs folder
215
+ 2. run `npm run docs` to regenerate docs folder
216
216
  3. commit + push
217
217
  4. run `pnpm publish`
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var pt=Object.defineProperty,yt=Object.defineProperties;var mt=Object.getOwnPropertyDescriptors;var x=Object.getOwnPropertySymbols;var kt=Object.prototype.hasOwnProperty,$t=Object.prototype.propertyIsEnumerable;var z=(n,t,e)=>t in n?pt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,o=(n,t)=>{for(var e in t||(t={}))kt.call(t,e)&&z(n,e,t[e]);if(x)for(var e of x(t))$t.call(t,e)&&z(n,e,t[e]);return n},h=(n,t)=>yt(n,mt(t));var a=(n,t,e)=>new Promise((s,r)=>{var u=c=>{try{d(e.next(c))}catch(l){r(l)}},i=c=>{try{d(e.throw(c))}catch(l){r(l)}},d=c=>c.done?s(c.value):Promise.resolve(c.value).then(u,i);d((e=e.apply(n,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function p(s){return a(this,arguments,function*(n,t={},e={}){var d;const{token:r,rawRes:u}=t;r&&(e.headers=h(o({},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 c=yield i.json(),l=`${c.title}
2
- ${c.detail}
3
- ${c.verbose}`;throw new Error(l)}throw new Error(`unexpected fetch error: ${i.statusText}`)}return u?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 a(this,null,function*(){let{env:t,dmShortID:e,email:s,password:r}=n;g({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 R(n){return a(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 p(r,{},{method:"POST",body:JSON.stringify({email:e,password:s}),headers:{"Content-Type":"application/json"}})})}function U(n){return a(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 p(r,{rawRes:!0},{method:"POST"})})}function M(n){return a(this,null,function*(){let{env:t,token:e}=n;g({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 g({dmShortID:n}),n}function G({env:n}){return g({env:n}),n}let wt=["created","creator","id","modified","private","_created","_creator","_embedded","_entryTitle","_id","_links","_modelTitle","_modelTitleField","_modified"];function H(n){let t={};for(let e in n)wt.includes(e)||(t[e]=n[e]);return t}function Et(n){return JSON.parse(JSON.stringify(n))}function Q(n){return a(this,null,function*(){let{env:t,dmShortID:e}=n;g({env:t,dmShortID:e});const s=y(`api/${e}`,t);return p(s,n)})}function S(n){return a(this,null,function*(){let{env:t,dmShortID:e,model:s,options:r={}}=n;g({env:t,dmShortID:e,model:s}),r=o({size:50,page:1,_list:!0},r);const u=$(r),i=y(`api/${e}/${s}?${u}`,t),{count:d,total:c,_embedded:l}=yield p(i,n);let f=l?l[`${e}:${s}`]:[];return f=Array.isArray(f)?f:[f],{count:d,total:c,items:f}})}function W({env:n,dmShortID:t,model:e,entryID:s,token:r}){g({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 X(u){return a(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 p(i,{token:r},{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}})})}function P(d){return a(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,value:r,token:u,safePut:i=!1}){g({env:n,dmShortID:t,model:e,entryID:s,value:r});const c={"Content-Type":"application/json"};if(i){if(!("_modified"in r))throw new Error("expected _modified to be set!");c["If-Unmodified-Since"]=new Date(r._modified).toUTCString()}const l=y(`api/${t}/${e}?_id=${s}`,n);return r=Et(r),r=H(r),yield p(l,{token:u},{method:"PUT",headers:c,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 u=y(`api/${t}/${e}?_id=${s}`,n);return p(u,{token:r,rawRes:!0},{method:"DELETE",headers:{"Content-Type":"application/json"}})}function Y(n,t){return a(this,null,function*(){let{env:e,dmShortID:s,model:r,options:u={}}=n;g({env:e,dmShortID:s,model:r}),n.options=o({size:50,page:1,_list:!0},u);let i=0,d,c=[];for(;d===void 0||i<d;){const l=yield S(n);for(let f of l.items)c.push(yield t(f));i+=l.items.length,d=l.total,n.options.page++}return c})}function Z(r){return a(this,arguments,function*({env:n,dmShortID:t,model:e,withMetadata:s}){var f,k,D,q,I;g({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:c}=d,l=H(c);for(let w in l){let m=l[w];if(m.required=d.required.includes(w),(k=l[w])!=null&&k.oneOf&&((D=l[w])==null||delete D.oneOf),(q=m.title)!=null&&q.includes("<")&&((I=m.title)!=null&&I.includes(">"))){const j=m.title.split("<")[1].slice(0,-1),ft=m.title.split("<")[0];m.type=ft,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 l[w].title}if(s){const w=c._modelTitle.title,m=c._modelTitleField.title;return{properties:l,meta:{modelTitleField:m,modelTitle:w}}}return l})}function v(n){return Object.entries(n).map(([t,e])=>typeof e!="object"?{[t]:String(e)}:o(o(o(o(o(o(o({},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)=>o(o({},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)=>P(h(o({},et(n)),{value:t}));function rt(n,t){const e=O(t);return t._embedded[`${e}:${t._modelTitle}/${n}/asset`]}function ot(u){return a(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}),d=y(`a/${t}/${e}?${i}`,n),{_embedded:c}=yield p(d,{token:r});return c?c["ec:dm-asset"]:void 0})}function it(n){return a(this,null,function*(){let{env:t,dmShortID:e,assetGroup:s,token:r,options:u={}}=n;g({env:t,dmShortID:e,assetGroup:s}),u=o({size:50,page:1,_list:!0},u);const i=$(u),d=y(`a/${e}/${s}?${i}`,t),{count:c,total:l,_embedded:f}=yield p(d,{token:r});let k=f?f["ec:dm-asset"]:[];return k=Array.isArray(k)?k:[k],{count:c,total:l,items:k}})}function ct(d){return a(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,token:s,file:r,name:u,options:i}){g({env:n,dmShortID:t,assetGroup:e,file:r});const c=y(`a/${t}/${e}`,n),l=new FormData;return l.append("file",r,u),i&&Object.keys(i).forEach(k=>{l.append(k,i[k])}),(yield p(c,{token:s},{method:"POST",body:l}))._embedded["ec:dm-asset"]})}function at(u){return a(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 p(i,{token:r,rawRes:!0},{method:"DELETE"})})}function ut(n){return a(this,null,function*(){let{env:t,dmID:e,token:s}=n;g({env:t,dmID:e});const r=y(`?dataManagerID=${e}`,t);return p(r,{token:s})})}function lt(n){return a(this,null,function*(){let{env:t,options:e={}}=n;g({env:t}),e=o({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 c=d?d["ec:datamanager"]:[];return c=Array.isArray(c)?c:[c],{count:u,total:i,items:c}})}function dt(n){return a(this,null,function*(){let{env:t,dmID:e,options:s={}}=n;g({env:t,dmID:e}),s=o({size:25,dataManagerID:e,page:1,_list:!0},s);const r=$(s),u=y(`model?${r}`,t),{count:i,total:d,_embedded:c}=yield p(u,n);let l=c?c["ec:model"]:[];return l=Array.isArray(l)?l:[l],{count:i,total:d,items:l}})}function gt(n){return a(this,null,function*(){let{env:t,resource:e,options:s={},subdomain:r="datamanager"}=n;g({env:t,subdomain:r,resource:e}),s=o({size:25,page:1,_list:!0},s);const u=$(s),i=y(`${e}?${u}`,t,r),{count:d,total:c,_embedded:l}=yield p(i,n);let f=l?l[Object.keys(l)[0]]:[];return f=Array.isArray(f)?f:[f],{count:d,total:c,items:f}})}function ht(e){return a(this,arguments,function*(n,t={}){let{env:s,route:r,options:u={},subdomain:i="datamanager"}=n;g({env:s,subdomain:i,route:r}),u=o({},u);const d=$(u),c=y(`${r}?${d}`,s,i);return p(c,n,t)})}const _=Object.freeze(Object.defineProperty({__proto__:null,assetList:it,createAsset:ct,createEntry:X,deleteAsset:at,deleteEntry:L,deleteEntryObject:nt,dmList:lt,editEntry:P,editEntryObject:st,entryList:S,filterOptions:tt,getAsset:ot,getDatamanager:ut,getEcAuthKey:G,getEntry:W,getEntryAsset:rt,getEntryEnv:B,getEntryShortID:O,getPublicAuthKey:V,getSchema:Z,loginEc:R,loginPublic:J,logoutEc:M,logoutPublic:U,mapEntries:Y,modelList:dt,publicApi:Q,raw:ht,resourceList:gt,sdkOptions:v},Symbol.toStringTag,{value:"Module"})),{entryList:C,mapEntries:Tt,getEntry:bt,getAsset:At,assetList:F,createAsset:_t,deleteAsset:Ot,createEntry:jt,editEntry:K,deleteEntry:St,getSchema:Pt,loginPublic:Lt,loginEc:vt,logoutEc:Bt,logoutPublic:Dt,getEcAuthKey:b,getPublicAuthKey:A,dmList:qt,modelList:It,publicApi:xt,getDatamanager:zt,resourceList:Ct,raw:Ft}=_;function Kt(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(o(o({},this.config),t))}entries(){return a(this,arguments,function*(t={}){const e=yield this.getBestToken();return C(h(o({},this.config),{options:t,token:e}))})}entryList(t){return a(this,null,function*(){const e=yield this.getBestToken();return C(h(o({},this.config),{options:t,token:e}))})}mapEntries(s){return a(this,arguments,function*(t,e={}){const r=yield this.getBestToken();return Tt(h(o({},this.config),{options:e,token:r}),t)})}getEntry(t){return a(this,null,function*(){const e=yield this.getBestToken();return bt(h(o({},this.config),{entryID:t,token:e}))})}editEntrySafe(t,e){return a(this,null,function*(){const s=yield this.getBestToken();return K(h(o({},this.config),{entryID:t,token:s,value:e,safePut:!0}))})}getSchema(){return a(this,null,function*(){return Pt(this.config)})}assets(t){return a(this,null,function*(){const e=yield this.getBestToken();return F(h(o({},this.config),{options:t,token:e}))})}assetList(t){return a(this,null,function*(){const e=yield this.getBestToken();return F(h(o({},this.config),{options:t,token:e}))})}createAsset(t){return a(this,null,function*(){const{file:e,name:s,options:r}=t,u=yield this.getBestToken();return _t(h(o({},this.config),{file:e,name:s,options:r,token:u}))})}deleteAsset(t){return a(this,null,function*(){const e=yield this.getBestToken();return Ot(h(o({},this.config),{token:e,assetID:t}))})}getAsset(t){return a(this,null,function*(){const e=yield this.getBestToken();return At(h(o({},this.config),{assetID:t,token:e}))})}createEntry(t){return a(this,null,function*(){const e=yield this.getBestToken();return jt(h(o({},this.config),{token:e,value:t}))})}editEntry(t,e){return a(this,null,function*(){const s=yield this.getBestToken();return K(h(o({},this.config),{entryID:t,token:s,value:e}))})}deleteEntry(t){return a(this,null,function*(){const e=yield this.getBestToken();return St(h(o({},this.config),{token:e,entryID:t}))})}resourceList(t){return a(this,null,function*(){const e=yield this.getBestToken();return Ct(h(o({},this.config),{options:t,token:e}))})}raw(t,e){return a(this,null,function*(){const s=yield this.getBestToken();return Ft(h(o({},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 vt(o(o({},this.config),t)).then(e=>this.setToken(b(this.config),e.token))}loginPublic(t){return Lt(o(o({},this.config),t)).then(e=>this.setToken(A(this.config),e.token))}logoutPublic(){const t=this.getPublicToken();return Dt(h(o({},this.config),{token:t})).then(()=>this.removeToken(A(this.config)))}logoutEc(){const t=this.getEcToken();return Bt(h(o({},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 xt(this.config)}getDatamanager(t){return a(this,null,function*(){const e=yield this.getBestToken();return zt(h(o({},this.config),{dmID:t,token:e}))})}dmList(){return a(this,arguments,function*(t={}){const e=yield this.getBestToken();return qt(h(o({},this.config),{options:t,token:e}))})}modelList(){return a(this,arguments,function*(t={}){const e=yield this.getBestToken();return It(h(o({},this.config),{options:t,token:e}))})}}const Nt=n=>new T({env:n}),Jt=n=>new T({env:n});exports.Fdk=T;exports.act=Kt;exports.apiURL=y;exports.apis=E;exports.assetList=it;exports.createAsset=ct;exports.createEntry=X;exports.deleteAsset=at;exports.deleteEntry=L;exports.deleteEntryObject=nt;exports.dmList=lt;exports.editEntry=P;exports.editEntryObject=st;exports.entryList=S;exports.expect=g;exports.fdk=Nt;exports.fetcher=p;exports.filterOptions=tt;exports.getAsset=ot;exports.getDatamanager=ut;exports.getEcAuthKey=G;exports.getEntry=W;exports.getEntryAsset=rt;exports.getEntryEnv=B;exports.getEntryShortID=O;exports.getPublicAuthKey=V;exports.getSchema=Z;exports.loginEc=R;exports.loginPublic=J;exports.logoutEc=M;exports.logoutPublic=U;exports.mapEntries=Y;exports.modelList=dt;exports.publicApi=Q;exports.query=$;exports.raw=ht;exports.resourceList=gt;exports.sdk=Jt;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.get(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
@@ -1,49 +1,49 @@
1
1
  var M = Object.defineProperty, V = Object.defineProperties;
2
- var G = Object.getOwnPropertyDescriptors;
3
- var v = Object.getOwnPropertySymbols;
4
- var H = Object.prototype.hasOwnProperty, Q = Object.prototype.propertyIsEnumerable;
5
- var B = (n, t, e) => t in n ? M(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, o = (n, t) => {
2
+ var H = Object.getOwnPropertyDescriptors;
3
+ var B = Object.getOwnPropertySymbols;
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) => {
6
6
  for (var e in t || (t = {}))
7
- H.call(t, e) && B(n, e, t[e]);
8
- if (v)
9
- for (var e of v(t))
10
- Q.call(t, e) && B(n, e, t[e]);
7
+ Q.call(t, e) && v(n, e, t[e]);
8
+ if (B)
9
+ for (var e of B(t))
10
+ W.call(t, e) && v(n, e, t[e]);
11
11
  return n;
12
- }, h = (n, t) => V(n, G(t));
13
- var c = (n, t, e) => new Promise((s, r) => {
14
- var u = (a) => {
12
+ }, g = (n, t) => V(n, H(t));
13
+ var u = (n, t, e) => new Promise((s, r) => {
14
+ var d = (o) => {
15
15
  try {
16
- d(e.next(a));
17
- } catch (l) {
18
- r(l);
16
+ l(e.next(o));
17
+ } catch (c) {
18
+ r(c);
19
19
  }
20
- }, i = (a) => {
20
+ }, i = (o) => {
21
21
  try {
22
- d(e.throw(a));
23
- } catch (l) {
24
- r(l);
22
+ l(e.throw(o));
23
+ } catch (c) {
24
+ r(c);
25
25
  }
26
- }, d = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(u, i);
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
- return c(this, arguments, function* (n, t = {}, e = {}) {
31
- var d;
32
- const { token: r, rawRes: u } = t;
33
- r && (e.headers = h(o({}, e.headers || {}), {
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 || {}), {
34
34
  Authorization: `Bearer ${r}`
35
35
  }));
36
36
  const i = yield fetch(n, e);
37
37
  if (!i.ok) {
38
- if ((d = i.headers.get("content-type")) != null && d.includes("application/json")) {
39
- const a = yield i.json(), l = `${a.title}
40
- ${a.detail}
41
- ${a.verbose}`;
42
- throw new Error(l);
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
+ throw new Error(c);
43
43
  }
44
44
  throw new Error(`unexpected fetch error: ${i.statusText}`);
45
45
  }
46
- return u ? i : yield i.json();
46
+ return d ? i : yield i.json();
47
47
  });
48
48
  }
49
49
  const A = {
@@ -82,7 +82,7 @@ function y(n, t = "stage", e = "datamanager") {
82
82
  function k(n, t = !0) {
83
83
  return Object.entries(n).sort((e, s) => e[0].localeCompare(s[0])).map(([e, s]) => `${e}=${s}`).join("&");
84
84
  }
85
- function g(n) {
85
+ function h(n) {
86
86
  Object.entries(n).forEach(([t, e]) => {
87
87
  if (e === void 0)
88
88
  throw new Error(`expected ${t} to be set!`);
@@ -92,13 +92,13 @@ const z = {
92
92
  stage: "https://accounts.cachena.entrecode.de/",
93
93
  live: "https://accounts.entrecode.de/"
94
94
  };
95
- function W(n) {
96
- return c(this, null, function* () {
95
+ function X(n) {
96
+ return u(this, null, function* () {
97
97
  let { env: t, dmShortID: e, email: s, password: r } = n;
98
- g({ env: t, dmShortID: e, email: s, password: r });
99
- const u = y(`api/${e}/_auth/login?clientID=rest`, t);
98
+ h({ env: t, dmShortID: e, email: s, password: r });
99
+ const d = y(`api/${e}/_auth/login?clientID=rest`, t);
100
100
  return yield p(
101
- u,
101
+ d,
102
102
  {},
103
103
  {
104
104
  method: "POST",
@@ -110,10 +110,10 @@ function W(n) {
110
110
  );
111
111
  });
112
112
  }
113
- function X(n) {
114
- return c(this, null, function* () {
113
+ function Y(n) {
114
+ return u(this, null, function* () {
115
115
  let { env: t, email: e, password: s } = n;
116
- g({ env: t, email: e, password: s });
116
+ h({ env: t, email: e, password: s });
117
117
  const r = `${z[t]}auth/login?clientID=rest`;
118
118
  return yield p(
119
119
  r,
@@ -128,10 +128,10 @@ function X(n) {
128
128
  );
129
129
  });
130
130
  }
131
- function Y(n) {
132
- return c(this, null, function* () {
131
+ function Z(n) {
132
+ return u(this, null, function* () {
133
133
  let { dmShortID: t, env: e, token: s } = n;
134
- g({ dmShortID: t, env: e, token: s });
134
+ h({ dmShortID: t, env: e, token: s });
135
135
  const r = y(
136
136
  `api/${t}/_auth/logout?clientID=rest&token=${s}`,
137
137
  e
@@ -145,10 +145,10 @@ function Y(n) {
145
145
  );
146
146
  });
147
147
  }
148
- function Z(n) {
149
- return c(this, null, function* () {
148
+ function G(n) {
149
+ return u(this, null, function* () {
150
150
  let { env: t, token: e } = n;
151
- g({ env: t, token: e });
151
+ h({ env: t, token: e });
152
152
  const s = `${z[t]}auth/logout?clientID=rest`;
153
153
  return yield p(
154
154
  s,
@@ -163,10 +163,10 @@ function Z(n) {
163
163
  });
164
164
  }
165
165
  function tt({ dmShortID: n }) {
166
- return g({ dmShortID: n }), n;
166
+ return h({ dmShortID: n }), n;
167
167
  }
168
168
  function et({ env: n }) {
169
- return g({ env: n }), n;
169
+ return h({ env: n }), n;
170
170
  }
171
171
  let nt = [
172
172
  "created",
@@ -194,20 +194,20 @@ function st(n) {
194
194
  return JSON.parse(JSON.stringify(n));
195
195
  }
196
196
  function rt(n) {
197
- return c(this, null, function* () {
197
+ return u(this, null, function* () {
198
198
  let { env: t, dmShortID: e } = n;
199
- g({ env: t, dmShortID: e });
199
+ h({ env: t, dmShortID: e });
200
200
  const s = y(`api/${e}`, t);
201
201
  return p(s, n);
202
202
  });
203
203
  }
204
- function I(n) {
205
- return c(this, null, function* () {
204
+ function F(n) {
205
+ return u(this, null, function* () {
206
206
  let { env: t, dmShortID: e, model: s, options: r = {} } = n;
207
- g({ env: t, dmShortID: e, model: s }), r = o({ size: 50, page: 1, _list: !0 }, r);
208
- const u = k(r), i = y(`api/${e}/${s}?${u}`, t), { count: d, total: a, _embedded: l } = yield p(i, n);
209
- let f = l ? l[`${e}:${s}`] : [];
210
- return f = Array.isArray(f) ? f : [f], { count: d, total: a, items: f };
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 };
211
211
  });
212
212
  }
213
213
  function ot({
@@ -217,19 +217,19 @@ function ot({
217
217
  entryID: s,
218
218
  token: r
219
219
  }) {
220
- g({ env: n, dmShortID: t, model: e, entryID: s });
221
- const u = k({ _id: s }), i = y(`api/${t}/${e}?${u}`, n);
220
+ h({ env: n, dmShortID: t, model: e, entryID: s });
221
+ const d = k({ _id: s }), i = y(`api/${t}/${e}?${d}`, n);
222
222
  return p(i, { token: r });
223
223
  }
224
- function it(u) {
225
- return c(this, arguments, function* ({
224
+ function it(d) {
225
+ return u(this, arguments, function* ({
226
226
  env: n,
227
227
  dmShortID: t,
228
228
  model: e,
229
229
  value: s,
230
230
  token: r
231
231
  }) {
232
- g({ env: n, dmShortID: t, model: e, value: s });
232
+ h({ env: n, dmShortID: t, model: e, value: s });
233
233
  const i = y(`api/${t}/${e}`, n);
234
234
  return yield p(
235
235
  i,
@@ -244,32 +244,32 @@ function it(u) {
244
244
  );
245
245
  });
246
246
  }
247
- function K(d) {
248
- return c(this, arguments, function* ({
247
+ function K(l) {
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: u,
254
+ token: d,
255
255
  safePut: i = !1
256
256
  }) {
257
- g({ env: n, dmShortID: t, model: e, entryID: s, value: r });
258
- const a = {
257
+ h({ env: n, dmShortID: t, model: e, entryID: s, value: r });
258
+ const o = {
259
259
  "Content-Type": "application/json"
260
260
  };
261
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
- const l = y(`api/${t}/${e}?_id=${s}`, n);
266
+ const c = y(`api/${t}/${e}?_id=${s}`, n);
267
267
  return r = st(r), r = C(r), yield p(
268
- l,
269
- { token: u },
268
+ c,
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
  );
@@ -282,10 +282,10 @@ function N({
282
282
  entryID: s,
283
283
  token: r
284
284
  }) {
285
- g({ env: n, dmShortID: t, model: e, entryID: s });
286
- const u = y(`api/${t}/${e}?_id=${s}`, n);
285
+ h({ env: n, dmShortID: t, model: e, entryID: s });
286
+ const d = y(`api/${t}/${e}?_id=${s}`, n);
287
287
  return p(
288
- u,
288
+ d,
289
289
  { token: r, rawRes: !0 },
290
290
  {
291
291
  method: "DELETE",
@@ -296,49 +296,49 @@ function N({
296
296
  );
297
297
  }
298
298
  function at(n, t) {
299
- return c(this, null, function* () {
300
- let { env: e, dmShortID: s, model: r, options: u = {} } = n;
301
- g({ env: e, dmShortID: s, model: r }), n.options = o({ size: 50, page: 1, _list: !0 }, u);
302
- let i = 0, d, a = [];
303
- for (; d === void 0 || i < d; ) {
304
- const l = yield I(n);
305
- for (let f of l.items)
306
- a.push(yield t(f));
307
- i += l.items.length, d = l.total, n.options.page++;
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)
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
- return c(this, arguments, function* ({ env: n, dmShortID: t, model: e, withMetadata: s }) {
313
+ return u(this, arguments, function* ({ env: n, dmShortID: t, model: e, withMetadata: s }) {
314
314
  var f, $, j, S, L;
315
- g({ env: n, dmShortID: t, model: e });
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")
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")
318
318
  throw new Error(
319
- `getSchema: ${u} returned unexpected format: ${JSON.stringify(i)}`
319
+ `getSchema: ${d} returned unexpected format: ${JSON.stringify(i)}`
320
320
  );
321
- const { properties: a } = d, l = C(a);
322
- for (let w in l) {
323
- let m = l[w];
324
- if (m.required = d.required.includes(w), ($ = l[w]) != null && $.oneOf && ((j = l[w]) == null || delete j.oneOf), (S = m.title) != null && S.includes("<") && ((L = m.title) != null && L.includes(">"))) {
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
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
328
328
  ["asset", "entry", "assets", "entries"].includes(m.title) ? (m.type = m.title, m.resource = null) : m.type = m.title;
329
- delete l[w].title;
329
+ delete c[w].title;
330
330
  }
331
331
  if (s) {
332
- const w = a._modelTitle.title, m = a._modelTitleField.title;
333
- return { properties: l, meta: { modelTitleField: m, modelTitle: w } };
332
+ const w = o._modelTitle.title, m = o._modelTitleField.title;
333
+ return { properties: c, meta: { modelTitleField: m, modelTitle: w } };
334
334
  }
335
- return l;
335
+ return c;
336
336
  });
337
337
  }
338
- function F(n) {
339
- return Object.entries(n).map(([t, e]) => typeof e != "object" ? { [t]: String(e) } : o(o(o(o(o(o(o({}, 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) => o(o({}, t), e), {});
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), {});
340
340
  }
341
- const ut = F;
341
+ const ut = I;
342
342
  function P(n) {
343
343
  return n._links.collection.href.split("/").slice(-2)[0];
344
344
  }
@@ -351,68 +351,98 @@ 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(h(o({}, R(n)), {
354
+ }, dt = (n) => N(R(n)), lt = (n, t) => K(g(a({}, R(n)), {
355
355
  value: t
356
356
  }));
357
- function gt(n, t) {
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 ht(u) {
362
- return c(this, arguments, function* ({
361
+ function gt(d) {
362
+ return u(this, arguments, function* ({
363
363
  env: n,
364
364
  dmShortID: t,
365
365
  assetGroup: e,
366
366
  assetID: s,
367
367
  token: r
368
368
  }) {
369
- g({ env: n, dmShortID: t, assetGroup: e, assetID: s });
370
- const i = k({ assetID: s }), d = y(`a/${t}/${e}?${i}`, n), { _embedded: a } = yield p(d, { token: r });
371
- return a ? a["ec:dm-asset"] : void 0;
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 });
371
+ return o ? o["ec:dm-asset"] : void 0;
372
372
  });
373
373
  }
374
374
  function ft(n) {
375
- return c(this, null, function* () {
376
- let { env: t, dmShortID: e, assetGroup: s, token: r, options: u = {} } = n;
377
- g({ env: t, dmShortID: e, assetGroup: s }), u = o({ size: 50, page: 1, _list: !0 }, u);
378
- const i = k(u), d = y(`a/${e}/${s}?${i}`, t), { count: a, total: l, _embedded: f } = yield p(d, { token: r });
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 });
379
379
  let $ = f ? f["ec:dm-asset"] : [];
380
- return $ = Array.isArray($) ? $ : [$], { count: a, total: l, items: $ };
380
+ return $ = Array.isArray($) ? $ : [$], { count: o, total: c, items: $ };
381
381
  });
382
382
  }
383
- function pt(d) {
384
- return c(this, arguments, function* ({
383
+ function pt(l) {
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: u,
390
+ name: d,
391
391
  options: i
392
392
  }) {
393
- g({ env: n, dmShortID: t, assetGroup: e, file: r });
394
- const a = y(`a/${t}/${e}`, n), l = new FormData();
395
- return l.append("file", r, u), i && Object.keys(i).forEach(($) => {
396
- l.append($, i[$]);
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[$]);
397
397
  }), (yield p(
398
- a,
398
+ o,
399
399
  { token: s },
400
400
  {
401
401
  method: "POST",
402
- body: l
402
+ body: c
403
403
  }
404
404
  ))._embedded["ec:dm-asset"];
405
405
  });
406
406
  }
407
- function yt(u) {
408
- return c(this, arguments, function* ({
407
+ function yt(d) {
408
+ return u(this, arguments, function* ({
409
+ env: n,
410
+ dmShortID: t,
411
+ assetGroup: e,
412
+ files: s,
413
+ options: r
414
+ }) {
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(
419
+ "file",
420
+ c
421
+ /* , name */
422
+ );
423
+ }), r && Object.keys(r).forEach((c) => {
424
+ l.append(c, r[c]);
425
+ });
426
+ const o = yield p(
427
+ i,
428
+ {},
429
+ {
430
+ method: "POST",
431
+ body: l
432
+ }
433
+ );
434
+ return Array.isArray(o._embedded["ec:dm-asset"]) ? o._embedded["ec:dm-asset"] : [o._embedded["ec:dm-asset"]];
435
+ });
436
+ }
437
+ function mt(d) {
438
+ return u(this, arguments, function* ({
409
439
  env: n,
410
440
  dmShortID: t,
411
441
  assetGroup: e,
412
442
  assetID: s,
413
443
  token: r
414
444
  }) {
415
- g({ env: n, dmShortID: t, assetGroup: e, assetID: s });
445
+ h({ env: n, dmShortID: t, assetGroup: e, assetID: s });
416
446
  const i = y(`a/${t}/${e}/${s}`, n);
417
447
  yield p(
418
448
  i,
@@ -423,109 +453,111 @@ function yt(u) {
423
453
  );
424
454
  });
425
455
  }
426
- function mt(n) {
427
- return c(this, null, function* () {
456
+ function $t(n) {
457
+ return u(this, null, function* () {
428
458
  let { env: t, dmID: e, token: s } = n;
429
- g({ env: t, dmID: e });
459
+ h({ env: t, dmID: e });
430
460
  const r = y(`?dataManagerID=${e}`, t);
431
461
  return p(r, { token: s });
432
462
  });
433
463
  }
434
- function $t(n) {
435
- return c(this, null, function* () {
464
+ function kt(n) {
465
+ return u(this, null, function* () {
436
466
  let { env: t, options: e = {} } = n;
437
- g({ env: t }), e = o({ size: 25, page: 1, _list: !0 }, e);
438
- const s = k(e), r = y(`?${s}`, t), { count: u, total: i, _embedded: d } = yield p(r, n);
439
- let a = d ? d["ec:datamanager"] : [];
440
- return a = Array.isArray(a) ? a : [a], { count: u, total: i, 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 };
441
471
  });
442
472
  }
443
- function kt(n) {
444
- return c(this, null, function* () {
473
+ function wt(n) {
474
+ return u(this, null, function* () {
445
475
  let { env: t, dmID: e, options: s = {} } = n;
446
- g({ env: t, dmID: e }), s = o({ size: 25, dataManagerID: e, page: 1, _list: !0 }, s);
447
- const r = k(s), u = y(`model?${r}`, t), { count: i, total: d, _embedded: a } = yield p(u, n);
448
- let l = a ? a["ec:model"] : [];
449
- return l = Array.isArray(l) ? l : [l], { count: i, total: d, items: l };
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 };
450
480
  });
451
481
  }
452
- function wt(n) {
453
- return c(this, null, function* () {
482
+ function Tt(n) {
483
+ return u(this, null, function* () {
454
484
  let { env: t, resource: e, options: s = {}, subdomain: r = "datamanager" } = n;
455
- g({ env: t, subdomain: r, resource: e }), s = o({ size: 25, page: 1, _list: !0 }, s);
456
- const u = k(s), i = y(`${e}?${u}`, t, r), { count: d, total: a, _embedded: l } = yield p(i, n);
457
- let f = l ? l[Object.keys(l)[0]] : [];
458
- return f = Array.isArray(f) ? f : [f], { count: d, total: a, items: f };
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 };
459
489
  });
460
490
  }
461
- function Tt(e) {
462
- return c(this, arguments, function* (n, t = {}) {
463
- let { env: s, route: r, options: u = {}, subdomain: i = "datamanager" } = n;
464
- g({ env: s, subdomain: i, route: r }), u = o({}, u);
465
- const d = k(u), a = y(`${r}?${d}`, s, i);
466
- return p(a, n, t);
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);
496
+ return p(o, n, t);
467
497
  });
468
498
  }
469
499
  const b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
470
500
  __proto__: null,
471
501
  assetList: ft,
472
502
  createAsset: pt,
503
+ createAssets: yt,
473
504
  createEntry: it,
474
- deleteAsset: yt,
505
+ deleteAsset: mt,
475
506
  deleteEntry: N,
476
- deleteEntryObject: lt,
477
- dmList: $t,
507
+ deleteEntryObject: dt,
508
+ dmList: kt,
478
509
  editEntry: K,
479
- editEntryObject: dt,
480
- entryList: I,
510
+ editEntryObject: lt,
511
+ entryList: F,
481
512
  filterOptions: ut,
482
- getAsset: ht,
483
- getDatamanager: mt,
513
+ getAsset: gt,
514
+ getDatamanager: $t,
484
515
  getEcAuthKey: et,
485
516
  getEntry: ot,
486
- getEntryAsset: gt,
517
+ getEntryAsset: ht,
487
518
  getEntryEnv: J,
488
519
  getEntryShortID: P,
489
520
  getPublicAuthKey: tt,
490
521
  getSchema: ct,
491
- loginEc: X,
492
- loginPublic: W,
493
- logoutEc: Z,
494
- logoutPublic: Y,
522
+ loginEc: Y,
523
+ loginPublic: X,
524
+ logoutEc: G,
525
+ logoutPublic: Z,
495
526
  mapEntries: at,
496
- modelList: kt,
527
+ modelList: wt,
497
528
  publicApi: rt,
498
- raw: Tt,
499
- resourceList: wt,
500
- sdkOptions: F
529
+ raw: Et,
530
+ resourceList: Tt,
531
+ sdkOptions: I
501
532
  }, Symbol.toStringTag, { value: "Module" })), {
502
533
  entryList: D,
503
- mapEntries: Et,
504
- getEntry: bt,
505
- getAsset: At,
534
+ mapEntries: bt,
535
+ getEntry: At,
536
+ getAsset: _t,
506
537
  assetList: q,
507
- createAsset: _t,
508
- deleteAsset: Ot,
509
- createEntry: Pt,
538
+ createAsset: Ot,
539
+ createAssets: Pt,
540
+ deleteAsset: jt,
541
+ createEntry: St,
510
542
  editEntry: x,
511
- deleteEntry: jt,
512
- getSchema: St,
513
- loginPublic: Lt,
514
- loginEc: vt,
515
- logoutEc: Bt,
516
- logoutPublic: Dt,
543
+ deleteEntry: Lt,
544
+ getSchema: Bt,
545
+ loginPublic: vt,
546
+ loginEc: Dt,
547
+ logoutEc: qt,
548
+ logoutPublic: xt,
517
549
  getEcAuthKey: T,
518
550
  getPublicAuthKey: E,
519
- dmList: qt,
520
- modelList: xt,
521
- publicApi: zt,
522
- getDatamanager: Ct,
523
- resourceList: It,
524
- raw: Kt
551
+ dmList: zt,
552
+ modelList: Ct,
553
+ publicApi: Ft,
554
+ getDatamanager: Kt,
555
+ resourceList: Nt,
556
+ raw: It
525
557
  } = b;
526
- function Ft(n) {
558
+ function Rt(n) {
527
559
  const { action: t } = n;
528
- if (g({ action: t }), !b[t])
560
+ if (h({ action: t }), !b[t])
529
561
  throw new Error(
530
562
  `"${t}" does not exist! try one of ${Object.keys(b).join(
531
563
  ", "
@@ -548,13 +580,13 @@ class _ {
548
580
  }
549
581
  /** @ignore */
550
582
  set(t) {
551
- return new _(o(o({}, this.config), t));
583
+ return new _(a(a({}, this.config), t));
552
584
  }
553
585
  /** @ignore */
554
586
  entries() {
555
- return c(this, arguments, function* (t = {}) {
587
+ return u(this, arguments, function* (t = {}) {
556
588
  const e = yield this.getBestToken();
557
- return D(h(o({}, this.config), { options: t, token: e }));
589
+ return D(g(a({}, this.config), { options: t, token: e }));
558
590
  });
559
591
  }
560
592
  /**
@@ -571,9 +603,9 @@ class _ {
571
603
  * const secrets = await fdk("stage").token(token).dm("83cc6374").model("secret").entryList()
572
604
  */
573
605
  entryList(t) {
574
- return c(this, null, function* () {
606
+ return u(this, null, function* () {
575
607
  const e = yield this.getBestToken();
576
- return D(h(o({}, this.config), { options: t, token: e }));
608
+ return D(g(a({}, this.config), { options: t, token: e }));
577
609
  });
578
610
  }
579
611
  /**
@@ -588,9 +620,9 @@ class _ {
588
620
  * console.log("res", res);
589
621
  */
590
622
  mapEntries(s) {
591
- return c(this, arguments, function* (t, e = {}) {
623
+ return u(this, arguments, function* (t, e = {}) {
592
624
  const r = yield this.getBestToken();
593
- return Et(h(o({}, this.config), { options: e, token: r }), t);
625
+ return bt(g(a({}, this.config), { options: e, token: r }), t);
594
626
  });
595
627
  }
596
628
  /**
@@ -601,9 +633,9 @@ class _ {
601
633
  * const muffin = await fdk("stage").dm("83cc6374").model("muffin").getEntry("1gOtzWvrdq")
602
634
  */
603
635
  getEntry(t) {
604
- return c(this, null, function* () {
636
+ return u(this, null, function* () {
605
637
  const e = yield this.getBestToken();
606
- return bt(h(o({}, this.config), { entryID: t, token: e }));
638
+ return At(g(a({}, this.config), { entryID: t, token: e }));
607
639
  });
608
640
  }
609
641
  /**
@@ -621,9 +653,9 @@ class _ {
621
653
  * .editEntrySafe("1gOtzWvrdq", { name: "test", _modified: "2020-01-01T00:00:00.000Z"})
622
654
  */
623
655
  editEntrySafe(t, e) {
624
- return c(this, null, function* () {
656
+ return u(this, null, function* () {
625
657
  const s = yield this.getBestToken();
626
- return x(h(o({}, 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 }));
627
659
  });
628
660
  }
629
661
  /**
@@ -634,15 +666,15 @@ class _ {
634
666
  * const muffin = await fdk("stage").dm("83cc6374").model("muffin").getSchema()
635
667
  */
636
668
  getSchema() {
637
- return c(this, null, function* () {
638
- return St(this.config);
669
+ return u(this, null, function* () {
670
+ return Bt(this.config);
639
671
  });
640
672
  }
641
673
  /** @ignore */
642
674
  assets(t) {
643
- return c(this, null, function* () {
675
+ return u(this, null, function* () {
644
676
  const e = yield this.getBestToken();
645
- return q(h(o({}, this.config), { options: t, token: e }));
677
+ return q(g(a({}, this.config), { options: t, token: e }));
646
678
  });
647
679
  }
648
680
  /**
@@ -657,9 +689,9 @@ class _ {
657
689
  * const files = await fdk("stage").token(token).dm("83cc6374").assetGroup("avatars").assetList()
658
690
  */
659
691
  assetList(t) {
660
- return c(this, null, function* () {
692
+ return u(this, null, function* () {
661
693
  const e = yield this.getBestToken();
662
- return q(h(o({}, this.config), { options: t, token: e }));
694
+ return q(g(a({}, this.config), { options: t, token: e }));
663
695
  });
664
696
  }
665
697
  /**
@@ -682,9 +714,34 @@ class _ {
682
714
  * .createAsset({ file, name: "venndiagram.png" });
683
715
  */
684
716
  createAsset(t) {
685
- return c(this, null, function* () {
686
- const { file: e, name: s, options: r } = t, u = yield this.getBestToken();
687
- return _t(h(o({}, this.config), { file: e, name: s, options: r, token: u }));
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 }));
720
+ });
721
+ }
722
+ /**
723
+ * Uploads multiple assets. Expects `dmShortID` / `assetGroup` / `files` to be set.
724
+ * If the assetGroup is not public, you also need to provide a `token`.
725
+ * @category Assets
726
+ * @example
727
+ * // browser example
728
+ * document.getElementById("file").addEventListener("input", async (e) => {
729
+ * const files = e.target.files;
730
+ * const asset = await ecadmin.assetgroup("test").createAssets({ files })
731
+ * });
732
+ * @example
733
+ * // node example
734
+ * const buf = fs.readFileSync("venndiagram.png");
735
+ * const files = [new Blob([buf])];
736
+ * const upload = await fdk("stage")
737
+ * .dm("83cc6374")
738
+ * .assetgroup("test")
739
+ * .createAsset({ files });
740
+ */
741
+ createAssets(t) {
742
+ return u(this, null, function* () {
743
+ const { files: e, options: s } = t, r = yield this.getBestToken();
744
+ return Pt(g(a({}, this.config), { files: e, options: s, token: r }));
688
745
  });
689
746
  }
690
747
  /**
@@ -696,9 +753,9 @@ class _ {
696
753
  * await ecadmin.assetgroup("test").deleteAsset('xxxx');
697
754
  */
698
755
  deleteAsset(t) {
699
- return c(this, null, function* () {
756
+ return u(this, null, function* () {
700
757
  const e = yield this.getBestToken();
701
- return Ot(h(o({}, this.config), { token: e, assetID: t }));
758
+ return jt(g(a({}, this.config), { token: e, assetID: t }));
702
759
  });
703
760
  }
704
761
  /**
@@ -709,9 +766,9 @@ class _ {
709
766
  * const asset = await fdk("stage").dm("83cc6374").assetgroup("test").getAsset("tP-ZxpZZTGmbPnET-wArAQ")
710
767
  */
711
768
  getAsset(t) {
712
- return c(this, null, function* () {
769
+ return u(this, null, function* () {
713
770
  const e = yield this.getBestToken();
714
- return At(h(o({}, this.config), { assetID: t, token: e }));
771
+ return _t(g(a({}, this.config), { assetID: t, token: e }));
715
772
  });
716
773
  }
717
774
  /**
@@ -723,9 +780,9 @@ class _ {
723
780
  * const entry = await fdk("stage").dm("83cc6374").model("muffin").createEntry({ name: 'test' })
724
781
  */
725
782
  createEntry(t) {
726
- return c(this, null, function* () {
783
+ return u(this, null, function* () {
727
784
  const e = yield this.getBestToken();
728
- return Pt(h(o({}, this.config), { token: e, value: t }));
785
+ return St(g(a({}, this.config), { token: e, value: t }));
729
786
  });
730
787
  }
731
788
  /**
@@ -738,9 +795,9 @@ class _ {
738
795
  * const entry = await fdk("stage").dm("83cc6374").model("muffin").editEntry("1gOtzWvrdq", { name: "test" })
739
796
  */
740
797
  editEntry(t, e) {
741
- return c(this, null, function* () {
798
+ return u(this, null, function* () {
742
799
  const s = yield this.getBestToken();
743
- return x(h(o({}, this.config), { entryID: t, token: s, value: e }));
800
+ return x(g(a({}, this.config), { entryID: t, token: s, value: e }));
744
801
  });
745
802
  }
746
803
  /**
@@ -753,9 +810,9 @@ class _ {
753
810
  * await fdk("stage").dm("83cc6374").model("muffin").deleteEntry("1gOtzWvrdq")
754
811
  */
755
812
  deleteEntry(t) {
756
- return c(this, null, function* () {
813
+ return u(this, null, function* () {
757
814
  const e = yield this.getBestToken();
758
- return jt(h(o({}, this.config), { token: e, entryID: t }));
815
+ return Lt(g(a({}, this.config), { token: e, entryID: t }));
759
816
  });
760
817
  }
761
818
  /**
@@ -767,9 +824,9 @@ class _ {
767
824
  * const res = await fdk("stage").resource("template").resourceList()
768
825
  */
769
826
  resourceList(t) {
770
- return c(this, null, function* () {
827
+ return u(this, null, function* () {
771
828
  const e = yield this.getBestToken();
772
- return It(h(o({}, this.config), { options: t, token: e }));
829
+ return Nt(g(a({}, this.config), { options: t, token: e }));
773
830
  });
774
831
  }
775
832
  /**
@@ -783,9 +840,9 @@ class _ {
783
840
  * const res = await fdk("stage").route("stats").raw()
784
841
  */
785
842
  raw(t, e) {
786
- return c(this, null, function* () {
843
+ return u(this, null, function* () {
787
844
  const s = yield this.getBestToken();
788
- return Kt(h(o({}, this.config), { options: t, token: s }), e);
845
+ return It(g(a({}, this.config), { options: t, token: s }), e);
789
846
  });
790
847
  }
791
848
  /**
@@ -852,7 +909,7 @@ class _ {
852
909
  * @category Auth
853
910
  */
854
911
  loginEc(t) {
855
- return vt(o(o({}, this.config), t)).then(
912
+ return Dt(a(a({}, this.config), t)).then(
856
913
  (e) => this.setToken(T(this.config), e.token)
857
914
  );
858
915
  }
@@ -861,7 +918,7 @@ class _ {
861
918
  * @category Auth
862
919
  */
863
920
  loginPublic(t) {
864
- return Lt(o(o({}, this.config), t)).then(
921
+ return vt(a(a({}, this.config), t)).then(
865
922
  (e) => this.setToken(E(this.config), e.token)
866
923
  );
867
924
  }
@@ -871,7 +928,7 @@ class _ {
871
928
  */
872
929
  logoutPublic() {
873
930
  const t = this.getPublicToken();
874
- return Dt(h(o({}, this.config), { token: t })).then(
931
+ return xt(g(a({}, this.config), { token: t })).then(
875
932
  () => this.removeToken(E(this.config))
876
933
  );
877
934
  }
@@ -881,7 +938,7 @@ class _ {
881
938
  */
882
939
  logoutEc() {
883
940
  const t = this.getEcToken();
884
- return Bt(h(o({}, this.config), { token: t })).then(
941
+ return qt(g(a({}, this.config), { token: t })).then(
885
942
  () => this.removeToken(T(this.config))
886
943
  );
887
944
  }
@@ -981,16 +1038,16 @@ class _ {
981
1038
  * @category Entries
982
1039
  */
983
1040
  publicApi() {
984
- return zt(this.config);
1041
+ return Ft(this.config);
985
1042
  }
986
1043
  /**
987
1044
  * Loads a DatamanagerResource by its long id. Requires token.
988
1045
  * @category Admin
989
1046
  */
990
1047
  getDatamanager(t) {
991
- return c(this, null, function* () {
1048
+ return u(this, null, function* () {
992
1049
  const e = yield this.getBestToken();
993
- return Ct(h(o({}, this.config), { dmID: t, token: e }));
1050
+ return Kt(g(a({}, this.config), { dmID: t, token: e }));
994
1051
  });
995
1052
  }
996
1053
  /**
@@ -1002,9 +1059,9 @@ class _ {
1002
1059
  * const dms = await fdk("stage").dmList()
1003
1060
  */
1004
1061
  dmList() {
1005
- return c(this, arguments, function* (t = {}) {
1062
+ return u(this, arguments, function* (t = {}) {
1006
1063
  const e = yield this.getBestToken();
1007
- return qt(h(o({}, this.config), { options: t, token: e }));
1064
+ return zt(g(a({}, this.config), { options: t, token: e }));
1008
1065
  });
1009
1066
  }
1010
1067
  /**
@@ -1016,51 +1073,52 @@ class _ {
1016
1073
  * const models = await fdk("stage").dmID("254a03f1-cb76-4f1e-a52a-bbd4180ca10c").modelList()
1017
1074
  */
1018
1075
  modelList() {
1019
- return c(this, arguments, function* (t = {}) {
1076
+ return u(this, arguments, function* (t = {}) {
1020
1077
  const e = yield this.getBestToken();
1021
- return xt(h(o({}, this.config), { options: t, token: e }));
1078
+ return Ct(g(a({}, this.config), { options: t, token: e }));
1022
1079
  });
1023
1080
  }
1024
1081
  }
1025
- const Jt = (n) => new _({ env: n }), Rt = (n) => new _({ env: n });
1082
+ const Ut = (n) => new _({ env: n }), Mt = (n) => new _({ env: n });
1026
1083
  export {
1027
1084
  _ as Fdk,
1028
- Ft as act,
1085
+ Rt as act,
1029
1086
  y as apiURL,
1030
1087
  A as apis,
1031
1088
  ft as assetList,
1032
1089
  pt as createAsset,
1090
+ yt as createAssets,
1033
1091
  it as createEntry,
1034
- yt as deleteAsset,
1092
+ mt as deleteAsset,
1035
1093
  N as deleteEntry,
1036
- lt as deleteEntryObject,
1037
- $t as dmList,
1094
+ dt as deleteEntryObject,
1095
+ kt as dmList,
1038
1096
  K as editEntry,
1039
- dt as editEntryObject,
1040
- I as entryList,
1041
- g as expect,
1042
- Jt as fdk,
1097
+ lt as editEntryObject,
1098
+ F as entryList,
1099
+ h as expect,
1100
+ Ut as fdk,
1043
1101
  p as fetcher,
1044
1102
  ut as filterOptions,
1045
- ht as getAsset,
1046
- mt as getDatamanager,
1103
+ gt as getAsset,
1104
+ $t as getDatamanager,
1047
1105
  et as getEcAuthKey,
1048
1106
  ot as getEntry,
1049
- gt as getEntryAsset,
1107
+ ht as getEntryAsset,
1050
1108
  J as getEntryEnv,
1051
1109
  P as getEntryShortID,
1052
1110
  tt as getPublicAuthKey,
1053
1111
  ct as getSchema,
1054
- X as loginEc,
1055
- W as loginPublic,
1056
- Z as logoutEc,
1057
- Y as logoutPublic,
1112
+ Y as loginEc,
1113
+ X as loginPublic,
1114
+ G as logoutEc,
1115
+ Z as logoutPublic,
1058
1116
  at as mapEntries,
1059
- kt as modelList,
1117
+ wt as modelList,
1060
1118
  rt as publicApi,
1061
1119
  k as query,
1062
- Tt as raw,
1063
- wt as resourceList,
1064
- Rt as sdk,
1065
- F as sdkOptions
1120
+ Et as raw,
1121
+ Tt as resourceList,
1122
+ Mt as sdk,
1123
+ I as sdkOptions
1066
1124
  };
package/dist/lib/api.d.ts CHANGED
@@ -161,6 +161,29 @@ export declare class Fdk {
161
161
  name: string;
162
162
  options: AssetCreateOptions;
163
163
  }): Promise<import("src/types").AssetResource>;
164
+ /**
165
+ * Uploads multiple assets. Expects `dmShortID` / `assetGroup` / `files` to be set.
166
+ * If the assetGroup is not public, you also need to provide a `token`.
167
+ * @category Assets
168
+ * @example
169
+ * // browser example
170
+ * document.getElementById("file").addEventListener("input", async (e) => {
171
+ * const files = e.target.files;
172
+ * const asset = await ecadmin.assetgroup("test").createAssets({ files })
173
+ * });
174
+ * @example
175
+ * // node example
176
+ * const buf = fs.readFileSync("venndiagram.png");
177
+ * const files = [new Blob([buf])];
178
+ * const upload = await fdk("stage")
179
+ * .dm("83cc6374")
180
+ * .assetgroup("test")
181
+ * .createAsset({ files });
182
+ */
183
+ createAssets(config: {
184
+ files: Blob[];
185
+ options: AssetCreateOptions;
186
+ }): Promise<import("src/types").AssetResource[]>;
164
187
  /**
165
188
  * Deletes an asset. Expects `dmShortID` / `assetGroup` / `assetID` to be set.
166
189
  * You probably also need to provide a `token`.
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/lib/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,cAAc,EACf,MAAM,WAAW,CAAC;AAGnB,cAAc,QAAQ,CAAC;AA4BvB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAW7D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAAa,GAAG;IACd,cAAc;IACd,MAAM,EAAE,GAAG,CAAC;IACZ,cAAc;gBACF,MAAM,GAAE,SAAc;IAWlC,cAAc;IACd,GAAG,CAAC,GAAG,KAAA;IAKP,cAAc;IACR,OAAO,CAAC,OAAO,KAAK;IAI1B;;;;;;;;;;;;OAYG;IACG,SAAS,CAAC,OAAO,EAAE,kBAAkB;IAK3C;;;;;;;;;;OAUG;IACG,UAAU,CAAC,EAAE,KAAA,EAAE,OAAO,GAAE,kBAAuB;IAIrD;;;;;;OAMG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM;IAI9B;;;;;;;;;;;;;OAaG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAIlD;;;;;;OAMG;IACG,SAAS,IAAI,OAAO,CAAC,WAAW,CAAC;IAGvC,cAAc;IACR,MAAM,CAAC,OAAO,KAAA;IAIpB;;;;;;;;;;OAUG;IACG,SAAS,CAAC,OAAO,EAAE,kBAAkB;IAI3C;;;;;;;;;;;;;;;;;;OAkBG;IACG,WAAW,CAAC,MAAM,EAAE;QACxB,IAAI,EAAE,IAAI,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,kBAAkB,CAAC;KAC7B;IAKD;;;;;;;OAOG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM;IAIjC;;;;;;OAMG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM;IAK9B;;;;;;;OAOG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM;IAI/B;;;;;;;;OAQG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAI9C;;;;;;;;OAQG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM;IAKjC;;;;;;;OAOG;IACG,YAAY,CAAC,OAAO,EAAE,kBAAkB;IAK9C;;;;;;;;;OASG;IACG,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;IAKzD;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,cAAc,EAAE,cAAc;IAI7C,cAAc;IACd,WAAW,CAAC,GAAG,KAAA;IAOf,cAAc;IACd,QAAQ,CAAC,GAAG,KAAA;IAOZ,cAAc;IACd,cAAc;IAGd,cAAc;IACd,UAAU;IAGV,cAAc;IACd,QAAQ,CAAC,GAAG,KAAA,EAAE,KAAK,KAAA;IAMnB;;;;OAIG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM;IAGxB;;;;OAIG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM;IAG5B;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IAKnD;;;OAGG;IACH,WAAW,CAAC,MAAM,KAAA;IAMlB;;;OAGG;IACH,YAAY;IAMZ;;;OAGG;IACH,QAAQ;IAMR,cAAc;IACd,cAAc;IAGd,cAAc;IACd,UAAU;IAGV,cAAc;IACd,WAAW;IAGX,cAAc;IACd,YAAY;IAOZ;;;;OAIG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM;IAGnB;;;;OAIG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM;IAGnB,cAAc;IACd,SAAS,CAAC,SAAS,KAAA;IAGnB;;;;OAIG;IACH,EAAE,CAAC,SAAS,EAAE,MAAM;IAGpB;;;;OAIG;IACH,IAAI,CAAC,IAAI,KAAA;IAGT;;;;OAIG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM;IAG7B,cAAc;IACd,UAAU,CAAC,UAAU,EAAE,MAAM;IAG7B;;;;OAIG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM;IAG3B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAGzB;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM;IAInB;;;OAGG;IACH,SAAS;IAIT;;;OAGG;IACG,cAAc,CAAC,IAAI,EAAE,MAAM;IAKjC;;;;;;;OAOG;IACG,MAAM,CAAC,OAAO,GAAE,kBAAuB;IAI7C;;;;;;;OAOG;IACG,SAAS,CAAC,OAAO,GAAE,kBAAuB;CAIjD;AAED;;;;;GAKG;AACH,eAAO,MAAM,GAAG,QAAS,MAAM,GAAG,OAAO,QAAqB,CAAC;AAC/D,cAAc;AACd,eAAO,MAAM,GAAG,QAAS,MAAM,GAAG,OAAO,QAAqB,CAAC"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/lib/api.ts"],"names":[],"mappings":"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"}
@@ -21,6 +21,16 @@ export declare function createAsset({ env, dmShortID, assetGroup, token, file, n
21
21
  name: any;
22
22
  options: any;
23
23
  }): Promise<AssetResource>;
24
+ /**
25
+ * @ignore
26
+ */
27
+ export declare function createAssets({ env, dmShortID, assetGroup, files, options, }: {
28
+ env: any;
29
+ dmShortID: any;
30
+ assetGroup: any;
31
+ files: any;
32
+ options: any;
33
+ }): Promise<AssetResource[]>;
24
34
  /**
25
35
  * @ignore
26
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,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.7.3",
3
+ "version": "0.8.1",
4
4
  "description": "ec frontend sdk",
5
5
  "main": "dist/index.cjs",
6
6
  "directories": {