-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmasdesc.js
More file actions
28 lines (25 loc) · 935 Bytes
/
masdesc.js
File metadata and controls
28 lines (25 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const restaf = require("@sassoftware/restaf");
const restaflib = require("@sassoftware/restaflib");
const getLogonPayload = require("./packages/examples/lib/getLogonPayload.js");
let params = {model: 'cancer10000'};
_masDescribe(params)
.then((r) => console.log("done", r))
.catch((err) => console.log(JSON.stringify(err, null, 4)));
async function _masDescribe(params) {
// setup
let { masSetup, masDescribe } = restaflib;
let store = restaf.initStore({});
let logonPayload = await getLogonPayload();
let inputs = {};
let masControl;
let {model} = params;
try {
masControl = await masSetup(store, [model], logonPayload);
let describe = await masDescribe(masControl, model, null, true);
return { content: [{ type: 'text', text: JSON.stringify(describe) }] };
} catch (err) {
console.log(err);
await store.logoff();
return { content: [{ type: 'text', text: JSON.stringify(err) }] };
}
}