ec.fdk 0.2.31 → 0.3.1
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 +3 -3
- package/dist/index.mjs +241 -147
- package/dist/lib/admin.d.mts +6 -0
- package/dist/lib/admin.d.mts.map +1 -1
- package/dist/lib/api.d.mts +45 -0
- package/dist/lib/api.d.mts.map +1 -1
- package/dist/lib/util.d.mts +1 -1
- package/dist/lib/util.d.mts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
${
|
|
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,_,O;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.title)!=null&&_.includes("<")&&((O=p.title)!=null&&O.includes(">"))){const b=p.title.split("<")[1].slice(0,-1),Z=p.title.split("<")[0];p.type=Z,b.includes(":")?p.resource=b.split(":")[1]:p.resource=b}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:T,getPublicAuthKey:P,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(T(this.config)))}loginPublic(t){return $t(u(u({},this.config),t)).then(this.setAuth(P(this.config)))}logoutPublic(){const t=this.getPublicToken();return console.log("token",t),At(f(u({},this.config),{token:t})).then(this.unsetAuth(P(this.config)))}logoutEc(){const t=this.getEcToken();return console.log("token",t),wt(f(u({},this.config),{token:t})).then(this.unsetAuth(T(this.config)))}getPublicToken(){return this.config.token||this.getAuth(P(this.config))}getEcToken(){return this.config.token||this.getAuth(T(this.config))}hasPublicToken(){return!!this.getPublicToken()}hasEcToken(){return!!this.getEcToken()}hasAnyToken(){return!!this.getEcToken()||!!this.getPublicToken()}getBestToken(){try{return this.getEcToken()||this.getPublicToken()}catch(t){return}}model(t){return this.set({model:t})}token(t){return this.set({token:t})}dmShortID(t){return this.set({dmShortID:t})}dmID(t){return this.set({dmID:t})}dm(t){return this.dmShortID(t)}assetGroup(t){return this.set({assetGroup:t})}assetgroup(t){return this.assetGroup(t)}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;
|
|
1
|
+
"use strict";var nt=Object.defineProperty,st=Object.defineProperties;var rt=Object.getOwnPropertyDescriptors;var O=Object.getOwnPropertySymbols;var ot=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable;var j=(n,t,e)=>t in n?nt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,u=(n,t)=>{for(var e in t||(t={}))ot.call(t,e)&&j(n,e,t[e]);if(O)for(var e of O(t))it.call(t,e)&&j(n,e,t[e]);return n},p=(n,t)=>st(n,rt(t));var c=(n,t,e)=>new Promise((s,r)=>{var a=i=>{try{h(e.next(i))}catch(l){r(l)}},o=i=>{try{h(e.throw(i))}catch(l){r(l)}},h=i=>i.done?s(i.value):Promise.resolve(i.value).then(a,o);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=p(u({},e.headers||{}),{Authorization:`Bearer ${r}`}));const o=yield fetch(n,e);if(!o.ok){if((h=o.headers.get("content-type"))!=null&&h.includes("application/json")){const i=yield o.json(),l=`${i.title}
|
|
2
|
+
${i.detail}
|
|
3
|
+
${i.verbose}`;throw new Error(l)}throw new Error(`unexpected fetch error: ${o.statusText}`)}return a?o:yield o.json()})}const S={datamanager:{live:"https://datamanager.entrecode.de/",stage:"https://datamanager.cachena.entrecode.de/"},accounts:{live:"https://accounts.entrecode.de/",stage:"https://accounts.cachena.entrecode.de/"},appserver:{live:"https://appserver.entrecode.de/",stage:"https://appserver.cachena.entrecode.de/"}};function y(n,t="stage",e="datamanager"){const s=S[e];if(!s)throw new Error(`subdomain "${e}" not found. Try one of ${Object.keys(S).join(", ")}`);const r=s[t];if(!r)throw new Error(`env "${t}" not found. Try one of ${Object.keys(s[t]).join(", ")}`);return r+n}function w(n,t=!0){return Object.entries(n).sort((e,s)=>e[0].localeCompare(s[0])).map(([e,s])=>`${e}=${s}`).join("&")}function 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 v(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=`${B[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 z({env:n}){return d({env:n}),n}let ct=["created","creator","id","modified","private","_created","_creator","_embedded","_entryTitle","_id","_links","_modelTitle","_modelTitleField","_modified"];function J(n){let t={};for(let e in n)ct.includes(e)||(t[e]=n[e]);return t}function at(n){return JSON.parse(JSON.stringify(n))}function N(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 R(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),o=y(`api/${e}/${s}?${a}`,t),{count:h,total:i,_embedded:l}=yield g(o,n);let f=l?l[`${e}:${s}`]:[];return f=Array.isArray(f)?f:[f],{count:h,total:i,items:f}})}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}),o=y(`api/${t}/${e}?${a}`,n);return g(o,{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 o=y(`api/${t}/${e}`,n);return yield g(o,{env:n,dmShortID:t,token:r},{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}})})}function M(o){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=at(r),r=J(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 o=y(`api/${t}/${e}?_id=${s}`,n);yield g(o,{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,f,m,_,L;d({env:n,dmShortID:t,model:e});const r=y(`api/schema/${t}/${e}`,n),a=yield g(r),o=(l=a==null?void 0:a.allOf)==null?void 0:l[1];if(typeof o.properties!="object")throw new Error(`getSchema: ${r} returned unexpected format: ${JSON.stringify(a)}`);const{properties:h}=o,i=J(h);for(let k in i){let $=i[k];if($.required=o.required.includes(k),(f=i[k])!=null&&f.oneOf&&((m=i[k])==null||delete m.oneOf),(_=$.title)!=null&&_.includes("<")&&((L=$.title)!=null&&L.includes(">"))){const b=$.title.split("<")[1].slice(0,-1),et=$.title.split("<")[0];$.type=et,b.includes(":")?$.resource=b.split(":")[1]:$.resource=b}else["asset","entry","assets","entries"].includes($.title)?($.type=$.title,$.resource=null):$.type=$.title;delete i[k].title}return i})}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 o=w({assetID:s}),h=y(`a/${t}/${e}?${o}`,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 o=w(a),h=y(`a/${e}/${s}?${o}`,t),{count:i,total:l,_embedded:f}=yield g(h,{dmShortID:e,token:r});let m=f?f["ec:dm-asset"]:[];return m=Array.isArray(m)?m:[m],{count:i,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:o}){d({env:n,dmShortID:t,assetGroup:e,file:r});const i=y(`a/${t}/${e}`,n),l=new FormData;return l.append("file",r,a),o&&Object.keys(o).forEach(m=>{l.append(m,o[m])}),(yield g(i,{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 o=y(`a/${t}/${e}/${s}`,n);yield g(o,{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:o,_embedded:h}=yield g(r,n);let i=h?h["ec:datamanager"]:[];return i=Array.isArray(i)?i:[i],{count:a,total:o,items:i}})}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:o,total:h,_embedded:i}=yield g(a,n);let l=i?i["ec:model"]:[];return l=Array.isArray(l)?l:[l],{count:o,total:h,items:l}})}function Z(n){return c(this,null,function*(){let{env:t,resource:e,options:s={},subdomain:r="datamanager"}=n;d({env:t,subdomain:r,resource:e}),s=u({size:25,page:1,_list:!0},s);const a=w(s),o=y(`${e}?${a}`,t,r),{count:h,total:i,_embedded:l}=yield g(o,n);let f=l?l[Object.keys(l)[0]]:[];return f=Array.isArray(f)?f:[f],{count:h,total:i,items:f}})}function tt(e){return c(this,arguments,function*(n,t={}){let{env:s,route:r,options:a={},subdomain:o="datamanager"}=n;d({env:s,subdomain:o,route:r}),a=u({},a);const h=w(a),i=y(`${r}?${h}`,s,o);return g(i,n,t)})}const A=Object.freeze(Object.defineProperty({__proto__:null,assetList:H,createAsset:I,createEntry:F,deleteAsset:Q,deleteEntry:U,dmList:X,editEntry:M,entryList:R,getAsset:G,getDatamanager:W,getEcAuthKey:z,getEntry:C,getPublicAuthKey:x,getSchema:V,loginEc:D,loginPublic:q,logoutEc:K,logoutPublic:v,modelList:Y,publicApi:N,raw:tt,resourceList:Z},Symbol.toStringTag,{value:"Module"})),{entryList:ut,getEntry:lt,getAsset:ht,assetList:dt,createAsset:gt,deleteAsset:yt,createEntry:ft,editEntry:pt,deleteEntry:$t,getSchema:mt,loginPublic:wt,loginEc:kt,logoutEc:At,logoutPublic:Et,getEcAuthKey:T,getPublicAuthKey:P,dmList:bt,modelList:Tt,publicApi:Pt,getDatamanager:_t,resourceList:Lt,raw:Ot}=A;function jt(n){const{action:t}=n;if(d({action:t}),!A[t])throw new Error(`"${t}" does not exist! try one of ${Object.keys(A).join(", ")}`);return A[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 ut(p(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 lt(p(u({},this.config),{entryID:t,token:e}))})}getSchema(){return c(this,null,function*(){return mt(this.config)})}assets(t){return c(this,null,function*(){const e=yield this.getBestToken();return dt(p(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 gt(p(u({},this.config),{file:t,name:e,options:s,token:r}))})}deleteAsset(t){return c(this,null,function*(){const e=yield this.getBestToken();return yt(p(u({},this.config),{token:e,assetID:t}))})}getAsset(t){return c(this,null,function*(){const e=yield this.getBestToken();return ht(p(u({},this.config),{assetID:t,token:e}))})}createEntry(t){return c(this,null,function*(){const e=yield this.getBestToken();return ft(p(u({},this.config),{token:e,value:t}))})}editEntry(t,e){return c(this,null,function*(){const s=yield this.getBestToken();return pt(p(u({},this.config),{entryID:t,token:s,value:e}))})}deleteEntry(t){return c(this,null,function*(){const e=yield this.getBestToken();return $t(p(u({},this.config),{token:e,entryID:t}))})}resourceList(t){return c(this,null,function*(){const e=yield this.getBestToken();return Lt(p(u({},this.config),{options:t,token:e}))})}raw(t,e){return c(this,null,function*(){const s=yield this.getBestToken();return Ot(p(u({},this.config),{options:t,token:s}),e)})}authAdapter(t){return this.set({authAdapter:t})}setAuth(t){return e=>{if(!this.config.authAdapter)throw new Error("cannot setAuth: no authAdapter defined!");const{set:s}=this.config.authAdapter;return s(t,e.token),e}}unsetAuth(t){return e=>{if(console.log("unset auth",e),!this.config.authAdapter)throw new Error("cannot unsetAuth: no authAdapter defined!");const{remove:s}=this.config.authAdapter;return s(t),e}}getAuth(t){if(!this.config.authAdapter)throw new Error("cannot getAuth: no authAdapter defined!");const{get:e}=this.config.authAdapter;return e(t)}loginEc(t){return kt(u(u({},this.config),t)).then(this.setAuth(T(this.config)))}loginPublic(t){return wt(u(u({},this.config),t)).then(this.setAuth(P(this.config)))}logoutPublic(){const t=this.getPublicToken();return console.log("token",t),Et(p(u({},this.config),{token:t})).then(this.unsetAuth(P(this.config)))}logoutEc(){const t=this.getEcToken();return console.log("token",t),At(p(u({},this.config),{token:t})).then(this.unsetAuth(T(this.config)))}getPublicToken(){return this.config.token||this.getAuth(P(this.config))}getEcToken(){return this.config.token||this.getAuth(T(this.config))}hasPublicToken(){return!!this.getPublicToken()}hasEcToken(){return!!this.getEcToken()}hasAnyToken(){return!!this.getEcToken()||!!this.getPublicToken()}getBestToken(){try{return this.getEcToken()||this.getPublicToken()}catch(t){return}}model(t){return this.set({model:t})}token(t){return this.set({token:t})}dmShortID(t){return this.set({dmShortID:t})}dmID(t){return this.set({dmID:t})}dm(t){return this.dmShortID(t)}assetGroup(t){return this.set({assetGroup:t})}assetgroup(t){return this.assetGroup(t)}subdomain(t){return this.set({subdomain:t})}resource(t){return this.set({resource:t})}route(t){return this.set({route:t})}publicApi(){return Pt(this.config)}getDatamanager(t){return c(this,null,function*(){const e=yield this.getBestToken();return _t(p(u({},this.config),{dmID:t,token:e}))})}dmList(){return c(this,arguments,function*(t={}){const e=yield this.getBestToken();return bt(p(u({},this.config),{options:t,token:e}))})}modelList(){return c(this,arguments,function*(t={}){const e=yield this.getBestToken();return Tt(p(u({},this.config),{options:t,token:e}))})}}const St=n=>new E({env:n});exports.Sdk=E;exports.act=jt;exports.apiURL=y;exports.assetList=H;exports.createAsset=I;exports.createEntry=F;exports.deleteAsset=Q;exports.deleteEntry=U;exports.dmList=X;exports.editEntry=M;exports.entryList=R;exports.expect=d;exports.fetcher=g;exports.getAsset=G;exports.getDatamanager=W;exports.getEcAuthKey=z;exports.getEntry=C;exports.getPublicAuthKey=x;exports.getSchema=V;exports.loginEc=D;exports.loginPublic=q;exports.logoutEc=K;exports.logoutPublic=v;exports.modelList=Y;exports.publicApi=N;exports.query=w;exports.raw=tt;exports.resourceList=Z;exports.sdk=St;
|
package/dist/index.mjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
var K = Object.defineProperty,
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
1
|
+
var K = Object.defineProperty, v = Object.defineProperties;
|
|
2
|
+
var x = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var O = Object.getOwnPropertySymbols;
|
|
4
|
+
var z = Object.prototype.hasOwnProperty, J = Object.prototype.propertyIsEnumerable;
|
|
5
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
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var e of
|
|
10
|
-
|
|
7
|
+
z.call(t, e) && j(n, e, t[e]);
|
|
8
|
+
if (O)
|
|
9
|
+
for (var e of O(t))
|
|
10
|
+
J.call(t, e) && j(n, e, t[e]);
|
|
11
11
|
return n;
|
|
12
|
-
}, f = (n, t) =>
|
|
12
|
+
}, f = (n, t) => v(n, x(t));
|
|
13
13
|
var a = (n, t, e) => new Promise((s, r) => {
|
|
14
|
-
var c = (
|
|
14
|
+
var c = (i) => {
|
|
15
15
|
try {
|
|
16
|
-
h(e.next(
|
|
16
|
+
h(e.next(i));
|
|
17
17
|
} catch (l) {
|
|
18
18
|
r(l);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, o = (i) => {
|
|
21
21
|
try {
|
|
22
|
-
h(e.throw(
|
|
22
|
+
h(e.throw(i));
|
|
23
23
|
} catch (l) {
|
|
24
24
|
r(l);
|
|
25
25
|
}
|
|
26
|
-
}, h = (
|
|
26
|
+
}, h = (i) => i.done ? s(i.value) : Promise.resolve(i.value).then(c, o);
|
|
27
27
|
h((e = e.apply(n, t)).next());
|
|
28
28
|
});
|
|
29
29
|
function g(s) {
|
|
@@ -33,30 +33,45 @@ function g(s) {
|
|
|
33
33
|
r && (e.headers = f(u({}, e.headers || {}), {
|
|
34
34
|
Authorization: `Bearer ${r}`
|
|
35
35
|
}));
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
38
|
-
if ((h =
|
|
39
|
-
const
|
|
40
|
-
${
|
|
41
|
-
${
|
|
36
|
+
const o = yield fetch(n, e);
|
|
37
|
+
if (!o.ok) {
|
|
38
|
+
if ((h = o.headers.get("content-type")) != null && h.includes("application/json")) {
|
|
39
|
+
const i = yield o.json(), l = `${i.title}
|
|
40
|
+
${i.detail}
|
|
41
|
+
${i.verbose}`;
|
|
42
42
|
throw new Error(l);
|
|
43
43
|
}
|
|
44
|
-
throw new Error(`unexpected fetch error: ${
|
|
44
|
+
throw new Error(`unexpected fetch error: ${o.statusText}`);
|
|
45
45
|
}
|
|
46
|
-
return c ?
|
|
46
|
+
return c ? o : yield o.json();
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
const S = {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
datamanager: {
|
|
51
|
+
live: "https://datamanager.entrecode.de/",
|
|
52
|
+
stage: "https://datamanager.cachena.entrecode.de/"
|
|
53
|
+
},
|
|
54
|
+
accounts: {
|
|
55
|
+
live: "https://accounts.entrecode.de/",
|
|
56
|
+
stage: "https://accounts.cachena.entrecode.de/"
|
|
57
|
+
},
|
|
58
|
+
appserver: {
|
|
59
|
+
live: "https://appserver.entrecode.de/",
|
|
60
|
+
stage: "https://appserver.cachena.entrecode.de/"
|
|
61
|
+
}
|
|
52
62
|
};
|
|
53
|
-
function
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
63
|
+
function p(n, t = "stage", e = "datamanager") {
|
|
64
|
+
const s = S[e];
|
|
65
|
+
if (!s)
|
|
66
|
+
throw new Error(
|
|
67
|
+
`subdomain "${e}" not found. Try one of ${Object.keys(S).join(", ")}`
|
|
68
|
+
);
|
|
69
|
+
const r = s[t];
|
|
70
|
+
if (!r)
|
|
56
71
|
throw new Error(
|
|
57
|
-
`env "${t}" not found. Try one of ${Object.keys(
|
|
72
|
+
`env "${t}" not found. Try one of ${Object.keys(s[t]).join(", ")}`
|
|
58
73
|
);
|
|
59
|
-
return
|
|
74
|
+
return r + n;
|
|
60
75
|
}
|
|
61
76
|
function w(n, t = !0) {
|
|
62
77
|
return Object.entries(n).sort((e, s) => e[0].localeCompare(s[0])).map(([e, s]) => `${e}=${s}`).join("&");
|
|
@@ -71,11 +86,11 @@ const B = {
|
|
|
71
86
|
stage: "https://accounts.cachena.entrecode.de/",
|
|
72
87
|
live: "https://accounts.entrecode.de/"
|
|
73
88
|
};
|
|
74
|
-
function
|
|
89
|
+
function N(n) {
|
|
75
90
|
return a(this, null, function* () {
|
|
76
91
|
let { env: t, dmShortID: e, email: s, password: r } = n;
|
|
77
92
|
d({ env: t, dmShortID: e, email: s, password: r });
|
|
78
|
-
const c =
|
|
93
|
+
const c = p(`api/${e}/_auth/login?clientID=rest`, t);
|
|
79
94
|
return yield g(
|
|
80
95
|
c,
|
|
81
96
|
{},
|
|
@@ -89,7 +104,7 @@ function C(n) {
|
|
|
89
104
|
);
|
|
90
105
|
});
|
|
91
106
|
}
|
|
92
|
-
function
|
|
107
|
+
function C(n) {
|
|
93
108
|
return a(this, null, function* () {
|
|
94
109
|
let { env: t, email: e, password: s } = n;
|
|
95
110
|
d({ env: t, email: e, password: s });
|
|
@@ -107,11 +122,11 @@ function R(n) {
|
|
|
107
122
|
);
|
|
108
123
|
});
|
|
109
124
|
}
|
|
110
|
-
function
|
|
125
|
+
function R(n) {
|
|
111
126
|
return a(this, null, function* () {
|
|
112
127
|
let { dmShortID: t, env: e, token: s } = n;
|
|
113
128
|
d({ dmShortID: t, env: e, token: s });
|
|
114
|
-
const r =
|
|
129
|
+
const r = p(
|
|
115
130
|
`api/${t}/_auth/logout?clientID=rest&token=${s}`,
|
|
116
131
|
e
|
|
117
132
|
);
|
|
@@ -124,7 +139,7 @@ function F(n) {
|
|
|
124
139
|
);
|
|
125
140
|
});
|
|
126
141
|
}
|
|
127
|
-
function
|
|
142
|
+
function F(n) {
|
|
128
143
|
return a(this, null, function* () {
|
|
129
144
|
let { env: t, token: e } = n;
|
|
130
145
|
d({ env: t, token: e });
|
|
@@ -141,10 +156,10 @@ function M(n) {
|
|
|
141
156
|
);
|
|
142
157
|
});
|
|
143
158
|
}
|
|
144
|
-
function
|
|
159
|
+
function M({ dmShortID: n }) {
|
|
145
160
|
return d({ dmShortID: n }), n;
|
|
146
161
|
}
|
|
147
|
-
function
|
|
162
|
+
function U({ env: n }) {
|
|
148
163
|
return d({ env: n }), n;
|
|
149
164
|
}
|
|
150
165
|
let V = [
|
|
@@ -176,7 +191,7 @@ function H(n) {
|
|
|
176
191
|
return a(this, null, function* () {
|
|
177
192
|
let { env: t, dmShortID: e } = n;
|
|
178
193
|
d({ env: t, dmShortID: e });
|
|
179
|
-
const s =
|
|
194
|
+
const s = p(`api/${e}`, t);
|
|
180
195
|
return g(s, n);
|
|
181
196
|
});
|
|
182
197
|
}
|
|
@@ -184,22 +199,22 @@ function I(n) {
|
|
|
184
199
|
return a(this, null, function* () {
|
|
185
200
|
let { env: t, dmShortID: e, model: s, options: r = {} } = n;
|
|
186
201
|
d({ env: t, dmShortID: e, model: s }), r = u({ size: 50, page: 1, _list: !0 }, r);
|
|
187
|
-
const c = w(r),
|
|
188
|
-
let
|
|
189
|
-
return
|
|
202
|
+
const c = w(r), o = p(`api/${e}/${s}?${c}`, t), { count: h, total: i, _embedded: l } = yield g(o, n);
|
|
203
|
+
let y = l ? l[`${e}:${s}`] : [];
|
|
204
|
+
return y = Array.isArray(y) ? y : [y], { count: h, total: i, items: y };
|
|
190
205
|
});
|
|
191
206
|
}
|
|
192
207
|
function Q({ env: n, dmShortID: t, model: e, entryID: s, token: r }) {
|
|
193
208
|
d({ env: n, dmShortID: t, model: e, entryID: s });
|
|
194
|
-
const c = w({ _id: s }),
|
|
195
|
-
return g(
|
|
209
|
+
const c = w({ _id: s }), o = p(`api/${t}/${e}?${c}`, n);
|
|
210
|
+
return g(o, { dmShortID: t, token: r });
|
|
196
211
|
}
|
|
197
212
|
function W(c) {
|
|
198
213
|
return a(this, arguments, function* ({ env: n, dmShortID: t, model: e, value: s, token: r }) {
|
|
199
214
|
d({ env: n, dmShortID: t, model: e, value: s });
|
|
200
|
-
const
|
|
215
|
+
const o = p(`api/${t}/${e}`, n);
|
|
201
216
|
return yield g(
|
|
202
|
-
|
|
217
|
+
o,
|
|
203
218
|
{ env: n, dmShortID: t, token: r },
|
|
204
219
|
{
|
|
205
220
|
method: "POST",
|
|
@@ -211,7 +226,7 @@ function W(c) {
|
|
|
211
226
|
);
|
|
212
227
|
});
|
|
213
228
|
}
|
|
214
|
-
function X(
|
|
229
|
+
function X(o) {
|
|
215
230
|
return a(this, arguments, function* ({
|
|
216
231
|
env: n,
|
|
217
232
|
dmShortID: t,
|
|
@@ -221,7 +236,7 @@ function X(i) {
|
|
|
221
236
|
token: c
|
|
222
237
|
}) {
|
|
223
238
|
d({ env: n, dmShortID: t, model: e, entryID: s, value: r });
|
|
224
|
-
const h =
|
|
239
|
+
const h = p(`api/${t}/${e}?_id=${s}`, n);
|
|
225
240
|
return r = G(r), r = q(r), yield g(
|
|
226
241
|
h,
|
|
227
242
|
{ token: c },
|
|
@@ -238,9 +253,9 @@ function X(i) {
|
|
|
238
253
|
function Y(c) {
|
|
239
254
|
return a(this, arguments, function* ({ env: n, dmShortID: t, model: e, entryID: s, token: r }) {
|
|
240
255
|
d({ env: n, dmShortID: t, model: e, entryID: s });
|
|
241
|
-
const
|
|
256
|
+
const o = p(`api/${t}/${e}?_id=${s}`, n);
|
|
242
257
|
yield g(
|
|
243
|
-
|
|
258
|
+
o,
|
|
244
259
|
{ token: r, rawRes: !0 },
|
|
245
260
|
{
|
|
246
261
|
method: "DELETE",
|
|
@@ -253,30 +268,30 @@ function Y(c) {
|
|
|
253
268
|
}
|
|
254
269
|
function Z(s) {
|
|
255
270
|
return a(this, arguments, function* ({ env: n, dmShortID: t, model: e }) {
|
|
256
|
-
var l,
|
|
271
|
+
var l, y, m, P, L;
|
|
257
272
|
d({ env: n, dmShortID: t, model: e });
|
|
258
|
-
const r =
|
|
259
|
-
if (typeof
|
|
273
|
+
const r = p(`api/schema/${t}/${e}`, n), c = yield g(r), o = (l = c == null ? void 0 : c.allOf) == null ? void 0 : l[1];
|
|
274
|
+
if (typeof o.properties != "object")
|
|
260
275
|
throw new Error(
|
|
261
276
|
`getSchema: ${r} returned unexpected format: ${JSON.stringify(c)}`
|
|
262
277
|
);
|
|
263
|
-
const { properties: h } =
|
|
264
|
-
for (let
|
|
265
|
-
let
|
|
266
|
-
if (
|
|
267
|
-
const
|
|
268
|
-
|
|
278
|
+
const { properties: h } = o, i = q(h);
|
|
279
|
+
for (let k in i) {
|
|
280
|
+
let $ = i[k];
|
|
281
|
+
if ($.required = o.required.includes(k), (y = i[k]) != null && y.oneOf && ((m = i[k]) == null || delete m.oneOf), (P = $.title) != null && P.includes("<") && ((L = $.title) != null && L.includes(">"))) {
|
|
282
|
+
const E = $.title.split("<")[1].slice(0, -1), D = $.title.split("<")[0];
|
|
283
|
+
$.type = D, E.includes(":") ? $.resource = E.split(":")[1] : $.resource = E;
|
|
269
284
|
} else
|
|
270
|
-
["asset", "entry", "assets", "entries"].includes(
|
|
271
|
-
delete
|
|
285
|
+
["asset", "entry", "assets", "entries"].includes($.title) ? ($.type = $.title, $.resource = null) : $.type = $.title;
|
|
286
|
+
delete i[k].title;
|
|
272
287
|
}
|
|
273
|
-
return
|
|
288
|
+
return i;
|
|
274
289
|
});
|
|
275
290
|
}
|
|
276
291
|
function tt(c) {
|
|
277
292
|
return a(this, arguments, function* ({ env: n, dmShortID: t, assetGroup: e, assetID: s, token: r }) {
|
|
278
293
|
d({ env: n, dmShortID: t, assetGroup: e, assetID: s });
|
|
279
|
-
const
|
|
294
|
+
const o = w({ assetID: s }), h = p(`a/${t}/${e}?${o}`, n);
|
|
280
295
|
return (yield g(h, { dmShortID: t, token: r }))._embedded["ec:dm-asset"];
|
|
281
296
|
});
|
|
282
297
|
}
|
|
@@ -284,9 +299,9 @@ function et(n) {
|
|
|
284
299
|
return a(this, null, function* () {
|
|
285
300
|
let { env: t, dmShortID: e, assetGroup: s, token: r, options: c = {} } = n;
|
|
286
301
|
d({ env: t, dmShortID: e, assetGroup: s }), c = u({ size: 50, page: 1, _list: !0 }, c);
|
|
287
|
-
const
|
|
288
|
-
let m =
|
|
289
|
-
return m = Array.isArray(m) ? m : [m], { count:
|
|
302
|
+
const o = w(c), h = p(`a/${e}/${s}?${o}`, t), { count: i, total: l, _embedded: y } = yield g(h, { dmShortID: e, token: r });
|
|
303
|
+
let m = y ? y["ec:dm-asset"] : [];
|
|
304
|
+
return m = Array.isArray(m) ? m : [m], { count: i, total: l, items: m };
|
|
290
305
|
});
|
|
291
306
|
}
|
|
292
307
|
function nt(h) {
|
|
@@ -297,14 +312,14 @@ function nt(h) {
|
|
|
297
312
|
token: s,
|
|
298
313
|
file: r,
|
|
299
314
|
name: c,
|
|
300
|
-
options:
|
|
315
|
+
options: o
|
|
301
316
|
}) {
|
|
302
317
|
d({ env: n, dmShortID: t, assetGroup: e, file: r });
|
|
303
|
-
const
|
|
304
|
-
return l.append("file", r, c),
|
|
305
|
-
l.append(m,
|
|
318
|
+
const i = p(`a/${t}/${e}`, n), l = new FormData();
|
|
319
|
+
return l.append("file", r, c), o && Object.keys(o).forEach((m) => {
|
|
320
|
+
l.append(m, o[m]);
|
|
306
321
|
}), (yield g(
|
|
307
|
-
|
|
322
|
+
i,
|
|
308
323
|
{ token: s },
|
|
309
324
|
{
|
|
310
325
|
method: "POST",
|
|
@@ -322,9 +337,9 @@ function st(c) {
|
|
|
322
337
|
token: r
|
|
323
338
|
}) {
|
|
324
339
|
d({ env: n, dmShortID: t, assetGroup: e, assetID: s });
|
|
325
|
-
const
|
|
340
|
+
const o = p(`a/${t}/${e}/${s}`, n);
|
|
326
341
|
yield g(
|
|
327
|
-
|
|
342
|
+
o,
|
|
328
343
|
{ token: r, rawRes: !0 },
|
|
329
344
|
{
|
|
330
345
|
method: "DELETE"
|
|
@@ -336,88 +351,109 @@ function rt(n) {
|
|
|
336
351
|
return a(this, null, function* () {
|
|
337
352
|
let { env: t, dmID: e, token: s } = n;
|
|
338
353
|
d({ env: t, dmID: e });
|
|
339
|
-
const r =
|
|
354
|
+
const r = p(`?dataManagerID=${e}`, t);
|
|
340
355
|
return g(r, { token: s });
|
|
341
356
|
});
|
|
342
357
|
}
|
|
343
|
-
function
|
|
358
|
+
function ot(n) {
|
|
344
359
|
return a(this, null, function* () {
|
|
345
360
|
let { env: t, options: e = {} } = n;
|
|
346
361
|
d({ env: t }), e = u({ size: 25, page: 1, _list: !0 }, e);
|
|
347
|
-
const s = w(e), r =
|
|
348
|
-
let
|
|
349
|
-
return
|
|
362
|
+
const s = w(e), r = p(`?${s}`, t), { count: c, total: o, _embedded: h } = yield g(r, n);
|
|
363
|
+
let i = h ? h["ec:datamanager"] : [];
|
|
364
|
+
return i = Array.isArray(i) ? i : [i], { count: c, total: o, items: i };
|
|
350
365
|
});
|
|
351
366
|
}
|
|
352
|
-
function
|
|
367
|
+
function it(n) {
|
|
353
368
|
return a(this, null, function* () {
|
|
354
369
|
let { env: t, dmID: e, options: s = {} } = n;
|
|
355
370
|
d({ env: t, dmID: e }), s = u({ size: 25, dataManagerID: e, page: 1, _list: !0 }, s);
|
|
356
|
-
const r = w(s), c =
|
|
357
|
-
let l =
|
|
358
|
-
return l = Array.isArray(l) ? l : [l], { count:
|
|
371
|
+
const r = w(s), c = p(`model?${r}`, t), { count: o, total: h, _embedded: i } = yield g(c, n);
|
|
372
|
+
let l = i ? i["ec:model"] : [];
|
|
373
|
+
return l = Array.isArray(l) ? l : [l], { count: o, total: h, items: l };
|
|
359
374
|
});
|
|
360
375
|
}
|
|
361
|
-
|
|
376
|
+
function at(n) {
|
|
377
|
+
return a(this, null, function* () {
|
|
378
|
+
let { env: t, resource: e, options: s = {}, subdomain: r = "datamanager" } = n;
|
|
379
|
+
d({ env: t, subdomain: r, resource: e }), s = u({ size: 25, page: 1, _list: !0 }, s);
|
|
380
|
+
const c = w(s), o = p(`${e}?${c}`, t, r), { count: h, total: i, _embedded: l } = yield g(o, n);
|
|
381
|
+
let y = l ? l[Object.keys(l)[0]] : [];
|
|
382
|
+
return y = Array.isArray(y) ? y : [y], { count: h, total: i, items: y };
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
function ct(e) {
|
|
386
|
+
return a(this, arguments, function* (n, t = {}) {
|
|
387
|
+
let { env: s, route: r, options: c = {}, subdomain: o = "datamanager" } = n;
|
|
388
|
+
d({ env: s, subdomain: o, route: r }), c = u({}, c);
|
|
389
|
+
const h = w(c), i = p(`${r}?${h}`, s, o);
|
|
390
|
+
return g(i, n, t);
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
const A = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
362
394
|
__proto__: null,
|
|
363
395
|
assetList: et,
|
|
364
396
|
createAsset: nt,
|
|
365
397
|
createEntry: W,
|
|
366
398
|
deleteAsset: st,
|
|
367
399
|
deleteEntry: Y,
|
|
368
|
-
dmList:
|
|
400
|
+
dmList: ot,
|
|
369
401
|
editEntry: X,
|
|
370
402
|
entryList: I,
|
|
371
403
|
getAsset: tt,
|
|
372
404
|
getDatamanager: rt,
|
|
373
|
-
getEcAuthKey:
|
|
405
|
+
getEcAuthKey: U,
|
|
374
406
|
getEntry: Q,
|
|
375
|
-
getPublicAuthKey:
|
|
407
|
+
getPublicAuthKey: M,
|
|
376
408
|
getSchema: Z,
|
|
377
|
-
loginEc:
|
|
378
|
-
loginPublic:
|
|
379
|
-
logoutEc:
|
|
380
|
-
logoutPublic:
|
|
381
|
-
modelList:
|
|
382
|
-
publicApi: H
|
|
409
|
+
loginEc: C,
|
|
410
|
+
loginPublic: N,
|
|
411
|
+
logoutEc: F,
|
|
412
|
+
logoutPublic: R,
|
|
413
|
+
modelList: it,
|
|
414
|
+
publicApi: H,
|
|
415
|
+
raw: ct,
|
|
416
|
+
resourceList: at
|
|
383
417
|
}, Symbol.toStringTag, { value: "Module" })), {
|
|
384
|
-
entryList:
|
|
385
|
-
getEntry:
|
|
386
|
-
getAsset:
|
|
387
|
-
assetList:
|
|
388
|
-
createAsset:
|
|
389
|
-
deleteAsset:
|
|
390
|
-
createEntry:
|
|
391
|
-
editEntry:
|
|
392
|
-
deleteEntry:
|
|
393
|
-
getSchema:
|
|
394
|
-
loginPublic:
|
|
395
|
-
loginEc:
|
|
396
|
-
logoutEc:
|
|
397
|
-
logoutPublic:
|
|
418
|
+
entryList: ut,
|
|
419
|
+
getEntry: lt,
|
|
420
|
+
getAsset: ht,
|
|
421
|
+
assetList: dt,
|
|
422
|
+
createAsset: gt,
|
|
423
|
+
deleteAsset: yt,
|
|
424
|
+
createEntry: ft,
|
|
425
|
+
editEntry: pt,
|
|
426
|
+
deleteEntry: $t,
|
|
427
|
+
getSchema: mt,
|
|
428
|
+
loginPublic: wt,
|
|
429
|
+
loginEc: kt,
|
|
430
|
+
logoutEc: At,
|
|
431
|
+
logoutPublic: Et,
|
|
398
432
|
getEcAuthKey: b,
|
|
399
433
|
getPublicAuthKey: T,
|
|
400
|
-
dmList:
|
|
401
|
-
modelList:
|
|
402
|
-
publicApi:
|
|
403
|
-
getDatamanager:
|
|
404
|
-
|
|
405
|
-
|
|
434
|
+
dmList: bt,
|
|
435
|
+
modelList: Tt,
|
|
436
|
+
publicApi: _t,
|
|
437
|
+
getDatamanager: Pt,
|
|
438
|
+
resourceList: Lt,
|
|
439
|
+
raw: Ot
|
|
440
|
+
} = A;
|
|
441
|
+
function St(n) {
|
|
406
442
|
const { action: t } = n;
|
|
407
|
-
if (d({ action: t }), !
|
|
443
|
+
if (d({ action: t }), !A[t])
|
|
408
444
|
throw new Error(
|
|
409
|
-
`"${t}" does not exist! try one of ${Object.keys(
|
|
445
|
+
`"${t}" does not exist! try one of ${Object.keys(A).join(
|
|
410
446
|
", "
|
|
411
447
|
)}`
|
|
412
448
|
);
|
|
413
|
-
return
|
|
449
|
+
return A[t](n);
|
|
414
450
|
}
|
|
415
|
-
class
|
|
451
|
+
class _ {
|
|
416
452
|
constructor(t) {
|
|
417
453
|
this.config = t;
|
|
418
454
|
}
|
|
419
455
|
set(t) {
|
|
420
|
-
return new
|
|
456
|
+
return new _(u(u({}, this.config), t));
|
|
421
457
|
}
|
|
422
458
|
/**
|
|
423
459
|
* Loads entry list. Expects `dmShortID` / `model` to be set.
|
|
@@ -435,7 +471,7 @@ class P {
|
|
|
435
471
|
entries() {
|
|
436
472
|
return a(this, arguments, function* (t = {}) {
|
|
437
473
|
const e = yield this.getBestToken();
|
|
438
|
-
return
|
|
474
|
+
return ut(f(u({}, this.config), { options: t, token: e }));
|
|
439
475
|
});
|
|
440
476
|
}
|
|
441
477
|
entryList(t) {
|
|
@@ -455,7 +491,7 @@ class P {
|
|
|
455
491
|
getEntry(t) {
|
|
456
492
|
return a(this, null, function* () {
|
|
457
493
|
const e = yield this.getBestToken();
|
|
458
|
-
return
|
|
494
|
+
return lt(f(u({}, this.config), { entryID: t, token: e }));
|
|
459
495
|
});
|
|
460
496
|
}
|
|
461
497
|
/**
|
|
@@ -468,7 +504,7 @@ class P {
|
|
|
468
504
|
*/
|
|
469
505
|
getSchema() {
|
|
470
506
|
return a(this, null, function* () {
|
|
471
|
-
return
|
|
507
|
+
return mt(this.config);
|
|
472
508
|
});
|
|
473
509
|
}
|
|
474
510
|
/**
|
|
@@ -487,7 +523,7 @@ class P {
|
|
|
487
523
|
assets(t) {
|
|
488
524
|
return a(this, null, function* () {
|
|
489
525
|
const e = yield this.getBestToken();
|
|
490
|
-
return
|
|
526
|
+
return dt(f(u({}, this.config), { options: t, token: e }));
|
|
491
527
|
});
|
|
492
528
|
}
|
|
493
529
|
assetList(t) {
|
|
@@ -519,7 +555,7 @@ class P {
|
|
|
519
555
|
createAsset() {
|
|
520
556
|
return a(this, arguments, function* ({ file: t, name: e, options: s } = {}) {
|
|
521
557
|
const r = yield this.getBestToken();
|
|
522
|
-
return
|
|
558
|
+
return gt(f(u({}, this.config), { file: t, name: e, options: s, token: r }));
|
|
523
559
|
});
|
|
524
560
|
}
|
|
525
561
|
/**
|
|
@@ -534,7 +570,7 @@ class P {
|
|
|
534
570
|
deleteAsset(t) {
|
|
535
571
|
return a(this, null, function* () {
|
|
536
572
|
const e = yield this.getBestToken();
|
|
537
|
-
return
|
|
573
|
+
return yt(f(u({}, this.config), { token: e, assetID: t }));
|
|
538
574
|
});
|
|
539
575
|
}
|
|
540
576
|
/**
|
|
@@ -549,7 +585,7 @@ class P {
|
|
|
549
585
|
getAsset(t) {
|
|
550
586
|
return a(this, null, function* () {
|
|
551
587
|
const e = yield this.getBestToken();
|
|
552
|
-
return
|
|
588
|
+
return ht(f(u({}, this.config), { assetID: t, token: e }));
|
|
553
589
|
});
|
|
554
590
|
}
|
|
555
591
|
/**
|
|
@@ -564,7 +600,7 @@ class P {
|
|
|
564
600
|
createEntry(t) {
|
|
565
601
|
return a(this, null, function* () {
|
|
566
602
|
const e = yield this.getBestToken();
|
|
567
|
-
return
|
|
603
|
+
return ft(f(u({}, this.config), { token: e, value: t }));
|
|
568
604
|
});
|
|
569
605
|
}
|
|
570
606
|
/**
|
|
@@ -580,7 +616,7 @@ class P {
|
|
|
580
616
|
editEntry(t, e) {
|
|
581
617
|
return a(this, null, function* () {
|
|
582
618
|
const s = yield this.getBestToken();
|
|
583
|
-
return
|
|
619
|
+
return pt(f(u({}, this.config), { entryID: t, token: s, value: e }));
|
|
584
620
|
});
|
|
585
621
|
}
|
|
586
622
|
/**
|
|
@@ -595,7 +631,39 @@ class P {
|
|
|
595
631
|
deleteEntry(t) {
|
|
596
632
|
return a(this, null, function* () {
|
|
597
633
|
const e = yield this.getBestToken();
|
|
598
|
-
return
|
|
634
|
+
return $t(f(u({}, this.config), { token: e, entryID: t }));
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Fetches resource list. Expects `resource` to be set. `subdomain` defaults to "datamanager".
|
|
639
|
+
* Fetches `https://<subdomain>.entrecode.de/<resource>?_list=true&size=<options.size ?? 25>`
|
|
640
|
+
*
|
|
641
|
+
* @param {object=} options options for list request.
|
|
642
|
+
* @returns {Promise<ResourceList>}
|
|
643
|
+
* @example
|
|
644
|
+
* const res = await sdk("stage").resource("template").resourceList()
|
|
645
|
+
*/
|
|
646
|
+
resourceList(t) {
|
|
647
|
+
return a(this, null, function* () {
|
|
648
|
+
const e = yield this.getBestToken();
|
|
649
|
+
return Lt(f(u({}, this.config), { options: t, token: e }));
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Fetches raw route. Expects `route` to be set. `subdomain` defaults to "datamanager".
|
|
654
|
+
* Fetches `https://<subdomain>.entrecode.de/<route>?<options>`
|
|
655
|
+
* Use this when no other fdk method can give you your request.
|
|
656
|
+
*
|
|
657
|
+
* @param {object=} options options for list request.
|
|
658
|
+
* @param {object=} fetchOptions (optional) options passed to fetch.
|
|
659
|
+
* @returns {Promise<any>}
|
|
660
|
+
* @example
|
|
661
|
+
* const res = await sdk("stage").route("stats").raw()
|
|
662
|
+
*/
|
|
663
|
+
raw(t, e) {
|
|
664
|
+
return a(this, null, function* () {
|
|
665
|
+
const s = yield this.getBestToken();
|
|
666
|
+
return Ot(f(u({}, this.config), { options: t, token: s }), e);
|
|
599
667
|
});
|
|
600
668
|
}
|
|
601
669
|
// TODO: rename authAdapter -> storageAdapter
|
|
@@ -625,24 +693,24 @@ class P {
|
|
|
625
693
|
return e(t);
|
|
626
694
|
}
|
|
627
695
|
loginEc(t) {
|
|
628
|
-
return
|
|
696
|
+
return kt(u(u({}, this.config), t)).then(
|
|
629
697
|
this.setAuth(b(this.config))
|
|
630
698
|
);
|
|
631
699
|
}
|
|
632
700
|
loginPublic(t) {
|
|
633
|
-
return
|
|
701
|
+
return wt(u(u({}, this.config), t)).then(
|
|
634
702
|
this.setAuth(T(this.config))
|
|
635
703
|
);
|
|
636
704
|
}
|
|
637
705
|
logoutPublic() {
|
|
638
706
|
const t = this.getPublicToken();
|
|
639
|
-
return console.log("token", t),
|
|
707
|
+
return console.log("token", t), Et(f(u({}, this.config), { token: t })).then(
|
|
640
708
|
this.unsetAuth(T(this.config))
|
|
641
709
|
);
|
|
642
710
|
}
|
|
643
711
|
logoutEc() {
|
|
644
712
|
const t = this.getEcToken();
|
|
645
|
-
return console.log("token", t),
|
|
713
|
+
return console.log("token", t), At(f(u({}, this.config), { token: t })).then(
|
|
646
714
|
this.unsetAuth(b(this.config))
|
|
647
715
|
);
|
|
648
716
|
}
|
|
@@ -724,12 +792,36 @@ class P {
|
|
|
724
792
|
assetgroup(t) {
|
|
725
793
|
return this.assetGroup(t);
|
|
726
794
|
}
|
|
795
|
+
/**
|
|
796
|
+
* Sets the subdomain to use.
|
|
797
|
+
* @param {string} subdomain subdomain
|
|
798
|
+
* @returns Sdk
|
|
799
|
+
*/
|
|
800
|
+
subdomain(t) {
|
|
801
|
+
return this.set({ subdomain: t });
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* Sets the name of the resource to use.
|
|
805
|
+
* @param {string} resource name of the resource
|
|
806
|
+
* @returns Sdk
|
|
807
|
+
*/
|
|
808
|
+
resource(t) {
|
|
809
|
+
return this.set({ resource: t });
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* Sets the route to use.
|
|
813
|
+
* @param {string} route route
|
|
814
|
+
* @returns Sdk
|
|
815
|
+
*/
|
|
816
|
+
route(t) {
|
|
817
|
+
return this.set({ route: t });
|
|
818
|
+
}
|
|
727
819
|
/**
|
|
728
820
|
* Returns the public api root endpoint. Expects dmShortID to be set.
|
|
729
821
|
* @returns any
|
|
730
822
|
*/
|
|
731
823
|
publicApi() {
|
|
732
|
-
return
|
|
824
|
+
return _t(this.config);
|
|
733
825
|
}
|
|
734
826
|
/**
|
|
735
827
|
* Loads a DatamanagerResource by its long id. Requires token.
|
|
@@ -738,7 +830,7 @@ class P {
|
|
|
738
830
|
getDatamanager(t) {
|
|
739
831
|
return a(this, null, function* () {
|
|
740
832
|
const e = yield this.getBestToken();
|
|
741
|
-
return
|
|
833
|
+
return Pt(f(u({}, this.config), { dmID: t, token: e }));
|
|
742
834
|
});
|
|
743
835
|
}
|
|
744
836
|
/**
|
|
@@ -752,7 +844,7 @@ class P {
|
|
|
752
844
|
dmList() {
|
|
753
845
|
return a(this, arguments, function* (t = {}) {
|
|
754
846
|
const e = yield this.getBestToken();
|
|
755
|
-
return
|
|
847
|
+
return bt(f(u({}, this.config), { options: t, token: e }));
|
|
756
848
|
});
|
|
757
849
|
}
|
|
758
850
|
/**
|
|
@@ -766,37 +858,39 @@ class P {
|
|
|
766
858
|
modelList() {
|
|
767
859
|
return a(this, arguments, function* (t = {}) {
|
|
768
860
|
const e = yield this.getBestToken();
|
|
769
|
-
return
|
|
861
|
+
return Tt(f(u({}, this.config), { options: t, token: e }));
|
|
770
862
|
});
|
|
771
863
|
}
|
|
772
864
|
}
|
|
773
|
-
const
|
|
865
|
+
const Bt = (n) => new _({ env: n });
|
|
774
866
|
export {
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
867
|
+
_ as Sdk,
|
|
868
|
+
St as act,
|
|
869
|
+
p as apiURL,
|
|
778
870
|
et as assetList,
|
|
779
871
|
nt as createAsset,
|
|
780
872
|
W as createEntry,
|
|
781
873
|
st as deleteAsset,
|
|
782
874
|
Y as deleteEntry,
|
|
783
|
-
|
|
875
|
+
ot as dmList,
|
|
784
876
|
X as editEntry,
|
|
785
877
|
I as entryList,
|
|
786
878
|
d as expect,
|
|
787
879
|
g as fetcher,
|
|
788
880
|
tt as getAsset,
|
|
789
881
|
rt as getDatamanager,
|
|
790
|
-
|
|
882
|
+
U as getEcAuthKey,
|
|
791
883
|
Q as getEntry,
|
|
792
|
-
|
|
884
|
+
M as getPublicAuthKey,
|
|
793
885
|
Z as getSchema,
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
886
|
+
C as loginEc,
|
|
887
|
+
N as loginPublic,
|
|
888
|
+
F as logoutEc,
|
|
889
|
+
R as logoutPublic,
|
|
890
|
+
it as modelList,
|
|
799
891
|
H as publicApi,
|
|
800
892
|
w as query,
|
|
801
|
-
|
|
893
|
+
ct as raw,
|
|
894
|
+
at as resourceList,
|
|
895
|
+
Bt as sdk
|
|
802
896
|
};
|
package/dist/lib/admin.d.mts
CHANGED
|
@@ -9,4 +9,10 @@ export function modelList(config: any): Promise<{
|
|
|
9
9
|
total: any;
|
|
10
10
|
items: any;
|
|
11
11
|
}>;
|
|
12
|
+
export function resourceList(config: any): Promise<{
|
|
13
|
+
count: any;
|
|
14
|
+
total: any;
|
|
15
|
+
items: any;
|
|
16
|
+
}>;
|
|
17
|
+
export function raw(config: any, fetchOptions?: {}): Promise<any>;
|
|
12
18
|
//# sourceMappingURL=admin.d.mts.map
|
package/dist/lib/admin.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.d.mts","sourceRoot":"","sources":["../../src/lib/admin.mjs"],"names":[],"mappings":"AAEA,0DAMC;AAED;;;;GAYC;AAED;;;;GAWC"}
|
|
1
|
+
{"version":3,"file":"admin.d.mts","sourceRoot":"","sources":["../../src/lib/admin.mjs"],"names":[],"mappings":"AAEA,0DAMC;AAED;;;;GAYC;AAED;;;;GAWC;AAED;;;;GAWC;AAED,kEAQC"}
|
package/dist/lib/api.d.mts
CHANGED
|
@@ -133,6 +133,28 @@ export class Sdk {
|
|
|
133
133
|
* await sdk("stage").dm("83cc6374").model("muffin").deleteEntry("1gOtzWvrdq")
|
|
134
134
|
*/
|
|
135
135
|
deleteEntry(entryID: string): void;
|
|
136
|
+
/**
|
|
137
|
+
* Fetches resource list. Expects `resource` to be set. `subdomain` defaults to "datamanager".
|
|
138
|
+
* Fetches `https://<subdomain>.entrecode.de/<resource>?_list=true&size=<options.size ?? 25>`
|
|
139
|
+
*
|
|
140
|
+
* @param {object=} options options for list request.
|
|
141
|
+
* @returns {Promise<ResourceList>}
|
|
142
|
+
* @example
|
|
143
|
+
* const res = await sdk("stage").resource("template").resourceList()
|
|
144
|
+
*/
|
|
145
|
+
resourceList(options?: object | undefined): Promise<ResourceList>;
|
|
146
|
+
/**
|
|
147
|
+
* Fetches raw route. Expects `route` to be set. `subdomain` defaults to "datamanager".
|
|
148
|
+
* Fetches `https://<subdomain>.entrecode.de/<route>?<options>`
|
|
149
|
+
* Use this when no other fdk method can give you your request.
|
|
150
|
+
*
|
|
151
|
+
* @param {object=} options options for list request.
|
|
152
|
+
* @param {object=} fetchOptions (optional) options passed to fetch.
|
|
153
|
+
* @returns {Promise<any>}
|
|
154
|
+
* @example
|
|
155
|
+
* const res = await sdk("stage").route("stats").raw()
|
|
156
|
+
*/
|
|
157
|
+
raw(options?: object | undefined, fetchOptions?: object | undefined): Promise<any>;
|
|
136
158
|
authAdapter(authAdapter: any): Sdk;
|
|
137
159
|
setAuth(key: any): (auth: any) => any;
|
|
138
160
|
unsetAuth(key: any): (auth: any) => any;
|
|
@@ -189,6 +211,24 @@ export class Sdk {
|
|
|
189
211
|
* @returns Sdk
|
|
190
212
|
*/
|
|
191
213
|
assetgroup(assetGroup: string): Sdk;
|
|
214
|
+
/**
|
|
215
|
+
* Sets the subdomain to use.
|
|
216
|
+
* @param {string} subdomain subdomain
|
|
217
|
+
* @returns Sdk
|
|
218
|
+
*/
|
|
219
|
+
subdomain(subdomain: string): Sdk;
|
|
220
|
+
/**
|
|
221
|
+
* Sets the name of the resource to use.
|
|
222
|
+
* @param {string} resource name of the resource
|
|
223
|
+
* @returns Sdk
|
|
224
|
+
*/
|
|
225
|
+
resource(resource: string): Sdk;
|
|
226
|
+
/**
|
|
227
|
+
* Sets the route to use.
|
|
228
|
+
* @param {string} route route
|
|
229
|
+
* @returns Sdk
|
|
230
|
+
*/
|
|
231
|
+
route(route: string): Sdk;
|
|
192
232
|
/**
|
|
193
233
|
* Returns the public api root endpoint. Expects dmShortID to be set.
|
|
194
234
|
* @returns any
|
|
@@ -340,6 +380,11 @@ export type AssetList = {
|
|
|
340
380
|
total: number;
|
|
341
381
|
items: AssetResource[];
|
|
342
382
|
};
|
|
383
|
+
export type ResourceList = {
|
|
384
|
+
count: number;
|
|
385
|
+
total: number;
|
|
386
|
+
items: any[];
|
|
387
|
+
};
|
|
343
388
|
/**
|
|
344
389
|
* // config: {} ?
|
|
345
390
|
*/
|
package/dist/lib/api.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.mts","sourceRoot":"","sources":["../../src/lib/api.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.d.mts","sourceRoot":"","sources":["../../src/lib/api.mjs"],"names":[],"mappings":"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"}
|
package/dist/lib/util.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function fetcher(url: any, config?: {}, options?: {}): Promise<any>;
|
|
2
|
-
export function apiURL(route: any, env?: string): any;
|
|
2
|
+
export function apiURL(route: any, env?: string, subdomain?: string): any;
|
|
3
3
|
export function query(params: any, sort?: boolean): any;
|
|
4
4
|
export function expect(obj: any): void;
|
|
5
5
|
//# sourceMappingURL=util.d.mts.map
|
package/dist/lib/util.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.mts","sourceRoot":"","sources":["../../src/lib/util.mjs"],"names":[],"mappings":"AAAA,2EAsBC;
|
|
1
|
+
{"version":3,"file":"util.d.mts","sourceRoot":"","sources":["../../src/lib/util.mjs"],"names":[],"mappings":"AAAA,2EAsBC;AAiBD,0EAcC;AAED,wDAKC;AAED,uCAMC"}
|