datagrok-tools 4.13.16 → 4.13.17

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/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Datagrok-tools changelog
2
2
 
3
3
 
4
+ ## 4.13.17 (2024-08-27)
5
+
6
+ ### Features
7
+
8
+ * Added decorators for viewer functions
9
+
4
10
  ## 4.13.16 (2024-08-23)
5
11
 
6
12
  ### Features
@@ -56,6 +56,7 @@ function createDirectoryContents(name, config, templateDir, packageDir) {
56
56
  if (file === 'package.json') {
57
57
  // Generate scripts for non-default servers from `config.yaml`
58
58
  var _package = JSON.parse(contents);
59
+ _package['scripts'] = {};
59
60
  for (var server in config.servers) {
60
61
  if (server === config["default"]) continue;
61
62
  _package['scripts']["debug-".concat(name.toLowerCase(), "-").concat(server)] = "webpack && grok publish ".concat(server);
@@ -1,8 +1,34 @@
1
1
 
2
- //name: #{NAME}
3
- //description: Creates #{NAME} viewer
4
- //tags: viewer
5
- //output: viewer result
6
- export function _#{NAME}() {
7
- return new #{NAME}();
2
+
3
+ @grok.decorators.viewer({
4
+ name: '#{NAME}',
5
+ description: 'Creates #{NAME} viewer'
6
+ })
7
+ export class #{NAME}Viewer extends DG.JsViewer {
8
+ constructor() {
9
+ super();
10
+ }
11
+
12
+ // Additional chart settings
13
+ init() {
14
+ }
15
+
16
+ // Stream subscriptions
17
+ onTableAttached() {
18
+ this.init();
19
+ this.render();
20
+ }
21
+
22
+ // Cancel subscriptions when the viewer is detached
23
+ detach() {
24
+ }
25
+
26
+ // Override to handle property changes
27
+ onPropertyChanged(property : DG.Property | null) {
28
+ super.onPropertyChanged(property);
29
+ this.render();
30
+ }
31
+
32
+ render(computeData = true) {
33
+ }
8
34
  }
@@ -1,8 +1,9 @@
1
1
  import * as DG from "datagrok-api/dg";
2
- import {runTests, tests, TestContext} from '@datagrok-libraries/utils/src/test';
2
+ import * as grok from 'datagrok-api/grok';
3
+ import { runTests, tests, TestContext } from '@datagrok-libraries/utils/src/test';
3
4
 
4
5
  export let _package = new DG.Package();
5
- export {tests};
6
+ export { tests };
6
7
 
7
8
  //name: test
8
9
  //input: string category {optional: true}
@@ -10,6 +11,6 @@ export {tests};
10
11
  //input: object testContext {optional: true}
11
12
  //output: dataframe result
12
13
  export async function test(category: string, test: string, testContext: TestContext): Promise<DG.DataFrame> {
13
- const data = await runTests({category, test, testContext});
14
+ const data = await runTests({ category, test, testContext });
14
15
  return DG.DataFrame.fromObjects(data)!;
15
- }
16
+ }
@@ -1,6 +1,6 @@
1
1
  const path = require('path');
2
2
  const packageName = path.parse(require('./package.json').name).name.toLowerCase().replace(/-/g, '');
3
-
3
+ const FuncGeneratorPlugin = require('datagrok-tools/plugins/func-gen-plugin');
4
4
  module.exports = {
5
5
  cache: {
6
6
  type: 'filesystem',
@@ -29,4 +29,7 @@ module.exports = {
29
29
  libraryTarget: 'var',
30
30
  path: path.resolve(__dirname, 'dist'),
31
31
  },
32
+ plugins: [
33
+ new FuncGeneratorPlugin({outputPath: './src/package.g.ts'}),
34
+ ],
32
35
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datagrok-tools",
3
- "version": "4.13.16",
3
+ "version": "4.13.17",
4
4
  "description": "Utility to upload and publish packages to Datagrok",
5
5
  "homepage": "https://github.com/datagrok-ai/public/tree/master/tools#readme",
6
6
  "dependencies": {