datagrok-tools 4.2.1 → 4.3.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.
Files changed (42) hide show
  1. package/README.md +84 -84
  2. package/bin/_deprecated/migrate.js +83 -83
  3. package/bin/_deprecated/upload.js +161 -161
  4. package/bin/commands/publish.js +1 -1
  5. package/bin/grok.js +26 -26
  6. package/config-template.yaml +11 -11
  7. package/entity-template/app.js +6 -6
  8. package/entity-template/connection.json +17 -17
  9. package/entity-template/function.js +9 -9
  10. package/entity-template/function.ts +9 -9
  11. package/entity-template/init.js +4 -4
  12. package/entity-template/panel.js +11 -11
  13. package/entity-template/panel.ts +11 -11
  14. package/entity-template/queries.sql +7 -7
  15. package/entity-template/sem-type-detector.js +11 -11
  16. package/entity-template/view-class.js +60 -60
  17. package/entity-template/view-class.ts +64 -64
  18. package/entity-template/view.js +10 -10
  19. package/entity-template/viewer-class.js +23 -23
  20. package/entity-template/viewer-class.ts +23 -23
  21. package/entity-template/viewer.js +8 -8
  22. package/package-template/.eslintrc.json +38 -38
  23. package/package-template/.vscode/launch.json +15 -15
  24. package/package-template/.vscode/tasks.json +9 -9
  25. package/package-template/README.md +2 -2
  26. package/package-template/detectors.js +9 -9
  27. package/package-template/gitignore +29 -29
  28. package/package-template/package.json +29 -29
  29. package/package-template/src/package-test.js +12 -12
  30. package/package-template/src/package-test.ts +13 -13
  31. package/package-template/src/package.js +11 -11
  32. package/package-template/ts.webpack.config.js +36 -36
  33. package/package-template/tsconfig.json +71 -71
  34. package/package-template/webpack.config.js +27 -27
  35. package/package.json +51 -51
  36. package/script-template/javascript.js +6 -6
  37. package/script-template/julia.jl +8 -8
  38. package/script-template/node.js +8 -8
  39. package/script-template/octave.m +8 -8
  40. package/script-template/python.py +8 -8
  41. package/script-template/r.R +8 -8
  42. package/tsconfig.json +71 -71
package/bin/grok.js CHANGED
@@ -1,26 +1,26 @@
1
- #!/usr/bin/env node
2
- const argv = require('minimist')(process.argv.slice(2), {alias: {k: 'key'}});
3
- const help = require('./commands/help').help;
4
-
5
- const commands = {
6
- add: require('./commands/add').add,
7
- api: require('./commands/api').api,
8
- config: require('./commands/config').config,
9
- create: require('./commands/create').create,
10
- publish: require('./commands/publish').publish,
11
- migrate: require('./_deprecated/migrate').migrate
12
- };
13
-
14
- const command = argv['_'][0];
15
- if (command in commands) {
16
- try {
17
- if (!commands[command](argv)) {
18
- console.log(help[command]);
19
- }
20
- } catch (err) {
21
- console.error(err);
22
- console.log(help[command]);
23
- }
24
- } else {
25
- console.log(help.help);
26
- }
1
+ #!/usr/bin/env node
2
+ const argv = require('minimist')(process.argv.slice(2), {alias: {k: 'key'}});
3
+ const help = require('./commands/help').help;
4
+
5
+ const commands = {
6
+ add: require('./commands/add').add,
7
+ api: require('./commands/api').api,
8
+ config: require('./commands/config').config,
9
+ create: require('./commands/create').create,
10
+ publish: require('./commands/publish').publish,
11
+ migrate: require('./_deprecated/migrate').migrate
12
+ };
13
+
14
+ const command = argv['_'][0];
15
+ if (command in commands) {
16
+ try {
17
+ if (!commands[command](argv)) {
18
+ console.log(help[command]);
19
+ }
20
+ } catch (err) {
21
+ console.error(err);
22
+ console.log(help[command]);
23
+ }
24
+ } else {
25
+ console.log(help.help);
26
+ }
@@ -1,11 +1,11 @@
1
- servers:
2
- dev:
3
- url: 'https://dev.datagrok.ai/api'
4
- key: ''
5
- public:
6
- url: 'https://public.datagrok.ai/api'
7
- key: ''
8
- local:
9
- url: 'http://127.0.0.1:8080/api'
10
- key: ''
11
- default: 'public'
1
+ servers:
2
+ dev:
3
+ url: 'https://dev.datagrok.ai/api'
4
+ key: ''
5
+ public:
6
+ url: 'https://public.datagrok.ai/api'
7
+ key: ''
8
+ local:
9
+ url: 'http://127.0.0.1:8080/api'
10
+ key: ''
11
+ default: 'public'
@@ -1,6 +1,6 @@
1
-
2
- //name: #{NAME}
3
- //tags: app
4
- export function #{NAME}() {
5
- grok.shell.info('Hello!');
6
- }
1
+
2
+ //name: #{NAME}
3
+ //tags: app
4
+ export function #{NAME}() {
5
+ grok.shell.info('Hello!');
6
+ }
@@ -1,17 +1,17 @@
1
- {
2
- "name": "#{NAME}",
3
- "#type": "DataConnection",
4
- "parameters": {
5
- "server": "#{GROK_DB_SERVER}",
6
- "db": "#{DB_NAME}"
7
- },
8
- "credentials" : {
9
- "parameters": {
10
- "login": "#{LOGIN}",
11
- "password": "#{PASSWORD}"
12
- }
13
- },
14
- "dataSource": "PostgreSQL",
15
- "description": "#{DB_NAME} db",
16
- "tags": ["demo"]
17
- }
1
+ {
2
+ "name": "#{NAME}",
3
+ "#type": "DataConnection",
4
+ "parameters": {
5
+ "server": "#{GROK_DB_SERVER}",
6
+ "db": "#{DB_NAME}"
7
+ },
8
+ "credentials" : {
9
+ "parameters": {
10
+ "login": "#{LOGIN}",
11
+ "password": "#{PASSWORD}"
12
+ }
13
+ },
14
+ "dataSource": "PostgreSQL",
15
+ "description": "#{DB_NAME} db",
16
+ "tags": ["demo"]
17
+ }
@@ -1,9 +1,9 @@
1
-
2
- //name: #{NAME}
3
- //input: string name
4
- //output: string greeting
5
- export function #{NAME}(name) {
6
- let greeting = 'Hello, ' + name;
7
- grok.shell.info(greeting);
8
- return greeting;
9
- }
1
+
2
+ //name: #{NAME}
3
+ //input: string name
4
+ //output: string greeting
5
+ export function #{NAME}(name) {
6
+ let greeting = 'Hello, ' + name;
7
+ grok.shell.info(greeting);
8
+ return greeting;
9
+ }
@@ -1,9 +1,9 @@
1
-
2
- //name: #{NAME}
3
- //input: string name
4
- //output: string greeting
5
- export function #{NAME}(name: string) {
6
- let greeting = 'Hello, ' + name;
7
- grok.shell.info(greeting);
8
- return greeting;
9
- }
1
+
2
+ //name: #{NAME}
3
+ //input: string name
4
+ //output: string greeting
5
+ export function #{NAME}(name: string) {
6
+ let greeting = 'Hello, ' + name;
7
+ grok.shell.info(greeting);
8
+ return greeting;
9
+ }
@@ -1,4 +1,4 @@
1
-
2
- //tags: init
3
- export async function #{NAME}() {
4
- }
1
+
2
+ //tags: init
3
+ export async function #{NAME}() {
4
+ }
@@ -1,11 +1,11 @@
1
-
2
- //name: #{NAME}
3
- //description: Creates an info panel
4
- //tags: panel
5
- //input: string smiles {semType: Molecule}
6
- //output: widget result
7
- //condition: true
8
- export function #{NAME}(smiles) {
9
- let mol = ui.div(grok.chem.svgMol(smiles));
10
- return DG.Widget.fromRoot(mol);
11
- }
1
+
2
+ //name: #{NAME}
3
+ //description: Creates an info panel
4
+ //tags: panel
5
+ //input: string smiles {semType: Molecule}
6
+ //output: widget result
7
+ //condition: true
8
+ export function #{NAME}(smiles) {
9
+ let mol = ui.div(grok.chem.svgMol(smiles));
10
+ return DG.Widget.fromRoot(mol);
11
+ }
@@ -1,11 +1,11 @@
1
-
2
- //name: #{NAME}
3
- //description: Creates an info panel
4
- //tags: panel
5
- //input: string smiles {semType: Molecule}
6
- //output: widget result
7
- //condition: true
8
- export function #{NAME}(smiles: string) {
9
- let mol = ui.div(grok.chem.svgMol(smiles));
10
- return DG.Widget.fromRoot(mol);
11
- }
1
+
2
+ //name: #{NAME}
3
+ //description: Creates an info panel
4
+ //tags: panel
5
+ //input: string smiles {semType: Molecule}
6
+ //output: widget result
7
+ //condition: true
8
+ export function #{NAME}(smiles: string) {
9
+ let mol = ui.div(grok.chem.svgMol(smiles));
10
+ return DG.Widget.fromRoot(mol);
11
+ }
@@ -1,7 +1,7 @@
1
-
2
- --name: #{NAME}
3
- --connection: #{CONNECTION}
4
- --input: int id
5
- --output: dataframe result
6
- select * from country where id = @id
7
- --end
1
+
2
+ --name: #{NAME}
3
+ --connection: #{CONNECTION}
4
+ --input: int id
5
+ --output: dataframe result
6
+ select * from country where id = @id
7
+ --end
@@ -1,11 +1,11 @@
1
-
2
- //tags: semTypeDetector
3
- //input: column col
4
- //output: string semType
5
- detect#{PACKAGE_DETECTORS_NAME}(col) {
6
- if (col.name.startsWith('#{NAME_PREFIX}')) {
7
- col.semType = '#{NAME}';
8
- return col.semType;
9
- }
10
- return null;
11
- }
1
+
2
+ //tags: semTypeDetector
3
+ //input: column col
4
+ //output: string semType
5
+ detect#{PACKAGE_DETECTORS_NAME}(col) {
6
+ if (col.name.startsWith('#{NAME_PREFIX}')) {
7
+ col.semType = '#{NAME}';
8
+ return col.semType;
9
+ }
10
+ return null;
11
+ }
@@ -1,60 +1,60 @@
1
- import * as grok from 'datagrok-api/grok';
2
- import * as ui from 'datagrok-api/ui';
3
- import * as DG from 'datagrok-api/dg';
4
-
5
- // A sample class from the Notebooks package:
6
- // https://github.com/datagrok-ai/public/tree/master/packages/Notebooks
7
- // This class defines a new view for Jupyter Notebooks.
8
- export class #{NAME} extends DG.ViewBase {
9
- constructor(params, path) {
10
- super(params, path);
11
- this.TYPE = 'Notebook';
12
- this.PATH = '/notebook';
13
- }
14
-
15
- // Override basic methods
16
- get type() {
17
- return this.TYPE;
18
- }
19
-
20
- get helpUrl() {
21
- return '/help/develop/jupyter-notebook.md';
22
- }
23
-
24
- get name() {
25
- return 'Notebook';
26
- }
27
-
28
- get path() {
29
- return `${this.PATH}/${this.notebookId}`;
30
- }
31
-
32
- // Icon
33
- getIcon() {
34
- let img = document.createElement('img');
35
- img.src = '/images/entities/jupyter.png';
36
- img.height = 18;
37
- img.width = 18;
38
- return img;
39
- }
40
-
41
- // View state serialization/deserialization
42
- saveStateMap() {
43
- return {'notebookId': this.notebookId};
44
- }
45
-
46
- loadStateMap(stateMap) {
47
- open(stateMap['notebookId']);
48
- }
49
-
50
- // URL path handler
51
- handlePath(path) {
52
- let id = path.replace(`${this.PATH}/`, '');
53
- open(id);
54
- }
55
-
56
- // URL path checker
57
- acceptsPath(path) {
58
- return path.startsWith(this.PATH);
59
- }
60
- }
1
+ import * as grok from 'datagrok-api/grok';
2
+ import * as ui from 'datagrok-api/ui';
3
+ import * as DG from 'datagrok-api/dg';
4
+
5
+ // A sample class from the Notebooks package:
6
+ // https://github.com/datagrok-ai/public/tree/master/packages/Notebooks
7
+ // This class defines a new view for Jupyter Notebooks.
8
+ export class #{NAME} extends DG.ViewBase {
9
+ constructor(params, path) {
10
+ super(params, path);
11
+ this.TYPE = 'Notebook';
12
+ this.PATH = '/notebook';
13
+ }
14
+
15
+ // Override basic methods
16
+ get type() {
17
+ return this.TYPE;
18
+ }
19
+
20
+ get helpUrl() {
21
+ return '/help/develop/jupyter-notebook.md';
22
+ }
23
+
24
+ get name() {
25
+ return 'Notebook';
26
+ }
27
+
28
+ get path() {
29
+ return `${this.PATH}/${this.notebookId}`;
30
+ }
31
+
32
+ // Icon
33
+ getIcon() {
34
+ let img = document.createElement('img');
35
+ img.src = '/images/entities/jupyter.png';
36
+ img.height = 18;
37
+ img.width = 18;
38
+ return img;
39
+ }
40
+
41
+ // View state serialization/deserialization
42
+ saveStateMap() {
43
+ return {'notebookId': this.notebookId};
44
+ }
45
+
46
+ loadStateMap(stateMap) {
47
+ open(stateMap['notebookId']);
48
+ }
49
+
50
+ // URL path handler
51
+ handlePath(path) {
52
+ let id = path.replace(`${this.PATH}/`, '');
53
+ open(id);
54
+ }
55
+
56
+ // URL path checker
57
+ acceptsPath(path) {
58
+ return path.startsWith(this.PATH);
59
+ }
60
+ }
@@ -1,64 +1,64 @@
1
- import * as grok from 'datagrok-api/grok';
2
- import * as ui from 'datagrok-api/ui';
3
- import * as DG from 'datagrok-api/dg';
4
-
5
- // A sample class from the Notebooks package:
6
- // https://github.com/datagrok-ai/public/tree/master/packages/Notebooks
7
- // This class defines a new view for Jupyter Notebooks.
8
- export class #{NAME} extends DG.ViewBase {
9
- TYPE: string;
10
- PATH: string;
11
- notebookId: any;
12
-
13
- constructor(params: object | null, path: string) {
14
- super(params, path);
15
- this.TYPE = 'Notebook';
16
- this.PATH = '/notebook';
17
- }
18
-
19
- // Override basic methods
20
- get type() {
21
- return this.TYPE;
22
- }
23
-
24
- get helpUrl() {
25
- return '/help/compute/jupyter-notebook.md';
26
- }
27
-
28
- get name() {
29
- return 'Notebook';
30
- }
31
-
32
- get path() {
33
- return `${this.PATH}/${this.notebookId}`;
34
- }
35
-
36
- // Icon
37
- getIcon() {
38
- let img = document.createElement('img');
39
- img.src = '/images/entities/jupyter.png';
40
- img.height = 18;
41
- img.width = 18;
42
- return img;
43
- }
44
-
45
- // View state serialization/deserialization
46
- saveStateMap() {
47
- return {'notebookId': this.notebookId};
48
- }
49
-
50
- loadStateMap(stateMap: { [x: string]: string }) {
51
- open(stateMap['notebookId']);
52
- }
53
-
54
- // URL path handler
55
- handlePath(path: string) {
56
- let id = path.replace(`${this.PATH}/`, '');
57
- open(id);
58
- }
59
-
60
- // URL path checker
61
- acceptsPath(path: string) {
62
- return path.startsWith(this.PATH);
63
- }
64
- }
1
+ import * as grok from 'datagrok-api/grok';
2
+ import * as ui from 'datagrok-api/ui';
3
+ import * as DG from 'datagrok-api/dg';
4
+
5
+ // A sample class from the Notebooks package:
6
+ // https://github.com/datagrok-ai/public/tree/master/packages/Notebooks
7
+ // This class defines a new view for Jupyter Notebooks.
8
+ export class #{NAME} extends DG.ViewBase {
9
+ TYPE: string;
10
+ PATH: string;
11
+ notebookId: any;
12
+
13
+ constructor(params: object | null, path: string) {
14
+ super(params, path);
15
+ this.TYPE = 'Notebook';
16
+ this.PATH = '/notebook';
17
+ }
18
+
19
+ // Override basic methods
20
+ get type() {
21
+ return this.TYPE;
22
+ }
23
+
24
+ get helpUrl() {
25
+ return '/help/compute/jupyter-notebook.md';
26
+ }
27
+
28
+ get name() {
29
+ return 'Notebook';
30
+ }
31
+
32
+ get path() {
33
+ return `${this.PATH}/${this.notebookId}`;
34
+ }
35
+
36
+ // Icon
37
+ getIcon() {
38
+ let img = document.createElement('img');
39
+ img.src = '/images/entities/jupyter.png';
40
+ img.height = 18;
41
+ img.width = 18;
42
+ return img;
43
+ }
44
+
45
+ // View state serialization/deserialization
46
+ saveStateMap() {
47
+ return {'notebookId': this.notebookId};
48
+ }
49
+
50
+ loadStateMap(stateMap: { [x: string]: string }) {
51
+ open(stateMap['notebookId']);
52
+ }
53
+
54
+ // URL path handler
55
+ handlePath(path: string) {
56
+ let id = path.replace(`${this.PATH}/`, '');
57
+ open(id);
58
+ }
59
+
60
+ // URL path checker
61
+ acceptsPath(path: string) {
62
+ return path.startsWith(this.PATH);
63
+ }
64
+ }
@@ -1,10 +1,10 @@
1
-
2
- //name: #{NAME}
3
- //description: Creates #{NAME} view
4
- //tags: view
5
- //input: map params
6
- //input: string path
7
- //output: view result
8
- export function _#{NAME}(params = null, path = '') {
9
- return new #{NAME}(params, path);
10
- }
1
+
2
+ //name: #{NAME}
3
+ //description: Creates #{NAME} view
4
+ //tags: view
5
+ //input: map params
6
+ //input: string path
7
+ //output: view result
8
+ export function _#{NAME}(params = null, path = '') {
9
+ return new #{NAME}(params, path);
10
+ }
@@ -1,23 +1,23 @@
1
- import * as grok from 'datagrok-api/grok';
2
- import * as ui from 'datagrok-api/ui';
3
- import * as DG from 'datagrok-api/dg';
4
-
5
- // See also https://datagrok.ai/help/develop/how-to/develop-custom-viewer
6
- // This viewer does the following:
7
- // * listens to changes of filter and selection in the attached table,
8
- // * updates the number of filtered/selected rows accordingly.
9
- export class #{NAME} extends DG.JsViewer {
10
- onTableAttached() {
11
- this.subs.push(this.dataFrame.selection.onChanged.subscribe((_) => this.render()));
12
- this.subs.push(this.dataFrame.filter.onChanged.subscribe((_) => this.render()));
13
-
14
- this.render();
15
- }
16
-
17
- render() {
18
- this.root.innerHTML =
19
- `${this.dataFrame.toString()}<br>
20
- Selected: ${this.dataFrame.selection.trueCount}<br>
21
- Filtered: ${this.dataFrame.filter.trueCount}`;
22
- }
23
- }
1
+ import * as grok from 'datagrok-api/grok';
2
+ import * as ui from 'datagrok-api/ui';
3
+ import * as DG from 'datagrok-api/dg';
4
+
5
+ // See also https://datagrok.ai/help/develop/how-to/develop-custom-viewer
6
+ // This viewer does the following:
7
+ // * listens to changes of filter and selection in the attached table,
8
+ // * updates the number of filtered/selected rows accordingly.
9
+ export class #{NAME} extends DG.JsViewer {
10
+ onTableAttached() {
11
+ this.subs.push(this.dataFrame.selection.onChanged.subscribe((_) => this.render()));
12
+ this.subs.push(this.dataFrame.filter.onChanged.subscribe((_) => this.render()));
13
+
14
+ this.render();
15
+ }
16
+
17
+ render() {
18
+ this.root.innerHTML =
19
+ `${this.dataFrame.toString()}<br>
20
+ Selected: ${this.dataFrame.selection.trueCount}<br>
21
+ Filtered: ${this.dataFrame.filter.trueCount}`;
22
+ }
23
+ }
@@ -1,23 +1,23 @@
1
- import * as grok from 'datagrok-api/grok';
2
- import * as ui from 'datagrok-api/ui';
3
- import * as DG from 'datagrok-api/dg';
4
-
5
- // See also https://datagrok.ai/help/develop/how-to/develop-custom-viewer
6
- // This viewer does the following:
7
- // * listens to changes of filter and selection in the attached table,
8
- // * updates the number of filtered/selected rows accordingly.
9
- export class #{NAME} extends DG.JsViewer {
10
- onTableAttached() {
11
- this.subs.push(this.dataFrame!.selection.onChanged.subscribe((_) => this.render()));
12
- this.subs.push(this.dataFrame!.filter.onChanged.subscribe((_) => this.render()));
13
-
14
- this.render();
15
- }
16
-
17
- render() {
18
- this.root.innerHTML =
19
- `${this.dataFrame!.toString()}<br>
20
- Selected: ${this.dataFrame!.selection.trueCount}<br>
21
- Filtered: ${this.dataFrame!.filter.trueCount}`;
22
- }
23
- }
1
+ import * as grok from 'datagrok-api/grok';
2
+ import * as ui from 'datagrok-api/ui';
3
+ import * as DG from 'datagrok-api/dg';
4
+
5
+ // See also https://datagrok.ai/help/develop/how-to/develop-custom-viewer
6
+ // This viewer does the following:
7
+ // * listens to changes of filter and selection in the attached table,
8
+ // * updates the number of filtered/selected rows accordingly.
9
+ export class #{NAME} extends DG.JsViewer {
10
+ onTableAttached() {
11
+ this.subs.push(this.dataFrame!.selection.onChanged.subscribe((_) => this.render()));
12
+ this.subs.push(this.dataFrame!.filter.onChanged.subscribe((_) => this.render()));
13
+
14
+ this.render();
15
+ }
16
+
17
+ render() {
18
+ this.root.innerHTML =
19
+ `${this.dataFrame!.toString()}<br>
20
+ Selected: ${this.dataFrame!.selection.trueCount}<br>
21
+ Filtered: ${this.dataFrame!.filter.trueCount}`;
22
+ }
23
+ }
@@ -1,8 +1,8 @@
1
-
2
- //name: #{NAME}
3
- //description: Creates #{NAME} viewer
4
- //tags: viewer
5
- //output: viewer result
6
- export function _#{NAME}() {
7
- return new #{NAME}();
8
- }
1
+
2
+ //name: #{NAME}
3
+ //description: Creates #{NAME} viewer
4
+ //tags: viewer
5
+ //output: viewer result
6
+ export function _#{NAME}() {
7
+ return new #{NAME}();
8
+ }