datagrok-tools 4.14.44 → 4.14.46
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/package.json +2 -3
- package/plugins/func-gen-plugin.js +10 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datagrok-tools",
|
|
3
|
-
"version": "4.14.
|
|
3
|
+
"version": "4.14.46",
|
|
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": {
|
|
@@ -31,8 +31,7 @@
|
|
|
31
31
|
"link": "npm link",
|
|
32
32
|
"prepublishOnly": "babel bin --extensions .ts -d bin",
|
|
33
33
|
"babel": "babel bin --extensions .ts -d bin",
|
|
34
|
-
"build": "babel bin --extensions .ts -d bin"
|
|
35
|
-
"debug-source-map": "babel bin --extensions .ts -d bin --source-maps true"
|
|
34
|
+
"build": "babel bin --extensions .ts -d bin"
|
|
36
35
|
},
|
|
37
36
|
"bin": {
|
|
38
37
|
"datagrok-upload": "./bin/_deprecated/upload.js",
|
|
@@ -195,7 +195,13 @@ class FuncGeneratorPlugin {
|
|
|
195
195
|
else if (funcAnnotaionOptions.outputs?.length === 0)
|
|
196
196
|
actualType = 'void';
|
|
197
197
|
|
|
198
|
-
if (!funcAnnotaionOptions.name) funcAnnotaionOptions.name = identifierName;
|
|
198
|
+
// if (!funcAnnotaionOptions.name) funcAnnotaionOptions.name = identifierName;
|
|
199
|
+
|
|
200
|
+
console.log(funcName);
|
|
201
|
+
console.log(funcAnnotaionOptions.name);
|
|
202
|
+
if (funcAnnotaionOptions.name === funcName)
|
|
203
|
+
funcAnnotaionOptions.name = undefined;
|
|
204
|
+
|
|
199
205
|
functions.push(
|
|
200
206
|
reservedDecorators[name]['genFunc'](
|
|
201
207
|
getFuncAnnotation(funcAnnotaionOptions),
|
|
@@ -413,11 +419,13 @@ class FuncGeneratorPlugin {
|
|
|
413
419
|
let resultType = 'void';
|
|
414
420
|
let nodeAnnotation = annotation;
|
|
415
421
|
let isArray = false;
|
|
422
|
+
let isNullable = false;
|
|
416
423
|
if (nodeAnnotation?.type === 'TSUnionType' &&
|
|
417
424
|
nodeAnnotation?.types?.length === 2 &&
|
|
418
425
|
nodeAnnotation?.types?.some((e)=> e?.type === 'TSNullKeyword' || e?.type === 'TSVoidKeyword'|| e?.type === 'TSUndefinedKeyword')) {
|
|
419
426
|
nodeAnnotation =
|
|
420
427
|
nodeAnnotation.types.filter((e)=> e.type !== 'TSNullKeyword' || e?.type === 'TSVoidKeyword' || e?.type === 'TSUndefinedKeyword')[0];
|
|
428
|
+
isNullable = true;
|
|
421
429
|
}
|
|
422
430
|
|
|
423
431
|
|
|
@@ -442,6 +450,7 @@ class FuncGeneratorPlugin {
|
|
|
442
450
|
}
|
|
443
451
|
}
|
|
444
452
|
let anotationType = typesToAnnotation[resultType];
|
|
453
|
+
resultType = isNullable? 'any' : resultType;
|
|
445
454
|
if (isArray && anotationType) anotationType = `list<${anotationType}>`;
|
|
446
455
|
return [anotationType ?? 'dynamic', `${resultType}${isArray? '[]': ''}` ?? 'any'];
|
|
447
456
|
}
|