datagrok-api
Advanced tools
Comparing version 0.1.15 to 0.1.17
{ | ||
"name": "datagrok-api", | ||
"version": "0.1.15", | ||
"version": "0.1.17", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -108,3 +108,5 @@ /** | ||
EVENT_DATA : 'event_data', | ||
PROGRESS_INDICATOR: 'progressindicator' | ||
PROGRESS_INDICATOR: 'progressindicator', | ||
CREDENTIALS: 'Credentials', | ||
SCRIPT_ENVIRONMENT: 'ScriptEnvironment' | ||
} | ||
@@ -111,0 +113,0 @@ |
@@ -9,3 +9,3 @@ import { | ||
Notebook, | ||
Project, Script, | ||
Project, Script, ScriptEnvironment, | ||
TableInfo, | ||
@@ -85,2 +85,6 @@ User | ||
/** Environments API endpoint | ||
* @type {HttpDataSource<ScriptEnvironment>} */ | ||
get environments() { return new HttpDataSource(grok_Dapi_Environments(), (a) => new ScriptEnvironment(a)); } | ||
/** Users Data Storage API endpoint | ||
@@ -260,3 +264,3 @@ * @type {UserDataStorage} */ | ||
* @param {boolean} currentUser get a value from a current user storage | ||
* @returns {Promise<Map>}*/ | ||
* @returns {Promise<Map>} */ | ||
get(name, currentUser = true) { | ||
@@ -271,3 +275,3 @@ return new Promise((resolve, reject) => | ||
* @param {boolean} currentUser get a value from a current user storage | ||
* @returns {Promise<Map>}*/ | ||
* @returns {Promise<string>} */ | ||
getValue(name, key, currentUser = true) { | ||
@@ -282,3 +286,3 @@ return new Promise((resolve, reject) => | ||
* @param {boolean} currentUser get a value from a current user storage | ||
* @returns {Promise}*/ | ||
* @returns {Promise} */ | ||
remove(name, key, currentUser = true) { | ||
@@ -285,0 +289,0 @@ return new Promise((resolve, reject) => |
import * as ui from "./../ui.js"; | ||
import {Functions} from "./functions"; | ||
import {TYPE} from "./const"; | ||
import {toJs} from "./wrappers"; | ||
@@ -148,2 +149,7 @@ | ||
/** Environment name | ||
* @type {string} */ | ||
get environment() { return grok_Notebook_Get_Environment(this.d); } | ||
set environment(e) { return grok_Notebook_Set_Environment(this.d, e); } | ||
/** Converts Notebook to HTML code | ||
@@ -191,2 +197,20 @@ * @returns {Promise<string>} */ | ||
/** Represents a script environment */ | ||
export class ScriptEnvironment extends Entity { | ||
constructor(d) { super(d); } | ||
/** Create instance of ScriptEnvironment | ||
* @param {string} name | ||
* @returns {ScriptEnvironment} | ||
* */ | ||
static create(name) { return new ScriptEnvironment(grok_ScriptEnvironment_Create(name)); } | ||
/** Environment yaml file content | ||
* @type {string} */ | ||
get environment() { return grok_ScriptEnvironment_Environment(this.d); } | ||
/** Setup environment */ | ||
setup() { return new Promise((resolve, reject) => grok_ScriptEnvironment_Setup(this.d, () => resolve())); } | ||
} | ||
/** | ||
@@ -198,2 +222,3 @@ * Represents a package, which is a unit of distribution of content in the Datagrok platform. | ||
this.webRoot = webRoot; | ||
this.name = ""; | ||
} | ||
@@ -205,2 +230,12 @@ | ||
/*async*/ init() { return Promise.resolve(null); } | ||
/** Returns credentials for package | ||
* @returns {Credentials} */ | ||
getCredentials() { | ||
return new Promise((resolve, reject) => grok_Package_Get_Credentials(this.name, (c) => { | ||
let cred = toJs(c); | ||
console.log(cred); | ||
resolve(cred); | ||
})); | ||
} | ||
} | ||
@@ -207,0 +242,0 @@ |
@@ -1,2 +0,2 @@ | ||
import {paramsToJs, toJs} from "./wrappers"; | ||
import {paramsToJs, toDart, toJs} from "./wrappers"; | ||
@@ -9,3 +9,3 @@ /** Grok functions */ | ||
call(name, parameters = {}, showProgress = false, progress = null) { return new Promise((resolve, reject) => grok_CallFunc(name, parameters, (out) => resolve(out), showProgress, progress)); } | ||
call(name, parameters = {}, showProgress = false, progress = null) { return new Promise((resolve, reject) => grok_CallFunc(name, parameters, (out) => resolve(out), showProgress, toDart(progress))); } | ||
@@ -12,0 +12,0 @@ eval(name) { return new Promise((resolve, reject) => grok_EvalFunc(name, (out) => resolve(out))); } |
@@ -61,4 +61,6 @@ import {VIEW_TYPE, VIEWER} from "./const"; | ||
/** Sets custom view panels on the ribbon. | ||
* Sample: {@link https://public.datagrok.ai/js/samples/ui/views/ribbon} */ | ||
setRibbonPanels(panels) { grok_View_SetRibbonPanels(this.d, panels); } | ||
* @param {Array<Array<HTMLElement>>} panels | ||
* @param {boolean} clear Clear all previous before setup | ||
* Sample: {@link https://public.datagrok.ai/js/samples/ui/views/ribbon} */ | ||
setRibbonPanels(panels, clear = false) { grok_View_SetRibbonPanels(this.d, panels, clear); } | ||
@@ -65,0 +67,0 @@ /** @returns {HTMLElement} View icon. */ |
@@ -243,2 +243,4 @@ import {toDart, toJs} from "./wrappers"; | ||
get percent() { return grok_ProgressIndicator_Get_Percent(this.d); } | ||
get description() { return grok_ProgressIndicator_Get_Description(this.d); } | ||
@@ -254,2 +256,9 @@ set description(s) { grok_ProgressIndicator_Set_Description(this.d, s); } | ||
export class TaskBarProgressIndicator extends ProgressIndicator { | ||
static create(name) { return new TaskBarProgressIndicator(grok_TaskBarProgressIndicator_Create(name)); } | ||
close() { return grok_TaskBarProgressIndicator_Close(this.d); } | ||
} | ||
export class TagEditor { | ||
@@ -377,5 +386,6 @@ constructor(d) { this.d = d; } | ||
* @returns {boolean} */ | ||
get checked() { return grok_TreeViewNode_Checked(this.d); } | ||
get checked() { return grok_TreeViewNode_Get_Checked(this.d); } | ||
set checked(checked) { return grok_TreeViewNode_Set_Checked(this.d, checked); } | ||
/** Returns node text | ||
/** Returns node text. | ||
* @returns {string} */ | ||
@@ -382,0 +392,0 @@ get text() { return grok_TreeViewNode_Text(this.d); } |
import {Column, DataFrame} from "./dataframe"; | ||
import {Project, Property, SemanticValue, User} from "./entities"; | ||
import {Credentials, Project, Property, ScriptEnvironment, SemanticValue, User} from "./entities"; | ||
import {EventData} from "./events"; | ||
@@ -59,2 +59,6 @@ import {Menu, ProgressIndicator} from "./widgets"; | ||
return new ProgressIndicator(d); | ||
case TYPE.CREDENTIALS: | ||
return new Credentials(d); | ||
case TYPE.SCRIPT_ENVIRONMENT: | ||
return new ScriptEnvironment(d); | ||
} | ||
@@ -70,2 +74,4 @@ | ||
export function toDart(x) { | ||
if (x === undefined || x === null) | ||
return x; | ||
return (typeof x.d !== 'undefined') ? x.d : x; | ||
@@ -72,0 +78,0 @@ } |
156023
3498