ec.fdk 0.2.25 → 0.2.26

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/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var G=Object.defineProperty,H=Object.defineProperties;var Q=Object.getOwnPropertyDescriptors;var b=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var T=(n,t,e)=>t in n?G(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,c=(n,t)=>{for(var e in t||(t={}))V.call(t,e)&&T(n,e,t[e]);if(b)for(var e of b(t))W.call(t,e)&&T(n,e,t[e]);return n},y=(n,t)=>H(n,Q(t));var o=(n,t,e)=>new Promise((s,r)=>{var u=a=>{try{l(e.next(a))}catch(g){r(g)}},i=a=>{try{l(e.throw(a))}catch(g){r(g)}},l=a=>a.done?s(a.value):Promise.resolve(a.value).then(u,i);l((e=e.apply(n,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function d(s){return o(this,arguments,function*(n,t={},e={}){var l;const{token:r,rawRes:u}=t;r&&(e.headers=y(c({},e.headers||{}),{Authorization:`Bearer ${r}`}));const i=yield fetch(n,e);if(!i.ok){if((l=i.headers.get("content-type"))!=null&&l.includes("application/json")){const a=yield i.json(),g=`${a.title}
2
- ${a.detail}
3
- ${a.verbose}`;throw new Error(g)}throw new Error(`unexpected fetch error: ${i.statusText}`)}return u?i:yield i.json()})}const P={live:"https://datamanager.entrecode.de/",stage:"https://datamanager.cachena.entrecode.de/"};function f(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 A(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 L={stage:"https://accounts.cachena.entrecode.de/",live:"https://accounts.entrecode.de/"};function j(n){return o(this,null,function*(){let{env:t,dmShortID:e,email:s,password:r}=n;h({env:t,dmShortID:e,email:s,password:r});const u=f(`api/${e}/_auth/login?clientID=rest`,t);return yield d(u,{},{method:"POST",body:JSON.stringify({email:s,password:r}),headers:{"Content-Type":"application/json"}})})}function O(n){return o(this,null,function*(){let{env:t,email:e,password:s}=n;h({env:t,email:e,password:s});const r=`${L[t]}auth/login?clientID=rest`;return yield d(r,{},{method:"POST",body:JSON.stringify({email:e,password:s}),headers:{"Content-Type":"application/json"}})})}function _(n){return o(this,null,function*(){let{dmShortID:t,env:e,token:s}=n;h({dmShortID:t,env:e,token:s});const r=f(`api/${t}/_auth/logout?clientID=rest&token=${s}`,e);return yield d(r,{dmShortID:t,rawRes:!0},{method:"POST"})})}function B(n){return o(this,null,function*(){let{env:t,token:e}=n;h({env:t,token:e});const s=`${L[t]}auth/logout?clientID=rest`;return yield d(s,{rawRes:!0,token:e},{method:"POST"})})}function S({dmShortID:n}){return h({dmShortID:n}),n}function D({env:n}){return h({env:n}),n}function q(n){return o(this,null,function*(){let{env:t,dmShortID:e}=n;h({env:t,dmShortID:e});const s=f(`api/${e}`,t);return d(s,n)})}function K(n){return o(this,null,function*(){let{env:t,dmShortID:e,model:s,options:r={}}=n;h({env:t,dmShortID:e,model:s}),r=c({size:50,page:1,_list:!0},r);const u=A(r),i=f(`api/${e}/${s}?${u}`,t),{count:l,total:a,_embedded:g}=yield d(i,n);let p=g?g[`${e}:${s}`]:[];return p=Array.isArray(p)?p:[p],{count:l,total:a,items:p}})}function R({env:n,dmShortID:t,model:e,entryID:s,token:r}){h({env:n,dmShortID:t,model:e,entryID:s});const u=A({_id:s}),i=f(`api/${t}/${e}?${u}`,n);return d(i,{dmShortID:t,token:r})}function v(u){return o(this,arguments,function*({env:n,dmShortID:t,model:e,value:s,token:r}){h({env:n,dmShortID:t,model:e,value:s});const i=f(`api/${t}/${e}`,n);return yield d(i,{env:n,dmShortID:t,token:r},{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}})})}function x(i){return o(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,value:r,token:u}){h({env:n,dmShortID:t,model:e,entryID:s,value:r});const l=f(`api/${t}/${e}?_id=${s}`,n);return yield d(l,{token:u},{method:"PUT",body:JSON.stringify(r),headers:{"Content-Type":"application/json"}})})}function z(u){return o(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,token:r}){h({env:n,dmShortID:t,model:e,entryID:s});const i=f(`api/${t}/${e}?_id=${s}`,n);yield d(i,{token:r,rawRes:!0},{method:"DELETE",headers:{"Content-Type":"application/json"}})})}function C(u){return o(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){h({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=A({assetID:s}),l=f(`a/${t}/${e}?${i}`,n);return(yield d(l,{dmShortID:t,token:r}))._embedded["ec:dm-asset"]})}function J(n){return o(this,null,function*(){let{env:t,dmShortID:e,assetGroup:s,token:r,options:u={}}=n;h({env:t,dmShortID:e,assetGroup:s}),u=c({size:50,page:1,_list:!0},u);const i=A(u),l=f(`a/${e}/${s}?${i}`,t),{count:a,total:g,_embedded:p}=yield d(l,{dmShortID:e,token:r});let $=p?p["ec:dm-asset"]:[];return $=Array.isArray($)?$:[$],{count:a,total:g,items:$}})}function M(l){return o(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 a=f(`a/${t}/${e}`,n),g=new FormData;return g.append("file",r,u),i&&Object.keys(i).forEach($=>{g.append($,i[$])}),(yield d(a,{token:s},{method:"POST",body:g}))._embedded["ec:dm-asset"]})}function N(u){return o(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){h({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=f(`a/${t}/${e}/${s}`,n);yield d(i,{token:r,rawRes:!0},{method:"DELETE"})})}function U(n){return o(this,null,function*(){let{env:t,dmID:e,token:s}=n;h({env:t,dmID:e});const r=f(`?dataManagerID=${e}`,t);return d(r,{token:s})})}function F(n){return o(this,null,function*(){let{env:t,options:e={}}=n;h({env:t}),e=c({size:25,page:1,_list:!0},e);const s=A(e),r=f(`?${s}`,t),{count:u,total:i,_embedded:l}=yield d(r,n);let a=l?l["ec:datamanager"]:[];return a=Array.isArray(a)?a:[a],{count:u,total:i,items:a}})}function I(n){return o(this,null,function*(){let{env:t,dmID:e,options:s={}}=n;h({env:t,dmID:e}),s=c({size:25,dataManagerID:e,page:1,_list:!0},s);const r=A(s),u=f(`model?${r}`,t),{count:i,total:l,_embedded:a}=yield d(u,n);let g=a?a["ec:model"]:[];return g=Array.isArray(g)?g:[g],{count:i,total:l,items:g}})}const k=Object.freeze(Object.defineProperty({__proto__:null,assetList:J,createAsset:M,createEntry:v,deleteAsset:N,deleteEntry:z,dmList:F,editEntry:x,entryList:K,getAsset:C,getDatamanager:U,getEcAuthKey:D,getEntry:R,getPublicAuthKey:S,loginEc:O,loginPublic:j,logoutEc:B,logoutPublic:_,modelList:I,publicApi:q},Symbol.toStringTag,{value:"Module"})),{entryList:X,getEntry:Y,getAsset:Z,assetList:tt,createAsset:et,deleteAsset:nt,createEntry:st,editEntry:rt,deleteEntry:ot,loginPublic:it,loginEc:at,logoutEc:ct,logoutPublic:ut,getEcAuthKey:w,getPublicAuthKey:m,dmList:ht,modelList:lt,publicApi:gt,getDatamanager:dt}=k;function yt(n){const{action:t}=n;if(h({action:t}),!k[t])throw new Error(`"${t}" does not exist! try one of ${Object.keys(k).join(", ")}`);return k[t](n)}class E{constructor(t){this.config=t}set(t){return new E(c(c({},this.config),t))}entries(){return o(this,arguments,function*(t={}){const e=yield this.getBestToken();return X(y(c({},this.config),{options:t,token:e}))})}entryList(t){return o(this,null,function*(){return this.entries(t)})}getEntry(t){return o(this,null,function*(){const e=yield this.getBestToken();return Y(y(c({},this.config),{entryID:t,token:e}))})}assets(t){return o(this,null,function*(){const e=yield this.getBestToken();return tt(y(c({},this.config),{options:t,token:e}))})}assetList(t){return o(this,null,function*(){return this.assets(t)})}createAsset(){return o(this,arguments,function*({file:t,name:e,options:s}={}){const r=yield this.getBestToken();return et(y(c({},this.config),{file:t,name:e,options:s,token:r}))})}deleteAsset(t){return o(this,null,function*(){const e=yield this.getBestToken();return nt(y(c({},this.config),{token:e,assetID:t}))})}getAsset(t){return o(this,null,function*(){const e=yield this.getBestToken();return Z(y(c({},this.config),{assetID:t,token:e}))})}createEntry(t){return o(this,null,function*(){const e=yield this.getBestToken();return st(y(c({},this.config),{token:e,value:t}))})}editEntry(t,e){return o(this,null,function*(){const s=yield this.getBestToken();return rt(y(c({},this.config),{entryID:t,token:s,value:e}))})}deleteEntry(t){return o(this,null,function*(){const e=yield this.getBestToken();return ot(y(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 at(c(c({},this.config),t)).then(this.setAuth(w(this.config)))}loginPublic(t){return it(c(c({},this.config),t)).then(this.setAuth(m(this.config)))}logoutPublic(){const t=this.getPublicToken();return console.log("token",t),ut(y(c({},this.config),{token:t})).then(this.unsetAuth(m(this.config)))}logoutEc(){const t=this.getEcToken();return console.log("token",t),ct(y(c({},this.config),{token:t})).then(this.unsetAuth(w(this.config)))}getPublicToken(){return this.config.token||this.getAuth(m(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})}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)}publicApi(){return gt(this.config)}getDatamanager(t){return o(this,null,function*(){const e=yield this.getBestToken();return dt(y(c({},this.config),{dmID:t,token:e}))})}dmList(){return o(this,arguments,function*(t={}){const e=yield this.getBestToken();return ht(y(c({},this.config),{options:t,token:e}))})}modelList(){return o(this,arguments,function*(t={}){const e=yield this.getBestToken();return lt(y(c({},this.config),{options:t,token:e}))})}}const ft=n=>new E({env:n});exports.Sdk=E;exports.act=yt;exports.apiURL=f;exports.assetList=J;exports.createAsset=M;exports.createEntry=v;exports.deleteAsset=N;exports.deleteEntry=z;exports.dmList=F;exports.editEntry=x;exports.entryList=K;exports.expect=h;exports.fetcher=d;exports.getAsset=C;exports.getDatamanager=U;exports.getEcAuthKey=D;exports.getEntry=R;exports.getPublicAuthKey=S;exports.loginEc=O;exports.loginPublic=j;exports.logoutEc=B;exports.logoutPublic=_;exports.modelList=I;exports.publicApi=q;exports.query=A;exports.sdk=ft;
1
+ "use strict";var Z=Object.defineProperty,tt=Object.defineProperties;var et=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var nt=Object.prototype.hasOwnProperty,st=Object.prototype.propertyIsEnumerable;var O=(n,t,e)=>t in n?Z(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,l=(n,t)=>{for(var e in t||(t={}))nt.call(t,e)&&O(n,e,t[e]);if(L)for(var e of L(t))st.call(t,e)&&O(n,e,t[e]);return n},f=(n,t)=>tt(n,et(t));var o=(n,t,e)=>new Promise((s,r)=>{var u=c=>{try{a(e.next(c))}catch(h){r(h)}},i=c=>{try{a(e.throw(c))}catch(h){r(h)}},a=c=>c.done?s(c.value):Promise.resolve(c.value).then(u,i);a((e=e.apply(n,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function g(s){return o(this,arguments,function*(n,t={},e={}){var a;const{token:r,rawRes:u}=t;r&&(e.headers=f(l({},e.headers||{}),{Authorization:`Bearer ${r}`}));const i=yield fetch(n,e);if(!i.ok){if((a=i.headers.get("content-type"))!=null&&a.includes("application/json")){const c=yield i.json(),h=`${c.title}
2
+ ${c.detail}
3
+ ${c.verbose}`;throw new Error(h)}throw new Error(`unexpected fetch error: ${i.statusText}`)}return u?i:yield i.json()})}const j={live:"https://datamanager.entrecode.de/",stage:"https://datamanager.cachena.entrecode.de/"};function y(n,t="stage"){const e=j[t];if(!e)throw new Error(`env "${t}" not found. Try one of ${Object.keys(j).join(", ")}`);return e+n}function k(n,t=!0){return Object.entries(n).sort((e,s)=>e[0].localeCompare(s[0])).map(([e,s])=>`${e}=${s}`).join("&")}function d(n){Object.entries(n).forEach(([t,e])=>{if(e===void 0)throw new Error(`expected ${t} to be set!`)})}const S={stage:"https://accounts.cachena.entrecode.de/",live:"https://accounts.entrecode.de/"};function B(n){return o(this,null,function*(){let{env:t,dmShortID:e,email:s,password:r}=n;d({env:t,dmShortID:e,email:s,password:r});const u=y(`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 q(n){return o(this,null,function*(){let{env:t,email:e,password:s}=n;d({env:t,email:e,password:s});const r=`${S[t]}auth/login?clientID=rest`;return yield g(r,{},{method:"POST",body:JSON.stringify({email:e,password:s}),headers:{"Content-Type":"application/json"}})})}function D(n){return o(this,null,function*(){let{dmShortID:t,env:e,token:s}=n;d({dmShortID:t,env:e,token:s});const r=y(`api/${t}/_auth/logout?clientID=rest&token=${s}`,e);return yield g(r,{dmShortID:t,rawRes:!0},{method:"POST"})})}function K(n){return o(this,null,function*(){let{env:t,token:e}=n;d({env:t,token:e});const s=`${S[t]}auth/logout?clientID=rest`;return yield g(s,{rawRes:!0,token:e},{method:"POST"})})}function x({dmShortID:n}){return d({dmShortID:n}),n}function R({env:n}){return d({env:n}),n}function v(n){return o(this,null,function*(){let{env:t,dmShortID:e}=n;d({env:t,dmShortID:e});const s=y(`api/${e}`,t);return g(s,n)})}function z(n){return o(this,null,function*(){let{env:t,dmShortID:e,model:s,options:r={}}=n;d({env:t,dmShortID:e,model:s}),r=l({size:50,page:1,_list:!0},r);const u=k(r),i=y(`api/${e}/${s}?${u}`,t),{count:a,total:c,_embedded:h}=yield g(i,n);let p=h?h[`${e}:${s}`]:[];return p=Array.isArray(p)?p:[p],{count:a,total:c,items:p}})}function C({env:n,dmShortID:t,model:e,entryID:s,token:r}){d({env:n,dmShortID:t,model:e,entryID:s});const u=k({_id:s}),i=y(`api/${t}/${e}?${u}`,n);return g(i,{dmShortID:t,token:r})}function J(u){return o(this,arguments,function*({env:n,dmShortID:t,model:e,value:s,token:r}){d({env:n,dmShortID:t,model:e,value:s});const i=y(`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 N(i){return o(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,value:r,token:u}){d({env:n,dmShortID:t,model:e,entryID:s,value:r});const a=y(`api/${t}/${e}?_id=${s}`,n);return yield g(a,{token:u},{method:"PUT",body:JSON.stringify(r),headers:{"Content-Type":"application/json"}})})}function M(u){return o(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,token:r}){d({env:n,dmShortID:t,model:e,entryID:s});const i=y(`api/${t}/${e}?_id=${s}`,n);yield g(i,{token:r,rawRes:!0},{method:"DELETE",headers:{"Content-Type":"application/json"}})})}function U(s){return o(this,arguments,function*({env:n,dmShortID:t,model:e}){var h,p,$,P,_;d({env:n,dmShortID:t,model:e});const r=y(`api/schema/${t}/${e}`,n),u=yield g(r),i=(h=u==null?void 0:u.allOf)==null?void 0:h[1];if(typeof i.properties!="object")throw new Error(`getSchema: ${r} returned unexpected format: ${JSON.stringify(u)}`);const{properties:a}=i;let c=["created","creator","id","modified","private","_created","_creator","_embedded","_entryTitle","_id","_links","_modelTitle","_modelTitleField","_modified"];for(let A in a){let m=a[A];if(m.required=i.required.includes(A),c.includes(A)){delete a[A];continue}if((p=a[A])!=null&&p.oneOf&&(($=a[A])==null||delete $.oneOf),(P=m.title)!=null&&P.includes("<")&&((_=m.title)!=null&&_.includes(">"))){const X=m.title.split("<")[1].slice(0,-1),Y=m.title.split("<")[0];m.type=Y,m.resource=X,delete a[A].title}["asset","entry","assets","entries"].includes(m.title)&&(m.type=m.title,m.resource=null,delete a[A].title)}return a})}function F(u){return o(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){d({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=k({assetID:s}),a=y(`a/${t}/${e}?${i}`,n);return(yield g(a,{dmShortID:t,token:r}))._embedded["ec:dm-asset"]})}function G(n){return o(this,null,function*(){let{env:t,dmShortID:e,assetGroup:s,token:r,options:u={}}=n;d({env:t,dmShortID:e,assetGroup:s}),u=l({size:50,page:1,_list:!0},u);const i=k(u),a=y(`a/${e}/${s}?${i}`,t),{count:c,total:h,_embedded:p}=yield g(a,{dmShortID:e,token:r});let $=p?p["ec:dm-asset"]:[];return $=Array.isArray($)?$:[$],{count:c,total:h,items:$}})}function H(a){return o(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,token:s,file:r,name:u,options:i}){d({env:n,dmShortID:t,assetGroup:e,file:r});const c=y(`a/${t}/${e}`,n),h=new FormData;return h.append("file",r,u),i&&Object.keys(i).forEach($=>{h.append($,i[$])}),(yield g(c,{token:s},{method:"POST",body:h}))._embedded["ec:dm-asset"]})}function I(u){return o(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){d({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=y(`a/${t}/${e}/${s}`,n);yield g(i,{token:r,rawRes:!0},{method:"DELETE"})})}function Q(n){return o(this,null,function*(){let{env:t,dmID:e,token:s}=n;d({env:t,dmID:e});const r=y(`?dataManagerID=${e}`,t);return g(r,{token:s})})}function V(n){return o(this,null,function*(){let{env:t,options:e={}}=n;d({env:t}),e=l({size:25,page:1,_list:!0},e);const s=k(e),r=y(`?${s}`,t),{count:u,total:i,_embedded:a}=yield g(r,n);let c=a?a["ec:datamanager"]:[];return c=Array.isArray(c)?c:[c],{count:u,total:i,items:c}})}function W(n){return o(this,null,function*(){let{env:t,dmID:e,options:s={}}=n;d({env:t,dmID:e}),s=l({size:25,dataManagerID:e,page:1,_list:!0},s);const r=k(s),u=y(`model?${r}`,t),{count:i,total:a,_embedded:c}=yield g(u,n);let h=c?c["ec:model"]:[];return h=Array.isArray(h)?h:[h],{count:i,total:a,items:h}})}const w=Object.freeze(Object.defineProperty({__proto__:null,assetList:G,createAsset:H,createEntry:J,deleteAsset:I,deleteEntry:M,dmList:V,editEntry:N,entryList:z,getAsset:F,getDatamanager:Q,getEcAuthKey:R,getEntry:C,getPublicAuthKey:x,getSchema:U,loginEc:q,loginPublic:B,logoutEc:K,logoutPublic:D,modelList:W,publicApi:v},Symbol.toStringTag,{value:"Module"})),{entryList:rt,getEntry:it,getAsset:ot,assetList:ct,createAsset:at,deleteAsset:ut,createEntry:lt,editEntry:ht,deleteEntry:dt,getSchema:gt,loginPublic:yt,loginEc:ft,logoutEc:pt,logoutPublic:$t,getEcAuthKey:b,getPublicAuthKey:T,dmList:mt,modelList:At,publicApi:kt,getDatamanager:wt}=w;function Et(n){const{action:t}=n;if(d({action:t}),!w[t])throw new Error(`"${t}" does not exist! try one of ${Object.keys(w).join(", ")}`);return w[t](n)}class E{constructor(t){this.config=t}set(t){return new E(l(l({},this.config),t))}entries(){return o(this,arguments,function*(t={}){const e=yield this.getBestToken();return rt(f(l({},this.config),{options:t,token:e}))})}entryList(t){return o(this,null,function*(){return this.entries(t)})}getEntry(t){return o(this,null,function*(){const e=yield this.getBestToken();return it(f(l({},this.config),{entryID:t,token:e}))})}getSchema(){return o(this,null,function*(){return gt(this.config)})}assets(t){return o(this,null,function*(){const e=yield this.getBestToken();return ct(f(l({},this.config),{options:t,token:e}))})}assetList(t){return o(this,null,function*(){return this.assets(t)})}createAsset(){return o(this,arguments,function*({file:t,name:e,options:s}={}){const r=yield this.getBestToken();return at(f(l({},this.config),{file:t,name:e,options:s,token:r}))})}deleteAsset(t){return o(this,null,function*(){const e=yield this.getBestToken();return ut(f(l({},this.config),{token:e,assetID:t}))})}getAsset(t){return o(this,null,function*(){const e=yield this.getBestToken();return ot(f(l({},this.config),{assetID:t,token:e}))})}createEntry(t){return o(this,null,function*(){const e=yield this.getBestToken();return lt(f(l({},this.config),{token:e,value:t}))})}editEntry(t,e){return o(this,null,function*(){const s=yield this.getBestToken();return ht(f(l({},this.config),{entryID:t,token:s,value:e}))})}deleteEntry(t){return o(this,null,function*(){const e=yield this.getBestToken();return dt(f(l({},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 ft(l(l({},this.config),t)).then(this.setAuth(b(this.config)))}loginPublic(t){return yt(l(l({},this.config),t)).then(this.setAuth(T(this.config)))}logoutPublic(){const t=this.getPublicToken();return console.log("token",t),$t(f(l({},this.config),{token:t})).then(this.unsetAuth(T(this.config)))}logoutEc(){const t=this.getEcToken();return console.log("token",t),pt(f(l({},this.config),{token:t})).then(this.unsetAuth(b(this.config)))}getPublicToken(){return this.config.token||this.getAuth(T(this.config))}getEcToken(){return this.config.token||this.getAuth(b(this.config))}hasPublicToken(){return!!this.getPublicToken()}hasEcToken(){return!!this.getEcToken()}hasAnyToken(){return!!this.getEcToken()||!!this.getPublicToken()}getBestToken(){try{return this.getEcToken()||this.getPublicToken()}catch(t){return}}model(t){return this.set({model:t})}token(t){return this.set({token:t})}dmShortID(t){return this.set({dmShortID:t})}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)}publicApi(){return kt(this.config)}getDatamanager(t){return o(this,null,function*(){const e=yield this.getBestToken();return wt(f(l({},this.config),{dmID:t,token:e}))})}dmList(){return o(this,arguments,function*(t={}){const e=yield this.getBestToken();return mt(f(l({},this.config),{options:t,token:e}))})}modelList(){return o(this,arguments,function*(t={}){const e=yield this.getBestToken();return At(f(l({},this.config),{options:t,token:e}))})}}const bt=n=>new E({env:n});exports.Sdk=E;exports.act=Et;exports.apiURL=y;exports.assetList=G;exports.createAsset=H;exports.createEntry=J;exports.deleteAsset=I;exports.deleteEntry=M;exports.dmList=V;exports.editEntry=N;exports.entryList=z;exports.expect=d;exports.fetcher=g;exports.getAsset=F;exports.getDatamanager=Q;exports.getEcAuthKey=R;exports.getEntry=C;exports.getPublicAuthKey=x;exports.getSchema=U;exports.loginEc=q;exports.loginPublic=B;exports.logoutEc=K;exports.logoutPublic=D;exports.modelList=W;exports.publicApi=v;exports.query=k;exports.sdk=bt;
package/dist/index.mjs CHANGED
@@ -1,87 +1,87 @@
1
- var j = Object.defineProperty, _ = Object.defineProperties;
2
- var O = Object.getOwnPropertyDescriptors;
3
- var b = Object.getOwnPropertySymbols;
4
- var B = Object.prototype.hasOwnProperty, D = Object.prototype.propertyIsEnumerable;
5
- var T = (n, t, e) => t in n ? j(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, c = (n, t) => {
1
+ var D = Object.defineProperty, K = Object.defineProperties;
2
+ var x = Object.getOwnPropertyDescriptors;
3
+ var L = Object.getOwnPropertySymbols;
4
+ var z = Object.prototype.hasOwnProperty, C = Object.prototype.propertyIsEnumerable;
5
+ var O = (n, t, e) => t in n ? D(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, l = (n, t) => {
6
6
  for (var e in t || (t = {}))
7
- B.call(t, e) && T(n, e, t[e]);
8
- if (b)
9
- for (var e of b(t))
10
- D.call(t, e) && T(n, e, t[e]);
7
+ z.call(t, e) && O(n, e, t[e]);
8
+ if (L)
9
+ for (var e of L(t))
10
+ C.call(t, e) && O(n, e, t[e]);
11
11
  return n;
12
- }, y = (n, t) => _(n, O(t));
13
- var r = (n, t, e) => new Promise((s, o) => {
12
+ }, y = (n, t) => K(n, x(t));
13
+ var o = (n, t, e) => new Promise((s, r) => {
14
14
  var u = (a) => {
15
15
  try {
16
- h(e.next(a));
17
- } catch (l) {
18
- o(l);
16
+ c(e.next(a));
17
+ } catch (h) {
18
+ r(h);
19
19
  }
20
20
  }, i = (a) => {
21
21
  try {
22
- h(e.throw(a));
23
- } catch (l) {
24
- o(l);
22
+ c(e.throw(a));
23
+ } catch (h) {
24
+ r(h);
25
25
  }
26
- }, h = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(u, i);
27
- h((e = e.apply(n, t)).next());
26
+ }, c = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(u, i);
27
+ c((e = e.apply(n, t)).next());
28
28
  });
29
- function d(s) {
30
- return r(this, arguments, function* (n, t = {}, e = {}) {
31
- var h;
32
- const { token: o, rawRes: u } = t;
33
- o && (e.headers = y(c({}, e.headers || {}), {
34
- Authorization: `Bearer ${o}`
29
+ function g(s) {
30
+ return o(this, arguments, function* (n, t = {}, e = {}) {
31
+ var c;
32
+ const { token: r, rawRes: u } = t;
33
+ r && (e.headers = y(l({}, e.headers || {}), {
34
+ Authorization: `Bearer ${r}`
35
35
  }));
36
36
  const i = yield fetch(n, e);
37
37
  if (!i.ok) {
38
- if ((h = i.headers.get("content-type")) != null && h.includes("application/json")) {
39
- const a = yield i.json(), l = `${a.title}
38
+ if ((c = i.headers.get("content-type")) != null && c.includes("application/json")) {
39
+ const a = yield i.json(), h = `${a.title}
40
40
  ${a.detail}
41
41
  ${a.verbose}`;
42
- throw new Error(l);
42
+ throw new Error(h);
43
43
  }
44
44
  throw new Error(`unexpected fetch error: ${i.statusText}`);
45
45
  }
46
46
  return u ? i : yield i.json();
47
47
  });
48
48
  }
49
- const P = {
49
+ const j = {
50
50
  live: "https://datamanager.entrecode.de/",
51
51
  stage: "https://datamanager.cachena.entrecode.de/"
52
52
  };
53
53
  function f(n, t = "stage") {
54
- const e = P[t];
54
+ const e = j[t];
55
55
  if (!e)
56
56
  throw new Error(
57
- `env "${t}" not found. Try one of ${Object.keys(P).join(", ")}`
57
+ `env "${t}" not found. Try one of ${Object.keys(j).join(", ")}`
58
58
  );
59
59
  return e + n;
60
60
  }
61
- function A(n, t = !0) {
61
+ function w(n, t = !0) {
62
62
  return Object.entries(n).sort((e, s) => e[0].localeCompare(s[0])).map(([e, s]) => `${e}=${s}`).join("&");
63
63
  }
64
- function g(n) {
64
+ function d(n) {
65
65
  Object.entries(n).forEach(([t, e]) => {
66
66
  if (e === void 0)
67
67
  throw new Error(`expected ${t} to be set!`);
68
68
  });
69
69
  }
70
- const L = {
70
+ const S = {
71
71
  stage: "https://accounts.cachena.entrecode.de/",
72
72
  live: "https://accounts.entrecode.de/"
73
73
  };
74
- function S(n) {
75
- return r(this, null, function* () {
76
- let { env: t, dmShortID: e, email: s, password: o } = n;
77
- g({ env: t, dmShortID: e, email: s, password: o });
74
+ function R(n) {
75
+ return o(this, null, function* () {
76
+ let { env: t, dmShortID: e, email: s, password: r } = n;
77
+ d({ env: t, dmShortID: e, email: s, password: r });
78
78
  const u = f(`api/${e}/_auth/login?clientID=rest`, t);
79
- return yield d(
79
+ return yield g(
80
80
  u,
81
81
  {},
82
82
  {
83
83
  method: "POST",
84
- body: JSON.stringify({ email: s, password: o }),
84
+ body: JSON.stringify({ email: s, password: r }),
85
85
  headers: {
86
86
  "Content-Type": "application/json"
87
87
  }
@@ -89,13 +89,13 @@ function S(n) {
89
89
  );
90
90
  });
91
91
  }
92
- function K(n) {
93
- return r(this, null, function* () {
92
+ function v(n) {
93
+ return o(this, null, function* () {
94
94
  let { env: t, email: e, password: s } = n;
95
- g({ env: t, email: e, password: s });
96
- const o = `${L[t]}auth/login?clientID=rest`;
97
- return yield d(
98
- o,
95
+ d({ env: t, email: e, password: s });
96
+ const r = `${S[t]}auth/login?clientID=rest`;
97
+ return yield g(
98
+ r,
99
99
  {},
100
100
  {
101
101
  method: "POST",
@@ -107,16 +107,16 @@ function K(n) {
107
107
  );
108
108
  });
109
109
  }
110
- function q(n) {
111
- return r(this, null, function* () {
110
+ function J(n) {
111
+ return o(this, null, function* () {
112
112
  let { dmShortID: t, env: e, token: s } = n;
113
- g({ dmShortID: t, env: e, token: s });
114
- const o = f(
113
+ d({ dmShortID: t, env: e, token: s });
114
+ const r = f(
115
115
  `api/${t}/_auth/logout?clientID=rest&token=${s}`,
116
116
  e
117
117
  );
118
- return yield d(
119
- o,
118
+ return yield g(
119
+ r,
120
120
  { dmShortID: t, rawRes: !0 },
121
121
  {
122
122
  method: "POST"
@@ -124,12 +124,12 @@ function q(n) {
124
124
  );
125
125
  });
126
126
  }
127
- function x(n) {
128
- return r(this, null, function* () {
127
+ function N(n) {
128
+ return o(this, null, function* () {
129
129
  let { env: t, token: e } = n;
130
- g({ env: t, token: e });
131
- const s = `${L[t]}auth/logout?clientID=rest`;
132
- return yield d(
130
+ d({ env: t, token: e });
131
+ const s = `${S[t]}auth/logout?clientID=rest`;
132
+ return yield g(
133
133
  s,
134
134
  {
135
135
  rawRes: !0,
@@ -141,41 +141,41 @@ function x(n) {
141
141
  );
142
142
  });
143
143
  }
144
- function z({ dmShortID: n }) {
145
- return g({ dmShortID: n }), n;
144
+ function M({ dmShortID: n }) {
145
+ return d({ dmShortID: n }), n;
146
146
  }
147
- function C({ env: n }) {
148
- return g({ env: n }), n;
147
+ function F({ env: n }) {
148
+ return d({ env: n }), n;
149
149
  }
150
- function R(n) {
151
- return r(this, null, function* () {
150
+ function U(n) {
151
+ return o(this, null, function* () {
152
152
  let { env: t, dmShortID: e } = n;
153
- g({ env: t, dmShortID: e });
153
+ d({ env: t, dmShortID: e });
154
154
  const s = f(`api/${e}`, t);
155
- return d(s, n);
155
+ return g(s, n);
156
156
  });
157
157
  }
158
- function v(n) {
159
- return r(this, null, function* () {
160
- let { env: t, dmShortID: e, model: s, options: o = {} } = n;
161
- g({ env: t, dmShortID: e, model: s }), o = c({ size: 50, page: 1, _list: !0 }, o);
162
- const u = A(o), i = f(`api/${e}/${s}?${u}`, t), { count: h, total: a, _embedded: l } = yield d(i, n);
163
- let p = l ? l[`${e}:${s}`] : [];
164
- return p = Array.isArray(p) ? p : [p], { count: h, total: a, items: p };
158
+ function G(n) {
159
+ return o(this, null, function* () {
160
+ let { env: t, dmShortID: e, model: s, options: r = {} } = n;
161
+ d({ env: t, dmShortID: e, model: s }), r = l({ size: 50, page: 1, _list: !0 }, r);
162
+ const u = w(r), i = f(`api/${e}/${s}?${u}`, t), { count: c, total: a, _embedded: h } = yield g(i, n);
163
+ let p = h ? h[`${e}:${s}`] : [];
164
+ return p = Array.isArray(p) ? p : [p], { count: c, total: a, items: p };
165
165
  });
166
166
  }
167
- function J({ env: n, dmShortID: t, model: e, entryID: s, token: o }) {
168
- g({ env: n, dmShortID: t, model: e, entryID: s });
169
- const u = A({ _id: s }), i = f(`api/${t}/${e}?${u}`, n);
170
- return d(i, { dmShortID: t, token: o });
167
+ function H({ env: n, dmShortID: t, model: e, entryID: s, token: r }) {
168
+ d({ env: n, dmShortID: t, model: e, entryID: s });
169
+ const u = w({ _id: s }), i = f(`api/${t}/${e}?${u}`, n);
170
+ return g(i, { dmShortID: t, token: r });
171
171
  }
172
- function N(u) {
173
- return r(this, arguments, function* ({ env: n, dmShortID: t, model: e, value: s, token: o }) {
174
- g({ env: n, dmShortID: t, model: e, value: s });
172
+ function I(u) {
173
+ return o(this, arguments, function* ({ env: n, dmShortID: t, model: e, value: s, token: r }) {
174
+ d({ env: n, dmShortID: t, model: e, value: s });
175
175
  const i = f(`api/${t}/${e}`, n);
176
- return yield d(
176
+ return yield g(
177
177
  i,
178
- { env: n, dmShortID: t, token: o },
178
+ { env: n, dmShortID: t, token: r },
179
179
  {
180
180
  method: "POST",
181
181
  body: JSON.stringify(s),
@@ -186,23 +186,23 @@ function N(u) {
186
186
  );
187
187
  });
188
188
  }
189
- function M(i) {
190
- return r(this, arguments, function* ({
189
+ function Q(i) {
190
+ return o(this, arguments, function* ({
191
191
  env: n,
192
192
  dmShortID: t,
193
193
  model: e,
194
194
  entryID: s,
195
- value: o,
195
+ value: r,
196
196
  token: u
197
197
  }) {
198
- g({ env: n, dmShortID: t, model: e, entryID: s, value: o });
199
- const h = f(`api/${t}/${e}?_id=${s}`, n);
200
- return yield d(
201
- h,
198
+ d({ env: n, dmShortID: t, model: e, entryID: s, value: r });
199
+ const c = f(`api/${t}/${e}?_id=${s}`, n);
200
+ return yield g(
201
+ c,
202
202
  { token: u },
203
203
  {
204
204
  method: "PUT",
205
- body: JSON.stringify(o),
205
+ body: JSON.stringify(r),
206
206
  headers: {
207
207
  "Content-Type": "application/json"
208
208
  }
@@ -210,13 +210,13 @@ function M(i) {
210
210
  );
211
211
  });
212
212
  }
213
- function U(u) {
214
- return r(this, arguments, function* ({ env: n, dmShortID: t, model: e, entryID: s, token: o }) {
215
- g({ env: n, dmShortID: t, model: e, entryID: s });
213
+ function V(u) {
214
+ return o(this, arguments, function* ({ env: n, dmShortID: t, model: e, entryID: s, token: r }) {
215
+ d({ env: n, dmShortID: t, model: e, entryID: s });
216
216
  const i = f(`api/${t}/${e}?_id=${s}`, n);
217
- yield d(
217
+ yield g(
218
218
  i,
219
- { token: o, rawRes: !0 },
219
+ { token: r, rawRes: !0 },
220
220
  {
221
221
  method: "DELETE",
222
222
  headers: {
@@ -226,136 +226,179 @@ function U(u) {
226
226
  );
227
227
  });
228
228
  }
229
- function F(u) {
230
- return r(this, arguments, function* ({ env: n, dmShortID: t, assetGroup: e, assetID: s, token: o }) {
231
- g({ env: n, dmShortID: t, assetGroup: e, assetID: s });
232
- const i = A({ assetID: s }), h = f(`a/${t}/${e}?${i}`, n);
233
- return (yield d(h, { dmShortID: t, token: o }))._embedded["ec:dm-asset"];
229
+ function W(s) {
230
+ return o(this, arguments, function* ({ env: n, dmShortID: t, model: e }) {
231
+ var h, p, $, P, _;
232
+ d({ env: n, dmShortID: t, model: e });
233
+ const r = f(`api/schema/${t}/${e}`, n), u = yield g(r), i = (h = u == null ? void 0 : u.allOf) == null ? void 0 : h[1];
234
+ if (typeof i.properties != "object")
235
+ throw new Error(
236
+ `getSchema: ${r} returned unexpected format: ${JSON.stringify(u)}`
237
+ );
238
+ const { properties: c } = i;
239
+ let a = [
240
+ "created",
241
+ "creator",
242
+ "id",
243
+ "modified",
244
+ "private",
245
+ "_created",
246
+ "_creator",
247
+ "_embedded",
248
+ "_entryTitle",
249
+ "_id",
250
+ "_links",
251
+ "_modelTitle",
252
+ "_modelTitleField",
253
+ "_modified"
254
+ ];
255
+ for (let A in c) {
256
+ let m = c[A];
257
+ if (m.required = i.required.includes(A), a.includes(A)) {
258
+ delete c[A];
259
+ continue;
260
+ }
261
+ if ((p = c[A]) != null && p.oneOf && (($ = c[A]) == null || delete $.oneOf), (P = m.title) != null && P.includes("<") && ((_ = m.title) != null && _.includes(">"))) {
262
+ const B = m.title.split("<")[1].slice(0, -1), q = m.title.split("<")[0];
263
+ m.type = q, m.resource = B, delete c[A].title;
264
+ }
265
+ ["asset", "entry", "assets", "entries"].includes(m.title) && (m.type = m.title, m.resource = null, delete c[A].title);
266
+ }
267
+ return c;
268
+ });
269
+ }
270
+ function X(u) {
271
+ return o(this, arguments, function* ({ env: n, dmShortID: t, assetGroup: e, assetID: s, token: r }) {
272
+ d({ env: n, dmShortID: t, assetGroup: e, assetID: s });
273
+ const i = w({ assetID: s }), c = f(`a/${t}/${e}?${i}`, n);
274
+ return (yield g(c, { dmShortID: t, token: r }))._embedded["ec:dm-asset"];
234
275
  });
235
276
  }
236
- function I(n) {
237
- return r(this, null, function* () {
238
- let { env: t, dmShortID: e, assetGroup: s, token: o, options: u = {} } = n;
239
- g({ env: t, dmShortID: e, assetGroup: s }), u = c({ size: 50, page: 1, _list: !0 }, u);
240
- const i = A(u), h = f(`a/${e}/${s}?${i}`, t), { count: a, total: l, _embedded: p } = yield d(h, { dmShortID: e, token: o });
277
+ function Y(n) {
278
+ return o(this, null, function* () {
279
+ let { env: t, dmShortID: e, assetGroup: s, token: r, options: u = {} } = n;
280
+ d({ env: t, dmShortID: e, assetGroup: s }), u = l({ size: 50, page: 1, _list: !0 }, u);
281
+ const i = w(u), c = f(`a/${e}/${s}?${i}`, t), { count: a, total: h, _embedded: p } = yield g(c, { dmShortID: e, token: r });
241
282
  let $ = p ? p["ec:dm-asset"] : [];
242
- return $ = Array.isArray($) ? $ : [$], { count: a, total: l, items: $ };
283
+ return $ = Array.isArray($) ? $ : [$], { count: a, total: h, items: $ };
243
284
  });
244
285
  }
245
- function G(h) {
246
- return r(this, arguments, function* ({
286
+ function Z(c) {
287
+ return o(this, arguments, function* ({
247
288
  env: n,
248
289
  dmShortID: t,
249
290
  assetGroup: e,
250
291
  token: s,
251
- file: o,
292
+ file: r,
252
293
  name: u,
253
294
  options: i
254
295
  }) {
255
- g({ env: n, dmShortID: t, assetGroup: e, file: o });
256
- const a = f(`a/${t}/${e}`, n), l = new FormData();
257
- return l.append("file", o, u), i && Object.keys(i).forEach(($) => {
258
- l.append($, i[$]);
259
- }), (yield d(
296
+ d({ env: n, dmShortID: t, assetGroup: e, file: r });
297
+ const a = f(`a/${t}/${e}`, n), h = new FormData();
298
+ return h.append("file", r, u), i && Object.keys(i).forEach(($) => {
299
+ h.append($, i[$]);
300
+ }), (yield g(
260
301
  a,
261
302
  { token: s },
262
303
  {
263
304
  method: "POST",
264
- body: l
305
+ body: h
265
306
  }
266
307
  ))._embedded["ec:dm-asset"];
267
308
  });
268
309
  }
269
- function H(u) {
270
- return r(this, arguments, function* ({
310
+ function tt(u) {
311
+ return o(this, arguments, function* ({
271
312
  env: n,
272
313
  dmShortID: t,
273
314
  assetGroup: e,
274
315
  assetID: s,
275
- token: o
316
+ token: r
276
317
  }) {
277
- g({ env: n, dmShortID: t, assetGroup: e, assetID: s });
318
+ d({ env: n, dmShortID: t, assetGroup: e, assetID: s });
278
319
  const i = f(`a/${t}/${e}/${s}`, n);
279
- yield d(
320
+ yield g(
280
321
  i,
281
- { token: o, rawRes: !0 },
322
+ { token: r, rawRes: !0 },
282
323
  {
283
324
  method: "DELETE"
284
325
  }
285
326
  );
286
327
  });
287
328
  }
288
- function Q(n) {
289
- return r(this, null, function* () {
329
+ function et(n) {
330
+ return o(this, null, function* () {
290
331
  let { env: t, dmID: e, token: s } = n;
291
- g({ env: t, dmID: e });
292
- const o = f(`?dataManagerID=${e}`, t);
293
- return d(o, { token: s });
332
+ d({ env: t, dmID: e });
333
+ const r = f(`?dataManagerID=${e}`, t);
334
+ return g(r, { token: s });
294
335
  });
295
336
  }
296
- function V(n) {
297
- return r(this, null, function* () {
337
+ function nt(n) {
338
+ return o(this, null, function* () {
298
339
  let { env: t, options: e = {} } = n;
299
- g({ env: t }), e = c({ size: 25, page: 1, _list: !0 }, e);
300
- const s = A(e), o = f(`?${s}`, t), { count: u, total: i, _embedded: h } = yield d(o, n);
301
- let a = h ? h["ec:datamanager"] : [];
340
+ d({ env: t }), e = l({ size: 25, page: 1, _list: !0 }, e);
341
+ const s = w(e), r = f(`?${s}`, t), { count: u, total: i, _embedded: c } = yield g(r, n);
342
+ let a = c ? c["ec:datamanager"] : [];
302
343
  return a = Array.isArray(a) ? a : [a], { count: u, total: i, items: a };
303
344
  });
304
345
  }
305
- function W(n) {
306
- return r(this, null, function* () {
346
+ function st(n) {
347
+ return o(this, null, function* () {
307
348
  let { env: t, dmID: e, options: s = {} } = n;
308
- g({ env: t, dmID: e }), s = c({ size: 25, dataManagerID: e, page: 1, _list: !0 }, s);
309
- const o = A(s), u = f(`model?${o}`, t), { count: i, total: h, _embedded: a } = yield d(u, n);
310
- let l = a ? a["ec:model"] : [];
311
- return l = Array.isArray(l) ? l : [l], { count: i, total: h, items: l };
349
+ d({ env: t, dmID: e }), s = l({ size: 25, dataManagerID: e, page: 1, _list: !0 }, s);
350
+ const r = w(s), u = f(`model?${r}`, t), { count: i, total: c, _embedded: a } = yield g(u, n);
351
+ let h = a ? a["ec:model"] : [];
352
+ return h = Array.isArray(h) ? h : [h], { count: i, total: c, items: h };
312
353
  });
313
354
  }
314
355
  const k = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
315
356
  __proto__: null,
316
- assetList: I,
317
- createAsset: G,
318
- createEntry: N,
319
- deleteAsset: H,
320
- deleteEntry: U,
321
- dmList: V,
322
- editEntry: M,
323
- entryList: v,
324
- getAsset: F,
325
- getDatamanager: Q,
326
- getEcAuthKey: C,
327
- getEntry: J,
328
- getPublicAuthKey: z,
329
- loginEc: K,
330
- loginPublic: S,
331
- logoutEc: x,
332
- logoutPublic: q,
333
- modelList: W,
334
- publicApi: R
357
+ assetList: Y,
358
+ createAsset: Z,
359
+ createEntry: I,
360
+ deleteAsset: tt,
361
+ deleteEntry: V,
362
+ dmList: nt,
363
+ editEntry: Q,
364
+ entryList: G,
365
+ getAsset: X,
366
+ getDatamanager: et,
367
+ getEcAuthKey: F,
368
+ getEntry: H,
369
+ getPublicAuthKey: M,
370
+ getSchema: W,
371
+ loginEc: v,
372
+ loginPublic: R,
373
+ logoutEc: N,
374
+ logoutPublic: J,
375
+ modelList: st,
376
+ publicApi: U
335
377
  }, Symbol.toStringTag, { value: "Module" })), {
336
- entryList: X,
337
- getEntry: Y,
338
- getAsset: Z,
339
- assetList: tt,
340
- createAsset: et,
341
- deleteAsset: nt,
342
- createEntry: st,
343
- editEntry: ot,
344
- deleteEntry: rt,
345
- loginPublic: it,
346
- loginEc: at,
347
- logoutEc: ct,
348
- logoutPublic: ut,
378
+ entryList: rt,
379
+ getEntry: it,
380
+ getAsset: ot,
381
+ assetList: at,
382
+ createAsset: ct,
383
+ deleteAsset: ut,
384
+ createEntry: lt,
385
+ editEntry: ht,
386
+ deleteEntry: dt,
387
+ getSchema: gt,
388
+ loginPublic: yt,
389
+ loginEc: ft,
390
+ logoutEc: pt,
391
+ logoutPublic: $t,
349
392
  getEcAuthKey: E,
350
- getPublicAuthKey: w,
351
- dmList: ht,
352
- modelList: lt,
353
- publicApi: gt,
354
- getDatamanager: dt
393
+ getPublicAuthKey: b,
394
+ dmList: mt,
395
+ modelList: At,
396
+ publicApi: wt,
397
+ getDatamanager: kt
355
398
  } = k;
356
- function ft(n) {
399
+ function bt(n) {
357
400
  const { action: t } = n;
358
- if (g({ action: t }), !k[t])
401
+ if (d({ action: t }), !k[t])
359
402
  throw new Error(
360
403
  `"${t}" does not exist! try one of ${Object.keys(k).join(
361
404
  ", "
@@ -363,12 +406,12 @@ function ft(n) {
363
406
  );
364
407
  return k[t](n);
365
408
  }
366
- class m {
409
+ class T {
367
410
  constructor(t) {
368
411
  this.config = t;
369
412
  }
370
413
  set(t) {
371
- return new m(c(c({}, this.config), t));
414
+ return new T(l(l({}, this.config), t));
372
415
  }
373
416
  /**
374
417
  * Loads entry list. Expects `dmShortID` / `model` to be set.
@@ -384,13 +427,13 @@ class m {
384
427
  * const secrets = await sdk("stage").token(token).dm("83cc6374").model("secret").entries()
385
428
  */
386
429
  entries() {
387
- return r(this, arguments, function* (t = {}) {
430
+ return o(this, arguments, function* (t = {}) {
388
431
  const e = yield this.getBestToken();
389
- return X(y(c({}, this.config), { options: t, token: e }));
432
+ return rt(y(l({}, this.config), { options: t, token: e }));
390
433
  });
391
434
  }
392
435
  entryList(t) {
393
- return r(this, null, function* () {
436
+ return o(this, null, function* () {
394
437
  return this.entries(t);
395
438
  });
396
439
  }
@@ -404,9 +447,22 @@ class m {
404
447
  * const muffin = await sdk("stage").dm("83cc6374").model("muffin").getEntry("1gOtzWvrdq")
405
448
  */
406
449
  getEntry(t) {
407
- return r(this, null, function* () {
450
+ return o(this, null, function* () {
408
451
  const e = yield this.getBestToken();
409
- return Y(y(c({}, this.config), { entryID: t, token: e }));
452
+ return it(y(l({}, this.config), { entryID: t, token: e }));
453
+ });
454
+ }
455
+ /**
456
+ * Loads the schema of a model. Expects `dmShortID` / `model` to be set.
457
+ *
458
+ * @param {string} entryID
459
+ * @returns {Promise<EntrySchema>}
460
+ * @example
461
+ * const muffin = await sdk("stage").dm("83cc6374").model("muffin").getSchema()
462
+ */
463
+ getSchema() {
464
+ return o(this, null, function* () {
465
+ return gt(this.config);
410
466
  });
411
467
  }
412
468
  /**
@@ -423,13 +479,13 @@ class m {
423
479
  * const files = await sdk("stage").token(token).dm("83cc6374").assetGroup("avatars").assets()
424
480
  */
425
481
  assets(t) {
426
- return r(this, null, function* () {
482
+ return o(this, null, function* () {
427
483
  const e = yield this.getBestToken();
428
- return tt(y(c({}, this.config), { options: t, token: e }));
484
+ return at(y(l({}, this.config), { options: t, token: e }));
429
485
  });
430
486
  }
431
487
  assetList(t) {
432
- return r(this, null, function* () {
488
+ return o(this, null, function* () {
433
489
  return this.assets(t);
434
490
  });
435
491
  }
@@ -455,9 +511,9 @@ class m {
455
511
  * .createAsset({ file, name: "venndiagram.png" });
456
512
  */
457
513
  createAsset() {
458
- return r(this, arguments, function* ({ file: t, name: e, options: s } = {}) {
459
- const o = yield this.getBestToken();
460
- return et(y(c({}, this.config), { file: t, name: e, options: s, token: o }));
514
+ return o(this, arguments, function* ({ file: t, name: e, options: s } = {}) {
515
+ const r = yield this.getBestToken();
516
+ return ct(y(l({}, this.config), { file: t, name: e, options: s, token: r }));
461
517
  });
462
518
  }
463
519
  /**
@@ -470,9 +526,9 @@ class m {
470
526
  * await ecadmin.assetgroup("test").deleteAsset('xxxx');
471
527
  */
472
528
  deleteAsset(t) {
473
- return r(this, null, function* () {
529
+ return o(this, null, function* () {
474
530
  const e = yield this.getBestToken();
475
- return nt(y(c({}, this.config), { token: e, assetID: t }));
531
+ return ut(y(l({}, this.config), { token: e, assetID: t }));
476
532
  });
477
533
  }
478
534
  /**
@@ -485,9 +541,9 @@ class m {
485
541
  * const asset = await sdk("stage").dm("83cc6374").assetgroup("test").getAsset("tP-ZxpZZTGmbPnET-wArAQ")
486
542
  */
487
543
  getAsset(t) {
488
- return r(this, null, function* () {
544
+ return o(this, null, function* () {
489
545
  const e = yield this.getBestToken();
490
- return Z(y(c({}, this.config), { assetID: t, token: e }));
546
+ return ot(y(l({}, this.config), { assetID: t, token: e }));
491
547
  });
492
548
  }
493
549
  /**
@@ -500,9 +556,9 @@ class m {
500
556
  * const entry = await sdk("stage").dm("83cc6374").model("muffin").createEntry({ name: 'test' })
501
557
  */
502
558
  createEntry(t) {
503
- return r(this, null, function* () {
559
+ return o(this, null, function* () {
504
560
  const e = yield this.getBestToken();
505
- return st(y(c({}, this.config), { token: e, value: t }));
561
+ return lt(y(l({}, this.config), { token: e, value: t }));
506
562
  });
507
563
  }
508
564
  /**
@@ -516,9 +572,9 @@ class m {
516
572
  * const entry = await sdk("stage").dm("83cc6374").model("muffin").editEntry("1gOtzWvrdq", { name: "test" })
517
573
  */
518
574
  editEntry(t, e) {
519
- return r(this, null, function* () {
575
+ return o(this, null, function* () {
520
576
  const s = yield this.getBestToken();
521
- return ot(y(c({}, this.config), { entryID: t, token: s, value: e }));
577
+ return ht(y(l({}, this.config), { entryID: t, token: s, value: e }));
522
578
  });
523
579
  }
524
580
  /**
@@ -531,9 +587,9 @@ class m {
531
587
  * await sdk("stage").dm("83cc6374").model("muffin").deleteEntry("1gOtzWvrdq")
532
588
  */
533
589
  deleteEntry(t) {
534
- return r(this, null, function* () {
590
+ return o(this, null, function* () {
535
591
  const e = yield this.getBestToken();
536
- return rt(y(c({}, this.config), { token: e, entryID: t }));
592
+ return dt(y(l({}, this.config), { token: e, entryID: t }));
537
593
  });
538
594
  }
539
595
  // TODO: rename authAdapter -> storageAdapter
@@ -563,29 +619,29 @@ class m {
563
619
  return e(t);
564
620
  }
565
621
  loginEc(t) {
566
- return at(c(c({}, this.config), t)).then(
622
+ return ft(l(l({}, this.config), t)).then(
567
623
  this.setAuth(E(this.config))
568
624
  );
569
625
  }
570
626
  loginPublic(t) {
571
- return it(c(c({}, this.config), t)).then(
572
- this.setAuth(w(this.config))
627
+ return yt(l(l({}, this.config), t)).then(
628
+ this.setAuth(b(this.config))
573
629
  );
574
630
  }
575
631
  logoutPublic() {
576
632
  const t = this.getPublicToken();
577
- return console.log("token", t), ut(y(c({}, this.config), { token: t })).then(
578
- this.unsetAuth(w(this.config))
633
+ return console.log("token", t), $t(y(l({}, this.config), { token: t })).then(
634
+ this.unsetAuth(b(this.config))
579
635
  );
580
636
  }
581
637
  logoutEc() {
582
638
  const t = this.getEcToken();
583
- return console.log("token", t), ct(y(c({}, this.config), { token: t })).then(
639
+ return console.log("token", t), pt(y(l({}, this.config), { token: t })).then(
584
640
  this.unsetAuth(E(this.config))
585
641
  );
586
642
  }
587
643
  getPublicToken() {
588
- return this.config.token || this.getAuth(w(this.config));
644
+ return this.config.token || this.getAuth(b(this.config));
589
645
  }
590
646
  getEcToken() {
591
647
  return this.config.token || this.getAuth(E(this.config));
@@ -667,16 +723,16 @@ class m {
667
723
  * @returns any
668
724
  */
669
725
  publicApi() {
670
- return gt(this.config);
726
+ return wt(this.config);
671
727
  }
672
728
  /**
673
729
  * Loads a DatamanagerResource by its long id. Requires token.
674
730
  * @returns any
675
731
  */
676
732
  getDatamanager(t) {
677
- return r(this, null, function* () {
733
+ return o(this, null, function* () {
678
734
  const e = yield this.getBestToken();
679
- return dt(y(c({}, this.config), { dmID: t, token: e }));
735
+ return kt(y(l({}, this.config), { dmID: t, token: e }));
680
736
  });
681
737
  }
682
738
  /**
@@ -688,9 +744,9 @@ class m {
688
744
  * const dms = await sdk("stage").dmList()
689
745
  */
690
746
  dmList() {
691
- return r(this, arguments, function* (t = {}) {
747
+ return o(this, arguments, function* (t = {}) {
692
748
  const e = yield this.getBestToken();
693
- return ht(y(c({}, this.config), { options: t, token: e }));
749
+ return mt(y(l({}, this.config), { options: t, token: e }));
694
750
  });
695
751
  }
696
752
  /**
@@ -702,38 +758,39 @@ class m {
702
758
  * const models = await sdk("stage").dmID("254a03f1-cb76-4f1e-a52a-bbd4180ca10c").modelList()
703
759
  */
704
760
  modelList() {
705
- return r(this, arguments, function* (t = {}) {
761
+ return o(this, arguments, function* (t = {}) {
706
762
  const e = yield this.getBestToken();
707
- return lt(y(c({}, this.config), { options: t, token: e }));
763
+ return At(y(l({}, this.config), { options: t, token: e }));
708
764
  });
709
765
  }
710
766
  }
711
- const pt = (n) => new m({ env: n });
767
+ const Tt = (n) => new T({ env: n });
712
768
  export {
713
- m as Sdk,
714
- ft as act,
769
+ T as Sdk,
770
+ bt as act,
715
771
  f as apiURL,
716
- I as assetList,
717
- G as createAsset,
718
- N as createEntry,
719
- H as deleteAsset,
720
- U as deleteEntry,
721
- V as dmList,
722
- M as editEntry,
723
- v as entryList,
724
- g as expect,
725
- d as fetcher,
726
- F as getAsset,
727
- Q as getDatamanager,
728
- C as getEcAuthKey,
729
- J as getEntry,
730
- z as getPublicAuthKey,
731
- K as loginEc,
732
- S as loginPublic,
733
- x as logoutEc,
734
- q as logoutPublic,
735
- W as modelList,
736
- R as publicApi,
737
- A as query,
738
- pt as sdk
772
+ Y as assetList,
773
+ Z as createAsset,
774
+ I as createEntry,
775
+ tt as deleteAsset,
776
+ V as deleteEntry,
777
+ nt as dmList,
778
+ Q as editEntry,
779
+ G as entryList,
780
+ d as expect,
781
+ g as fetcher,
782
+ X as getAsset,
783
+ et as getDatamanager,
784
+ F as getEcAuthKey,
785
+ H as getEntry,
786
+ M as getPublicAuthKey,
787
+ W as getSchema,
788
+ v as loginEc,
789
+ R as loginPublic,
790
+ N as logoutEc,
791
+ J as logoutPublic,
792
+ st as modelList,
793
+ U as publicApi,
794
+ w as query,
795
+ Tt as sdk
739
796
  };
@@ -1 +1 @@
1
- {"version":3,"file":"admin.d.mts","sourceRoot":"","sources":["../../src/lib/admin.mjs"],"names":[],"mappings":"AAEA,0DAKC;AAED;;;;GAWC;AAED;;;;GAWC"}
1
+ {"version":3,"file":"admin.d.mts","sourceRoot":"","sources":["../../src/lib/admin.mjs"],"names":[],"mappings":"AAEA,0DAMC;AAED;;;;GAYC;AAED;;;;GAWC"}
@@ -32,6 +32,15 @@ export class Sdk {
32
32
  * const muffin = await sdk("stage").dm("83cc6374").model("muffin").getEntry("1gOtzWvrdq")
33
33
  */
34
34
  getEntry(entryID: string): Promise<EntryResource>;
35
+ /**
36
+ * Loads the schema of a model. Expects `dmShortID` / `model` to be set.
37
+ *
38
+ * @param {string} entryID
39
+ * @returns {Promise<EntrySchema>}
40
+ * @example
41
+ * const muffin = await sdk("stage").dm("83cc6374").model("muffin").getSchema()
42
+ */
43
+ getSchema(): Promise<EntrySchema>;
35
44
  /**
36
45
  * Loads asset list. Expects `dmShortID` / `assetGroup` to be set.
37
46
  * If the assetGroup is not public, you also need to provide a `token`.
@@ -270,6 +279,35 @@ export type EntryResource = {
270
279
  */
271
280
  key?: any;
272
281
  };
282
+ export type EntryFieldSchema = {
283
+ /**
284
+ * - The default value or null
285
+ */
286
+ default: any;
287
+ /**
288
+ * - The field description
289
+ */
290
+ description: string;
291
+ /**
292
+ * - If true, the field cannot be changed on PUT
293
+ */
294
+ readOnly: boolean;
295
+ /**
296
+ * - If true, the field has to be set on POST
297
+ */
298
+ required: boolean;
299
+ /**
300
+ * - field type
301
+ */
302
+ type: string;
303
+ /**
304
+ * - If field type is one of entry | entries | asset | assets, this field contains the name of the expected resource or null if all are valid
305
+ */
306
+ resource: string;
307
+ };
308
+ export type EntrySchema = {
309
+ [x: string]: EntryFieldSchema;
310
+ };
273
311
  export type EntryList = {
274
312
  count: number;
275
313
  total: number;
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.mts","sourceRoot":"","sources":["../../src/lib/api.mjs"],"names":[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AAM,GAAG,IAAI;;;YAKb,GAAG;aACH,MAAM;iBACN,MAAM;YACN,gBAAgB,EAAE;gBAClB,OAAO;cACP,MAAM;WACN,GAAG,EAAE;eACL,GAAG,EAAE;aACL,MAAM,EAAE;aACR,MAAM;cACN,MAAM;cACN,GAAG,EAAE;UACL,GAAG;WACH,MAAM;gBACN,MAAM;YACN,GAAG;;;WAMH,MAAM;WACN,MAAM;WACN,aAAa,EAAE"}
@@ -33,4 +33,9 @@ export function deleteEntry({ env, dmShortID, model, entryID, token }: {
33
33
  entryID: any;
34
34
  token: any;
35
35
  }): Promise<void>;
36
+ export function getSchema({ env, dmShortID, model }: {
37
+ env: any;
38
+ dmShortID: any;
39
+ model: any;
40
+ }): Promise<any>;
36
41
  //# sourceMappingURL=entries.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entries.d.mts","sourceRoot":"","sources":["../../src/lib/entries.mjs"],"names":[],"mappings":"AAEA,qDAMC;AAED;;;;GAYC;AAED;;;;;;iBAKC;AAED;;;;;;iBAeC;AAED;;;;;;;iBAuBC;AAED;;;;;;kBAcC"}
1
+ {"version":3,"file":"entries.d.mts","sourceRoot":"","sources":["../../src/lib/entries.mjs"],"names":[],"mappings":"AAEA,qDAMC;AAED;;;;GAYC;AAED;;;;;;iBAKC;AAED;;;;;;iBAeC;AAED;;;;;;;iBAuBC;AAED;;;;;;kBAcC;AAED;;;;iBAsDC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ec.fdk",
3
- "version": "0.2.25",
3
+ "version": "0.2.26",
4
4
  "description": "ec frontend sdk",
5
5
  "main": "dist/index.cjs",
6
6
  "directories": {