ec.fdk 0.4.3 → 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 +2 -2
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +115 -117
- package/dist/lib/api.d.mts +2 -2
- package/dist/lib/api.d.mts.map +1 -1
- package/dist/lib/entries.d.mts +1 -1
- package/dist/lib/entries.d.mts.map +1 -1
- package/package.json +1 -1
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.<AssetResource></code>](#AssetResource)
|
|
71
71
|
* [.createEntry(value)](#module_api.Sdk+createEntry) ⇒ [<code>Promise.<EntryResource></code>](#EntryResource)
|
|
72
72
|
* [.editEntry(entryID, value)](#module_api.Sdk+editEntry) ⇒ [<code>Promise.<EntryResource></code>](#EntryResource)
|
|
73
|
-
* [.deleteEntry(entryID)](#module_api.Sdk+deleteEntry) ⇒ <code>void
|
|
73
|
+
* [.deleteEntry(entryID)](#module_api.Sdk+deleteEntry) ⇒ <code>Promise.<void></code>
|
|
74
74
|
* [.resourceList([options])](#module_api.Sdk+resourceList) ⇒ [<code>Promise.<ResourceList></code>](#ResourceList)
|
|
75
75
|
* [.raw([options], [fetchOptions])](#module_api.Sdk+raw) ⇒ <code>Promise.<any></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
|
|
284
|
+
#### sdk.deleteEntry(entryID) ⇒ <code>Promise.<void></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
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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
|
|
2
|
-
${
|
|
3
|
-
${a.verbose}`;throw new Error(u)}throw new Error(`unexpected fetch error: ${i.statusText}`)}return l?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 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 N(n){return c(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 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 C(n){return c(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 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 U(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 I({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 V(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=gt(r),r=R(r),yield g(u,{token:l},{method:"PUT",headers:a,body:JSON.stringify(r)})})}function G(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 H(r){return c(this,arguments,function*({env:n,dmShortID:t,model:e,withMetadata:s}){var f,$,O,L,j;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=R(a);for(let A in u){let m=u[A];if(m.required=d.required.includes(A),($=u[A])!=null&&$.oneOf&&((O=u[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 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 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(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 Y(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 Z(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 tt(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 et(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 nt(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 st(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 rt(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 it(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 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 c(this,arguments,function*(t={}){const e=yield this.getBestToken();return ft(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 yt(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 kt(this.config)})}assets(t){return c(this,null,function*(){const e=yield this.getBestToken();return mt(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 $t(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 wt(y(o({},this.config),{token:e,assetID:t}))})}getAsset(t){return c(this,null,function*(){const e=yield this.getBestToken();return pt(y(o({},this.config),{assetID:t,token:e}))})}createEntry(t){return c(this,null,function*(){const e=yield this.getBestToken();return At(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 Et(y(o({},this.config),{token:e,entryID:t}))})}resourceList(t){return c(this,null,function*(){const e=yield this.getBestToken();return Bt(y(o({},this.config),{options:t,token:e}))})}raw(t,e){return c(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 c(this,null,function*(){const e=yield this.getBestToken();return St(y(o({},this.config),{dmID:t,token:e}))})}dmList(){return c(this,arguments,function*(t={}){const e=yield this.getBestToken();return Ot(y(o({},this.config),{options:t,token:e}))})}modelList(){return c(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;
|
|
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
|
@@ -10,40 +10,40 @@ var S = (n, t, e) => t in n ? z(n, t, { enumerable: !0, configurable: !0, writab
|
|
|
10
10
|
R.call(t, e) && S(n, e, t[e]);
|
|
11
11
|
return n;
|
|
12
12
|
}, p = (n, t) => C(n, F(t));
|
|
13
|
-
var
|
|
14
|
-
var
|
|
13
|
+
var c = (n, t, e) => new Promise((s, r) => {
|
|
14
|
+
var u = (a) => {
|
|
15
15
|
try {
|
|
16
|
-
d(e.next(
|
|
17
|
-
} catch (
|
|
18
|
-
r(
|
|
16
|
+
d(e.next(a));
|
|
17
|
+
} catch (l) {
|
|
18
|
+
r(l);
|
|
19
19
|
}
|
|
20
|
-
}, i = (
|
|
20
|
+
}, i = (a) => {
|
|
21
21
|
try {
|
|
22
|
-
d(e.throw(
|
|
23
|
-
} catch (
|
|
24
|
-
r(
|
|
22
|
+
d(e.throw(a));
|
|
23
|
+
} catch (l) {
|
|
24
|
+
r(l);
|
|
25
25
|
}
|
|
26
|
-
}, d = (
|
|
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
|
|
30
|
+
return c(this, arguments, function* (n, t = {}, e = {}) {
|
|
31
31
|
var d;
|
|
32
|
-
const { token: r, rawRes:
|
|
32
|
+
const { token: r, rawRes: u } = t;
|
|
33
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
|
|
40
|
-
${
|
|
41
|
-
${
|
|
42
|
-
throw new Error(
|
|
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
|
|
46
|
+
return u ? i : yield i.json();
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
const B = {
|
|
@@ -89,12 +89,12 @@ const q = {
|
|
|
89
89
|
live: "https://accounts.entrecode.de/"
|
|
90
90
|
};
|
|
91
91
|
function v(n) {
|
|
92
|
-
return
|
|
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
|
|
95
|
+
const u = y(`api/${e}/_auth/login?clientID=rest`, t);
|
|
96
96
|
return yield g(
|
|
97
|
-
|
|
97
|
+
u,
|
|
98
98
|
{},
|
|
99
99
|
{
|
|
100
100
|
method: "POST",
|
|
@@ -107,7 +107,7 @@ function v(n) {
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
function U(n) {
|
|
110
|
-
return
|
|
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
113
|
const r = `${q[t]}auth/login?clientID=rest`;
|
|
@@ -125,7 +125,7 @@ function U(n) {
|
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
function I(n) {
|
|
128
|
-
return
|
|
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
131
|
const r = y(
|
|
@@ -142,7 +142,7 @@ function I(n) {
|
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
function M(n) {
|
|
145
|
-
return
|
|
145
|
+
return c(this, null, function* () {
|
|
146
146
|
let { env: t, token: e } = n;
|
|
147
147
|
h({ env: t, token: e });
|
|
148
148
|
const s = `${q[t]}auth/logout?clientID=rest`;
|
|
@@ -190,7 +190,7 @@ function Q(n) {
|
|
|
190
190
|
return JSON.parse(JSON.stringify(n));
|
|
191
191
|
}
|
|
192
192
|
function W(n) {
|
|
193
|
-
return
|
|
193
|
+
return c(this, null, function* () {
|
|
194
194
|
let { env: t, dmShortID: e } = n;
|
|
195
195
|
h({ env: t, dmShortID: e });
|
|
196
196
|
const s = y(`api/${e}`, t);
|
|
@@ -198,21 +198,21 @@ function W(n) {
|
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
function X(n) {
|
|
201
|
-
return
|
|
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
|
|
205
|
-
let f =
|
|
206
|
-
return f = Array.isArray(f) ? f : [f], { count: d, total:
|
|
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
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
|
|
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 Z(
|
|
215
|
-
return
|
|
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
217
|
const i = y(`api/${t}/${e}`, n);
|
|
218
218
|
return yield g(
|
|
@@ -229,76 +229,74 @@ function Z(l) {
|
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
function tt(d) {
|
|
232
|
-
return
|
|
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:
|
|
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
|
|
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
|
-
|
|
248
|
+
a["If-Unmodified-Since"] = new Date(r._modified).toUTCString();
|
|
249
249
|
}
|
|
250
|
-
const
|
|
250
|
+
const l = y(`api/${t}/${e}?_id=${s}`, n);
|
|
251
251
|
return r = Q(r), r = x(r), yield g(
|
|
252
|
-
|
|
253
|
-
{ token:
|
|
252
|
+
l,
|
|
253
|
+
{ token: u },
|
|
254
254
|
{
|
|
255
255
|
method: "PUT",
|
|
256
|
-
headers:
|
|
256
|
+
headers: a,
|
|
257
257
|
body: JSON.stringify(r)
|
|
258
258
|
}
|
|
259
259
|
);
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
|
-
function et(
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
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
276
|
function nt(r) {
|
|
279
|
-
return
|
|
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
|
|
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: ${
|
|
283
|
+
`getSchema: ${u} returned unexpected format: ${JSON.stringify(i)}`
|
|
286
284
|
);
|
|
287
|
-
const { properties:
|
|
288
|
-
for (let A in
|
|
289
|
-
let m =
|
|
290
|
-
if (m.required = d.required.includes(A), ($ =
|
|
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(">"))) {
|
|
291
289
|
const k = m.title.split("<")[1].slice(0, -1), N = m.title.split("<")[0];
|
|
292
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
|
|
293
|
+
delete l[A].title;
|
|
296
294
|
}
|
|
297
295
|
if (s) {
|
|
298
|
-
const A =
|
|
299
|
-
return { properties:
|
|
296
|
+
const A = a._modelTitle.title, m = a._modelTitleField.title;
|
|
297
|
+
return { properties: l, meta: { modelTitleField: m, modelTitle: A } };
|
|
300
298
|
}
|
|
301
|
-
return
|
|
299
|
+
return l;
|
|
302
300
|
});
|
|
303
301
|
}
|
|
304
302
|
function st(n) {
|
|
@@ -311,48 +309,48 @@ function rt(n, t) {
|
|
|
311
309
|
const e = K(t);
|
|
312
310
|
return t._embedded[`${e}:${t._modelTitle}/${n}/asset`];
|
|
313
311
|
}
|
|
314
|
-
function it(
|
|
315
|
-
return
|
|
312
|
+
function it(u) {
|
|
313
|
+
return c(this, arguments, function* ({ env: n, dmShortID: t, assetGroup: e, assetID: s, token: r }) {
|
|
316
314
|
h({ env: n, dmShortID: t, assetGroup: e, assetID: s });
|
|
317
315
|
const i = w({ assetID: s }), d = y(`a/${t}/${e}?${i}`, n);
|
|
318
316
|
return (yield g(d, { dmShortID: t, token: r }))._embedded["ec:dm-asset"];
|
|
319
317
|
});
|
|
320
318
|
}
|
|
321
319
|
function ot(n) {
|
|
322
|
-
return
|
|
323
|
-
let { env: t, dmShortID: e, assetGroup: s, token: r, options:
|
|
324
|
-
h({ env: t, dmShortID: e, assetGroup: s }),
|
|
325
|
-
const i = w(
|
|
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 });
|
|
326
324
|
let $ = f ? f["ec:dm-asset"] : [];
|
|
327
|
-
return $ = Array.isArray($) ? $ : [$], { count:
|
|
325
|
+
return $ = Array.isArray($) ? $ : [$], { count: a, total: l, items: $ };
|
|
328
326
|
});
|
|
329
327
|
}
|
|
330
328
|
function at(d) {
|
|
331
|
-
return
|
|
329
|
+
return c(this, arguments, function* ({
|
|
332
330
|
env: n,
|
|
333
331
|
dmShortID: t,
|
|
334
332
|
assetGroup: e,
|
|
335
333
|
token: s,
|
|
336
334
|
file: r,
|
|
337
|
-
name:
|
|
335
|
+
name: u,
|
|
338
336
|
options: i
|
|
339
337
|
}) {
|
|
340
338
|
h({ env: n, dmShortID: t, assetGroup: e, file: r });
|
|
341
|
-
const
|
|
342
|
-
return
|
|
343
|
-
|
|
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[$]);
|
|
344
342
|
}), (yield g(
|
|
345
|
-
|
|
343
|
+
a,
|
|
346
344
|
{ token: s },
|
|
347
345
|
{
|
|
348
346
|
method: "POST",
|
|
349
|
-
body:
|
|
347
|
+
body: l
|
|
350
348
|
}
|
|
351
349
|
))._embedded["ec:dm-asset"];
|
|
352
350
|
});
|
|
353
351
|
}
|
|
354
|
-
function ct(
|
|
355
|
-
return
|
|
352
|
+
function ct(u) {
|
|
353
|
+
return c(this, arguments, function* ({
|
|
356
354
|
env: n,
|
|
357
355
|
dmShortID: t,
|
|
358
356
|
assetGroup: e,
|
|
@@ -371,7 +369,7 @@ function ct(l) {
|
|
|
371
369
|
});
|
|
372
370
|
}
|
|
373
371
|
function ut(n) {
|
|
374
|
-
return
|
|
372
|
+
return c(this, null, function* () {
|
|
375
373
|
let { env: t, dmID: e, token: s } = n;
|
|
376
374
|
h({ env: t, dmID: e });
|
|
377
375
|
const r = y(`?dataManagerID=${e}`, t);
|
|
@@ -379,38 +377,38 @@ function ut(n) {
|
|
|
379
377
|
});
|
|
380
378
|
}
|
|
381
379
|
function lt(n) {
|
|
382
|
-
return
|
|
380
|
+
return c(this, null, function* () {
|
|
383
381
|
let { env: t, options: e = {} } = n;
|
|
384
382
|
h({ env: t }), e = o({ size: 25, page: 1, _list: !0 }, e);
|
|
385
|
-
const s = w(e), r = y(`?${s}`, t), { count:
|
|
386
|
-
let
|
|
387
|
-
return
|
|
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 };
|
|
388
386
|
});
|
|
389
387
|
}
|
|
390
388
|
function dt(n) {
|
|
391
|
-
return
|
|
389
|
+
return c(this, null, function* () {
|
|
392
390
|
let { env: t, dmID: e, options: s = {} } = n;
|
|
393
391
|
h({ env: t, dmID: e }), s = o({ size: 25, dataManagerID: e, page: 1, _list: !0 }, s);
|
|
394
|
-
const r = w(s),
|
|
395
|
-
let
|
|
396
|
-
return
|
|
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 };
|
|
397
395
|
});
|
|
398
396
|
}
|
|
399
397
|
function ht(n) {
|
|
400
|
-
return
|
|
398
|
+
return c(this, null, function* () {
|
|
401
399
|
let { env: t, resource: e, options: s = {}, subdomain: r = "datamanager" } = n;
|
|
402
400
|
h({ env: t, subdomain: r, resource: e }), s = o({ size: 25, page: 1, _list: !0 }, s);
|
|
403
|
-
const
|
|
404
|
-
let f =
|
|
405
|
-
return f = Array.isArray(f) ? f : [f], { count: d, total:
|
|
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 };
|
|
406
404
|
});
|
|
407
405
|
}
|
|
408
406
|
function gt(e) {
|
|
409
|
-
return
|
|
410
|
-
let { env: s, route: r, options:
|
|
411
|
-
h({ env: s, subdomain: i, route: r }),
|
|
412
|
-
const d = w(
|
|
413
|
-
return g(
|
|
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);
|
|
414
412
|
});
|
|
415
413
|
}
|
|
416
414
|
const E = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -495,13 +493,13 @@ class _ {
|
|
|
495
493
|
* const secrets = await sdk("stage").token(token).dm("83cc6374").model("secret").entries()
|
|
496
494
|
*/
|
|
497
495
|
entries() {
|
|
498
|
-
return
|
|
496
|
+
return c(this, arguments, function* (t = {}) {
|
|
499
497
|
const e = yield this.getBestToken();
|
|
500
498
|
return ft(p(o({}, this.config), { options: t, token: e }));
|
|
501
499
|
});
|
|
502
500
|
}
|
|
503
501
|
entryList(t) {
|
|
504
|
-
return
|
|
502
|
+
return c(this, null, function* () {
|
|
505
503
|
return this.entries(t);
|
|
506
504
|
});
|
|
507
505
|
}
|
|
@@ -515,7 +513,7 @@ class _ {
|
|
|
515
513
|
* const muffin = await sdk("stage").dm("83cc6374").model("muffin").getEntry("1gOtzWvrdq")
|
|
516
514
|
*/
|
|
517
515
|
getEntry(t) {
|
|
518
|
-
return
|
|
516
|
+
return c(this, null, function* () {
|
|
519
517
|
const e = yield this.getBestToken();
|
|
520
518
|
return pt(p(o({}, this.config), { entryID: t, token: e }));
|
|
521
519
|
});
|
|
@@ -535,7 +533,7 @@ class _ {
|
|
|
535
533
|
* .editEntrySafe("1gOtzWvrdq", { name: "test", _modified: "2020-01-01T00:00:00.000Z"})
|
|
536
534
|
*/
|
|
537
535
|
editEntrySafe(t, e) {
|
|
538
|
-
return
|
|
536
|
+
return c(this, null, function* () {
|
|
539
537
|
const s = yield this.getBestToken();
|
|
540
538
|
return D(p(o({}, this.config), { entryID: t, token: s, value: e, safePut: !0 }));
|
|
541
539
|
});
|
|
@@ -549,7 +547,7 @@ class _ {
|
|
|
549
547
|
* const muffin = await sdk("stage").dm("83cc6374").model("muffin").getSchema()
|
|
550
548
|
*/
|
|
551
549
|
getSchema() {
|
|
552
|
-
return
|
|
550
|
+
return c(this, null, function* () {
|
|
553
551
|
return kt(this.config);
|
|
554
552
|
});
|
|
555
553
|
}
|
|
@@ -567,13 +565,13 @@ class _ {
|
|
|
567
565
|
* const files = await sdk("stage").token(token).dm("83cc6374").assetGroup("avatars").assets()
|
|
568
566
|
*/
|
|
569
567
|
assets(t) {
|
|
570
|
-
return
|
|
568
|
+
return c(this, null, function* () {
|
|
571
569
|
const e = yield this.getBestToken();
|
|
572
570
|
return mt(p(o({}, this.config), { options: t, token: e }));
|
|
573
571
|
});
|
|
574
572
|
}
|
|
575
573
|
assetList(t) {
|
|
576
|
-
return
|
|
574
|
+
return c(this, null, function* () {
|
|
577
575
|
return this.assets(t);
|
|
578
576
|
});
|
|
579
577
|
}
|
|
@@ -599,7 +597,7 @@ class _ {
|
|
|
599
597
|
* .createAsset({ file, name: "venndiagram.png" });
|
|
600
598
|
*/
|
|
601
599
|
createAsset() {
|
|
602
|
-
return
|
|
600
|
+
return c(this, arguments, function* ({ file: t, name: e, options: s } = {}) {
|
|
603
601
|
const r = yield this.getBestToken();
|
|
604
602
|
return $t(p(o({}, this.config), { file: t, name: e, options: s, token: r }));
|
|
605
603
|
});
|
|
@@ -614,7 +612,7 @@ class _ {
|
|
|
614
612
|
* await ecadmin.assetgroup("test").deleteAsset('xxxx');
|
|
615
613
|
*/
|
|
616
614
|
deleteAsset(t) {
|
|
617
|
-
return
|
|
615
|
+
return c(this, null, function* () {
|
|
618
616
|
const e = yield this.getBestToken();
|
|
619
617
|
return wt(p(o({}, this.config), { token: e, assetID: t }));
|
|
620
618
|
});
|
|
@@ -629,7 +627,7 @@ class _ {
|
|
|
629
627
|
* const asset = await sdk("stage").dm("83cc6374").assetgroup("test").getAsset("tP-ZxpZZTGmbPnET-wArAQ")
|
|
630
628
|
*/
|
|
631
629
|
getAsset(t) {
|
|
632
|
-
return
|
|
630
|
+
return c(this, null, function* () {
|
|
633
631
|
const e = yield this.getBestToken();
|
|
634
632
|
return yt(p(o({}, this.config), { assetID: t, token: e }));
|
|
635
633
|
});
|
|
@@ -644,7 +642,7 @@ class _ {
|
|
|
644
642
|
* const entry = await sdk("stage").dm("83cc6374").model("muffin").createEntry({ name: 'test' })
|
|
645
643
|
*/
|
|
646
644
|
createEntry(t) {
|
|
647
|
-
return
|
|
645
|
+
return c(this, null, function* () {
|
|
648
646
|
const e = yield this.getBestToken();
|
|
649
647
|
return At(p(o({}, this.config), { token: e, value: t }));
|
|
650
648
|
});
|
|
@@ -660,7 +658,7 @@ class _ {
|
|
|
660
658
|
* const entry = await sdk("stage").dm("83cc6374").model("muffin").editEntry("1gOtzWvrdq", { name: "test" })
|
|
661
659
|
*/
|
|
662
660
|
editEntry(t, e) {
|
|
663
|
-
return
|
|
661
|
+
return c(this, null, function* () {
|
|
664
662
|
const s = yield this.getBestToken();
|
|
665
663
|
return D(p(o({}, this.config), { entryID: t, token: s, value: e }));
|
|
666
664
|
});
|
|
@@ -670,12 +668,12 @@ class _ {
|
|
|
670
668
|
* If model DELETE is not public, you also need to provide a `token`.
|
|
671
669
|
*
|
|
672
670
|
* @param {string} entryID id of entry to delete
|
|
673
|
-
* @returns {void}
|
|
671
|
+
* @returns {Promise<void>}
|
|
674
672
|
* @example
|
|
675
673
|
* await sdk("stage").dm("83cc6374").model("muffin").deleteEntry("1gOtzWvrdq")
|
|
676
674
|
*/
|
|
677
675
|
deleteEntry(t) {
|
|
678
|
-
return
|
|
676
|
+
return c(this, null, function* () {
|
|
679
677
|
const e = yield this.getBestToken();
|
|
680
678
|
return Et(p(o({}, this.config), { token: e, entryID: t }));
|
|
681
679
|
});
|
|
@@ -690,7 +688,7 @@ class _ {
|
|
|
690
688
|
* const res = await sdk("stage").resource("template").resourceList()
|
|
691
689
|
*/
|
|
692
690
|
resourceList(t) {
|
|
693
|
-
return
|
|
691
|
+
return c(this, null, function* () {
|
|
694
692
|
const e = yield this.getBestToken();
|
|
695
693
|
return Bt(p(o({}, this.config), { options: t, token: e }));
|
|
696
694
|
});
|
|
@@ -707,7 +705,7 @@ class _ {
|
|
|
707
705
|
* const res = await sdk("stage").route("stats").raw()
|
|
708
706
|
*/
|
|
709
707
|
raw(t, e) {
|
|
710
|
-
return
|
|
708
|
+
return c(this, null, function* () {
|
|
711
709
|
const s = yield this.getBestToken();
|
|
712
710
|
return Dt(p(o({}, this.config), { options: t, token: s }), e);
|
|
713
711
|
});
|
|
@@ -874,7 +872,7 @@ class _ {
|
|
|
874
872
|
* @returns any
|
|
875
873
|
*/
|
|
876
874
|
getDatamanager(t) {
|
|
877
|
-
return
|
|
875
|
+
return c(this, null, function* () {
|
|
878
876
|
const e = yield this.getBestToken();
|
|
879
877
|
return St(p(o({}, this.config), { dmID: t, token: e }));
|
|
880
878
|
});
|
|
@@ -888,7 +886,7 @@ class _ {
|
|
|
888
886
|
* const dms = await sdk("stage").dmList()
|
|
889
887
|
*/
|
|
890
888
|
dmList() {
|
|
891
|
-
return
|
|
889
|
+
return c(this, arguments, function* (t = {}) {
|
|
892
890
|
const e = yield this.getBestToken();
|
|
893
891
|
return Lt(p(o({}, this.config), { options: t, token: e }));
|
|
894
892
|
});
|
|
@@ -902,7 +900,7 @@ class _ {
|
|
|
902
900
|
* const models = await sdk("stage").dmID("254a03f1-cb76-4f1e-a52a-bbd4180ca10c").modelList()
|
|
903
901
|
*/
|
|
904
902
|
modelList() {
|
|
905
|
-
return
|
|
903
|
+
return c(this, arguments, function* (t = {}) {
|
|
906
904
|
const e = yield this.getBestToken();
|
|
907
905
|
return Ot(p(o({}, this.config), { options: t, token: e }));
|
|
908
906
|
});
|
package/dist/lib/api.d.mts
CHANGED
|
@@ -143,11 +143,11 @@ export class Sdk {
|
|
|
143
143
|
* If model DELETE is not public, you also need to provide a `token`.
|
|
144
144
|
*
|
|
145
145
|
* @param {string} entryID id of entry to delete
|
|
146
|
-
* @returns {void}
|
|
146
|
+
* @returns {Promise<void>}
|
|
147
147
|
* @example
|
|
148
148
|
* await sdk("stage").dm("83cc6374").model("muffin").deleteEntry("1gOtzWvrdq")
|
|
149
149
|
*/
|
|
150
|
-
deleteEntry(entryID: string): void
|
|
150
|
+
deleteEntry(entryID: string): Promise<void>;
|
|
151
151
|
/**
|
|
152
152
|
* Fetches resource list. Expects `resource` to be set. `subdomain` defaults to "datamanager".
|
|
153
153
|
* Fetches `https://<subdomain>.entrecode.de/<resource>?_list=true&size=<options.size ?? 25>`
|
package/dist/lib/api.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.mts","sourceRoot":"","sources":["../../src/lib/api.mjs"],"names":[],"mappings":"AAgCA,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;;;;;;;;;;;;;OAaG;IACH,uBATW,MAAM,SACN,MAAM,GACJ,QAAQ,aAAa,CAAC,CAUlC;IACD;;;;;;;OAOG;IACH,aAJa,QAAQ,WAAW,CAAC,CAMhC;IACD;;;;;;;;;;;;OAYG;IACH,iBATW,MAAM,eACJ,QAAQ,SAAS,CAAC,CAW9B;IACD,4CAEC;IACD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,sCAjBW;QAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;QAAC,MAAM,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAClD,QAAQ,aAAa,CAAC,CAmBlC;IACD;;;;;;;;OAQG;IACH,qBALW,MAAM,GACJ,QAAQ,IAAI,CAAC,CAOzB;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,
|
|
1
|
+
{"version":3,"file":"api.d.mts","sourceRoot":"","sources":["../../src/lib/api.mjs"],"names":[],"mappings":"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"}
|
package/dist/lib/entries.d.mts
CHANGED
|
@@ -33,7 +33,7 @@ export function deleteEntry({ env, dmShortID, model, entryID, token }: {
|
|
|
33
33
|
model: any;
|
|
34
34
|
entryID: any;
|
|
35
35
|
token: any;
|
|
36
|
-
}): Promise<
|
|
36
|
+
}): Promise<any>;
|
|
37
37
|
export function getSchema({ env, dmShortID, model, withMetadata }: {
|
|
38
38
|
env: any;
|
|
39
39
|
dmShortID: any;
|
|
@@ -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;;;;;;
|
|
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"}
|