datagrok-tools 4.13.26 → 4.13.28
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 +12 -0
- package/bin/commands/check.js +31 -18
- package/bin/commands/help.js +7 -3
- package/bin/commands/publish-all.js +47 -0
- package/bin/grok.js +1 -0
- package/bin/utils/test-utils.js +3 -3
- package/bin/utils/utils.js +15 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# Datagrok-tools changelog
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## 4.13.28 (2024-10-09)
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* Grok Check update(added checks on caching)
|
|
9
|
+
|
|
10
|
+
## 4.13.27 (2024-10-02)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* Publish all added
|
|
15
|
+
|
|
4
16
|
## 4.13.26 (2024-10-02)
|
|
5
17
|
|
|
6
18
|
### Features
|
package/bin/commands/check.js
CHANGED
|
@@ -46,12 +46,10 @@ function runChecks(packagePath) {
|
|
|
46
46
|
ignoreFiles: ['.npmignore', '.gitignore']
|
|
47
47
|
});
|
|
48
48
|
var jsTsFiles = files.filter(function (f) {
|
|
49
|
-
return !f.startsWith('dist/') && (f.endsWith('.js') || f.endsWith('.ts'));
|
|
49
|
+
return !f.startsWith('dist/') && (f.endsWith('.js') || f.endsWith('.ts') || f.endsWith('.sql') || f.endsWith('.py'));
|
|
50
50
|
});
|
|
51
51
|
var 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'];
|
|
52
|
-
|
|
53
|
-
return packageFiles.includes(f);
|
|
54
|
-
});
|
|
52
|
+
// const funcFiles = jsTsFiles.filter((f) => packageFiles.includes(f));
|
|
55
53
|
var errors = [];
|
|
56
54
|
var warnings = [];
|
|
57
55
|
var packageFilePath = _path["default"].join(packagePath, 'package.json');
|
|
@@ -73,7 +71,7 @@ function runChecks(packagePath) {
|
|
|
73
71
|
errors.push.apply(errors, (0, _toConsumableArray2["default"])(checkSourceMap(packagePath)));
|
|
74
72
|
errors.push.apply(errors, (0, _toConsumableArray2["default"])(checkNpmIgnore(packagePath)));
|
|
75
73
|
warnings.push.apply(warnings, (0, _toConsumableArray2["default"])(checkScriptNames(packagePath)));
|
|
76
|
-
errors.push.apply(errors, (0, _toConsumableArray2["default"])(checkFuncSignatures(packagePath,
|
|
74
|
+
errors.push.apply(errors, (0, _toConsumableArray2["default"])(checkFuncSignatures(packagePath, jsTsFiles)));
|
|
77
75
|
errors.push.apply(errors, (0, _toConsumableArray2["default"])(checkPackageFile(packagePath, json, {
|
|
78
76
|
isWebpack: isWebpack,
|
|
79
77
|
externals: externals,
|
|
@@ -266,9 +264,7 @@ function checkFuncSignatures(packagePath, files) {
|
|
|
266
264
|
tags = _ref5.tags;
|
|
267
265
|
var value = true;
|
|
268
266
|
var message = '';
|
|
269
|
-
|
|
270
|
-
// TODO: GROK-15398: Fix file viewer check in grok check
|
|
271
|
-
if (tags == null || tags.length !== 1 || tags[0] !== 'fileViewer') {
|
|
267
|
+
if (tags == null || tags.length !== 1 && tags[0] !== 'fileViewer') {
|
|
272
268
|
value = false;
|
|
273
269
|
message += 'File viewers must have only one tag: "fileViewer"\n';
|
|
274
270
|
}
|
|
@@ -357,11 +353,12 @@ function checkFuncSignatures(packagePath, files) {
|
|
|
357
353
|
_step6;
|
|
358
354
|
try {
|
|
359
355
|
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
356
|
+
var _file$split$pop;
|
|
360
357
|
var file = _step6.value;
|
|
361
358
|
var content = _fs["default"].readFileSync(_path["default"].join(packagePath, file), {
|
|
362
359
|
encoding: 'utf-8'
|
|
363
360
|
});
|
|
364
|
-
var functions = getFuncMetadata(content);
|
|
361
|
+
var functions = getFuncMetadata(content, (_file$split$pop = file.split('.').pop()) !== null && _file$split$pop !== void 0 ? _file$split$pop : 'ts');
|
|
365
362
|
var _loop = function _loop() {
|
|
366
363
|
var f = _functions[_i];
|
|
367
364
|
var paramsCheck = checkFunctions.params(f);
|
|
@@ -374,6 +371,9 @@ function checkFuncSignatures(packagePath, files) {
|
|
|
374
371
|
var vr = checkFunctions[roles[0]](f);
|
|
375
372
|
if (!vr.value) warnings.push("File ".concat(file, ", function ").concat(f.name, ":\n").concat(vr.message));
|
|
376
373
|
}
|
|
374
|
+
if (f.isInvalidateOnWithoutCache) warnings.push("File ".concat(file, ", function ").concat(f.name, ": Cant use invalidateOn without cache, please follow this example: 'meta.cache.invalidateOn'"));
|
|
375
|
+
if (f.cache) if (!utils.cahceValues.includes(f.cache)) warnings.push("File ".concat(file, ", function ").concat(f.name, ": unsupposed variable for cache : ").concat(f.cache));
|
|
376
|
+
if (f.invalidateOn) if (!utils.isValidCron(f.invalidateOn)) warnings.push("File ".concat(file, ", function ").concat(f.name, ": unsupposed variable for invalidateOn : ").concat(f.invalidateOn));
|
|
377
377
|
};
|
|
378
378
|
for (var _i = 0, _functions = functions; _i < _functions.length; _i++) {
|
|
379
379
|
_loop();
|
|
@@ -613,7 +613,7 @@ function warn(warnings) {
|
|
|
613
613
|
return color.warn(w);
|
|
614
614
|
});
|
|
615
615
|
}
|
|
616
|
-
function getFuncMetadata(script) {
|
|
616
|
+
function getFuncMetadata(script, fileExtention) {
|
|
617
617
|
var funcData = [];
|
|
618
618
|
var isHeader = false;
|
|
619
619
|
var data = {
|
|
@@ -627,20 +627,33 @@ function getFuncMetadata(script) {
|
|
|
627
627
|
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
628
628
|
var line = _step11.value;
|
|
629
629
|
if (!line) continue;
|
|
630
|
-
|
|
630
|
+
//@ts-ignore
|
|
631
|
+
var match = line.match(utils.fileParamRegex[fileExtention]);
|
|
631
632
|
if (match) {
|
|
632
633
|
var _line$match;
|
|
633
634
|
if (!isHeader) isHeader = true;
|
|
634
635
|
var param = match[1];
|
|
635
|
-
if (param === 'name') data.name = (_line$match = line.match(utils.nameAnnRegex)) === null || _line$match === void 0 ? void 0 : _line$match[2];else if (param === 'description') data.description = match[2];else if (param === 'input')
|
|
636
|
+
if (param === 'name') data.name = (_line$match = line.match(utils.nameAnnRegex)) === null || _line$match === void 0 ? void 0 : _line$match[2];else if (param === 'description') data.description = match[2];else if (param === 'input') {
|
|
637
|
+
data.inputs.push({
|
|
638
|
+
type: match[2],
|
|
639
|
+
name: match[3]
|
|
640
|
+
});
|
|
641
|
+
} else if (param === 'output') data.outputs.push({
|
|
636
642
|
type: match[2],
|
|
637
643
|
name: match[3]
|
|
638
|
-
});else if (param === '
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
+
});else if (param === 'tags') {
|
|
645
|
+
data.tags = match.input && match[3] ? match.input.split(':')[1].split(',').map(function (t) {
|
|
646
|
+
return t.trim();
|
|
647
|
+
}) : [match[2]];
|
|
648
|
+
} else if (param === 'meta.cache') {
|
|
649
|
+
var _line$split$pop;
|
|
650
|
+
data.cache = (_line$split$pop = line.split(':').pop()) === null || _line$split$pop === void 0 ? void 0 : _line$split$pop.trim();
|
|
651
|
+
} else if (param === 'meta.cache.invalidateOn') {
|
|
652
|
+
var _line$split$pop2;
|
|
653
|
+
data.invalidateOn = (_line$split$pop2 = line.split(':').pop()) === null || _line$split$pop2 === void 0 ? void 0 : _line$split$pop2.trim();
|
|
654
|
+
} else if (param === 'meta.invalidateOn') {
|
|
655
|
+
data.isInvalidateOnWithoutCache = true;
|
|
656
|
+
}
|
|
644
657
|
}
|
|
645
658
|
if (isHeader) {
|
|
646
659
|
var nm = line.match(utils.nameRegex);
|
package/bin/commands/help.js
CHANGED
|
@@ -4,16 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.help = void 0;
|
|
7
|
-
var HELP = "\nUsage: grok <command>\n\nDatagrok's package management tool\n\nCommands:\n add Add an object template\n api Create wrapper functions\n check Check package content (function signatures, etc.)\n config Create and manage config files\n create Create a package\n init Modify a package template\n link Link `datagrok-api` and libraries for local development\n publish Upload a package\n test Run package tests\n\nTo get help on a particular command, use:\n grok <command> --help\n\nRead more about the package development workflow:\nhttps://datagrok.ai/help/develop/develop\n";
|
|
7
|
+
var HELP = "\nUsage: grok <command>\n\nDatagrok's package management tool\n\nCommands:\n add Add an object template\n api Create wrapper functions\n check Check package content (function signatures, etc.)\n config Create and manage config files\n create Create a package\n init Modify a package template\n link Link `datagrok-api` and libraries for local development\n publish Upload a package\n publishAll Upload all packages\n test Run package tests\n testAll Run packages tests\n\nTo get help on a particular command, use:\n grok <command> --help\n\nRead more about the package development workflow:\nhttps://datagrok.ai/help/develop/develop\n";
|
|
8
8
|
var HELP_ADD = "\nUsage: grok add <entity> <name>\n\nAdd an object template to your package:\n\ngrok add app <name>\ngrok add connection <name>\ngrok add detector <semantic-type-name>\ngrok add function [tag] <name>\ngrok add query <name>\ngrok add script [tag] <language> <name>\ngrok add view <name>\ngrok add viewer <name>\ngrok add tests\n\nPlease note that entity names may only include letters and numbers\n\nSupported languages for scripts:\njavascript, julia, node, octave, python, r\n\nAvailable tags:\npanel, init\n";
|
|
9
9
|
var HELP_INIT = "\nUsage: grok init\n\nModify a package template by adding config files for linters, IDE, etc.\n\nOptions:\n[--eslint] [--ide] [--test] [--ts] [--git]\n\n--eslint Add a configuration for eslint\n--ide Add an IDE-specific configuration for debugging (vscode)\n--test Add tests support (TypeScript packages only)\n--ts Convert a JavaScript package to TypeScript\n--git Configure GIT and install commit linting tools.\n Read more: https://datagrok.ai/help/develop/advanced/git-policy\n";
|
|
10
10
|
var HELP_API = "\nUsage: grok api\n\nCreate wrapper functions for package scripts and queries\n";
|
|
11
11
|
var HELP_CONFIG = "\nUsage: grok config\n\nCreate or update a configuration file\n\nOptions:\n[--reset] [--server] [--alias] [-k | --key]\n\n--reset Restore the default config file template\n--server Use to add a server to the config (`grok config add --alias alias --server url --key key`)\n--alias Use in conjunction with the `server` option to set the server name\n--key Use in conjunction with the `server` option to set the developer key\n--default Use in conjunction with the `server` option to set the added server as default\n";
|
|
12
12
|
var HELP_CREATE = "\nUsage: grok create [name]\n\nCreate a package:\n\ngrok create Create a package in the current working directory\ngrok create <name> Create a package in a folder with the specified name\n\nPlease note that the package name may only include letters, numbers, underscores, or hyphens\n\nOptions:\n[--eslint] [--ide] [--js | --ts] [--test]\n\n--eslint Add a configuration for eslint\n--ide Add an IDE-specific configuration for debugging (vscode)\n--js Create a JavaScript package\n--ts Create a TypeScript package (default)\n--test Add tests support (TypeScript packages only)\n";
|
|
13
13
|
var HELP_PUBLISH = "\nUsage: grok publish [host]\n\nUpload a package\n\nOptions:\n[--build|--rebuild] [--debug|--release] [-k | --key] [--suffix]\n\nRunning `grok publish` is the same as running `grok publish defaultHost --build --debug`\n";
|
|
14
|
+
var HELP_PUBLISHALL = "\nUsage: grok publishAll \n\nUpload all packages\n\nOptions:\n [--host] [--release] [--link-package] [--skip-build]\n\n --host Host alias as in the config file\n --release Publish cureent version as release version\n --skip-build Skip the package build step\n --link-package Link local packages\n";
|
|
14
15
|
var HELP_CHECK = "\nUsage: grok check\n\nOptions:\n[-r | --recursive]\n\n--recursive Check all packages in the current directory\n\nCheck package content (function signatures, import statements of external modules, etc.)\n";
|
|
15
|
-
var HELP_TEST = "\nUsage: grok test\n\nOptions:\n[--category] [--host] [--csv] [--gui] [--skip-build] [--skip-publish] [--catchUnhandled] [--report] [--record] [--verbose] [--platform]\n\n--category Specify a category name to run tests for\n--host Host alias as in the config file\n--csv Save the test report in a CSV file\n--gui Launch graphical interface (non-headless mode)\n--catchUnhandled Catch unhandled exceptions during test execution (default=true)\n--report Report failed tests to audit, notifies package author (default=false)\n--skip-build Skip the package build step\n--skip-publish Skip the package publication step\n--record Records the test execution process in mp4 format\n--verbose Prints detailed information about passed and skipped tests in the console\n--platform Runs only platform tests (applicable for ApiTests package only)\n--core Runs package & core tests (applicable for DevTools package only)\n\nRun package tests\n\nSee instructions:\nhttps://datagrok.ai/help/develop/how-to/test-packages#local-testing\n";
|
|
16
|
-
var
|
|
16
|
+
var HELP_TEST = "\nUsage: grok test\n\nOptions:\n[--package] [--category] [--test] [--host] [--csv] [--gui] [--skip-build] [--skip-publish] [--link] [--catchUnhandled] [--report] [--record] [--verbose] [--platform] [--benchmark] [--stress-test]\n\n--package Specify a package name to run tests for\n--category Specify a category name to run tests for\n--test Specify a test name to run \n--host Host alias as in the config file\n--csv Save the test report in a CSV file\n--gui Launch graphical interface (non-headless mode)\n--catchUnhandled Catch unhandled exceptions during test execution (default=true)\n--report Report failed tests to audit, notifies package author (default=false)\n--skip-build Skip the package build step\n--skip-publish Skip the package publication step\n--link \t Link the package to local utils\n--record Records the test execution process in mp4 format\n--verbose Prints detailed information about passed and skipped tests in the console\n--platform Runs only platform tests (applicable for ApiTests package only)\n--core Runs package & core tests (applicable for DevTools package only)\n--benchmark \t Runs tests in benchmark mode\n--stress-test Runs shuffled stress-test only\n \nRun package tests\n\nSee instructions:\nhttps://datagrok.ai/help/develop/how-to/test-packages#local-testing\n";
|
|
17
|
+
var HELP_TESTALL = "\nUsage: grok testAll\n\nOptions:\n[--packages] [--host] [--csv] [--gui] [--skip-build] [--skip-publish] [--link-package] [--catchUnhandled] [--report] [--record] [--verbose] [--benchmark] [--stress-test] [--order] [--tags] [--testRepeat] [--workersCount]\n\n--packages Specify a packages names to run tests for\n--host Host alias as in the config file\n--csv Save the test report in a CSV file\n--gui Launch graphical interface (non-headless mode)\n--catchUnhandled Catch unhandled exceptions during test execution (default=true)\n--report Report failed tests to audit, notifies packages author (default=false)\n--skip-build Skip the packages build step\n--skip-publish Skip the packages publication step\n--link-package \t Link the packages to local utils\n--record Records the test execution process in mp4 format\n--verbose Prints detailed information about passed and skipped tests in the console\n--core Runs packages & core tests (applicable for DevTools packages only)\n--benchmark \t Runs tests in benchmark mode\n--stress-test Runs shuffled stress-test only\n--order Specify order for tests invocation\n--tags Filter tests by tag name for run\n--testRepeat Set amount of tests repeats\n--workersCount Set amount of workers for tests run\n\nRun tests of all or specified packages \n\nSee instructions:\nhttps://datagrok.ai/help/develop/how-to/test-packages#local-testing\n";
|
|
18
|
+
var HELP_LINK = "\nUsage: grok link\n\nLink `datagrok-api` and libraries for local development\n";
|
|
17
19
|
|
|
18
20
|
// const HELP_MIGRATE = `
|
|
19
21
|
// Usage: grok migrate
|
|
@@ -31,6 +33,8 @@ var help = exports.help = {
|
|
|
31
33
|
init: HELP_INIT,
|
|
32
34
|
link: HELP_LINK,
|
|
33
35
|
publish: HELP_PUBLISH,
|
|
36
|
+
publishAll: HELP_PUBLISHALL,
|
|
34
37
|
test: HELP_TEST,
|
|
38
|
+
testAll: HELP_TESTALL,
|
|
35
39
|
help: HELP
|
|
36
40
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.publishAll = publishAll;
|
|
9
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _testUtils = require("../utils/test-utils");
|
|
12
|
+
var utils = _interopRequireWildcard(require("../utils/utils"));
|
|
13
|
+
var _jsYaml = _interopRequireDefault(require("js-yaml"));
|
|
14
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
15
|
+
var _os = _interopRequireDefault(require("os"));
|
|
16
|
+
var _path = _interopRequireDefault(require("path"));
|
|
17
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
18
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
19
|
+
var _require = require('child_process'),
|
|
20
|
+
exec = _require.exec;
|
|
21
|
+
var curDir = process.cwd();
|
|
22
|
+
var grokDir = _path["default"].join(_os["default"].homedir(), '.grok');
|
|
23
|
+
var confPath = _path["default"].join(grokDir, 'config.yaml');
|
|
24
|
+
function publishAll(_x) {
|
|
25
|
+
return _publishAll.apply(this, arguments);
|
|
26
|
+
}
|
|
27
|
+
function _publishAll() {
|
|
28
|
+
_publishAll = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(args) {
|
|
29
|
+
var config;
|
|
30
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
31
|
+
while (1) switch (_context.prev = _context.next) {
|
|
32
|
+
case 0:
|
|
33
|
+
config = _jsYaml["default"].load(_fs["default"].readFileSync(confPath, {
|
|
34
|
+
encoding: 'utf-8'
|
|
35
|
+
}));
|
|
36
|
+
utils.setHost(args.host, config);
|
|
37
|
+
;
|
|
38
|
+
_context.next = 5;
|
|
39
|
+
return (0, _testUtils.loadPackages)(curDir, 'all', args.host, false, args["skip-build"], args["link-package"], args.release);
|
|
40
|
+
case 5:
|
|
41
|
+
case "end":
|
|
42
|
+
return _context.stop();
|
|
43
|
+
}
|
|
44
|
+
}, _callee);
|
|
45
|
+
}));
|
|
46
|
+
return _publishAll.apply(this, arguments);
|
|
47
|
+
}
|
package/bin/grok.js
CHANGED
|
@@ -15,6 +15,7 @@ const commands = {
|
|
|
15
15
|
publish: require('./commands/publish').publish,
|
|
16
16
|
test: require('./commands/test').test,
|
|
17
17
|
testall: require('./commands/test-all').testAll,
|
|
18
|
+
publishall: require('./commands/publish-all').publishAll,
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
const command = argv['_'][0];
|
package/bin/utils/test-utils.js
CHANGED
|
@@ -315,11 +315,11 @@ var recorderConfig = exports.recorderConfig = {
|
|
|
315
315
|
}
|
|
316
316
|
// aspectRatio: '16:9',
|
|
317
317
|
};
|
|
318
|
-
function loadPackages(_x10, _x11, _x12, _x13, _x14, _x15) {
|
|
318
|
+
function loadPackages(_x10, _x11, _x12, _x13, _x14, _x15, _x16) {
|
|
319
319
|
return _loadPackages.apply(this, arguments);
|
|
320
320
|
}
|
|
321
321
|
function _loadPackages() {
|
|
322
|
-
_loadPackages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(packagesDir, packagesToLoad, host, skipPublish, skipBuild, linkPackage) {
|
|
322
|
+
_loadPackages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(packagesDir, packagesToLoad, host, skipPublish, skipBuild, linkPackage, release) {
|
|
323
323
|
var packagesToRun, hostString, _iterator, _step, pacakgeName, _iterator2, _step2, dirName, packageDir, _spaceToCamelCase$toL, _packageJsonData$frie, packageJsonData, packageFriendlyName;
|
|
324
324
|
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
325
325
|
while (1) switch (_context6.prev = _context6.next) {
|
|
@@ -385,7 +385,7 @@ function _loadPackages() {
|
|
|
385
385
|
return utils.runScript("npm run build", packageDir);
|
|
386
386
|
case 24:
|
|
387
387
|
_context6.next = 26;
|
|
388
|
-
return utils.runScript("grok publish ".concat(hostString), packageDir);
|
|
388
|
+
return utils.runScript("grok publish ".concat(hostString).concat(release ? ' --release' : ''), packageDir);
|
|
389
389
|
case 26:
|
|
390
390
|
packagesToRun.set(dirName, true);
|
|
391
391
|
console.log("Package published ".concat(dirName));
|
package/bin/utils/utils.js
CHANGED
|
@@ -4,12 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.absUrlRegex = exports.TemplateBuilder = void 0;
|
|
7
|
+
exports.cahceValues = exports.absUrlRegex = exports.TemplateBuilder = void 0;
|
|
8
8
|
exports.camelCaseToKebab = camelCaseToKebab;
|
|
9
9
|
exports.checkScriptLocation = checkScriptLocation;
|
|
10
10
|
exports.commentMap = void 0;
|
|
11
11
|
exports.delay = delay;
|
|
12
|
-
exports.dgToTsTypeMap = exports.dgImports = void 0;
|
|
12
|
+
exports.fileParamRegex = exports.dgToTsTypeMap = exports.dgImports = void 0;
|
|
13
13
|
exports.friendlyNameToName = friendlyNameToName;
|
|
14
14
|
exports.getParam = getParam;
|
|
15
15
|
exports.getScriptInputs = getScriptInputs;
|
|
@@ -18,9 +18,10 @@ exports.getScriptOutputType = getScriptOutputType;
|
|
|
18
18
|
exports.headerTags = void 0;
|
|
19
19
|
exports.isEmpty = isEmpty;
|
|
20
20
|
exports.isPackageDir = isPackageDir;
|
|
21
|
+
exports.isValidCron = isValidCron;
|
|
21
22
|
exports.kebabToCamelCase = kebabToCamelCase;
|
|
22
23
|
exports.mapURL = mapURL;
|
|
23
|
-
exports.queryWrapperTemplate = exports.queryExtension = exports.propertyTypes = exports.
|
|
24
|
+
exports.queryWrapperTemplate = exports.queryExtension = exports.propertyTypes = exports.namespaceTemplate = exports.nameRegex = exports.nameAnnRegex = void 0;
|
|
24
25
|
exports.removeScope = removeScope;
|
|
25
26
|
exports.replacers = void 0;
|
|
26
27
|
exports.runScript = runScript;
|
|
@@ -235,6 +236,11 @@ function getParam(name, script) {
|
|
|
235
236
|
return match ? (_match$2 = match[1]) === null || _match$2 === void 0 ? void 0 : _match$2.trim() : null;
|
|
236
237
|
}
|
|
237
238
|
;
|
|
239
|
+
var cahceValues = exports.cahceValues = ['all', 'server', 'client', 'true'];
|
|
240
|
+
function isValidCron(cronExpression) {
|
|
241
|
+
var cronRegex = /^(\*|([0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9])|\*\/([0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9])) (\*|([0-9]|1[0-9]|2[0-3])|\*\/([0-9]|1[0-9]|2[0-3])) (\*|([1-9]|1[0-9]|2[0-9]|3[0-1])|\*\/([1-9]|1[0-9]|2[0-9]|3[0-1])) (\*|([1-9]|1[0-2])|\*\/([1-9]|1[0-2])) (\*|([0-6])|\*\/([0-6]))$/;
|
|
242
|
+
return cronRegex.test(cronExpression);
|
|
243
|
+
}
|
|
238
244
|
var dgToTsTypeMap = exports.dgToTsTypeMap = {
|
|
239
245
|
"int": 'number',
|
|
240
246
|
"double": 'number',
|
|
@@ -248,7 +254,12 @@ var dgToTsTypeMap = exports.dgToTsTypeMap = {
|
|
|
248
254
|
};
|
|
249
255
|
var propertyTypes = exports.propertyTypes = ['bool', 'int', 'double', 'string', 'datetime', 'object', 'column', 'dataframe', 'bitset', 'cell', 'string_list', 'map'];
|
|
250
256
|
var 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'];
|
|
251
|
-
var
|
|
257
|
+
var fileParamRegex = exports.fileParamRegex = {
|
|
258
|
+
py: new RegExp("#\\s*((?:".concat(headerTags.join('|'), ")[^:]*): *([^\\s\\[\\{]+) ?([^\\s\\[\\{]+)?[^\\n]*$")),
|
|
259
|
+
ts: new RegExp("//\\s*((?:".concat(headerTags.join('|'), ")[^:]*): *([^\\s\\[\\{]+) ?([^\\s\\[\\{]+)?[^\\n]*$")),
|
|
260
|
+
js: new RegExp("//\\s*((?:".concat(headerTags.join('|'), ")[^:]*): *([^\\s\\[\\{]+) ?([^\\s\\[\\{]+)?[^\\n]*$")),
|
|
261
|
+
sql: new RegExp("--\\s*((?:".concat(headerTags.join('|'), ")[^:]*): *([^\\s\\[\\{]+) ?([^\\s\\[\\{]+)?[^\\n]*$"))
|
|
262
|
+
};
|
|
252
263
|
var nameAnnRegex = exports.nameAnnRegex = /\/\/\s*(name[^:]*): ([^\n\r\[\{]+)/;
|
|
253
264
|
var nameRegex = exports.nameRegex = /(?:|static|export\s+function|export\s+async\s+function)\s+([a-zA-Z_][a-zA-Z0-9_$]*)\s*\((.*?)\).*/;
|
|
254
265
|
var absUrlRegex = exports.absUrlRegex = new RegExp('^(?:[a-z+]+:)?//', 'i');
|
package/package.json
CHANGED