ec.fdk 0.6.4 → 0.6.5

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.
Files changed (57) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs +3 -3
  3. package/dist/index.mjs +64 -64
  4. package/dist/lib/api.d.ts +26 -0
  5. package/dist/lib/api.d.ts.map +1 -1
  6. package/dist/lib/entries.d.ts +4 -4
  7. package/package.json +2 -2
  8. package/docs/.nojekyll +0 -1
  9. package/docs/assets/hierarchy.js +0 -1
  10. package/docs/assets/highlight.css +0 -85
  11. package/docs/assets/icons.js +0 -18
  12. package/docs/assets/icons.svg +0 -1
  13. package/docs/assets/main.js +0 -60
  14. package/docs/assets/navigation.js +0 -1
  15. package/docs/assets/search.js +0 -1
  16. package/docs/assets/style.css +0 -1610
  17. package/docs/classes/Sdk.html +0 -181
  18. package/docs/functions/act.html +0 -1
  19. package/docs/functions/apiURL.html +0 -1
  20. package/docs/functions/assetList.html +0 -1
  21. package/docs/functions/createAsset.html +0 -1
  22. package/docs/functions/createEntry.html +0 -1
  23. package/docs/functions/deleteAsset.html +0 -1
  24. package/docs/functions/deleteEntry.html +0 -1
  25. package/docs/functions/deleteEntryObject.html +0 -1
  26. package/docs/functions/dmList.html +0 -1
  27. package/docs/functions/editEntry.html +0 -1
  28. package/docs/functions/editEntryObject.html +0 -1
  29. package/docs/functions/entryList.html +0 -1
  30. package/docs/functions/expect.html +0 -1
  31. package/docs/functions/fdk.html +0 -1
  32. package/docs/functions/fetcher.html +0 -1
  33. package/docs/functions/filterOptions.html +0 -3
  34. package/docs/functions/getAsset.html +0 -1
  35. package/docs/functions/getDatamanager.html +0 -1
  36. package/docs/functions/getEcAuthKey.html +0 -1
  37. package/docs/functions/getEntry.html +0 -1
  38. package/docs/functions/getEntryAsset.html +0 -3
  39. package/docs/functions/getEntryEnv.html +0 -2
  40. package/docs/functions/getEntryShortID.html +0 -2
  41. package/docs/functions/getPublicAuthKey.html +0 -1
  42. package/docs/functions/getSchema.html +0 -1
  43. package/docs/functions/loginEc.html +0 -1
  44. package/docs/functions/loginPublic.html +0 -1
  45. package/docs/functions/logoutEc.html +0 -1
  46. package/docs/functions/logoutPublic.html +0 -1
  47. package/docs/functions/mapEntries.html +0 -1
  48. package/docs/functions/modelList.html +0 -1
  49. package/docs/functions/publicApi.html +0 -1
  50. package/docs/functions/query.html +0 -1
  51. package/docs/functions/raw.html +0 -1
  52. package/docs/functions/resourceList.html +0 -1
  53. package/docs/functions/sdk-1.html +0 -1
  54. package/docs/functions/sdkOptions.html +0 -3
  55. package/docs/index.html +0 -80
  56. package/docs/modules.html +0 -1
  57. package/docs/variables/apis.html +0 -1
package/README.md CHANGED
@@ -66,7 +66,7 @@ const muffins = await act({
66
66
  });
67
67
  ```
68
68
 
69
- The object passed to `act` expects an `action` ([available actions](https://github.com/entrecode/ec.fdk/blob/main/packages/ec.fdk/src/lib/api.mjs))
69
+ The object passed to `act` expects an `action` ([available actions](https://github.com/entrecode/ec.fdk/blob/main/packages/ec.fdk/src/lib/api.ts))
70
70
  and additional keys that are required to perform the action.
71
71
  If you don't know the required keys for an action, either call `act` without additional keys or look it up in the source.
72
72
  For example, this is how the `entryList` function looks:
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var ft=Object.defineProperty,pt=Object.defineProperties;var yt=Object.getOwnPropertyDescriptors;var x=Object.getOwnPropertySymbols;var mt=Object.prototype.hasOwnProperty,$t=Object.prototype.propertyIsEnumerable;var z=(n,t,e)=>t in n?ft(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,o=(n,t)=>{for(var e in t||(t={}))mt.call(t,e)&&z(n,e,t[e]);if(x)for(var e of x(t))$t.call(t,e)&&z(n,e,t[e]);return n},f=(n,t)=>pt(n,yt(t));var a=(n,t,e)=>new Promise((s,r)=>{var l=c=>{try{d(e.next(c))}catch(u){r(u)}},i=c=>{try{d(e.throw(c))}catch(u){r(u)}},d=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);d((e=e.apply(n,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function p(s){return a(this,arguments,function*(n,t={},e={}){var d;const{token:r,rawRes:l}=t;r&&(e.headers=f(o({},e.headers||{}),{Authorization:`Bearer ${r}`}));const i=yield fetch(n,e);if(!i.ok){if((d=i.headers.get("content-type"))!=null&&d.includes("application/json")){const c=yield i.json(),u=`${c.title}
2
- ${c.detail}
3
- ${c.verbose}`;throw new Error(u)}throw new Error(`unexpected fetch error: ${i.statusText}`)}return l?i:yield i.json()})}const b={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/"},"dm-history":{live:"https://dm-history.entrecode.de/",stage:"https://dm-history.cachena.entrecode.de/"}};function y(n,t="stage",e="datamanager"){const s=b[e];if(!s)throw new Error(`subdomain "${e}" not found. Try one of ${Object.keys(b).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 E(n,t=!0){return Object.entries(n).sort((e,s)=>e[0].localeCompare(s[0])).map(([e,s])=>`${e}=${s}`).join("&")}function h(n){Object.entries(n).forEach(([t,e])=>{if(e===void 0)throw new Error(`expected ${t} to be set!`)})}const K={stage:"https://accounts.cachena.entrecode.de/",live:"https://accounts.entrecode.de/"};function N(n){return a(this,null,function*(){let{env:t,dmShortID:e,email:s,password:r}=n;h({env:t,dmShortID:e,email:s,password:r});const l=y(`api/${e}/_auth/login?clientID=rest`,t);return yield p(l,{},{method:"POST",body:JSON.stringify({email:s,password:r}),headers:{"Content-Type":"application/json"}})})}function F(n){return a(this,null,function*(){let{env:t,email:e,password:s}=n;h({env:t,email:e,password:s});const r=`${K[t]}auth/login?clientID=rest`;return yield p(r,{},{method:"POST",body:JSON.stringify({email:e,password:s}),headers:{"Content-Type":"application/json"}})})}function J(n){return a(this,null,function*(){let{dmShortID:t,env:e,token:s}=n;h({dmShortID:t,env:e,token:s});const r=y(`api/${t}/_auth/logout?clientID=rest&token=${s}`,e);return yield p(r,{rawRes:!0},{method:"POST"})})}function R(n){return a(this,null,function*(){let{env:t,token:e}=n;h({env:t,token:e});const s=`${K[t]}auth/logout?clientID=rest`;return yield p(s,{rawRes:!0,token:e},{method:"POST"})})}function U({dmShortID:n}){return h({dmShortID:n}),n}function M({env:n}){return h({env:n}),n}let Et=["created","creator","id","modified","private","_created","_creator","_embedded","_entryTitle","_id","_links","_modelTitle","_modelTitleField","_modified"];function V(n){let t={};for(let e in n)Et.includes(e)||(t[e]=n[e]);return t}function wt(n){return JSON.parse(JSON.stringify(n))}function G(n){return a(this,null,function*(){let{env:t,dmShortID:e}=n;h({env:t,dmShortID:e});const s=y(`api/${e}`,t);return p(s,n)})}function S(n){return a(this,null,function*(){let{env:t,dmShortID:e,model:s,options:r={}}=n;h({env:t,dmShortID:e,model:s}),r=o({size:50,page:1,_list:!0},r);const l=E(r),i=y(`api/${e}/${s}?${l}`,t),{count:d,total:c,_embedded:u}=yield p(i,n);let g=u?u[`${e}:${s}`]:[];return g=Array.isArray(g)?g:[g],{count:d,total:c,items:g}})}function H({env:n,dmShortID:t,model:e,entryID:s,token:r}){h({env:n,dmShortID:t,model:e,entryID:s});const l=E({_id:s}),i=y(`api/${t}/${e}?${l}`,n);return p(i,{token:r})}function Q(l){return a(this,arguments,function*({env:n,dmShortID:t,model:e,value:s,token:r}){h({env:n,dmShortID:t,model:e,value:s});const i=y(`api/${t}/${e}`,n);return yield p(i,{token:r},{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}})})}function P(d){return a(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,value:r,token:l,safePut:i=!1}){h({env:n,dmShortID:t,model:e,entryID:s,value:r});const c={"Content-Type":"application/json"};if(i){if(!("_modified"in r))throw new Error("expected _modified to be set!");c["If-Unmodified-Since"]=new Date(r._modified).toUTCString()}const u=y(`api/${t}/${e}?_id=${s}`,n);return r=wt(r),r=V(r),yield p(u,{token:l},{method:"PUT",headers:c,body:JSON.stringify(r)})})}function L({env:n,dmShortID:t,model:e,entryID:s,token:r}){h({env:n,dmShortID:t,model:e,entryID:s});const l=y(`api/${t}/${e}?_id=${s}`,n);return p(l,{token:r,rawRes:!0},{method:"DELETE",headers:{"Content-Type":"application/json"}})}function W(n,t){return a(this,null,function*(){let{env:e,dmShortID:s,model:r,options:l={}}=n;h({env:e,dmShortID:s,model:r}),n.options=o({size:50,page:1,_list:!0},l);let i=0,d,c=[];for(;d===void 0||i<d;){const u=yield S(n);for(let g of u.items)c.push(yield t(g));i+=u.items.length,d=u.total,n.options.page++}return c})}function X(r){return a(this,arguments,function*({env:n,dmShortID:t,model:e,withMetadata:s}){var g,$,v,q,I;h({env:n,dmShortID:t,model:e});const l=y(`api/schema/${t}/${e}`,n),i=yield p(l),d=(g=i==null?void 0:i.allOf)==null?void 0:g[1];if(typeof d.properties!="object")throw new Error(`getSchema: ${l} returned unexpected format: ${JSON.stringify(i)}`);const{properties:c}=d,u=V(c);for(let w in u){let m=u[w];if(m.required=d.required.includes(w),($=u[w])!=null&&$.oneOf&&((v=u[w])==null||delete v.oneOf),(q=m.title)!=null&&q.includes("<")&&((I=m.title)!=null&&I.includes(">"))){const _=m.title.split("<")[1].slice(0,-1),gt=m.title.split("<")[0];m.type=gt,_.includes(":")?m.resource=_.split(":")[1]:m.resource=_}else["asset","entry","assets","entries"].includes(m.title)?(m.type=m.title,m.resource=null):m.type=m.title;delete u[w].title}if(s){const w=c._modelTitle.title,m=c._modelTitleField.title;return{properties:u,meta:{modelTitleField:m,modelTitle:w}}}return u})}function B(n){return Object.entries(n).map(([t,e])=>typeof e!="object"?{[t]:String(e)}:o(o(o(o(o(o(o({},e.sort&&{sort:Array.isArray(e)?e.join(","):e}),e.search&&{[t+"~"]:e.search}),e.notNull&&{[t+"!"]:""}),e.null&&{[t]:""}),e.any&&{[t]:e.any.join(",")}),e.from&&{[t+"From"]:e.from}),e.to&&{[t+"To"]:e.to})).reduce((t,e)=>o(o({},t),e),{})}const Y=B;function A(n){return n._links.collection.href.split("/").slice(-2)[0]}function D(n){const t=n._links.collection.href.split("api/")[0];return Object.keys(b.datamanager).find(s=>b.datamanager[s]===t)}const Z=n=>{const t=A(n),e=D(n),s=n._modelTitle,r=n.id;return{dmShortID:t,env:e,model:s,entryID:r}},tt=n=>L(Z(n)),et=(n,t)=>P(f(o({},Z(n)),{value:t}));function nt(n,t){const e=A(t);return t._embedded[`${e}:${t._modelTitle}/${n}/asset`]}function st(l){return a(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){h({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=E({assetID:s}),d=y(`a/${t}/${e}?${i}`,n);return(yield p(d,{token:r}))._embedded["ec:dm-asset"]})}function rt(n){return a(this,null,function*(){let{env:t,dmShortID:e,assetGroup:s,token:r,options:l={}}=n;h({env:t,dmShortID:e,assetGroup:s}),l=o({size:50,page:1,_list:!0},l);const i=E(l),d=y(`a/${e}/${s}?${i}`,t),{count:c,total:u,_embedded:g}=yield p(d,{token:r});let $=g?g["ec:dm-asset"]:[];return $=Array.isArray($)?$:[$],{count:c,total:u,items:$}})}function it(d){return a(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,token:s,file:r,name:l,options:i}){h({env:n,dmShortID:t,assetGroup:e,file:r});const c=y(`a/${t}/${e}`,n),u=new FormData;return u.append("file",r,l),i&&Object.keys(i).forEach($=>{u.append($,i[$])}),(yield p(c,{token:s},{method:"POST",body:u}))._embedded["ec:dm-asset"]})}function ot(l){return a(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){h({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=y(`a/${t}/${e}/${s}`,n);yield p(i,{token:r,rawRes:!0},{method:"DELETE"})})}function ct(n){return a(this,null,function*(){let{env:t,dmID:e,token:s}=n;h({env:t,dmID:e});const r=y(`?dataManagerID=${e}`,t);return p(r,{token:s})})}function at(n){return a(this,null,function*(){let{env:t,options:e={}}=n;h({env:t}),e=o({size:25,page:1,_list:!0},e);const s=E(e),r=y(`?${s}`,t),{count:l,total:i,_embedded:d}=yield p(r,n);let c=d?d["ec:datamanager"]:[];return c=Array.isArray(c)?c:[c],{count:l,total:i,items:c}})}function ut(n){return a(this,null,function*(){let{env:t,dmID:e,options:s={}}=n;h({env:t,dmID:e}),s=o({size:25,dataManagerID:e,page:1,_list:!0},s);const r=E(s),l=y(`model?${r}`,t),{count:i,total:d,_embedded:c}=yield p(l,n);let u=c?c["ec:model"]:[];return u=Array.isArray(u)?u:[u],{count:i,total:d,items:u}})}function lt(n){return a(this,null,function*(){let{env:t,resource:e,options:s={},subdomain:r="datamanager"}=n;h({env:t,subdomain:r,resource:e}),s=o({size:25,page:1,_list:!0},s);const l=E(s),i=y(`${e}?${l}`,t,r),{count:d,total:c,_embedded:u}=yield p(i,n);let g=u?u[Object.keys(u)[0]]:[];return g=Array.isArray(g)?g:[g],{count:d,total:c,items:g}})}function dt(e){return a(this,arguments,function*(n,t={}){let{env:s,route:r,options:l={},subdomain:i="datamanager"}=n;h({env:s,subdomain:i,route:r}),l=o({},l);const d=E(l),c=y(`${r}?${d}`,s,i);return p(c,n,t)})}const k=Object.freeze(Object.defineProperty({__proto__:null,assetList:rt,createAsset:it,createEntry:Q,deleteAsset:ot,deleteEntry:L,deleteEntryObject:tt,dmList:at,editEntry:P,editEntryObject:et,entryList:S,filterOptions:Y,getAsset:st,getDatamanager:ct,getEcAuthKey:M,getEntry:H,getEntryAsset:nt,getEntryEnv:D,getEntryShortID:A,getPublicAuthKey:U,getSchema:X,loginEc:F,loginPublic:N,logoutEc:R,logoutPublic:J,mapEntries:W,modelList:ut,publicApi:G,raw:dt,resourceList:lt,sdkOptions:B},Symbol.toStringTag,{value:"Module"})),{entryList:bt,mapEntries:kt,getEntry:At,getAsset:Tt,assetList:_t,createAsset:Ot,deleteAsset:jt,createEntry:St,editEntry:C,deleteEntry:Pt,getSchema:Lt,loginPublic:Bt,loginEc:Dt,logoutEc:vt,logoutPublic:qt,getEcAuthKey:O,getPublicAuthKey:j,dmList:It,modelList:xt,publicApi:zt,getDatamanager:Ct,resourceList:Kt,raw:Nt}=k;function Ft(n){const{action:t}=n;if(h({action:t}),!k[t])throw new Error(`"${t}" does not exist! try one of ${Object.keys(k).join(", ")}`);return k[t](n)}class T{constructor(t){this.config=t}set(t){return new T(o(o({},this.config),t))}entries(){return a(this,arguments,function*(t={}){const e=yield this.getBestToken();return bt(f(o({},this.config),{options:t,token:e}))})}entryList(t){return a(this,null,function*(){return this.entries(t)})}mapEntries(s){return a(this,arguments,function*(t,e={}){const r=yield this.getBestToken();return kt(f(o({},this.config),{options:e,token:r}),t)})}getEntry(t){return a(this,null,function*(){const e=yield this.getBestToken();return At(f(o({},this.config),{entryID:t,token:e}))})}editEntrySafe(t,e){return a(this,null,function*(){const s=yield this.getBestToken();return C(f(o({},this.config),{entryID:t,token:s,value:e,safePut:!0}))})}getSchema(){return a(this,null,function*(){return Lt(this.config)})}assets(t){return a(this,null,function*(){const e=yield this.getBestToken();return _t(f(o({},this.config),{options:t,token:e}))})}assetList(t){return a(this,null,function*(){return this.assets(t)})}createAsset(){return a(this,arguments,function*({file:t,name:e,options:s}={}){const r=yield this.getBestToken();return Ot(f(o({},this.config),{file:t,name:e,options:s,token:r}))})}deleteAsset(t){return a(this,null,function*(){const e=yield this.getBestToken();return jt(f(o({},this.config),{token:e,assetID:t}))})}getAsset(t){return a(this,null,function*(){const e=yield this.getBestToken();return Tt(f(o({},this.config),{assetID:t,token:e}))})}createEntry(t){return a(this,null,function*(){const e=yield this.getBestToken();return St(f(o({},this.config),{token:e,value:t}))})}editEntry(t,e){return a(this,null,function*(){const s=yield this.getBestToken();return C(f(o({},this.config),{entryID:t,token:s,value:e}))})}deleteEntry(t){return a(this,null,function*(){const e=yield this.getBestToken();return Pt(f(o({},this.config),{token:e,entryID:t}))})}resourceList(t){return a(this,null,function*(){const e=yield this.getBestToken();return Kt(f(o({},this.config),{options:t,token:e}))})}raw(t,e){return a(this,null,function*(){const s=yield this.getBestToken();return Nt(f(o({},this.config),{options:t,token:s}),e)})}storageAdapter(t){return this.set({storageAdapter:t})}setAuth(t){return e=>{if(!this.config.storageAdapter)throw new Error("cannot setAuth: no storageAdapter defined!");const{set:s}=this.config.storageAdapter;return s(t,e.token),e}}unsetAuth(t){return e=>{if(!this.config.storageAdapter)throw new Error("cannot unsetAuth: no storageAdapter defined!");const{remove:s}=this.config.storageAdapter;return s(t),e}}getAuth(t){if(!this.config.storageAdapter)throw new Error("cannot getAuth: no storageAdapter defined!");const{get:e}=this.config.storageAdapter;return e(t)}loginEc(t){return Dt(o(o({},this.config),t)).then(this.setAuth(O(this.config)))}loginPublic(t){return Bt(o(o({},this.config),t)).then(this.setAuth(j(this.config)))}logoutPublic(){const t=this.getPublicToken();return qt(f(o({},this.config),{token:t})).then(this.unsetAuth(j(this.config)))}logoutEc(){const t=this.getEcToken();return vt(f(o({},this.config),{token:t})).then(this.unsetAuth(O(this.config)))}getPublicToken(){return this.config.token||this.getAuth(j(this.config))}getEcToken(){return this.config.token||this.getAuth(O(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 zt(this.config)}getDatamanager(t){return a(this,null,function*(){const e=yield this.getBestToken();return Ct(f(o({},this.config),{dmID:t,token:e}))})}dmList(){return a(this,arguments,function*(t={}){const e=yield this.getBestToken();return It(f(o({},this.config),{options:t,token:e}))})}modelList(){return a(this,arguments,function*(t={}){const e=yield this.getBestToken();return xt(f(o({},this.config),{options:t,token:e}))})}}const ht=n=>new T({env:n}),Jt=ht;exports.Sdk=T;exports.act=Ft;exports.apiURL=y;exports.apis=b;exports.assetList=rt;exports.createAsset=it;exports.createEntry=Q;exports.deleteAsset=ot;exports.deleteEntry=L;exports.deleteEntryObject=tt;exports.dmList=at;exports.editEntry=P;exports.editEntryObject=et;exports.entryList=S;exports.expect=h;exports.fdk=Jt;exports.fetcher=p;exports.filterOptions=Y;exports.getAsset=st;exports.getDatamanager=ct;exports.getEcAuthKey=M;exports.getEntry=H;exports.getEntryAsset=nt;exports.getEntryEnv=D;exports.getEntryShortID=A;exports.getPublicAuthKey=U;exports.getSchema=X;exports.loginEc=F;exports.loginPublic=N;exports.logoutEc=R;exports.logoutPublic=J;exports.mapEntries=W;exports.modelList=ut;exports.publicApi=G;exports.query=E;exports.raw=dt;exports.resourceList=lt;exports.sdk=ht;exports.sdkOptions=B;
1
+ "use strict";var ft=Object.defineProperty,pt=Object.defineProperties;var yt=Object.getOwnPropertyDescriptors;var x=Object.getOwnPropertySymbols;var mt=Object.prototype.hasOwnProperty,$t=Object.prototype.propertyIsEnumerable;var z=(n,t,e)=>t in n?ft(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,c=(n,t)=>{for(var e in t||(t={}))mt.call(t,e)&&z(n,e,t[e]);if(x)for(var e of x(t))$t.call(t,e)&&z(n,e,t[e]);return n},f=(n,t)=>pt(n,yt(t));var a=(n,t,e)=>new Promise((s,r)=>{var l=i=>{try{d(e.next(i))}catch(u){r(u)}},o=i=>{try{d(e.throw(i))}catch(u){r(u)}},d=i=>i.done?s(i.value):Promise.resolve(i.value).then(l,o);d((e=e.apply(n,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function p(s){return a(this,arguments,function*(n,t={},e={}){var d;const{token:r,rawRes:l}=t;r&&(e.headers=f(c({},e.headers||{}),{Authorization:`Bearer ${r}`}));const o=yield fetch(n,e);if(!o.ok){if((d=o.headers.get("content-type"))!=null&&d.includes("application/json")){const i=yield o.json(),u=`${i.title}
2
+ ${i.detail}
3
+ ${i.verbose}`;throw new Error(u)}throw new Error(`unexpected fetch error: ${o.statusText}`)}return l?o:yield o.json()})}const b={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/"},"dm-history":{live:"https://dm-history.entrecode.de/",stage:"https://dm-history.cachena.entrecode.de/"}};function y(n,t="stage",e="datamanager"){const s=b[e];if(!s)throw new Error(`subdomain "${e}" not found. Try one of ${Object.keys(b).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 E(n,t=!0){return Object.entries(n).sort((e,s)=>e[0].localeCompare(s[0])).map(([e,s])=>`${e}=${s}`).join("&")}function h(n){Object.entries(n).forEach(([t,e])=>{if(e===void 0)throw new Error(`expected ${t} to be set!`)})}const K={stage:"https://accounts.cachena.entrecode.de/",live:"https://accounts.entrecode.de/"};function N(n){return a(this,null,function*(){let{env:t,dmShortID:e,email:s,password:r}=n;h({env:t,dmShortID:e,email:s,password:r});const l=y(`api/${e}/_auth/login?clientID=rest`,t);return yield p(l,{},{method:"POST",body:JSON.stringify({email:s,password:r}),headers:{"Content-Type":"application/json"}})})}function F(n){return a(this,null,function*(){let{env:t,email:e,password:s}=n;h({env:t,email:e,password:s});const r=`${K[t]}auth/login?clientID=rest`;return yield p(r,{},{method:"POST",body:JSON.stringify({email:e,password:s}),headers:{"Content-Type":"application/json"}})})}function J(n){return a(this,null,function*(){let{dmShortID:t,env:e,token:s}=n;h({dmShortID:t,env:e,token:s});const r=y(`api/${t}/_auth/logout?clientID=rest&token=${s}`,e);return yield p(r,{rawRes:!0},{method:"POST"})})}function R(n){return a(this,null,function*(){let{env:t,token:e}=n;h({env:t,token:e});const s=`${K[t]}auth/logout?clientID=rest`;return yield p(s,{rawRes:!0,token:e},{method:"POST"})})}function U({dmShortID:n}){return h({dmShortID:n}),n}function M({env:n}){return h({env:n}),n}let Et=["created","creator","id","modified","private","_created","_creator","_embedded","_entryTitle","_id","_links","_modelTitle","_modelTitleField","_modified"];function V(n){let t={};for(let e in n)Et.includes(e)||(t[e]=n[e]);return t}function wt(n){return JSON.parse(JSON.stringify(n))}function G(n){return a(this,null,function*(){let{env:t,dmShortID:e}=n;h({env:t,dmShortID:e});const s=y(`api/${e}`,t);return p(s,n)})}function S(n){return a(this,null,function*(){let{env:t,dmShortID:e,model:s,options:r={}}=n;h({env:t,dmShortID:e,model:s}),r=c({size:50,page:1,_list:!0},r);const l=E(r),o=y(`api/${e}/${s}?${l}`,t),{count:d,total:i,_embedded:u}=yield p(o,n);let g=u?u[`${e}:${s}`]:[];return g=Array.isArray(g)?g:[g],{count:d,total:i,items:g}})}function H({env:n,dmShortID:t,model:e,entryID:s,token:r}){h({env:n,dmShortID:t,model:e,entryID:s});const l=E({_id:s}),o=y(`api/${t}/${e}?${l}`,n);return p(o,{token:r})}function Q(l){return a(this,arguments,function*({env:n,dmShortID:t,model:e,value:s,token:r}){h({env:n,dmShortID:t,model:e,value:s});const o=y(`api/${t}/${e}`,n);return yield p(o,{token:r},{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}})})}function P(d){return a(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,value:r,token:l,safePut:o=!1}){h({env:n,dmShortID:t,model:e,entryID:s,value:r});const i={"Content-Type":"application/json"};if(o){if(!("_modified"in r))throw new Error("expected _modified to be set!");i["If-Unmodified-Since"]=new Date(r._modified).toUTCString()}const u=y(`api/${t}/${e}?_id=${s}`,n);return r=wt(r),r=V(r),yield p(u,{token:l},{method:"PUT",headers:i,body:JSON.stringify(r)})})}function L({env:n,dmShortID:t,model:e,entryID:s,token:r}){h({env:n,dmShortID:t,model:e,entryID:s});const l=y(`api/${t}/${e}?_id=${s}`,n);return p(l,{token:r,rawRes:!0},{method:"DELETE",headers:{"Content-Type":"application/json"}})}function W(n,t){return a(this,null,function*(){let{env:e,dmShortID:s,model:r,options:l={}}=n;h({env:e,dmShortID:s,model:r}),n.options=c({size:50,page:1,_list:!0},l);let o=0,d,i=[];for(;d===void 0||o<d;){const u=yield S(n);for(let g of u.items)i.push(yield t(g));o+=u.items.length,d=u.total,n.options.page++}return i})}function X(r){return a(this,arguments,function*({env:n,dmShortID:t,model:e,withMetadata:s}){var g,$,D,q,I;h({env:n,dmShortID:t,model:e});const l=y(`api/schema/${t}/${e}`,n),o=yield p(l),d=(g=o==null?void 0:o.allOf)==null?void 0:g[1];if(typeof d.properties!="object")throw new Error(`getSchema: ${l} returned unexpected format: ${JSON.stringify(o)}`);const{properties:i}=d,u=V(i);for(let w in u){let m=u[w];if(m.required=d.required.includes(w),($=u[w])!=null&&$.oneOf&&((D=u[w])==null||delete D.oneOf),(q=m.title)!=null&&q.includes("<")&&((I=m.title)!=null&&I.includes(">"))){const _=m.title.split("<")[1].slice(0,-1),gt=m.title.split("<")[0];m.type=gt,_.includes(":")?m.resource=_.split(":")[1]:m.resource=_}else["asset","entry","assets","entries"].includes(m.title)?(m.type=m.title,m.resource=null):m.type=m.title;delete u[w].title}if(s){const w=i._modelTitle.title,m=i._modelTitleField.title;return{properties:u,meta:{modelTitleField:m,modelTitle:w}}}return u})}function v(n){return Object.entries(n).map(([t,e])=>typeof e!="object"?{[t]:String(e)}:c(c(c(c(c(c(c({},e.sort&&{sort:Array.isArray(e)?e.join(","):e}),e.search&&{[t+"~"]:e.search}),e.notNull&&{[t+"!"]:""}),e.null&&{[t]:""}),e.any&&{[t]:e.any.join(",")}),e.from&&{[t+"From"]:e.from}),e.to&&{[t+"To"]:e.to})).reduce((t,e)=>c(c({},t),e),{})}const Y=v;function A(n){return n._links.collection.href.split("/").slice(-2)[0]}function B(n){const t=n._links.collection.href.split("api/")[0];return Object.keys(b.datamanager).find(s=>b.datamanager[s]===t)}const Z=n=>{const t=A(n),e=B(n),s=n._modelTitle,r=n.id;return{dmShortID:t,env:e,model:s,entryID:r}},tt=n=>L(Z(n)),et=(n,t)=>P(f(c({},Z(n)),{value:t}));function nt(n,t){const e=A(t);return t._embedded[`${e}:${t._modelTitle}/${n}/asset`]}function st(l){return a(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){h({env:n,dmShortID:t,assetGroup:e,assetID:s});const o=E({assetID:s}),d=y(`a/${t}/${e}?${o}`,n),{_embedded:i}=yield p(d,{token:r});return i?i["ec:dm-asset"]:void 0})}function rt(n){return a(this,null,function*(){let{env:t,dmShortID:e,assetGroup:s,token:r,options:l={}}=n;h({env:t,dmShortID:e,assetGroup:s}),l=c({size:50,page:1,_list:!0},l);const o=E(l),d=y(`a/${e}/${s}?${o}`,t),{count:i,total:u,_embedded:g}=yield p(d,{token:r});let $=g?g["ec:dm-asset"]:[];return $=Array.isArray($)?$:[$],{count:i,total:u,items:$}})}function ot(d){return a(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,token:s,file:r,name:l,options:o}){h({env:n,dmShortID:t,assetGroup:e,file:r});const i=y(`a/${t}/${e}`,n),u=new FormData;return u.append("file",r,l),o&&Object.keys(o).forEach($=>{u.append($,o[$])}),(yield p(i,{token:s},{method:"POST",body:u}))._embedded["ec:dm-asset"]})}function it(l){return a(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){h({env:n,dmShortID:t,assetGroup:e,assetID:s});const o=y(`a/${t}/${e}/${s}`,n);yield p(o,{token:r,rawRes:!0},{method:"DELETE"})})}function ct(n){return a(this,null,function*(){let{env:t,dmID:e,token:s}=n;h({env:t,dmID:e});const r=y(`?dataManagerID=${e}`,t);return p(r,{token:s})})}function at(n){return a(this,null,function*(){let{env:t,options:e={}}=n;h({env:t}),e=c({size:25,page:1,_list:!0},e);const s=E(e),r=y(`?${s}`,t),{count:l,total:o,_embedded:d}=yield p(r,n);let i=d?d["ec:datamanager"]:[];return i=Array.isArray(i)?i:[i],{count:l,total:o,items:i}})}function ut(n){return a(this,null,function*(){let{env:t,dmID:e,options:s={}}=n;h({env:t,dmID:e}),s=c({size:25,dataManagerID:e,page:1,_list:!0},s);const r=E(s),l=y(`model?${r}`,t),{count:o,total:d,_embedded:i}=yield p(l,n);let u=i?i["ec:model"]:[];return u=Array.isArray(u)?u:[u],{count:o,total:d,items:u}})}function lt(n){return a(this,null,function*(){let{env:t,resource:e,options:s={},subdomain:r="datamanager"}=n;h({env:t,subdomain:r,resource:e}),s=c({size:25,page:1,_list:!0},s);const l=E(s),o=y(`${e}?${l}`,t,r),{count:d,total:i,_embedded:u}=yield p(o,n);let g=u?u[Object.keys(u)[0]]:[];return g=Array.isArray(g)?g:[g],{count:d,total:i,items:g}})}function dt(e){return a(this,arguments,function*(n,t={}){let{env:s,route:r,options:l={},subdomain:o="datamanager"}=n;h({env:s,subdomain:o,route:r}),l=c({},l);const d=E(l),i=y(`${r}?${d}`,s,o);return p(i,n,t)})}const k=Object.freeze(Object.defineProperty({__proto__:null,assetList:rt,createAsset:ot,createEntry:Q,deleteAsset:it,deleteEntry:L,deleteEntryObject:tt,dmList:at,editEntry:P,editEntryObject:et,entryList:S,filterOptions:Y,getAsset:st,getDatamanager:ct,getEcAuthKey:M,getEntry:H,getEntryAsset:nt,getEntryEnv:B,getEntryShortID:A,getPublicAuthKey:U,getSchema:X,loginEc:F,loginPublic:N,logoutEc:R,logoutPublic:J,mapEntries:W,modelList:ut,publicApi:G,raw:dt,resourceList:lt,sdkOptions:v},Symbol.toStringTag,{value:"Module"})),{entryList:bt,mapEntries:kt,getEntry:At,getAsset:Tt,assetList:_t,createAsset:Ot,deleteAsset:jt,createEntry:St,editEntry:C,deleteEntry:Pt,getSchema:Lt,loginPublic:vt,loginEc:Bt,logoutEc:Dt,logoutPublic:qt,getEcAuthKey:O,getPublicAuthKey:j,dmList:It,modelList:xt,publicApi:zt,getDatamanager:Ct,resourceList:Kt,raw:Nt}=k;function Ft(n){const{action:t}=n;if(h({action:t}),!k[t])throw new Error(`"${t}" does not exist! try one of ${Object.keys(k).join(", ")}`);return k[t](n)}class T{constructor(t){this.config=t}set(t){return new T(c(c({},this.config),t))}entries(){return a(this,arguments,function*(t={}){const e=yield this.getBestToken();return bt(f(c({},this.config),{options:t,token:e}))})}entryList(t){return a(this,null,function*(){return this.entries(t)})}mapEntries(s){return a(this,arguments,function*(t,e={}){const r=yield this.getBestToken();return kt(f(c({},this.config),{options:e,token:r}),t)})}getEntry(t){return a(this,null,function*(){const e=yield this.getBestToken();return At(f(c({},this.config),{entryID:t,token:e}))})}editEntrySafe(t,e){return a(this,null,function*(){const s=yield this.getBestToken();return C(f(c({},this.config),{entryID:t,token:s,value:e,safePut:!0}))})}getSchema(){return a(this,null,function*(){return Lt(this.config)})}assets(t){return a(this,null,function*(){const e=yield this.getBestToken();return _t(f(c({},this.config),{options:t,token:e}))})}assetList(t){return a(this,null,function*(){return this.assets(t)})}createAsset(){return a(this,arguments,function*({file:t,name:e,options:s}={}){const r=yield this.getBestToken();return Ot(f(c({},this.config),{file:t,name:e,options:s,token:r}))})}deleteAsset(t){return a(this,null,function*(){const e=yield this.getBestToken();return jt(f(c({},this.config),{token:e,assetID:t}))})}getAsset(t){return a(this,null,function*(){const e=yield this.getBestToken();return Tt(f(c({},this.config),{assetID:t,token:e}))})}createEntry(t){return a(this,null,function*(){const e=yield this.getBestToken();return St(f(c({},this.config),{token:e,value:t}))})}editEntry(t,e){return a(this,null,function*(){const s=yield this.getBestToken();return C(f(c({},this.config),{entryID:t,token:s,value:e}))})}deleteEntry(t){return a(this,null,function*(){const e=yield this.getBestToken();return Pt(f(c({},this.config),{token:e,entryID:t}))})}resourceList(t){return a(this,null,function*(){const e=yield this.getBestToken();return Kt(f(c({},this.config),{options:t,token:e}))})}raw(t,e){return a(this,null,function*(){const s=yield this.getBestToken();return Nt(f(c({},this.config),{options:t,token:s}),e)})}storageAdapter(t){return this.set({storageAdapter:t})}setAuth(t){return e=>{if(!this.config.storageAdapter)throw new Error("cannot setAuth: no storageAdapter defined!");const{set:s}=this.config.storageAdapter;return s(t,e.token),e}}unsetAuth(t){return e=>{if(!this.config.storageAdapter)throw new Error("cannot unsetAuth: no storageAdapter defined!");const{remove:s}=this.config.storageAdapter;return s(t),e}}getAuth(t){if(!this.config.storageAdapter)throw new Error("cannot getAuth: no storageAdapter defined!");const{get:e}=this.config.storageAdapter;return e(t)}loginEc(t){return Bt(c(c({},this.config),t)).then(this.setAuth(O(this.config)))}loginPublic(t){return vt(c(c({},this.config),t)).then(this.setAuth(j(this.config)))}logoutPublic(){const t=this.getPublicToken();return qt(f(c({},this.config),{token:t})).then(this.unsetAuth(j(this.config)))}logoutEc(){const t=this.getEcToken();return Dt(f(c({},this.config),{token:t})).then(this.unsetAuth(O(this.config)))}getPublicToken(){return this.config.token||this.getAuth(j(this.config))}getEcToken(){return this.config.token||this.getAuth(O(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 zt(this.config)}getDatamanager(t){return a(this,null,function*(){const e=yield this.getBestToken();return Ct(f(c({},this.config),{dmID:t,token:e}))})}dmList(){return a(this,arguments,function*(t={}){const e=yield this.getBestToken();return It(f(c({},this.config),{options:t,token:e}))})}modelList(){return a(this,arguments,function*(t={}){const e=yield this.getBestToken();return xt(f(c({},this.config),{options:t,token:e}))})}}const ht=n=>new T({env:n}),Jt=ht;exports.Sdk=T;exports.act=Ft;exports.apiURL=y;exports.apis=b;exports.assetList=rt;exports.createAsset=ot;exports.createEntry=Q;exports.deleteAsset=it;exports.deleteEntry=L;exports.deleteEntryObject=tt;exports.dmList=at;exports.editEntry=P;exports.editEntryObject=et;exports.entryList=S;exports.expect=h;exports.fdk=Jt;exports.fetcher=p;exports.filterOptions=Y;exports.getAsset=st;exports.getDatamanager=ct;exports.getEcAuthKey=M;exports.getEntry=H;exports.getEntryAsset=nt;exports.getEntryEnv=B;exports.getEntryShortID=A;exports.getPublicAuthKey=U;exports.getSchema=X;exports.loginEc=F;exports.loginPublic=N;exports.logoutEc=R;exports.logoutPublic=J;exports.mapEntries=W;exports.modelList=ut;exports.publicApi=G;exports.query=E;exports.raw=dt;exports.resourceList=lt;exports.sdk=ht;exports.sdkOptions=v;
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ var R = Object.defineProperty, U = Object.defineProperties;
2
2
  var M = Object.getOwnPropertyDescriptors;
3
3
  var B = Object.getOwnPropertySymbols;
4
4
  var V = Object.prototype.hasOwnProperty, G = Object.prototype.propertyIsEnumerable;
5
- var D = (n, t, e) => t in n ? R(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, i = (n, t) => {
5
+ var D = (n, t, e) => t in n ? R(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, a = (n, t) => {
6
6
  for (var e in t || (t = {}))
7
7
  V.call(t, e) && D(n, e, t[e]);
8
8
  if (B)
@@ -11,34 +11,34 @@ var D = (n, t, e) => t in n ? R(n, t, { enumerable: !0, configurable: !0, writab
11
11
  return n;
12
12
  }, f = (n, t) => U(n, M(t));
13
13
  var c = (n, t, e) => new Promise((s, r) => {
14
- var l = (a) => {
14
+ var l = (i) => {
15
15
  try {
16
- d(e.next(a));
16
+ d(e.next(i));
17
17
  } catch (u) {
18
18
  r(u);
19
19
  }
20
- }, o = (a) => {
20
+ }, o = (i) => {
21
21
  try {
22
- d(e.throw(a));
22
+ d(e.throw(i));
23
23
  } catch (u) {
24
24
  r(u);
25
25
  }
26
- }, d = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(l, o);
26
+ }, d = (i) => i.done ? s(i.value) : Promise.resolve(i.value).then(l, o);
27
27
  d((e = e.apply(n, t)).next());
28
28
  });
29
29
  function p(s) {
30
30
  return c(this, arguments, function* (n, t = {}, e = {}) {
31
31
  var d;
32
32
  const { token: r, rawRes: l } = t;
33
- r && (e.headers = f(i({}, e.headers || {}), {
33
+ r && (e.headers = f(a({}, e.headers || {}), {
34
34
  Authorization: `Bearer ${r}`
35
35
  }));
36
36
  const o = yield fetch(n, e);
37
37
  if (!o.ok) {
38
38
  if ((d = o.headers.get("content-type")) != null && d.includes("application/json")) {
39
- const a = yield o.json(), u = `${a.title}
40
- ${a.detail}
41
- ${a.verbose}`;
39
+ const i = yield o.json(), u = `${i.title}
40
+ ${i.detail}
41
+ ${i.verbose}`;
42
42
  throw new Error(u);
43
43
  }
44
44
  throw new Error(`unexpected fetch error: ${o.statusText}`);
@@ -204,10 +204,10 @@ function nt(n) {
204
204
  function z(n) {
205
205
  return c(this, null, function* () {
206
206
  let { env: t, dmShortID: e, model: s, options: r = {} } = n;
207
- h({ env: t, dmShortID: e, model: s }), r = i({ size: 50, page: 1, _list: !0 }, r);
208
- const l = w(r), o = y(`api/${e}/${s}?${l}`, t), { count: d, total: a, _embedded: u } = yield p(o, n);
207
+ h({ env: t, dmShortID: e, model: s }), r = a({ size: 50, page: 1, _list: !0 }, r);
208
+ const l = w(r), o = y(`api/${e}/${s}?${l}`, t), { count: d, total: i, _embedded: u } = yield p(o, n);
209
209
  let g = u ? u[`${e}:${s}`] : [];
210
- return g = Array.isArray(g) ? g : [g], { count: d, total: a, items: g };
210
+ return g = Array.isArray(g) ? g : [g], { count: d, total: i, items: g };
211
211
  });
212
212
  }
213
213
  function st({ env: n, dmShortID: t, model: e, entryID: s, token: r }) {
@@ -243,13 +243,13 @@ function C(d) {
243
243
  safePut: o = !1
244
244
  }) {
245
245
  h({ env: n, dmShortID: t, model: e, entryID: s, value: r });
246
- const a = {
246
+ const i = {
247
247
  "Content-Type": "application/json"
248
248
  };
249
249
  if (o) {
250
250
  if (!("_modified" in r))
251
251
  throw new Error("expected _modified to be set!");
252
- a["If-Unmodified-Since"] = new Date(r._modified).toUTCString();
252
+ i["If-Unmodified-Since"] = new Date(r._modified).toUTCString();
253
253
  }
254
254
  const u = y(`api/${t}/${e}?_id=${s}`, n);
255
255
  return r = et(r), r = x(r), yield p(
@@ -257,7 +257,7 @@ function C(d) {
257
257
  { token: l },
258
258
  {
259
259
  method: "PUT",
260
- headers: a,
260
+ headers: i,
261
261
  body: JSON.stringify(r)
262
262
  }
263
263
  );
@@ -286,15 +286,15 @@ function I({
286
286
  function ot(n, t) {
287
287
  return c(this, null, function* () {
288
288
  let { env: e, dmShortID: s, model: r, options: l = {} } = n;
289
- h({ env: e, dmShortID: s, model: r }), n.options = i({ size: 50, page: 1, _list: !0 }, l);
290
- let o = 0, d, a = [];
289
+ h({ env: e, dmShortID: s, model: r }), n.options = a({ size: 50, page: 1, _list: !0 }, l);
290
+ let o = 0, d, i = [];
291
291
  for (; d === void 0 || o < d; ) {
292
292
  const u = yield z(n);
293
293
  for (let g of u.items)
294
- a.push(yield t(g));
294
+ i.push(yield t(g));
295
295
  o += u.items.length, d = u.total, n.options.page++;
296
296
  }
297
- return a;
297
+ return i;
298
298
  });
299
299
  }
300
300
  function it(r) {
@@ -306,7 +306,7 @@ function it(r) {
306
306
  throw new Error(
307
307
  `getSchema: ${l} returned unexpected format: ${JSON.stringify(o)}`
308
308
  );
309
- const { properties: a } = d, u = x(a);
309
+ const { properties: i } = d, u = x(i);
310
310
  for (let E in u) {
311
311
  let m = u[E];
312
312
  if (m.required = d.required.includes(E), ($ = u[E]) != null && $.oneOf && ((P = u[E]) == null || delete P.oneOf), (S = m.title) != null && S.includes("<") && ((L = m.title) != null && L.includes(">"))) {
@@ -317,14 +317,14 @@ function it(r) {
317
317
  delete u[E].title;
318
318
  }
319
319
  if (s) {
320
- const E = a._modelTitle.title, m = a._modelTitleField.title;
320
+ const E = i._modelTitle.title, m = i._modelTitleField.title;
321
321
  return { properties: u, meta: { modelTitleField: m, modelTitle: E } };
322
322
  }
323
323
  return u;
324
324
  });
325
325
  }
326
326
  function K(n) {
327
- return Object.entries(n).map(([t, e]) => typeof e != "object" ? { [t]: String(e) } : i(i(i(i(i(i(i({}, e.sort && { sort: Array.isArray(e) ? e.join(",") : e }), e.search && { [t + "~"]: e.search }), e.notNull && { [t + "!"]: "" }), e.null && { [t]: "" }), e.any && { [t]: e.any.join(",") }), e.from && { [t + "From"]: e.from }), e.to && { [t + "To"]: e.to })).reduce((t, e) => i(i({}, t), e), {});
327
+ return Object.entries(n).map(([t, e]) => typeof e != "object" ? { [t]: String(e) } : a(a(a(a(a(a(a({}, e.sort && { sort: Array.isArray(e) ? e.join(",") : e }), e.search && { [t + "~"]: e.search }), e.notNull && { [t + "!"]: "" }), e.null && { [t]: "" }), e.any && { [t]: e.any.join(",") }), e.from && { [t + "From"]: e.from }), e.to && { [t + "To"]: e.to })).reduce((t, e) => a(a({}, t), e), {});
328
328
  }
329
329
  const at = K;
330
330
  function O(n) {
@@ -339,7 +339,7 @@ function N(n) {
339
339
  const F = (n) => {
340
340
  const t = O(n), e = N(n), s = n._modelTitle, r = n.id;
341
341
  return { dmShortID: t, env: e, model: s, entryID: r };
342
- }, ct = (n) => I(F(n)), ut = (n, t) => C(f(i({}, F(n)), {
342
+ }, ct = (n) => I(F(n)), ut = (n, t) => C(f(a({}, F(n)), {
343
343
  value: t
344
344
  }));
345
345
  function lt(n, t) {
@@ -349,17 +349,17 @@ function lt(n, t) {
349
349
  function dt(l) {
350
350
  return c(this, arguments, function* ({ env: n, dmShortID: t, assetGroup: e, assetID: s, token: r }) {
351
351
  h({ env: n, dmShortID: t, assetGroup: e, assetID: s });
352
- const o = w({ assetID: s }), d = y(`a/${t}/${e}?${o}`, n);
353
- return (yield p(d, { token: r }))._embedded["ec:dm-asset"];
352
+ const o = w({ assetID: s }), d = y(`a/${t}/${e}?${o}`, n), { _embedded: i } = yield p(d, { token: r });
353
+ return i ? i["ec:dm-asset"] : void 0;
354
354
  });
355
355
  }
356
356
  function ht(n) {
357
357
  return c(this, null, function* () {
358
358
  let { env: t, dmShortID: e, assetGroup: s, token: r, options: l = {} } = n;
359
- h({ env: t, dmShortID: e, assetGroup: s }), l = i({ size: 50, page: 1, _list: !0 }, l);
360
- const o = w(l), d = y(`a/${e}/${s}?${o}`, t), { count: a, total: u, _embedded: g } = yield p(d, { token: r });
359
+ h({ env: t, dmShortID: e, assetGroup: s }), l = a({ size: 50, page: 1, _list: !0 }, l);
360
+ const o = w(l), d = y(`a/${e}/${s}?${o}`, t), { count: i, total: u, _embedded: g } = yield p(d, { token: r });
361
361
  let $ = g ? g["ec:dm-asset"] : [];
362
- return $ = Array.isArray($) ? $ : [$], { count: a, total: u, items: $ };
362
+ return $ = Array.isArray($) ? $ : [$], { count: i, total: u, items: $ };
363
363
  });
364
364
  }
365
365
  function gt(d) {
@@ -373,11 +373,11 @@ function gt(d) {
373
373
  options: o
374
374
  }) {
375
375
  h({ env: n, dmShortID: t, assetGroup: e, file: r });
376
- const a = y(`a/${t}/${e}`, n), u = new FormData();
376
+ const i = y(`a/${t}/${e}`, n), u = new FormData();
377
377
  return u.append("file", r, l), o && Object.keys(o).forEach(($) => {
378
378
  u.append($, o[$]);
379
379
  }), (yield p(
380
- a,
380
+ i,
381
381
  { token: s },
382
382
  {
383
383
  method: "POST",
@@ -416,36 +416,36 @@ function pt(n) {
416
416
  function yt(n) {
417
417
  return c(this, null, function* () {
418
418
  let { env: t, options: e = {} } = n;
419
- h({ env: t }), e = i({ size: 25, page: 1, _list: !0 }, e);
419
+ h({ env: t }), e = a({ size: 25, page: 1, _list: !0 }, e);
420
420
  const s = w(e), r = y(`?${s}`, t), { count: l, total: o, _embedded: d } = yield p(r, n);
421
- let a = d ? d["ec:datamanager"] : [];
422
- return a = Array.isArray(a) ? a : [a], { count: l, total: o, items: a };
421
+ let i = d ? d["ec:datamanager"] : [];
422
+ return i = Array.isArray(i) ? i : [i], { count: l, total: o, items: i };
423
423
  });
424
424
  }
425
425
  function mt(n) {
426
426
  return c(this, null, function* () {
427
427
  let { env: t, dmID: e, options: s = {} } = n;
428
- h({ env: t, dmID: e }), s = i({ size: 25, dataManagerID: e, page: 1, _list: !0 }, s);
429
- const r = w(s), l = y(`model?${r}`, t), { count: o, total: d, _embedded: a } = yield p(l, n);
430
- let u = a ? a["ec:model"] : [];
428
+ h({ env: t, dmID: e }), s = a({ size: 25, dataManagerID: e, page: 1, _list: !0 }, s);
429
+ const r = w(s), l = y(`model?${r}`, t), { count: o, total: d, _embedded: i } = yield p(l, n);
430
+ let u = i ? i["ec:model"] : [];
431
431
  return u = Array.isArray(u) ? u : [u], { count: o, total: d, items: u };
432
432
  });
433
433
  }
434
434
  function $t(n) {
435
435
  return c(this, null, function* () {
436
436
  let { env: t, resource: e, options: s = {}, subdomain: r = "datamanager" } = n;
437
- h({ env: t, subdomain: r, resource: e }), s = i({ size: 25, page: 1, _list: !0 }, s);
438
- const l = w(s), o = y(`${e}?${l}`, t, r), { count: d, total: a, _embedded: u } = yield p(o, n);
437
+ h({ env: t, subdomain: r, resource: e }), s = a({ size: 25, page: 1, _list: !0 }, s);
438
+ const l = w(s), o = y(`${e}?${l}`, t, r), { count: d, total: i, _embedded: u } = yield p(o, n);
439
439
  let g = u ? u[Object.keys(u)[0]] : [];
440
- return g = Array.isArray(g) ? g : [g], { count: d, total: a, items: g };
440
+ return g = Array.isArray(g) ? g : [g], { count: d, total: i, items: g };
441
441
  });
442
442
  }
443
443
  function wt(e) {
444
444
  return c(this, arguments, function* (n, t = {}) {
445
445
  let { env: s, route: r, options: l = {}, subdomain: o = "datamanager" } = n;
446
- h({ env: s, subdomain: o, route: r }), l = i({}, l);
447
- const d = w(l), a = y(`${r}?${d}`, s, o);
448
- return p(a, n, t);
446
+ h({ env: s, subdomain: o, route: r }), l = a({}, l);
447
+ const d = w(l), i = y(`${r}?${d}`, s, o);
448
+ return p(i, n, t);
449
449
  });
450
450
  }
451
451
  const A = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -520,7 +520,7 @@ class j {
520
520
  this.config = t;
521
521
  }
522
522
  set(t) {
523
- return new j(i(i({}, this.config), t));
523
+ return new j(a(a({}, this.config), t));
524
524
  }
525
525
  /**
526
526
  * Loads entry list. Expects `dmShortID` / `model` to be set.
@@ -538,7 +538,7 @@ class j {
538
538
  entries() {
539
539
  return c(this, arguments, function* (t = {}) {
540
540
  const e = yield this.getBestToken();
541
- return Et(f(i({}, this.config), { options: t, token: e }));
541
+ return Et(f(a({}, this.config), { options: t, token: e }));
542
542
  });
543
543
  }
544
544
  entryList(t) {
@@ -560,7 +560,7 @@ class j {
560
560
  mapEntries(s) {
561
561
  return c(this, arguments, function* (t, e = {}) {
562
562
  const r = yield this.getBestToken();
563
- return At(f(i({}, this.config), { options: e, token: r }), t);
563
+ return At(f(a({}, this.config), { options: e, token: r }), t);
564
564
  });
565
565
  }
566
566
  /**
@@ -575,7 +575,7 @@ class j {
575
575
  getEntry(t) {
576
576
  return c(this, null, function* () {
577
577
  const e = yield this.getBestToken();
578
- return bt(f(i({}, this.config), { entryID: t, token: e }));
578
+ return bt(f(a({}, this.config), { entryID: t, token: e }));
579
579
  });
580
580
  }
581
581
  /**
@@ -595,7 +595,7 @@ class j {
595
595
  editEntrySafe(t, e) {
596
596
  return c(this, null, function* () {
597
597
  const s = yield this.getBestToken();
598
- return v(f(i({}, this.config), { entryID: t, token: s, value: e, safePut: !0 }));
598
+ return v(f(a({}, this.config), { entryID: t, token: s, value: e, safePut: !0 }));
599
599
  });
600
600
  }
601
601
  /**
@@ -627,7 +627,7 @@ class j {
627
627
  assets(t) {
628
628
  return c(this, null, function* () {
629
629
  const e = yield this.getBestToken();
630
- return Tt(f(i({}, this.config), { options: t, token: e }));
630
+ return Tt(f(a({}, this.config), { options: t, token: e }));
631
631
  });
632
632
  }
633
633
  assetList(t) {
@@ -659,7 +659,7 @@ class j {
659
659
  createAsset() {
660
660
  return c(this, arguments, function* ({ file: t, name: e, options: s } = {}) {
661
661
  const r = yield this.getBestToken();
662
- return _t(f(i({}, this.config), { file: t, name: e, options: s, token: r }));
662
+ return _t(f(a({}, this.config), { file: t, name: e, options: s, token: r }));
663
663
  });
664
664
  }
665
665
  /**
@@ -674,7 +674,7 @@ class j {
674
674
  deleteAsset(t) {
675
675
  return c(this, null, function* () {
676
676
  const e = yield this.getBestToken();
677
- return Ot(f(i({}, this.config), { token: e, assetID: t }));
677
+ return Ot(f(a({}, this.config), { token: e, assetID: t }));
678
678
  });
679
679
  }
680
680
  /**
@@ -689,7 +689,7 @@ class j {
689
689
  getAsset(t) {
690
690
  return c(this, null, function* () {
691
691
  const e = yield this.getBestToken();
692
- return kt(f(i({}, this.config), { assetID: t, token: e }));
692
+ return kt(f(a({}, this.config), { assetID: t, token: e }));
693
693
  });
694
694
  }
695
695
  /**
@@ -704,7 +704,7 @@ class j {
704
704
  createEntry(t) {
705
705
  return c(this, null, function* () {
706
706
  const e = yield this.getBestToken();
707
- return jt(f(i({}, this.config), { token: e, value: t }));
707
+ return jt(f(a({}, this.config), { token: e, value: t }));
708
708
  });
709
709
  }
710
710
  /**
@@ -720,7 +720,7 @@ class j {
720
720
  editEntry(t, e) {
721
721
  return c(this, null, function* () {
722
722
  const s = yield this.getBestToken();
723
- return v(f(i({}, this.config), { entryID: t, token: s, value: e }));
723
+ return v(f(a({}, this.config), { entryID: t, token: s, value: e }));
724
724
  });
725
725
  }
726
726
  /**
@@ -735,7 +735,7 @@ class j {
735
735
  deleteEntry(t) {
736
736
  return c(this, null, function* () {
737
737
  const e = yield this.getBestToken();
738
- return Pt(f(i({}, this.config), { token: e, entryID: t }));
738
+ return Pt(f(a({}, this.config), { token: e, entryID: t }));
739
739
  });
740
740
  }
741
741
  /**
@@ -750,7 +750,7 @@ class j {
750
750
  resourceList(t) {
751
751
  return c(this, null, function* () {
752
752
  const e = yield this.getBestToken();
753
- return It(f(i({}, this.config), { options: t, token: e }));
753
+ return It(f(a({}, this.config), { options: t, token: e }));
754
754
  });
755
755
  }
756
756
  /**
@@ -767,7 +767,7 @@ class j {
767
767
  raw(t, e) {
768
768
  return c(this, null, function* () {
769
769
  const s = yield this.getBestToken();
770
- return Kt(f(i({}, this.config), { options: t, token: s }), e);
770
+ return Kt(f(a({}, this.config), { options: t, token: s }), e);
771
771
  });
772
772
  }
773
773
  storageAdapter(t) {
@@ -796,24 +796,24 @@ class j {
796
796
  return e(t);
797
797
  }
798
798
  loginEc(t) {
799
- return Bt(i(i({}, this.config), t)).then(
799
+ return Bt(a(a({}, this.config), t)).then(
800
800
  this.setAuth(T(this.config))
801
801
  );
802
802
  }
803
803
  loginPublic(t) {
804
- return Lt(i(i({}, this.config), t)).then(
804
+ return Lt(a(a({}, this.config), t)).then(
805
805
  this.setAuth(_(this.config))
806
806
  );
807
807
  }
808
808
  logoutPublic() {
809
809
  const t = this.getPublicToken();
810
- return vt(f(i({}, this.config), { token: t })).then(
810
+ return vt(f(a({}, this.config), { token: t })).then(
811
811
  this.unsetAuth(_(this.config))
812
812
  );
813
813
  }
814
814
  logoutEc() {
815
815
  const t = this.getEcToken();
816
- return Dt(f(i({}, this.config), { token: t })).then(
816
+ return Dt(f(a({}, this.config), { token: t })).then(
817
817
  this.unsetAuth(T(this.config))
818
818
  );
819
819
  }
@@ -933,7 +933,7 @@ class j {
933
933
  getDatamanager(t) {
934
934
  return c(this, null, function* () {
935
935
  const e = yield this.getBestToken();
936
- return Ct(f(i({}, this.config), { dmID: t, token: e }));
936
+ return Ct(f(a({}, this.config), { dmID: t, token: e }));
937
937
  });
938
938
  }
939
939
  /**
@@ -947,7 +947,7 @@ class j {
947
947
  dmList() {
948
948
  return c(this, arguments, function* (t = {}) {
949
949
  const e = yield this.getBestToken();
950
- return qt(f(i({}, this.config), { options: t, token: e }));
950
+ return qt(f(a({}, this.config), { options: t, token: e }));
951
951
  });
952
952
  }
953
953
  /**
@@ -961,7 +961,7 @@ class j {
961
961
  modelList() {
962
962
  return c(this, arguments, function* (t = {}) {
963
963
  const e = yield this.getBestToken();
964
- return xt(f(i({}, this.config), { options: t, token: e }));
964
+ return xt(f(a({}, this.config), { options: t, token: e }));
965
965
  });
966
966
  }
967
967
  }
package/dist/lib/api.d.ts CHANGED
@@ -90,11 +90,37 @@ export declare class Sdk {
90
90
  * const files = await sdk("stage").token(token).dm("83cc6374").assetGroup("avatars").assets()
91
91
  */
92
92
  assets(options: any): Promise<{
93
+ /**
94
+ * Loads entry list. Expects `dmShortID` / `model` to be set.
95
+ * If the model is not public, you also need to provide a `token`.
96
+ *
97
+ * @param {object=} options options for entry list request.
98
+ * @returns {Promise<EntryList>}
99
+ * @example
100
+ * // public model
101
+ * const muffins = await sdk("stage").dm("83cc6374").model("muffin").entries()
102
+ * @example
103
+ * // non-public model
104
+ * const secrets = await sdk("stage").token(token).dm("83cc6374").model("secret").entries()
105
+ */
93
106
  count: any;
94
107
  total: any;
95
108
  items: any;
96
109
  }>;
97
110
  assetList(options: any): Promise<{
111
+ /**
112
+ * Loads entry list. Expects `dmShortID` / `model` to be set.
113
+ * If the model is not public, you also need to provide a `token`.
114
+ *
115
+ * @param {object=} options options for entry list request.
116
+ * @returns {Promise<EntryList>}
117
+ * @example
118
+ * // public model
119
+ * const muffins = await sdk("stage").dm("83cc6374").model("muffin").entries()
120
+ * @example
121
+ * // non-public model
122
+ * const secrets = await sdk("stage").token(token).dm("83cc6374").model("secret").entries()
123
+ */
98
124
  count: any;
99
125
  total: any;
100
126
  items: any;
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/lib/api.ts"],"names":[],"mappings":"AAKA,cAAc,QAAQ,CAAC;AA4BvB,wBAAgB,GAAG,CAAC,MAAM,KAAA,OAWzB;AAED;;GAEG;AACH,qBAAa,GAAG;IACd,MAAM,EAAE,GAAG,CAAC;gBACA,MAAM,KAAA;IAIlB,GAAG,CAAC,GAAG,KAAA;IAKP;;;;;;;;;;;;OAYG;IACG,OAAO,CAAC,OAAO,KAAK;;;;;IAIpB,SAAS,CAAC,OAAO,KAAA;;;;;IAIvB;;;;;;;;;;OAUG;IACG,UAAU,CAAC,EAAE,KAAA,EAAE,OAAO,KAAK;IAIjC;;;;;;;;OAQG;IACG,QAAQ,CAAC,OAAO,KAAA;IAItB;;;;;;;;;;;;;OAaG;IACG,aAAa,CAAC,OAAO,KAAA,EAAE,KAAK,KAAA;IAIlC;;;;;;;OAOG;IACG,SAAS;IAGf;;;;;;;;;;;;OAYG;IACG,MAAM,CAAC,OAAO,KAAA;;;;;IAId,SAAS,CAAC,OAAO,KAAA;;;;;IAGvB;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,GAAE,GAAQ;IAInD;;;;;;;;OAQG;IACG,WAAW,CAAC,OAAO,KAAA;IAIzB;;;;;;;;OAQG;IACG,QAAQ,CAAC,OAAO,KAAA;IAKtB;;;;;;;;OAQG;IACG,WAAW,CAAC,KAAK,KAAA;IAIvB;;;;;;;;;OASG;IACG,SAAS,CAAC,OAAO,KAAA,EAAE,KAAK,KAAA;IAI9B;;;;;;;;OAQG;IACG,WAAW,CAAC,OAAO,KAAA;IAKzB;;;;;;;;OAQG;IACG,YAAY,CAAC,OAAO,KAAA;;;;;IAK1B;;;;;;;;;;OAUG;IACG,GAAG,CAAC,OAAO,KAAA,EAAE,YAAY,KAAA;IAK/B,cAAc,CAAC,cAAc,KAAA;IAK7B,OAAO,CAAC,GAAG,KAAA;IAUX,SAAS,CAAC,GAAG,KAAA;IAUb,OAAO,CAAC,GAAG,KAAA;IAQX,OAAO,CAAC,MAAM,KAAA;IAKd,WAAW,CAAC,MAAM,KAAA;IAOlB,YAAY;IAOZ,QAAQ;IAOR,cAAc;IAGd,UAAU;IAGV,cAAc;IAGd,UAAU;IAGV,WAAW;IAGX,YAAY;IAOZ;;;;OAIG;IACH,KAAK,CAAC,KAAK,KAAA;IAGX;;;;OAIG;IACH,KAAK,CAAC,KAAK,KAAA;IAGX;;;;OAIG;IACH,SAAS,CAAC,SAAS,KAAA;IAGnB;;;;OAIG;IACH,IAAI,CAAC,IAAI,KAAA;IAGT;;;;OAIG;IACH,EAAE,CAAC,SAAS,KAAA;IAGZ;;;;OAIG;IACH,UAAU,CAAC,UAAU,KAAA;IAGrB;;;;OAIG;IACH,UAAU,CAAC,UAAU,KAAA;IAGrB;;;;OAIG;IACH,SAAS,CAAC,SAAS,KAAA;IAGnB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,KAAA;IAGjB;;;;OAIG;IACH,KAAK,CAAC,KAAK,KAAA;IAIX;;;OAGG;IACH,SAAS;IAIT;;;OAGG;IACG,cAAc,CAAC,IAAI,KAAA;IAKzB;;;;;;;OAOG;IACG,MAAM,CAAC,OAAO,KAAK;;;;;IAIzB;;;;;;;OAOG;IACG,SAAS,CAAC,OAAO,KAAK;;;;;CAI7B;AAED,eAAO,MAAM,GAAG,mBAA4B,CAAC;AAC7C,eAAO,MAAM,GAAG,mBAAM,CAAC"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/lib/api.ts"],"names":[],"mappings":"AAKA,cAAc,QAAQ,CAAC;AA4BvB,wBAAgB,GAAG,CAAC,MAAM,KAAA,OAWzB;AAED;;GAEG;AACH,qBAAa,GAAG;IACd,MAAM,EAAE,GAAG,CAAC;gBACA,MAAM,KAAA;IAIlB,GAAG,CAAC,GAAG,KAAA;IAKP;;;;;;;;;;;;OAYG;IACG,OAAO,CAAC,OAAO,KAAK;;;;;IAIpB,SAAS,CAAC,OAAO,KAAA;;;;;IAIvB;;;;;;;;;;OAUG;IACG,UAAU,CAAC,EAAE,KAAA,EAAE,OAAO,KAAK;IAIjC;;;;;;;;OAQG;IACG,QAAQ,CAAC,OAAO,KAAA;IAItB;;;;;;;;;;;;;OAaG;IACG,aAAa,CAAC,OAAO,KAAA,EAAE,KAAK,KAAA;IAIlC;;;;;;;OAOG;IACG,SAAS;IAGf;;;;;;;;;;;;OAYG;IACG,MAAM,CAAC,OAAO,KAAA;QA3FpB;;;;;;;;;;;;WAYG;;;;;IAmFG,SAAS,CAAC,OAAO,KAAA;QA/FvB;;;;;;;;;;;;WAYG;;;;;IAsFH;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,GAAE,GAAQ;IAInD;;;;;;;;OAQG;IACG,WAAW,CAAC,OAAO,KAAA;IAIzB;;;;;;;;OAQG;IACG,QAAQ,CAAC,OAAO,KAAA;IAKtB;;;;;;;;OAQG;IACG,WAAW,CAAC,KAAK,KAAA;IAIvB;;;;;;;;;OASG;IACG,SAAS,CAAC,OAAO,KAAA,EAAE,KAAK,KAAA;IAI9B;;;;;;;;OAQG;IACG,WAAW,CAAC,OAAO,KAAA;IAKzB;;;;;;;;OAQG;IACG,YAAY,CAAC,OAAO,KAAA;;;;;IAK1B;;;;;;;;;;OAUG;IACG,GAAG,CAAC,OAAO,KAAA,EAAE,YAAY,KAAA;IAK/B,cAAc,CAAC,cAAc,KAAA;IAK7B,OAAO,CAAC,GAAG,KAAA;IAUX,SAAS,CAAC,GAAG,KAAA;IAUb,OAAO,CAAC,GAAG,KAAA;IAQX,OAAO,CAAC,MAAM,KAAA;IAKd,WAAW,CAAC,MAAM,KAAA;IAOlB,YAAY;IAOZ,QAAQ;IAOR,cAAc;IAGd,UAAU;IAGV,cAAc;IAGd,UAAU;IAGV,WAAW;IAGX,YAAY;IAOZ;;;;OAIG;IACH,KAAK,CAAC,KAAK,KAAA;IAGX;;;;OAIG;IACH,KAAK,CAAC,KAAK,KAAA;IAGX;;;;OAIG;IACH,SAAS,CAAC,SAAS,KAAA;IAGnB;;;;OAIG;IACH,IAAI,CAAC,IAAI,KAAA;IAGT;;;;OAIG;IACH,EAAE,CAAC,SAAS,KAAA;IAGZ;;;;OAIG;IACH,UAAU,CAAC,UAAU,KAAA;IAGrB;;;;OAIG;IACH,UAAU,CAAC,UAAU,KAAA;IAGrB;;;;OAIG;IACH,SAAS,CAAC,SAAS,KAAA;IAGnB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,KAAA;IAGjB;;;;OAIG;IACH,KAAK,CAAC,KAAK,KAAA;IAIX;;;OAGG;IACH,SAAS;IAIT;;;OAGG;IACG,cAAc,CAAC,IAAI,KAAA;IAKzB;;;;;;;OAOG;IACG,MAAM,CAAC,OAAO,KAAK;;;;;IAIzB;;;;;;;OAOG;IACG,SAAS,CAAC,OAAO,KAAK;;;;;CAI7B;AAED,eAAO,MAAM,GAAG,mBAA4B,CAAC;AAC7C,eAAO,MAAM,GAAG,mBAAM,CAAC"}
@@ -68,7 +68,7 @@ export declare const filterOptions: typeof sdkOptions;
68
68
  /**
69
69
  * Returns the shortID of the given EntryResource
70
70
  *
71
- * @param {@type {import('./api.mjs').EntryResource}} entry EntryResource
71
+ * @param {EntryResource}} entry EntryResource
72
72
  * @returns {string}
73
73
  *
74
74
  */
@@ -76,7 +76,7 @@ export declare function getEntryShortID(entry: any): any;
76
76
  /**
77
77
  * Returns the env of the given EntryResource
78
78
  *
79
- * @param {@type {import('./api.mjs').EntryResource}} entry EntryResource
79
+ * @param {EntryResource}} entry EntryResource
80
80
  * @returns {string}
81
81
  *
82
82
  */
@@ -86,8 +86,8 @@ export declare const editEntryObject: (entry: any, value: any) => Promise<any>;
86
86
  /**
87
87
  * Returns the embedded asset from the given field name and EntryResource
88
88
  *
89
- * @param {@type {import('./api.mjs').EntryResource}} entry EntryResource
90
- * @returns {@type {import('./api.mjs').AssetResource}}
89
+ * @param {EntryResource}} entry EntryResource
90
+ * @returns {AssetResource}}
91
91
  *
92
92
  */
93
93
  export declare function getEntryAsset(field: any, entry: any): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ec.fdk",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "description": "ec frontend sdk",
5
5
  "main": "dist/index.cjs",
6
6
  "directories": {
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "scripts": {
32
32
  "build": "vite build && tsc",
33
- "docs": "typedoc"
33
+ "docs": "typedoc --out ../../docs"
34
34
  },
35
35
  "module": "dist/index.mjs",
36
36
  "types": "dist/index.d.ts"
package/docs/.nojekyll DELETED
@@ -1 +0,0 @@
1
- TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
@@ -1 +0,0 @@
1
- window.hierarchyData = "eJyrVirKzy8pVrKKjtVRKkpNy0lNLsnMzytWsqqurQUAmx4Kpg=="