profoundjs 6.2.0 → 6.4.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.
Files changed (33) hide show
  1. package/htdocs/fusionchartsxt/js/maps/fusioncharts.india.js +2 -1
  2. package/htdocs/fusionchartsxt/js/maps/fusioncharts.jammuandkashmir.js +8 -2
  3. package/htdocs/fusionchartsxt/js/maps/fusioncharts.ladakh.js +238 -0
  4. package/htdocs/fusionchartsxt/js/pui-fusioncharts.js +368 -53
  5. package/htdocs/profoundui/proddata/css/logic.css +21 -2
  6. package/htdocs/profoundui/proddata/css/profoundui.css +16 -0
  7. package/htdocs/profoundui/proddata/js/designer.js +3862 -3846
  8. package/htdocs/profoundui/proddata/js/key_management.js +3 -3
  9. package/htdocs/profoundui/proddata/js/rich-display-react-component.js +5 -5
  10. package/htdocs/profoundui/proddata/js/rich-display-vue-component.js +3 -3
  11. package/htdocs/profoundui/proddata/js/runtime.js +1234 -1230
  12. package/htdocs/profoundui/proddata/js/soapclient.js +22 -22
  13. package/index.js +4 -4
  14. package/package.json +2 -1
  15. package/profound.jse +1 -1
  16. package/setup/call.js +1 -1
  17. package/setup/completeInstall.js +51 -56
  18. package/setup/convertStartJS.js +40 -30
  19. package/setup/encrypt_client_file.js +4 -0
  20. package/setup/install.js +1 -1
  21. package/setup/install_utils.js +44 -30
  22. package/setup/lic_client.js +1 -1
  23. package/setup/modules/papisamples/.noderun/settings.json +5 -0
  24. package/setup/modules/papisamples/APISample.api.json +313 -0
  25. package/setup/modules/papisamples/APISample.js +55 -0
  26. package/setup/modules/papisamples/APISample.json +751 -0
  27. package/setup/modules/papisamples/README.md +17 -0
  28. package/setup/modules/papisamples/hobbyshop.csv +6 -0
  29. package/setup/modules/papisamples/readCSVFile.js +136 -0
  30. package/setup/pjsdist.savf +0 -0
  31. package/setup/plugins/mathoperation.js +84 -0
  32. package/setup/removeExtraComponents.js +4 -6
  33. package/setup/setup.js +50 -14
@@ -0,0 +1,17 @@
1
+
2
+ # Profound API Samples
3
+
4
+ A sample Profound API program. Server-side API logic is defined in low-code and JavaScript. A client-side program exists to demonstrate calling the API end point.
5
+
6
+ ## Sample GET, POST, PUT, DELETE, and Grid Request
7
+
8
+ Run the sample user interface by clicking either
9
+ * Launch > Launch App in Browser Tab
10
+ * Launch > Launch App in IDE
11
+
12
+ ## Files
13
+ * APISample.api.json - the server-side logic for the API endpoints, as Low Code steps
14
+ * APISample.js - program logic for the sample user interface to interact with the APIs
15
+ * APISample.json - sample user interface to interact with the APIs
16
+ * hobbyshop.csv - sample data file
17
+ * readCSVFile.js - sample module to handle reading and writing to the data file. Used in Low Code steps.
@@ -0,0 +1,6 @@
1
+ 1,Nintendo Switch,200,8
2
+ 2,AC Ambient,100 ,6
3
+ 3,XBOX one,120,3
4
+ 4,Sega Saturn,120,3
5
+ 5,Playstation 3,100,5
6
+ 6,bicycle gears,16,18
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ /**
3
+ * A utility function to read a CSV file and output its contents in a pre-determined format.
4
+ */
5
+ const fs = require("fs"); // filestream module
6
+ const readline = require("readline"); // line-by-line reading module
7
+
8
+ /**
9
+ * Read a file line by line and output an object with its contents, with each field as properties of the object.
10
+ * @param {String} filename
11
+ * @param {Number} rowID
12
+ * @returns {Object}
13
+ */
14
+ async function fileRead(filename, rowID = 0) {
15
+ let fLength = 0;
16
+ const lData = [];
17
+ let lTemp = null;
18
+ // Start a file stream to read the file line-by-line
19
+ const fstream = fs.createReadStream(filename);
20
+ const linereader = readline.createInterface({
21
+ input: fstream,
22
+ crlfDelay: Infinity // used to identify all \r\n entries in the file as single line breaks
23
+ });
24
+
25
+ // Start reading the lines of the file
26
+ for await (const line of linereader) {
27
+ fLength++;
28
+ if (rowID == 0) { // read the whole file, parse each line into arrays
29
+ lTemp = line.split(",");
30
+ lData.push({ ID: lTemp[0], Name: lTemp[1], Price: lTemp[2], Quantity: lTemp[3] });
31
+ }
32
+ else if (fLength == rowID) {
33
+ lTemp = line.split(",");
34
+ lData.push({ ID: lTemp[0], Name: lTemp[1], Price: lTemp[2], Quantity: lTemp[3] });
35
+ }
36
+ };
37
+
38
+ return { length: fLength, data: lData };
39
+ }
40
+
41
+ /**
42
+ * Read a file line by line, changing the specified line, and then write the data back to the file.
43
+ * Return a message indicating which row was updated.
44
+ * The original file is changed.
45
+ * @param {String} filename
46
+ * @param {Number} rowID
47
+ * @returns {String}
48
+ */
49
+ async function fileUpdate(filename, rowID, data) {
50
+ let fLength = 0;
51
+ // Start a file stream to read the file line-by-line
52
+ const fstream = fs.createReadStream(filename);
53
+ const linereader = readline.createInterface({
54
+ input: fstream,
55
+ crlfDelay: Infinity // used to identify all \r\n entries in the file as single line breaks
56
+ });
57
+
58
+ let strUpdated = "";
59
+
60
+ // Start reading the lines of the file
61
+ for await (const line of linereader) {
62
+ fLength++;
63
+ if (fLength == rowID) {
64
+ strUpdated += fLength + "," + data + "\n"; // update the specific line if found
65
+ }
66
+ else strUpdated += line + "\n";
67
+ };
68
+ linereader.close();
69
+ fstream.close();
70
+
71
+ // remove the last entry of \n
72
+ strUpdated = strUpdated.substring(0, strUpdated.length - 1);
73
+
74
+ const message = await new Promise((resolve, reject) => {
75
+ // rewrite the file with the updated data
76
+ fs.writeFile(filename, strUpdated, (err) => {
77
+ if (err) reject(err);
78
+ else resolve("Row ID: " + iID + "\nData Updated: " + data);
79
+ });
80
+ });
81
+
82
+ return message;
83
+ }
84
+
85
+ /**
86
+ * Read a file line by line and build a string with the file contents, with the line specified by rowID removed.
87
+ * Write the new string to the file, overwriting the original file.
88
+ * Return a message indicating which row was deleted.
89
+ * @param {String} filename
90
+ * @param {Number} rowID
91
+ * @returns {String}
92
+ */
93
+ async function lineDelete(filename, rowID) {
94
+ let iCol = 0;
95
+ let fLength = 0;
96
+ let strUpdated = "";
97
+ let strTemp = "";
98
+ // Start a file stream to read the file line-by-line
99
+ const fstream = fs.createReadStream(filename);
100
+ const linereader = readline.createInterface({
101
+ input: fstream,
102
+ crlfDelay: Infinity // used to identify all \r\n entries in the file as single line breaks
103
+ });
104
+
105
+ // Start reading the lines of the file
106
+ for await (const line of linereader) {
107
+ fLength++;
108
+ if (fLength < rowID) { // Copy the line as is if it's not the row ID requested
109
+ strUpdated += line + "\n";
110
+ }
111
+ else if (fLength > rowID) { // Update the first column to reflect the correct line
112
+ iCol = line.indexOf(","); // find first occurence of , as the first column
113
+ strTemp = line.substring(iCol, line.length); // move the , and the data to temp string
114
+ strUpdated += (fLength - 1) + strTemp + "\n"; // add the line and its updated column number
115
+ }
116
+ };
117
+ linereader.close();
118
+ fstream.close();
119
+
120
+ // remove the last entry of \n
121
+ strUpdated = strUpdated.substring(0, strUpdated.length - 1);
122
+
123
+ // Write the strUpdated string to the file at filename:
124
+ const message = new Promise((resolve, reject) => {
125
+ fs.writeFile(filename, strUpdated, (err) => {
126
+ if (err) reject(err);
127
+ else resolve("Row " + rowID + " deleted.");
128
+ });
129
+ });
130
+
131
+ return message;
132
+ }
133
+
134
+ exports.fileRead = fileRead;
135
+ exports.fileUpdate = fileUpdate;
136
+ exports.lineDelete = lineDelete;
Binary file
@@ -0,0 +1,84 @@
1
+
2
+ module.exports = {
3
+
4
+ name: "Math-Operation",
5
+
6
+ // The title that is displayed for this sample plugin on the plugin selection
7
+ text: "Math Operation",
8
+
9
+ // The plugin category that the sample plugin will be placed into.
10
+ // A category will be created if the category name does not currently exist
11
+ category: "Sample User Plugins",
12
+
13
+ // The help text that is displayed when the help icon is clicked on this plugin's menu
14
+ help: `This plugin does a math operation set by the user for 2 different numbers from 2 widget sources`,
15
+
16
+ // Specifies if the plugin is a client-side or server-side step. A plugin is server-side by default.
17
+ clientSide: true,
18
+
19
+ context: "rdf",
20
+
21
+ // An array used to generate the plugin questions and assign values set by the user.
22
+ questions: [
23
+
24
+ {
25
+ id: "firstNumber",
26
+ text: "ID of Widget containing the first number",
27
+ required: true,
28
+ insertDynamic: true,
29
+ dynamicSource: "widgets"
30
+ },
31
+
32
+ {
33
+ id: "secondNumber",
34
+ text: "ID of Widget containing the second number",
35
+ required: true,
36
+ insertDynamic: true,
37
+ dynamicSource: "widgets"
38
+ },
39
+
40
+ {
41
+ id: "operation",
42
+ text: "Math operation",
43
+ required: true,
44
+ type: "dropdown",
45
+ source: ["+","-","*","/"],
46
+ required: true
47
+ },
48
+
49
+ {
50
+ id: "result",
51
+ text: "ID of Widget where result will be stored",
52
+ required: true,
53
+ insertDynamic: true,
54
+ dynamicSource: "widgets"
55
+ }
56
+ ],
57
+
58
+ // This is where code is generated for the plugin once the questions are answered.
59
+ // You can also see this code via the "convert to code" plugin icon.
60
+ generator: function(answers) {
61
+
62
+ let result = 0;
63
+ let code = "";
64
+
65
+ switch (answers["operation"]) {
66
+
67
+ case "+":
68
+ code = 'pui.set( "' + answers.result + '", parseInt( pui.get("' + answers.firstNumber + '") ) + parseInt( pui.get("' + answers.secondNumber + '") ) );';
69
+ break;
70
+ case "-":
71
+ code = 'pui.set( "' + answers.result + '", parseInt( pui.get("' + answers.firstNumber + '") ) - parseInt( pui.get("' + answers.secondNumber + '") ) );';
72
+ break;
73
+ case "*":
74
+ code = 'pui.set( "' + answers.result + '", parseInt( pui.get("' + answers.firstNumber + '") ) * parseInt( pui.get("' + answers.secondNumber + '") ) );';
75
+ break;
76
+ case "/":
77
+ code = 'pui.set( "' + answers.result + '", parseInt( pui.get("' + answers.firstNumber + '") ) / parseInt( pui.get("' + answers.secondNumber + '") ) );';
78
+ break;
79
+
80
+ }
81
+
82
+ return code;
83
+ }
84
+ }
@@ -3,7 +3,7 @@
3
3
 
4
4
  /*
5
5
  Discovers and removes additional components that exist outside of the package installation directory.
6
-
6
+
7
7
  It's used by Profound Installer
8
8
 
9
9
  Any changes to the behavior may require changes to the "install_info.json" file or Profound Installer.
@@ -15,9 +15,8 @@ const readline = require("readline");
15
15
 
16
16
  const IBMi = iutils.isIBMi();
17
17
 
18
- (async () => {
18
+ (async() => {
19
19
  try {
20
-
21
20
  // Parse arguments.
22
21
  const argDefs = {
23
22
  alias: {
@@ -39,7 +38,7 @@ const IBMi = iutils.isIBMi();
39
38
 
40
39
  // Show help and quit, if requested.
41
40
  if (args["help"] === true) {
42
- const HELP = `Usage: node removeExtraComponents.js [OPTION]
41
+ const HELP = `Usage: node removeExtraComponents.js [OPTION]
43
42
  -h, --help Print this help and exit.
44
43
  -d, --dry-run Report what items would be removed, without removing them.
45
44
  -s, --silent Bypass confirmation prompt.
@@ -170,7 +169,6 @@ It is intended to be used before uninstalling the package via NPM.
170
169
  }
171
170
  console.log("Removal of extra components complete.");
172
171
  process.stdin.destroy();
173
-
174
172
  }
175
173
  catch (error) {
176
174
  process.stdin.destroy();
@@ -194,7 +192,7 @@ function exec(command, quiet = false) {
194
192
  const opts = {
195
193
  env: {
196
194
  QIBM_USE_DESCRIPTOR_STDIO: "Y",
197
- QIBM_MULTI_THREADED: "N",
195
+ QIBM_MULTI_THREADED: "N"
198
196
  },
199
197
  stdio: "pipe",
200
198
  windowsHide: true
package/setup/setup.js CHANGED
@@ -38,7 +38,7 @@ let logFile;
38
38
 
39
39
  let SILENT_MODE = false;
40
40
 
41
- (async () => {
41
+ (async() => {
42
42
  try {
43
43
  // Parse arguments.
44
44
  const args = minimist(
@@ -63,7 +63,7 @@ let SILENT_MODE = false;
63
63
  "ibmi-instance-node-path",
64
64
  "nodegit-version"
65
65
  ],
66
- unknown: function (arg) {
66
+ unknown: function(arg) {
67
67
  console.error("Unknown argument:", arg);
68
68
  process.exit(1);
69
69
  }
@@ -253,6 +253,15 @@ let SILENT_MODE = false;
253
253
  log("Creating modules directory.");
254
254
  fs.mkdirSync(path.join(deployDir, "modules"));
255
255
  }
256
+
257
+ // Create plugins directory.
258
+ if (directoryExists(path.join(deployDir, "plugins"))) {
259
+ log("plugins directory exists.");
260
+ }
261
+ else {
262
+ log("Creating plugins directory.");
263
+ fs.mkdirSync(path.join(deployDir, "plugins"));
264
+ }
256
265
 
257
266
  // Grant PROFOUNDJS user all permissions to modules directory tree.
258
267
  if (IBMi) {
@@ -280,6 +289,15 @@ let SILENT_MODE = false;
280
289
  log("Creating puidnlexit.js.");
281
290
  copyFile(path.join(__dirname, "modules", "puidnlexit.js"), path.join(deployDir, "modules"), "utf8");
282
291
  }
292
+
293
+ // Create mathoperation.js.
294
+ if (fileExists(path.join(deployDir, "plugins", "mathoperation.js"))) {
295
+ log("mathoperation.js file exists.");
296
+ }
297
+ else {
298
+ log("Creating mathoperation.js.");
299
+ copyFile(path.join(__dirname, "plugins", "mathoperation.js"), path.join(deployDir, "plugins"), "utf8");
300
+ }
283
301
 
284
302
  // Create samples directory.
285
303
  if (directoryExists(path.join(deployDir, "modules", "pjssamples"))) {
@@ -288,6 +306,13 @@ let SILENT_MODE = false;
288
306
  log("Copying pjssamples.");
289
307
  copyDir(path.join(__dirname, "modules", "pjssamples"), path.join(deployDir, "modules"));
290
308
 
309
+ // Create PAPI samples directory
310
+ if (directoryExists(path.join(deployDir, "modules", "papisamples"))) {
311
+ fs.removeSync(path.join(deployDir, "modules", "papisamples"));
312
+ }
313
+ log("Copying papisamples.");
314
+ copyDir(path.join(__dirname, "modules", "papisamples"), path.join(deployDir, "modules"));
315
+
291
316
  // Create store_credentials.js.
292
317
  if (fileExists(path.join(deployDir, "store_credentials.js"))) {
293
318
  log("store_credentials.js file exists.");
@@ -306,6 +331,17 @@ let SILENT_MODE = false;
306
331
  log("store_options.js created.");
307
332
  }
308
333
 
334
+ // Begin OAuth2 requirements.
335
+ // Create encrypt_client_file.js.
336
+ if (fileExists(path.join(deployDir, "encrypt_client_file.js"))) {
337
+ log("encrypt_client_file.js file exists.");
338
+ }
339
+ else {
340
+ copyFile(path.join(__dirname, "encrypt_client_file.js"), deployDir, "utf8");
341
+ log("encrypt_client_file.js created.");
342
+ }
343
+ // End OAuth2 requirements.
344
+
309
345
  // Create call.js.
310
346
  if (fileExists(path.join(deployDir, "call.js"))) {
311
347
  log("call.js file exists.");
@@ -414,17 +450,17 @@ let SILENT_MODE = false;
414
450
  }
415
451
  })();
416
452
 
417
- function log (...args) {
453
+ function log(...args) {
418
454
  console.log(...args);
419
455
  logToFile(...args);
420
456
  }
421
457
 
422
- function logError (...args) {
458
+ function logError(...args) {
423
459
  console.error(...args);
424
460
  logToFile(...args);
425
461
  }
426
462
 
427
- function logToFile (...args) {
463
+ function logToFile(...args) {
428
464
  if (SILENT_MODE) {
429
465
  return;
430
466
  }
@@ -433,7 +469,7 @@ function logToFile (...args) {
433
469
  fs.writeFileSync(logFile, output, { flag: "a" });
434
470
  }
435
471
 
436
- function die () {
472
+ function die() {
437
473
  logError(`\n${RED}Profound.js installation failed.${RESET}`);
438
474
  if (!SILENT_MODE) {
439
475
  console.error(`${RED}See installation log:${RESET} ${logPath}\n`);
@@ -441,11 +477,11 @@ function die () {
441
477
  process.exit(1);
442
478
  }
443
479
 
444
- function copyDir (dir, destinationDir) {
480
+ function copyDir(dir, destinationDir) {
445
481
  const dirName = path.basename(dir);
446
482
  fs.mkdirSync(path.join(destinationDir, dirName));
447
483
  const files = fs.readdirSync(dir);
448
- files.forEach(function (file, index) {
484
+ files.forEach(function(file, index) {
449
485
  if (fs.lstatSync(path.join(dir, file)).isDirectory()) { // recurse
450
486
  copyDir(path.join(dir, file), path.join(destinationDir, dirName));
451
487
  }
@@ -455,7 +491,7 @@ function copyDir (dir, destinationDir) {
455
491
  });
456
492
  }
457
493
 
458
- function copyFile (file, destination, type) {
494
+ function copyFile(file, destination, type) {
459
495
  if (type == null) type = "binary";
460
496
  let toFile;
461
497
  if (directoryExists(destination)) {
@@ -468,9 +504,9 @@ function copyFile (file, destination, type) {
468
504
  fs.writeFileSync(toFile, content, type);
469
505
  }
470
506
 
471
- function createPuiscreens (deployDir) {
507
+ function createPuiscreens(deployDir) {
472
508
  const targetPuiScreensFile = path.join(deployDir, "modules", "puiscreens.json");
473
- function copyFileOldVersionIs (version, compareStr) {
509
+ function copyFileOldVersionIs(version, compareStr) {
474
510
  compareStr = compareStr || "=";
475
511
  log("Found Standard puiscreens.json file version " + compareStr + " " + version + ", replacing with current version...");
476
512
  copyFile(path.join(__dirname, "modules", "puiscreens.json"), targetPuiScreensFile, "utf8");
@@ -598,7 +634,7 @@ function createPuiscreens (deployDir) {
598
634
  }
599
635
  }
600
636
 
601
- function directoryExists (dir) {
637
+ function directoryExists(dir) {
602
638
  let exists = false;
603
639
  try {
604
640
  const stat = fs.statSync(dir);
@@ -610,7 +646,7 @@ function directoryExists (dir) {
610
646
  return exists;
611
647
  }
612
648
 
613
- function fileExists (file) {
649
+ function fileExists(file) {
614
650
  let exists = false;
615
651
  try {
616
652
  const stat = fs.statSync(file);
@@ -622,7 +658,7 @@ function fileExists (file) {
622
658
  return exists;
623
659
  }
624
660
 
625
- function runCommand (command, switches) {
661
+ function runCommand(command, switches) {
626
662
  log("Executing IBM i command: " + command);
627
663
  const args = [command];
628
664
  if (typeof switches == "string") {