ec.fdk 0.2.29 → 0.2.30
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 +2 -2
- package/dist/index.mjs +53 -53
- package/dist/lib/entries.d.mts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var tt=Object.defineProperty,et=Object.defineProperties;var nt=Object.getOwnPropertyDescriptors;var
|
|
1
|
+
"use strict";var tt=Object.defineProperty,et=Object.defineProperties;var nt=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var st=Object.prototype.hasOwnProperty,rt=Object.prototype.propertyIsEnumerable;var S=(n,t,e)=>t in n?tt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,u=(n,t)=>{for(var e in t||(t={}))st.call(t,e)&&S(n,e,t[e]);if(L)for(var e of L(t))rt.call(t,e)&&S(n,e,t[e]);return n},f=(n,t)=>et(n,nt(t));var c=(n,t,e)=>new Promise((s,r)=>{var a=o=>{try{h(e.next(o))}catch(l){r(l)}},i=o=>{try{h(e.throw(o))}catch(l){r(l)}},h=o=>o.done?s(o.value):Promise.resolve(o.value).then(a,i);h((e=e.apply(n,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function g(s){return c(this,arguments,function*(n,t={},e={}){var h;const{token:r,rawRes:a}=t;r&&(e.headers=f(u({},e.headers||{}),{Authorization:`Bearer ${r}`}));const i=yield fetch(n,e);if(!i.ok){if((h=i.headers.get("content-type"))!=null&&h.includes("application/json")){const o=yield i.json(),l=`${o.title}
|
|
2
2
|
${o.detail}
|
|
3
|
-
${o.verbose}`;throw new Error(l)}throw new Error(`unexpected fetch error: ${i.statusText}`)}return a?i:yield i.json()})}const S={live:"https://datamanager.entrecode.de/",stage:"https://datamanager.cachena.entrecode.de/"};function y(n,t="stage"){const e=S[t];if(!e)throw new Error(`env "${t}" not found. Try one of ${Object.keys(S).join(", ")}`);return e+n}function w(n,t=!0){return Object.entries(n).sort((e,s)=>e[0].localeCompare(s[0])).map(([e,s])=>`${e}=${s}`).join("&")}function d(n){Object.entries(n).forEach(([t,e])=>{if(e===void 0)throw new Error(`expected ${t} to be set!`)})}const j={stage:"https://accounts.cachena.entrecode.de/",live:"https://accounts.entrecode.de/"};function B(n){return c(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 c(this,null,function*(){let{env:t,email:e,password:s}=n;d({env:t,email:e,password:s});const r=`${j[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 c(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 c(this,null,function*(){let{env:t,token:e}=n;d({env:t,token:e});const s=`${j[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 J({env:n}){return d({env:n}),n}let it=["created","creator","id","modified","private","_created","_creator","_embedded","_entryTitle","_id","_links","_modelTitle","_modelTitleField","_modified"];function N(n){let t={};for(let e in n)it.includes(e)||(t[e]=n[e]);return t}function ot(n){return JSON.parse(JSON.stringify(n))}function R(n){return c(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 c(this,null,function*(){let{env:t,dmShortID:e,model:s,options:r={}}=n;d({env:t,dmShortID:e,model:s}),r=u({size:50,page:1,_list:!0},r);const a=w(r),i=y(`api/${e}/${s}?${a}`,t),{count:h,total:o,_embedded:l}=yield g(i,n);let $=l?l[`${e}:${s}`]:[];return $=Array.isArray($)?$:[$],{count:h,total:o,items:$}})}function C({env:n,dmShortID:t,model:e,entryID:s,token:r}){d({env:n,dmShortID:t,model:e,entryID:s});const a=w({_id:s}),i=y(`api/${t}/${e}?${a}`,n);return g(i,{dmShortID:t,token:r})}function F(a){return c(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 M(i){return c(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 h=y(`api/${t}/${e}?_id=${s}`,n);return r=ot(r),r=N(r),yield g(h,{token:a},{method:"PUT",body:JSON.stringify(r),headers:{"Content-Type":"application/json"}})})}function U(a){return c(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 v(s){return c(this,arguments,function*({env:n,dmShortID:t,model:e}){var l,$,m,P,_;d({env:n,dmShortID:t,model:e});const r=y(`api/schema/${t}/${e}`,n),a=yield g(r),i=(l=a==null?void 0:a.allOf)==null?void 0:l[1];if(typeof i.properties!="object")throw new Error(`getSchema: ${r} returned unexpected format: ${JSON.stringify(a)}`);const{properties:h}=i,o=N(h);for(let A in o){let p=o[A];if(p.required=i.required.includes(A),($=o[A])!=null&&$.oneOf&&((m=o[A])==null||delete m.oneOf),(P=p.title)!=null&&P.includes("<")&&((_=p.title)!=null&&_.includes(">"))){const Y=p.title.split("<")[1].slice(0,-1),Z=p.title.split("<")[0];p.type=Z,p.resource=Y}else["asset","entry","assets","entries"].includes(p.title)?(p.type=p.title,p.resource=null):p.type=p.title;delete o[A].title}return o})}function V(a){return c(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){d({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=w({assetID:s}),h=y(`a/${t}/${e}?${i}`,n);return(yield g(h,{dmShortID:t,token:r}))._embedded["ec:dm-asset"]})}function G(n){return c(this,null,function*(){let{env:t,dmShortID:e,assetGroup:s,token:r,options:a={}}=n;d({env:t,dmShortID:e,assetGroup:s}),a=u({size:50,page:1,_list:!0},a);const i=w(a),h=y(`a/${e}/${s}?${i}`,t),{count:o,total:l,_embedded:$}=yield g(h,{dmShortID:e,token:r});let m=$?$["ec:dm-asset"]:[];return m=Array.isArray(m)?m:[m],{count:o,total:l,items:m}})}function H(h){return c(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 o=y(`a/${t}/${e}`,n),l=new FormData;return l.append("file",r,a),i&&Object.keys(i).forEach(m=>{l.append(m,i[m])}),(yield g(o,{token:s},{method:"POST",body:l}))._embedded["ec:dm-asset"]})}function I(a){return c(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 c(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 W(n){return c(this,null,function*(){let{env:t,options:e={}}=n;d({env:t}),e=u({size:25,page:1,_list:!0},e);const s=w(e),r=y(`?${s}`,t),{count:a,total:i,_embedded:h}=yield g(r,n);let o=h?h["ec:datamanager"]:[];return o=Array.isArray(o)?o:[o],{count:a,total:i,items:o}})}function X(n){return c(this,null,function*(){let{env:t,dmID:e,options:s={}}=n;d({env:t,dmID:e}),s=u({size:25,dataManagerID:e,page:1,_list:!0},s);const r=w(s),a=y(`model?${r}`,t),{count:i,total:h,_embedded:o}=yield g(a,n);let l=o?o["ec:model"]:[];return l=Array.isArray(l)?l:[l],{count:i,total:h,items:l}})}const k=Object.freeze(Object.defineProperty({__proto__:null,assetList:G,createAsset:H,createEntry:F,deleteAsset:I,deleteEntry:U,dmList:W,editEntry:M,entryList:z,getAsset:V,getDatamanager:Q,getEcAuthKey:J,getEntry:C,getPublicAuthKey:x,getSchema:v,loginEc:q,loginPublic:B,logoutEc:K,logoutPublic:D,modelList:X,publicApi:R},Symbol.toStringTag,{value:"Module"})),{entryList:ct,getEntry:at,getAsset:ut,assetList:lt,createAsset:ht,deleteAsset:dt,createEntry:gt,editEntry:yt,deleteEntry:ft,getSchema:pt,loginPublic:$t,loginEc:mt,logoutEc:wt,logoutPublic:At,getEcAuthKey:b,getPublicAuthKey:T,dmList:kt,modelList:Et,publicApi:bt,getDatamanager:Tt}=k;function Pt(n){const{action:t}=n;if(d({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(u(u({},this.config),t))}entries(){return c(this,arguments,function*(t={}){const e=yield this.getBestToken();return ct(f(u({},this.config),{options:t,token:e}))})}entryList(t){return c(this,null,function*(){return this.entries(t)})}getEntry(t){return c(this,null,function*(){const e=yield this.getBestToken();return at(f(u({},this.config),{entryID:t,token:e}))})}getSchema(){return c(this,null,function*(){return pt(this.config)})}assets(t){return c(this,null,function*(){const e=yield this.getBestToken();return lt(f(u({},this.config),{options:t,token:e}))})}assetList(t){return c(this,null,function*(){return this.assets(t)})}createAsset(){return c(this,arguments,function*({file:t,name:e,options:s}={}){const r=yield this.getBestToken();return ht(f(u({},this.config),{file:t,name:e,options:s,token:r}))})}deleteAsset(t){return c(this,null,function*(){const e=yield this.getBestToken();return dt(f(u({},this.config),{token:e,assetID:t}))})}getAsset(t){return c(this,null,function*(){const e=yield this.getBestToken();return ut(f(u({},this.config),{assetID:t,token:e}))})}createEntry(t){return c(this,null,function*(){const e=yield this.getBestToken();return gt(f(u({},this.config),{token:e,value:t}))})}editEntry(t,e){return c(this,null,function*(){const s=yield this.getBestToken();return yt(f(u({},this.config),{entryID:t,token:s,value:e}))})}deleteEntry(t){return c(this,null,function*(){const e=yield this.getBestToken();return ft(f(u({},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 mt(u(u({},this.config),t)).then(this.setAuth(b(this.config)))}loginPublic(t){return $t(u(u({},this.config),t)).then(this.setAuth(T(this.config)))}logoutPublic(){const t=this.getPublicToken();return console.log("token",t),At(f(u({},this.config),{token:t})).then(this.unsetAuth(T(this.config)))}logoutEc(){const t=this.getEcToken();return console.log("token",t),wt(f(u({},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 bt(this.config)}getDatamanager(t){return c(this,null,function*(){const e=yield this.getBestToken();return Tt(f(u({},this.config),{dmID:t,token:e}))})}dmList(){return c(this,arguments,function*(t={}){const e=yield this.getBestToken();return kt(f(u({},this.config),{options:t,token:e}))})}modelList(){return c(this,arguments,function*(t={}){const e=yield this.getBestToken();return Et(f(u({},this.config),{options:t,token:e}))})}}const _t=n=>new E({env:n});exports.Sdk=E;exports.act=Pt;exports.apiURL=y;exports.assetList=G;exports.createAsset=H;exports.createEntry=F;exports.deleteAsset=I;exports.deleteEntry=U;exports.dmList=W;exports.editEntry=M;exports.entryList=z;exports.expect=d;exports.fetcher=g;exports.getAsset=V;exports.getDatamanager=Q;exports.getEcAuthKey=J;exports.getEntry=C;exports.getPublicAuthKey=x;exports.getSchema=v;exports.loginEc=q;exports.loginPublic=B;exports.logoutEc=K;exports.logoutPublic=D;exports.modelList=X;exports.publicApi=R;exports.query=w;exports.sdk=_t;
|
|
3
|
+
${o.verbose}`;throw new Error(l)}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 w(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 B={stage:"https://accounts.cachena.entrecode.de/",live:"https://accounts.entrecode.de/"};function q(n){return c(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 D(n){return c(this,null,function*(){let{env:t,email:e,password:s}=n;d({env:t,email:e,password:s});const r=`${B[t]}auth/login?clientID=rest`;return yield g(r,{},{method:"POST",body:JSON.stringify({email:e,password:s}),headers:{"Content-Type":"application/json"}})})}function K(n){return c(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 x(n){return c(this,null,function*(){let{env:t,token:e}=n;d({env:t,token:e});const s=`${B[t]}auth/logout?clientID=rest`;return yield g(s,{rawRes:!0,token:e},{method:"POST"})})}function J({dmShortID:n}){return d({dmShortID:n}),n}function N({env:n}){return d({env:n}),n}let it=["created","creator","id","modified","private","_created","_creator","_embedded","_entryTitle","_id","_links","_modelTitle","_modelTitleField","_modified"];function R(n){let t={};for(let e in n)it.includes(e)||(t[e]=n[e]);return t}function ot(n){return JSON.parse(JSON.stringify(n))}function z(n){return c(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 C(n){return c(this,null,function*(){let{env:t,dmShortID:e,model:s,options:r={}}=n;d({env:t,dmShortID:e,model:s}),r=u({size:50,page:1,_list:!0},r);const a=w(r),i=y(`api/${e}/${s}?${a}`,t),{count:h,total:o,_embedded:l}=yield g(i,n);let $=l?l[`${e}:${s}`]:[];return $=Array.isArray($)?$:[$],{count:h,total:o,items:$}})}function F({env:n,dmShortID:t,model:e,entryID:s,token:r}){d({env:n,dmShortID:t,model:e,entryID:s});const a=w({_id:s}),i=y(`api/${t}/${e}?${a}`,n);return g(i,{dmShortID:t,token:r})}function M(a){return c(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 U(i){return c(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 h=y(`api/${t}/${e}?_id=${s}`,n);return r=ot(r),r=R(r),yield g(h,{token:a},{method:"PUT",body:JSON.stringify(r),headers:{"Content-Type":"application/json"}})})}function v(a){return c(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 V(s){return c(this,arguments,function*({env:n,dmShortID:t,model:e}){var l,$,m,P,_;d({env:n,dmShortID:t,model:e});const r=y(`api/schema/${t}/${e}`,n),a=yield g(r),i=(l=a==null?void 0:a.allOf)==null?void 0:l[1];if(typeof i.properties!="object")throw new Error(`getSchema: ${r} returned unexpected format: ${JSON.stringify(a)}`);const{properties:h}=i,o=R(h);for(let A in o){let p=o[A];if(p.required=i.required.includes(A),($=o[A])!=null&&$.oneOf&&((m=o[A])==null||delete m.oneOf),(P=p.title)!=null&&P.includes("<")&&((_=p.title)!=null&&_.includes(">"))){const O=p.title.split("<")[1].slice(0,-1),Z=p.title.split("<")[0];p.type=Z,p.resource.includes(":")?p.resource=O.split(":")[1]:p.resource=O}else["asset","entry","assets","entries"].includes(p.title)?(p.type=p.title,p.resource=null):p.type=p.title;delete o[A].title}return o})}function G(a){return c(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){d({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=w({assetID:s}),h=y(`a/${t}/${e}?${i}`,n);return(yield g(h,{dmShortID:t,token:r}))._embedded["ec:dm-asset"]})}function H(n){return c(this,null,function*(){let{env:t,dmShortID:e,assetGroup:s,token:r,options:a={}}=n;d({env:t,dmShortID:e,assetGroup:s}),a=u({size:50,page:1,_list:!0},a);const i=w(a),h=y(`a/${e}/${s}?${i}`,t),{count:o,total:l,_embedded:$}=yield g(h,{dmShortID:e,token:r});let m=$?$["ec:dm-asset"]:[];return m=Array.isArray(m)?m:[m],{count:o,total:l,items:m}})}function I(h){return c(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 o=y(`a/${t}/${e}`,n),l=new FormData;return l.append("file",r,a),i&&Object.keys(i).forEach(m=>{l.append(m,i[m])}),(yield g(o,{token:s},{method:"POST",body:l}))._embedded["ec:dm-asset"]})}function Q(a){return c(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 W(n){return c(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 X(n){return c(this,null,function*(){let{env:t,options:e={}}=n;d({env:t}),e=u({size:25,page:1,_list:!0},e);const s=w(e),r=y(`?${s}`,t),{count:a,total:i,_embedded:h}=yield g(r,n);let o=h?h["ec:datamanager"]:[];return o=Array.isArray(o)?o:[o],{count:a,total:i,items:o}})}function Y(n){return c(this,null,function*(){let{env:t,dmID:e,options:s={}}=n;d({env:t,dmID:e}),s=u({size:25,dataManagerID:e,page:1,_list:!0},s);const r=w(s),a=y(`model?${r}`,t),{count:i,total:h,_embedded:o}=yield g(a,n);let l=o?o["ec:model"]:[];return l=Array.isArray(l)?l:[l],{count:i,total:h,items:l}})}const k=Object.freeze(Object.defineProperty({__proto__:null,assetList:H,createAsset:I,createEntry:M,deleteAsset:Q,deleteEntry:v,dmList:X,editEntry:U,entryList:C,getAsset:G,getDatamanager:W,getEcAuthKey:N,getEntry:F,getPublicAuthKey:J,getSchema:V,loginEc:D,loginPublic:q,logoutEc:x,logoutPublic:K,modelList:Y,publicApi:z},Symbol.toStringTag,{value:"Module"})),{entryList:ct,getEntry:at,getAsset:ut,assetList:lt,createAsset:ht,deleteAsset:dt,createEntry:gt,editEntry:yt,deleteEntry:ft,getSchema:pt,loginPublic:$t,loginEc:mt,logoutEc:wt,logoutPublic:At,getEcAuthKey:b,getPublicAuthKey:T,dmList:kt,modelList:Et,publicApi:bt,getDatamanager:Tt}=k;function Pt(n){const{action:t}=n;if(d({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(u(u({},this.config),t))}entries(){return c(this,arguments,function*(t={}){const e=yield this.getBestToken();return ct(f(u({},this.config),{options:t,token:e}))})}entryList(t){return c(this,null,function*(){return this.entries(t)})}getEntry(t){return c(this,null,function*(){const e=yield this.getBestToken();return at(f(u({},this.config),{entryID:t,token:e}))})}getSchema(){return c(this,null,function*(){return pt(this.config)})}assets(t){return c(this,null,function*(){const e=yield this.getBestToken();return lt(f(u({},this.config),{options:t,token:e}))})}assetList(t){return c(this,null,function*(){return this.assets(t)})}createAsset(){return c(this,arguments,function*({file:t,name:e,options:s}={}){const r=yield this.getBestToken();return ht(f(u({},this.config),{file:t,name:e,options:s,token:r}))})}deleteAsset(t){return c(this,null,function*(){const e=yield this.getBestToken();return dt(f(u({},this.config),{token:e,assetID:t}))})}getAsset(t){return c(this,null,function*(){const e=yield this.getBestToken();return ut(f(u({},this.config),{assetID:t,token:e}))})}createEntry(t){return c(this,null,function*(){const e=yield this.getBestToken();return gt(f(u({},this.config),{token:e,value:t}))})}editEntry(t,e){return c(this,null,function*(){const s=yield this.getBestToken();return yt(f(u({},this.config),{entryID:t,token:s,value:e}))})}deleteEntry(t){return c(this,null,function*(){const e=yield this.getBestToken();return ft(f(u({},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 mt(u(u({},this.config),t)).then(this.setAuth(b(this.config)))}loginPublic(t){return $t(u(u({},this.config),t)).then(this.setAuth(T(this.config)))}logoutPublic(){const t=this.getPublicToken();return console.log("token",t),At(f(u({},this.config),{token:t})).then(this.unsetAuth(T(this.config)))}logoutEc(){const t=this.getEcToken();return console.log("token",t),wt(f(u({},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 bt(this.config)}getDatamanager(t){return c(this,null,function*(){const e=yield this.getBestToken();return Tt(f(u({},this.config),{dmID:t,token:e}))})}dmList(){return c(this,arguments,function*(t={}){const e=yield this.getBestToken();return kt(f(u({},this.config),{options:t,token:e}))})}modelList(){return c(this,arguments,function*(t={}){const e=yield this.getBestToken();return Et(f(u({},this.config),{options:t,token:e}))})}}const _t=n=>new E({env:n});exports.Sdk=E;exports.act=Pt;exports.apiURL=y;exports.assetList=H;exports.createAsset=I;exports.createEntry=M;exports.deleteAsset=Q;exports.deleteEntry=v;exports.dmList=X;exports.editEntry=U;exports.entryList=C;exports.expect=d;exports.fetcher=g;exports.getAsset=G;exports.getDatamanager=W;exports.getEcAuthKey=N;exports.getEntry=F;exports.getPublicAuthKey=J;exports.getSchema=V;exports.loginEc=D;exports.loginPublic=q;exports.logoutEc=x;exports.logoutPublic=K;exports.modelList=Y;exports.publicApi=z;exports.query=w;exports.sdk=_t;
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var K = Object.defineProperty, x = Object.defineProperties;
|
|
2
2
|
var J = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
3
|
+
var L = Object.getOwnPropertySymbols;
|
|
4
4
|
var N = Object.prototype.hasOwnProperty, z = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
5
|
+
var j = (n, t, e) => t in n ? K(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, u = (n, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
|
-
N.call(t, e) &&
|
|
8
|
-
if (
|
|
9
|
-
for (var e of
|
|
10
|
-
z.call(t, e) &&
|
|
7
|
+
N.call(t, e) && j(n, e, t[e]);
|
|
8
|
+
if (L)
|
|
9
|
+
for (var e of L(t))
|
|
10
|
+
z.call(t, e) && j(n, e, t[e]);
|
|
11
11
|
return n;
|
|
12
|
-
},
|
|
12
|
+
}, f = (n, t) => x(n, J(t));
|
|
13
13
|
var a = (n, t, e) => new Promise((s, r) => {
|
|
14
14
|
var c = (o) => {
|
|
15
15
|
try {
|
|
@@ -30,7 +30,7 @@ function g(s) {
|
|
|
30
30
|
return a(this, arguments, function* (n, t = {}, e = {}) {
|
|
31
31
|
var h;
|
|
32
32
|
const { token: r, rawRes: c } = t;
|
|
33
|
-
r && (e.headers =
|
|
33
|
+
r && (e.headers = f(u({}, e.headers || {}), {
|
|
34
34
|
Authorization: `Bearer ${r}`
|
|
35
35
|
}));
|
|
36
36
|
const i = yield fetch(n, e);
|
|
@@ -46,15 +46,15 @@ ${o.verbose}`;
|
|
|
46
46
|
return c ? i : yield i.json();
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
const
|
|
49
|
+
const S = {
|
|
50
50
|
live: "https://datamanager.entrecode.de/",
|
|
51
51
|
stage: "https://datamanager.cachena.entrecode.de/"
|
|
52
52
|
};
|
|
53
|
-
function
|
|
54
|
-
const e =
|
|
53
|
+
function y(n, t = "stage") {
|
|
54
|
+
const e = S[t];
|
|
55
55
|
if (!e)
|
|
56
56
|
throw new Error(
|
|
57
|
-
`env "${t}" not found. Try one of ${Object.keys(
|
|
57
|
+
`env "${t}" not found. Try one of ${Object.keys(S).join(", ")}`
|
|
58
58
|
);
|
|
59
59
|
return e + n;
|
|
60
60
|
}
|
|
@@ -67,7 +67,7 @@ function d(n) {
|
|
|
67
67
|
throw new Error(`expected ${t} to be set!`);
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
const
|
|
70
|
+
const B = {
|
|
71
71
|
stage: "https://accounts.cachena.entrecode.de/",
|
|
72
72
|
live: "https://accounts.entrecode.de/"
|
|
73
73
|
};
|
|
@@ -75,7 +75,7 @@ function C(n) {
|
|
|
75
75
|
return a(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 c =
|
|
78
|
+
const c = y(`api/${e}/_auth/login?clientID=rest`, t);
|
|
79
79
|
return yield g(
|
|
80
80
|
c,
|
|
81
81
|
{},
|
|
@@ -93,7 +93,7 @@ function R(n) {
|
|
|
93
93
|
return a(this, null, function* () {
|
|
94
94
|
let { env: t, email: e, password: s } = n;
|
|
95
95
|
d({ env: t, email: e, password: s });
|
|
96
|
-
const r = `${
|
|
96
|
+
const r = `${B[t]}auth/login?clientID=rest`;
|
|
97
97
|
return yield g(
|
|
98
98
|
r,
|
|
99
99
|
{},
|
|
@@ -111,7 +111,7 @@ function F(n) {
|
|
|
111
111
|
return a(this, null, function* () {
|
|
112
112
|
let { dmShortID: t, env: e, token: s } = n;
|
|
113
113
|
d({ dmShortID: t, env: e, token: s });
|
|
114
|
-
const r =
|
|
114
|
+
const r = y(
|
|
115
115
|
`api/${t}/_auth/logout?clientID=rest&token=${s}`,
|
|
116
116
|
e
|
|
117
117
|
);
|
|
@@ -128,7 +128,7 @@ function M(n) {
|
|
|
128
128
|
return a(this, null, function* () {
|
|
129
129
|
let { env: t, token: e } = n;
|
|
130
130
|
d({ env: t, token: e });
|
|
131
|
-
const s = `${
|
|
131
|
+
const s = `${B[t]}auth/logout?clientID=rest`;
|
|
132
132
|
return yield g(
|
|
133
133
|
s,
|
|
134
134
|
{
|
|
@@ -163,7 +163,7 @@ let V = [
|
|
|
163
163
|
"_modelTitleField",
|
|
164
164
|
"_modified"
|
|
165
165
|
];
|
|
166
|
-
function
|
|
166
|
+
function q(n) {
|
|
167
167
|
let t = {};
|
|
168
168
|
for (let e in n)
|
|
169
169
|
V.includes(e) || (t[e] = n[e]);
|
|
@@ -176,7 +176,7 @@ function H(n) {
|
|
|
176
176
|
return a(this, null, function* () {
|
|
177
177
|
let { env: t, dmShortID: e } = n;
|
|
178
178
|
d({ env: t, dmShortID: e });
|
|
179
|
-
const s =
|
|
179
|
+
const s = y(`api/${e}`, t);
|
|
180
180
|
return g(s, n);
|
|
181
181
|
});
|
|
182
182
|
}
|
|
@@ -184,20 +184,20 @@ function I(n) {
|
|
|
184
184
|
return a(this, null, function* () {
|
|
185
185
|
let { env: t, dmShortID: e, model: s, options: r = {} } = n;
|
|
186
186
|
d({ env: t, dmShortID: e, model: s }), r = u({ size: 50, page: 1, _list: !0 }, r);
|
|
187
|
-
const c = w(r), i =
|
|
187
|
+
const c = w(r), i = y(`api/${e}/${s}?${c}`, t), { count: h, total: o, _embedded: l } = yield g(i, n);
|
|
188
188
|
let $ = l ? l[`${e}:${s}`] : [];
|
|
189
189
|
return $ = Array.isArray($) ? $ : [$], { count: h, total: o, items: $ };
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
192
|
function Q({ env: n, dmShortID: t, model: e, entryID: s, token: r }) {
|
|
193
193
|
d({ env: n, dmShortID: t, model: e, entryID: s });
|
|
194
|
-
const c = w({ _id: s }), i =
|
|
194
|
+
const c = w({ _id: s }), i = y(`api/${t}/${e}?${c}`, n);
|
|
195
195
|
return g(i, { dmShortID: t, token: r });
|
|
196
196
|
}
|
|
197
197
|
function W(c) {
|
|
198
198
|
return a(this, arguments, function* ({ env: n, dmShortID: t, model: e, value: s, token: r }) {
|
|
199
199
|
d({ env: n, dmShortID: t, model: e, value: s });
|
|
200
|
-
const i =
|
|
200
|
+
const i = y(`api/${t}/${e}`, n);
|
|
201
201
|
return yield g(
|
|
202
202
|
i,
|
|
203
203
|
{ env: n, dmShortID: t, token: r },
|
|
@@ -221,8 +221,8 @@ function X(i) {
|
|
|
221
221
|
token: c
|
|
222
222
|
}) {
|
|
223
223
|
d({ env: n, dmShortID: t, model: e, entryID: s, value: r });
|
|
224
|
-
const h =
|
|
225
|
-
return r = G(r), r =
|
|
224
|
+
const h = y(`api/${t}/${e}?_id=${s}`, n);
|
|
225
|
+
return r = G(r), r = q(r), yield g(
|
|
226
226
|
h,
|
|
227
227
|
{ token: c },
|
|
228
228
|
{
|
|
@@ -238,7 +238,7 @@ function X(i) {
|
|
|
238
238
|
function Y(c) {
|
|
239
239
|
return a(this, arguments, function* ({ env: n, dmShortID: t, model: e, entryID: s, token: r }) {
|
|
240
240
|
d({ env: n, dmShortID: t, model: e, entryID: s });
|
|
241
|
-
const i =
|
|
241
|
+
const i = y(`api/${t}/${e}?_id=${s}`, n);
|
|
242
242
|
yield g(
|
|
243
243
|
i,
|
|
244
244
|
{ token: r, rawRes: !0 },
|
|
@@ -255,17 +255,17 @@ function Z(s) {
|
|
|
255
255
|
return a(this, arguments, function* ({ env: n, dmShortID: t, model: e }) {
|
|
256
256
|
var l, $, m, P, _;
|
|
257
257
|
d({ env: n, dmShortID: t, model: e });
|
|
258
|
-
const r =
|
|
258
|
+
const r = y(`api/schema/${t}/${e}`, n), c = yield g(r), i = (l = c == null ? void 0 : c.allOf) == null ? void 0 : l[1];
|
|
259
259
|
if (typeof i.properties != "object")
|
|
260
260
|
throw new Error(
|
|
261
261
|
`getSchema: ${r} returned unexpected format: ${JSON.stringify(c)}`
|
|
262
262
|
);
|
|
263
|
-
const { properties: h } = i, o =
|
|
263
|
+
const { properties: h } = i, o = q(h);
|
|
264
264
|
for (let A in o) {
|
|
265
265
|
let p = o[A];
|
|
266
266
|
if (p.required = i.required.includes(A), ($ = o[A]) != null && $.oneOf && ((m = o[A]) == null || delete m.oneOf), (P = p.title) != null && P.includes("<") && ((_ = p.title) != null && _.includes(">"))) {
|
|
267
|
-
const
|
|
268
|
-
p.type = D, p.resource =
|
|
267
|
+
const O = p.title.split("<")[1].slice(0, -1), D = p.title.split("<")[0];
|
|
268
|
+
p.type = D, p.resource.includes(":") ? p.resource = O.split(":")[1] : p.resource = O;
|
|
269
269
|
} else
|
|
270
270
|
["asset", "entry", "assets", "entries"].includes(p.title) ? (p.type = p.title, p.resource = null) : p.type = p.title;
|
|
271
271
|
delete o[A].title;
|
|
@@ -276,7 +276,7 @@ function Z(s) {
|
|
|
276
276
|
function tt(c) {
|
|
277
277
|
return a(this, arguments, function* ({ env: n, dmShortID: t, assetGroup: e, assetID: s, token: r }) {
|
|
278
278
|
d({ env: n, dmShortID: t, assetGroup: e, assetID: s });
|
|
279
|
-
const i = w({ assetID: s }), h =
|
|
279
|
+
const i = w({ assetID: s }), h = y(`a/${t}/${e}?${i}`, n);
|
|
280
280
|
return (yield g(h, { dmShortID: t, token: r }))._embedded["ec:dm-asset"];
|
|
281
281
|
});
|
|
282
282
|
}
|
|
@@ -284,7 +284,7 @@ function et(n) {
|
|
|
284
284
|
return a(this, null, function* () {
|
|
285
285
|
let { env: t, dmShortID: e, assetGroup: s, token: r, options: c = {} } = n;
|
|
286
286
|
d({ env: t, dmShortID: e, assetGroup: s }), c = u({ size: 50, page: 1, _list: !0 }, c);
|
|
287
|
-
const i = w(c), h =
|
|
287
|
+
const i = w(c), h = y(`a/${e}/${s}?${i}`, t), { count: o, total: l, _embedded: $ } = yield g(h, { dmShortID: e, token: r });
|
|
288
288
|
let m = $ ? $["ec:dm-asset"] : [];
|
|
289
289
|
return m = Array.isArray(m) ? m : [m], { count: o, total: l, items: m };
|
|
290
290
|
});
|
|
@@ -300,7 +300,7 @@ function nt(h) {
|
|
|
300
300
|
options: i
|
|
301
301
|
}) {
|
|
302
302
|
d({ env: n, dmShortID: t, assetGroup: e, file: r });
|
|
303
|
-
const o =
|
|
303
|
+
const o = y(`a/${t}/${e}`, n), l = new FormData();
|
|
304
304
|
return l.append("file", r, c), i && Object.keys(i).forEach((m) => {
|
|
305
305
|
l.append(m, i[m]);
|
|
306
306
|
}), (yield g(
|
|
@@ -322,7 +322,7 @@ function st(c) {
|
|
|
322
322
|
token: r
|
|
323
323
|
}) {
|
|
324
324
|
d({ env: n, dmShortID: t, assetGroup: e, assetID: s });
|
|
325
|
-
const i =
|
|
325
|
+
const i = y(`a/${t}/${e}/${s}`, n);
|
|
326
326
|
yield g(
|
|
327
327
|
i,
|
|
328
328
|
{ token: r, rawRes: !0 },
|
|
@@ -336,7 +336,7 @@ function rt(n) {
|
|
|
336
336
|
return a(this, null, function* () {
|
|
337
337
|
let { env: t, dmID: e, token: s } = n;
|
|
338
338
|
d({ env: t, dmID: e });
|
|
339
|
-
const r =
|
|
339
|
+
const r = y(`?dataManagerID=${e}`, t);
|
|
340
340
|
return g(r, { token: s });
|
|
341
341
|
});
|
|
342
342
|
}
|
|
@@ -344,7 +344,7 @@ function it(n) {
|
|
|
344
344
|
return a(this, null, function* () {
|
|
345
345
|
let { env: t, options: e = {} } = n;
|
|
346
346
|
d({ env: t }), e = u({ size: 25, page: 1, _list: !0 }, e);
|
|
347
|
-
const s = w(e), r =
|
|
347
|
+
const s = w(e), r = y(`?${s}`, t), { count: c, total: i, _embedded: h } = yield g(r, n);
|
|
348
348
|
let o = h ? h["ec:datamanager"] : [];
|
|
349
349
|
return o = Array.isArray(o) ? o : [o], { count: c, total: i, items: o };
|
|
350
350
|
});
|
|
@@ -353,7 +353,7 @@ function ot(n) {
|
|
|
353
353
|
return a(this, null, function* () {
|
|
354
354
|
let { env: t, dmID: e, options: s = {} } = n;
|
|
355
355
|
d({ env: t, dmID: e }), s = u({ size: 25, dataManagerID: e, page: 1, _list: !0 }, s);
|
|
356
|
-
const r = w(s), c =
|
|
356
|
+
const r = w(s), c = y(`model?${r}`, t), { count: i, total: h, _embedded: o } = yield g(c, n);
|
|
357
357
|
let l = o ? o["ec:model"] : [];
|
|
358
358
|
return l = Array.isArray(l) ? l : [l], { count: i, total: h, items: l };
|
|
359
359
|
});
|
|
@@ -388,8 +388,8 @@ const E = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
388
388
|
createAsset: ht,
|
|
389
389
|
deleteAsset: dt,
|
|
390
390
|
createEntry: gt,
|
|
391
|
-
editEntry:
|
|
392
|
-
deleteEntry:
|
|
391
|
+
editEntry: ft,
|
|
392
|
+
deleteEntry: yt,
|
|
393
393
|
getSchema: pt,
|
|
394
394
|
loginPublic: $t,
|
|
395
395
|
loginEc: mt,
|
|
@@ -435,7 +435,7 @@ class T {
|
|
|
435
435
|
entries() {
|
|
436
436
|
return a(this, arguments, function* (t = {}) {
|
|
437
437
|
const e = yield this.getBestToken();
|
|
438
|
-
return at(
|
|
438
|
+
return at(f(u({}, this.config), { options: t, token: e }));
|
|
439
439
|
});
|
|
440
440
|
}
|
|
441
441
|
entryList(t) {
|
|
@@ -455,7 +455,7 @@ class T {
|
|
|
455
455
|
getEntry(t) {
|
|
456
456
|
return a(this, null, function* () {
|
|
457
457
|
const e = yield this.getBestToken();
|
|
458
|
-
return ct(
|
|
458
|
+
return ct(f(u({}, this.config), { entryID: t, token: e }));
|
|
459
459
|
});
|
|
460
460
|
}
|
|
461
461
|
/**
|
|
@@ -487,7 +487,7 @@ class T {
|
|
|
487
487
|
assets(t) {
|
|
488
488
|
return a(this, null, function* () {
|
|
489
489
|
const e = yield this.getBestToken();
|
|
490
|
-
return lt(
|
|
490
|
+
return lt(f(u({}, this.config), { options: t, token: e }));
|
|
491
491
|
});
|
|
492
492
|
}
|
|
493
493
|
assetList(t) {
|
|
@@ -519,7 +519,7 @@ class T {
|
|
|
519
519
|
createAsset() {
|
|
520
520
|
return a(this, arguments, function* ({ file: t, name: e, options: s } = {}) {
|
|
521
521
|
const r = yield this.getBestToken();
|
|
522
|
-
return ht(
|
|
522
|
+
return ht(f(u({}, this.config), { file: t, name: e, options: s, token: r }));
|
|
523
523
|
});
|
|
524
524
|
}
|
|
525
525
|
/**
|
|
@@ -534,7 +534,7 @@ class T {
|
|
|
534
534
|
deleteAsset(t) {
|
|
535
535
|
return a(this, null, function* () {
|
|
536
536
|
const e = yield this.getBestToken();
|
|
537
|
-
return dt(
|
|
537
|
+
return dt(f(u({}, this.config), { token: e, assetID: t }));
|
|
538
538
|
});
|
|
539
539
|
}
|
|
540
540
|
/**
|
|
@@ -549,7 +549,7 @@ class T {
|
|
|
549
549
|
getAsset(t) {
|
|
550
550
|
return a(this, null, function* () {
|
|
551
551
|
const e = yield this.getBestToken();
|
|
552
|
-
return ut(
|
|
552
|
+
return ut(f(u({}, this.config), { assetID: t, token: e }));
|
|
553
553
|
});
|
|
554
554
|
}
|
|
555
555
|
/**
|
|
@@ -564,7 +564,7 @@ class T {
|
|
|
564
564
|
createEntry(t) {
|
|
565
565
|
return a(this, null, function* () {
|
|
566
566
|
const e = yield this.getBestToken();
|
|
567
|
-
return gt(
|
|
567
|
+
return gt(f(u({}, this.config), { token: e, value: t }));
|
|
568
568
|
});
|
|
569
569
|
}
|
|
570
570
|
/**
|
|
@@ -580,7 +580,7 @@ class T {
|
|
|
580
580
|
editEntry(t, e) {
|
|
581
581
|
return a(this, null, function* () {
|
|
582
582
|
const s = yield this.getBestToken();
|
|
583
|
-
return
|
|
583
|
+
return ft(f(u({}, this.config), { entryID: t, token: s, value: e }));
|
|
584
584
|
});
|
|
585
585
|
}
|
|
586
586
|
/**
|
|
@@ -595,7 +595,7 @@ class T {
|
|
|
595
595
|
deleteEntry(t) {
|
|
596
596
|
return a(this, null, function* () {
|
|
597
597
|
const e = yield this.getBestToken();
|
|
598
|
-
return
|
|
598
|
+
return yt(f(u({}, this.config), { token: e, entryID: t }));
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
601
|
// TODO: rename authAdapter -> storageAdapter
|
|
@@ -636,13 +636,13 @@ class T {
|
|
|
636
636
|
}
|
|
637
637
|
logoutPublic() {
|
|
638
638
|
const t = this.getPublicToken();
|
|
639
|
-
return console.log("token", t), At(
|
|
639
|
+
return console.log("token", t), At(f(u({}, this.config), { token: t })).then(
|
|
640
640
|
this.unsetAuth(b(this.config))
|
|
641
641
|
);
|
|
642
642
|
}
|
|
643
643
|
logoutEc() {
|
|
644
644
|
const t = this.getEcToken();
|
|
645
|
-
return console.log("token", t), wt(
|
|
645
|
+
return console.log("token", t), wt(f(u({}, this.config), { token: t })).then(
|
|
646
646
|
this.unsetAuth(k(this.config))
|
|
647
647
|
);
|
|
648
648
|
}
|
|
@@ -738,7 +738,7 @@ class T {
|
|
|
738
738
|
getDatamanager(t) {
|
|
739
739
|
return a(this, null, function* () {
|
|
740
740
|
const e = yield this.getBestToken();
|
|
741
|
-
return Tt(
|
|
741
|
+
return Tt(f(u({}, this.config), { dmID: t, token: e }));
|
|
742
742
|
});
|
|
743
743
|
}
|
|
744
744
|
/**
|
|
@@ -752,7 +752,7 @@ class T {
|
|
|
752
752
|
dmList() {
|
|
753
753
|
return a(this, arguments, function* (t = {}) {
|
|
754
754
|
const e = yield this.getBestToken();
|
|
755
|
-
return Et(
|
|
755
|
+
return Et(f(u({}, this.config), { options: t, token: e }));
|
|
756
756
|
});
|
|
757
757
|
}
|
|
758
758
|
/**
|
|
@@ -766,7 +766,7 @@ class T {
|
|
|
766
766
|
modelList() {
|
|
767
767
|
return a(this, arguments, function* (t = {}) {
|
|
768
768
|
const e = yield this.getBestToken();
|
|
769
|
-
return kt(
|
|
769
|
+
return kt(f(u({}, this.config), { options: t, token: e }));
|
|
770
770
|
});
|
|
771
771
|
}
|
|
772
772
|
}
|
|
@@ -774,7 +774,7 @@ const Ot = (n) => new T({ env: n });
|
|
|
774
774
|
export {
|
|
775
775
|
T as Sdk,
|
|
776
776
|
_t as act,
|
|
777
|
-
|
|
777
|
+
y as apiURL,
|
|
778
778
|
et as assetList,
|
|
779
779
|
nt as createAsset,
|
|
780
780
|
W as createEntry,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entries.d.mts","sourceRoot":"","sources":["../../src/lib/entries.mjs"],"names":[],"mappings":"AAiCA,qDAMC;AAED;;;;GAYC;AAED;;;;;;iBAKC;AAED;;;;;;iBAeC;AAED;;;;;;;iBA0BC;AAED;;;;;;kBAcC;AAED;;;;
|
|
1
|
+
{"version":3,"file":"entries.d.mts","sourceRoot":"","sources":["../../src/lib/entries.mjs"],"names":[],"mappings":"AAiCA,qDAMC;AAED;;;;GAYC;AAED;;;;;;iBAKC;AAED;;;;;;iBAeC;AAED;;;;;;;iBA0BC;AAED;;;;;;kBAcC;AAED;;;;gBAsCC"}
|