ec.fdk 0.4.2 → 0.4.4

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
@@ -70,7 +70,7 @@ Now what follows is the autogenerated doc from source:
70
70
  * [.getAsset(assetID)](#module_api.Sdk+getAsset) ⇒ [<code>Promise.&lt;AssetResource&gt;</code>](#AssetResource)
71
71
  * [.createEntry(value)](#module_api.Sdk+createEntry) ⇒ [<code>Promise.&lt;EntryResource&gt;</code>](#EntryResource)
72
72
  * [.editEntry(entryID, value)](#module_api.Sdk+editEntry) ⇒ [<code>Promise.&lt;EntryResource&gt;</code>](#EntryResource)
73
- * [.deleteEntry(entryID)](#module_api.Sdk+deleteEntry) ⇒ <code>void</code>
73
+ * [.deleteEntry(entryID)](#module_api.Sdk+deleteEntry) ⇒ <code>Promise.&lt;void&gt;</code>
74
74
  * [.resourceList([options])](#module_api.Sdk+resourceList) ⇒ [<code>Promise.&lt;ResourceList&gt;</code>](#ResourceList)
75
75
  * [.raw([options], [fetchOptions])](#module_api.Sdk+raw) ⇒ <code>Promise.&lt;any&gt;</code>
76
76
  * [.model(model)](#module_api.Sdk+model) ⇒
@@ -281,7 +281,7 @@ const entry = await sdk("stage").dm("83cc6374").model("muffin").editEntry("1gOtz
281
281
  ```
282
282
  <a name="module_api.Sdk+deleteEntry"></a>
283
283
 
284
- #### sdk.deleteEntry(entryID) ⇒ <code>void</code>
284
+ #### sdk.deleteEntry(entryID) ⇒ <code>Promise.&lt;void&gt;</code>
285
285
  <p>Deletes an entry. Expects <code>dmShortID</code> / <code>model</code> to be set.
286
286
  If model DELETE is not public, you also need to provide a <code>token</code>.</p>
287
287
 
@@ -493,18 +493,3 @@ const dms = await sdk("stage").dmList()
493
493
  ```js
494
494
  const models = await sdk("stage").dmID("254a03f1-cb76-4f1e-a52a-bbd4180ca10c").modelList()
495
495
  ```
496
- <a name="module_api.sdkOptions"></a>
497
-
498
- ### api.sdkOptions(options) ⇒ <code>Promise.&lt;any&gt;</code>
499
- <p>Takes <a href="https://entrecode.github.io/ec.sdk/#filteroptions">ec.sdk filterOptions</a>, outputs an <a href="https://doc.entrecode.de/api-basics/#filtering">entrecode filter</a></p>
500
-
501
- **Kind**: static method of [<code>api</code>](#module_api)
502
-
503
- | Param | Type | Description |
504
- | --- | --- | --- |
505
- | options | <code>SdkFilterOptions</code> | <p>sdk filterOptions</p> |
506
-
507
- **Example**
508
- ```js
509
- const res = await sdk("stage").route("stats").raw()
510
- ```
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var rt=Object.defineProperty,it=Object.defineProperties;var ot=Object.getOwnPropertyDescriptors;var j=Object.getOwnPropertySymbols;var ct=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable;var S=(n,t,e)=>t in n?rt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,o=(n,t)=>{for(var e in t||(t={}))ct.call(t,e)&&S(n,e,t[e]);if(j)for(var e of j(t))at.call(t,e)&&S(n,e,t[e]);return n},y=(n,t)=>it(n,ot(t));var c=(n,t,e)=>new Promise((s,r)=>{var l=a=>{try{d(e.next(a))}catch(u){r(u)}},i=a=>{try{d(e.throw(a))}catch(u){r(u)}},d=a=>a.done?s(a.value):Promise.resolve(a.value).then(l,i);d((e=e.apply(n,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function g(s){return c(this,arguments,function*(n,t={},e={}){var d;const{token:r,rawRes:l}=t;r&&(e.headers=y(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 a=yield i.json(),u=`${a.title}
2
- ${a.detail}
3
- ${a.verbose}`;throw new Error(u)}throw new Error(`unexpected fetch error: ${i.statusText}`)}return l?i:yield i.json()})}const B={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/"}};function p(n,t="stage",e="datamanager"){const s=B[e];if(!s)throw new Error(`subdomain "${e}" not found. Try one of ${Object.keys(B).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 w(n,t=!0){return Object.entries(n).sort((e,s)=>e[0].localeCompare(s[0])).map(([e,s])=>`${e}=${s}`).join("&")}function h(n){Object.entries(n).forEach(([t,e])=>{if(e===void 0)throw new Error(`expected ${t} to be set!`)})}const D={stage:"https://accounts.cachena.entrecode.de/",live:"https://accounts.entrecode.de/"};function x(n){return c(this,null,function*(){let{env:t,dmShortID:e,email:s,password:r}=n;h({env:t,dmShortID:e,email:s,password:r});const l=p(`api/${e}/_auth/login?clientID=rest`,t);return yield g(l,{},{method:"POST",body:JSON.stringify({email:s,password:r}),headers:{"Content-Type":"application/json"}})})}function K(n){return c(this,null,function*(){let{env:t,email:e,password:s}=n;h({env:t,email:e,password:s});const r=`${D[t]}auth/login?clientID=rest`;return yield g(r,{},{method:"POST",body:JSON.stringify({email:e,password:s}),headers:{"Content-Type":"application/json"}})})}function N(n){return c(this,null,function*(){let{dmShortID:t,env:e,token:s}=n;h({dmShortID:t,env:e,token:s});const r=p(`api/${t}/_auth/logout?clientID=rest&token=${s}`,e);return yield g(r,{dmShortID:t,rawRes:!0},{method:"POST"})})}function z(n){return c(this,null,function*(){let{env:t,token:e}=n;h({env:t,token:e});const s=`${D[t]}auth/logout?clientID=rest`;return yield g(s,{rawRes:!0,token:e},{method:"POST"})})}function C({dmShortID:n}){return h({dmShortID:n}),n}function F({env:n}){return h({env:n}),n}let ut=["created","creator","id","modified","private","_created","_creator","_embedded","_entryTitle","_id","_links","_modelTitle","_modelTitleField","_modified"];function J(n){let t={};for(let e in n)ut.includes(e)||(t[e]=n[e]);return t}function lt(n){return JSON.parse(JSON.stringify(n))}function R(n){return c(this,null,function*(){let{env:t,dmShortID:e}=n;h({env:t,dmShortID:e});const s=p(`api/${e}`,t);return g(s,n)})}function v(n){return c(this,null,function*(){let{env:t,dmShortID:e,model:s,options:r={}}=n;h({env:t,dmShortID:e,model:s}),r=o({size:50,page:1,_list:!0},r);const l=w(r),i=p(`api/${e}/${s}?${l}`,t),{count:d,total:a,_embedded:u}=yield g(i,n);let f=u?u[`${e}:${s}`]:[];return f=Array.isArray(f)?f:[f],{count:d,total:a,items:f}})}function U({env:n,dmShortID:t,model:e,entryID:s,token:r}){h({env:n,dmShortID:t,model:e,entryID:s});const l=w({_id:s}),i=p(`api/${t}/${e}?${l}`,n);return g(i,{dmShortID:t,token:r})}function M(l){return c(this,arguments,function*({env:n,dmShortID:t,model:e,value:s,token:r}){h({env:n,dmShortID:t,model:e,value:s});const i=p(`api/${t}/${e}`,n);return yield g(i,{env:n,dmShortID:t,token:r},{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}})})}function I(d){return c(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,value:r,token:l,safePut:i=!1}){h({env:n,dmShortID:t,model:e,entryID:s,value:r});const a={"Content-Type":"application/json"};if(i){if(!("_modified"in r))throw new Error("expected _modified to be set!");a["If-Unmodified-Since"]=new Date(r._modified).toUTCString()}const u=p(`api/${t}/${e}?_id=${s}`,n);return r=lt(r),r=J(r),yield g(u,{token:l},{method:"PUT",headers:a,body:JSON.stringify(r)})})}function V(l){return c(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,token:r}){h({env:n,dmShortID:t,model:e,entryID:s});const i=p(`api/${t}/${e}?_id=${s}`,n);yield g(i,{token:r,rawRes:!0},{method:"DELETE",headers:{"Content-Type":"application/json"}})})}function G(r){return c(this,arguments,function*({env:n,dmShortID:t,model:e,withMetadata:s}){var f,$,P,O,L;h({env:n,dmShortID:t,model:e});const l=p(`api/schema/${t}/${e}`,n),i=yield g(l),d=(f=i==null?void 0:i.allOf)==null?void 0:f[1];if(typeof d.properties!="object")throw new Error(`getSchema: ${l} returned unexpected format: ${JSON.stringify(i)}`);const{properties:a}=d,u=J(a);for(let A in u){let m=u[A];if(m.required=d.required.includes(A),($=u[A])!=null&&$.oneOf&&((P=u[A])==null||delete P.oneOf),(O=m.title)!=null&&O.includes("<")&&((L=m.title)!=null&&L.includes(">"))){const E=m.title.split("<")[1].slice(0,-1),st=m.title.split("<")[0];m.type=st,E.includes(":")?m.resource=E.split(":")[1]:m.resource=E}else["asset","entry","assets","entries"].includes(m.title)?(m.type=m.title,m.resource=null):m.type=m.title;delete u[A].title}if(s){const A=a._modelTitle.title,m=a._modelTitleField.title;return{properties:u,meta:{modelTitleField:m,modelTitle:A}}}return u})}function H(l){return c(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){h({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=w({assetID:s}),d=p(`a/${t}/${e}?${i}`,n);return(yield g(d,{dmShortID:t,token:r}))._embedded["ec:dm-asset"]})}function Q(n){return c(this,null,function*(){let{env:t,dmShortID:e,assetGroup:s,token:r,options:l={}}=n;h({env:t,dmShortID:e,assetGroup:s}),l=o({size:50,page:1,_list:!0},l);const i=w(l),d=p(`a/${e}/${s}?${i}`,t),{count:a,total:u,_embedded:f}=yield g(d,{dmShortID:e,token:r});let $=f?f["ec:dm-asset"]:[];return $=Array.isArray($)?$:[$],{count:a,total:u,items:$}})}function W(d){return c(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,token:s,file:r,name:l,options:i}){h({env:n,dmShortID:t,assetGroup:e,file:r});const a=p(`a/${t}/${e}`,n),u=new FormData;return u.append("file",r,l),i&&Object.keys(i).forEach($=>{u.append($,i[$])}),(yield g(a,{token:s},{method:"POST",body:u}))._embedded["ec:dm-asset"]})}function X(l){return c(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){h({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=p(`a/${t}/${e}/${s}`,n);yield g(i,{token:r,rawRes:!0},{method:"DELETE"})})}function Y(n){return c(this,null,function*(){let{env:t,dmID:e,token:s}=n;h({env:t,dmID:e});const r=p(`?dataManagerID=${e}`,t);return g(r,{token:s})})}function Z(n){return c(this,null,function*(){let{env:t,options:e={}}=n;h({env:t}),e=o({size:25,page:1,_list:!0},e);const s=w(e),r=p(`?${s}`,t),{count:l,total:i,_embedded:d}=yield g(r,n);let a=d?d["ec:datamanager"]:[];return a=Array.isArray(a)?a:[a],{count:l,total:i,items:a}})}function tt(n){return c(this,null,function*(){let{env:t,dmID:e,options:s={}}=n;h({env:t,dmID:e}),s=o({size:25,dataManagerID:e,page:1,_list:!0},s);const r=w(s),l=p(`model?${r}`,t),{count:i,total:d,_embedded:a}=yield g(l,n);let u=a?a["ec:model"]:[];return u=Array.isArray(u)?u:[u],{count:i,total:d,items:u}})}function et(n){return c(this,null,function*(){let{env:t,resource:e,options:s={},subdomain:r="datamanager"}=n;h({env:t,subdomain:r,resource:e}),s=o({size:25,page:1,_list:!0},s);const l=w(s),i=p(`${e}?${l}`,t,r),{count:d,total:a,_embedded:u}=yield g(i,n);let f=u?u[Object.keys(u)[0]]:[];return f=Array.isArray(f)?f:[f],{count:d,total:a,items:f}})}function nt(e){return c(this,arguments,function*(n,t={}){let{env:s,route:r,options:l={},subdomain:i="datamanager"}=n;h({env:s,subdomain:i,route:r}),l=o({},l);const d=w(l),a=p(`${r}?${d}`,s,i);return g(a,n,t)})}const k=Object.freeze(Object.defineProperty({__proto__:null,assetList:Q,createAsset:W,createEntry:M,deleteAsset:X,deleteEntry:V,dmList:Z,editEntry:I,entryList:v,getAsset:H,getDatamanager:Y,getEcAuthKey:F,getEntry:U,getPublicAuthKey:C,getSchema:G,loginEc:K,loginPublic:x,logoutEc:z,logoutPublic:N,modelList:tt,publicApi:R,raw:nt,resourceList:et},Symbol.toStringTag,{value:"Module"})),{entryList:dt,getEntry:ht,getAsset:gt,assetList:ft,createAsset:yt,deleteAsset:pt,createEntry:mt,editEntry:q,deleteEntry:$t,getSchema:wt,loginPublic:At,loginEc:kt,logoutEc:bt,logoutPublic:Et,getEcAuthKey:T,getPublicAuthKey:_,dmList:Tt,modelList:_t,publicApi:Pt,getDatamanager:Ot,resourceList:Lt,raw:jt}=k;function St(n){const{action:t}=n;if(h({action:t}),!k[t])throw new Error(`"${t}" does not exist! try one of ${Object.keys(k).join(", ")}`);return k[t](n)}class b{constructor(t){this.config=t}set(t){return new b(o(o({},this.config),t))}entries(){return c(this,arguments,function*(t={}){const e=yield this.getBestToken();return dt(y(o({},this.config),{options:t,token:e}))})}entryList(t){return c(this,null,function*(){return this.entries(t)})}getEntry(t){return c(this,null,function*(){const e=yield this.getBestToken();return ht(y(o({},this.config),{entryID:t,token:e}))})}editEntrySafe(t,e){return c(this,null,function*(){const s=yield this.getBestToken();return q(y(o({},this.config),{entryID:t,token:s,value:e,safePut:!0}))})}getSchema(){return c(this,null,function*(){return wt(this.config)})}assets(t){return c(this,null,function*(){const e=yield this.getBestToken();return ft(y(o({},this.config),{options:t,token:e}))})}assetList(t){return c(this,null,function*(){return this.assets(t)})}createAsset(){return c(this,arguments,function*({file:t,name:e,options:s}={}){const r=yield this.getBestToken();return yt(y(o({},this.config),{file:t,name:e,options:s,token:r}))})}deleteAsset(t){return c(this,null,function*(){const e=yield this.getBestToken();return pt(y(o({},this.config),{token:e,assetID:t}))})}getAsset(t){return c(this,null,function*(){const e=yield this.getBestToken();return gt(y(o({},this.config),{assetID:t,token:e}))})}createEntry(t){return c(this,null,function*(){const e=yield this.getBestToken();return mt(y(o({},this.config),{token:e,value:t}))})}editEntry(t,e){return c(this,null,function*(){const s=yield this.getBestToken();return q(y(o({},this.config),{entryID:t,token:s,value:e}))})}deleteEntry(t){return c(this,null,function*(){const e=yield this.getBestToken();return $t(y(o({},this.config),{token:e,entryID:t}))})}resourceList(t){return c(this,null,function*(){const e=yield this.getBestToken();return Lt(y(o({},this.config),{options:t,token:e}))})}raw(t,e){return c(this,null,function*(){const s=yield this.getBestToken();return jt(y(o({},this.config),{options:t,token:s}),e)})}authAdapter(t){return this.set({authAdapter:t})}setAuth(t){return e=>{if(!this.config.authAdapter)throw new Error("cannot setAuth: no authAdapter defined!");const{set:s}=this.config.authAdapter;return s(t,e.token),e}}unsetAuth(t){return e=>{if(console.log("unset auth",e),!this.config.authAdapter)throw new Error("cannot unsetAuth: no authAdapter defined!");const{remove:s}=this.config.authAdapter;return s(t),e}}getAuth(t){if(!this.config.authAdapter)throw new Error("cannot getAuth: no authAdapter defined!");const{get:e}=this.config.authAdapter;return e(t)}loginEc(t){return kt(o(o({},this.config),t)).then(this.setAuth(T(this.config)))}loginPublic(t){return At(o(o({},this.config),t)).then(this.setAuth(_(this.config)))}logoutPublic(){const t=this.getPublicToken();return console.log("token",t),Et(y(o({},this.config),{token:t})).then(this.unsetAuth(_(this.config)))}logoutEc(){const t=this.getEcToken();return console.log("token",t),bt(y(o({},this.config),{token:t})).then(this.unsetAuth(T(this.config)))}getPublicToken(){return this.config.token||this.getAuth(_(this.config))}getEcToken(){return this.config.token||this.getAuth(T(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})}dmID(t){return this.set({dmID:t})}dm(t){return this.dmShortID(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 Pt(this.config)}getDatamanager(t){return c(this,null,function*(){const e=yield this.getBestToken();return Ot(y(o({},this.config),{dmID:t,token:e}))})}dmList(){return c(this,arguments,function*(t={}){const e=yield this.getBestToken();return Tt(y(o({},this.config),{options:t,token:e}))})}modelList(){return c(this,arguments,function*(t={}){const e=yield this.getBestToken();return _t(y(o({},this.config),{options:t,token:e}))})}}const Bt=n=>new b({env:n});function qt(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),{})}exports.Sdk=b;exports.act=St;exports.apiURL=p;exports.assetList=Q;exports.createAsset=W;exports.createEntry=M;exports.deleteAsset=X;exports.deleteEntry=V;exports.dmList=Z;exports.editEntry=I;exports.entryList=v;exports.expect=h;exports.fetcher=g;exports.getAsset=H;exports.getDatamanager=Y;exports.getEcAuthKey=F;exports.getEntry=U;exports.getPublicAuthKey=C;exports.getSchema=G;exports.loginEc=K;exports.loginPublic=x;exports.logoutEc=z;exports.logoutPublic=N;exports.modelList=tt;exports.publicApi=R;exports.query=w;exports.raw=nt;exports.resourceList=et;exports.sdk=Bt;exports.sdkOptions=qt;
1
+ "use strict";var ct=Object.defineProperty,at=Object.defineProperties;var ut=Object.getOwnPropertyDescriptors;var S=Object.getOwnPropertySymbols;var lt=Object.prototype.hasOwnProperty,dt=Object.prototype.propertyIsEnumerable;var B=(n,t,e)=>t in n?ct(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,o=(n,t)=>{for(var e in t||(t={}))lt.call(t,e)&&B(n,e,t[e]);if(S)for(var e of S(t))dt.call(t,e)&&B(n,e,t[e]);return n},y=(n,t)=>at(n,ut(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 g(s){return a(this,arguments,function*(n,t={},e={}){var d;const{token:r,rawRes:u}=t;r&&(e.headers=y(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 D={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/"}};function p(n,t="stage",e="datamanager"){const s=D[e];if(!s)throw new Error(`subdomain "${e}" not found. Try one of ${Object.keys(D).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 w(n,t=!0){return Object.entries(n).sort((e,s)=>e[0].localeCompare(s[0])).map(([e,s])=>`${e}=${s}`).join("&")}function h(n){Object.entries(n).forEach(([t,e])=>{if(e===void 0)throw new Error(`expected ${t} to be set!`)})}const x={stage:"https://accounts.cachena.entrecode.de/",live:"https://accounts.entrecode.de/"};function K(n){return a(this,null,function*(){let{env:t,dmShortID:e,email:s,password:r}=n;h({env:t,dmShortID:e,email:s,password:r});const u=p(`api/${e}/_auth/login?clientID=rest`,t);return yield g(u,{},{method:"POST",body:JSON.stringify({email:s,password:r}),headers:{"Content-Type":"application/json"}})})}function N(n){return a(this,null,function*(){let{env:t,email:e,password:s}=n;h({env:t,email:e,password:s});const r=`${x[t]}auth/login?clientID=rest`;return yield g(r,{},{method:"POST",body:JSON.stringify({email:e,password:s}),headers:{"Content-Type":"application/json"}})})}function z(n){return a(this,null,function*(){let{dmShortID:t,env:e,token:s}=n;h({dmShortID:t,env:e,token:s});const r=p(`api/${t}/_auth/logout?clientID=rest&token=${s}`,e);return yield g(r,{dmShortID:t,rawRes:!0},{method:"POST"})})}function C(n){return a(this,null,function*(){let{env:t,token:e}=n;h({env:t,token:e});const s=`${x[t]}auth/logout?clientID=rest`;return yield g(s,{rawRes:!0,token:e},{method:"POST"})})}function F({dmShortID:n}){return h({dmShortID:n}),n}function J({env:n}){return h({env:n}),n}let ht=["created","creator","id","modified","private","_created","_creator","_embedded","_entryTitle","_id","_links","_modelTitle","_modelTitleField","_modified"];function R(n){let t={};for(let e in n)ht.includes(e)||(t[e]=n[e]);return t}function gt(n){return JSON.parse(JSON.stringify(n))}function v(n){return a(this,null,function*(){let{env:t,dmShortID:e}=n;h({env:t,dmShortID:e});const s=p(`api/${e}`,t);return g(s,n)})}function U(n){return a(this,null,function*(){let{env:t,dmShortID:e,model:s,options:r={}}=n;h({env:t,dmShortID:e,model:s}),r=o({size:50,page:1,_list:!0},r);const u=w(r),i=p(`api/${e}/${s}?${u}`,t),{count:d,total:c,_embedded:l}=yield g(i,n);let f=l?l[`${e}:${s}`]:[];return f=Array.isArray(f)?f:[f],{count:d,total:c,items:f}})}function I({env:n,dmShortID:t,model:e,entryID:s,token:r}){h({env:n,dmShortID:t,model:e,entryID:s});const u=w({_id:s}),i=p(`api/${t}/${e}?${u}`,n);return g(i,{dmShortID:t,token:r})}function M(u){return a(this,arguments,function*({env:n,dmShortID:t,model:e,value:s,token:r}){h({env:n,dmShortID:t,model:e,value:s});const i=p(`api/${t}/${e}`,n);return yield g(i,{env:n,dmShortID:t,token:r},{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}})})}function V(d){return a(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,value:r,token:u,safePut:i=!1}){h({env:n,dmShortID:t,model:e,entryID:s,value:r});const 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=p(`api/${t}/${e}?_id=${s}`,n);return r=gt(r),r=R(r),yield g(l,{token:u},{method:"PUT",headers:c,body:JSON.stringify(r)})})}function G({env:n,dmShortID:t,model:e,entryID:s,token:r}){h({env:n,dmShortID:t,model:e,entryID:s});const u=p(`api/${t}/${e}?_id=${s}`,n);return g(u,{token:r,rawRes:!0},{method:"DELETE",headers:{"Content-Type":"application/json"}})}function H(r){return a(this,arguments,function*({env:n,dmShortID:t,model:e,withMetadata:s}){var f,$,O,L,j;h({env:n,dmShortID:t,model:e});const u=p(`api/schema/${t}/${e}`,n),i=yield g(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=R(c);for(let A in l){let m=l[A];if(m.required=d.required.includes(A),($=l[A])!=null&&$.oneOf&&((O=l[A])==null||delete O.oneOf),(L=m.title)!=null&&L.includes("<")&&((j=m.title)!=null&&j.includes(">"))){const b=m.title.split("<")[1].slice(0,-1),ot=m.title.split("<")[0];m.type=ot,b.includes(":")?m.resource=b.split(":")[1]:m.resource=b}else["asset","entry","assets","entries"].includes(m.title)?(m.type=m.title,m.resource=null):m.type=m.title;delete l[A].title}if(s){const A=c._modelTitle.title,m=c._modelTitleField.title;return{properties:l,meta:{modelTitleField:m,modelTitle:A}}}return l})}function Q(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),{})}function P(n){return n._links.collection.href.split("/").slice(-2)[0]}function W(n,t){const e=P(t);return t._embedded[`${e}:${t._modelTitle}/${n}/asset`]}function X(u){return a(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){h({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=w({assetID:s}),d=p(`a/${t}/${e}?${i}`,n);return(yield g(d,{dmShortID:t,token:r}))._embedded["ec:dm-asset"]})}function Y(n){return a(this,null,function*(){let{env:t,dmShortID:e,assetGroup:s,token:r,options:u={}}=n;h({env:t,dmShortID:e,assetGroup:s}),u=o({size:50,page:1,_list:!0},u);const i=w(u),d=p(`a/${e}/${s}?${i}`,t),{count:c,total:l,_embedded:f}=yield g(d,{dmShortID:e,token:r});let $=f?f["ec:dm-asset"]:[];return $=Array.isArray($)?$:[$],{count:c,total:l,items:$}})}function Z(d){return a(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,token:s,file:r,name:u,options:i}){h({env:n,dmShortID:t,assetGroup:e,file:r});const c=p(`a/${t}/${e}`,n),l=new FormData;return l.append("file",r,u),i&&Object.keys(i).forEach($=>{l.append($,i[$])}),(yield g(c,{token:s},{method:"POST",body:l}))._embedded["ec:dm-asset"]})}function tt(u){return a(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){h({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=p(`a/${t}/${e}/${s}`,n);yield g(i,{token:r,rawRes:!0},{method:"DELETE"})})}function et(n){return a(this,null,function*(){let{env:t,dmID:e,token:s}=n;h({env:t,dmID:e});const r=p(`?dataManagerID=${e}`,t);return g(r,{token:s})})}function nt(n){return a(this,null,function*(){let{env:t,options:e={}}=n;h({env:t}),e=o({size:25,page:1,_list:!0},e);const s=w(e),r=p(`?${s}`,t),{count:u,total:i,_embedded:d}=yield g(r,n);let c=d?d["ec:datamanager"]:[];return c=Array.isArray(c)?c:[c],{count:u,total:i,items:c}})}function st(n){return a(this,null,function*(){let{env:t,dmID:e,options:s={}}=n;h({env:t,dmID:e}),s=o({size:25,dataManagerID:e,page:1,_list:!0},s);const r=w(s),u=p(`model?${r}`,t),{count:i,total:d,_embedded:c}=yield g(u,n);let l=c?c["ec:model"]:[];return l=Array.isArray(l)?l:[l],{count:i,total:d,items:l}})}function rt(n){return a(this,null,function*(){let{env:t,resource:e,options:s={},subdomain:r="datamanager"}=n;h({env:t,subdomain:r,resource:e}),s=o({size:25,page:1,_list:!0},s);const u=w(s),i=p(`${e}?${u}`,t,r),{count:d,total:c,_embedded:l}=yield g(i,n);let f=l?l[Object.keys(l)[0]]:[];return f=Array.isArray(f)?f:[f],{count:d,total:c,items:f}})}function it(e){return a(this,arguments,function*(n,t={}){let{env:s,route:r,options:u={},subdomain:i="datamanager"}=n;h({env:s,subdomain:i,route:r}),u=o({},u);const d=w(u),c=p(`${r}?${d}`,s,i);return g(c,n,t)})}const E=Object.freeze(Object.defineProperty({__proto__:null,assetList:Y,createAsset:Z,createEntry:M,deleteAsset:tt,deleteEntry:G,dmList:nt,editEntry:V,entryList:U,getAsset:X,getDatamanager:et,getEcAuthKey:J,getEntry:I,getEntryAsset:W,getEntryShortID:P,getPublicAuthKey:F,getSchema:H,loginEc:N,loginPublic:K,logoutEc:C,logoutPublic:z,modelList:st,publicApi:v,raw:it,resourceList:rt,sdkOptions:Q},Symbol.toStringTag,{value:"Module"})),{entryList:ft,getEntry:yt,getAsset:pt,assetList:mt,createAsset:$t,deleteAsset:wt,createEntry:At,editEntry:q,deleteEntry:Et,getSchema:kt,loginPublic:bt,loginEc:Tt,logoutEc:_t,logoutPublic:Pt,getEcAuthKey:T,getPublicAuthKey:_,dmList:Ot,modelList:Lt,publicApi:jt,getDatamanager:St,resourceList:Bt,raw:Dt}=E;function qt(n){const{action:t}=n;if(h({action:t}),!E[t])throw new Error(`"${t}" does not exist! try one of ${Object.keys(E).join(", ")}`);return E[t](n)}class k{constructor(t){this.config=t}set(t){return new k(o(o({},this.config),t))}entries(){return a(this,arguments,function*(t={}){const e=yield this.getBestToken();return ft(y(o({},this.config),{options:t,token:e}))})}entryList(t){return a(this,null,function*(){return this.entries(t)})}getEntry(t){return a(this,null,function*(){const e=yield this.getBestToken();return yt(y(o({},this.config),{entryID:t,token:e}))})}editEntrySafe(t,e){return a(this,null,function*(){const s=yield this.getBestToken();return q(y(o({},this.config),{entryID:t,token:s,value:e,safePut:!0}))})}getSchema(){return a(this,null,function*(){return kt(this.config)})}assets(t){return a(this,null,function*(){const e=yield this.getBestToken();return mt(y(o({},this.config),{options:t,token:e}))})}assetList(t){return a(this,null,function*(){return this.assets(t)})}createAsset(){return a(this,arguments,function*({file:t,name:e,options:s}={}){const r=yield this.getBestToken();return $t(y(o({},this.config),{file:t,name:e,options:s,token:r}))})}deleteAsset(t){return a(this,null,function*(){const e=yield this.getBestToken();return wt(y(o({},this.config),{token:e,assetID:t}))})}getAsset(t){return a(this,null,function*(){const e=yield this.getBestToken();return pt(y(o({},this.config),{assetID:t,token:e}))})}createEntry(t){return a(this,null,function*(){const e=yield this.getBestToken();return At(y(o({},this.config),{token:e,value:t}))})}editEntry(t,e){return a(this,null,function*(){const s=yield this.getBestToken();return q(y(o({},this.config),{entryID:t,token:s,value:e}))})}deleteEntry(t){return a(this,null,function*(){const e=yield this.getBestToken();return Et(y(o({},this.config),{token:e,entryID:t}))})}resourceList(t){return a(this,null,function*(){const e=yield this.getBestToken();return Bt(y(o({},this.config),{options:t,token:e}))})}raw(t,e){return a(this,null,function*(){const s=yield this.getBestToken();return Dt(y(o({},this.config),{options:t,token:s}),e)})}authAdapter(t){return this.set({authAdapter:t})}setAuth(t){return e=>{if(!this.config.authAdapter)throw new Error("cannot setAuth: no authAdapter defined!");const{set:s}=this.config.authAdapter;return s(t,e.token),e}}unsetAuth(t){return e=>{if(console.log("unset auth",e),!this.config.authAdapter)throw new Error("cannot unsetAuth: no authAdapter defined!");const{remove:s}=this.config.authAdapter;return s(t),e}}getAuth(t){if(!this.config.authAdapter)throw new Error("cannot getAuth: no authAdapter defined!");const{get:e}=this.config.authAdapter;return e(t)}loginEc(t){return Tt(o(o({},this.config),t)).then(this.setAuth(T(this.config)))}loginPublic(t){return bt(o(o({},this.config),t)).then(this.setAuth(_(this.config)))}logoutPublic(){const t=this.getPublicToken();return console.log("token",t),Pt(y(o({},this.config),{token:t})).then(this.unsetAuth(_(this.config)))}logoutEc(){const t=this.getEcToken();return console.log("token",t),_t(y(o({},this.config),{token:t})).then(this.unsetAuth(T(this.config)))}getPublicToken(){return this.config.token||this.getAuth(_(this.config))}getEcToken(){return this.config.token||this.getAuth(T(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})}dmID(t){return this.set({dmID:t})}dm(t){return this.dmShortID(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 jt(this.config)}getDatamanager(t){return a(this,null,function*(){const e=yield this.getBestToken();return St(y(o({},this.config),{dmID:t,token:e}))})}dmList(){return a(this,arguments,function*(t={}){const e=yield this.getBestToken();return Ot(y(o({},this.config),{options:t,token:e}))})}modelList(){return a(this,arguments,function*(t={}){const e=yield this.getBestToken();return Lt(y(o({},this.config),{options:t,token:e}))})}}const xt=n=>new k({env:n});exports.Sdk=k;exports.act=qt;exports.apiURL=p;exports.assetList=Y;exports.createAsset=Z;exports.createEntry=M;exports.deleteAsset=tt;exports.deleteEntry=G;exports.dmList=nt;exports.editEntry=V;exports.entryList=U;exports.expect=h;exports.fetcher=g;exports.getAsset=X;exports.getDatamanager=et;exports.getEcAuthKey=J;exports.getEntry=I;exports.getEntryAsset=W;exports.getEntryShortID=P;exports.getPublicAuthKey=F;exports.getSchema=H;exports.loginEc=N;exports.loginPublic=K;exports.logoutEc=C;exports.logoutPublic=z;exports.modelList=st;exports.publicApi=v;exports.query=w;exports.raw=it;exports.resourceList=rt;exports.sdk=xt;exports.sdkOptions=Q;
package/dist/index.mjs CHANGED
@@ -1,49 +1,49 @@
1
- var N = Object.defineProperty, z = Object.defineProperties;
2
- var C = Object.getOwnPropertyDescriptors;
1
+ var z = Object.defineProperty, C = Object.defineProperties;
2
+ var F = Object.getOwnPropertyDescriptors;
3
3
  var j = Object.getOwnPropertySymbols;
4
- var F = Object.prototype.hasOwnProperty, J = Object.prototype.propertyIsEnumerable;
5
- var S = (n, t, e) => t in n ? N(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, o = (n, t) => {
4
+ var J = Object.prototype.hasOwnProperty, R = Object.prototype.propertyIsEnumerable;
5
+ var S = (n, t, e) => t in n ? z(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, o = (n, t) => {
6
6
  for (var e in t || (t = {}))
7
- F.call(t, e) && S(n, e, t[e]);
7
+ J.call(t, e) && S(n, e, t[e]);
8
8
  if (j)
9
9
  for (var e of j(t))
10
- J.call(t, e) && S(n, e, t[e]);
10
+ R.call(t, e) && S(n, e, t[e]);
11
11
  return n;
12
- }, y = (n, t) => z(n, C(t));
13
- var a = (n, t, e) => new Promise((s, r) => {
14
- var l = (c) => {
12
+ }, p = (n, t) => C(n, F(t));
13
+ var c = (n, t, e) => new Promise((s, r) => {
14
+ var u = (a) => {
15
15
  try {
16
- d(e.next(c));
17
- } catch (u) {
18
- r(u);
16
+ d(e.next(a));
17
+ } catch (l) {
18
+ r(l);
19
19
  }
20
- }, i = (c) => {
20
+ }, i = (a) => {
21
21
  try {
22
- d(e.throw(c));
23
- } catch (u) {
24
- r(u);
22
+ d(e.throw(a));
23
+ } catch (l) {
24
+ r(l);
25
25
  }
26
- }, d = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(l, i);
26
+ }, d = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(u, i);
27
27
  d((e = e.apply(n, t)).next());
28
28
  });
29
29
  function g(s) {
30
- return a(this, arguments, function* (n, t = {}, e = {}) {
30
+ return c(this, arguments, function* (n, t = {}, e = {}) {
31
31
  var d;
32
- const { token: r, rawRes: l } = t;
33
- r && (e.headers = y(o({}, e.headers || {}), {
32
+ const { token: r, rawRes: u } = t;
33
+ r && (e.headers = p(o({}, e.headers || {}), {
34
34
  Authorization: `Bearer ${r}`
35
35
  }));
36
36
  const i = yield fetch(n, e);
37
37
  if (!i.ok) {
38
38
  if ((d = i.headers.get("content-type")) != null && d.includes("application/json")) {
39
- const c = yield i.json(), u = `${c.title}
40
- ${c.detail}
41
- ${c.verbose}`;
42
- throw new Error(u);
39
+ const a = yield i.json(), l = `${a.title}
40
+ ${a.detail}
41
+ ${a.verbose}`;
42
+ throw new Error(l);
43
43
  }
44
44
  throw new Error(`unexpected fetch error: ${i.statusText}`);
45
45
  }
46
- return l ? i : yield i.json();
46
+ return u ? i : yield i.json();
47
47
  });
48
48
  }
49
49
  const B = {
@@ -60,7 +60,7 @@ const B = {
60
60
  stage: "https://appserver.cachena.entrecode.de/"
61
61
  }
62
62
  };
63
- function p(n, t = "stage", e = "datamanager") {
63
+ function y(n, t = "stage", e = "datamanager") {
64
64
  const s = B[e];
65
65
  if (!s)
66
66
  throw new Error(
@@ -84,17 +84,17 @@ function h(n) {
84
84
  throw new Error(`expected ${t} to be set!`);
85
85
  });
86
86
  }
87
- const D = {
87
+ const q = {
88
88
  stage: "https://accounts.cachena.entrecode.de/",
89
89
  live: "https://accounts.entrecode.de/"
90
90
  };
91
- function R(n) {
92
- return a(this, null, function* () {
91
+ function v(n) {
92
+ return c(this, null, function* () {
93
93
  let { env: t, dmShortID: e, email: s, password: r } = n;
94
94
  h({ env: t, dmShortID: e, email: s, password: r });
95
- const l = p(`api/${e}/_auth/login?clientID=rest`, t);
95
+ const u = y(`api/${e}/_auth/login?clientID=rest`, t);
96
96
  return yield g(
97
- l,
97
+ u,
98
98
  {},
99
99
  {
100
100
  method: "POST",
@@ -106,11 +106,11 @@ function R(n) {
106
106
  );
107
107
  });
108
108
  }
109
- function v(n) {
110
- return a(this, null, function* () {
109
+ function U(n) {
110
+ return c(this, null, function* () {
111
111
  let { env: t, email: e, password: s } = n;
112
112
  h({ env: t, email: e, password: s });
113
- const r = `${D[t]}auth/login?clientID=rest`;
113
+ const r = `${q[t]}auth/login?clientID=rest`;
114
114
  return yield g(
115
115
  r,
116
116
  {},
@@ -124,11 +124,11 @@ function v(n) {
124
124
  );
125
125
  });
126
126
  }
127
- function U(n) {
128
- return a(this, null, function* () {
127
+ function I(n) {
128
+ return c(this, null, function* () {
129
129
  let { dmShortID: t, env: e, token: s } = n;
130
130
  h({ dmShortID: t, env: e, token: s });
131
- const r = p(
131
+ const r = y(
132
132
  `api/${t}/_auth/logout?clientID=rest&token=${s}`,
133
133
  e
134
134
  );
@@ -142,10 +142,10 @@ function U(n) {
142
142
  });
143
143
  }
144
144
  function M(n) {
145
- return a(this, null, function* () {
145
+ return c(this, null, function* () {
146
146
  let { env: t, token: e } = n;
147
147
  h({ env: t, token: e });
148
- const s = `${D[t]}auth/logout?clientID=rest`;
148
+ const s = `${q[t]}auth/logout?clientID=rest`;
149
149
  return yield g(
150
150
  s,
151
151
  {
@@ -158,13 +158,13 @@ function M(n) {
158
158
  );
159
159
  });
160
160
  }
161
- function I({ dmShortID: n }) {
161
+ function V({ dmShortID: n }) {
162
162
  return h({ dmShortID: n }), n;
163
163
  }
164
- function V({ env: n }) {
164
+ function G({ env: n }) {
165
165
  return h({ env: n }), n;
166
166
  }
167
- let G = [
167
+ let H = [
168
168
  "created",
169
169
  "creator",
170
170
  "id",
@@ -183,38 +183,38 @@ let G = [
183
183
  function x(n) {
184
184
  let t = {};
185
185
  for (let e in n)
186
- G.includes(e) || (t[e] = n[e]);
186
+ H.includes(e) || (t[e] = n[e]);
187
187
  return t;
188
188
  }
189
- function H(n) {
189
+ function Q(n) {
190
190
  return JSON.parse(JSON.stringify(n));
191
191
  }
192
- function Q(n) {
193
- return a(this, null, function* () {
192
+ function W(n) {
193
+ return c(this, null, function* () {
194
194
  let { env: t, dmShortID: e } = n;
195
195
  h({ env: t, dmShortID: e });
196
- const s = p(`api/${e}`, t);
196
+ const s = y(`api/${e}`, t);
197
197
  return g(s, n);
198
198
  });
199
199
  }
200
- function W(n) {
201
- return a(this, null, function* () {
200
+ function X(n) {
201
+ return c(this, null, function* () {
202
202
  let { env: t, dmShortID: e, model: s, options: r = {} } = n;
203
203
  h({ env: t, dmShortID: e, model: s }), r = o({ size: 50, page: 1, _list: !0 }, r);
204
- const l = w(r), i = p(`api/${e}/${s}?${l}`, t), { count: d, total: c, _embedded: u } = yield g(i, n);
205
- let f = u ? u[`${e}:${s}`] : [];
206
- return f = Array.isArray(f) ? f : [f], { count: d, total: c, items: f };
204
+ const u = w(r), i = y(`api/${e}/${s}?${u}`, t), { count: d, total: a, _embedded: l } = yield g(i, n);
205
+ let f = l ? l[`${e}:${s}`] : [];
206
+ return f = Array.isArray(f) ? f : [f], { count: d, total: a, items: f };
207
207
  });
208
208
  }
209
- function X({ env: n, dmShortID: t, model: e, entryID: s, token: r }) {
209
+ function Y({ env: n, dmShortID: t, model: e, entryID: s, token: r }) {
210
210
  h({ env: n, dmShortID: t, model: e, entryID: s });
211
- const l = w({ _id: s }), i = p(`api/${t}/${e}?${l}`, n);
211
+ const u = w({ _id: s }), i = y(`api/${t}/${e}?${u}`, n);
212
212
  return g(i, { dmShortID: t, token: r });
213
213
  }
214
- function Y(l) {
215
- return a(this, arguments, function* ({ env: n, dmShortID: t, model: e, value: s, token: r }) {
214
+ function Z(u) {
215
+ return c(this, arguments, function* ({ env: n, dmShortID: t, model: e, value: s, token: r }) {
216
216
  h({ env: n, dmShortID: t, model: e, value: s });
217
- const i = p(`api/${t}/${e}`, n);
217
+ const i = y(`api/${t}/${e}`, n);
218
218
  return yield g(
219
219
  i,
220
220
  { env: n, dmShortID: t, token: r },
@@ -228,121 +228,129 @@ function Y(l) {
228
228
  );
229
229
  });
230
230
  }
231
- function Z(d) {
232
- return a(this, arguments, function* ({
231
+ function tt(d) {
232
+ return c(this, arguments, function* ({
233
233
  env: n,
234
234
  dmShortID: t,
235
235
  model: e,
236
236
  entryID: s,
237
237
  value: r,
238
- token: l,
238
+ token: u,
239
239
  safePut: i = !1
240
240
  }) {
241
241
  h({ env: n, dmShortID: t, model: e, entryID: s, value: r });
242
- const c = {
242
+ const a = {
243
243
  "Content-Type": "application/json"
244
244
  };
245
245
  if (i) {
246
246
  if (!("_modified" in r))
247
247
  throw new Error("expected _modified to be set!");
248
- c["If-Unmodified-Since"] = new Date(r._modified).toUTCString();
248
+ a["If-Unmodified-Since"] = new Date(r._modified).toUTCString();
249
249
  }
250
- const u = p(`api/${t}/${e}?_id=${s}`, n);
251
- return r = H(r), r = x(r), yield g(
252
- u,
253
- { token: l },
250
+ const l = y(`api/${t}/${e}?_id=${s}`, n);
251
+ return r = Q(r), r = x(r), yield g(
252
+ l,
253
+ { token: u },
254
254
  {
255
255
  method: "PUT",
256
- headers: c,
256
+ headers: a,
257
257
  body: JSON.stringify(r)
258
258
  }
259
259
  );
260
260
  });
261
261
  }
262
- function tt(l) {
263
- return a(this, arguments, function* ({ env: n, dmShortID: t, model: e, entryID: s, token: r }) {
264
- h({ env: n, dmShortID: t, model: e, entryID: s });
265
- const i = p(`api/${t}/${e}?_id=${s}`, n);
266
- yield g(
267
- i,
268
- { token: r, rawRes: !0 },
269
- {
270
- method: "DELETE",
271
- headers: {
272
- "Content-Type": "application/json"
273
- }
262
+ function et({ env: n, dmShortID: t, model: e, entryID: s, token: r }) {
263
+ h({ env: n, dmShortID: t, model: e, entryID: s });
264
+ const u = y(`api/${t}/${e}?_id=${s}`, n);
265
+ return g(
266
+ u,
267
+ { token: r, rawRes: !0 },
268
+ {
269
+ method: "DELETE",
270
+ headers: {
271
+ "Content-Type": "application/json"
274
272
  }
275
- );
276
- });
273
+ }
274
+ );
277
275
  }
278
- function et(r) {
279
- return a(this, arguments, function* ({ env: n, dmShortID: t, model: e, withMetadata: s }) {
276
+ function nt(r) {
277
+ return c(this, arguments, function* ({ env: n, dmShortID: t, model: e, withMetadata: s }) {
280
278
  var f, $, P, L, O;
281
279
  h({ env: n, dmShortID: t, model: e });
282
- const l = p(`api/schema/${t}/${e}`, n), i = yield g(l), d = (f = i == null ? void 0 : i.allOf) == null ? void 0 : f[1];
280
+ const u = y(`api/schema/${t}/${e}`, n), i = yield g(u), d = (f = i == null ? void 0 : i.allOf) == null ? void 0 : f[1];
283
281
  if (typeof d.properties != "object")
284
282
  throw new Error(
285
- `getSchema: ${l} returned unexpected format: ${JSON.stringify(i)}`
283
+ `getSchema: ${u} returned unexpected format: ${JSON.stringify(i)}`
286
284
  );
287
- const { properties: c } = d, u = x(c);
288
- for (let A in u) {
289
- let m = u[A];
290
- if (m.required = d.required.includes(A), ($ = u[A]) != null && $.oneOf && ((P = u[A]) == null || delete P.oneOf), (L = m.title) != null && L.includes("<") && ((O = m.title) != null && O.includes(">"))) {
291
- const k = m.title.split("<")[1].slice(0, -1), K = m.title.split("<")[0];
292
- m.type = K, k.includes(":") ? m.resource = k.split(":")[1] : m.resource = k;
285
+ const { properties: a } = d, l = x(a);
286
+ for (let A in l) {
287
+ let m = l[A];
288
+ if (m.required = d.required.includes(A), ($ = l[A]) != null && $.oneOf && ((P = l[A]) == null || delete P.oneOf), (L = m.title) != null && L.includes("<") && ((O = m.title) != null && O.includes(">"))) {
289
+ const k = m.title.split("<")[1].slice(0, -1), N = m.title.split("<")[0];
290
+ m.type = N, k.includes(":") ? m.resource = k.split(":")[1] : m.resource = k;
293
291
  } else
294
292
  ["asset", "entry", "assets", "entries"].includes(m.title) ? (m.type = m.title, m.resource = null) : m.type = m.title;
295
- delete u[A].title;
293
+ delete l[A].title;
296
294
  }
297
295
  if (s) {
298
- const A = c._modelTitle.title, m = c._modelTitleField.title;
299
- return { properties: u, meta: { modelTitleField: m, modelTitle: A } };
296
+ const A = a._modelTitle.title, m = a._modelTitleField.title;
297
+ return { properties: l, meta: { modelTitleField: m, modelTitle: A } };
300
298
  }
301
- return u;
299
+ return l;
302
300
  });
303
301
  }
304
- function nt(l) {
305
- return a(this, arguments, function* ({ env: n, dmShortID: t, assetGroup: e, assetID: s, token: r }) {
302
+ function st(n) {
303
+ 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), {});
304
+ }
305
+ function K(n) {
306
+ return n._links.collection.href.split("/").slice(-2)[0];
307
+ }
308
+ function rt(n, t) {
309
+ const e = K(t);
310
+ return t._embedded[`${e}:${t._modelTitle}/${n}/asset`];
311
+ }
312
+ function it(u) {
313
+ return c(this, arguments, function* ({ env: n, dmShortID: t, assetGroup: e, assetID: s, token: r }) {
306
314
  h({ env: n, dmShortID: t, assetGroup: e, assetID: s });
307
- const i = w({ assetID: s }), d = p(`a/${t}/${e}?${i}`, n);
315
+ const i = w({ assetID: s }), d = y(`a/${t}/${e}?${i}`, n);
308
316
  return (yield g(d, { dmShortID: t, token: r }))._embedded["ec:dm-asset"];
309
317
  });
310
318
  }
311
- function st(n) {
312
- return a(this, null, function* () {
313
- let { env: t, dmShortID: e, assetGroup: s, token: r, options: l = {} } = n;
314
- h({ env: t, dmShortID: e, assetGroup: s }), l = o({ size: 50, page: 1, _list: !0 }, l);
315
- const i = w(l), d = p(`a/${e}/${s}?${i}`, t), { count: c, total: u, _embedded: f } = yield g(d, { dmShortID: e, token: r });
319
+ function ot(n) {
320
+ return c(this, null, function* () {
321
+ let { env: t, dmShortID: e, assetGroup: s, token: r, options: u = {} } = n;
322
+ h({ env: t, dmShortID: e, assetGroup: s }), u = o({ size: 50, page: 1, _list: !0 }, u);
323
+ const i = w(u), d = y(`a/${e}/${s}?${i}`, t), { count: a, total: l, _embedded: f } = yield g(d, { dmShortID: e, token: r });
316
324
  let $ = f ? f["ec:dm-asset"] : [];
317
- return $ = Array.isArray($) ? $ : [$], { count: c, total: u, items: $ };
325
+ return $ = Array.isArray($) ? $ : [$], { count: a, total: l, items: $ };
318
326
  });
319
327
  }
320
- function rt(d) {
321
- return a(this, arguments, function* ({
328
+ function at(d) {
329
+ return c(this, arguments, function* ({
322
330
  env: n,
323
331
  dmShortID: t,
324
332
  assetGroup: e,
325
333
  token: s,
326
334
  file: r,
327
- name: l,
335
+ name: u,
328
336
  options: i
329
337
  }) {
330
338
  h({ env: n, dmShortID: t, assetGroup: e, file: r });
331
- const c = p(`a/${t}/${e}`, n), u = new FormData();
332
- return u.append("file", r, l), i && Object.keys(i).forEach(($) => {
333
- u.append($, i[$]);
339
+ const a = y(`a/${t}/${e}`, n), l = new FormData();
340
+ return l.append("file", r, u), i && Object.keys(i).forEach(($) => {
341
+ l.append($, i[$]);
334
342
  }), (yield g(
335
- c,
343
+ a,
336
344
  { token: s },
337
345
  {
338
346
  method: "POST",
339
- body: u
347
+ body: l
340
348
  }
341
349
  ))._embedded["ec:dm-asset"];
342
350
  });
343
351
  }
344
- function it(l) {
345
- return a(this, arguments, function* ({
352
+ function ct(u) {
353
+ return c(this, arguments, function* ({
346
354
  env: n,
347
355
  dmShortID: t,
348
356
  assetGroup: e,
@@ -350,7 +358,7 @@ function it(l) {
350
358
  token: r
351
359
  }) {
352
360
  h({ env: n, dmShortID: t, assetGroup: e, assetID: s });
353
- const i = p(`a/${t}/${e}/${s}`, n);
361
+ const i = y(`a/${t}/${e}/${s}`, n);
354
362
  yield g(
355
363
  i,
356
364
  { token: r, rawRes: !0 },
@@ -360,98 +368,101 @@ function it(l) {
360
368
  );
361
369
  });
362
370
  }
363
- function ot(n) {
364
- return a(this, null, function* () {
371
+ function ut(n) {
372
+ return c(this, null, function* () {
365
373
  let { env: t, dmID: e, token: s } = n;
366
374
  h({ env: t, dmID: e });
367
- const r = p(`?dataManagerID=${e}`, t);
375
+ const r = y(`?dataManagerID=${e}`, t);
368
376
  return g(r, { token: s });
369
377
  });
370
378
  }
371
- function at(n) {
372
- return a(this, null, function* () {
379
+ function lt(n) {
380
+ return c(this, null, function* () {
373
381
  let { env: t, options: e = {} } = n;
374
382
  h({ env: t }), e = o({ size: 25, page: 1, _list: !0 }, e);
375
- const s = w(e), r = p(`?${s}`, t), { count: l, total: i, _embedded: d } = yield g(r, n);
376
- let c = d ? d["ec:datamanager"] : [];
377
- return c = Array.isArray(c) ? c : [c], { count: l, total: i, items: c };
383
+ const s = w(e), r = y(`?${s}`, t), { count: u, total: i, _embedded: d } = yield g(r, n);
384
+ let a = d ? d["ec:datamanager"] : [];
385
+ return a = Array.isArray(a) ? a : [a], { count: u, total: i, items: a };
378
386
  });
379
387
  }
380
- function ct(n) {
381
- return a(this, null, function* () {
388
+ function dt(n) {
389
+ return c(this, null, function* () {
382
390
  let { env: t, dmID: e, options: s = {} } = n;
383
391
  h({ env: t, dmID: e }), s = o({ size: 25, dataManagerID: e, page: 1, _list: !0 }, s);
384
- const r = w(s), l = p(`model?${r}`, t), { count: i, total: d, _embedded: c } = yield g(l, n);
385
- let u = c ? c["ec:model"] : [];
386
- return u = Array.isArray(u) ? u : [u], { count: i, total: d, items: u };
392
+ const r = w(s), u = y(`model?${r}`, t), { count: i, total: d, _embedded: a } = yield g(u, n);
393
+ let l = a ? a["ec:model"] : [];
394
+ return l = Array.isArray(l) ? l : [l], { count: i, total: d, items: l };
387
395
  });
388
396
  }
389
- function ut(n) {
390
- return a(this, null, function* () {
397
+ function ht(n) {
398
+ return c(this, null, function* () {
391
399
  let { env: t, resource: e, options: s = {}, subdomain: r = "datamanager" } = n;
392
400
  h({ env: t, subdomain: r, resource: e }), s = o({ size: 25, page: 1, _list: !0 }, s);
393
- const l = w(s), i = p(`${e}?${l}`, t, r), { count: d, total: c, _embedded: u } = yield g(i, n);
394
- let f = u ? u[Object.keys(u)[0]] : [];
395
- return f = Array.isArray(f) ? f : [f], { count: d, total: c, items: f };
401
+ const u = w(s), i = y(`${e}?${u}`, t, r), { count: d, total: a, _embedded: l } = yield g(i, n);
402
+ let f = l ? l[Object.keys(l)[0]] : [];
403
+ return f = Array.isArray(f) ? f : [f], { count: d, total: a, items: f };
396
404
  });
397
405
  }
398
- function lt(e) {
399
- return a(this, arguments, function* (n, t = {}) {
400
- let { env: s, route: r, options: l = {}, subdomain: i = "datamanager" } = n;
401
- h({ env: s, subdomain: i, route: r }), l = o({}, l);
402
- const d = w(l), c = p(`${r}?${d}`, s, i);
403
- return g(c, n, t);
406
+ function gt(e) {
407
+ return c(this, arguments, function* (n, t = {}) {
408
+ let { env: s, route: r, options: u = {}, subdomain: i = "datamanager" } = n;
409
+ h({ env: s, subdomain: i, route: r }), u = o({}, u);
410
+ const d = w(u), a = y(`${r}?${d}`, s, i);
411
+ return g(a, n, t);
404
412
  });
405
413
  }
406
414
  const E = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
407
415
  __proto__: null,
408
- assetList: st,
409
- createAsset: rt,
410
- createEntry: Y,
411
- deleteAsset: it,
412
- deleteEntry: tt,
413
- dmList: at,
414
- editEntry: Z,
415
- entryList: W,
416
- getAsset: nt,
417
- getDatamanager: ot,
418
- getEcAuthKey: V,
419
- getEntry: X,
420
- getPublicAuthKey: I,
421
- getSchema: et,
422
- loginEc: v,
423
- loginPublic: R,
416
+ assetList: ot,
417
+ createAsset: at,
418
+ createEntry: Z,
419
+ deleteAsset: ct,
420
+ deleteEntry: et,
421
+ dmList: lt,
422
+ editEntry: tt,
423
+ entryList: X,
424
+ getAsset: it,
425
+ getDatamanager: ut,
426
+ getEcAuthKey: G,
427
+ getEntry: Y,
428
+ getEntryAsset: rt,
429
+ getEntryShortID: K,
430
+ getPublicAuthKey: V,
431
+ getSchema: nt,
432
+ loginEc: U,
433
+ loginPublic: v,
424
434
  logoutEc: M,
425
- logoutPublic: U,
426
- modelList: ct,
427
- publicApi: Q,
428
- raw: lt,
429
- resourceList: ut
435
+ logoutPublic: I,
436
+ modelList: dt,
437
+ publicApi: W,
438
+ raw: gt,
439
+ resourceList: ht,
440
+ sdkOptions: st
430
441
  }, Symbol.toStringTag, { value: "Module" })), {
431
- entryList: dt,
432
- getEntry: ht,
433
- getAsset: gt,
434
- assetList: ft,
435
- createAsset: yt,
436
- deleteAsset: pt,
437
- createEntry: mt,
438
- editEntry: q,
439
- deleteEntry: $t,
440
- getSchema: wt,
441
- loginPublic: At,
442
- loginEc: Et,
443
- logoutEc: kt,
444
- logoutPublic: bt,
442
+ entryList: ft,
443
+ getEntry: pt,
444
+ getAsset: yt,
445
+ assetList: mt,
446
+ createAsset: $t,
447
+ deleteAsset: wt,
448
+ createEntry: At,
449
+ editEntry: D,
450
+ deleteEntry: Et,
451
+ getSchema: kt,
452
+ loginPublic: bt,
453
+ loginEc: Tt,
454
+ logoutEc: _t,
455
+ logoutPublic: Pt,
445
456
  getEcAuthKey: b,
446
457
  getPublicAuthKey: T,
447
- dmList: Tt,
448
- modelList: _t,
449
- publicApi: Pt,
450
- getDatamanager: Lt,
451
- resourceList: Ot,
452
- raw: jt
458
+ dmList: Lt,
459
+ modelList: Ot,
460
+ publicApi: jt,
461
+ getDatamanager: St,
462
+ resourceList: Bt,
463
+ raw: Dt
453
464
  } = E;
454
- function Bt(n) {
465
+ function xt(n) {
455
466
  const { action: t } = n;
456
467
  if (h({ action: t }), !E[t])
457
468
  throw new Error(
@@ -482,13 +493,13 @@ class _ {
482
493
  * const secrets = await sdk("stage").token(token).dm("83cc6374").model("secret").entries()
483
494
  */
484
495
  entries() {
485
- return a(this, arguments, function* (t = {}) {
496
+ return c(this, arguments, function* (t = {}) {
486
497
  const e = yield this.getBestToken();
487
- return dt(y(o({}, this.config), { options: t, token: e }));
498
+ return ft(p(o({}, this.config), { options: t, token: e }));
488
499
  });
489
500
  }
490
501
  entryList(t) {
491
- return a(this, null, function* () {
502
+ return c(this, null, function* () {
492
503
  return this.entries(t);
493
504
  });
494
505
  }
@@ -502,9 +513,9 @@ class _ {
502
513
  * const muffin = await sdk("stage").dm("83cc6374").model("muffin").getEntry("1gOtzWvrdq")
503
514
  */
504
515
  getEntry(t) {
505
- return a(this, null, function* () {
516
+ return c(this, null, function* () {
506
517
  const e = yield this.getBestToken();
507
- return ht(y(o({}, this.config), { entryID: t, token: e }));
518
+ return pt(p(o({}, this.config), { entryID: t, token: e }));
508
519
  });
509
520
  }
510
521
  /**
@@ -522,9 +533,9 @@ class _ {
522
533
  * .editEntrySafe("1gOtzWvrdq", { name: "test", _modified: "2020-01-01T00:00:00.000Z"})
523
534
  */
524
535
  editEntrySafe(t, e) {
525
- return a(this, null, function* () {
536
+ return c(this, null, function* () {
526
537
  const s = yield this.getBestToken();
527
- return q(y(o({}, this.config), { entryID: t, token: s, value: e, safePut: !0 }));
538
+ return D(p(o({}, this.config), { entryID: t, token: s, value: e, safePut: !0 }));
528
539
  });
529
540
  }
530
541
  /**
@@ -536,8 +547,8 @@ class _ {
536
547
  * const muffin = await sdk("stage").dm("83cc6374").model("muffin").getSchema()
537
548
  */
538
549
  getSchema() {
539
- return a(this, null, function* () {
540
- return wt(this.config);
550
+ return c(this, null, function* () {
551
+ return kt(this.config);
541
552
  });
542
553
  }
543
554
  /**
@@ -554,13 +565,13 @@ class _ {
554
565
  * const files = await sdk("stage").token(token).dm("83cc6374").assetGroup("avatars").assets()
555
566
  */
556
567
  assets(t) {
557
- return a(this, null, function* () {
568
+ return c(this, null, function* () {
558
569
  const e = yield this.getBestToken();
559
- return ft(y(o({}, this.config), { options: t, token: e }));
570
+ return mt(p(o({}, this.config), { options: t, token: e }));
560
571
  });
561
572
  }
562
573
  assetList(t) {
563
- return a(this, null, function* () {
574
+ return c(this, null, function* () {
564
575
  return this.assets(t);
565
576
  });
566
577
  }
@@ -586,9 +597,9 @@ class _ {
586
597
  * .createAsset({ file, name: "venndiagram.png" });
587
598
  */
588
599
  createAsset() {
589
- return a(this, arguments, function* ({ file: t, name: e, options: s } = {}) {
600
+ return c(this, arguments, function* ({ file: t, name: e, options: s } = {}) {
590
601
  const r = yield this.getBestToken();
591
- return yt(y(o({}, this.config), { file: t, name: e, options: s, token: r }));
602
+ return $t(p(o({}, this.config), { file: t, name: e, options: s, token: r }));
592
603
  });
593
604
  }
594
605
  /**
@@ -601,9 +612,9 @@ class _ {
601
612
  * await ecadmin.assetgroup("test").deleteAsset('xxxx');
602
613
  */
603
614
  deleteAsset(t) {
604
- return a(this, null, function* () {
615
+ return c(this, null, function* () {
605
616
  const e = yield this.getBestToken();
606
- return pt(y(o({}, this.config), { token: e, assetID: t }));
617
+ return wt(p(o({}, this.config), { token: e, assetID: t }));
607
618
  });
608
619
  }
609
620
  /**
@@ -616,9 +627,9 @@ class _ {
616
627
  * const asset = await sdk("stage").dm("83cc6374").assetgroup("test").getAsset("tP-ZxpZZTGmbPnET-wArAQ")
617
628
  */
618
629
  getAsset(t) {
619
- return a(this, null, function* () {
630
+ return c(this, null, function* () {
620
631
  const e = yield this.getBestToken();
621
- return gt(y(o({}, this.config), { assetID: t, token: e }));
632
+ return yt(p(o({}, this.config), { assetID: t, token: e }));
622
633
  });
623
634
  }
624
635
  /**
@@ -631,9 +642,9 @@ class _ {
631
642
  * const entry = await sdk("stage").dm("83cc6374").model("muffin").createEntry({ name: 'test' })
632
643
  */
633
644
  createEntry(t) {
634
- return a(this, null, function* () {
645
+ return c(this, null, function* () {
635
646
  const e = yield this.getBestToken();
636
- return mt(y(o({}, this.config), { token: e, value: t }));
647
+ return At(p(o({}, this.config), { token: e, value: t }));
637
648
  });
638
649
  }
639
650
  /**
@@ -647,9 +658,9 @@ class _ {
647
658
  * const entry = await sdk("stage").dm("83cc6374").model("muffin").editEntry("1gOtzWvrdq", { name: "test" })
648
659
  */
649
660
  editEntry(t, e) {
650
- return a(this, null, function* () {
661
+ return c(this, null, function* () {
651
662
  const s = yield this.getBestToken();
652
- return q(y(o({}, this.config), { entryID: t, token: s, value: e }));
663
+ return D(p(o({}, this.config), { entryID: t, token: s, value: e }));
653
664
  });
654
665
  }
655
666
  /**
@@ -657,14 +668,14 @@ class _ {
657
668
  * If model DELETE is not public, you also need to provide a `token`.
658
669
  *
659
670
  * @param {string} entryID id of entry to delete
660
- * @returns {void}
671
+ * @returns {Promise<void>}
661
672
  * @example
662
673
  * await sdk("stage").dm("83cc6374").model("muffin").deleteEntry("1gOtzWvrdq")
663
674
  */
664
675
  deleteEntry(t) {
665
- return a(this, null, function* () {
676
+ return c(this, null, function* () {
666
677
  const e = yield this.getBestToken();
667
- return $t(y(o({}, this.config), { token: e, entryID: t }));
678
+ return Et(p(o({}, this.config), { token: e, entryID: t }));
668
679
  });
669
680
  }
670
681
  /**
@@ -677,9 +688,9 @@ class _ {
677
688
  * const res = await sdk("stage").resource("template").resourceList()
678
689
  */
679
690
  resourceList(t) {
680
- return a(this, null, function* () {
691
+ return c(this, null, function* () {
681
692
  const e = yield this.getBestToken();
682
- return Ot(y(o({}, this.config), { options: t, token: e }));
693
+ return Bt(p(o({}, this.config), { options: t, token: e }));
683
694
  });
684
695
  }
685
696
  /**
@@ -694,9 +705,9 @@ class _ {
694
705
  * const res = await sdk("stage").route("stats").raw()
695
706
  */
696
707
  raw(t, e) {
697
- return a(this, null, function* () {
708
+ return c(this, null, function* () {
698
709
  const s = yield this.getBestToken();
699
- return jt(y(o({}, this.config), { options: t, token: s }), e);
710
+ return Dt(p(o({}, this.config), { options: t, token: s }), e);
700
711
  });
701
712
  }
702
713
  // TODO: rename authAdapter -> storageAdapter
@@ -726,24 +737,24 @@ class _ {
726
737
  return e(t);
727
738
  }
728
739
  loginEc(t) {
729
- return Et(o(o({}, this.config), t)).then(
740
+ return Tt(o(o({}, this.config), t)).then(
730
741
  this.setAuth(b(this.config))
731
742
  );
732
743
  }
733
744
  loginPublic(t) {
734
- return At(o(o({}, this.config), t)).then(
745
+ return bt(o(o({}, this.config), t)).then(
735
746
  this.setAuth(T(this.config))
736
747
  );
737
748
  }
738
749
  logoutPublic() {
739
750
  const t = this.getPublicToken();
740
- return console.log("token", t), bt(y(o({}, this.config), { token: t })).then(
751
+ return console.log("token", t), Pt(p(o({}, this.config), { token: t })).then(
741
752
  this.unsetAuth(T(this.config))
742
753
  );
743
754
  }
744
755
  logoutEc() {
745
756
  const t = this.getEcToken();
746
- return console.log("token", t), kt(y(o({}, this.config), { token: t })).then(
757
+ return console.log("token", t), _t(p(o({}, this.config), { token: t })).then(
747
758
  this.unsetAuth(b(this.config))
748
759
  );
749
760
  }
@@ -854,16 +865,16 @@ class _ {
854
865
  * @returns any
855
866
  */
856
867
  publicApi() {
857
- return Pt(this.config);
868
+ return jt(this.config);
858
869
  }
859
870
  /**
860
871
  * Loads a DatamanagerResource by its long id. Requires token.
861
872
  * @returns any
862
873
  */
863
874
  getDatamanager(t) {
864
- return a(this, null, function* () {
875
+ return c(this, null, function* () {
865
876
  const e = yield this.getBestToken();
866
- return Lt(y(o({}, this.config), { dmID: t, token: e }));
877
+ return St(p(o({}, this.config), { dmID: t, token: e }));
867
878
  });
868
879
  }
869
880
  /**
@@ -875,9 +886,9 @@ class _ {
875
886
  * const dms = await sdk("stage").dmList()
876
887
  */
877
888
  dmList() {
878
- return a(this, arguments, function* (t = {}) {
889
+ return c(this, arguments, function* (t = {}) {
879
890
  const e = yield this.getBestToken();
880
- return Tt(y(o({}, this.config), { options: t, token: e }));
891
+ return Lt(p(o({}, this.config), { options: t, token: e }));
881
892
  });
882
893
  }
883
894
  /**
@@ -889,45 +900,44 @@ class _ {
889
900
  * const models = await sdk("stage").dmID("254a03f1-cb76-4f1e-a52a-bbd4180ca10c").modelList()
890
901
  */
891
902
  modelList() {
892
- return a(this, arguments, function* (t = {}) {
903
+ return c(this, arguments, function* (t = {}) {
893
904
  const e = yield this.getBestToken();
894
- return _t(y(o({}, this.config), { options: t, token: e }));
905
+ return Ot(p(o({}, this.config), { options: t, token: e }));
895
906
  });
896
907
  }
897
908
  }
898
- const qt = (n) => new _({ env: n });
899
- function Dt(n) {
900
- 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), {});
901
- }
909
+ const Kt = (n) => new _({ env: n });
902
910
  export {
903
911
  _ as Sdk,
904
- Bt as act,
905
- p as apiURL,
906
- st as assetList,
907
- rt as createAsset,
908
- Y as createEntry,
909
- it as deleteAsset,
910
- tt as deleteEntry,
911
- at as dmList,
912
- Z as editEntry,
913
- W as entryList,
912
+ xt as act,
913
+ y as apiURL,
914
+ ot as assetList,
915
+ at as createAsset,
916
+ Z as createEntry,
917
+ ct as deleteAsset,
918
+ et as deleteEntry,
919
+ lt as dmList,
920
+ tt as editEntry,
921
+ X as entryList,
914
922
  h as expect,
915
923
  g as fetcher,
916
- nt as getAsset,
917
- ot as getDatamanager,
918
- V as getEcAuthKey,
919
- X as getEntry,
920
- I as getPublicAuthKey,
921
- et as getSchema,
922
- v as loginEc,
923
- R as loginPublic,
924
+ it as getAsset,
925
+ ut as getDatamanager,
926
+ G as getEcAuthKey,
927
+ Y as getEntry,
928
+ rt as getEntryAsset,
929
+ K as getEntryShortID,
930
+ V as getPublicAuthKey,
931
+ nt as getSchema,
932
+ U as loginEc,
933
+ v as loginPublic,
924
934
  M as logoutEc,
925
- U as logoutPublic,
926
- ct as modelList,
927
- Q as publicApi,
935
+ I as logoutPublic,
936
+ dt as modelList,
937
+ W as publicApi,
928
938
  w as query,
929
- lt as raw,
930
- ut as resourceList,
931
- qt as sdk,
932
- Dt as sdkOptions
939
+ gt as raw,
940
+ ht as resourceList,
941
+ Kt as sdk,
942
+ st as sdkOptions
933
943
  };
@@ -1,13 +1,4 @@
1
1
  export function act(config: any): any;
2
- /**
3
- * Takes [ec.sdk filterOptions](https://entrecode.github.io/ec.sdk/#filteroptions), outputs an [entrecode filter](https://doc.entrecode.de/api-basics/#filtering)
4
- *
5
- * @param {SdkFilterOptions} options sdk filterOptions
6
- * @returns {Record<string, string>}
7
- * @example
8
- * const res = await sdk("stage").route("stats").raw()
9
- */
10
- export function sdkOptions(options: SdkFilterOptions): Record<string, string>;
11
2
  export * from "./util.mjs";
12
3
  /**
13
4
  * SDK
@@ -152,11 +143,11 @@ export class Sdk {
152
143
  * If model DELETE is not public, you also need to provide a `token`.
153
144
  *
154
145
  * @param {string} entryID id of entry to delete
155
- * @returns {void}
146
+ * @returns {Promise<void>}
156
147
  * @example
157
148
  * await sdk("stage").dm("83cc6374").model("muffin").deleteEntry("1gOtzWvrdq")
158
149
  */
159
- deleteEntry(entryID: string): void;
150
+ deleteEntry(entryID: string): Promise<void>;
160
151
  /**
161
152
  * Fetches resource list. Expects `resource` to be set. `subdomain` defaults to "datamanager".
162
153
  * Fetches `https://<subdomain>.entrecode.de/<resource>?_list=true&size=<options.size ?? 25>`
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.mts","sourceRoot":"","sources":["../../src/lib/api.mjs"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"api.d.mts","sourceRoot":"","sources":["../../src/lib/api.mjs"],"names":[],"mappings":"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"}
@@ -33,11 +33,69 @@ export function deleteEntry({ env, dmShortID, model, entryID, token }: {
33
33
  model: any;
34
34
  entryID: any;
35
35
  token: any;
36
- }): Promise<void>;
36
+ }): Promise<any>;
37
37
  export function getSchema({ env, dmShortID, model, withMetadata }: {
38
38
  env: any;
39
39
  dmShortID: any;
40
40
  model: any;
41
41
  withMetadata: any;
42
42
  }): Promise<{}>;
43
+ /**
44
+ * @typedef {Object} SdkFilter
45
+ * @property {string | string[]} sort
46
+ * @property {string} search
47
+ * @property {boolean} notNull
48
+ * @property {boolean} null
49
+ * @property {Array[]} any
50
+ * @property {string} from
51
+ * @property {string} to
52
+ *
53
+ */
54
+ /**
55
+ * @typedef {Object} SdkFilterOptions
56
+ * @property {SdkFilter} sort
57
+ * @property {number} _count
58
+ * @property {number} page
59
+ * @property {Record<string, SdkFilter> | string | boolean} [key]
60
+ *
61
+ */
62
+ /**
63
+ * Takes [ec.sdk filterOptions](https://entrecode.github.io/ec.sdk/#filteroptions), outputs an [entrecode filter](https://doc.entrecode.de/api-basics/#filtering)
64
+ *
65
+ * @param {SdkFilterOptions} options sdk filterOptions
66
+ * @returns {Record<string, string>}
67
+ *
68
+ */
69
+ export function sdkOptions(options: SdkFilterOptions): Record<string, string>;
70
+ /**
71
+ * Returns the shortID of the given EntryResource
72
+ *
73
+ * @param {EntryResource} entry EntryResource
74
+ * @returns {string}
75
+ *
76
+ */
77
+ export function getEntryShortID(entry: EntryResource): string;
78
+ /**
79
+ * Returns the embedded asset from the given field name and EntryResource
80
+ *
81
+ * @param {EntryResource} entry EntryResource
82
+ * @returns {string}
83
+ *
84
+ */
85
+ export function getEntryAsset(field: any, entry: EntryResource): string;
86
+ export type SdkFilter = {
87
+ sort: string | string[];
88
+ search: string;
89
+ notNull: boolean;
90
+ null: boolean;
91
+ any: any[][];
92
+ from: string;
93
+ to: string;
94
+ };
95
+ export type SdkFilterOptions = {
96
+ sort: SdkFilter;
97
+ _count: number;
98
+ page: number;
99
+ key?: Record<string, SdkFilter> | string | boolean;
100
+ };
43
101
  //# sourceMappingURL=entries.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entries.d.mts","sourceRoot":"","sources":["../../src/lib/entries.mjs"],"names":[],"mappings":"AAiCA,qDAMC;AAED;;;;GAYC;AAED;;;;;;iBAKC;AAED;;;;;;iBAeC;AAED;;;;;;;;iBAkCC;AAED;;;;;;kBAcC;AAED;;;;;gBA4CC"}
1
+ {"version":3,"file":"entries.d.mts","sourceRoot":"","sources":["../../src/lib/entries.mjs"],"names":[],"mappings":"AAiCA,qDAMC;AAED;;;;GAYC;AAED;;;;;;iBAKC;AAED;;;;;;iBAeC;AAED;;;;;;;;iBAkCC;AAED;;;;;;iBAcC;AAED;;;;;gBA4CC;AAED;;;;;;;;;;GAUG;AACH;;;;;;;GAOG;AAEH;;;;;;GAMG;AACH,oCAJW,gBAAgB,GACd,OAAO,MAAM,EAAE,MAAM,CAAC,CAoBlC;AACD;;;;;;GAMG;AACH,uDAHa,MAAM,CAKlB;AAED;;;;;;GAMG;AACH,iEAHa,MAAM,CAMlB;;UAhEa,MAAM,GAAG,MAAM,EAAE;YACjB,MAAM;aACN,OAAO;UACP,OAAO;SACP,OAAO;UACP,MAAM;QACN,MAAM;;;UAKN,SAAS;YACT,MAAM;UACN,MAAM;UACN,OAAO,MAAM,EAAE,SAAS,CAAC,GAAG,MAAM,GAAG,OAAO"}
@@ -2,19 +2,4 @@ export function fetcher(url: any, config?: {}, options?: {}): Promise<any>;
2
2
  export function apiURL(route: any, env?: string, subdomain?: string): any;
3
3
  export function query(params: any, sort?: boolean): any;
4
4
  export function expect(obj: any): void;
5
- export type SdkFilter = {
6
- sort: string | string[];
7
- search: string;
8
- notNull: boolean;
9
- null: boolean;
10
- any: any[][];
11
- from: string;
12
- to: string;
13
- };
14
- export type SdkFilterOptions = {
15
- sort: SdkFilter;
16
- _count: number;
17
- page: number;
18
- key?: Record<string, SdkFilter> | string | boolean;
19
- };
20
5
  //# sourceMappingURL=util.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.mts","sourceRoot":"","sources":["../../src/lib/util.mjs"],"names":[],"mappings":"AAAA,2EAsBC;AAiBD,0EAgBC;AAED,wDAKC;AAED,uCAMC;;UAIa,MAAM,GAAG,MAAM,EAAE;YACjB,MAAM;aACN,OAAO;UACP,OAAO;SACP,OAAO;UACP,MAAM;QACN,MAAM;;;UAKN,SAAS;YACT,MAAM;UACN,MAAM;UACN,OAAO,MAAM,EAAE,SAAS,CAAC,GAAG,MAAM,GAAG,OAAO"}
1
+ {"version":3,"file":"util.d.mts","sourceRoot":"","sources":["../../src/lib/util.mjs"],"names":[],"mappings":"AAAA,2EAsBC;AAiBD,0EAgBC;AAED,wDAKC;AAED,uCAMC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ec.fdk",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "ec frontend sdk",
5
5
  "main": "dist/index.cjs",
6
6
  "directories": {