ec.fdk 0.2.25 → 0.2.27

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 a=c=>{try{u(e.next(c))}catch(h){r(h)}},i=c=>{try{u(e.throw(c))}catch(h){r(h)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(a,i);u((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 u;const{token:r,rawRes:a}=t;r&&(e.headers=f(l({},e.headers||{}),{Authorization:`Bearer ${r}`}));const i=yield fetch(n,e);if(!i.ok){if((u=i.headers.get("content-type"))!=null&&u.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 a?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 a=y(`api/${e}/_auth/login?clientID=rest`,t);return yield g(a,{},{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 a=k(r),i=y(`api/${e}/${s}?${a}`,t),{count:u,total:c,_embedded:h}=yield g(i,n);let $=h?h[`${e}:${s}`]:[];return $=Array.isArray($)?$:[$],{count:u,total:c,items:$}})}function C({env:n,dmShortID:t,model:e,entryID:s,token:r}){d({env:n,dmShortID:t,model:e,entryID:s});const a=k({_id:s}),i=y(`api/${t}/${e}?${a}`,n);return g(i,{dmShortID:t,token:r})}function J(a){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:a}){d({env:n,dmShortID:t,model:e,entryID:s,value:r});const u=y(`api/${t}/${e}?_id=${s}`,n);return yield g(u,{token:a},{method:"PUT",body:JSON.stringify(r),headers:{"Content-Type":"application/json"}})})}function M(a){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,$,m,P,_;d({env:n,dmShortID:t,model:e});const r=y(`api/schema/${t}/${e}`,n),a=yield g(r),i=(h=a==null?void 0:a.allOf)==null?void 0:h[1];if(typeof i.properties!="object")throw new Error(`getSchema: ${r} returned unexpected format: ${JSON.stringify(a)}`);const{properties:u}=i;let c=["created","creator","id","modified","private","_created","_creator","_embedded","_entryTitle","_id","_links","_modelTitle","_modelTitleField","_modified"];for(let A in u){let p=u[A];if(p.required=i.required.includes(A),c.includes(A)){delete u[A];continue}if(($=u[A])!=null&&$.oneOf&&((m=u[A])==null||delete m.oneOf),(P=p.title)!=null&&P.includes("<")&&((_=p.title)!=null&&_.includes(">"))){const X=p.title.split("<")[1].slice(0,-1),Y=p.title.split("<")[0];p.type=Y,p.resource=X}else["asset","entry","assets","entries"].includes(p.title)?(p.type=p.title,p.resource=null):p.type=p.title;delete u[A].title}return u})}function F(a){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}),u=y(`a/${t}/${e}?${i}`,n);return(yield g(u,{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:a={}}=n;d({env:t,dmShortID:e,assetGroup:s}),a=l({size:50,page:1,_list:!0},a);const i=k(a),u=y(`a/${e}/${s}?${i}`,t),{count:c,total:h,_embedded:$}=yield g(u,{dmShortID:e,token:r});let m=$?$["ec:dm-asset"]:[];return m=Array.isArray(m)?m:[m],{count:c,total:h,items:m}})}function H(u){return o(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,token:s,file:r,name:a,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,a),i&&Object.keys(i).forEach(m=>{h.append(m,i[m])}),(yield g(c,{token:s},{method:"POST",body:h}))._embedded["ec:dm-asset"]})}function I(a){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:a,total:i,_embedded:u}=yield g(r,n);let c=u?u["ec:datamanager"]:[];return c=Array.isArray(c)?c:[c],{count:a,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),a=y(`model?${r}`,t),{count:i,total:u,_embedded:c}=yield g(a,n);let h=c?c["ec:model"]:[];return h=Array.isArray(h)?h:[h],{count:i,total:u,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) => {
14
- var u = (a) => {
12
+ }, y = (n, t) => K(n, x(t));
13
+ var o = (n, t, e) => new Promise((s, r) => {
14
+ var c = (a) => {
15
15
  try {
16
- h(e.next(a));
17
- } catch (l) {
18
- o(l);
16
+ u(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
+ u(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
+ }, u = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(c, i);
27
+ u((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 u;
32
+ const { token: r, rawRes: c } = 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 ((u = i.headers.get("content-type")) != null && u.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
- return u ? i : yield i.json();
46
+ return c ? 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 });
78
- const u = f(`api/${e}/_auth/login?clientID=rest`, t);
79
- return yield d(
80
- u,
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
+ const c = f(`api/${e}/_auth/login?clientID=rest`, t);
79
+ return yield g(
80
+ c,
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 c = w(r), i = f(`api/${e}/${s}?${c}`, t), { count: u, total: a, _embedded: h } = yield g(i, n);
163
+ let $ = h ? h[`${e}:${s}`] : [];
164
+ return $ = Array.isArray($) ? $ : [$], { count: u, total: a, items: $ };
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 c = w({ _id: s }), i = f(`api/${t}/${e}?${c}`, 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(c) {
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,
196
- token: u
195
+ value: r,
196
+ token: c
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,
202
- { token: u },
198
+ d({ env: n, dmShortID: t, model: e, entryID: s, value: r });
199
+ const u = f(`api/${t}/${e}?_id=${s}`, n);
200
+ return yield g(
201
+ u,
202
+ { token: c },
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(c) {
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,180 @@ 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, $, m, P, _;
232
+ d({ env: n, dmShortID: t, model: e });
233
+ const r = f(`api/schema/${t}/${e}`, n), c = yield g(r), i = (h = c == null ? void 0 : c.allOf) == null ? void 0 : h[1];
234
+ if (typeof i.properties != "object")
235
+ throw new Error(
236
+ `getSchema: ${r} returned unexpected format: ${JSON.stringify(c)}`
237
+ );
238
+ const { properties: u } = 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 u) {
256
+ let p = u[A];
257
+ if (p.required = i.required.includes(A), a.includes(A)) {
258
+ delete u[A];
259
+ continue;
260
+ }
261
+ if (($ = u[A]) != null && $.oneOf && ((m = u[A]) == null || delete m.oneOf), (P = p.title) != null && P.includes("<") && ((_ = p.title) != null && _.includes(">"))) {
262
+ const B = p.title.split("<")[1].slice(0, -1), q = p.title.split("<")[0];
263
+ p.type = q, p.resource = B;
264
+ } else
265
+ ["asset", "entry", "assets", "entries"].includes(p.title) ? (p.type = p.title, p.resource = null) : p.type = p.title;
266
+ delete u[A].title;
267
+ }
268
+ return u;
234
269
  });
235
270
  }
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 });
241
- let $ = p ? p["ec:dm-asset"] : [];
242
- return $ = Array.isArray($) ? $ : [$], { count: a, total: l, items: $ };
271
+ function X(c) {
272
+ return o(this, arguments, function* ({ env: n, dmShortID: t, assetGroup: e, assetID: s, token: r }) {
273
+ d({ env: n, dmShortID: t, assetGroup: e, assetID: s });
274
+ const i = w({ assetID: s }), u = f(`a/${t}/${e}?${i}`, n);
275
+ return (yield g(u, { dmShortID: t, token: r }))._embedded["ec:dm-asset"];
243
276
  });
244
277
  }
245
- function G(h) {
246
- return r(this, arguments, function* ({
278
+ function Y(n) {
279
+ return o(this, null, function* () {
280
+ let { env: t, dmShortID: e, assetGroup: s, token: r, options: c = {} } = n;
281
+ d({ env: t, dmShortID: e, assetGroup: s }), c = l({ size: 50, page: 1, _list: !0 }, c);
282
+ const i = w(c), u = f(`a/${e}/${s}?${i}`, t), { count: a, total: h, _embedded: $ } = yield g(u, { dmShortID: e, token: r });
283
+ let m = $ ? $["ec:dm-asset"] : [];
284
+ return m = Array.isArray(m) ? m : [m], { count: a, total: h, items: m };
285
+ });
286
+ }
287
+ function Z(u) {
288
+ return o(this, arguments, function* ({
247
289
  env: n,
248
290
  dmShortID: t,
249
291
  assetGroup: e,
250
292
  token: s,
251
- file: o,
252
- name: u,
293
+ file: r,
294
+ name: c,
253
295
  options: i
254
296
  }) {
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(
297
+ d({ env: n, dmShortID: t, assetGroup: e, file: r });
298
+ const a = f(`a/${t}/${e}`, n), h = new FormData();
299
+ return h.append("file", r, c), i && Object.keys(i).forEach((m) => {
300
+ h.append(m, i[m]);
301
+ }), (yield g(
260
302
  a,
261
303
  { token: s },
262
304
  {
263
305
  method: "POST",
264
- body: l
306
+ body: h
265
307
  }
266
308
  ))._embedded["ec:dm-asset"];
267
309
  });
268
310
  }
269
- function H(u) {
270
- return r(this, arguments, function* ({
311
+ function tt(c) {
312
+ return o(this, arguments, function* ({
271
313
  env: n,
272
314
  dmShortID: t,
273
315
  assetGroup: e,
274
316
  assetID: s,
275
- token: o
317
+ token: r
276
318
  }) {
277
- g({ env: n, dmShortID: t, assetGroup: e, assetID: s });
319
+ d({ env: n, dmShortID: t, assetGroup: e, assetID: s });
278
320
  const i = f(`a/${t}/${e}/${s}`, n);
279
- yield d(
321
+ yield g(
280
322
  i,
281
- { token: o, rawRes: !0 },
323
+ { token: r, rawRes: !0 },
282
324
  {
283
325
  method: "DELETE"
284
326
  }
285
327
  );
286
328
  });
287
329
  }
288
- function Q(n) {
289
- return r(this, null, function* () {
330
+ function et(n) {
331
+ return o(this, null, function* () {
290
332
  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 });
333
+ d({ env: t, dmID: e });
334
+ const r = f(`?dataManagerID=${e}`, t);
335
+ return g(r, { token: s });
294
336
  });
295
337
  }
296
- function V(n) {
297
- return r(this, null, function* () {
338
+ function nt(n) {
339
+ return o(this, null, function* () {
298
340
  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"] : [];
302
- return a = Array.isArray(a) ? a : [a], { count: u, total: i, items: a };
341
+ d({ env: t }), e = l({ size: 25, page: 1, _list: !0 }, e);
342
+ const s = w(e), r = f(`?${s}`, t), { count: c, total: i, _embedded: u } = yield g(r, n);
343
+ let a = u ? u["ec:datamanager"] : [];
344
+ return a = Array.isArray(a) ? a : [a], { count: c, total: i, items: a };
303
345
  });
304
346
  }
305
- function W(n) {
306
- return r(this, null, function* () {
347
+ function st(n) {
348
+ return o(this, null, function* () {
307
349
  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 };
350
+ d({ env: t, dmID: e }), s = l({ size: 25, dataManagerID: e, page: 1, _list: !0 }, s);
351
+ const r = w(s), c = f(`model?${r}`, t), { count: i, total: u, _embedded: a } = yield g(c, n);
352
+ let h = a ? a["ec:model"] : [];
353
+ return h = Array.isArray(h) ? h : [h], { count: i, total: u, items: h };
312
354
  });
313
355
  }
314
356
  const k = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
315
357
  __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
358
+ assetList: Y,
359
+ createAsset: Z,
360
+ createEntry: I,
361
+ deleteAsset: tt,
362
+ deleteEntry: V,
363
+ dmList: nt,
364
+ editEntry: Q,
365
+ entryList: G,
366
+ getAsset: X,
367
+ getDatamanager: et,
368
+ getEcAuthKey: F,
369
+ getEntry: H,
370
+ getPublicAuthKey: M,
371
+ getSchema: W,
372
+ loginEc: v,
373
+ loginPublic: R,
374
+ logoutEc: N,
375
+ logoutPublic: J,
376
+ modelList: st,
377
+ publicApi: U
335
378
  }, 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,
379
+ entryList: rt,
380
+ getEntry: it,
381
+ getAsset: ot,
382
+ assetList: at,
383
+ createAsset: ct,
384
+ deleteAsset: ut,
385
+ createEntry: lt,
386
+ editEntry: ht,
387
+ deleteEntry: dt,
388
+ getSchema: gt,
389
+ loginPublic: yt,
390
+ loginEc: ft,
391
+ logoutEc: pt,
392
+ logoutPublic: $t,
349
393
  getEcAuthKey: E,
350
- getPublicAuthKey: w,
351
- dmList: ht,
352
- modelList: lt,
353
- publicApi: gt,
354
- getDatamanager: dt
394
+ getPublicAuthKey: b,
395
+ dmList: mt,
396
+ modelList: At,
397
+ publicApi: wt,
398
+ getDatamanager: kt
355
399
  } = k;
356
- function ft(n) {
400
+ function bt(n) {
357
401
  const { action: t } = n;
358
- if (g({ action: t }), !k[t])
402
+ if (d({ action: t }), !k[t])
359
403
  throw new Error(
360
404
  `"${t}" does not exist! try one of ${Object.keys(k).join(
361
405
  ", "
@@ -363,12 +407,12 @@ function ft(n) {
363
407
  );
364
408
  return k[t](n);
365
409
  }
366
- class m {
410
+ class T {
367
411
  constructor(t) {
368
412
  this.config = t;
369
413
  }
370
414
  set(t) {
371
- return new m(c(c({}, this.config), t));
415
+ return new T(l(l({}, this.config), t));
372
416
  }
373
417
  /**
374
418
  * Loads entry list. Expects `dmShortID` / `model` to be set.
@@ -384,13 +428,13 @@ class m {
384
428
  * const secrets = await sdk("stage").token(token).dm("83cc6374").model("secret").entries()
385
429
  */
386
430
  entries() {
387
- return r(this, arguments, function* (t = {}) {
431
+ return o(this, arguments, function* (t = {}) {
388
432
  const e = yield this.getBestToken();
389
- return X(y(c({}, this.config), { options: t, token: e }));
433
+ return rt(y(l({}, this.config), { options: t, token: e }));
390
434
  });
391
435
  }
392
436
  entryList(t) {
393
- return r(this, null, function* () {
437
+ return o(this, null, function* () {
394
438
  return this.entries(t);
395
439
  });
396
440
  }
@@ -404,9 +448,22 @@ class m {
404
448
  * const muffin = await sdk("stage").dm("83cc6374").model("muffin").getEntry("1gOtzWvrdq")
405
449
  */
406
450
  getEntry(t) {
407
- return r(this, null, function* () {
451
+ return o(this, null, function* () {
408
452
  const e = yield this.getBestToken();
409
- return Y(y(c({}, this.config), { entryID: t, token: e }));
453
+ return it(y(l({}, this.config), { entryID: t, token: e }));
454
+ });
455
+ }
456
+ /**
457
+ * Loads the schema of a model. Expects `dmShortID` / `model` to be set.
458
+ *
459
+ * @param {string} entryID
460
+ * @returns {Promise<EntrySchema>}
461
+ * @example
462
+ * const muffin = await sdk("stage").dm("83cc6374").model("muffin").getSchema()
463
+ */
464
+ getSchema() {
465
+ return o(this, null, function* () {
466
+ return gt(this.config);
410
467
  });
411
468
  }
412
469
  /**
@@ -423,13 +480,13 @@ class m {
423
480
  * const files = await sdk("stage").token(token).dm("83cc6374").assetGroup("avatars").assets()
424
481
  */
425
482
  assets(t) {
426
- return r(this, null, function* () {
483
+ return o(this, null, function* () {
427
484
  const e = yield this.getBestToken();
428
- return tt(y(c({}, this.config), { options: t, token: e }));
485
+ return at(y(l({}, this.config), { options: t, token: e }));
429
486
  });
430
487
  }
431
488
  assetList(t) {
432
- return r(this, null, function* () {
489
+ return o(this, null, function* () {
433
490
  return this.assets(t);
434
491
  });
435
492
  }
@@ -455,9 +512,9 @@ class m {
455
512
  * .createAsset({ file, name: "venndiagram.png" });
456
513
  */
457
514
  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 }));
515
+ return o(this, arguments, function* ({ file: t, name: e, options: s } = {}) {
516
+ const r = yield this.getBestToken();
517
+ return ct(y(l({}, this.config), { file: t, name: e, options: s, token: r }));
461
518
  });
462
519
  }
463
520
  /**
@@ -470,9 +527,9 @@ class m {
470
527
  * await ecadmin.assetgroup("test").deleteAsset('xxxx');
471
528
  */
472
529
  deleteAsset(t) {
473
- return r(this, null, function* () {
530
+ return o(this, null, function* () {
474
531
  const e = yield this.getBestToken();
475
- return nt(y(c({}, this.config), { token: e, assetID: t }));
532
+ return ut(y(l({}, this.config), { token: e, assetID: t }));
476
533
  });
477
534
  }
478
535
  /**
@@ -485,9 +542,9 @@ class m {
485
542
  * const asset = await sdk("stage").dm("83cc6374").assetgroup("test").getAsset("tP-ZxpZZTGmbPnET-wArAQ")
486
543
  */
487
544
  getAsset(t) {
488
- return r(this, null, function* () {
545
+ return o(this, null, function* () {
489
546
  const e = yield this.getBestToken();
490
- return Z(y(c({}, this.config), { assetID: t, token: e }));
547
+ return ot(y(l({}, this.config), { assetID: t, token: e }));
491
548
  });
492
549
  }
493
550
  /**
@@ -500,9 +557,9 @@ class m {
500
557
  * const entry = await sdk("stage").dm("83cc6374").model("muffin").createEntry({ name: 'test' })
501
558
  */
502
559
  createEntry(t) {
503
- return r(this, null, function* () {
560
+ return o(this, null, function* () {
504
561
  const e = yield this.getBestToken();
505
- return st(y(c({}, this.config), { token: e, value: t }));
562
+ return lt(y(l({}, this.config), { token: e, value: t }));
506
563
  });
507
564
  }
508
565
  /**
@@ -516,9 +573,9 @@ class m {
516
573
  * const entry = await sdk("stage").dm("83cc6374").model("muffin").editEntry("1gOtzWvrdq", { name: "test" })
517
574
  */
518
575
  editEntry(t, e) {
519
- return r(this, null, function* () {
576
+ return o(this, null, function* () {
520
577
  const s = yield this.getBestToken();
521
- return ot(y(c({}, this.config), { entryID: t, token: s, value: e }));
578
+ return ht(y(l({}, this.config), { entryID: t, token: s, value: e }));
522
579
  });
523
580
  }
524
581
  /**
@@ -531,9 +588,9 @@ class m {
531
588
  * await sdk("stage").dm("83cc6374").model("muffin").deleteEntry("1gOtzWvrdq")
532
589
  */
533
590
  deleteEntry(t) {
534
- return r(this, null, function* () {
591
+ return o(this, null, function* () {
535
592
  const e = yield this.getBestToken();
536
- return rt(y(c({}, this.config), { token: e, entryID: t }));
593
+ return dt(y(l({}, this.config), { token: e, entryID: t }));
537
594
  });
538
595
  }
539
596
  // TODO: rename authAdapter -> storageAdapter
@@ -563,29 +620,29 @@ class m {
563
620
  return e(t);
564
621
  }
565
622
  loginEc(t) {
566
- return at(c(c({}, this.config), t)).then(
623
+ return ft(l(l({}, this.config), t)).then(
567
624
  this.setAuth(E(this.config))
568
625
  );
569
626
  }
570
627
  loginPublic(t) {
571
- return it(c(c({}, this.config), t)).then(
572
- this.setAuth(w(this.config))
628
+ return yt(l(l({}, this.config), t)).then(
629
+ this.setAuth(b(this.config))
573
630
  );
574
631
  }
575
632
  logoutPublic() {
576
633
  const t = this.getPublicToken();
577
- return console.log("token", t), ut(y(c({}, this.config), { token: t })).then(
578
- this.unsetAuth(w(this.config))
634
+ return console.log("token", t), $t(y(l({}, this.config), { token: t })).then(
635
+ this.unsetAuth(b(this.config))
579
636
  );
580
637
  }
581
638
  logoutEc() {
582
639
  const t = this.getEcToken();
583
- return console.log("token", t), ct(y(c({}, this.config), { token: t })).then(
640
+ return console.log("token", t), pt(y(l({}, this.config), { token: t })).then(
584
641
  this.unsetAuth(E(this.config))
585
642
  );
586
643
  }
587
644
  getPublicToken() {
588
- return this.config.token || this.getAuth(w(this.config));
645
+ return this.config.token || this.getAuth(b(this.config));
589
646
  }
590
647
  getEcToken() {
591
648
  return this.config.token || this.getAuth(E(this.config));
@@ -667,16 +724,16 @@ class m {
667
724
  * @returns any
668
725
  */
669
726
  publicApi() {
670
- return gt(this.config);
727
+ return wt(this.config);
671
728
  }
672
729
  /**
673
730
  * Loads a DatamanagerResource by its long id. Requires token.
674
731
  * @returns any
675
732
  */
676
733
  getDatamanager(t) {
677
- return r(this, null, function* () {
734
+ return o(this, null, function* () {
678
735
  const e = yield this.getBestToken();
679
- return dt(y(c({}, this.config), { dmID: t, token: e }));
736
+ return kt(y(l({}, this.config), { dmID: t, token: e }));
680
737
  });
681
738
  }
682
739
  /**
@@ -688,9 +745,9 @@ class m {
688
745
  * const dms = await sdk("stage").dmList()
689
746
  */
690
747
  dmList() {
691
- return r(this, arguments, function* (t = {}) {
748
+ return o(this, arguments, function* (t = {}) {
692
749
  const e = yield this.getBestToken();
693
- return ht(y(c({}, this.config), { options: t, token: e }));
750
+ return mt(y(l({}, this.config), { options: t, token: e }));
694
751
  });
695
752
  }
696
753
  /**
@@ -702,38 +759,39 @@ class m {
702
759
  * const models = await sdk("stage").dmID("254a03f1-cb76-4f1e-a52a-bbd4180ca10c").modelList()
703
760
  */
704
761
  modelList() {
705
- return r(this, arguments, function* (t = {}) {
762
+ return o(this, arguments, function* (t = {}) {
706
763
  const e = yield this.getBestToken();
707
- return lt(y(c({}, this.config), { options: t, token: e }));
764
+ return At(y(l({}, this.config), { options: t, token: e }));
708
765
  });
709
766
  }
710
767
  }
711
- const pt = (n) => new m({ env: n });
768
+ const Tt = (n) => new T({ env: n });
712
769
  export {
713
- m as Sdk,
714
- ft as act,
770
+ T as Sdk,
771
+ bt as act,
715
772
  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
773
+ Y as assetList,
774
+ Z as createAsset,
775
+ I as createEntry,
776
+ tt as deleteAsset,
777
+ V as deleteEntry,
778
+ nt as dmList,
779
+ Q as editEntry,
780
+ G as entryList,
781
+ d as expect,
782
+ g as fetcher,
783
+ X as getAsset,
784
+ et as getDatamanager,
785
+ F as getEcAuthKey,
786
+ H as getEntry,
787
+ M as getPublicAuthKey,
788
+ W as getSchema,
789
+ v as loginEc,
790
+ R as loginPublic,
791
+ N as logoutEc,
792
+ J as logoutPublic,
793
+ st as modelList,
794
+ U as publicApi,
795
+ w as query,
796
+ Tt as sdk
739
797
  };
@@ -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":[],"mappings":"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"}
1
+ {"version":3,"file":"api.d.mts","sourceRoot":"","sources":["../../src/lib/api.mjs"],"names":[],"mappings":"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"}
@@ -33,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.27",
4
4
  "description": "ec frontend sdk",
5
5
  "main": "dist/index.cjs",
6
6
  "directories": {