datagrok-tools 4.14.23 → 4.14.25
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/bin/commands/api.js +1 -7
- package/bin/commands/check.js +11 -1
- package/bin/utils/utils.js +4 -3
- package/package.json +1 -1
package/bin/commands/api.js
CHANGED
|
@@ -103,13 +103,7 @@ function generateFunctionWrappers() {
|
|
|
103
103
|
const annotationInputs = utils.getScriptInputs(annotation[0], utils.commentMap[utils.jsExtention]);
|
|
104
104
|
const annotationOutputDir = utils.getScriptOutputType(annotation[0], utils.commentMap[utils.jsExtention]);
|
|
105
105
|
let outputType = '';
|
|
106
|
-
|
|
107
|
-
if (outputType != '') {
|
|
108
|
-
outputType = 'any';
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
outputType = utils.dgToTsTypeMap[outputAnnotation[1]] ?? 'any';
|
|
112
|
-
}
|
|
106
|
+
outputType = annotationOutputDir ?? 'any';
|
|
113
107
|
checkNameColision(name);
|
|
114
108
|
const tb = new utils.TemplateBuilder(utils.scriptWrapperTemplate).replace('FUNC_NAME', name).replace('FUNC_NAME_LOWERCASE', name).replace('PACKAGE_NAMESPACE', _package?.friendlyName ?? '').replace('PARAMS_OBJECT', annotationInputs).replace('FUNC_DESCRIPTION', description).replace('TYPED_PARAMS', annotationInputs).replace('OUTPUT_TYPE', outputType);
|
|
115
109
|
wrappers.push(tb.build(1));
|
package/bin/commands/check.js
CHANGED
|
@@ -40,7 +40,7 @@ function runChecks(packagePath, soft = false) {
|
|
|
40
40
|
path: packagePath,
|
|
41
41
|
ignoreFiles: ['.npmignore', '.gitignore']
|
|
42
42
|
}).filter(e => !e.includes('node_modules'));
|
|
43
|
-
const jsTsFiles = files.filter(f =>
|
|
43
|
+
const jsTsFiles = files.filter(f => (f.startsWith('src' + _path.default.sep) || f.startsWith('queries' + _path.default.sep) || f.startsWith('scripts' + _path.default.sep)) && (f.endsWith('.js') || f.endsWith('.ts') || f.endsWith('.sql') || f.endsWith('.py')));
|
|
44
44
|
const packageFiles = ['src/package.ts', 'src/detectors.ts', 'src/package.js', 'src/detectors.js', 'src/package-test.ts', 'src/package-test.js', 'package.js', 'detectors.js'];
|
|
45
45
|
// const funcFiles = jsTsFiles.filter((f) => packageFiles.includes(f));
|
|
46
46
|
const errors = [];
|
|
@@ -305,6 +305,7 @@ function checkFuncSignatures(packagePath, files) {
|
|
|
305
305
|
};
|
|
306
306
|
const functionRoles = Object.keys(checkFunctions);
|
|
307
307
|
for (const file of files) {
|
|
308
|
+
if (file.includes('.min.')) continue;
|
|
308
309
|
const content = _fs.default.readFileSync(_path.default.join(packagePath, file), {
|
|
309
310
|
encoding: 'utf-8'
|
|
310
311
|
});
|
|
@@ -557,6 +558,15 @@ function getFuncMetadata(script, fileExtention) {
|
|
|
557
558
|
}
|
|
558
559
|
if (isHeader) {
|
|
559
560
|
const nm = line.match(utils.nameRegex);
|
|
561
|
+
if (data.name === '') {
|
|
562
|
+
data = {
|
|
563
|
+
name: '',
|
|
564
|
+
inputs: [],
|
|
565
|
+
outputs: []
|
|
566
|
+
};
|
|
567
|
+
isHeader = false;
|
|
568
|
+
continue;
|
|
569
|
+
}
|
|
560
570
|
if (nm) data.name = nm[1]?.toLocaleLowerCase();
|
|
561
571
|
if (data.name && !match) {
|
|
562
572
|
funcData.push(data);
|
package/bin/utils/utils.js
CHANGED
|
@@ -180,7 +180,8 @@ const dgToTsTypeMap = exports.dgToTsTypeMap = {
|
|
|
180
180
|
column: 'DG.Column',
|
|
181
181
|
column_list: 'string[]',
|
|
182
182
|
file: 'DG.FileInfo',
|
|
183
|
-
view: 'DG.View'
|
|
183
|
+
view: 'DG.View',
|
|
184
|
+
void: 'void'
|
|
184
185
|
};
|
|
185
186
|
const propertyTypes = exports.propertyTypes = ['bool', 'int', 'double', 'string', 'datetime', 'object', 'column', 'dataframe', 'bitset', 'cell', 'string_list', 'map'];
|
|
186
187
|
const headerTags = exports.headerTags = ['name', 'description', 'help-url', 'input', 'output', 'tags', 'sample', 'language', 'returns', 'test', 'sidebar', 'condition', 'top-menu', 'environment', 'require', 'editor-for', 'schedule', 'reference', 'editor', 'meta', 'connection', 'friendlyName'];
|
|
@@ -202,14 +203,14 @@ function getScriptOutputType(script, comment = '#') {
|
|
|
202
203
|
let wasSecond = false;
|
|
203
204
|
for (let match of matches) {
|
|
204
205
|
if (resType === 'void') {
|
|
205
|
-
resType = dgToTsTypeMap[match[1]];
|
|
206
|
+
resType = dgToTsTypeMap[match[1]] ?? 'any';
|
|
206
207
|
firstItemName = match[2];
|
|
207
208
|
} else {
|
|
208
209
|
if (!wasSecond) {
|
|
209
210
|
resType = `${firstItemName}: ${resType}`;
|
|
210
211
|
wasSecond = true;
|
|
211
212
|
}
|
|
212
|
-
resType = [resType, `${match[2]}: ${dgToTsTypeMap[match[1]]}`].join(', ');
|
|
213
|
+
resType = [resType, `${match[2]}: ${dgToTsTypeMap[match[1]] ?? 'any'}`].join(', ');
|
|
213
214
|
}
|
|
214
215
|
}
|
|
215
216
|
return wasSecond ? `{${resType}}` : resType;
|
package/package.json
CHANGED