ec.fdk 0.7.2 → 0.8.0

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
@@ -37,7 +37,7 @@ fdk("stage") // choose stage environment
37
37
  });
38
38
  ```
39
39
 
40
- See all functions in the [Fdk reference](/docs/classes/Fdk.html).
40
+ See all functions in the [Fdk reference](https://entrecode.github.io/ec.fdk/classes/Fdk.html).
41
41
 
42
42
  ### act
43
43
 
@@ -52,7 +52,7 @@ const muffins = await act({
52
52
  });
53
53
  ```
54
54
 
55
- More in the [act reference](/docs/functions/act.html).
55
+ More in the [act reference](https://entrecode.github.io/ec.fdk/functions/act.html).
56
56
 
57
57
  ### Using act with swr / react-query
58
58
 
@@ -189,10 +189,29 @@ const entryList = await fdk("stage")
189
189
  .entryList(filterOptions({ created: { to: "2021-01-18T09:13:47.605Z" } }));
190
190
  ```
191
191
 
192
+ ### Asset List
193
+
194
+ ```js
195
+ // ec.sdk
196
+ await api.dmAssetList(group, { assetID: { any: value } });
197
+ // ec.fdk
198
+ const options = sdkOptions({ assetID: { any: value } } as any);
199
+ const assets = await api.assetGroup(group).assetList(options);
200
+ ```
201
+
202
+ ### Load Asset
203
+
204
+ ```js
205
+ // ec.sdk
206
+ api.dmAsset(group, img);
207
+ // ec.fdk
208
+ api.assetGroup(group).getAsset(img);
209
+ ```
210
+
192
211
  ## Publish
193
212
 
194
213
  0. `cd packages/ec.fdk`
195
214
  1. bump version in `packages/ec.fdk/package.json`
196
- 2. run `pnpm docs` to regenerate docs folder
215
+ 2. run `npm run docs` to regenerate docs folder
197
216
  3. commit + push
198
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,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;
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, i = (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 l = (a) => {
15
15
  try {
16
16
  d(e.next(a));
17
- } catch (l) {
18
- r(l);
17
+ } catch (c) {
18
+ r(c);
19
19
  }
20
- }, i = (a) => {
20
+ }, o = (a) => {
21
21
  try {
22
22
  d(e.throw(a));
23
- } catch (l) {
24
- r(l);
23
+ } catch (c) {
24
+ r(c);
25
25
  }
26
- }, d = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(u, i);
26
+ }, d = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(l, o);
27
27
  d((e = e.apply(n, t)).next());
28
28
  });
29
29
  function p(s) {
30
- return c(this, arguments, function* (n, t = {}, e = {}) {
30
+ return u(this, arguments, function* (n, t = {}, e = {}) {
31
31
  var d;
32
- const { token: r, rawRes: u } = t;
33
- r && (e.headers = h(o({}, e.headers || {}), {
32
+ const { token: r, rawRes: l } = t;
33
+ r && (e.headers = g(i({}, e.headers || {}), {
34
34
  Authorization: `Bearer ${r}`
35
35
  }));
36
- const i = yield fetch(n, e);
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}
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
40
  ${a.detail}
41
41
  ${a.verbose}`;
42
- throw new Error(l);
42
+ throw new Error(c);
43
43
  }
44
- throw new Error(`unexpected fetch error: ${i.statusText}`);
44
+ throw new Error(`unexpected fetch error: ${o.statusText}`);
45
45
  }
46
- return u ? i : yield i.json();
46
+ return l ? o : yield o.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 l = y(`api/${e}/_auth/login?clientID=rest`, t);
100
100
  return yield p(
101
- u,
101
+ l,
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,19 +194,19 @@ 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}`] : [];
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);
209
+ let f = c ? c[`${e}:${s}`] : [];
210
210
  return f = Array.isArray(f) ? f : [f], { count: d, total: a, items: f };
211
211
  });
212
212
  }
@@ -217,22 +217,22 @@ 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);
222
- return p(i, { token: r });
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 });
223
223
  }
224
- function it(u) {
225
- return c(this, arguments, function* ({
224
+ function it(l) {
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 });
233
- const i = y(`api/${t}/${e}`, n);
232
+ h({ env: n, dmShortID: t, model: e, value: s });
233
+ const o = y(`api/${t}/${e}`, n);
234
234
  return yield p(
235
- i,
235
+ o,
236
236
  { token: r },
237
237
  {
238
238
  method: "POST",
@@ -245,28 +245,28 @@ function it(u) {
245
245
  });
246
246
  }
247
247
  function K(d) {
248
- return c(this, arguments, function* ({
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,
255
- safePut: i = !1
254
+ token: l,
255
+ safePut: o = !1
256
256
  }) {
257
- g({ env: n, dmShortID: t, model: e, entryID: s, value: r });
257
+ h({ env: n, dmShortID: t, model: e, entryID: s, value: r });
258
258
  const a = {
259
259
  "Content-Type": "application/json"
260
260
  };
261
- if (i) {
261
+ if (o) {
262
262
  if (!("_modified" in r))
263
263
  throw new Error("expected _modified to be set!");
264
264
  a["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: l },
270
270
  {
271
271
  method: "PUT",
272
272
  headers: a,
@@ -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 l = y(`api/${t}/${e}?_id=${s}`, n);
287
287
  return p(
288
- u,
288
+ l,
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)
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; ) {
304
+ const c = yield F(n);
305
+ for (let f of c.items)
306
306
  a.push(yield t(f));
307
- i += l.items.length, d = l.total, n.options.page++;
307
+ o += c.items.length, d = c.total, n.options.page++;
308
308
  }
309
309
  return a;
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];
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
317
  if (typeof d.properties != "object")
318
318
  throw new Error(
319
- `getSchema: ${u} returned unexpected format: ${JSON.stringify(i)}`
319
+ `getSchema: ${l} returned unexpected format: ${JSON.stringify(o)}`
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: a } = d, c = C(a);
322
+ for (let w in c) {
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(">"))) {
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
332
  const w = a._modelTitle.title, m = a._modelTitleField.title;
333
- return { properties: l, meta: { modelTitleField: m, modelTitle: w } };
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) } : 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), {});
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,71 +351,99 @@ 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
+ }, lt = (n) => N(R(n)), dt = (n, t) => K(g(i({}, 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(l) {
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 });
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
371
  return a ? a["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: 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 });
379
379
  let $ = f ? f["ec:dm-asset"] : [];
380
- return $ = Array.isArray($) ? $ : [$], { count: a, total: l, items: $ };
380
+ return $ = Array.isArray($) ? $ : [$], { count: a, total: c, items: $ };
381
381
  });
382
382
  }
383
383
  function pt(d) {
384
- return c(this, arguments, function* ({
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,
391
- options: i
390
+ name: l,
391
+ options: o
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 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[$]);
397
397
  }), (yield p(
398
398
  a,
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(l) {
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 o = y(`a/${t}/${e}`, n), d = new FormData();
417
+ return s.forEach((c) => {
418
+ d.append(
419
+ "file",
420
+ c
421
+ /* , name */
422
+ );
423
+ }), r && Object.keys(r).forEach((c) => {
424
+ d.append(c, r[c]);
425
+ }), (yield p(
426
+ o,
427
+ {},
428
+ {
429
+ method: "POST",
430
+ body: d
431
+ }
432
+ ))._embedded["ec:dm-asset"];
433
+ });
434
+ }
435
+ function mt(l) {
436
+ return u(this, arguments, function* ({
409
437
  env: n,
410
438
  dmShortID: t,
411
439
  assetGroup: e,
412
440
  assetID: s,
413
441
  token: r
414
442
  }) {
415
- g({ env: n, dmShortID: t, assetGroup: e, assetID: s });
416
- const i = y(`a/${t}/${e}/${s}`, n);
443
+ h({ env: n, dmShortID: t, assetGroup: e, assetID: s });
444
+ const o = y(`a/${t}/${e}/${s}`, n);
417
445
  yield p(
418
- i,
446
+ o,
419
447
  { token: r, rawRes: !0 },
420
448
  {
421
449
  method: "DELETE"
@@ -423,46 +451,46 @@ function yt(u) {
423
451
  );
424
452
  });
425
453
  }
426
- function mt(n) {
427
- return c(this, null, function* () {
454
+ function $t(n) {
455
+ return u(this, null, function* () {
428
456
  let { env: t, dmID: e, token: s } = n;
429
- g({ env: t, dmID: e });
457
+ h({ env: t, dmID: e });
430
458
  const r = y(`?dataManagerID=${e}`, t);
431
459
  return p(r, { token: s });
432
460
  });
433
461
  }
434
- function $t(n) {
435
- return c(this, null, function* () {
462
+ function kt(n) {
463
+ return u(this, null, function* () {
436
464
  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);
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);
439
467
  let a = d ? d["ec:datamanager"] : [];
440
- return a = Array.isArray(a) ? a : [a], { count: u, total: i, items: a };
468
+ return a = Array.isArray(a) ? a : [a], { count: l, total: o, items: a };
441
469
  });
442
470
  }
443
- function kt(n) {
444
- return c(this, null, function* () {
471
+ function wt(n) {
472
+ return u(this, null, function* () {
445
473
  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 };
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 };
450
478
  });
451
479
  }
452
- function wt(n) {
453
- return c(this, null, function* () {
480
+ function Tt(n) {
481
+ return u(this, null, function* () {
454
482
  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]] : [];
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
+ let f = c ? c[Object.keys(c)[0]] : [];
458
486
  return f = Array.isArray(f) ? f : [f], { count: d, total: a, items: f };
459
487
  });
460
488
  }
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);
489
+ function Et(e) {
490
+ 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);
466
494
  return p(a, n, t);
467
495
  });
468
496
  }
@@ -470,62 +498,64 @@ const b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
470
498
  __proto__: null,
471
499
  assetList: ft,
472
500
  createAsset: pt,
501
+ createAssets: yt,
473
502
  createEntry: it,
474
- deleteAsset: yt,
503
+ deleteAsset: mt,
475
504
  deleteEntry: N,
476
505
  deleteEntryObject: lt,
477
- dmList: $t,
506
+ dmList: kt,
478
507
  editEntry: K,
479
508
  editEntryObject: dt,
480
- entryList: I,
509
+ entryList: F,
481
510
  filterOptions: ut,
482
- getAsset: ht,
483
- getDatamanager: mt,
511
+ getAsset: gt,
512
+ getDatamanager: $t,
484
513
  getEcAuthKey: et,
485
514
  getEntry: ot,
486
- getEntryAsset: gt,
515
+ getEntryAsset: ht,
487
516
  getEntryEnv: J,
488
517
  getEntryShortID: P,
489
518
  getPublicAuthKey: tt,
490
519
  getSchema: ct,
491
- loginEc: X,
492
- loginPublic: W,
493
- logoutEc: Z,
494
- logoutPublic: Y,
520
+ loginEc: Y,
521
+ loginPublic: X,
522
+ logoutEc: G,
523
+ logoutPublic: Z,
495
524
  mapEntries: at,
496
- modelList: kt,
525
+ modelList: wt,
497
526
  publicApi: rt,
498
- raw: Tt,
499
- resourceList: wt,
500
- sdkOptions: F
527
+ raw: Et,
528
+ resourceList: Tt,
529
+ sdkOptions: I
501
530
  }, Symbol.toStringTag, { value: "Module" })), {
502
531
  entryList: D,
503
- mapEntries: Et,
504
- getEntry: bt,
505
- getAsset: At,
532
+ mapEntries: bt,
533
+ getEntry: At,
534
+ getAsset: _t,
506
535
  assetList: q,
507
- createAsset: _t,
508
- deleteAsset: Ot,
509
- createEntry: Pt,
536
+ createAsset: Ot,
537
+ createAssets: Pt,
538
+ deleteAsset: jt,
539
+ createEntry: St,
510
540
  editEntry: x,
511
- deleteEntry: jt,
512
- getSchema: St,
513
- loginPublic: Lt,
514
- loginEc: vt,
515
- logoutEc: Bt,
516
- logoutPublic: Dt,
541
+ deleteEntry: Lt,
542
+ getSchema: Bt,
543
+ loginPublic: vt,
544
+ loginEc: Dt,
545
+ logoutEc: qt,
546
+ logoutPublic: xt,
517
547
  getEcAuthKey: T,
518
548
  getPublicAuthKey: E,
519
- dmList: qt,
520
- modelList: xt,
521
- publicApi: zt,
522
- getDatamanager: Ct,
523
- resourceList: It,
524
- raw: Kt
549
+ dmList: zt,
550
+ modelList: Ct,
551
+ publicApi: Ft,
552
+ getDatamanager: Kt,
553
+ resourceList: Nt,
554
+ raw: It
525
555
  } = b;
526
- function Ft(n) {
556
+ function Rt(n) {
527
557
  const { action: t } = n;
528
- if (g({ action: t }), !b[t])
558
+ if (h({ action: t }), !b[t])
529
559
  throw new Error(
530
560
  `"${t}" does not exist! try one of ${Object.keys(b).join(
531
561
  ", "
@@ -548,13 +578,13 @@ class _ {
548
578
  }
549
579
  /** @ignore */
550
580
  set(t) {
551
- return new _(o(o({}, this.config), t));
581
+ return new _(i(i({}, this.config), t));
552
582
  }
553
583
  /** @ignore */
554
584
  entries() {
555
- return c(this, arguments, function* (t = {}) {
585
+ return u(this, arguments, function* (t = {}) {
556
586
  const e = yield this.getBestToken();
557
- return D(h(o({}, this.config), { options: t, token: e }));
587
+ return D(g(i({}, this.config), { options: t, token: e }));
558
588
  });
559
589
  }
560
590
  /**
@@ -571,9 +601,9 @@ class _ {
571
601
  * const secrets = await fdk("stage").token(token).dm("83cc6374").model("secret").entryList()
572
602
  */
573
603
  entryList(t) {
574
- return c(this, null, function* () {
604
+ return u(this, null, function* () {
575
605
  const e = yield this.getBestToken();
576
- return D(h(o({}, this.config), { options: t, token: e }));
606
+ return D(g(i({}, this.config), { options: t, token: e }));
577
607
  });
578
608
  }
579
609
  /**
@@ -588,9 +618,9 @@ class _ {
588
618
  * console.log("res", res);
589
619
  */
590
620
  mapEntries(s) {
591
- return c(this, arguments, function* (t, e = {}) {
621
+ return u(this, arguments, function* (t, e = {}) {
592
622
  const r = yield this.getBestToken();
593
- return Et(h(o({}, this.config), { options: e, token: r }), t);
623
+ return bt(g(i({}, this.config), { options: e, token: r }), t);
594
624
  });
595
625
  }
596
626
  /**
@@ -601,9 +631,9 @@ class _ {
601
631
  * const muffin = await fdk("stage").dm("83cc6374").model("muffin").getEntry("1gOtzWvrdq")
602
632
  */
603
633
  getEntry(t) {
604
- return c(this, null, function* () {
634
+ return u(this, null, function* () {
605
635
  const e = yield this.getBestToken();
606
- return bt(h(o({}, this.config), { entryID: t, token: e }));
636
+ return At(g(i({}, this.config), { entryID: t, token: e }));
607
637
  });
608
638
  }
609
639
  /**
@@ -621,9 +651,9 @@ class _ {
621
651
  * .editEntrySafe("1gOtzWvrdq", { name: "test", _modified: "2020-01-01T00:00:00.000Z"})
622
652
  */
623
653
  editEntrySafe(t, e) {
624
- return c(this, null, function* () {
654
+ return u(this, null, function* () {
625
655
  const s = yield this.getBestToken();
626
- return x(h(o({}, this.config), { entryID: t, token: s, value: e, safePut: !0 }));
656
+ return x(g(i({}, this.config), { entryID: t, token: s, value: e, safePut: !0 }));
627
657
  });
628
658
  }
629
659
  /**
@@ -634,15 +664,15 @@ class _ {
634
664
  * const muffin = await fdk("stage").dm("83cc6374").model("muffin").getSchema()
635
665
  */
636
666
  getSchema() {
637
- return c(this, null, function* () {
638
- return St(this.config);
667
+ return u(this, null, function* () {
668
+ return Bt(this.config);
639
669
  });
640
670
  }
641
671
  /** @ignore */
642
672
  assets(t) {
643
- return c(this, null, function* () {
673
+ return u(this, null, function* () {
644
674
  const e = yield this.getBestToken();
645
- return q(h(o({}, this.config), { options: t, token: e }));
675
+ return q(g(i({}, this.config), { options: t, token: e }));
646
676
  });
647
677
  }
648
678
  /**
@@ -657,9 +687,9 @@ class _ {
657
687
  * const files = await fdk("stage").token(token).dm("83cc6374").assetGroup("avatars").assetList()
658
688
  */
659
689
  assetList(t) {
660
- return c(this, null, function* () {
690
+ return u(this, null, function* () {
661
691
  const e = yield this.getBestToken();
662
- return q(h(o({}, this.config), { options: t, token: e }));
692
+ return q(g(i({}, this.config), { options: t, token: e }));
663
693
  });
664
694
  }
665
695
  /**
@@ -682,9 +712,34 @@ class _ {
682
712
  * .createAsset({ file, name: "venndiagram.png" });
683
713
  */
684
714
  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 }));
715
+ 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
+ });
719
+ }
720
+ /**
721
+ * Uploads multiple assets. Expects `dmShortID` / `assetGroup` / `files` to be set.
722
+ * If the assetGroup is not public, you also need to provide a `token`.
723
+ * @category Assets
724
+ * @example
725
+ * // browser example
726
+ * document.getElementById("file").addEventListener("input", async (e) => {
727
+ * const files = e.target.files;
728
+ * const asset = await ecadmin.assetgroup("test").createAssets({ files })
729
+ * });
730
+ * @example
731
+ * // node example
732
+ * const buf = fs.readFileSync("venndiagram.png");
733
+ * const files = [new Blob([buf])];
734
+ * const upload = await fdk("stage")
735
+ * .dm("83cc6374")
736
+ * .assetgroup("test")
737
+ * .createAsset({ files });
738
+ */
739
+ createAssets(t) {
740
+ return u(this, null, function* () {
741
+ const { files: e, options: s } = t, r = yield this.getBestToken();
742
+ return Pt(g(i({}, this.config), { files: e, options: s, token: r }));
688
743
  });
689
744
  }
690
745
  /**
@@ -696,9 +751,9 @@ class _ {
696
751
  * await ecadmin.assetgroup("test").deleteAsset('xxxx');
697
752
  */
698
753
  deleteAsset(t) {
699
- return c(this, null, function* () {
754
+ return u(this, null, function* () {
700
755
  const e = yield this.getBestToken();
701
- return Ot(h(o({}, this.config), { token: e, assetID: t }));
756
+ return jt(g(i({}, this.config), { token: e, assetID: t }));
702
757
  });
703
758
  }
704
759
  /**
@@ -709,9 +764,9 @@ class _ {
709
764
  * const asset = await fdk("stage").dm("83cc6374").assetgroup("test").getAsset("tP-ZxpZZTGmbPnET-wArAQ")
710
765
  */
711
766
  getAsset(t) {
712
- return c(this, null, function* () {
767
+ return u(this, null, function* () {
713
768
  const e = yield this.getBestToken();
714
- return At(h(o({}, this.config), { assetID: t, token: e }));
769
+ return _t(g(i({}, this.config), { assetID: t, token: e }));
715
770
  });
716
771
  }
717
772
  /**
@@ -723,9 +778,9 @@ class _ {
723
778
  * const entry = await fdk("stage").dm("83cc6374").model("muffin").createEntry({ name: 'test' })
724
779
  */
725
780
  createEntry(t) {
726
- return c(this, null, function* () {
781
+ return u(this, null, function* () {
727
782
  const e = yield this.getBestToken();
728
- return Pt(h(o({}, this.config), { token: e, value: t }));
783
+ return St(g(i({}, this.config), { token: e, value: t }));
729
784
  });
730
785
  }
731
786
  /**
@@ -738,9 +793,9 @@ class _ {
738
793
  * const entry = await fdk("stage").dm("83cc6374").model("muffin").editEntry("1gOtzWvrdq", { name: "test" })
739
794
  */
740
795
  editEntry(t, e) {
741
- return c(this, null, function* () {
796
+ return u(this, null, function* () {
742
797
  const s = yield this.getBestToken();
743
- return x(h(o({}, this.config), { entryID: t, token: s, value: e }));
798
+ return x(g(i({}, this.config), { entryID: t, token: s, value: e }));
744
799
  });
745
800
  }
746
801
  /**
@@ -753,9 +808,9 @@ class _ {
753
808
  * await fdk("stage").dm("83cc6374").model("muffin").deleteEntry("1gOtzWvrdq")
754
809
  */
755
810
  deleteEntry(t) {
756
- return c(this, null, function* () {
811
+ return u(this, null, function* () {
757
812
  const e = yield this.getBestToken();
758
- return jt(h(o({}, this.config), { token: e, entryID: t }));
813
+ return Lt(g(i({}, this.config), { token: e, entryID: t }));
759
814
  });
760
815
  }
761
816
  /**
@@ -767,9 +822,9 @@ class _ {
767
822
  * const res = await fdk("stage").resource("template").resourceList()
768
823
  */
769
824
  resourceList(t) {
770
- return c(this, null, function* () {
825
+ return u(this, null, function* () {
771
826
  const e = yield this.getBestToken();
772
- return It(h(o({}, this.config), { options: t, token: e }));
827
+ return Nt(g(i({}, this.config), { options: t, token: e }));
773
828
  });
774
829
  }
775
830
  /**
@@ -783,9 +838,9 @@ class _ {
783
838
  * const res = await fdk("stage").route("stats").raw()
784
839
  */
785
840
  raw(t, e) {
786
- return c(this, null, function* () {
841
+ return u(this, null, function* () {
787
842
  const s = yield this.getBestToken();
788
- return Kt(h(o({}, this.config), { options: t, token: s }), e);
843
+ return It(g(i({}, this.config), { options: t, token: s }), e);
789
844
  });
790
845
  }
791
846
  /**
@@ -852,7 +907,7 @@ class _ {
852
907
  * @category Auth
853
908
  */
854
909
  loginEc(t) {
855
- return vt(o(o({}, this.config), t)).then(
910
+ return Dt(i(i({}, this.config), t)).then(
856
911
  (e) => this.setToken(T(this.config), e.token)
857
912
  );
858
913
  }
@@ -861,7 +916,7 @@ class _ {
861
916
  * @category Auth
862
917
  */
863
918
  loginPublic(t) {
864
- return Lt(o(o({}, this.config), t)).then(
919
+ return vt(i(i({}, this.config), t)).then(
865
920
  (e) => this.setToken(E(this.config), e.token)
866
921
  );
867
922
  }
@@ -871,7 +926,7 @@ class _ {
871
926
  */
872
927
  logoutPublic() {
873
928
  const t = this.getPublicToken();
874
- return Dt(h(o({}, this.config), { token: t })).then(
929
+ return xt(g(i({}, this.config), { token: t })).then(
875
930
  () => this.removeToken(E(this.config))
876
931
  );
877
932
  }
@@ -881,7 +936,7 @@ class _ {
881
936
  */
882
937
  logoutEc() {
883
938
  const t = this.getEcToken();
884
- return Bt(h(o({}, this.config), { token: t })).then(
939
+ return qt(g(i({}, this.config), { token: t })).then(
885
940
  () => this.removeToken(T(this.config))
886
941
  );
887
942
  }
@@ -981,16 +1036,16 @@ class _ {
981
1036
  * @category Entries
982
1037
  */
983
1038
  publicApi() {
984
- return zt(this.config);
1039
+ return Ft(this.config);
985
1040
  }
986
1041
  /**
987
1042
  * Loads a DatamanagerResource by its long id. Requires token.
988
1043
  * @category Admin
989
1044
  */
990
1045
  getDatamanager(t) {
991
- return c(this, null, function* () {
1046
+ return u(this, null, function* () {
992
1047
  const e = yield this.getBestToken();
993
- return Ct(h(o({}, this.config), { dmID: t, token: e }));
1048
+ return Kt(g(i({}, this.config), { dmID: t, token: e }));
994
1049
  });
995
1050
  }
996
1051
  /**
@@ -1002,9 +1057,9 @@ class _ {
1002
1057
  * const dms = await fdk("stage").dmList()
1003
1058
  */
1004
1059
  dmList() {
1005
- return c(this, arguments, function* (t = {}) {
1060
+ return u(this, arguments, function* (t = {}) {
1006
1061
  const e = yield this.getBestToken();
1007
- return qt(h(o({}, this.config), { options: t, token: e }));
1062
+ return zt(g(i({}, this.config), { options: t, token: e }));
1008
1063
  });
1009
1064
  }
1010
1065
  /**
@@ -1016,51 +1071,52 @@ class _ {
1016
1071
  * const models = await fdk("stage").dmID("254a03f1-cb76-4f1e-a52a-bbd4180ca10c").modelList()
1017
1072
  */
1018
1073
  modelList() {
1019
- return c(this, arguments, function* (t = {}) {
1074
+ return u(this, arguments, function* (t = {}) {
1020
1075
  const e = yield this.getBestToken();
1021
- return xt(h(o({}, this.config), { options: t, token: e }));
1076
+ return Ct(g(i({}, this.config), { options: t, token: e }));
1022
1077
  });
1023
1078
  }
1024
1079
  }
1025
- const Jt = (n) => new _({ env: n }), Rt = (n) => new _({ env: n });
1080
+ const Ut = (n) => new _({ env: n }), Mt = (n) => new _({ env: n });
1026
1081
  export {
1027
1082
  _ as Fdk,
1028
- Ft as act,
1083
+ Rt as act,
1029
1084
  y as apiURL,
1030
1085
  A as apis,
1031
1086
  ft as assetList,
1032
1087
  pt as createAsset,
1088
+ yt as createAssets,
1033
1089
  it as createEntry,
1034
- yt as deleteAsset,
1090
+ mt as deleteAsset,
1035
1091
  N as deleteEntry,
1036
1092
  lt as deleteEntryObject,
1037
- $t as dmList,
1093
+ kt as dmList,
1038
1094
  K as editEntry,
1039
1095
  dt as editEntryObject,
1040
- I as entryList,
1041
- g as expect,
1042
- Jt as fdk,
1096
+ F as entryList,
1097
+ h as expect,
1098
+ Ut as fdk,
1043
1099
  p as fetcher,
1044
1100
  ut as filterOptions,
1045
- ht as getAsset,
1046
- mt as getDatamanager,
1101
+ gt as getAsset,
1102
+ $t as getDatamanager,
1047
1103
  et as getEcAuthKey,
1048
1104
  ot as getEntry,
1049
- gt as getEntryAsset,
1105
+ ht as getEntryAsset,
1050
1106
  J as getEntryEnv,
1051
1107
  P as getEntryShortID,
1052
1108
  tt as getPublicAuthKey,
1053
1109
  ct as getSchema,
1054
- X as loginEc,
1055
- W as loginPublic,
1056
- Z as logoutEc,
1057
- Y as logoutPublic,
1110
+ Y as loginEc,
1111
+ X as loginPublic,
1112
+ G as logoutEc,
1113
+ Z as logoutPublic,
1058
1114
  at as mapEntries,
1059
- kt as modelList,
1115
+ wt as modelList,
1060
1116
  rt as publicApi,
1061
1117
  k as query,
1062
- Tt as raw,
1063
- wt as resourceList,
1064
- Rt as sdk,
1065
- F as sdkOptions
1118
+ Et as raw,
1119
+ Tt as resourceList,
1120
+ Mt as sdk,
1121
+ I as sdkOptions
1066
1122
  };
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").AssetList>;
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,CAA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G,OAAO,QAAqB,CAAC;AAC/D,cAAc;AACd,eAAO,MAAM,GAAG,QAAS,MAAM,GAAG,OAAO,QAAqB,CAAC"}
@@ -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<AssetList>;
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,SAAS,CAAC,CAqBrB;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,EAChC,GAAG,EACH,SAAS,EACT,UAAU,EACV,OAAO,EACP,KAAK,GACN;;;;;;CAAA,iBAUA"}
package/dist/types.d.ts CHANGED
@@ -13,6 +13,7 @@ export type AssetResource = {
13
13
  mimetype: string;
14
14
  duplicates: number;
15
15
  file: AssetFile;
16
+ fileVariants: AssetFile[];
16
17
  };
17
18
  export type EntryResource = Record<string, any> & {
18
19
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,IAAI,CAAC;IACd,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,IAAI,EAAE,CAAC,MAAM,GAAG,GAAG,CAAC,EAAE,CAAC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AM,MAAM,kBAAkB,GAAG;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7B,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ec.fdk",
3
- "version": "0.7.2",
3
+ "version": "0.8.0",
4
4
  "description": "ec frontend sdk",
5
5
  "main": "dist/index.cjs",
6
6
  "directories": {