ec.fdk 0.2.26 → 0.2.28

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 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}
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
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;
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
@@ -11,31 +11,31 @@ var O = (n, t, e) => t in n ? D(n, t, { enumerable: !0, configurable: !0, writab
11
11
  return n;
12
12
  }, y = (n, t) => K(n, x(t));
13
13
  var o = (n, t, e) => new Promise((s, r) => {
14
- var u = (a) => {
14
+ var c = (a) => {
15
15
  try {
16
- c(e.next(a));
16
+ u(e.next(a));
17
17
  } catch (h) {
18
18
  r(h);
19
19
  }
20
20
  }, i = (a) => {
21
21
  try {
22
- c(e.throw(a));
22
+ u(e.throw(a));
23
23
  } catch (h) {
24
24
  r(h);
25
25
  }
26
- }, c = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(u, i);
27
- c((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
29
  function g(s) {
30
30
  return o(this, arguments, function* (n, t = {}, e = {}) {
31
- var c;
32
- const { token: r, rawRes: u } = t;
31
+ var u;
32
+ const { token: r, rawRes: c } = t;
33
33
  r && (e.headers = y(l({}, e.headers || {}), {
34
34
  Authorization: `Bearer ${r}`
35
35
  }));
36
36
  const i = yield fetch(n, e);
37
37
  if (!i.ok) {
38
- if ((c = i.headers.get("content-type")) != null && c.includes("application/json")) {
38
+ if ((u = i.headers.get("content-type")) != null && u.includes("application/json")) {
39
39
  const a = yield i.json(), h = `${a.title}
40
40
  ${a.detail}
41
41
  ${a.verbose}`;
@@ -43,7 +43,7 @@ ${a.verbose}`;
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
49
  const j = {
@@ -75,9 +75,9 @@ function R(n) {
75
75
  return o(this, null, function* () {
76
76
  let { env: t, dmShortID: e, email: s, password: r } = n;
77
77
  d({ env: t, dmShortID: e, email: s, password: r });
78
- const u = f(`api/${e}/_auth/login?clientID=rest`, t);
78
+ const c = f(`api/${e}/_auth/login?clientID=rest`, t);
79
79
  return yield g(
80
- u,
80
+ c,
81
81
  {},
82
82
  {
83
83
  method: "POST",
@@ -159,17 +159,17 @@ function G(n) {
159
159
  return o(this, null, function* () {
160
160
  let { env: t, dmShortID: e, model: s, options: r = {} } = n;
161
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 };
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
167
  function H({ env: n, dmShortID: t, model: e, entryID: s, token: r }) {
168
168
  d({ env: n, dmShortID: t, model: e, entryID: s });
169
- const u = w({ _id: s }), i = f(`api/${t}/${e}?${u}`, n);
169
+ const c = w({ _id: s }), i = f(`api/${t}/${e}?${c}`, n);
170
170
  return g(i, { dmShortID: t, token: r });
171
171
  }
172
- function I(u) {
172
+ function I(c) {
173
173
  return o(this, arguments, function* ({ env: n, dmShortID: t, model: e, value: s, token: r }) {
174
174
  d({ env: n, dmShortID: t, model: e, value: s });
175
175
  const i = f(`api/${t}/${e}`, n);
@@ -193,13 +193,13 @@ function Q(i) {
193
193
  model: e,
194
194
  entryID: s,
195
195
  value: r,
196
- token: u
196
+ token: c
197
197
  }) {
198
198
  d({ env: n, dmShortID: t, model: e, entryID: s, value: r });
199
- const c = f(`api/${t}/${e}?_id=${s}`, n);
199
+ const u = f(`api/${t}/${e}?_id=${s}`, n);
200
200
  return yield g(
201
- c,
202
- { token: u },
201
+ u,
202
+ { token: c },
203
203
  {
204
204
  method: "PUT",
205
205
  body: JSON.stringify(r),
@@ -210,7 +210,7 @@ function Q(i) {
210
210
  );
211
211
  });
212
212
  }
213
- function V(u) {
213
+ function V(c) {
214
214
  return o(this, arguments, function* ({ env: n, dmShortID: t, model: e, entryID: s, token: r }) {
215
215
  d({ env: n, dmShortID: t, model: e, entryID: s });
216
216
  const i = f(`api/${t}/${e}?_id=${s}`, n);
@@ -228,14 +228,14 @@ function V(u) {
228
228
  }
229
229
  function W(s) {
230
230
  return o(this, arguments, function* ({ env: n, dmShortID: t, model: e }) {
231
- var h, p, $, P, _;
231
+ var h, $, m, P, _;
232
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];
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
234
  if (typeof i.properties != "object")
235
235
  throw new Error(
236
- `getSchema: ${r} returned unexpected format: ${JSON.stringify(u)}`
236
+ `getSchema: ${r} returned unexpected format: ${JSON.stringify(c)}`
237
237
  );
238
- const { properties: c } = i;
238
+ const { properties: u } = i;
239
239
  let a = [
240
240
  "created",
241
241
  "creator",
@@ -252,51 +252,52 @@ function W(s) {
252
252
  "_modelTitleField",
253
253
  "_modified"
254
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];
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
259
  continue;
260
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);
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;
266
267
  }
267
- return c;
268
+ return u;
268
269
  });
269
270
  }
270
- function X(u) {
271
+ function X(c) {
271
272
  return o(this, arguments, function* ({ env: n, dmShortID: t, assetGroup: e, assetID: s, token: r }) {
272
273
  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"];
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"];
275
276
  });
276
277
  }
277
278
  function Y(n) {
278
279
  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 });
282
- let $ = p ? p["ec:dm-asset"] : [];
283
- return $ = Array.isArray($) ? $ : [$], { count: a, total: h, items: $ };
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 };
284
285
  });
285
286
  }
286
- function Z(c) {
287
+ function Z(u) {
287
288
  return o(this, arguments, function* ({
288
289
  env: n,
289
290
  dmShortID: t,
290
291
  assetGroup: e,
291
292
  token: s,
292
293
  file: r,
293
- name: u,
294
+ name: c,
294
295
  options: i
295
296
  }) {
296
297
  d({ env: n, dmShortID: t, assetGroup: e, file: r });
297
298
  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[$]);
299
+ return h.append("file", r, c), i && Object.keys(i).forEach((m) => {
300
+ h.append(m, i[m]);
300
301
  }), (yield g(
301
302
  a,
302
303
  { token: s },
@@ -307,7 +308,7 @@ function Z(c) {
307
308
  ))._embedded["ec:dm-asset"];
308
309
  });
309
310
  }
310
- function tt(u) {
311
+ function tt(c) {
311
312
  return o(this, arguments, function* ({
312
313
  env: n,
313
314
  dmShortID: t,
@@ -338,18 +339,18 @@ function nt(n) {
338
339
  return o(this, null, function* () {
339
340
  let { env: t, options: e = {} } = n;
340
341
  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"] : [];
343
- return a = Array.isArray(a) ? a : [a], { count: u, total: i, items: a };
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 };
344
345
  });
345
346
  }
346
347
  function st(n) {
347
348
  return o(this, null, function* () {
348
349
  let { env: t, dmID: e, options: s = {} } = n;
349
350
  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
+ const r = w(s), c = f(`model?${r}`, t), { count: i, total: u, _embedded: a } = yield g(c, n);
351
352
  let h = a ? a["ec:model"] : [];
352
- return h = Array.isArray(h) ? h : [h], { count: i, total: c, items: h };
353
+ return h = Array.isArray(h) ? h : [h], { count: i, total: u, items: h };
353
354
  });
354
355
  }
355
356
  const k = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -442,7 +443,7 @@ class T {
442
443
  * If the model is not public, you also need to provide a `token`.
443
444
  *
444
445
  * @param {string} entryID
445
- * @returns {Promise<EntryResource>}
446
+ * @returns {Promise<EntryResource & Record<string, any>>}
446
447
  * @example
447
448
  * const muffin = await sdk("stage").dm("83cc6374").model("muffin").getEntry("1gOtzWvrdq")
448
449
  */
@@ -27,11 +27,11 @@ export class Sdk {
27
27
  * If the model is not public, you also need to provide a `token`.
28
28
  *
29
29
  * @param {string} entryID
30
- * @returns {Promise<EntryResource>}
30
+ * @returns {Promise<EntryResource & Record<string, any>>}
31
31
  * @example
32
32
  * const muffin = await sdk("stage").dm("83cc6374").model("muffin").getEntry("1gOtzWvrdq")
33
33
  */
34
- getEntry(entryID: string): Promise<EntryResource>;
34
+ getEntry(entryID: string): Promise<EntryResource & Record<string, any>>;
35
35
  /**
36
36
  * Loads the schema of a model. Expects `dmShortID` / `model` to be set.
37
37
  *
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.mts","sourceRoot":"","sources":["../../src/lib/api.mjs"],"names":[],"mappings":"AA8BA,sCAWC;;AAED;;GAEG;AACH;IACE,yBAEC;IADC,YAAoB;IAGtB,mBAGC;IAED;;;;;;;;;;;;OAYG;IACH,kBAT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AAG;iBACH,MAAM;iBACN,OAAO;aACP,OAAO;cACP,OAAO;cACP,OAAO;YACP,OAAO;WACP,MAAM;UACN,MAAM;gBACN,MAAM,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ec.fdk",
3
- "version": "0.2.26",
3
+ "version": "0.2.28",
4
4
  "description": "ec frontend sdk",
5
5
  "main": "dist/index.cjs",
6
6
  "directories": {