profoundjs 6.1.0 → 6.3.0
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/htdocs/profoundui/proddata/css/logic.css +21 -2
- package/htdocs/profoundui/proddata/css/profoundui.css +16 -0
- package/htdocs/profoundui/proddata/js/designer.js +3893 -3813
- package/htdocs/profoundui/proddata/js/key_management.js +15 -21
- package/htdocs/profoundui/proddata/js/rich-display-react-component.js +42 -42
- package/htdocs/profoundui/proddata/js/rich-display-vue-component.js +27 -27
- package/htdocs/profoundui/proddata/js/runtime.js +1493 -1489
- package/htdocs/profoundui/proddata/js/soapclient.js +388 -395
- package/index.js +4 -4
- package/package.json +9 -1
- package/profound.jse +1 -1
- package/setup/call.js +1 -1
- package/setup/completeInstall.js +26 -56
- package/setup/convertStartJS.js +40 -30
- package/setup/encrypt_client_file.js +4 -0
- package/setup/install.js +1 -1
- package/setup/install_utils.js +15 -30
- package/setup/lic_client.js +9 -0
- package/setup/modules/papisamples/.noderun/settings.json +5 -0
- package/setup/modules/papisamples/APISample.api.json +313 -0
- package/setup/modules/papisamples/APISample.js +55 -0
- package/setup/modules/papisamples/APISample.json +751 -0
- package/setup/modules/papisamples/README.md +17 -0
- package/setup/modules/papisamples/hobbyshop.csv +6 -0
- package/setup/modules/papisamples/readCSVFile.js +136 -0
- package/setup/modules/puiscreens.json +6 -5
- package/setup/pjsdist.savf +0 -0
- package/setup/removeExtraComponents.js +4 -6
- package/setup/setup.js +87 -59
- package/views/cloud.css +19 -6
- package/views/key.ejs +32 -2
package/setup/call.js
CHANGED
package/setup/completeInstall.js
CHANGED
|
@@ -22,7 +22,7 @@ const readline = require("readline");
|
|
|
22
22
|
const iutils = require("./install_utils.js");
|
|
23
23
|
/*
|
|
24
24
|
NOTE: install_info.json
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
This file contains instructions for completing the installation.
|
|
27
27
|
It tells the process what questions to ask and what commands to run.
|
|
28
28
|
This file is shared with the GUI installer.
|
|
@@ -34,9 +34,8 @@ const semver = require("semver");
|
|
|
34
34
|
|
|
35
35
|
const IBMi = iutils.isIBMi();
|
|
36
36
|
|
|
37
|
-
(async
|
|
37
|
+
(async() => {
|
|
38
38
|
try {
|
|
39
|
-
|
|
40
39
|
const argDefs = {
|
|
41
40
|
alias: {
|
|
42
41
|
"h": "help",
|
|
@@ -58,7 +57,7 @@ const IBMi = iutils.isIBMi();
|
|
|
58
57
|
|
|
59
58
|
// Show help and quit, if requested.
|
|
60
59
|
if (args["help"]) {
|
|
61
|
-
const HELP = `Usage: node complete_install.js [OPTION]
|
|
60
|
+
const HELP = `Usage: node complete_install.js [OPTION]
|
|
62
61
|
-h, --help Print this help and exit.
|
|
63
62
|
-c, --configure Update config.js, if present.
|
|
64
63
|
-s, --silent No interactive prompts.
|
|
@@ -94,7 +93,7 @@ Valid arguments for --silent mode:
|
|
|
94
93
|
argDefs.unknown = function(arg) {
|
|
95
94
|
console.error("complete_install.js: Unknown argument:", arg);
|
|
96
95
|
process.exit(1);
|
|
97
|
-
}
|
|
96
|
+
};
|
|
98
97
|
args = minimist(process.argv.slice(2), argDefs);
|
|
99
98
|
|
|
100
99
|
// Validate arguments.
|
|
@@ -113,7 +112,7 @@ Valid arguments for --silent mode:
|
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
114
|
|
|
116
|
-
const RED
|
|
115
|
+
const RED = args.silent === true ? "" : "\x1b[31m";
|
|
117
116
|
const RESET = args.silent === true ? "" : "\x1b[0m";
|
|
118
117
|
|
|
119
118
|
// Silent/validation mode.
|
|
@@ -154,7 +153,6 @@ Valid arguments for --silent mode:
|
|
|
154
153
|
|
|
155
154
|
// If config.js doesn't exist, or if --configure is passed, prompt and create/update config.js.
|
|
156
155
|
if (!fileExists(configPath) || args["configure"] === true) {
|
|
157
|
-
|
|
158
156
|
const warnings = getWarnings();
|
|
159
157
|
for (const warning of warnings) {
|
|
160
158
|
console.log("");
|
|
@@ -217,15 +215,14 @@ Valid arguments for --silent mode:
|
|
|
217
215
|
return args.silent === true ? true : answer;
|
|
218
216
|
});
|
|
219
217
|
if (IBMi) {
|
|
220
|
-
svrname
|
|
218
|
+
svrname = answers.strtcpsvr_svrname;
|
|
221
219
|
autostart = answers.strtcpsvr_autostart;
|
|
222
|
-
ccsid
|
|
223
|
-
nodePath
|
|
220
|
+
ccsid = answers.strtcpsvr_ccsid;
|
|
221
|
+
nodePath = answers.strtcpsvr_nodePath;
|
|
224
222
|
}
|
|
225
|
-
|
|
223
|
+
|
|
226
224
|
// Create/update configuration file.
|
|
227
225
|
if (fileExists(configPath)) {
|
|
228
|
-
|
|
229
226
|
config.port = answers.port;
|
|
230
227
|
if (answers.gitSupport === false) {
|
|
231
228
|
config.gitSupport = false;
|
|
@@ -263,10 +260,8 @@ Valid arguments for --silent mode:
|
|
|
263
260
|
console.log("");
|
|
264
261
|
console.log("config.js updated.");
|
|
265
262
|
console.log("");
|
|
266
|
-
|
|
267
263
|
}
|
|
268
264
|
else {
|
|
269
|
-
|
|
270
265
|
let content = fs.readFileSync(path.join(iutils.getSetupDir(), "config.js"), "utf8");
|
|
271
266
|
eval("config = " + content.substr(content.indexOf("{")));
|
|
272
267
|
config.port = answers.port;
|
|
@@ -288,7 +283,7 @@ Valid arguments for --silent mode:
|
|
|
288
283
|
}
|
|
289
284
|
// Check if this is a workspace (if so, default to mysql)
|
|
290
285
|
if (!IBMi && fileExists(path.join(deployDir, "modules", "app", ".noderun", "settings.json"))) {
|
|
291
|
-
if (config.databaseConnections) delete config.databaseConnections;
|
|
286
|
+
if (config.databaseConnections) delete config.databaseConnections; // remove property so that it's appended at the end when we set it
|
|
292
287
|
config.databaseConnections = [{
|
|
293
288
|
name: "default",
|
|
294
289
|
default: true,
|
|
@@ -308,9 +303,7 @@ Valid arguments for --silent mode:
|
|
|
308
303
|
console.log("");
|
|
309
304
|
console.log("config.js created.");
|
|
310
305
|
console.log("");
|
|
311
|
-
|
|
312
306
|
}
|
|
313
|
-
|
|
314
307
|
}
|
|
315
308
|
|
|
316
309
|
// Complete installation.
|
|
@@ -360,7 +353,6 @@ Valid arguments for --silent mode:
|
|
|
360
353
|
catch {
|
|
361
354
|
process.exit(1);
|
|
362
355
|
}
|
|
363
|
-
|
|
364
356
|
}
|
|
365
357
|
catch (error) {
|
|
366
358
|
process.stdin.destroy();
|
|
@@ -370,7 +362,6 @@ Valid arguments for --silent mode:
|
|
|
370
362
|
})();
|
|
371
363
|
|
|
372
364
|
async function ask(questionParm, configs, recursive) {
|
|
373
|
-
|
|
374
365
|
let question = questionParm.prompt;
|
|
375
366
|
let defaultAnswer = getDefault(questionParm, configs);
|
|
376
367
|
if (questionParm.type === "boolean") {
|
|
@@ -379,10 +370,10 @@ async function ask(questionParm, configs, recursive) {
|
|
|
379
370
|
|
|
380
371
|
if (defaultAnswer == null) defaultAnswer = "";
|
|
381
372
|
if (typeof defaultAnswer !== "string") defaultAnswer = String(defaultAnswer);
|
|
382
|
-
|
|
373
|
+
|
|
383
374
|
if (defaultAnswer !== "") {
|
|
384
375
|
let lastChar = question.substr(question.length - 1, 1);
|
|
385
|
-
if (lastChar === ":" || lastChar === "?") {
|
|
376
|
+
if (lastChar === ":" || lastChar === "?") {
|
|
386
377
|
question = question.substr(0, question.length - 1) + " (" + defaultAnswer + ")" + lastChar;
|
|
387
378
|
}
|
|
388
379
|
else {
|
|
@@ -414,7 +405,6 @@ async function ask(questionParm, configs, recursive) {
|
|
|
414
405
|
answer = formatAnswer(questionParm, answer);
|
|
415
406
|
}
|
|
416
407
|
return answer;
|
|
417
|
-
|
|
418
408
|
}
|
|
419
409
|
|
|
420
410
|
function fileExists(file) {
|
|
@@ -430,23 +420,19 @@ function fileExists(file) {
|
|
|
430
420
|
}
|
|
431
421
|
|
|
432
422
|
function validateName(name) {
|
|
433
|
-
|
|
434
423
|
const error = iutils.validateIBMiName(name);
|
|
435
424
|
if (error) {
|
|
436
425
|
return error;
|
|
437
426
|
}
|
|
438
427
|
return true;
|
|
439
|
-
|
|
440
428
|
}
|
|
441
429
|
|
|
442
430
|
function validateIASP(name) {
|
|
443
|
-
|
|
444
431
|
const error = iutils.validateIBMiIASP(name);
|
|
445
432
|
if (error) {
|
|
446
433
|
return error;
|
|
447
434
|
}
|
|
448
435
|
return true;
|
|
449
|
-
|
|
450
436
|
}
|
|
451
437
|
|
|
452
438
|
function validatePort(port) {
|
|
@@ -457,22 +443,18 @@ function validatePort(port) {
|
|
|
457
443
|
}
|
|
458
444
|
|
|
459
445
|
function isValidNodePath(nodePath) {
|
|
460
|
-
|
|
461
446
|
if (!fileExists(nodePath)) {
|
|
462
447
|
return "Path " + nodePath + " does not exist. A valid path name must be entered.";
|
|
463
448
|
}
|
|
464
449
|
return true;
|
|
465
|
-
|
|
466
450
|
}
|
|
467
451
|
|
|
468
452
|
function isValidCcsid(ccsid) {
|
|
469
|
-
|
|
470
453
|
const error = iutils.validateIBMiCCSID(parseInt(ccsid, 10));
|
|
471
454
|
if (error) {
|
|
472
455
|
return error;
|
|
473
456
|
}
|
|
474
457
|
return true;
|
|
475
|
-
|
|
476
458
|
}
|
|
477
459
|
|
|
478
460
|
function validateYesNo(answer) {
|
|
@@ -483,34 +465,31 @@ function validateYesNo(answer) {
|
|
|
483
465
|
}
|
|
484
466
|
|
|
485
467
|
function stringifyConfig(config) {
|
|
486
|
-
|
|
487
468
|
// JavaScript functions (like connectorIPFilter) will be lost when doing JSON.stringify,
|
|
488
469
|
// so we need to do some magic to preserve them.
|
|
489
|
-
|
|
470
|
+
|
|
490
471
|
let funkz = [];
|
|
491
472
|
let configString = "\nmodule.exports = ";
|
|
492
473
|
|
|
493
474
|
configString += JSON.stringify(config, (key, val) => {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
475
|
+
if (typeof val === "function") {
|
|
476
|
+
let n = funkz.length;
|
|
477
|
+
funkz.push(val.toString());
|
|
478
|
+
return `___function${n}___`;
|
|
479
|
+
}
|
|
480
|
+
return val;
|
|
500
481
|
}, " ");
|
|
501
|
-
|
|
482
|
+
|
|
502
483
|
configString += "\n";
|
|
503
484
|
|
|
504
|
-
for (var i=0; i<funkz.length; i++) {
|
|
485
|
+
for (var i = 0; i < funkz.length; i++) {
|
|
505
486
|
configString = configString.replace(`"___function${i}___"`, funkz[i]);
|
|
506
487
|
}
|
|
507
488
|
|
|
508
489
|
return configString;
|
|
509
|
-
|
|
510
490
|
}
|
|
511
491
|
|
|
512
492
|
function validatePUIInstance(name) {
|
|
513
|
-
|
|
514
493
|
name = name.toUpperCase();
|
|
515
494
|
const result = validateName(name);
|
|
516
495
|
if (result !== true) {
|
|
@@ -522,12 +501,10 @@ function validatePUIInstance(name) {
|
|
|
522
501
|
return data.error;
|
|
523
502
|
}
|
|
524
503
|
return true;
|
|
525
|
-
|
|
526
504
|
}
|
|
527
505
|
|
|
528
506
|
function getPUIInstanceData(name) {
|
|
529
|
-
|
|
530
|
-
// Read the instance DB record to determine the server root and config file paths.
|
|
507
|
+
// Read the instance DB record to determine the server root and config file paths.
|
|
531
508
|
const instanceMember = `/QSYS.LIB/QUSRSYS.LIB/QATMHINSTC.FILE/${name}.MBR`;
|
|
532
509
|
try {
|
|
533
510
|
fs.accessSync(instanceMember, fs.constants.R_OK);
|
|
@@ -565,8 +542,8 @@ function getPUIInstanceData(name) {
|
|
|
565
542
|
}
|
|
566
543
|
).toString();
|
|
567
544
|
const lines = conf.split("\n")
|
|
568
|
-
|
|
569
|
-
|
|
545
|
+
.map(line => line.replace(/\r$/, ""))
|
|
546
|
+
.filter(line => !line.includes("#"));
|
|
570
547
|
|
|
571
548
|
// Determine PUI library.
|
|
572
549
|
// First check for: Define PUI_LIBRARY
|
|
@@ -618,7 +595,6 @@ function getPUIInstanceData(name) {
|
|
|
618
595
|
|
|
619
596
|
// Gets a PUI variable define
|
|
620
597
|
function getPUIDefine(name) {
|
|
621
|
-
|
|
622
598
|
const re = new RegExp(`${name}\\s+(.+)`);
|
|
623
599
|
for (const line of lines) {
|
|
624
600
|
let match = line.match(/^\s*Define\s+(.+)/i);
|
|
@@ -631,7 +607,6 @@ function getPUIInstanceData(name) {
|
|
|
631
607
|
}
|
|
632
608
|
}
|
|
633
609
|
}
|
|
634
|
-
|
|
635
610
|
}
|
|
636
611
|
|
|
637
612
|
// Gets library name from ScriptAlias directive matching alias path name.
|
|
@@ -663,7 +638,6 @@ function getPUIInstanceData(name) {
|
|
|
663
638
|
}
|
|
664
639
|
}
|
|
665
640
|
}
|
|
666
|
-
|
|
667
641
|
}
|
|
668
642
|
|
|
669
643
|
function argDefined(argDefs, args, name) {
|
|
@@ -680,7 +654,6 @@ function argDefined(argDefs, args, name) {
|
|
|
680
654
|
}
|
|
681
655
|
|
|
682
656
|
async function buildArgHelp() {
|
|
683
|
-
|
|
684
657
|
const nameHeading = "Argument";
|
|
685
658
|
const labelHeading = "Description";
|
|
686
659
|
const dftHeading = "Default Value";
|
|
@@ -690,10 +663,10 @@ async function buildArgHelp() {
|
|
|
690
663
|
const pad = 3;
|
|
691
664
|
await forEachQuestion(question => {
|
|
692
665
|
if (question.id) {
|
|
693
|
-
const name = "--" + question.id
|
|
666
|
+
const name = "--" + question.id;
|
|
694
667
|
const label = question.label;
|
|
695
668
|
opts[name] = {
|
|
696
|
-
label
|
|
669
|
+
label,
|
|
697
670
|
default: question.required ? getDefault(question) : "** NONE **"
|
|
698
671
|
};
|
|
699
672
|
if (name.length > nameLen) {
|
|
@@ -716,7 +689,6 @@ async function buildArgHelp() {
|
|
|
716
689
|
argHelp += opts[name].default;
|
|
717
690
|
}
|
|
718
691
|
return argHelp;
|
|
719
|
-
|
|
720
692
|
}
|
|
721
693
|
|
|
722
694
|
function checkItem(item) {
|
|
@@ -806,7 +778,6 @@ function getWarnings() {
|
|
|
806
778
|
}
|
|
807
779
|
|
|
808
780
|
async function forEachQuestion(fn) {
|
|
809
|
-
|
|
810
781
|
await iter(install_info.questions);
|
|
811
782
|
|
|
812
783
|
async function iter(questions) {
|
|
@@ -820,7 +791,6 @@ async function forEachQuestion(fn) {
|
|
|
820
791
|
}
|
|
821
792
|
}
|
|
822
793
|
}
|
|
823
|
-
|
|
824
794
|
}
|
|
825
795
|
|
|
826
796
|
function validate(question, answer) {
|
package/setup/convertStartJS.js
CHANGED
|
@@ -8,7 +8,6 @@ const moment = require("moment");
|
|
|
8
8
|
const profound = require("profoundjs");
|
|
9
9
|
|
|
10
10
|
module.exports = function(file) {
|
|
11
|
-
|
|
12
11
|
let content = fs.readFileSync(file, "utf8");
|
|
13
12
|
const ast = acorn.parse(content, {
|
|
14
13
|
ecmaVersion: "latest",
|
|
@@ -42,21 +41,24 @@ module.exports = function(file) {
|
|
|
42
41
|
if (node.type === "Program" || isFunction(node) || (node.type === "BlockStatement" && !isFunction(parent))) {
|
|
43
42
|
// Set up new scope.
|
|
44
43
|
const scope = {
|
|
45
|
-
node
|
|
44
|
+
node,
|
|
46
45
|
objects: new Map(),
|
|
47
46
|
scopes: new Map()
|
|
48
47
|
};
|
|
49
48
|
// Keep track of contained scopes.
|
|
50
49
|
const containingScope = scopeMap.get(scopeStack[scopeStack.length - 1]);
|
|
51
|
-
if (containingScope)
|
|
50
|
+
if (containingScope) {
|
|
52
51
|
containingScope.scopes.set(node, scope);
|
|
52
|
+
}
|
|
53
53
|
// Add function parameter names to scope.
|
|
54
54
|
if (isFunction(node)) {
|
|
55
55
|
node.params.forEach(param => {
|
|
56
|
-
if (param.type === "AssignmentPattern")
|
|
56
|
+
if (param.type === "AssignmentPattern") {
|
|
57
57
|
param = param.left;
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
}
|
|
59
|
+
if (param.type === "Identifier") {
|
|
60
|
+
scope.objects.set(param.name, { scope });
|
|
61
|
+
}
|
|
60
62
|
});
|
|
61
63
|
}
|
|
62
64
|
scopeMap.set(node, scope);
|
|
@@ -75,8 +77,9 @@ module.exports = function(file) {
|
|
|
75
77
|
}
|
|
76
78
|
else {
|
|
77
79
|
useStrict = containingFnInfo.useStrict;
|
|
78
|
-
if (node.body.type === "BlockStatement" && node.body.body.length > 0 && node.body.body[0].directive === "use strict")
|
|
80
|
+
if (node.body.type === "BlockStatement" && node.body.body.length > 0 && node.body.body[0].directive === "use strict") {
|
|
79
81
|
useStrict = true;
|
|
82
|
+
}
|
|
80
83
|
}
|
|
81
84
|
}
|
|
82
85
|
fnMap.set(node, {
|
|
@@ -95,7 +98,7 @@ module.exports = function(file) {
|
|
|
95
98
|
node.declarations.forEach(variableDeclarator => {
|
|
96
99
|
if (variableDeclarator.id.type === "Identifier") {
|
|
97
100
|
const scope = node.kind === "var" ? scopeMap.get(fn) : scopeMap.get(scopeStack[scopeStack.length - 1]);
|
|
98
|
-
scope.objects.set(variableDeclarator.id.name, { scope
|
|
101
|
+
scope.objects.set(variableDeclarator.id.name, { scope });
|
|
99
102
|
}
|
|
100
103
|
});
|
|
101
104
|
}
|
|
@@ -113,8 +116,9 @@ module.exports = function(file) {
|
|
|
113
116
|
else if (parent.type === "AssignmentExpression" && parent.right === node) {
|
|
114
117
|
name = getQualifiedName(parent.left);
|
|
115
118
|
}
|
|
116
|
-
if (name)
|
|
119
|
+
if (name) {
|
|
117
120
|
pjsPrefix = name;
|
|
121
|
+
}
|
|
118
122
|
}
|
|
119
123
|
}
|
|
120
124
|
}
|
|
@@ -156,8 +160,9 @@ module.exports = function(file) {
|
|
|
156
160
|
const containingScope = scopeMap.get(scopeStack[scopeStack.length - 2]);
|
|
157
161
|
const containingFn = fnStack[fnStack.length - 2];
|
|
158
162
|
if (node.type === "FunctionDeclaration") {
|
|
159
|
-
if (node.id.name)
|
|
163
|
+
if (node.id.name) {
|
|
160
164
|
fnInfo.name = node.id.name;
|
|
165
|
+
}
|
|
161
166
|
const containingFnInfo = fnMap.get(containingFn);
|
|
162
167
|
fnInfo.scope = (containingFnInfo.useStrict && containingScope.node.type === "BlockStatement") ? containingScope.node : containingFn;
|
|
163
168
|
}
|
|
@@ -183,7 +188,7 @@ module.exports = function(file) {
|
|
|
183
188
|
else if (node.type === "CallExpression") {
|
|
184
189
|
callMap.set(node, {
|
|
185
190
|
containingFn: fn,
|
|
186
|
-
parent
|
|
191
|
+
parent
|
|
187
192
|
});
|
|
188
193
|
const callee = node.callee;
|
|
189
194
|
let calleeName = getQualifiedName(callee);
|
|
@@ -194,7 +199,7 @@ module.exports = function(file) {
|
|
|
194
199
|
eval("fn = " + internalName);
|
|
195
200
|
}
|
|
196
201
|
catch (error) {}
|
|
197
|
-
if (fn && typeof(fn) === "function" && fn.constructor.name === "AsyncFunction") {
|
|
202
|
+
if (fn && typeof (fn) === "function" && fn.constructor.name === "AsyncFunction") {
|
|
198
203
|
needsAwait.set(node, true);
|
|
199
204
|
}
|
|
200
205
|
}
|
|
@@ -238,8 +243,9 @@ module.exports = function(file) {
|
|
|
238
243
|
else if (!fn.async) {
|
|
239
244
|
const fnInfo = fnMap.get(fn);
|
|
240
245
|
const parent = fnInfo.parent;
|
|
241
|
-
if (parent && parent.type === "MethodDefinition" && (parent.kind !== "method" || !parent.key))
|
|
246
|
+
if (parent && parent.type === "MethodDefinition" && (parent.kind !== "method" || !parent.key)) {
|
|
242
247
|
return;
|
|
248
|
+
}
|
|
243
249
|
const start = parent.type === "MethodDefinition" ? parent.key.start : fn.start;
|
|
244
250
|
insertions.push({
|
|
245
251
|
pos: start,
|
|
@@ -248,11 +254,11 @@ module.exports = function(file) {
|
|
|
248
254
|
}
|
|
249
255
|
});
|
|
250
256
|
|
|
251
|
-
insertions.sort(function
|
|
257
|
+
insertions.sort(function(a, b) {
|
|
252
258
|
if (a.pos === b.pos) return (a.atEnd || 0) - (b.atEnd || 0);
|
|
253
259
|
return a.pos - b.pos;
|
|
254
260
|
});
|
|
255
|
-
|
|
261
|
+
|
|
256
262
|
const newCode = [];
|
|
257
263
|
if (insertions.length) {
|
|
258
264
|
// For performance -- Instead of string concat use an array to hold the parts and pieces -- then join them together
|
|
@@ -275,10 +281,12 @@ module.exports = function(file) {
|
|
|
275
281
|
if (match) {
|
|
276
282
|
const lfs = match.filter(el => el === "\n").length;
|
|
277
283
|
const crlfs = match.length - lfs;
|
|
278
|
-
if (lfs > crlfs)
|
|
284
|
+
if (lfs > crlfs) {
|
|
279
285
|
EOL = "\n";
|
|
280
|
-
|
|
286
|
+
}
|
|
287
|
+
else if (crlfs > lfs) {
|
|
281
288
|
EOL = "\r\n";
|
|
289
|
+
}
|
|
282
290
|
}
|
|
283
291
|
const lines = content.split(EOL);
|
|
284
292
|
let index = 0;
|
|
@@ -303,10 +311,12 @@ module.exports = function(file) {
|
|
|
303
311
|
return changed;
|
|
304
312
|
|
|
305
313
|
function getCallName(name) {
|
|
306
|
-
if (callAPIs.includes(name))
|
|
314
|
+
if (callAPIs.includes(name)) {
|
|
307
315
|
return name;
|
|
308
|
-
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
309
318
|
return name.replace(/\.(call|apply)$/, "");
|
|
319
|
+
}
|
|
310
320
|
}
|
|
311
321
|
|
|
312
322
|
// Given a list of CallExpressions needing await (needsAwait):
|
|
@@ -314,7 +324,6 @@ module.exports = function(file) {
|
|
|
314
324
|
// Functions that contain await calls need to be made async, and any caller of the containing function needs to await the result.
|
|
315
325
|
// So then the caller of the containing function needs to be made aysnc, and so on...
|
|
316
326
|
function findAsyncCalls(needsAwait, needsAsync, callMap, fnMap) {
|
|
317
|
-
|
|
318
327
|
find(new Map(needsAwait));
|
|
319
328
|
|
|
320
329
|
function find(calls) {
|
|
@@ -322,8 +331,9 @@ module.exports = function(file) {
|
|
|
322
331
|
const callInfo = callMap.get(callExpression);
|
|
323
332
|
const containingFn = callInfo.containingFn;
|
|
324
333
|
needsAsync.set(containingFn, true);
|
|
325
|
-
if (containingFn.type === "Program")
|
|
334
|
+
if (containingFn.type === "Program") {
|
|
326
335
|
return;
|
|
336
|
+
}
|
|
327
337
|
const containingFnInfo = fnMap.get(containingFn);
|
|
328
338
|
if (containingFnInfo.scope && containingFnInfo.name && containingFnInfo.name !== "startPJS") {
|
|
329
339
|
const newCalls = new Map();
|
|
@@ -345,21 +355,20 @@ module.exports = function(file) {
|
|
|
345
355
|
}
|
|
346
356
|
});
|
|
347
357
|
}
|
|
348
|
-
|
|
349
358
|
}
|
|
350
|
-
|
|
351
|
-
}
|
|
359
|
+
};
|
|
352
360
|
|
|
353
361
|
// Given an Identifier or MemberExpression, tries to return a fully qualified name.
|
|
354
362
|
// Returns undefined if the name can't be determined due to dynamic parts.
|
|
355
363
|
function getQualifiedName(node) {
|
|
356
|
-
|
|
357
|
-
if (node.type !== "Identifier" && node.type !== "MemberExpression")
|
|
364
|
+
if (node.type !== "Identifier" && node.type !== "MemberExpression") {
|
|
358
365
|
return;
|
|
366
|
+
}
|
|
359
367
|
|
|
360
368
|
const parts = process(node);
|
|
361
|
-
if (parts.indexOf(undefined) === -1)
|
|
369
|
+
if (parts.indexOf(undefined) === -1) {
|
|
362
370
|
return parts.join(".");
|
|
371
|
+
}
|
|
363
372
|
|
|
364
373
|
function process(node) {
|
|
365
374
|
const parts = [];
|
|
@@ -371,17 +380,18 @@ function getQualifiedName(node) {
|
|
|
371
380
|
}
|
|
372
381
|
else if (node.type === "MemberExpression") {
|
|
373
382
|
parts.push(...process(node.object));
|
|
374
|
-
if (node.computed === true && node.property.type !== "Literal")
|
|
383
|
+
if (node.computed === true && node.property.type !== "Literal") {
|
|
375
384
|
parts.push("__COMPUTED__");
|
|
376
|
-
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
377
387
|
parts.push(...process(node.property));
|
|
388
|
+
}
|
|
378
389
|
}
|
|
379
390
|
else {
|
|
380
391
|
parts.push(undefined);
|
|
381
392
|
}
|
|
382
393
|
return parts;
|
|
383
394
|
}
|
|
384
|
-
|
|
385
395
|
}
|
|
386
396
|
|
|
387
397
|
function copyScopeObjects(scope, objects) {
|
package/setup/install.js
CHANGED
|
@@ -23,7 +23,7 @@ const iutils = require("./install_utils.js");
|
|
|
23
23
|
const path = require("path");
|
|
24
24
|
/*
|
|
25
25
|
NOTE: install_info.json
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
This file contains instructions for completing the installation.
|
|
28
28
|
It tells the process what questions to ask and what commands to run.
|
|
29
29
|
This file is shared with the GUI installer.
|
package/setup/install_utils.js
CHANGED
|
@@ -10,43 +10,35 @@ const os = require("os");
|
|
|
10
10
|
const path = require("path");
|
|
11
11
|
|
|
12
12
|
exports.getConfigPath = function() {
|
|
13
|
-
|
|
14
13
|
// Get the path - maybe its relative
|
|
15
14
|
let configPath = process.env.PROFOUNDJS_CONFIG_FILE || "./config.js";
|
|
16
|
-
if (configPath.startsWith("."))
|
|
15
|
+
if (configPath.startsWith(".")) {
|
|
17
16
|
configPath = path.join(exports.getDeployDir(), configPath);
|
|
17
|
+
}
|
|
18
18
|
|
|
19
19
|
// Make sure directory exists
|
|
20
20
|
fs.mkdirSync(path.dirname(configPath), { recursive: true });
|
|
21
21
|
|
|
22
22
|
return configPath;
|
|
23
|
-
|
|
24
|
-
}
|
|
23
|
+
};
|
|
25
24
|
|
|
26
25
|
exports.getDeployDir = function() {
|
|
27
|
-
|
|
28
26
|
const dirParts = __dirname.split(path.sep);
|
|
29
27
|
while (dirParts.length > 0 && dirParts.pop() !== "node_modules") {};
|
|
30
28
|
if (dirParts.length > 0) {
|
|
31
29
|
return dirParts.join(path.sep);
|
|
32
30
|
}
|
|
33
|
-
|
|
34
|
-
}
|
|
31
|
+
};
|
|
35
32
|
|
|
36
33
|
exports.getPackageDir = function() {
|
|
37
|
-
|
|
38
34
|
return path.resolve(__dirname, "..");
|
|
39
|
-
|
|
40
|
-
}
|
|
35
|
+
};
|
|
41
36
|
|
|
42
37
|
exports.getSetupDir = function() {
|
|
43
|
-
|
|
44
38
|
return path.join(exports.getPackageDir(), "setup");
|
|
45
|
-
|
|
46
|
-
}
|
|
39
|
+
};
|
|
47
40
|
|
|
48
41
|
exports.getIBMiInstances = function(installDir) {
|
|
49
|
-
|
|
50
42
|
const INSTANCES_DIR = "/profoundjs-base/instances";
|
|
51
43
|
|
|
52
44
|
if (!fs.existsSync(INSTANCES_DIR)) {
|
|
@@ -59,7 +51,7 @@ exports.getIBMiInstances = function(installDir) {
|
|
|
59
51
|
withFileTypes: true
|
|
60
52
|
}
|
|
61
53
|
)
|
|
62
|
-
|
|
54
|
+
.filter(el => el.isDirectory());
|
|
63
55
|
|
|
64
56
|
let instances = [];
|
|
65
57
|
for (const dir of dirs) {
|
|
@@ -70,7 +62,7 @@ exports.getIBMiInstances = function(installDir) {
|
|
|
70
62
|
catch (error) {
|
|
71
63
|
continue;
|
|
72
64
|
}
|
|
73
|
-
const instance ={
|
|
65
|
+
const instance = {
|
|
74
66
|
name: dir.name.toUpperCase(),
|
|
75
67
|
options: []
|
|
76
68
|
};
|
|
@@ -93,27 +85,21 @@ exports.getIBMiInstances = function(installDir) {
|
|
|
93
85
|
});
|
|
94
86
|
}
|
|
95
87
|
return instances;
|
|
96
|
-
|
|
97
|
-
}
|
|
88
|
+
};
|
|
98
89
|
|
|
99
90
|
exports.validateIBMiCCSID = function(ccsid) {
|
|
100
|
-
|
|
101
91
|
if (!Number.isInteger(ccsid) || ccsid < 1 || ccsid > 65535) {
|
|
102
92
|
return "CCSID must be a number 1-65535";
|
|
103
93
|
}
|
|
104
|
-
|
|
105
|
-
}
|
|
94
|
+
};
|
|
106
95
|
|
|
107
96
|
exports.validateIBMiIASP = function(name) {
|
|
108
|
-
|
|
109
97
|
if (name.toUpperCase() !== "*SYSBAS") {
|
|
110
98
|
return exports.validateIBMiName(name);
|
|
111
99
|
}
|
|
112
|
-
|
|
113
|
-
}
|
|
100
|
+
};
|
|
114
101
|
|
|
115
102
|
exports.validateIBMiName = function(name) {
|
|
116
|
-
|
|
117
103
|
if (name.length < 1 || name.length > 10) {
|
|
118
104
|
return "Name must be from 1-10 characters.";
|
|
119
105
|
}
|
|
@@ -126,15 +112,14 @@ exports.validateIBMiName = function(name) {
|
|
|
126
112
|
const chr = name.substr(i, 1).toUpperCase();
|
|
127
113
|
if ((chr < "A" || chr > "Z") && (chr < "0" || chr > "9") && chr != "#" && chr != "@" && chr != "$" && chr != "_" && chr != ".") {
|
|
128
114
|
return "Name contains an invalid character: " + chr;
|
|
129
|
-
}
|
|
115
|
+
}
|
|
130
116
|
}
|
|
131
|
-
|
|
132
|
-
}
|
|
117
|
+
};
|
|
133
118
|
|
|
134
119
|
exports.isIBMi = function() {
|
|
135
120
|
// Node.js versions < 18 report os.platform() === "aix" on IBM i.
|
|
136
|
-
return (os.platform() === "os400" || (os.platform() === "aix" && os.type() === "OS400"));
|
|
137
|
-
}
|
|
121
|
+
return (os.platform() === "os400" || (os.platform() === "aix" && os.type() === "OS400"));
|
|
122
|
+
};
|
|
138
123
|
|
|
139
124
|
if (exports.getDeployDir()) {
|
|
140
125
|
require("dotenv").config(
|