datagrok-tools 4.14.0 → 4.14.1

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.
@@ -375,10 +375,11 @@ const reservedDecorators = exports.reservedDecorators = {
375
375
  function generateClassFunc(annotation, className, sep = '\n') {
376
376
  return annotation + `export function _${className}() {${sep} return new ${className}();${sep}}${sep.repeat(2)}`;
377
377
  }
378
+ const primitives = new Set(['string', 'string[]', 'number', 'number[]', 'boolean', 'boolean[]']);
378
379
 
379
380
  /** Generates a DG function. */
380
381
  function generateFunc(annotation, funcName, sep = '\n', className = '', inputs = [], isAsync = false) {
381
- let funcSigNature = inputs.map(e => `${e.name}: ${e.type}`).join(', ');
382
+ let funcSigNature = inputs.map(e => `${e.name}: ${primitives.has(e.type ?? '') ? e.type : 'any'}`).join(', ');
382
383
  let funcArguments = inputs.map(e => e.name).join(', ');
383
384
  return annotation + `export ${isAsync ? 'async ' : ''}function ${funcName}(${funcSigNature}) {${sep} return ${className.length > 0 ? `${className}.` : ''}${funcName}(${funcArguments});${sep}}${sep.repeat(2)}`;
384
385
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datagrok-tools",
3
- "version": "4.14.0",
3
+ "version": "4.14.1",
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": {
@@ -179,10 +179,11 @@ class FuncGeneratorPlugin {
179
179
  name += ': ' + generate(baseParam.argument.typeAnnotation.typeAnnotation).code;
180
180
 
181
181
  let type = '';
182
- if (baseParam?.typeAnnotation?.typeAnnotation?.typeName || baseParam?.typeAnnotation?.typeAnnotation?.elementType?.typeName)
183
- type = 'any';
184
- else if (baseParam?.typeAnnotation?.typeAnnotation)
182
+ if (baseParam?.typeAnnotation?.typeAnnotation)
185
183
  type = generate(baseParam.typeAnnotation.typeAnnotation).code;
184
+ else
185
+ type = 'any';
186
+
186
187
  let params = baseParam.typeAnnotation.typeAnnotation.typeArguments?.params;
187
188
  if(type !== 'any' && params && params.length > 0)
188
189
  type += `<${params.map((e)=>e.typeName.name).join(',')}>`;