datagrok-tools 4.14.47 → 4.14.49

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.
@@ -21,7 +21,7 @@ let pseudoParams = exports.pseudoParams = /*#__PURE__*/function (pseudoParams) {
21
21
  return pseudoParams;
22
22
  }({});
23
23
  const nonMetaData = ['sidebar', 'editor', 'friendlyName', 'helpUrl', 'help-url', 'condition', 'connection', 'top-menu', 'cache', 'cache.invalidateOn', 'test'];
24
- const decoratorOptionToAnnotation = exports.decoratorOptionToAnnotation = new Map([['initialValue', 'default'], ['helpUrl', 'help-url'], ['topMenu', 'top-menu'], ['metaUrl', 'meta.url'], ['optionsType', 'type'], ['cacheInvalidateOn', 'cache.invalidateOn'], ['scriptHandlerLanguage', 'scriptHandler.language'], ['scriptHandlerExtensions', 'scriptHandler.extensions'], ['scriptHandlerCommentStart', 'scriptHandler.commentStart'], ['scriptHandlerTemplateScript', 'scriptHandler.templateScript'], ['scriptHandlerCodeEditorMode', 'scriptHandler.codeEditorMode'], ['scriptHandlerVectorizationFunction', 'scriptHandler.vectorizationFunction']]);
24
+ const decoratorOptionToAnnotation = exports.decoratorOptionToAnnotation = new Map([['helpUrl', 'help-url'], ['topMenu', 'top-menu'], ['metaUrl', 'meta.url'], ['optionsType', 'type'], ['cacheInvalidateOn', 'cache.invalidateOn'], ['scriptHandlerLanguage', 'scriptHandler.language'], ['scriptHandlerExtensions', 'scriptHandler.extensions'], ['scriptHandlerCommentStart', 'scriptHandler.commentStart'], ['scriptHandlerTemplateScript', 'scriptHandler.templateScript'], ['scriptHandlerCodeEditorMode', 'scriptHandler.codeEditorMode'], ['scriptHandlerVectorizationFunction', 'scriptHandler.vectorizationFunction']]);
25
25
  const dgAnnotationTypes = exports.dgAnnotationTypes = {
26
26
  INT: 'int',
27
27
  BIG_INT: 'bigint',
@@ -156,7 +156,7 @@ function getFuncAnnotation(data, comment = '//', sep = '\n') {
156
156
  for (const output of data.outputs) {
157
157
  if (output.type !== 'void') {
158
158
  // eslint-disable-next-line max-len
159
- s += comment + 'output: ' + output.type + (output.name ? ` ${output.name}${output.options ? ` ${buildStringOfOptions(output.options)}` : ''}` : '') + sep;
159
+ s += comment + 'output: ' + output.type + (output.name ? ` ${output.name}${output.options ? ` ${buildStringOfOptions(output)}` : ''}` : '') + sep;
160
160
  }
161
161
  }
162
162
  }
@@ -186,14 +186,19 @@ function getFuncAnnotation(data, comment = '//', sep = '\n') {
186
186
  const inputOptionsNames = exports.inputOptionsNames = ['semType', 'category', 'optional', 'editor', 'nullable', 'separators', 'choices', 'format', 'min', 'max', 'caption', 'description', 'initialValue', 'viewer', 'units', 'type', 'optionsType', 'step', 'meta.url', 'metaUrl'];
187
187
  function buildStringOfOptions(input) {
188
188
  const optionsInString = [];
189
- for (const [key, value] of Object.entries(input.options ?? {})) {
189
+ const opt = input.options ?? {};
190
+ let defaultValue = '';
191
+ if (opt['initialValue']) defaultValue = ` = ${opt['initialValue']}`;
192
+ for (const [key, value] of Object.entries(opt)) {
193
+ if (key === 'initialValue') continue;
190
194
  let val = value;
191
195
  let option = key;
192
196
  option = decoratorOptionToAnnotation.get(option) ?? option;
193
197
  if (Array.isArray(value)) val = JSON.stringify(value);
194
198
  optionsInString.push(`${option}: ${val}`);
195
199
  }
196
- return `{ ${optionsInString.join('; ')} }`;
200
+ const optString = optionsInString.length > 0 ? `{ ${optionsInString.join('; ')} }` : '';
201
+ return `${defaultValue} ${optString}`;
197
202
  }
198
203
  const reservedDecorators = exports.reservedDecorators = {
199
204
  viewer: {
@@ -10,7 +10,7 @@
10
10
  "@datagrok-libraries/utils": "^4.6.0"
11
11
  },
12
12
  "devDependencies": {
13
- "datagrok-tools": "^4.14.38",
13
+ "datagrok-tools": "^4.14.48",
14
14
  "webpack": "^5.95.0",
15
15
  "webpack-cli": "^5.1.4"
16
16
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datagrok-tools",
3
- "version": "4.14.47",
3
+ "version": "4.14.49",
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": {
@@ -197,8 +197,6 @@ class FuncGeneratorPlugin {
197
197
 
198
198
  // if (!funcAnnotaionOptions.name) funcAnnotaionOptions.name = identifierName;
199
199
 
200
- console.log(funcName);
201
- console.log(funcAnnotaionOptions.name);
202
200
  if (funcAnnotaionOptions.name === funcName)
203
201
  funcAnnotaionOptions.name = undefined;
204
202
 
@@ -253,7 +251,6 @@ class FuncGeneratorPlugin {
253
251
  optionsToAdd.set(key, this._evalLiteral(prop.value));
254
252
  else
255
253
  resultMap.set(key, this._evalLiteral(prop.value));
256
-
257
254
  }
258
255
 
259
256
  if (optionsToAdd.size > 0)