ec.fdk 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.hbs +2 -0
- package/README.md +158 -4
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +307 -276
- package/dist/lib/api.d.mts +17 -2
- package/dist/lib/api.d.mts.map +1 -1
- package/dist/lib/entries.d.mts +4 -2
- package/dist/lib/entries.d.mts.map +1 -1
- package/package.json +1 -1
package/README.hbs
CHANGED
|
@@ -46,6 +46,8 @@ await muffin.editEntry(items[0].id, { name: "edit!" });
|
|
|
46
46
|
await muffin.deleteEntry(items[1].id);
|
|
47
47
|
// create a new muffin
|
|
48
48
|
await muffin.createEntry({ name: "new muffin" });
|
|
49
|
+
// edit third entry with safePut
|
|
50
|
+
await muffin.editEntrySafe(items[2].id, { _modified: items[2]._modified, name: "safePut!" });
|
|
49
51
|
```
|
|
50
52
|
|
|
51
53
|
Now what follows is the autogenerated doc from source:
|
package/README.md
CHANGED
|
@@ -46,6 +46,8 @@ await muffin.editEntry(items[0].id, { name: "edit!" });
|
|
|
46
46
|
await muffin.deleteEntry(items[1].id);
|
|
47
47
|
// create a new muffin
|
|
48
48
|
await muffin.createEntry({ name: "new muffin" });
|
|
49
|
+
// edit third entry with safePut
|
|
50
|
+
await muffin.editEntrySafe(items[2].id, { _modified: items[2]._modified, name: "safePut!" });
|
|
49
51
|
```
|
|
50
52
|
|
|
51
53
|
Now what follows is the autogenerated doc from source:
|
|
@@ -60,6 +62,8 @@ Now what follows is the autogenerated doc from source:
|
|
|
60
62
|
* [.Sdk](#module_api.Sdk)
|
|
61
63
|
* [.entries([options])](#module_api.Sdk+entries) ⇒ [<code>Promise.<EntryList></code>](#EntryList)
|
|
62
64
|
* [.getEntry(entryID)](#module_api.Sdk+getEntry) ⇒ [<code>Promise.<EntryResource></code>](#EntryResource)
|
|
65
|
+
* [.editEntrySafe(entryID, value)](#module_api.Sdk+editEntrySafe) ⇒ [<code>Promise.<EntryResource></code>](#EntryResource)
|
|
66
|
+
* [.getSchema(entryID)](#module_api.Sdk+getSchema) ⇒ [<code>Promise.<EntrySchema></code>](#EntrySchema)
|
|
63
67
|
* [.assets([options])](#module_api.Sdk+assets) ⇒ [<code>Promise.<AssetList></code>](#AssetList)
|
|
64
68
|
* [.createAsset(options)](#module_api.Sdk+createAsset) ⇒ [<code>Promise.<AssetResource></code>](#AssetResource)
|
|
65
69
|
* [.deleteAsset(assetID)](#module_api.Sdk+deleteAsset) ⇒ <code>Promise.<void></code>
|
|
@@ -67,13 +71,22 @@ Now what follows is the autogenerated doc from source:
|
|
|
67
71
|
* [.createEntry(value)](#module_api.Sdk+createEntry) ⇒ [<code>Promise.<EntryResource></code>](#EntryResource)
|
|
68
72
|
* [.editEntry(entryID, value)](#module_api.Sdk+editEntry) ⇒ [<code>Promise.<EntryResource></code>](#EntryResource)
|
|
69
73
|
* [.deleteEntry(entryID)](#module_api.Sdk+deleteEntry) ⇒ <code>void</code>
|
|
74
|
+
* [.resourceList([options])](#module_api.Sdk+resourceList) ⇒ [<code>Promise.<ResourceList></code>](#ResourceList)
|
|
75
|
+
* [.raw([options], [fetchOptions])](#module_api.Sdk+raw) ⇒ <code>Promise.<any></code>
|
|
70
76
|
* [.model(model)](#module_api.Sdk+model) ⇒
|
|
71
77
|
* [.token(token)](#module_api.Sdk+token) ⇒
|
|
72
78
|
* [.dmShortID(dmShortID)](#module_api.Sdk+dmShortID) ⇒
|
|
79
|
+
* [.dmID(dmID)](#module_api.Sdk+dmID) ⇒
|
|
73
80
|
* [.dm(dmShortID)](#module_api.Sdk+dm) ⇒
|
|
74
81
|
* [.assetGroup(assetGroup)](#module_api.Sdk+assetGroup) ⇒
|
|
75
82
|
* [.assetgroup(assetGroup)](#module_api.Sdk+assetgroup) ⇒
|
|
83
|
+
* [.subdomain(subdomain)](#module_api.Sdk+subdomain) ⇒
|
|
84
|
+
* [.resource(resource)](#module_api.Sdk+resource) ⇒
|
|
85
|
+
* [.route(route)](#module_api.Sdk+route) ⇒
|
|
86
|
+
* [.publicApi()](#module_api.Sdk+publicApi) ⇒
|
|
87
|
+
* [.getDatamanager()](#module_api.Sdk+getDatamanager) ⇒
|
|
76
88
|
* [.dmList([options])](#module_api.Sdk+dmList) ⇒ [<code>Promise.<DatamanagerList></code>](#DatamanagerList)
|
|
89
|
+
* [.modelList([options])](#module_api.Sdk+modelList) ⇒ [<code>Promise.<ModelList></code>](#ModelList)
|
|
77
90
|
|
|
78
91
|
<a name="module_api.Sdk+entries"></a>
|
|
79
92
|
|
|
@@ -113,6 +126,42 @@ If the model is not public, you also need to provide a <code>token</code>.</p>
|
|
|
113
126
|
```js
|
|
114
127
|
const muffin = await sdk("stage").dm("83cc6374").model("muffin").getEntry("1gOtzWvrdq")
|
|
115
128
|
```
|
|
129
|
+
<a name="module_api.Sdk+editEntrySafe"></a>
|
|
130
|
+
|
|
131
|
+
#### sdk.editEntrySafe(entryID, value) ⇒ [<code>Promise.<EntryResource></code>](#EntryResource)
|
|
132
|
+
<p>Edits an entry with safe put. Expects <code>dmShortID</code> / <code>model</code> to be set.
|
|
133
|
+
Expects a <code>_modified</code> field in the value. Will only update if the entry has not been changed since.
|
|
134
|
+
If model PUT is not public, you also need to provide a <code>token</code>.</p>
|
|
135
|
+
|
|
136
|
+
**Kind**: instance method of [<code>Sdk</code>](#module_api.Sdk)
|
|
137
|
+
|
|
138
|
+
| Param | Type | Description |
|
|
139
|
+
| --- | --- | --- |
|
|
140
|
+
| entryID | <code>string</code> | <p>id of entry to edit</p> |
|
|
141
|
+
| value | <code>object</code> | <p>values to set. undefined fields are ignored</p> |
|
|
142
|
+
|
|
143
|
+
**Example**
|
|
144
|
+
```js
|
|
145
|
+
const entry = await sdk("stage")
|
|
146
|
+
.dm("83cc6374")
|
|
147
|
+
.model("muffin")
|
|
148
|
+
.editEntrySafe("1gOtzWvrdq", { name: "test", _modified: "2020-01-01T00:00:00.000Z"})
|
|
149
|
+
```
|
|
150
|
+
<a name="module_api.Sdk+getSchema"></a>
|
|
151
|
+
|
|
152
|
+
#### sdk.getSchema(entryID) ⇒ [<code>Promise.<EntrySchema></code>](#EntrySchema)
|
|
153
|
+
<p>Loads the schema of a model. Expects <code>dmShortID</code> / <code>model</code> to be set.</p>
|
|
154
|
+
|
|
155
|
+
**Kind**: instance method of [<code>Sdk</code>](#module_api.Sdk)
|
|
156
|
+
|
|
157
|
+
| Param | Type |
|
|
158
|
+
| --- | --- |
|
|
159
|
+
| entryID | <code>string</code> |
|
|
160
|
+
|
|
161
|
+
**Example**
|
|
162
|
+
```js
|
|
163
|
+
const muffin = await sdk("stage").dm("83cc6374").model("muffin").getSchema()
|
|
164
|
+
```
|
|
116
165
|
<a name="module_api.Sdk+assets"></a>
|
|
117
166
|
|
|
118
167
|
#### sdk.assets([options]) ⇒ [<code>Promise.<AssetList></code>](#AssetList)
|
|
@@ -246,6 +295,40 @@ If model DELETE is not public, you also need to provide a <code>token</code>.</p
|
|
|
246
295
|
```js
|
|
247
296
|
await sdk("stage").dm("83cc6374").model("muffin").deleteEntry("1gOtzWvrdq")
|
|
248
297
|
```
|
|
298
|
+
<a name="module_api.Sdk+resourceList"></a>
|
|
299
|
+
|
|
300
|
+
#### sdk.resourceList([options]) ⇒ [<code>Promise.<ResourceList></code>](#ResourceList)
|
|
301
|
+
<p>Fetches resource list. Expects <code>resource</code> to be set. <code>subdomain</code> defaults to "datamanager".
|
|
302
|
+
Fetches <code>https://<subdomain>.entrecode.de/<resource>?_list=true&size=<options.size ?? 25></code></p>
|
|
303
|
+
|
|
304
|
+
**Kind**: instance method of [<code>Sdk</code>](#module_api.Sdk)
|
|
305
|
+
|
|
306
|
+
| Param | Type | Description |
|
|
307
|
+
| --- | --- | --- |
|
|
308
|
+
| [options] | <code>object</code> | <p>options for list request.</p> |
|
|
309
|
+
|
|
310
|
+
**Example**
|
|
311
|
+
```js
|
|
312
|
+
const res = await sdk("stage").resource("template").resourceList()
|
|
313
|
+
```
|
|
314
|
+
<a name="module_api.Sdk+raw"></a>
|
|
315
|
+
|
|
316
|
+
#### sdk.raw([options], [fetchOptions]) ⇒ <code>Promise.<any></code>
|
|
317
|
+
<p>Fetches raw route. Expects <code>route</code> to be set. <code>subdomain</code> defaults to "datamanager".
|
|
318
|
+
Fetches <code>https://<subdomain>.entrecode.de/<route>?<options></code>
|
|
319
|
+
Use this when no other fdk method can give you your request.</p>
|
|
320
|
+
|
|
321
|
+
**Kind**: instance method of [<code>Sdk</code>](#module_api.Sdk)
|
|
322
|
+
|
|
323
|
+
| Param | Type | Description |
|
|
324
|
+
| --- | --- | --- |
|
|
325
|
+
| [options] | <code>object</code> | <p>options for list request.</p> |
|
|
326
|
+
| [fetchOptions] | <code>object</code> | <p>(optional) options passed to fetch.</p> |
|
|
327
|
+
|
|
328
|
+
**Example**
|
|
329
|
+
```js
|
|
330
|
+
const res = await sdk("stage").route("stats").raw()
|
|
331
|
+
```
|
|
249
332
|
<a name="module_api.Sdk+model"></a>
|
|
250
333
|
|
|
251
334
|
#### sdk.model(model) ⇒
|
|
@@ -282,6 +365,18 @@ await sdk("stage").dm("83cc6374").model("muffin").deleteEntry("1gOtzWvrdq")
|
|
|
282
365
|
| --- | --- |
|
|
283
366
|
| dmShortID | <code>string</code> |
|
|
284
367
|
|
|
368
|
+
<a name="module_api.Sdk+dmID"></a>
|
|
369
|
+
|
|
370
|
+
#### sdk.dmID(dmID) ⇒
|
|
371
|
+
<p>Sets the (long) ID of the datamanager to use</p>
|
|
372
|
+
|
|
373
|
+
**Kind**: instance method of [<code>Sdk</code>](#module_api.Sdk)
|
|
374
|
+
**Returns**: <p>Sdk</p>
|
|
375
|
+
|
|
376
|
+
| Param | Type |
|
|
377
|
+
| --- | --- |
|
|
378
|
+
| dmID | <code>string</code> |
|
|
379
|
+
|
|
285
380
|
<a name="module_api.Sdk+dm"></a>
|
|
286
381
|
|
|
287
382
|
#### sdk.dm(dmShortID) ⇒
|
|
@@ -318,6 +413,56 @@ await sdk("stage").dm("83cc6374").model("muffin").deleteEntry("1gOtzWvrdq")
|
|
|
318
413
|
| --- | --- | --- |
|
|
319
414
|
| assetGroup | <code>string</code> | <p>name of the asset group</p> |
|
|
320
415
|
|
|
416
|
+
<a name="module_api.Sdk+subdomain"></a>
|
|
417
|
+
|
|
418
|
+
#### sdk.subdomain(subdomain) ⇒
|
|
419
|
+
<p>Sets the subdomain to use.</p>
|
|
420
|
+
|
|
421
|
+
**Kind**: instance method of [<code>Sdk</code>](#module_api.Sdk)
|
|
422
|
+
**Returns**: <p>Sdk</p>
|
|
423
|
+
|
|
424
|
+
| Param | Type | Description |
|
|
425
|
+
| --- | --- | --- |
|
|
426
|
+
| subdomain | <code>string</code> | <p>subdomain</p> |
|
|
427
|
+
|
|
428
|
+
<a name="module_api.Sdk+resource"></a>
|
|
429
|
+
|
|
430
|
+
#### sdk.resource(resource) ⇒
|
|
431
|
+
<p>Sets the name of the resource to use.</p>
|
|
432
|
+
|
|
433
|
+
**Kind**: instance method of [<code>Sdk</code>](#module_api.Sdk)
|
|
434
|
+
**Returns**: <p>Sdk</p>
|
|
435
|
+
|
|
436
|
+
| Param | Type | Description |
|
|
437
|
+
| --- | --- | --- |
|
|
438
|
+
| resource | <code>string</code> | <p>name of the resource</p> |
|
|
439
|
+
|
|
440
|
+
<a name="module_api.Sdk+route"></a>
|
|
441
|
+
|
|
442
|
+
#### sdk.route(route) ⇒
|
|
443
|
+
<p>Sets the route to use.</p>
|
|
444
|
+
|
|
445
|
+
**Kind**: instance method of [<code>Sdk</code>](#module_api.Sdk)
|
|
446
|
+
**Returns**: <p>Sdk</p>
|
|
447
|
+
|
|
448
|
+
| Param | Type | Description |
|
|
449
|
+
| --- | --- | --- |
|
|
450
|
+
| route | <code>string</code> | <p>route</p> |
|
|
451
|
+
|
|
452
|
+
<a name="module_api.Sdk+publicApi"></a>
|
|
453
|
+
|
|
454
|
+
#### sdk.publicApi() ⇒
|
|
455
|
+
<p>Returns the public api root endpoint. Expects dmShortID to be set.</p>
|
|
456
|
+
|
|
457
|
+
**Kind**: instance method of [<code>Sdk</code>](#module_api.Sdk)
|
|
458
|
+
**Returns**: <p>any</p>
|
|
459
|
+
<a name="module_api.Sdk+getDatamanager"></a>
|
|
460
|
+
|
|
461
|
+
#### sdk.getDatamanager() ⇒
|
|
462
|
+
<p>Loads a DatamanagerResource by its long id. Requires token.</p>
|
|
463
|
+
|
|
464
|
+
**Kind**: instance method of [<code>Sdk</code>](#module_api.Sdk)
|
|
465
|
+
**Returns**: <p>any</p>
|
|
321
466
|
<a name="module_api.Sdk+dmList"></a>
|
|
322
467
|
|
|
323
468
|
#### sdk.dmList([options]) ⇒ [<code>Promise.<DatamanagerList></code>](#DatamanagerList)
|
|
@@ -331,11 +476,20 @@ await sdk("stage").dm("83cc6374").model("muffin").deleteEntry("1gOtzWvrdq")
|
|
|
331
476
|
|
|
332
477
|
**Example**
|
|
333
478
|
```js
|
|
334
|
-
|
|
335
|
-
const muffins = await sdk("stage").dm("83cc6374").model("muffin").entries()
|
|
479
|
+
const dms = await sdk("stage").dmList()
|
|
336
480
|
```
|
|
481
|
+
<a name="module_api.Sdk+modelList"></a>
|
|
482
|
+
|
|
483
|
+
#### sdk.modelList([options]) ⇒ [<code>Promise.<ModelList></code>](#ModelList)
|
|
484
|
+
<p>Loads model list. Expects dmID to be set. Make sure to provide an ec.admin <code>token</code> intercept one.</p>
|
|
485
|
+
|
|
486
|
+
**Kind**: instance method of [<code>Sdk</code>](#module_api.Sdk)
|
|
487
|
+
|
|
488
|
+
| Param | Type | Description |
|
|
489
|
+
| --- | --- | --- |
|
|
490
|
+
| [options] | <code>object</code> | <p>options for entry list request.</p> |
|
|
491
|
+
|
|
337
492
|
**Example**
|
|
338
493
|
```js
|
|
339
|
-
|
|
340
|
-
const secrets = await sdk("stage").token(token).dm("83cc6374").model("secret").entries()
|
|
494
|
+
const models = await sdk("stage").dmID("254a03f1-cb76-4f1e-a52a-bbd4180ca10c").modelList()
|
|
341
495
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
${
|
|
3
|
-
${i.verbose}`;throw new Error(l)}throw new Error(`unexpected fetch error: ${o.statusText}`)}return a?o:yield o.json()})}const S={datamanager:{live:"https://datamanager.entrecode.de/",stage:"https://datamanager.cachena.entrecode.de/"},accounts:{live:"https://accounts.entrecode.de/",stage:"https://accounts.cachena.entrecode.de/"},appserver:{live:"https://appserver.entrecode.de/",stage:"https://appserver.cachena.entrecode.de/"}};function y(n,t="stage",e="datamanager"){const s=S[e];if(!s)throw new Error(`subdomain "${e}" not found. Try one of ${Object.keys(S).join(", ")}`);const r=s[t];if(!r)throw new Error(`env "${t}" not found. Try one of ${Object.keys(s[t]).join(", ")}`);return r+n}function w(n,t=!0){return Object.entries(n).sort((e,s)=>e[0].localeCompare(s[0])).map(([e,s])=>`${e}=${s}`).join("&")}function d(n){Object.entries(n).forEach(([t,e])=>{if(e===void 0)throw new Error(`expected ${t} to be set!`)})}const B={stage:"https://accounts.cachena.entrecode.de/",live:"https://accounts.entrecode.de/"};function q(n){return c(this,null,function*(){let{env:t,dmShortID:e,email:s,password:r}=n;d({env:t,dmShortID:e,email:s,password:r});const a=y(`api/${e}/_auth/login?clientID=rest`,t);return yield g(a,{},{method:"POST",body:JSON.stringify({email:s,password:r}),headers:{"Content-Type":"application/json"}})})}function D(n){return c(this,null,function*(){let{env:t,email:e,password:s}=n;d({env:t,email:e,password:s});const r=`${B[t]}auth/login?clientID=rest`;return yield g(r,{},{method:"POST",body:JSON.stringify({email:e,password:s}),headers:{"Content-Type":"application/json"}})})}function v(n){return c(this,null,function*(){let{dmShortID:t,env:e,token:s}=n;d({dmShortID:t,env:e,token:s});const r=y(`api/${t}/_auth/logout?clientID=rest&token=${s}`,e);return yield g(r,{dmShortID:t,rawRes:!0},{method:"POST"})})}function K(n){return c(this,null,function*(){let{env:t,token:e}=n;d({env:t,token:e});const s=`${B[t]}auth/logout?clientID=rest`;return yield g(s,{rawRes:!0,token:e},{method:"POST"})})}function x({dmShortID:n}){return d({dmShortID:n}),n}function z({env:n}){return d({env:n}),n}let ct=["created","creator","id","modified","private","_created","_creator","_embedded","_entryTitle","_id","_links","_modelTitle","_modelTitleField","_modified"];function J(n){let t={};for(let e in n)ct.includes(e)||(t[e]=n[e]);return t}function at(n){return JSON.parse(JSON.stringify(n))}function N(n){return c(this,null,function*(){let{env:t,dmShortID:e}=n;d({env:t,dmShortID:e});const s=y(`api/${e}`,t);return g(s,n)})}function R(n){return c(this,null,function*(){let{env:t,dmShortID:e,model:s,options:r={}}=n;d({env:t,dmShortID:e,model:s}),r=u({size:50,page:1,_list:!0},r);const a=w(r),o=y(`api/${e}/${s}?${a}`,t),{count:h,total:i,_embedded:l}=yield g(o,n);let f=l?l[`${e}:${s}`]:[];return f=Array.isArray(f)?f:[f],{count:h,total:i,items:f}})}function C({env:n,dmShortID:t,model:e,entryID:s,token:r}){d({env:n,dmShortID:t,model:e,entryID:s});const a=w({_id:s}),o=y(`api/${t}/${e}?${a}`,n);return g(o,{dmShortID:t,token:r})}function F(a){return c(this,arguments,function*({env:n,dmShortID:t,model:e,value:s,token:r}){d({env:n,dmShortID:t,model:e,value:s});const o=y(`api/${t}/${e}`,n);return yield g(o,{env:n,dmShortID:t,token:r},{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}})})}function M(o){return c(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,value:r,token:a}){d({env:n,dmShortID:t,model:e,entryID:s,value:r});const h=y(`api/${t}/${e}?_id=${s}`,n);return r=at(r),r=J(r),yield g(h,{token:a},{method:"PUT",body:JSON.stringify(r),headers:{"Content-Type":"application/json"}})})}function U(a){return c(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,token:r}){d({env:n,dmShortID:t,model:e,entryID:s});const o=y(`api/${t}/${e}?_id=${s}`,n);yield g(o,{token:r,rawRes:!0},{method:"DELETE",headers:{"Content-Type":"application/json"}})})}function V(s){return c(this,arguments,function*({env:n,dmShortID:t,model:e}){var l,f,m,_,L;d({env:n,dmShortID:t,model:e});const r=y(`api/schema/${t}/${e}`,n),a=yield g(r),o=(l=a==null?void 0:a.allOf)==null?void 0:l[1];if(typeof o.properties!="object")throw new Error(`getSchema: ${r} returned unexpected format: ${JSON.stringify(a)}`);const{properties:h}=o,i=J(h);for(let k in i){let $=i[k];if($.required=o.required.includes(k),(f=i[k])!=null&&f.oneOf&&((m=i[k])==null||delete m.oneOf),(_=$.title)!=null&&_.includes("<")&&((L=$.title)!=null&&L.includes(">"))){const b=$.title.split("<")[1].slice(0,-1),et=$.title.split("<")[0];$.type=et,b.includes(":")?$.resource=b.split(":")[1]:$.resource=b}else["asset","entry","assets","entries"].includes($.title)?($.type=$.title,$.resource=null):$.type=$.title;delete i[k].title}return i})}function G(a){return c(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){d({env:n,dmShortID:t,assetGroup:e,assetID:s});const o=w({assetID:s}),h=y(`a/${t}/${e}?${o}`,n);return(yield g(h,{dmShortID:t,token:r}))._embedded["ec:dm-asset"]})}function H(n){return c(this,null,function*(){let{env:t,dmShortID:e,assetGroup:s,token:r,options:a={}}=n;d({env:t,dmShortID:e,assetGroup:s}),a=u({size:50,page:1,_list:!0},a);const o=w(a),h=y(`a/${e}/${s}?${o}`,t),{count:i,total:l,_embedded:f}=yield g(h,{dmShortID:e,token:r});let m=f?f["ec:dm-asset"]:[];return m=Array.isArray(m)?m:[m],{count:i,total:l,items:m}})}function I(h){return c(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,token:s,file:r,name:a,options:o}){d({env:n,dmShortID:t,assetGroup:e,file:r});const i=y(`a/${t}/${e}`,n),l=new FormData;return l.append("file",r,a),o&&Object.keys(o).forEach(m=>{l.append(m,o[m])}),(yield g(i,{token:s},{method:"POST",body:l}))._embedded["ec:dm-asset"]})}function Q(a){return c(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){d({env:n,dmShortID:t,assetGroup:e,assetID:s});const o=y(`a/${t}/${e}/${s}`,n);yield g(o,{token:r,rawRes:!0},{method:"DELETE"})})}function W(n){return c(this,null,function*(){let{env:t,dmID:e,token:s}=n;d({env:t,dmID:e});const r=y(`?dataManagerID=${e}`,t);return g(r,{token:s})})}function X(n){return c(this,null,function*(){let{env:t,options:e={}}=n;d({env:t}),e=u({size:25,page:1,_list:!0},e);const s=w(e),r=y(`?${s}`,t),{count:a,total:o,_embedded:h}=yield g(r,n);let i=h?h["ec:datamanager"]:[];return i=Array.isArray(i)?i:[i],{count:a,total:o,items:i}})}function Y(n){return c(this,null,function*(){let{env:t,dmID:e,options:s={}}=n;d({env:t,dmID:e}),s=u({size:25,dataManagerID:e,page:1,_list:!0},s);const r=w(s),a=y(`model?${r}`,t),{count:o,total:h,_embedded:i}=yield g(a,n);let l=i?i["ec:model"]:[];return l=Array.isArray(l)?l:[l],{count:o,total:h,items:l}})}function Z(n){return c(this,null,function*(){let{env:t,resource:e,options:s={},subdomain:r="datamanager"}=n;d({env:t,subdomain:r,resource:e}),s=u({size:25,page:1,_list:!0},s);const a=w(s),o=y(`${e}?${a}`,t,r),{count:h,total:i,_embedded:l}=yield g(o,n);let f=l?l[Object.keys(l)[0]]:[];return f=Array.isArray(f)?f:[f],{count:h,total:i,items:f}})}function tt(e){return c(this,arguments,function*(n,t={}){let{env:s,route:r,options:a={},subdomain:o="datamanager"}=n;d({env:s,subdomain:o,route:r}),a=u({},a);const h=w(a),i=y(`${r}?${h}`,s,o);return g(i,n,t)})}const A=Object.freeze(Object.defineProperty({__proto__:null,assetList:H,createAsset:I,createEntry:F,deleteAsset:Q,deleteEntry:U,dmList:X,editEntry:M,entryList:R,getAsset:G,getDatamanager:W,getEcAuthKey:z,getEntry:C,getPublicAuthKey:x,getSchema:V,loginEc:D,loginPublic:q,logoutEc:K,logoutPublic:v,modelList:Y,publicApi:N,raw:tt,resourceList:Z},Symbol.toStringTag,{value:"Module"})),{entryList:ut,getEntry:lt,getAsset:ht,assetList:dt,createAsset:gt,deleteAsset:yt,createEntry:ft,editEntry:pt,deleteEntry:$t,getSchema:mt,loginPublic:wt,loginEc:kt,logoutEc:At,logoutPublic:Et,getEcAuthKey:T,getPublicAuthKey:P,dmList:bt,modelList:Tt,publicApi:Pt,getDatamanager:_t,resourceList:Lt,raw:Ot}=A;function jt(n){const{action:t}=n;if(d({action:t}),!A[t])throw new Error(`"${t}" does not exist! try one of ${Object.keys(A).join(", ")}`);return A[t](n)}class E{constructor(t){this.config=t}set(t){return new E(u(u({},this.config),t))}entries(){return c(this,arguments,function*(t={}){const e=yield this.getBestToken();return ut(p(u({},this.config),{options:t,token:e}))})}entryList(t){return c(this,null,function*(){return this.entries(t)})}getEntry(t){return c(this,null,function*(){const e=yield this.getBestToken();return lt(p(u({},this.config),{entryID:t,token:e}))})}getSchema(){return c(this,null,function*(){return mt(this.config)})}assets(t){return c(this,null,function*(){const e=yield this.getBestToken();return dt(p(u({},this.config),{options:t,token:e}))})}assetList(t){return c(this,null,function*(){return this.assets(t)})}createAsset(){return c(this,arguments,function*({file:t,name:e,options:s}={}){const r=yield this.getBestToken();return gt(p(u({},this.config),{file:t,name:e,options:s,token:r}))})}deleteAsset(t){return c(this,null,function*(){const e=yield this.getBestToken();return yt(p(u({},this.config),{token:e,assetID:t}))})}getAsset(t){return c(this,null,function*(){const e=yield this.getBestToken();return ht(p(u({},this.config),{assetID:t,token:e}))})}createEntry(t){return c(this,null,function*(){const e=yield this.getBestToken();return ft(p(u({},this.config),{token:e,value:t}))})}editEntry(t,e){return c(this,null,function*(){const s=yield this.getBestToken();return pt(p(u({},this.config),{entryID:t,token:s,value:e}))})}deleteEntry(t){return c(this,null,function*(){const e=yield this.getBestToken();return $t(p(u({},this.config),{token:e,entryID:t}))})}resourceList(t){return c(this,null,function*(){const e=yield this.getBestToken();return Lt(p(u({},this.config),{options:t,token:e}))})}raw(t,e){return c(this,null,function*(){const s=yield this.getBestToken();return Ot(p(u({},this.config),{options:t,token:s}),e)})}authAdapter(t){return this.set({authAdapter:t})}setAuth(t){return e=>{if(!this.config.authAdapter)throw new Error("cannot setAuth: no authAdapter defined!");const{set:s}=this.config.authAdapter;return s(t,e.token),e}}unsetAuth(t){return e=>{if(console.log("unset auth",e),!this.config.authAdapter)throw new Error("cannot unsetAuth: no authAdapter defined!");const{remove:s}=this.config.authAdapter;return s(t),e}}getAuth(t){if(!this.config.authAdapter)throw new Error("cannot getAuth: no authAdapter defined!");const{get:e}=this.config.authAdapter;return e(t)}loginEc(t){return kt(u(u({},this.config),t)).then(this.setAuth(T(this.config)))}loginPublic(t){return wt(u(u({},this.config),t)).then(this.setAuth(P(this.config)))}logoutPublic(){const t=this.getPublicToken();return console.log("token",t),Et(p(u({},this.config),{token:t})).then(this.unsetAuth(P(this.config)))}logoutEc(){const t=this.getEcToken();return console.log("token",t),At(p(u({},this.config),{token:t})).then(this.unsetAuth(T(this.config)))}getPublicToken(){return this.config.token||this.getAuth(P(this.config))}getEcToken(){return this.config.token||this.getAuth(T(this.config))}hasPublicToken(){return!!this.getPublicToken()}hasEcToken(){return!!this.getEcToken()}hasAnyToken(){return!!this.getEcToken()||!!this.getPublicToken()}getBestToken(){try{return this.getEcToken()||this.getPublicToken()}catch(t){return}}model(t){return this.set({model:t})}token(t){return this.set({token:t})}dmShortID(t){return this.set({dmShortID:t})}dmID(t){return this.set({dmID:t})}dm(t){return this.dmShortID(t)}assetGroup(t){return this.set({assetGroup:t})}assetgroup(t){return this.assetGroup(t)}subdomain(t){return this.set({subdomain:t})}resource(t){return this.set({resource:t})}route(t){return this.set({route:t})}publicApi(){return Pt(this.config)}getDatamanager(t){return c(this,null,function*(){const e=yield this.getBestToken();return _t(p(u({},this.config),{dmID:t,token:e}))})}dmList(){return c(this,arguments,function*(t={}){const e=yield this.getBestToken();return bt(p(u({},this.config),{options:t,token:e}))})}modelList(){return c(this,arguments,function*(t={}){const e=yield this.getBestToken();return Tt(p(u({},this.config),{options:t,token:e}))})}}const St=n=>new E({env:n});exports.Sdk=E;exports.act=jt;exports.apiURL=y;exports.assetList=H;exports.createAsset=I;exports.createEntry=F;exports.deleteAsset=Q;exports.deleteEntry=U;exports.dmList=X;exports.editEntry=M;exports.entryList=R;exports.expect=d;exports.fetcher=g;exports.getAsset=G;exports.getDatamanager=W;exports.getEcAuthKey=z;exports.getEntry=C;exports.getPublicAuthKey=x;exports.getSchema=V;exports.loginEc=D;exports.loginPublic=q;exports.logoutEc=K;exports.logoutPublic=v;exports.modelList=Y;exports.publicApi=N;exports.query=w;exports.raw=tt;exports.resourceList=Z;exports.sdk=St;
|
|
1
|
+
"use strict";var rt=Object.defineProperty,it=Object.defineProperties;var ot=Object.getOwnPropertyDescriptors;var S=Object.getOwnPropertySymbols;var ct=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable;var j=(n,t,e)=>t in n?rt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,l=(n,t)=>{for(var e in t||(t={}))ct.call(t,e)&&j(n,e,t[e]);if(S)for(var e of S(t))at.call(t,e)&&j(n,e,t[e]);return n},y=(n,t)=>it(n,ot(t));var o=(n,t,e)=>new Promise((s,r)=>{var u=c=>{try{d(e.next(c))}catch(a){r(a)}},i=c=>{try{d(e.throw(c))}catch(a){r(a)}},d=c=>c.done?s(c.value):Promise.resolve(c.value).then(u,i);d((e=e.apply(n,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function g(s){return o(this,arguments,function*(n,t={},e={}){var d;const{token:r,rawRes:u}=t;r&&(e.headers=y(l({},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(),a=`${c.title}
|
|
2
|
+
${c.detail}
|
|
3
|
+
${c.verbose}`;throw new Error(a)}throw new Error(`unexpected fetch error: ${i.statusText}`)}return u?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/"}};function p(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 w(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 D={stage:"https://accounts.cachena.entrecode.de/",live:"https://accounts.entrecode.de/"};function x(n){return o(this,null,function*(){let{env:t,dmShortID:e,email:s,password:r}=n;h({env:t,dmShortID:e,email:s,password:r});const u=p(`api/${e}/_auth/login?clientID=rest`,t);return yield g(u,{},{method:"POST",body:JSON.stringify({email:s,password:r}),headers:{"Content-Type":"application/json"}})})}function K(n){return o(this,null,function*(){let{env:t,email:e,password:s}=n;h({env:t,email:e,password:s});const r=`${D[t]}auth/login?clientID=rest`;return yield g(r,{},{method:"POST",body:JSON.stringify({email:e,password:s}),headers:{"Content-Type":"application/json"}})})}function z(n){return o(this,null,function*(){let{dmShortID:t,env:e,token:s}=n;h({dmShortID:t,env:e,token:s});const r=p(`api/${t}/_auth/logout?clientID=rest&token=${s}`,e);return yield g(r,{dmShortID:t,rawRes:!0},{method:"POST"})})}function C(n){return o(this,null,function*(){let{env:t,token:e}=n;h({env:t,token:e});const s=`${D[t]}auth/logout?clientID=rest`;return yield g(s,{rawRes:!0,token:e},{method:"POST"})})}function J({dmShortID:n}){return h({dmShortID:n}),n}function N({env:n}){return h({env:n}),n}let ut=["created","creator","id","modified","private","_created","_creator","_embedded","_entryTitle","_id","_links","_modelTitle","_modelTitleField","_modified"];function R(n){let t={};for(let e in n)ut.includes(e)||(t[e]=n[e]);return t}function lt(n){return JSON.parse(JSON.stringify(n))}function v(n){return o(this,null,function*(){let{env:t,dmShortID:e}=n;h({env:t,dmShortID:e});const s=p(`api/${e}`,t);return g(s,n)})}function F(n){return o(this,null,function*(){let{env:t,dmShortID:e,model:s,options:r={}}=n;h({env:t,dmShortID:e,model:s}),r=l({size:50,page:1,_list:!0},r);const u=w(r),i=p(`api/${e}/${s}?${u}`,t),{count:d,total:c,_embedded:a}=yield g(i,n);let f=a?a[`${e}:${s}`]:[];return f=Array.isArray(f)?f:[f],{count:d,total:c,items:f}})}function U({env:n,dmShortID:t,model:e,entryID:s,token:r}){h({env:n,dmShortID:t,model:e,entryID:s});const u=w({_id:s}),i=p(`api/${t}/${e}?${u}`,n);return g(i,{dmShortID:t,token:r})}function M(u){return o(this,arguments,function*({env:n,dmShortID:t,model:e,value:s,token:r}){h({env:n,dmShortID:t,model:e,value:s});const i=p(`api/${t}/${e}`,n);return yield g(i,{env:n,dmShortID:t,token:r},{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}})})}function I(d){return o(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,value:r,token:u,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 a=p(`api/${t}/${e}?_id=${s}`,n);return r=lt(r),r=R(r),yield g(a,{token:u},{method:"PUT",headers:c,body:JSON.stringify(r)})})}function V(u){return o(this,arguments,function*({env:n,dmShortID:t,model:e,entryID:s,token:r}){h({env:n,dmShortID:t,model:e,entryID:s});const i=p(`api/${t}/${e}?_id=${s}`,n);yield g(i,{token:r,rawRes:!0},{method:"DELETE",headers:{"Content-Type":"application/json"}})})}function G(r){return o(this,arguments,function*({env:n,dmShortID:t,model:e,withMetadata:s}){var f,$,P,L,O;h({env:n,dmShortID:t,model:e});const u=p(`api/schema/${t}/${e}`,n),i=yield g(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:c}=d,a=R(c);for(let k in a){let m=a[k];if(m.required=d.required.includes(k),($=a[k])!=null&&$.oneOf&&((P=a[k])==null||delete P.oneOf),(L=m.title)!=null&&L.includes("<")&&((O=m.title)!=null&&O.includes(">"))){const b=m.title.split("<")[1].slice(0,-1),st=m.title.split("<")[0];m.type=st,b.includes(":")?m.resource=b.split(":")[1]:m.resource=b}else["asset","entry","assets","entries"].includes(m.title)?(m.type=m.title,m.resource=null):m.type=m.title;delete a[k].title}if(s){const k=c._modelTitle.title,m=c._modelTitleField.title;return{properties:a,meta:{modelTitleField:m,modelTitle:k}}}return a})}function H(u){return o(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){h({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=w({assetID:s}),d=p(`a/${t}/${e}?${i}`,n);return(yield g(d,{dmShortID:t,token:r}))._embedded["ec:dm-asset"]})}function Q(n){return o(this,null,function*(){let{env:t,dmShortID:e,assetGroup:s,token:r,options:u={}}=n;h({env:t,dmShortID:e,assetGroup:s}),u=l({size:50,page:1,_list:!0},u);const i=w(u),d=p(`a/${e}/${s}?${i}`,t),{count:c,total:a,_embedded:f}=yield g(d,{dmShortID:e,token:r});let $=f?f["ec:dm-asset"]:[];return $=Array.isArray($)?$:[$],{count:c,total:a,items:$}})}function W(d){return o(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,token:s,file:r,name:u,options:i}){h({env:n,dmShortID:t,assetGroup:e,file:r});const c=p(`a/${t}/${e}`,n),a=new FormData;return a.append("file",r,u),i&&Object.keys(i).forEach($=>{a.append($,i[$])}),(yield g(c,{token:s},{method:"POST",body:a}))._embedded["ec:dm-asset"]})}function X(u){return o(this,arguments,function*({env:n,dmShortID:t,assetGroup:e,assetID:s,token:r}){h({env:n,dmShortID:t,assetGroup:e,assetID:s});const i=p(`a/${t}/${e}/${s}`,n);yield g(i,{token:r,rawRes:!0},{method:"DELETE"})})}function Y(n){return o(this,null,function*(){let{env:t,dmID:e,token:s}=n;h({env:t,dmID:e});const r=p(`?dataManagerID=${e}`,t);return g(r,{token:s})})}function Z(n){return o(this,null,function*(){let{env:t,options:e={}}=n;h({env:t}),e=l({size:25,page:1,_list:!0},e);const s=w(e),r=p(`?${s}`,t),{count:u,total:i,_embedded:d}=yield g(r,n);let c=d?d["ec:datamanager"]:[];return c=Array.isArray(c)?c:[c],{count:u,total:i,items:c}})}function tt(n){return o(this,null,function*(){let{env:t,dmID:e,options:s={}}=n;h({env:t,dmID:e}),s=l({size:25,dataManagerID:e,page:1,_list:!0},s);const r=w(s),u=p(`model?${r}`,t),{count:i,total:d,_embedded:c}=yield g(u,n);let a=c?c["ec:model"]:[];return a=Array.isArray(a)?a:[a],{count:i,total:d,items:a}})}function et(n){return o(this,null,function*(){let{env:t,resource:e,options:s={},subdomain:r="datamanager"}=n;h({env:t,subdomain:r,resource:e}),s=l({size:25,page:1,_list:!0},s);const u=w(s),i=p(`${e}?${u}`,t,r),{count:d,total:c,_embedded:a}=yield g(i,n);let f=a?a[Object.keys(a)[0]]:[];return f=Array.isArray(f)?f:[f],{count:d,total:c,items:f}})}function nt(e){return o(this,arguments,function*(n,t={}){let{env:s,route:r,options:u={},subdomain:i="datamanager"}=n;h({env:s,subdomain:i,route:r}),u=l({},u);const d=w(u),c=p(`${r}?${d}`,s,i);return g(c,n,t)})}const A=Object.freeze(Object.defineProperty({__proto__:null,assetList:Q,createAsset:W,createEntry:M,deleteAsset:X,deleteEntry:V,dmList:Z,editEntry:I,entryList:F,getAsset:H,getDatamanager:Y,getEcAuthKey:N,getEntry:U,getPublicAuthKey:J,getSchema:G,loginEc:K,loginPublic:x,logoutEc:C,logoutPublic:z,modelList:tt,publicApi:v,raw:nt,resourceList:et},Symbol.toStringTag,{value:"Module"})),{entryList:dt,getEntry:ht,getAsset:gt,assetList:ft,createAsset:yt,deleteAsset:pt,createEntry:mt,editEntry:q,deleteEntry:$t,getSchema:wt,loginPublic:kt,loginEc:At,logoutEc:Et,logoutPublic:bt,getEcAuthKey:T,getPublicAuthKey:_,dmList:Tt,modelList:_t,publicApi:Pt,getDatamanager:Lt,resourceList:Ot,raw:St}=A;function jt(n){const{action:t}=n;if(h({action:t}),!A[t])throw new Error(`"${t}" does not exist! try one of ${Object.keys(A).join(", ")}`);return A[t](n)}class E{constructor(t){this.config=t}set(t){return new E(l(l({},this.config),t))}entries(){return o(this,arguments,function*(t={}){const e=yield this.getBestToken();return dt(y(l({},this.config),{options:t,token:e}))})}entryList(t){return o(this,null,function*(){return this.entries(t)})}getEntry(t){return o(this,null,function*(){const e=yield this.getBestToken();return ht(y(l({},this.config),{entryID:t,token:e}))})}editEntrySafe(t,e){return o(this,null,function*(){const s=yield this.getBestToken();return q(y(l({},this.config),{entryID:t,token:s,value:e,safePut:!0}))})}getSchema(){return o(this,null,function*(){return wt(this.config)})}assets(t){return o(this,null,function*(){const e=yield this.getBestToken();return ft(y(l({},this.config),{options:t,token:e}))})}assetList(t){return o(this,null,function*(){return this.assets(t)})}createAsset(){return o(this,arguments,function*({file:t,name:e,options:s}={}){const r=yield this.getBestToken();return yt(y(l({},this.config),{file:t,name:e,options:s,token:r}))})}deleteAsset(t){return o(this,null,function*(){const e=yield this.getBestToken();return pt(y(l({},this.config),{token:e,assetID:t}))})}getAsset(t){return o(this,null,function*(){const e=yield this.getBestToken();return gt(y(l({},this.config),{assetID:t,token:e}))})}createEntry(t){return o(this,null,function*(){const e=yield this.getBestToken();return mt(y(l({},this.config),{token:e,value:t}))})}editEntry(t,e){return o(this,null,function*(){const s=yield this.getBestToken();return q(y(l({},this.config),{entryID:t,token:s,value:e}))})}deleteEntry(t){return o(this,null,function*(){const e=yield this.getBestToken();return $t(y(l({},this.config),{token:e,entryID:t}))})}resourceList(t){return o(this,null,function*(){const e=yield this.getBestToken();return Ot(y(l({},this.config),{options:t,token:e}))})}raw(t,e){return o(this,null,function*(){const s=yield this.getBestToken();return St(y(l({},this.config),{options:t,token:s}),e)})}authAdapter(t){return this.set({authAdapter:t})}setAuth(t){return e=>{if(!this.config.authAdapter)throw new Error("cannot setAuth: no authAdapter defined!");const{set:s}=this.config.authAdapter;return s(t,e.token),e}}unsetAuth(t){return e=>{if(console.log("unset auth",e),!this.config.authAdapter)throw new Error("cannot unsetAuth: no authAdapter defined!");const{remove:s}=this.config.authAdapter;return s(t),e}}getAuth(t){if(!this.config.authAdapter)throw new Error("cannot getAuth: no authAdapter defined!");const{get:e}=this.config.authAdapter;return e(t)}loginEc(t){return At(l(l({},this.config),t)).then(this.setAuth(T(this.config)))}loginPublic(t){return kt(l(l({},this.config),t)).then(this.setAuth(_(this.config)))}logoutPublic(){const t=this.getPublicToken();return console.log("token",t),bt(y(l({},this.config),{token:t})).then(this.unsetAuth(_(this.config)))}logoutEc(){const t=this.getEcToken();return console.log("token",t),Et(y(l({},this.config),{token:t})).then(this.unsetAuth(T(this.config)))}getPublicToken(){return this.config.token||this.getAuth(_(this.config))}getEcToken(){return this.config.token||this.getAuth(T(this.config))}hasPublicToken(){return!!this.getPublicToken()}hasEcToken(){return!!this.getEcToken()}hasAnyToken(){return!!this.getEcToken()||!!this.getPublicToken()}getBestToken(){try{return this.getEcToken()||this.getPublicToken()}catch(t){return}}model(t){return this.set({model:t})}token(t){return this.set({token:t})}dmShortID(t){return this.set({dmShortID:t})}dmID(t){return this.set({dmID:t})}dm(t){return this.dmShortID(t)}assetGroup(t){return this.set({assetGroup:t})}assetgroup(t){return this.assetGroup(t)}subdomain(t){return this.set({subdomain:t})}resource(t){return this.set({resource:t})}route(t){return this.set({route:t})}publicApi(){return Pt(this.config)}getDatamanager(t){return o(this,null,function*(){const e=yield this.getBestToken();return Lt(y(l({},this.config),{dmID:t,token:e}))})}dmList(){return o(this,arguments,function*(t={}){const e=yield this.getBestToken();return Tt(y(l({},this.config),{options:t,token:e}))})}modelList(){return o(this,arguments,function*(t={}){const e=yield this.getBestToken();return _t(y(l({},this.config),{options:t,token:e}))})}}const Bt=n=>new E({env:n});exports.Sdk=E;exports.act=jt;exports.apiURL=p;exports.assetList=Q;exports.createAsset=W;exports.createEntry=M;exports.deleteAsset=X;exports.deleteEntry=V;exports.dmList=Z;exports.editEntry=I;exports.entryList=F;exports.expect=h;exports.fetcher=g;exports.getAsset=H;exports.getDatamanager=Y;exports.getEcAuthKey=N;exports.getEntry=U;exports.getPublicAuthKey=J;exports.getSchema=G;exports.loginEc=K;exports.loginPublic=x;exports.logoutEc=C;exports.logoutPublic=z;exports.modelList=tt;exports.publicApi=v;exports.query=w;exports.raw=nt;exports.resourceList=et;exports.sdk=Bt;
|