ec.fdk 0.6.4 → 0.7.0
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/README.md +7 -34
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +458 -402
- package/dist/lib/admin.d.ts +42 -17
- package/dist/lib/admin.d.ts.map +1 -1
- package/dist/lib/api.d.ts +236 -167
- package/dist/lib/api.d.ts.map +1 -1
- package/dist/lib/assets.d.ts +13 -8
- package/dist/lib/assets.d.ts.map +1 -1
- package/dist/lib/auth.d.ts +12 -2
- package/dist/lib/auth.d.ts.map +1 -1
- package/dist/lib/entries.d.ts +40 -30
- package/dist/lib/entries.d.ts.map +1 -1
- package/dist/lib/util.d.ts +11 -0
- package/dist/lib/util.d.ts.map +1 -1
- package/dist/types.d.ts +24 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -2
- package/typedoc.json +67 -0
- package/docs/.nojekyll +0 -1
- package/docs/assets/hierarchy.js +0 -1
- package/docs/assets/highlight.css +0 -85
- package/docs/assets/icons.js +0 -18
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -60
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1610
- package/docs/classes/Sdk.html +0 -181
- package/docs/functions/act.html +0 -1
- package/docs/functions/apiURL.html +0 -1
- package/docs/functions/assetList.html +0 -1
- package/docs/functions/createAsset.html +0 -1
- package/docs/functions/createEntry.html +0 -1
- package/docs/functions/deleteAsset.html +0 -1
- package/docs/functions/deleteEntry.html +0 -1
- package/docs/functions/deleteEntryObject.html +0 -1
- package/docs/functions/dmList.html +0 -1
- package/docs/functions/editEntry.html +0 -1
- package/docs/functions/editEntryObject.html +0 -1
- package/docs/functions/entryList.html +0 -1
- package/docs/functions/expect.html +0 -1
- package/docs/functions/fdk.html +0 -1
- package/docs/functions/fetcher.html +0 -1
- package/docs/functions/filterOptions.html +0 -3
- package/docs/functions/getAsset.html +0 -1
- package/docs/functions/getDatamanager.html +0 -1
- package/docs/functions/getEcAuthKey.html +0 -1
- package/docs/functions/getEntry.html +0 -1
- package/docs/functions/getEntryAsset.html +0 -3
- package/docs/functions/getEntryEnv.html +0 -2
- package/docs/functions/getEntryShortID.html +0 -2
- package/docs/functions/getPublicAuthKey.html +0 -1
- package/docs/functions/getSchema.html +0 -1
- package/docs/functions/loginEc.html +0 -1
- package/docs/functions/loginPublic.html +0 -1
- package/docs/functions/logoutEc.html +0 -1
- package/docs/functions/logoutPublic.html +0 -1
- package/docs/functions/mapEntries.html +0 -1
- package/docs/functions/modelList.html +0 -1
- package/docs/functions/publicApi.html +0 -1
- package/docs/functions/query.html +0 -1
- package/docs/functions/raw.html +0 -1
- package/docs/functions/resourceList.html +0 -1
- package/docs/functions/sdk-1.html +0 -1
- package/docs/functions/sdkOptions.html +0 -3
- package/docs/index.html +0 -80
- package/docs/modules.html +0 -1
- package/docs/variables/apis.html +0 -1
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<div style="width:180px;float:right">
|
|
2
|
+
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 600.7"><path d="M422.28,308.6c12.1,.99,24.4,1.93,36.68,3.02,10.25,.91,20.47,2.25,30.73,2.95,8.72,.59,16.86-1.5,23.84-7.14,.67-.54,1.5-.89,3.35-.97-.51,2.22-.35,4.99-1.65,6.54-3.35,3.95-6.84,8.19-11.18,10.83-11.86,7.22-25.26,10.37-38.95,10.76-13.61,.38-27.26-.86-40.9-1.16-9.3-.21-18.61-.04-27.91,.51,67.15,9.38,61.72,8.24,89.33,4-18.08,12.19-36.83,20.92-57.58,26.24,7.5,2.43,11.84,2.44,26.68,.21-.14,3.48-2.65,7.26-7.16,10.55-10.06,7.34-21.67,11.05-33.55,13.95-19.56,4.77-39.52,4.97-59.5,4.64-4.34-.07-8.68-.01-13.08,.5,13.06,5.11,26.62,7.46,40.58,8.25,14.01,.8,27.7-.13,41.35-5.71-1.72,6.11-4.73,10.97-8.58,15.2-13.73,15.11-31.1,23.32-51.16,25.82-8.13,1.01-16.37,1.11-24.88,1.64,7.81,4.66,16.19,6.12,25.16,5.64,9.06-.48,17.1-3.93,24.99-8.02l.69,1.08c-4.32,3.12-8.4,6.64-13,9.28-9.97,5.74-21,8.44-32.39,8.92-11.44,.48-22.92,.09-34.39,.17-4.05,.03-8.08,.36-11.57,2.61-.03,.42-.06,.84-.09,1.26,4.4,1.01,8.74,2.42,13.2,2.96,8.81,1.06,17.69,1.48,26.51,2.5,3.96,.46,8.31,.46,12,5.17-5.69,.88-10.65,1.97-15.66,2.37-15.15,1.2-30.32,2.19-45.48,3.14-7.99,.5-13.88,3.51-18.92,10.37-11.03,15.03-22.99,29.38-34.89,43.74-3.07,3.71-7.19,6.63-11.09,9.54-3.81,2.84-5.58,1.91-5.67-2.8-.17-9.14,1.61-18.03,5.57-26.18,5.77-11.89,12.15-23.49,18.5-35.1,1.53-2.8,1.75-4.72-.21-7.52-11.84-16.89-16.41-35.89-14.88-56.27,.48-6.41,2.51-12.7,3.83-19.05,.53,.04,1.06,.08,1.58,.12,.71,4.18,1.4,8.37,2.15,12.55,2.69,14.92,10.18,25.93,25.16,30.8,.48,.16,.99,.27,1.49,.34,.23,.03,.49-.09,1.03-.21-24.43-41.45-22.83-82.24,2.85-122.39-4.98,30.59-5.84,60.27,16.21,85.4l1.05-.21c-1.74-6.26-3.73-12.47-5.17-18.8-5.96-26.36-3.47-52.1,6.06-77.27,11.48-30.31,28.74-57.12,49.52-81.8,1.07-1.27,2.27-2.43,3.75-3.56-15.63,32.01-20.12,63.68,2.05,94.7-1.17-6.2-2.54-12.38-3.46-18.61-3.12-21.15,.23-41.53,8.08-61.21,10.57-26.48,27.36-48.55,48.77-67.19,13.82-12.03,28.71-22.59,44.54-31.81,.53-.31,1.06-.61,1.9-.52-5.28,4.71-10.58,9.39-15.82,14.14-15.82,14.35-29.43,30.37-36.68,50.83-8.79,24.81-8.11,49.39,3.27,73.45-.24-1.9-.48-3.79-.72-5.69-.25-2.04-.54-4.08-.75-6.12-2.53-24.69,3-47.77,14.1-69.68,15.33-30.27,38.64-52.73,68.11-69.05,7.04-3.9,14.28-7.42,21.72-10.73-11.64,9.33-21.57,19.84-25.93,34.45-4.32,14.5-4.72,28.76,3.9,42.3,.07-.67,.24-1.35,.2-2.01-1.8-31.86,13.48-54.27,39.33-70.67,20.17-12.8,42.33-20.47,65.93-23.39,11.94-1.48,24.14-2.04,36.16-1.57,31.31,1.23,49.5,29.26,38.31,58.8-8.47,22.34-25.75,35.7-47.51,43.79-5.34,1.99-11.07,2.94-17.49,4.59,16.75,6.65,30.66,1.21,44.37-7.67-9.53,14.85-45.53,39.76-73.29,50.86-28.3,11.31-58.02,14.03-88.26,14.97,5.4,1.04,10.75,2.49,16.2,3.03,13.43,1.32,26.89,2.85,40.37,3.14,25.98,.57,48.3-8.57,66.5-27.34,.35-.36,.77-.67,1.15-1.01l.85,.58c-2.92,4.18-5.44,8.71-8.81,12.5-23.65,26.59-51.9,46.08-87.16,53.55-11.25,2.38-23.01,2.34-34.51,3.63-12.37,1.39-24.72,3.03-37.07,4.62-1.05,.14-2.05,.69-2.69,.91Zm145.37-151.72c-1.45,.43-1.79,.5-2.1,.63-1.52,.67-3.05,1.33-4.54,2.05-50.38,24.25-95.21,56.55-136.02,94.54-38.56,35.9-73.82,74.85-105.49,116.98-29.04,38.64-55.18,79.14-77.54,122.02-4.66,8.93-8.62,18.22-12.91,27.34,13.09-14.03,25.94-27.99,36.34-44.09,40.57-62.84,84.8-122.91,135.35-178.21,43.47-47.55,90.87-90.55,144.44-126.52,7.11-4.78,14.32-9.41,22.46-14.74Z"/></svg>
|
|
3
|
+
</div>
|
|
4
|
+
|
|
1
5
|
# ec.fdk
|
|
2
6
|
|
|
3
7
|
*F*eatherweight *D*evelopment *K*it for entrecode APIs.
|
|
@@ -27,31 +31,13 @@ import { fdk } from "ec.fdk";
|
|
|
27
31
|
fdk("stage") // choose stage environment
|
|
28
32
|
.dm("83cc6374") // select datamanager via short id
|
|
29
33
|
.model("muffin") // select model muffin
|
|
30
|
-
.
|
|
34
|
+
.entryList() // load entry list
|
|
31
35
|
.then((list) => {
|
|
32
36
|
console.log(list);
|
|
33
37
|
});
|
|
34
38
|
```
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
// we want to do stuff with model muffin here
|
|
40
|
-
const muffin = fdk("stage").dm("83cc6374").model("muffin");
|
|
41
|
-
// load entry list
|
|
42
|
-
const { items } = await muffin.entries();
|
|
43
|
-
// edit first entry
|
|
44
|
-
await muffin.editEntry(items[0].id, { name: "edit!" });
|
|
45
|
-
// delete second entry
|
|
46
|
-
await muffin.deleteEntry(items[1].id);
|
|
47
|
-
// create a new muffin
|
|
48
|
-
await muffin.createEntry({ name: "new muffin" });
|
|
49
|
-
// edit third entry with safePut
|
|
50
|
-
await muffin.editEntrySafe(items[2].id, {
|
|
51
|
-
_modified: items[2]._modified,
|
|
52
|
-
name: "safePut!",
|
|
53
|
-
});
|
|
54
|
-
```
|
|
40
|
+
See all functions in the [Fdk reference](/docs/classes/Fdk.html).
|
|
55
41
|
|
|
56
42
|
### act
|
|
57
43
|
|
|
@@ -66,20 +52,7 @@ const muffins = await act({
|
|
|
66
52
|
});
|
|
67
53
|
```
|
|
68
54
|
|
|
69
|
-
|
|
70
|
-
and additional keys that are required to perform the action.
|
|
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
|
-
For example, this is how the `entryList` function looks:
|
|
73
|
-
|
|
74
|
-
```js
|
|
75
|
-
export async function entryList(config) {
|
|
76
|
-
let { env, dmShortID, model, options = {} } = config;
|
|
77
|
-
expect({ env, dmShortID, model });
|
|
78
|
-
/* more stuff */
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
here you can clearly see the available params.
|
|
55
|
+
More in the [act reference](/docs/functions/act.html).
|
|
83
56
|
|
|
84
57
|
### Using act with swr / react-query
|
|
85
58
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
${
|
|
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 pt=Object.defineProperty,yt=Object.defineProperties;var mt=Object.getOwnPropertyDescriptors;var x=Object.getOwnPropertySymbols;var kt=Object.prototype.hasOwnProperty,$t=Object.prototype.propertyIsEnumerable;var z=(n,t,e)=>t in n?pt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,o=(n,t)=>{for(var e in t||(t={}))kt.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},h=(n,t)=>yt(n,mt(t));var c=(n,t,e)=>new Promise((s,r)=>{var u=a=>{try{d(e.next(a))}catch(l){r(l)}},i=a=>{try{d(e.throw(a))}catch(l){r(l)}},d=a=>a.done?s(a.value):Promise.resolve(a.value).then(u,i);d((e=e.apply(n,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function p(s){return c(this,arguments,function*(n,t={},e={}){var d;const{token:r,rawRes:u}=t;r&&(e.headers=h(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 a=yield i.json(),l=`${a.title}
|
|
2
|
+
${a.detail}
|
|
3
|
+
${a.verbose}`;throw new Error(l)}throw new Error(`unexpected fetch error: ${i.statusText}`)}return u?i:yield i.json()})}const E={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=E[e];if(!s)throw new Error(`subdomain "${e}" not found. Try one of ${Object.keys(E).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 $(n,t=!0){return Object.entries(n).sort((e,s)=>e[0].localeCompare(s[0])).map(([e,s])=>`${e}=${s}`).join("&")}function g(n){Object.entries(n).forEach(([t,e])=>{if(e===void 0)throw new Error(`expected ${t} to be set!`)})}const N={stage:"https://accounts.cachena.entrecode.de/",live:"https://accounts.entrecode.de/"};function J(n){return c(this,null,function*(){let{env:t,dmShortID:e,email:s,password:r}=n;g({env:t,dmShortID:e,email:s,password:r});const u=y(`api/${e}/_auth/login?clientID=rest`,t);return yield p(u,{},{method:"POST",body:JSON.stringify({email:s,password:r}),headers:{"Content-Type":"application/json"}})})}function R(n){return c(this,null,function*(){let{env:t,email:e,password:s}=n;g({env:t,email:e,password:s});const r=`${N[t]}auth/login?clientID=rest`;return yield p(r,{},{method:"POST",body:JSON.stringify({email:e,password:s}),headers:{"Content-Type":"application/json"}})})}function U(n){return c(this,null,function*(){let{dmShortID:t,env:e,token:s}=n;g({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 M(n){return c(this,null,function*(){let{env:t,token:e}=n;g({env:t,token:e});const s=`${N[t]}auth/logout?clientID=rest`;return yield p(s,{rawRes:!0,token:e},{method:"POST"})})}function V({dmShortID:n}){return g({dmShortID:n}),n}function G({env:n}){return g({env:n}),n}let wt=["created","creator","id","modified","private","_created","_creator","_embedded","_entryTitle","_id","_links","_modelTitle","_modelTitleField","_modified"];function H(n){let t={};for(let e in n)wt.includes(e)||(t[e]=n[e]);return t}function Et(n){return JSON.parse(JSON.stringify(n))}function Q(n){return c(this,null,function*(){let{env:t,dmShortID:e}=n;g({env:t,dmShortID:e});const s=y(`api/${e}`,t);return p(s,n)})}function S(n){return c(this,null,function*(){let{env:t,dmShortID:e,model:s,options:r={}}=n;g({env:t,dmShortID:e,model:s}),r=o({size:50,page:1,_list:!0},r);const u=$(r),i=y(`api/${e}/${s}?${u}`,t),{count:d,total:a,_embedded:l}=yield p(i,n);let f=l?l[`${e}:${s}`]:[];return f=Array.isArray(f)?f:[f],{count:d,total:a,items:f}})}function W({env:n,dmShortID:t,model:e,entryID:s,token:r}){g({env:n,dmShortID:t,model:e,entryID:s});const u=$({_id:s}),i=y(`api/${t}/${e}?${u}`,n);return p(i,{token:r})}function X(u){return c(this,arguments,function*({env:n,dmShortID:t,model:e,value:s,token:r}){g({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 c(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,value:r,token:u,safePut:i=!1}){g({env:n,dmShortID:t,model:e,entryID:s,value:r});const a={"Content-Type":"application/json"};if(i){if(!("_modified"in r))throw new Error("expected _modified to be set!");a["If-Unmodified-Since"]=new Date(r._modified).toUTCString()}const l=y(`api/${t}/${e}?_id=${s}`,n);return r=Et(r),r=H(r),yield p(l,{token:u},{method:"PUT",headers:a,body:JSON.stringify(r)})})}function L({env:n,dmShortID:t,model:e,entryID:s,token:r}){g({env:n,dmShortID:t,model:e,entryID:s});const u=y(`api/${t}/${e}?_id=${s}`,n);return p(u,{token:r,rawRes:!0},{method:"DELETE",headers:{"Content-Type":"application/json"}})}function Y(n,t){return c(this,null,function*(){let{env:e,dmShortID:s,model:r,options:u={}}=n;g({env:e,dmShortID:s,model:r}),n.options=o({size:50,page:1,_list:!0},u);let i=0,d,a=[];for(;d===void 0||i<d;){const l=yield S(n);for(let f of l.items)a.push(yield t(f));i+=l.items.length,d=l.total,n.options.page++}return a})}function Z(r){return c(this,arguments,function*({env:n,dmShortID:t,model:e,withMetadata:s}){var f,k,D,q,I;g({env:n,dmShortID:t,model:e});const u=y(`api/schema/${t}/${e}`,n),i=yield p(u),d=(f=i==null?void 0:i.allOf)==null?void 0:f[1];if(typeof d.properties!="object")throw new Error(`getSchema: ${u} returned unexpected format: ${JSON.stringify(i)}`);const{properties:a}=d,l=H(a);for(let w in l){let m=l[w];if(m.required=d.required.includes(w),(k=l[w])!=null&&k.oneOf&&((D=l[w])==null||delete D.oneOf),(q=m.title)!=null&&q.includes("<")&&((I=m.title)!=null&&I.includes(">"))){const j=m.title.split("<")[1].slice(0,-1),ft=m.title.split("<")[0];m.type=ft,j.includes(":")?m.resource=j.split(":")[1]:m.resource=j}else["asset","entry","assets","entries"].includes(m.title)?(m.type=m.title,m.resource=null):m.type=m.title;delete l[w].title}if(s){const w=a._modelTitle.title,m=a._modelTitleField.title;return{properties:l,meta:{modelTitleField:m,modelTitle:w}}}return l})}function v(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 tt=v;function _(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(E.datamanager).find(s=>E.datamanager[s]===t)}const et=n=>{const t=_(n),e=B(n),s=n._modelTitle,r=n.id;return{dmShortID:t,env:e,model:s,entryID:r}},nt=n=>L(et(n)),st=(n,t)=>P(h(o({},et(n)),{value:t}));function rt(n,t){const e=_(t);return t._embedded[`${e}:${t._modelTitle}/${n}/asset`]}function ot(u){return c(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){g({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=$({assetID:s}),d=y(`a/${t}/${e}?${i}`,n),{_embedded:a}=yield p(d,{token:r});return a?a["ec:dm-asset"]:void 0})}function it(n){return c(this,null,function*(){let{env:t,dmShortID:e,assetGroup:s,token:r,options:u={}}=n;g({env:t,dmShortID:e,assetGroup:s}),u=o({size:50,page:1,_list:!0},u);const i=$(u),d=y(`a/${e}/${s}?${i}`,t),{count:a,total:l,_embedded:f}=yield p(d,{token:r});let k=f?f["ec:dm-asset"]:[];return k=Array.isArray(k)?k:[k],{count:a,total:l,items:k}})}function at(d){return c(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,token:s,file:r,name:u,options:i}){g({env:n,dmShortID:t,assetGroup:e,file:r});const a=y(`a/${t}/${e}`,n),l=new FormData;return l.append("file",r,u),i&&Object.keys(i).forEach(k=>{l.append(k,i[k])}),(yield p(a,{token:s},{method:"POST",body:l}))._embedded["ec:dm-asset"]})}function ct(u){return c(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){g({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 ut(n){return c(this,null,function*(){let{env:t,dmID:e,token:s}=n;g({env:t,dmID:e});const r=y(`?dataManagerID=${e}`,t);return p(r,{token:s})})}function lt(n){return c(this,null,function*(){let{env:t,options:e={}}=n;g({env:t}),e=o({size:25,page:1,_list:!0},e);const s=$(e),r=y(`?${s}`,t),{count:u,total:i,_embedded:d}=yield p(r,n);let a=d?d["ec:datamanager"]:[];return a=Array.isArray(a)?a:[a],{count:u,total:i,items:a}})}function dt(n){return c(this,null,function*(){let{env:t,dmID:e,options:s={}}=n;g({env:t,dmID:e}),s=o({size:25,dataManagerID:e,page:1,_list:!0},s);const r=$(s),u=y(`model?${r}`,t),{count:i,total:d,_embedded:a}=yield p(u,n);let l=a?a["ec:model"]:[];return l=Array.isArray(l)?l:[l],{count:i,total:d,items:l}})}function gt(n){return c(this,null,function*(){let{env:t,resource:e,options:s={},subdomain:r="datamanager"}=n;g({env:t,subdomain:r,resource:e}),s=o({size:25,page:1,_list:!0},s);const u=$(s),i=y(`${e}?${u}`,t,r),{count:d,total:a,_embedded:l}=yield p(i,n);let f=l?l[Object.keys(l)[0]]:[];return f=Array.isArray(f)?f:[f],{count:d,total:a,items:f}})}function ht(e){return c(this,arguments,function*(n,t={}){let{env:s,route:r,options:u={},subdomain:i="datamanager"}=n;g({env:s,subdomain:i,route:r}),u=o({},u);const d=$(u),a=y(`${r}?${d}`,s,i);return p(a,n,t)})}const A=Object.freeze(Object.defineProperty({__proto__:null,assetList:it,createAsset:at,createEntry:X,deleteAsset:ct,deleteEntry:L,deleteEntryObject:nt,dmList:lt,editEntry:P,editEntryObject:st,entryList:S,filterOptions:tt,getAsset:ot,getDatamanager:ut,getEcAuthKey:G,getEntry:W,getEntryAsset:rt,getEntryEnv:B,getEntryShortID:_,getPublicAuthKey:V,getSchema:Z,loginEc:R,loginPublic:J,logoutEc:M,logoutPublic:U,mapEntries:Y,modelList:dt,publicApi:Q,raw:ht,resourceList:gt,sdkOptions:v},Symbol.toStringTag,{value:"Module"})),{entryList:C,mapEntries:Tt,getEntry:bt,getAsset:At,assetList:F,createAsset:_t,deleteAsset:Ot,createEntry:jt,editEntry:K,deleteEntry:St,getSchema:Pt,loginPublic:Lt,loginEc:vt,logoutEc:Bt,logoutPublic:Dt,getEcAuthKey:T,getPublicAuthKey:b,dmList:qt,modelList:It,publicApi:xt,getDatamanager:zt,resourceList:Ct,raw:Ft}=A;function Kt(n){const{action:t}=n;if(g({action:t}),!A[t])throw new Error(`"${t}" does not exist! try one of ${Object.keys(A).join(", ")}`);return A[t](n)}class O{constructor(t={}){if(!t.storageAdapter){let e=new Map;t.storageAdapter={get:s=>e.get(s),set:(s,r)=>e.set(s,r),remove:s=>e.delete(s)}}this.config=t}set(t){return new O(o(o({},this.config),t))}entries(){return c(this,arguments,function*(t={}){const e=yield this.getBestToken();return C(h(o({},this.config),{options:t,token:e}))})}entryList(t){return c(this,null,function*(){const e=yield this.getBestToken();return C(h(o({},this.config),{options:t,token:e}))})}mapEntries(s){return c(this,arguments,function*(t,e={}){const r=yield this.getBestToken();return Tt(h(o({},this.config),{options:e,token:r}),t)})}getEntry(t){return c(this,null,function*(){const e=yield this.getBestToken();return bt(h(o({},this.config),{entryID:t,token:e}))})}editEntrySafe(t,e){return c(this,null,function*(){const s=yield this.getBestToken();return K(h(o({},this.config),{entryID:t,token:s,value:e,safePut:!0}))})}getSchema(){return c(this,null,function*(){return Pt(this.config)})}assets(t){return c(this,null,function*(){const e=yield this.getBestToken();return F(h(o({},this.config),{options:t,token:e}))})}assetList(t){return c(this,null,function*(){const e=yield this.getBestToken();return F(h(o({},this.config),{options:t,token:e}))})}createAsset(t){return c(this,null,function*(){const{file:e,name:s,options:r}=t,u=yield this.getBestToken();return _t(h(o({},this.config),{file:e,name:s,options:r,token:u}))})}deleteAsset(t){return c(this,null,function*(){const e=yield this.getBestToken();return Ot(h(o({},this.config),{token:e,assetID:t}))})}getAsset(t){return c(this,null,function*(){const e=yield this.getBestToken();return At(h(o({},this.config),{assetID:t,token:e}))})}createEntry(t){return c(this,null,function*(){const e=yield this.getBestToken();return jt(h(o({},this.config),{token:e,value:t}))})}editEntry(t,e){return c(this,null,function*(){const s=yield this.getBestToken();return K(h(o({},this.config),{entryID:t,token:s,value:e}))})}deleteEntry(t){return c(this,null,function*(){const e=yield this.getBestToken();return St(h(o({},this.config),{token:e,entryID:t}))})}resourceList(t){return c(this,null,function*(){const e=yield this.getBestToken();return Ct(h(o({},this.config),{options:t,token:e}))})}raw(t,e){return c(this,null,function*(){const s=yield this.getBestToken();return Ft(h(o({},this.config),{options:t,token:s}),e)})}storageAdapter(t){return this.set({storageAdapter:t})}removeToken(t){if(!this.config.storageAdapter)throw new Error("cannot removeToken: no storageAdapter defined!");const{remove:e}=this.config.storageAdapter;e(t)}getToken(t){if(!this.config.storageAdapter)throw new Error("cannot getAuth: no storageAdapter defined!");const{get:e}=this.config.storageAdapter;return e(t)}getPublicToken(){return this.config.token||this.getToken(b(this.config))}getEcToken(){return this.config.token||this.getToken(T(this.config))}setToken(t,e){if(!this.config.storageAdapter)throw new Error("cannot setEcToken: no storageAdapter defined!");return this.config.storageAdapter.get(t,e)}setEcToken(t){this.setToken(T(this.config),t)}setPublicToken(t){this.setToken(b(this.config),t)}loginEc(t){return vt(o(o({},this.config),t)).then(e=>this.setToken(T(this.config),e.token))}loginPublic(t){return Lt(o(o({},this.config),t)).then(e=>this.setToken(b(this.config),e.token))}logoutPublic(){const t=this.getPublicToken();return Dt(h(o({},this.config),{token:t})).then(()=>this.removeToken(b(this.config)))}logoutEc(){const t=this.getEcToken();return Bt(h(o({},this.config),{token:t})).then(()=>this.removeToken(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})}dm(t){return this.dmShortID(t)}dmID(t){return this.set({dmID: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 xt(this.config)}getDatamanager(t){return c(this,null,function*(){const e=yield this.getBestToken();return zt(h(o({},this.config),{dmID:t,token:e}))})}dmList(){return c(this,arguments,function*(t={}){const e=yield this.getBestToken();return qt(h(o({},this.config),{options:t,token:e}))})}modelList(){return c(this,arguments,function*(t={}){const e=yield this.getBestToken();return It(h(o({},this.config),{options:t,token:e}))})}}const Nt=n=>new O({env:n});exports.Fdk=O;exports.act=Kt;exports.apiURL=y;exports.apis=E;exports.assetList=it;exports.createAsset=at;exports.createEntry=X;exports.deleteAsset=ct;exports.deleteEntry=L;exports.deleteEntryObject=nt;exports.dmList=lt;exports.editEntry=P;exports.editEntryObject=st;exports.entryList=S;exports.expect=g;exports.fdk=Nt;exports.fetcher=p;exports.filterOptions=tt;exports.getAsset=ot;exports.getDatamanager=ut;exports.getEcAuthKey=G;exports.getEntry=W;exports.getEntryAsset=rt;exports.getEntryEnv=B;exports.getEntryShortID=_;exports.getPublicAuthKey=V;exports.getSchema=Z;exports.loginEc=R;exports.loginPublic=J;exports.logoutEc=M;exports.logoutPublic=U;exports.mapEntries=Y;exports.modelList=dt;exports.publicApi=Q;exports.query=$;exports.raw=ht;exports.resourceList=gt;exports.sdkOptions=v;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is the overview of the main entry file. You might want to go to the [README](/docs/) instead
|
|
3
|
+
* @module ec.fdk
|
|
4
|
+
*/
|
|
1
5
|
export * from "./lib/api";
|
|
2
6
|
export * from "./lib/util";
|
|
3
7
|
export * from "./lib/actions";
|
|
4
8
|
export * from "./types";
|
|
9
|
+
/**
|
|
10
|
+
* @categoryDescription Entries
|
|
11
|
+
* This is the method chaining API
|
|
12
|
+
* @showCategories
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
5
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AAExB;;;;;GAKG"}
|