datagrok-tools 4.1.18 → 4.2.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 (45) 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/config.js +11 -6
  5. package/bin/commands/create.js +2 -0
  6. package/bin/commands/help.js +1 -1
  7. package/bin/commands/publish.js +31 -25
  8. package/bin/grok.js +26 -26
  9. package/bin/utils/utils.js +1 -7
  10. package/config-template.yaml +11 -11
  11. package/entity-template/app.js +6 -6
  12. package/entity-template/connection.json +17 -17
  13. package/entity-template/function.js +9 -9
  14. package/entity-template/function.ts +9 -9
  15. package/entity-template/init.js +4 -4
  16. package/entity-template/panel.js +11 -11
  17. package/entity-template/panel.ts +11 -11
  18. package/entity-template/queries.sql +7 -7
  19. package/entity-template/sem-type-detector.js +11 -11
  20. package/entity-template/view-class.js +60 -60
  21. package/entity-template/view-class.ts +64 -64
  22. package/entity-template/view.js +10 -10
  23. package/entity-template/viewer-class.js +23 -23
  24. package/entity-template/viewer-class.ts +23 -23
  25. package/entity-template/viewer.js +8 -8
  26. package/package-template/.eslintrc.json +37 -35
  27. package/package-template/.vscode/launch.json +15 -15
  28. package/package-template/.vscode/tasks.json +9 -9
  29. package/package-template/README.md +2 -2
  30. package/package-template/detectors.js +9 -9
  31. package/package-template/gitignore +29 -29
  32. package/package-template/package.json +23 -22
  33. package/package-template/src/package-test.js +13 -0
  34. package/package-template/src/package-test.ts +13 -0
  35. package/package-template/src/package.js +2 -2
  36. package/package-template/ts.webpack.config.js +3 -1
  37. package/package-template/webpack.config.js +27 -26
  38. package/package.json +51 -51
  39. package/script-template/javascript.js +6 -6
  40. package/script-template/julia.jl +8 -8
  41. package/script-template/node.js +8 -8
  42. package/script-template/octave.m +8 -8
  43. package/script-template/python.py +8 -8
  44. package/script-template/r.R +8 -8
  45. package/tsconfig.json +71 -71
@@ -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
+ }
@@ -1,35 +1,37 @@
1
- {
2
- "env": {
3
- "browser": true,
4
- "es2021": true
5
- },
6
- "extends": [
7
- "google"
8
- ],
9
- "parserOptions": {
10
- "ecmaVersion": 12,
11
- "sourceType": "module"
12
- },
13
- "rules": {
14
- "indent": [
15
- "error",
16
- 2
17
- ],
18
- "max-len": [
19
- "error",
20
- 120
21
- ],
22
- "require-jsdoc": "off",
23
- "spaced-comment": "off",
24
- "linebreak-style": "off",
25
- "curly": [
26
- "error",
27
- "multi-or-nest"
28
- ],
29
- "brace-style": [
30
- "error",
31
- "1tbs",
32
- { "allowSingleLine": true }
33
- ]
34
- }
35
- }
1
+ {
2
+ "env": {
3
+ "browser": true,
4
+ "es2021": true
5
+ },
6
+ "extends": [
7
+ "google"
8
+ ],
9
+ "parserOptions": {
10
+ "ecmaVersion": 12,
11
+ "sourceType": "module"
12
+ },
13
+ "rules": {
14
+ "indent": [
15
+ "error",
16
+ 2
17
+ ],
18
+ "max-len": [
19
+ "error",
20
+ 120
21
+ ],
22
+ "require-jsdoc": "off",
23
+ "spaced-comment": "off",
24
+ "linebreak-style": "off",
25
+ "curly": [
26
+ "error",
27
+ "multi-or-nest"
28
+ ],
29
+ "brace-style": [
30
+ "error",
31
+ "1tbs",
32
+ {
33
+ "allowSingleLine": true
34
+ }
35
+ ]
36
+ }
37
+ }
@@ -1,16 +1,16 @@
1
- {
2
- // Use IntelliSense to learn about possible attributes.
3
- // Hover to view descriptions of existing attributes.
4
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
- "version": "0.2.0",
6
- "configurations": [
7
- {
8
- "preLaunchTask": "rebuild",
9
- "type": "pwa-chrome",
10
- "request": "launch",
11
- "name": "Debug #{GROK_HOST_ALIAS}",
12
- "url": "#{GROK_HOST}",
13
- "webRoot": "${workspaceFolder}"
14
- }
15
- ]
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "preLaunchTask": "rebuild",
9
+ "type": "pwa-chrome",
10
+ "request": "launch",
11
+ "name": "Debug #{GROK_HOST_ALIAS}",
12
+ "url": "#{GROK_HOST}",
13
+ "webRoot": "${workspaceFolder}"
14
+ }
15
+ ]
16
16
  }
@@ -1,10 +1,10 @@
1
- {
2
- "version": "2.0.0",
3
- "tasks": [
4
- {
5
- "type": "shell",
6
- "command": "cmd.exe /c 'call webpack && call grok publish {GROK_HOST_ALIAS}'",
7
- "label": "rebuild"
8
- }
9
- ]
1
+ {
2
+ "version": "2.0.0",
3
+ "tasks": [
4
+ {
5
+ "type": "shell",
6
+ "command": "cmd.exe /c 'call webpack && call grok publish {GROK_HOST_ALIAS}'",
7
+ "label": "rebuild"
8
+ }
9
+ ]
10
10
  }
@@ -1,3 +1,3 @@
1
- # #{PACKAGE_NAME}
2
-
1
+ # #{PACKAGE_NAME}
2
+
3
3
  #{PACKAGE_NAME} is a [package](https://datagrok.ai/help/develop/develop#packages) for the [Datagrok](https://datagrok.ai) platform.
@@ -1,9 +1,9 @@
1
- /**
2
- * The class contains semantic type detectors.
3
- * Detectors are functions tagged with `DG.FUNC_TYPES.SEM_TYPE_DETECTOR`.
4
- * See also: https://datagrok.ai/help/develop/how-to/define-semantic-type-detectors
5
- * The class name is comprised of <PackageName> and the `PackageDetectors` suffix.
6
- * Follow this naming convention to ensure that your detectors are properly loaded.
7
- */
8
- class #{PACKAGE_DETECTORS_NAME}PackageDetectors extends DG.Package {
9
- }
1
+ /**
2
+ * The class contains semantic type detectors.
3
+ * Detectors are functions tagged with `DG.FUNC_TYPES.SEM_TYPE_DETECTOR`.
4
+ * See also: https://datagrok.ai/help/develop/how-to/define-semantic-type-detectors
5
+ * The class name is comprised of <PackageName> and the `PackageDetectors` suffix.
6
+ * Follow this naming convention to ensure that your detectors are properly loaded.
7
+ */
8
+ class #{PACKAGE_DETECTORS_NAME}PackageDetectors extends DG.Package {
9
+ }
@@ -1,29 +1,29 @@
1
- # Developer keys
2
- upload.keys.json
3
-
4
- # Dependency directories
5
- node_modules/
6
-
7
- # Webpack outputs
8
- dist/
9
-
10
- # IDEs
11
- # VS Code (https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore)
12
- .vscode/*
13
- !.vscode/settings.json
14
- !.vscode/tasks.json
15
- !.vscode/launch.json
16
- !.vscode/extensions.json
17
- *.code-workspace
18
- .history/
19
-
20
- # Intellij IDEA/WebStorm (https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore)
21
- .idea/inspectionProfiles/
22
- .idea/**/compiler.xml
23
- .idea/**/encodings.xml
24
- .idea/**/workspace.xml
25
- .idea/**/tasks.xml
26
- .idea/**/usage.statistics.xml
27
- .idea/**/dictionaries
28
- .idea/**/shelf
29
- .idea/codeStyles/
1
+ # Developer keys
2
+ upload.keys.json
3
+
4
+ # Dependency directories
5
+ node_modules/
6
+
7
+ # Webpack outputs
8
+ dist/
9
+
10
+ # IDEs
11
+ # VS Code (https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore)
12
+ .vscode/*
13
+ !.vscode/settings.json
14
+ !.vscode/tasks.json
15
+ !.vscode/launch.json
16
+ !.vscode/extensions.json
17
+ *.code-workspace
18
+ .history/
19
+
20
+ # Intellij IDEA/WebStorm (https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore)
21
+ .idea/inspectionProfiles/
22
+ .idea/**/compiler.xml
23
+ .idea/**/encodings.xml
24
+ .idea/**/workspace.xml
25
+ .idea/**/tasks.xml
26
+ .idea/**/usage.statistics.xml
27
+ .idea/**/dictionaries
28
+ .idea/**/shelf
29
+ .idea/codeStyles/
@@ -1,22 +1,23 @@
1
- {
2
- "name": "#{PACKAGE_NAME_LOWERCASE}",
3
- "beta": true,
4
- "friendlyName": "#{PACKAGE_NAME}",
5
- "version": "0.0.1",
6
- "description": "",
7
- "dependencies": {
8
- "datagrok-api": "latest",
9
- "cash-dom": "latest",
10
- "dayjs": "latest"
11
- },
12
- "devDependencies": {
13
- "webpack": "latest",
14
- "webpack-cli": "latest"
15
- },
16
- "scripts": {
17
- "debug-#{PACKAGE_NAME_LOWERCASE}": "grok publish --rebuild",
18
- "release-#{PACKAGE_NAME_LOWERCASE}": "grok publish --rebuild --release",
19
- "build-#{PACKAGE_NAME_LOWERCASE}": "webpack",
20
- "build": "webpack"
21
- }
22
- }
1
+ {
2
+ "name": "#{PACKAGE_NAME_LOWERCASE}",
3
+ "beta": true,
4
+ "friendlyName": "#{PACKAGE_NAME}",
5
+ "version": "0.0.1",
6
+ "description": "",
7
+ "dependencies": {
8
+ "datagrok-api": "latest",
9
+ "cash-dom": "latest",
10
+ "dayjs": "latest"
11
+ },
12
+ "devDependencies": {
13
+ "webpack": "latest",
14
+ "webpack-cli": "latest"
15
+ },
16
+ "scripts": {
17
+ "link-all": "",
18
+ "debug-#{PACKAGE_NAME_LOWERCASE}": "webpack && grok publish ",
19
+ "release-#{PACKAGE_NAME_LOWERCASE}": "webpack && grok publish --release",
20
+ "build-#{PACKAGE_NAME_LOWERCASE}": "webpack",
21
+ "build": "webpack"
22
+ }
23
+ }
@@ -0,0 +1,13 @@
1
+ import * as DG from "datagrok-api/dg";
2
+ import * as grok from "datagrok-api/grok";
3
+ import {runTests} from "@datagrok-libraries/utils/src/test";
4
+ import "./tests/chem-tests";
5
+
6
+ export let _package = new DG.Package();
7
+
8
+ //name: test
9
+ //output: dataframe result
10
+ export async function test() {
11
+ let data = await runTests();
12
+ return DG.DataFrame.fromObjects(data);
13
+ }
@@ -0,0 +1,13 @@
1
+ import * as DG from "datagrok-api/dg";
2
+ import * as grok from "datagrok-api/grok";
3
+ import {runTests} from "@datagrok-libraries/utils/src/test";
4
+ import "./tests/chem-tests";
5
+
6
+ export let _package = new DG.Package();
7
+
8
+ //name: test
9
+ //output: dataframe result
10
+ export async function test(): Promise<DG.DataFrame> {
11
+ let data = await runTests();
12
+ return DG.DataFrame.fromObjects(data)!;
13
+ }
@@ -5,7 +5,7 @@ import * as DG from 'datagrok-api/dg';
5
5
 
6
6
  export const _package = new DG.Package();
7
7
 
8
- //name: test
9
- export function test() {
8
+ //name: info
9
+ export function info() {
10
10
  grok.shell.info(_package.webRoot);
11
11
  }
@@ -1,8 +1,10 @@
1
1
  const path = require('path');
2
+ const packageName = path.parse(require('./package.json').name).name.toLowerCase().replace(/-/g, '');
2
3
 
3
4
  module.exports = {
4
5
  mode: 'development',
5
6
  entry: {
7
+ test: {filename: 'package-test.js', library: {type: 'var', name:`${packageName}_test`}, import: './src/package-test.ts'},
6
8
  package: './src/package.ts'
7
9
  },
8
10
  resolve: {
@@ -27,7 +29,7 @@ module.exports = {
27
29
  },
28
30
  output: {
29
31
  filename: '[name].js',
30
- library: '#{PACKAGE_NAME_LOWERCASE_WORD}',
32
+ library: packageName,
31
33
  libraryTarget: 'var',
32
34
  path: path.resolve(__dirname, 'dist'),
33
35
  },
@@ -1,26 +1,27 @@
1
- const path = require('path');
2
-
3
- module.exports = {
4
- mode: 'development',
5
- entry: {
6
- package: './src/package.js'
7
- },
8
- devtool: 'inline-source-map',
9
- externals: {
10
- 'datagrok-api/dg': 'DG',
11
- 'datagrok-api/grok': 'grok',
12
- 'datagrok-api/ui': 'ui',
13
- 'openchemlib/full.js': 'OCL',
14
- 'rxjs': 'rxjs',
15
- 'rxjs/operators': 'rxjs.operators',
16
- 'cash-dom': '$',
17
- 'dayjs': 'dayjs',
18
- 'wu': 'wu',
19
- },
20
- output: {
21
- filename: '[name].js',
22
- library: '#{PACKAGE_NAME_LOWERCASE_WORD}',
23
- libraryTarget: 'var',
24
- path: path.resolve(__dirname, 'dist'),
25
- },
26
- };
1
+ const path = require('path');
2
+ const packageName = path.parse(require('./package.json').name).name.toLowerCase().replace(/-/g, '');
3
+
4
+ module.exports = {
5
+ mode: 'development',
6
+ entry: {
7
+ package: './src/package.js'
8
+ },
9
+ devtool: 'inline-source-map',
10
+ externals: {
11
+ 'datagrok-api/dg': 'DG',
12
+ 'datagrok-api/grok': 'grok',
13
+ 'datagrok-api/ui': 'ui',
14
+ 'openchemlib/full.js': 'OCL',
15
+ 'rxjs': 'rxjs',
16
+ 'rxjs/operators': 'rxjs.operators',
17
+ 'cash-dom': '$',
18
+ 'dayjs': 'dayjs',
19
+ 'wu': 'wu',
20
+ },
21
+ output: {
22
+ filename: '[name].js',
23
+ library: packageName,
24
+ libraryTarget: 'var',
25
+ path: path.resolve(__dirname, 'dist'),
26
+ },
27
+ };