ec.fdk 0.2.6 → 0.2.8

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
@@ -50,14 +50,14 @@ Now what follows is the autogenerated doc from source:
50
50
  **Kind**: static class of [<code>api</code>](#module_api)
51
51
 
52
52
  * [.Sdk](#module_api.Sdk)
53
- * [.entries([options])](#module_api.Sdk+entries) ⇒ <code>Object</code>
54
- * [.getEntry(entryID)](#module_api.Sdk+getEntry) ⇒ <code>object</code>
55
- * [.assets([options])](#module_api.Sdk+assets) ⇒ <code>Object</code>
56
- * [.createAsset([options])](#module_api.Sdk+createAsset) ⇒ <code>Object</code>
53
+ * [.entries([options])](#module_api.Sdk+entries) ⇒ [<code>Promise.&lt;EntryList&gt;</code>](#EntryList)
54
+ * [.getEntry(entryID)](#module_api.Sdk+getEntry) ⇒ [<code>Promise.&lt;EntryResource&gt;</code>](#EntryResource)
55
+ * [.assets([options])](#module_api.Sdk+assets) ⇒ [<code>Promise.&lt;AssetList&gt;</code>](#AssetList)
56
+ * [.createAsset([options])](#module_api.Sdk+createAsset) ⇒ [<code>Promise.&lt;AssetResource&gt;</code>](#AssetResource)
57
57
  * [.getAsset(assetID)](#module_api.Sdk+getAsset) ⇒ [<code>Promise.&lt;AssetResource&gt;</code>](#AssetResource)
58
- * [.createEntry(value)](#module_api.Sdk+createEntry) ⇒ <code>object</code>
59
- * [.editEntry(entryID, value)](#module_api.Sdk+editEntry) ⇒ <code>object</code>
60
- * [.deleteEntry(entryID)](#module_api.Sdk+deleteEntry) ⇒ <code>object</code>
58
+ * [.createEntry(value)](#module_api.Sdk+createEntry) ⇒ [<code>Promise.&lt;EntryResource&gt;</code>](#EntryResource)
59
+ * [.editEntry(entryID, value)](#module_api.Sdk+editEntry) ⇒ [<code>Promise.&lt;EntryResource&gt;</code>](#EntryResource)
60
+ * [.deleteEntry(entryID)](#module_api.Sdk+deleteEntry) ⇒ <code>void</code>
61
61
  * [.model(model)](#module_api.Sdk+model) ⇒
62
62
  * [.token(token)](#module_api.Sdk+token) ⇒
63
63
  * [.dmShortID(dmShortID)](#module_api.Sdk+dmShortID) ⇒
@@ -67,7 +67,7 @@ Now what follows is the autogenerated doc from source:
67
67
 
68
68
  <a name="module_api.Sdk+entries"></a>
69
69
 
70
- #### sdk.entries([options]) ⇒ <code>Object</code>
70
+ #### sdk.entries([options]) ⇒ [<code>Promise.&lt;EntryList&gt;</code>](#EntryList)
71
71
  <p>Loads entry list. Expects <code>dmShortID</code> / <code>model</code> to be set.
72
72
  If the model is not public, you also need to provide a <code>token</code>.</p>
73
73
 
@@ -89,7 +89,7 @@ const secrets = await sdk("stage").token(token).dm("83cc6374").model("secret").e
89
89
  ```
90
90
  <a name="module_api.Sdk+getEntry"></a>
91
91
 
92
- #### sdk.getEntry(entryID) ⇒ <code>object</code>
92
+ #### sdk.getEntry(entryID) ⇒ [<code>Promise.&lt;EntryResource&gt;</code>](#EntryResource)
93
93
  <p>Loads a single entry. Expects <code>dmShortID</code> / <code>model</code> to be set.
94
94
  If the model is not public, you also need to provide a <code>token</code>.</p>
95
95
 
@@ -105,7 +105,7 @@ const muffin = await sdk("stage").dm("83cc6374").model("muffin").getEntry("1gOtz
105
105
  ```
106
106
  <a name="module_api.Sdk+assets"></a>
107
107
 
108
- #### sdk.assets([options]) ⇒ <code>Object</code>
108
+ #### sdk.assets([options]) ⇒ [<code>Promise.&lt;AssetList&gt;</code>](#AssetList)
109
109
  <p>Loads asset list. Expects <code>dmShortID</code> / <code>assetGroup</code> to be set.
110
110
  If the assetGroup is not public, you also need to provide a <code>token</code>.</p>
111
111
 
@@ -127,7 +127,7 @@ const files = await sdk("stage").token(token).dm("83cc6374").assetGroup("avatars
127
127
  ```
128
128
  <a name="module_api.Sdk+createAsset"></a>
129
129
 
130
- #### sdk.createAsset([options]) ⇒ <code>Object</code>
130
+ #### sdk.createAsset([options]) ⇒ [<code>Promise.&lt;AssetResource&gt;</code>](#AssetResource)
131
131
  <p>Uploads an asset. Expects <code>dmShortID</code> / <code>assetGroup</code> / <code>file</code> to be set.
132
132
  If the assetGroup is not public, you also need to provide a <code>token</code>.</p>
133
133
 
@@ -173,7 +173,7 @@ const asset = await sdk("stage").dm("83cc6374").assetgroup("test").getAsset("tP-
173
173
  ```
174
174
  <a name="module_api.Sdk+createEntry"></a>
175
175
 
176
- #### sdk.createEntry(value) ⇒ <code>object</code>
176
+ #### sdk.createEntry(value) ⇒ [<code>Promise.&lt;EntryResource&gt;</code>](#EntryResource)
177
177
  <p>Creates a new entry. Expects <code>dmShortID</code> / <code>model</code> to be set.
178
178
  If model POST is not public, you also need to provide a <code>token</code>.</p>
179
179
 
@@ -189,7 +189,7 @@ const entry = await sdk("stage").dm("83cc6374").model("muffin").createEntry({ na
189
189
  ```
190
190
  <a name="module_api.Sdk+editEntry"></a>
191
191
 
192
- #### sdk.editEntry(entryID, value) ⇒ <code>object</code>
192
+ #### sdk.editEntry(entryID, value) ⇒ [<code>Promise.&lt;EntryResource&gt;</code>](#EntryResource)
193
193
  <p>Edits an entry. Expects <code>dmShortID</code> / <code>model</code> to be set.
194
194
  If model PUT is not public, you also need to provide a <code>token</code>.</p>
195
195
 
@@ -206,7 +206,7 @@ const entry = await sdk("stage").dm("83cc6374").model("muffin").editEntry("1gOtz
206
206
  ```
207
207
  <a name="module_api.Sdk+deleteEntry"></a>
208
208
 
209
- #### sdk.deleteEntry(entryID) ⇒ <code>object</code>
209
+ #### sdk.deleteEntry(entryID) ⇒ <code>void</code>
210
210
  <p>Deletes an entry. Expects <code>dmShortID</code> / <code>model</code> to be set.
211
211
  If model DELETE is not public, you also need to provide a <code>token</code>.</p>
212
212
 
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var M=Object.defineProperty,v=Object.defineProperties;var F=Object.getOwnPropertyDescriptors;var b=Object.getOwnPropertySymbols;var G=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var T=(n,t,e)=>t in n?M(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,c=(n,t)=>{for(var e in t||(t={}))G.call(t,e)&&T(n,e,t[e]);if(b)for(var e of b(t))H.call(t,e)&&T(n,e,t[e]);return n},d=(n,t)=>v(n,F(t));var r=(n,t,e)=>new Promise((s,o)=>{var a=u=>{try{g(e.next(u))}catch(f){o(f)}},i=u=>{try{g(e.throw(u))}catch(f){o(f)}},g=u=>u.done?s(u.value):Promise.resolve(u.value).then(a,i);g((e=e.apply(n,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function l(s){return r(this,arguments,function*(n,t={},e={}){const{token:o,rawRes:a}=t;o&&(e.headers=d(c({},e.headers||{}),{Authorization:`Bearer ${o}`}));const i=yield fetch(n,e);if(!i.ok)throw new Error(i.statusText);return a?i:yield i.json()})}const P={live:"https://datamanager.entrecode.de/",stage:"https://datamanager.cachena.entrecode.de/"};function y(n,t="stage"){const e=P[t];if(!e)throw new Error(`env "${t}" not found. Try one of ${Object.keys(P).join(", ")}`);return e+n}function p(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 m={stage:"https://accounts.cachena.entrecode.de/",live:"https://accounts.entrecode.de/"};function O(n){return r(this,null,function*(){let{env:t,dmShortID:e,email:s,password:o}=n;h({env:t,dmShortID:e,email:s,password:o});const a=y(`api/${e}/_auth/login?clientID=rest`,t);return yield l(a,{},{method:"POST",body:JSON.stringify({email:s,password:o}),headers:{"Content-Type":"application/json"}})})}function j(n){return r(this,null,function*(){let{env:t,email:e,password:s}=n;h({env:t,email:e,password:s});const o=`${m[t]}auth/login?clientID=rest`;return yield l(o,{},{method:"POST",body:JSON.stringify({email:e,password:s}),headers:{"Content-Type":"application/json"}})})}function _(n){return r(this,null,function*(){let{dmShortID:t,env:e,token:s}=n;h({dmShortID:t,env:e,token:s});const o=y(`api/${t}/_auth/logout?clientID=rest&token=${s}`,e);return yield l(o,{dmShortID:t,rawRes:!0},{method:"POST"})})}function L(n){return r(this,null,function*(){let{env:t,token:e}=n;h({env:t,token:e});const s=`${m[t]}auth/logout?clientID=rest`;return yield l(s,{rawRes:!0,token:e},{method:"POST"})})}function S({dmShortID:n}){return h({dmShortID:n}),n}function B({env:n}){return h({env:n}),n}function K(n){return r(this,null,function*(){let{env:t,dmShortID:e,model:s,options:o={}}=n;h({env:t,dmShortID:e,model:s}),o=c({size:50,page:1,_list:!0},o);const a=p(o),i=y(`api/${e}/${s}?${a}`,t),{count:g,total:u,_embedded:f}=yield l(i,n),E=f?f[`${e}:${s}`]:[];return{count:g,total:u,items:E}})}function q({env:n,dmShortID:t,model:e,entryID:s,token:o}){h({env:n,dmShortID:t,model:e,entryID:s});const a=p({_id:s}),i=y(`api/${t}/${e}?${a}`,n);return l(i,{dmShortID:t,token:o})}function C(a){return r(this,arguments,function*({env:n,dmShortID:t,model:e,value:s,token:o}){h({env:n,dmShortID:t,model:e,value:s}),console.log("create entry",t,e,s);const i=y(`api/${t}/${e}`,n);return console.log("url",i),yield l(i,{env:n,dmShortID:t,token:o},{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}})})}function R(i){return r(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,value:o,token:a}){h({env:n,dmShortID:t,model:e,entryID:s,value:o});const g=y(`api/${t}/${e}?_id=${s}`,n);return yield l(g,{token:a},{method:"PUT",body:JSON.stringify(o),headers:{"Content-Type":"application/json"}})})}function x(a){return r(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,token:o}){h({env:n,dmShortID:t,model:e,entryID:s});const i=y(`api/${t}/${e}?_id=${s}`,n);return yield l(i,{token:o,rawRes:!0},{method:"DELETE",headers:{"Content-Type":"application/json"}})})}function z(a){return r(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:o}){h({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=p({assetID:s}),g=y(`a/${t}/${e}?${i}`,n);return(yield l(g,{dmShortID:t,token:o}))._embedded["ec:dm-asset"]})}function J(n){return r(this,null,function*(){let{env:t,dmShortID:e,assetGroup:s,token:o,options:a={}}=n;h({env:t,dmShortID:e,assetGroup:s}),a=c({size:50,page:1,_list:!0},a);const i=p(a),g=y(`a/${e}/${s}?${i}`,t),{count:u,total:f,_embedded:E}=yield l(g,{dmShortID:e,token:o}),U=E?E["ec:dm-asset"]:[];return{count:u,total:f,items:U}})}function N(i){return r(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,token:s,file:o,name:a}){h({env:n,dmShortID:t,assetGroup:e,file:o});const g=y(`a/${t}/${e}`,n),u=new FormData;return u.append("file",o,a),(yield l(g,{token:s},{method:"POST",body:u}))._embedded["ec:dm-asset"]})}const $=Object.freeze(Object.defineProperty({__proto__:null,assetList:J,createAsset:N,createEntry:C,deleteEntry:x,editEntry:R,entryList:K,getAsset:z,getEcAuthKey:B,getEntry:q,getPublicAuthKey:S,loginEc:j,loginPublic:O,logoutEc:L,logoutPublic:_},Symbol.toStringTag,{value:"Module"})),{entryList:Q,getEntry:V,getAsset:W,assetList:X,createAsset:Y,createEntry:Z,editEntry:D,deleteEntry:I,loginPublic:tt,loginEc:et,logoutEc:nt,logoutPublic:st,getEcAuthKey:w,getPublicAuthKey:A}=$;function ot(n){const{action:t}=n;if(h({action:t}),!$[t])throw new Error(`"${t}" does not exist! try one of ${Object.keys($).join(", ")}`);return $[t](n)}class k{constructor(t){this.config=t}set(t){return new k(c(c({},this.config),t))}entries(){return r(this,arguments,function*(t={}){const e=yield this.getBestToken();return Q(d(c({},this.config),{options:t,token:e}))})}entryList(t){return r(this,null,function*(){return this.entries(t)})}getEntry(t){return r(this,null,function*(){const e=yield this.getBestToken();return V(d(c({},this.config),{entryID:t,token:e}))})}assets(t){return r(this,null,function*(){const e=yield this.getBestToken();return X(d(c({},this.config),{options:t,token:e}))})}assetList(t){return r(this,null,function*(){return this.assets(t)})}createAsset(){return r(this,arguments,function*({file:t,name:e}={}){const s=yield this.getBestToken();return Y(d(c({},this.config),{file:t,name:e,token:s}))})}getAsset(t){return r(this,null,function*(){const e=yield this.getBestToken();return W(d(c({},this.config),{assetID:t,token:e}))})}createEntry(t){return r(this,null,function*(){const e=yield this.getBestToken();return Z(d(c({},this.config),{token:e,value:t}))})}editEntry(t,e){return r(this,null,function*(){const s=yield this.getBestToken();return D(d(c({},this.config),{entryID:t,token:s,value:e}))})}deleteEntry(t){return r(this,null,function*(){const e=yield this.getBestToken();return I(d(c({},this.config),{token:e,entryID:t}))})}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 et(c(c({},this.config),t)).then(this.setAuth(w(this.config)))}loginPublic(t){return tt(c(c({},this.config),t)).then(this.setAuth(A(this.config)))}logoutPublic(){const t=this.getPublicToken();return console.log("token",t),st(d(c({},this.config),{token:t})).then(this.unsetAuth(A(this.config)))}logoutEc(){const t=this.getEcToken();return console.log("token",t),nt(d(c({},this.config),{token:t})).then(this.unsetAuth(w(this.config)))}getPublicToken(){return this.config.token||this.getAuth(A(this.config))}getEcToken(){return this.config.token||this.getAuth(w(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)}assetGroup(t){return this.set({assetGroup:t})}assetgroup(t){return this.assetGroup(t)}}const rt=n=>new k({env:n});exports.Sdk=k;exports.act=ot;exports.apiURL=y;exports.assetList=J;exports.createAsset=N;exports.createEntry=C;exports.deleteEntry=x;exports.editEntry=R;exports.entryList=K;exports.expect=h;exports.fetcher=l;exports.getAsset=z;exports.getEcAuthKey=B;exports.getEntry=q;exports.getPublicAuthKey=S;exports.loginEc=j;exports.loginPublic=O;exports.logoutEc=L;exports.logoutPublic=_;exports.query=p;exports.sdk=rt;
1
+ "use strict";var M=Object.defineProperty,v=Object.defineProperties;var F=Object.getOwnPropertyDescriptors;var b=Object.getOwnPropertySymbols;var G=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var T=(n,t,e)=>t in n?M(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,c=(n,t)=>{for(var e in t||(t={}))G.call(t,e)&&T(n,e,t[e]);if(b)for(var e of b(t))H.call(t,e)&&T(n,e,t[e]);return n},d=(n,t)=>v(n,F(t));var r=(n,t,e)=>new Promise((s,o)=>{var a=u=>{try{g(e.next(u))}catch(f){o(f)}},i=u=>{try{g(e.throw(u))}catch(f){o(f)}},g=u=>u.done?s(u.value):Promise.resolve(u.value).then(a,i);g((e=e.apply(n,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function l(s){return r(this,arguments,function*(n,t={},e={}){const{token:o,rawRes:a}=t;o&&(e.headers=d(c({},e.headers||{}),{Authorization:`Bearer ${o}`}));const i=yield fetch(n,e);if(!i.ok)throw new Error(i.statusText);return a?i:yield i.json()})}const P={live:"https://datamanager.entrecode.de/",stage:"https://datamanager.cachena.entrecode.de/"};function y(n,t="stage"){const e=P[t];if(!e)throw new Error(`env "${t}" not found. Try one of ${Object.keys(P).join(", ")}`);return e+n}function p(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 m={stage:"https://accounts.cachena.entrecode.de/",live:"https://accounts.entrecode.de/"};function O(n){return r(this,null,function*(){let{env:t,dmShortID:e,email:s,password:o}=n;h({env:t,dmShortID:e,email:s,password:o});const a=y(`api/${e}/_auth/login?clientID=rest`,t);return yield l(a,{},{method:"POST",body:JSON.stringify({email:s,password:o}),headers:{"Content-Type":"application/json"}})})}function j(n){return r(this,null,function*(){let{env:t,email:e,password:s}=n;h({env:t,email:e,password:s});const o=`${m[t]}auth/login?clientID=rest`;return yield l(o,{},{method:"POST",body:JSON.stringify({email:e,password:s}),headers:{"Content-Type":"application/json"}})})}function _(n){return r(this,null,function*(){let{dmShortID:t,env:e,token:s}=n;h({dmShortID:t,env:e,token:s});const o=y(`api/${t}/_auth/logout?clientID=rest&token=${s}`,e);return yield l(o,{dmShortID:t,rawRes:!0},{method:"POST"})})}function L(n){return r(this,null,function*(){let{env:t,token:e}=n;h({env:t,token:e});const s=`${m[t]}auth/logout?clientID=rest`;return yield l(s,{rawRes:!0,token:e},{method:"POST"})})}function S({dmShortID:n}){return h({dmShortID:n}),n}function B({env:n}){return h({env:n}),n}function K(n){return r(this,null,function*(){let{env:t,dmShortID:e,model:s,options:o={}}=n;h({env:t,dmShortID:e,model:s}),o=c({size:50,page:1,_list:!0},o);const a=p(o),i=y(`api/${e}/${s}?${a}`,t),{count:g,total:u,_embedded:f}=yield l(i,n),E=f?f[`${e}:${s}`]:[];return{count:g,total:u,items:E}})}function q({env:n,dmShortID:t,model:e,entryID:s,token:o}){h({env:n,dmShortID:t,model:e,entryID:s});const a=p({_id:s}),i=y(`api/${t}/${e}?${a}`,n);return l(i,{dmShortID:t,token:o})}function C(a){return r(this,arguments,function*({env:n,dmShortID:t,model:e,value:s,token:o}){h({env:n,dmShortID:t,model:e,value:s}),console.log("create entry",t,e,s);const i=y(`api/${t}/${e}`,n);return console.log("url",i),yield l(i,{env:n,dmShortID:t,token:o},{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}})})}function R(i){return r(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,value:o,token:a}){h({env:n,dmShortID:t,model:e,entryID:s,value:o});const g=y(`api/${t}/${e}?_id=${s}`,n);return yield l(g,{token:a},{method:"PUT",body:JSON.stringify(o),headers:{"Content-Type":"application/json"}})})}function x(a){return r(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,token:o}){h({env:n,dmShortID:t,model:e,entryID:s});const i=y(`api/${t}/${e}?_id=${s}`,n);yield l(i,{token:o,rawRes:!0},{method:"DELETE",headers:{"Content-Type":"application/json"}})})}function z(a){return r(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:o}){h({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=p({assetID:s}),g=y(`a/${t}/${e}?${i}`,n);return(yield l(g,{dmShortID:t,token:o}))._embedded["ec:dm-asset"]})}function J(n){return r(this,null,function*(){let{env:t,dmShortID:e,assetGroup:s,token:o,options:a={}}=n;h({env:t,dmShortID:e,assetGroup:s}),a=c({size:50,page:1,_list:!0},a);const i=p(a),g=y(`a/${e}/${s}?${i}`,t),{count:u,total:f,_embedded:E}=yield l(g,{dmShortID:e,token:o}),U=E?E["ec:dm-asset"]:[];return{count:u,total:f,items:U}})}function N(i){return r(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,token:s,file:o,name:a}){h({env:n,dmShortID:t,assetGroup:e,file:o});const g=y(`a/${t}/${e}`,n),u=new FormData;return u.append("file",o,a),(yield l(g,{token:s},{method:"POST",body:u}))._embedded["ec:dm-asset"]})}const $=Object.freeze(Object.defineProperty({__proto__:null,assetList:J,createAsset:N,createEntry:C,deleteEntry:x,editEntry:R,entryList:K,getAsset:z,getEcAuthKey:B,getEntry:q,getPublicAuthKey:S,loginEc:j,loginPublic:O,logoutEc:L,logoutPublic:_},Symbol.toStringTag,{value:"Module"})),{entryList:Q,getEntry:V,getAsset:W,assetList:X,createAsset:Y,createEntry:Z,editEntry:D,deleteEntry:I,loginPublic:tt,loginEc:et,logoutEc:nt,logoutPublic:st,getEcAuthKey:w,getPublicAuthKey:A}=$;function ot(n){const{action:t}=n;if(h({action:t}),!$[t])throw new Error(`"${t}" does not exist! try one of ${Object.keys($).join(", ")}`);return $[t](n)}class k{constructor(t){this.config=t}set(t){return new k(c(c({},this.config),t))}entries(){return r(this,arguments,function*(t={}){const e=yield this.getBestToken();return Q(d(c({},this.config),{options:t,token:e}))})}entryList(t){return r(this,null,function*(){return this.entries(t)})}getEntry(t){return r(this,null,function*(){const e=yield this.getBestToken();return V(d(c({},this.config),{entryID:t,token:e}))})}assets(t){return r(this,null,function*(){const e=yield this.getBestToken();return X(d(c({},this.config),{options:t,token:e}))})}assetList(t){return r(this,null,function*(){return this.assets(t)})}createAsset(){return r(this,arguments,function*({file:t,name:e}={}){const s=yield this.getBestToken();return Y(d(c({},this.config),{file:t,name:e,token:s}))})}getAsset(t){return r(this,null,function*(){const e=yield this.getBestToken();return W(d(c({},this.config),{assetID:t,token:e}))})}createEntry(t){return r(this,null,function*(){const e=yield this.getBestToken();return Z(d(c({},this.config),{token:e,value:t}))})}editEntry(t,e){return r(this,null,function*(){const s=yield this.getBestToken();return D(d(c({},this.config),{entryID:t,token:s,value:e}))})}deleteEntry(t){return r(this,null,function*(){const e=yield this.getBestToken();return I(d(c({},this.config),{token:e,entryID:t}))})}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 et(c(c({},this.config),t)).then(this.setAuth(w(this.config)))}loginPublic(t){return tt(c(c({},this.config),t)).then(this.setAuth(A(this.config)))}logoutPublic(){const t=this.getPublicToken();return console.log("token",t),st(d(c({},this.config),{token:t})).then(this.unsetAuth(A(this.config)))}logoutEc(){const t=this.getEcToken();return console.log("token",t),nt(d(c({},this.config),{token:t})).then(this.unsetAuth(w(this.config)))}getPublicToken(){return this.config.token||this.getAuth(A(this.config))}getEcToken(){return this.config.token||this.getAuth(w(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)}assetGroup(t){return this.set({assetGroup:t})}assetgroup(t){return this.assetGroup(t)}}const rt=n=>new k({env:n});exports.Sdk=k;exports.act=ot;exports.apiURL=y;exports.assetList=J;exports.createAsset=N;exports.createEntry=C;exports.deleteEntry=x;exports.editEntry=R;exports.entryList=K;exports.expect=h;exports.fetcher=l;exports.getAsset=z;exports.getEcAuthKey=B;exports.getEntry=q;exports.getPublicAuthKey=S;exports.loginEc=j;exports.loginPublic=O;exports.logoutEc=L;exports.logoutPublic=_;exports.query=p;exports.sdk=rt;
package/dist/index.mjs CHANGED
@@ -13,18 +13,18 @@ var T = (n, t, e) => t in n ? j(n, t, { enumerable: !0, configurable: !0, writab
13
13
  var r = (n, t, e) => new Promise((s, o) => {
14
14
  var a = (u) => {
15
15
  try {
16
- h(e.next(u));
16
+ g(e.next(u));
17
17
  } catch (f) {
18
18
  o(f);
19
19
  }
20
20
  }, i = (u) => {
21
21
  try {
22
- h(e.throw(u));
22
+ g(e.throw(u));
23
23
  } catch (f) {
24
24
  o(f);
25
25
  }
26
- }, h = (u) => u.done ? s(u.value) : Promise.resolve(u.value).then(a, i);
27
- h((e = e.apply(n, t)).next());
26
+ }, g = (u) => u.done ? s(u.value) : Promise.resolve(u.value).then(a, i);
27
+ g((e = e.apply(n, t)).next());
28
28
  });
29
29
  function d(s) {
30
30
  return r(this, arguments, function* (n, t = {}, e = {}) {
@@ -53,7 +53,7 @@ function y(n, t = "stage") {
53
53
  function $(n, t = !0) {
54
54
  return Object.entries(n).sort((e, s) => e[0].localeCompare(s[0])).map(([e, s]) => `${e}=${s}`).join("&");
55
55
  }
56
- function g(n) {
56
+ function h(n) {
57
57
  Object.entries(n).forEach(([t, e]) => {
58
58
  if (e === void 0)
59
59
  throw new Error(`expected ${t} to be set!`);
@@ -66,7 +66,7 @@ const m = {
66
66
  function S(n) {
67
67
  return r(this, null, function* () {
68
68
  let { env: t, dmShortID: e, email: s, password: o } = n;
69
- g({ env: t, dmShortID: e, email: s, password: o });
69
+ h({ env: t, dmShortID: e, email: s, password: o });
70
70
  const a = y(`api/${e}/_auth/login?clientID=rest`, t);
71
71
  return yield d(
72
72
  a,
@@ -84,7 +84,7 @@ function S(n) {
84
84
  function C(n) {
85
85
  return r(this, null, function* () {
86
86
  let { env: t, email: e, password: s } = n;
87
- g({ env: t, email: e, password: s });
87
+ h({ env: t, email: e, password: s });
88
88
  const o = `${m[t]}auth/login?clientID=rest`;
89
89
  return yield d(
90
90
  o,
@@ -102,7 +102,7 @@ function C(n) {
102
102
  function q(n) {
103
103
  return r(this, null, function* () {
104
104
  let { dmShortID: t, env: e, token: s } = n;
105
- g({ dmShortID: t, env: e, token: s });
105
+ h({ dmShortID: t, env: e, token: s });
106
106
  const o = y(
107
107
  `api/${t}/_auth/logout?clientID=rest&token=${s}`,
108
108
  e
@@ -119,7 +119,7 @@ function q(n) {
119
119
  function x(n) {
120
120
  return r(this, null, function* () {
121
121
  let { env: t, token: e } = n;
122
- g({ env: t, token: e });
122
+ h({ env: t, token: e });
123
123
  const s = `${m[t]}auth/logout?clientID=rest`;
124
124
  return yield d(
125
125
  s,
@@ -134,27 +134,27 @@ function x(n) {
134
134
  });
135
135
  }
136
136
  function R({ dmShortID: n }) {
137
- return g({ dmShortID: n }), n;
137
+ return h({ dmShortID: n }), n;
138
138
  }
139
139
  function z({ env: n }) {
140
- return g({ env: n }), n;
140
+ return h({ env: n }), n;
141
141
  }
142
142
  function J(n) {
143
143
  return r(this, null, function* () {
144
144
  let { env: t, dmShortID: e, model: s, options: o = {} } = n;
145
- g({ env: t, dmShortID: e, model: s }), o = c({ size: 50, page: 1, _list: !0 }, o);
146
- const a = $(o), i = y(`api/${e}/${s}?${a}`, t), { count: h, total: u, _embedded: f } = yield d(i, n), p = f ? f[`${e}:${s}`] : [];
147
- return { count: h, total: u, items: p };
145
+ h({ env: t, dmShortID: e, model: s }), o = c({ size: 50, page: 1, _list: !0 }, o);
146
+ const a = $(o), i = y(`api/${e}/${s}?${a}`, t), { count: g, total: u, _embedded: f } = yield d(i, n), p = f ? f[`${e}:${s}`] : [];
147
+ return { count: g, total: u, items: p };
148
148
  });
149
149
  }
150
150
  function N({ env: n, dmShortID: t, model: e, entryID: s, token: o }) {
151
- g({ env: n, dmShortID: t, model: e, entryID: s });
151
+ h({ env: n, dmShortID: t, model: e, entryID: s });
152
152
  const a = $({ _id: s }), i = y(`api/${t}/${e}?${a}`, n);
153
153
  return d(i, { dmShortID: t, token: o });
154
154
  }
155
155
  function U(a) {
156
156
  return r(this, arguments, function* ({ env: n, dmShortID: t, model: e, value: s, token: o }) {
157
- g({ env: n, dmShortID: t, model: e, value: s }), console.log("create entry", t, e, s);
157
+ h({ env: n, dmShortID: t, model: e, value: s }), console.log("create entry", t, e, s);
158
158
  const i = y(`api/${t}/${e}`, n);
159
159
  return console.log("url", i), yield d(
160
160
  i,
@@ -178,10 +178,10 @@ function F(i) {
178
178
  value: o,
179
179
  token: a
180
180
  }) {
181
- g({ env: n, dmShortID: t, model: e, entryID: s, value: o });
182
- const h = y(`api/${t}/${e}?_id=${s}`, n);
181
+ h({ env: n, dmShortID: t, model: e, entryID: s, value: o });
182
+ const g = y(`api/${t}/${e}?_id=${s}`, n);
183
183
  return yield d(
184
- h,
184
+ g,
185
185
  { token: a },
186
186
  {
187
187
  method: "PUT",
@@ -195,9 +195,9 @@ function F(i) {
195
195
  }
196
196
  function G(a) {
197
197
  return r(this, arguments, function* ({ env: n, dmShortID: t, model: e, entryID: s, token: o }) {
198
- g({ env: n, dmShortID: t, model: e, entryID: s });
198
+ h({ env: n, dmShortID: t, model: e, entryID: s });
199
199
  const i = y(`api/${t}/${e}?_id=${s}`, n);
200
- return yield d(
200
+ yield d(
201
201
  i,
202
202
  { token: o, rawRes: !0 },
203
203
  {
@@ -211,16 +211,16 @@ function G(a) {
211
211
  }
212
212
  function M(a) {
213
213
  return r(this, arguments, function* ({ env: n, dmShortID: t, assetGroup: e, assetID: s, token: o }) {
214
- g({ env: n, dmShortID: t, assetGroup: e, assetID: s });
215
- const i = $({ assetID: s }), h = y(`a/${t}/${e}?${i}`, n);
216
- return (yield d(h, { dmShortID: t, token: o }))._embedded["ec:dm-asset"];
214
+ h({ env: n, dmShortID: t, assetGroup: e, assetID: s });
215
+ const i = $({ assetID: s }), g = y(`a/${t}/${e}?${i}`, n);
216
+ return (yield d(g, { dmShortID: t, token: o }))._embedded["ec:dm-asset"];
217
217
  });
218
218
  }
219
219
  function v(n) {
220
220
  return r(this, null, function* () {
221
221
  let { env: t, dmShortID: e, assetGroup: s, token: o, options: a = {} } = n;
222
- g({ env: t, dmShortID: e, assetGroup: s }), a = c({ size: 50, page: 1, _list: !0 }, a);
223
- const i = $(a), h = y(`a/${e}/${s}?${i}`, t), { count: u, total: f, _embedded: p } = yield d(h, { dmShortID: e, token: o }), O = p ? p["ec:dm-asset"] : [];
222
+ h({ env: t, dmShortID: e, assetGroup: s }), a = c({ size: 50, page: 1, _list: !0 }, a);
223
+ const i = $(a), g = y(`a/${e}/${s}?${i}`, t), { count: u, total: f, _embedded: p } = yield d(g, { dmShortID: e, token: o }), O = p ? p["ec:dm-asset"] : [];
224
224
  return { count: u, total: f, items: O };
225
225
  });
226
226
  }
@@ -233,10 +233,10 @@ function H(i) {
233
233
  file: o,
234
234
  name: a
235
235
  }) {
236
- g({ env: n, dmShortID: t, assetGroup: e, file: o });
237
- const h = y(`a/${t}/${e}`, n), u = new FormData();
236
+ h({ env: n, dmShortID: t, assetGroup: e, file: o });
237
+ const g = y(`a/${t}/${e}`, n), u = new FormData();
238
238
  return u.append("file", o, a), (yield d(
239
- h,
239
+ g,
240
240
  { token: s },
241
241
  {
242
242
  method: "POST",
@@ -279,7 +279,7 @@ const E = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
279
279
  } = E;
280
280
  function rt(n) {
281
281
  const { action: t } = n;
282
- if (g({ action: t }), !E[t])
282
+ if (h({ action: t }), !E[t])
283
283
  throw new Error(
284
284
  `"${t}" does not exist! try one of ${Object.keys(E).join(
285
285
  ", "
@@ -299,7 +299,7 @@ class A {
299
299
  * If the model is not public, you also need to provide a `token`.
300
300
  *
301
301
  * @param {object=} options options for entry list request.
302
- * @returns {{ count: number, total: number, items: object[] }}
302
+ * @returns {Promise<EntryList>}
303
303
  * @example
304
304
  * // public model
305
305
  * const muffins = await sdk("stage").dm("83cc6374").model("muffin").entries()
@@ -323,7 +323,7 @@ class A {
323
323
  * If the model is not public, you also need to provide a `token`.
324
324
  *
325
325
  * @param {string} entryID
326
- * @returns {object}
326
+ * @returns {Promise<EntryResource>}
327
327
  * @example
328
328
  * const muffin = await sdk("stage").dm("83cc6374").model("muffin").getEntry("1gOtzWvrdq")
329
329
  */
@@ -338,7 +338,7 @@ class A {
338
338
  * If the assetGroup is not public, you also need to provide a `token`.
339
339
  *
340
340
  * @param {object=} options options for entry list request.
341
- * @returns {{ count: number, total: number, items: object[] }}
341
+ * @returns {Promise<AssetList>}
342
342
  * @example
343
343
  * // public assetGroup
344
344
  * const files = await sdk("stage").dm("83cc6374").assetGroup("avatars").assets()
@@ -362,7 +362,7 @@ class A {
362
362
  * If the assetGroup is not public, you also need to provide a `token`.
363
363
  *
364
364
  * @param {object=} options options for entry list request.
365
- * @returns {{ count: number, total: number, items: object[] }}
365
+ * @returns {Promise<AssetResource>}
366
366
  * @example
367
367
  * // browser example
368
368
  * document.getElementById("file").addEventListener("input", async (e) => {
@@ -404,7 +404,7 @@ class A {
404
404
  * If model POST is not public, you also need to provide a `token`.
405
405
  *
406
406
  * @param {object} value values to set.
407
- * @returns {object}
407
+ * @returns {Promise<EntryResource>}
408
408
  * @example
409
409
  * const entry = await sdk("stage").dm("83cc6374").model("muffin").createEntry({ name: 'test' })
410
410
  */
@@ -420,7 +420,7 @@ class A {
420
420
  *
421
421
  * @param {string} entryID id of entry to edit
422
422
  * @param {object} value values to set. undefined fields are ignored
423
- * @returns {object}
423
+ * @returns {Promise<EntryResource>}
424
424
  * @example
425
425
  * const entry = await sdk("stage").dm("83cc6374").model("muffin").editEntry("1gOtzWvrdq", { name: "test" })
426
426
  */
@@ -435,7 +435,7 @@ class A {
435
435
  * If model DELETE is not public, you also need to provide a `token`.
436
436
  *
437
437
  * @param {string} entryID id of entry to delete
438
- * @returns {object}
438
+ * @returns {void}
439
439
  * @example
440
440
  * await sdk("stage").dm("83cc6374").model("muffin").deleteEntry("1gOtzWvrdq")
441
441
  */
@@ -575,7 +575,7 @@ export {
575
575
  G as deleteEntry,
576
576
  F as editEntry,
577
577
  J as entryList,
578
- g as expect,
578
+ h as expect,
579
579
  d as fetcher,
580
580
  M as getAsset,
581
581
  z as getEcAuthKey,
@@ -12,7 +12,7 @@ export class Sdk {
12
12
  * If the model is not public, you also need to provide a `token`.
13
13
  *
14
14
  * @param {object=} options options for entry list request.
15
- * @returns {{ count: number, total: number, items: object[] }}
15
+ * @returns {Promise<EntryList>}
16
16
  * @example
17
17
  * // public model
18
18
  * const muffins = await sdk("stage").dm("83cc6374").model("muffin").entries()
@@ -20,32 +20,24 @@ export class Sdk {
20
20
  * // non-public model
21
21
  * const secrets = await sdk("stage").token(token).dm("83cc6374").model("secret").entries()
22
22
  */
23
- entries(options?: object | undefined): {
24
- count: number;
25
- total: number;
26
- items: object[];
27
- };
28
- entryList(options: any): Promise<{
29
- count: number;
30
- total: number;
31
- items: object[];
32
- }>;
23
+ entries(options?: object | undefined): Promise<EntryList>;
24
+ entryList(options: any): Promise<EntryList>;
33
25
  /**
34
26
  * Loads a single entry. Expects `dmShortID` / `model` to be set.
35
27
  * If the model is not public, you also need to provide a `token`.
36
28
  *
37
29
  * @param {string} entryID
38
- * @returns {object}
30
+ * @returns {Promise<EntryResource>}
39
31
  * @example
40
32
  * const muffin = await sdk("stage").dm("83cc6374").model("muffin").getEntry("1gOtzWvrdq")
41
33
  */
42
- getEntry(entryID: string): object;
34
+ getEntry(entryID: string): Promise<EntryResource>;
43
35
  /**
44
36
  * Loads asset list. Expects `dmShortID` / `assetGroup` to be set.
45
37
  * If the assetGroup is not public, you also need to provide a `token`.
46
38
  *
47
39
  * @param {object=} options options for entry list request.
48
- * @returns {{ count: number, total: number, items: object[] }}
40
+ * @returns {Promise<AssetList>}
49
41
  * @example
50
42
  * // public assetGroup
51
43
  * const files = await sdk("stage").dm("83cc6374").assetGroup("avatars").assets()
@@ -53,22 +45,14 @@ export class Sdk {
53
45
  * // non-public assetGroup
54
46
  * const files = await sdk("stage").token(token).dm("83cc6374").assetGroup("avatars").assets()
55
47
  */
56
- assets(options?: object | undefined): {
57
- count: number;
58
- total: number;
59
- items: object[];
60
- };
61
- assetList(options: any): Promise<{
62
- count: number;
63
- total: number;
64
- items: object[];
65
- }>;
48
+ assets(options?: object | undefined): Promise<AssetList>;
49
+ assetList(options: any): Promise<AssetList>;
66
50
  /**
67
51
  * Uploads an asset. Expects `dmShortID` / `assetGroup` / `file` to be set.
68
52
  * If the assetGroup is not public, you also need to provide a `token`.
69
53
  *
70
54
  * @param {object=} options options for entry list request.
71
- * @returns {{ count: number, total: number, items: object[] }}
55
+ * @returns {Promise<AssetResource>}
72
56
  * @example
73
57
  * // browser example
74
58
  * document.getElementById("file").addEventListener("input", async (e) => {
@@ -84,11 +68,7 @@ export class Sdk {
84
68
  * .assetgroup("test")
85
69
  * .createAsset({ file, name: "venndiagram.png" });
86
70
  */
87
- createAsset({ file, name }?: object | undefined): {
88
- count: number;
89
- total: number;
90
- items: object[];
91
- };
71
+ createAsset({ file, name }?: object | undefined): Promise<AssetResource>;
92
72
  /**
93
73
  * Loads a single asset. Expects `dmShortID` / `assetGroup` to be set.
94
74
  * If the asset group is not public, you also need to provide a `token`.
@@ -104,32 +84,32 @@ export class Sdk {
104
84
  * If model POST is not public, you also need to provide a `token`.
105
85
  *
106
86
  * @param {object} value values to set.
107
- * @returns {object}
87
+ * @returns {Promise<EntryResource>}
108
88
  * @example
109
89
  * const entry = await sdk("stage").dm("83cc6374").model("muffin").createEntry({ name: 'test' })
110
90
  */
111
- createEntry(value: object): object;
91
+ createEntry(value: object): Promise<EntryResource>;
112
92
  /**
113
93
  * Edits an entry. Expects `dmShortID` / `model` to be set.
114
94
  * If model PUT is not public, you also need to provide a `token`.
115
95
  *
116
96
  * @param {string} entryID id of entry to edit
117
97
  * @param {object} value values to set. undefined fields are ignored
118
- * @returns {object}
98
+ * @returns {Promise<EntryResource>}
119
99
  * @example
120
100
  * const entry = await sdk("stage").dm("83cc6374").model("muffin").editEntry("1gOtzWvrdq", { name: "test" })
121
101
  */
122
- editEntry(entryID: string, value: object): object;
102
+ editEntry(entryID: string, value: object): Promise<EntryResource>;
123
103
  /**
124
104
  * Deletes an entry. Expects `dmShortID` / `model` to be set.
125
105
  * If model DELETE is not public, you also need to provide a `token`.
126
106
  *
127
107
  * @param {string} entryID id of entry to delete
128
- * @returns {object}
108
+ * @returns {void}
129
109
  * @example
130
110
  * await sdk("stage").dm("83cc6374").model("muffin").deleteEntry("1gOtzWvrdq")
131
111
  */
132
- deleteEntry(entryID: string): object;
112
+ deleteEntry(entryID: string): void;
133
113
  authAdapter(authAdapter: any): Sdk;
134
114
  setAuth(key: any): (auth: any) => any;
135
115
  unsetAuth(key: any): (auth: any) => any;
@@ -182,6 +162,11 @@ export class Sdk {
182
162
  assetgroup(assetGroup: string): Sdk;
183
163
  }
184
164
  export function sdk(env: any): Sdk;
165
+ export type AssetFile = {
166
+ url: string;
167
+ size: number;
168
+ resolution: any;
169
+ };
185
170
  export type AssetResource = {
186
171
  assetID: string;
187
172
  created: Date;
@@ -189,5 +174,58 @@ export type AssetResource = {
189
174
  tags: Array<string | any>;
190
175
  title: string;
191
176
  type: string;
177
+ file: AssetFile;
178
+ };
179
+ export type EntryResource = {
180
+ /**
181
+ * - The creation date.
182
+ */
183
+ _created: Date;
184
+ /**
185
+ * - The creator's string representation.
186
+ */
187
+ _creator: string;
188
+ /**
189
+ * - Any embedded resource.
190
+ */
191
+ _embedded: any;
192
+ /**
193
+ * - Any associated links.
194
+ */
195
+ _links: any;
196
+ /**
197
+ * - The title of the model.
198
+ */
199
+ _modelTitle: string;
200
+ /**
201
+ * - The field representing the model title.
202
+ */
203
+ _modelTitleField: string;
204
+ /**
205
+ * - The last modification date.
206
+ */
207
+ _modified: Date;
208
+ /**
209
+ * - The creation date.
210
+ */
211
+ created: Date;
212
+ /**
213
+ * - The last modification date.
214
+ */
215
+ modified: Date;
216
+ /**
217
+ * - Any additional properties can be added dynamically.
218
+ */
219
+ key?: any;
220
+ };
221
+ export type EntryList = {
222
+ count: number;
223
+ total: number;
224
+ items: EntryResource[];
225
+ };
226
+ export type AssetList = {
227
+ count: number;
228
+ total: number;
229
+ items: AssetResource[];
192
230
  };
193
231
  //# sourceMappingURL=api.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.mts","sourceRoot":"","sources":["../../src/lib/api.mjs"],"names":[],"mappings":"AAwBA,sCAWC;;AAED;;GAEG;AACH;IACE,yBAEC;IADC,YAAoB;IAGtB,mBAGC;IAED;;;;;;;;;;;;OAYG;IACH,kBATW,MAAM,eACJ;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAW7D;IACD;eAZsB,MAAM;eAAS,MAAM;eAAS,MAAM,EAAE;OAc3D;IACD;;;;;;;;OAQG;IACH,kBALW,MAAM,GACJ,MAAM,CAOlB;IACD;;;;;;;;;;;;OAYG;IACH,iBATW,MAAM,eACJ;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAW7D;IACD;eAZsB,MAAM;eAAS,MAAM;eAAS,MAAM,EAAE;OAc3D;IACD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,6BAjBW,MAAM,eACJ;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAmB7D;IACD;;;;;;;;OAQG;IACH,kBALW,MAAM,GACJ,QAAQ,aAAa,CAAC,CAOlC;IAED;;;;;;;;OAQG;IACH,mBALW,MAAM,GACJ,MAAM,CAOlB;IACD;;;;;;;;;OASG;IACH,mBANW,MAAM,SACN,MAAM,GACJ,MAAM,CAOlB;IACD;;;;;;;;OAQG;IACH,qBALW,MAAM,GACJ,MAAM,CAOlB;IAID,mCAGC;IAED,sCASC;IACD,wCAUC;IACD,uBAMC;IAED,mCAIC;IACD,uCAKC;IAED,6BAMC;IAED,yBAMC;IAED,sBAEC;IACD,kBAEC;IACD,0BAEC;IACD,sBAEC;IACD,uBAEC;IACD,oBAMC;IACD;;;;OAIG;IACH,aAHW,MAAM,OAKhB;IACD;;;;OAIG;IACH,aAHW,MAAM,OAKhB;IACD;;;;OAIG;IACH,qBAHW,MAAM,OAKhB;IACD;;;;OAIG;IACH,cAHW,MAAM,OAKhB;IACD;;;;OAIG;IACH,uBAHW,MAAM,OAKhB;IACD;;;;OAIG;IACH,uBAHW,MAAM,OAKhB;CACF;AAEM,mCAAqC;;aAI9B,MAAM;aACN,IAAI;WACJ,MAAM,GAAG,CAAC;UACV,MAAM,MAAM,GAAG,GAAG,CAAC;WACnB,MAAM;UACN,MAAM"}
1
+ {"version":3,"file":"api.d.mts","sourceRoot":"","sources":["../../src/lib/api.mjs"],"names":[],"mappings":"AAwBA,sCAWC;;AAED;;GAEG;AACH;IACE,yBAEC;IADC,YAAoB;IAGtB,mBAGC;IAED;;;;;;;;;;;;OAYG;IACH,kBATW,MAAM,eACJ,QAAQ,SAAS,CAAC,CAW9B;IACD,4CAEC;IACD;;;;;;;;OAQG;IACH,kBALW,MAAM,GACJ,QAAQ,aAAa,CAAC,CAOlC;IACD;;;;;;;;;;;;OAYG;IACH,iBATW,MAAM,eACJ,QAAQ,SAAS,CAAC,CAW9B;IACD,4CAEC;IACD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,6BAjBW,MAAM,eACJ,QAAQ,aAAa,CAAC,CAmBlC;IACD;;;;;;;;OAQG;IACH,kBALW,MAAM,GACJ,QAAQ,aAAa,CAAC,CAOlC;IAED;;;;;;;;OAQG;IACH,mBALW,MAAM,GACJ,QAAQ,aAAa,CAAC,CAOlC;IACD;;;;;;;;;OASG;IACH,mBANW,MAAM,SACN,MAAM,GACJ,QAAQ,aAAa,CAAC,CAOlC;IACD;;;;;;;;OAQG;IACH,qBALW,MAAM,GACJ,IAAI,CAOhB;IAID,mCAGC;IAED,sCASC;IACD,wCAUC;IACD,uBAMC;IAED,mCAIC;IACD,uCAKC;IAED,6BAMC;IAED,yBAMC;IAED,sBAEC;IACD,kBAEC;IACD,0BAEC;IACD,sBAEC;IACD,uBAEC;IACD,oBAMC;IACD;;;;OAIG;IACH,aAHW,MAAM,OAKhB;IACD;;;;OAIG;IACH,aAHW,MAAM,OAKhB;IACD;;;;OAIG;IACH,qBAHW,MAAM,OAKhB;IACD;;;;OAIG;IACH,cAHW,MAAM,OAKhB;IACD;;;;OAIG;IACH,uBAHW,MAAM,OAKhB;IACD;;;;OAIG;IACH,uBAHW,MAAM,OAKhB;CACF;AAEM,mCAAqC;;SAI9B,MAAM;UACN,MAAM;;;;aAMN,MAAM;aACN,IAAI;WACJ,MAAM,GAAG,CAAC;UACV,MAAM,MAAM,GAAG,GAAG,CAAC;WACnB,MAAM;UACN,MAAM;UACN,SAAS;;;;;;cAKT,IAAI;;;;cACJ,MAAM;;;;eACN,GAAG;;;;YACH,GAAG;;;;iBACH,MAAM;;;;sBACN,MAAM;;;;eACN,IAAI;;;;aACJ,IAAI;;;;cACJ,IAAI;;;;UACJ,GAAG;;;WAKH,MAAM;WACN,MAAM;WACN,aAAa,EAAE;;;WAKf,MAAM;WACN,MAAM;WACN,aAAa,EAAE"}
@@ -31,5 +31,5 @@ export function deleteEntry({ env, dmShortID, model, entryID, token }: {
31
31
  model: any;
32
32
  entryID: any;
33
33
  token: any;
34
- }): Promise<any>;
34
+ }): Promise<void>;
35
35
  //# sourceMappingURL=entries.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entries.d.mts","sourceRoot":"","sources":["../../src/lib/entries.mjs"],"names":[],"mappings":"AAEA;;;;GAWC;AAED;;;;;;iBAKC;AAED;;;;;;iBAiBC;AAED;;;;;;;iBAuBC;AAED;;;;;;iBAeC"}
1
+ {"version":3,"file":"entries.d.mts","sourceRoot":"","sources":["../../src/lib/entries.mjs"],"names":[],"mappings":"AAEA;;;;GAWC;AAED;;;;;;iBAKC;AAED;;;;;;iBAiBC;AAED;;;;;;;iBAuBC;AAED;;;;;;kBAcC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ec.fdk",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "ec frontend sdk",
5
5
  "main": "dist/index.cjs",
6
6
  "directories": {