@naanlang/naan 1.0.2 → 1.0.3

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 (35) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +3 -3
  3. package/bin/index.js +2 -2
  4. package/dist/env_web.js +149 -20
  5. package/dist/naan.min.js +5 -5
  6. package/frameworks/browser/sworker.js +309 -91
  7. package/frameworks/browser/terminals.nlg +22 -9
  8. package/frameworks/browser/workers.nlg +19 -11
  9. package/frameworks/client/apiclient.nlg +17 -4
  10. package/frameworks/client/psm_client.nlg +116 -53
  11. package/frameworks/common/common.nlg +12 -2
  12. package/frameworks/node/apiserver.nlg +25 -13
  13. package/frameworks/node/filesystem.nlg +173 -30
  14. package/frameworks/node/psm_server.nlg +95 -32
  15. package/frameworks/project/build.nlg +40 -23
  16. package/frameworks/project/projects.nlg +47 -26
  17. package/frameworks/running/debugnub.nlg +2 -5
  18. package/frameworks/storage/csv.nlg +120 -0
  19. package/frameworks/storage/dbt_pouch.nlg +41 -25
  20. package/frameworks/storage/psm.nlg +108 -28
  21. package/frameworks/storage/psm_dbtables.nlg +7 -3
  22. package/frameworks/storage/resources.nlg +30 -2
  23. package/lib/browser/env_web.js +147 -18
  24. package/lib/browser/env_webworker.js +1 -1
  25. package/lib/browser/require.js +1 -1
  26. package/lib/core/naanlib.js +5 -5
  27. package/package.json +1 -1
  28. package/plugins/serviceAws/aws_cloudwatchlogs.nlg +1 -1
  29. package/plugins/serviceAws/aws_dynamo.nlg +625 -141
  30. package/plugins/serviceAws/aws_dynextra.nlg +294 -0
  31. package/plugins/serviceAws/dbt_aws.nlg +31 -11
  32. package/plugins/serviceAws/psm_aws.nlg +42 -26
  33. package/plugins/serviceAws/serviceAws.nlg +1 -0
  34. package/plugins/serviceGitHub/psm_github.nlg +41 -25
  35. package/plugins/serviceGitLab/psm_gitlab.nlg +41 -25
package/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Naan for NPM version 1.0.2-1 is released under the MIT License:
1
+ Naan for NPM version 1.0.3-1 is released under the MIT License:
2
2
 
3
3
  Copyright (c) 2017-2022 Zulch Laboratories, Inc.
4
4
 
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  Naan is an async-first software platform for rapid development.
5
5
 
6
6
  #### Release:
7
-      Naan for NPM version 1.0.2-1
7
+      Naan for NPM version 1.0.3-1
8
8
       Copyright (c) 2017-2022 Zulch Laboratories, Inc.
9
9
 
10
10
  #### Features
@@ -27,11 +27,11 @@ Please ensure you have a recent version of [node.js](http://nodejs.org/)
27
27
 
28
28
  For use everywhere as a command line app:
29
29
 
30
- npm install naan -g
30
+ npm install @naanlang/naan -g
31
31
 
32
32
  For use as a library in the current project:
33
33
 
34
- npm install naan
34
+ npm install @naanlang/naan
35
35
 
36
36
  #### Command line execution
37
37
 
package/bin/index.js CHANGED
@@ -58,11 +58,11 @@ process.argv.every((val, index) => {
58
58
  return (true);
59
59
  }
60
60
  if (val == "--version") {
61
- console.log("1.0.2");
61
+ console.log("1.0.3");
62
62
  process.exit(0);
63
63
  }
64
64
  if (val == "--buildno") {
65
- console.log("1.0.2-1");
65
+ console.log("1.0.3-1");
66
66
  process.exit(0);
67
67
  }
68
68
  if (val.substring(0,1) == "-") {
package/dist/env_web.js CHANGED
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * column positioning: // // !
8
8
  *
9
- * Copyright (c) 2017-2021 by Richard C. Zulch
9
+ * Copyright (c) 2017-2022 by Richard C. Zulch
10
10
  *
11
11
  */
12
12
 
@@ -83,6 +83,7 @@ exports.NaanControllerWeb = function() {
83
83
  var replqueue; // text destined for terminal when opened
84
84
  var termlist = []; // list of terminals currently attached
85
85
  var prefs = { };
86
+ var vsiteName;
86
87
 
87
88
  //
88
89
  // termTextOut
@@ -149,8 +150,15 @@ exports.NaanControllerWeb = function() {
149
150
  //
150
151
 
151
152
  this.StateGet = function StateGet() {
152
- if (termlist.length > 0)
153
- replstate = termlist[0].StateSave(); // restore current buffer state to new terminal
153
+ termlist.every(function(term) {
154
+ var state;
155
+ if (term.StateSave && (state = term.StateSave()))
156
+ { // update the state if we can
157
+ replstate = state;
158
+ return (false);
159
+ }
160
+ return (true); // keep searching
161
+ });
154
162
  return (replstate);
155
163
  };
156
164
 
@@ -204,14 +212,14 @@ exports.NaanControllerWeb = function() {
204
212
  if (term !== terminal)
205
213
  term.OnMessage({ // send text to other terminals
206
214
  id: "textout",
207
- text: text + "\r\n"
215
+ text: "\x1b[90m\x1b[3m" + text + "\x1b[0m" + "\r\n"
208
216
  });
209
217
  });
210
218
  window.setTimeout(function () {
211
- naanlib.textLine(text)
219
+ naanlib.textLine(text);
212
220
  }, 1);
213
221
  };
214
-
222
+
215
223
  this.ReplyMessage = function ReplyMessage(data) { // "remote" -> "local"
216
224
  termlist.forEach(function(term) {
217
225
  if (term.OnMessageOut)
@@ -229,9 +237,9 @@ exports.NaanControllerWeb = function() {
229
237
  this.DispatchMessage = function DispatchMessage(data) { // "local" -> "remote"
230
238
  if (nideListener)
231
239
  setTimeout(function() {
232
- nideListener(data)
240
+ nideListener(data);
233
241
  }, 1);
234
- }
242
+ };
235
243
 
236
244
  this.ReplyDebugger = function ReplyDebugger(data) { // "remote" -> "local"
237
245
  termlist.forEach(function(term) {
@@ -250,9 +258,9 @@ exports.NaanControllerWeb = function() {
250
258
  this.DispatchDebugger = function DispatchDebugger(data) { // "local" -> "remote"
251
259
  if (debugListener)
252
260
  setTimeout(function() {
253
- debugListener(data)
261
+ debugListener(data);
254
262
  }, 1);
255
- }
263
+ };
256
264
 
257
265
  //
258
266
  // Status
@@ -290,7 +298,95 @@ exports.NaanControllerWeb = function() {
290
298
  this.Dimensions = function Dimensions(rows, cols) {
291
299
  console.log("Naan terminal dimensions now (" + rows + ", " + cols + ")");
292
300
  };
301
+
302
+ //
303
+ // VsiteRefresh
304
+ //
305
+ // Check if our underlying data has changed, and reload if needed.
306
+ //
307
+
308
+ this.VsiteRefresh = function VsiteRefresh(url_origin) {
309
+ if (window.location.href.startsWith(url_origin))
310
+ window.location.reload(); // we have changed underneath
311
+ };
312
+
293
313
 
314
+ //==========================================================================
315
+ // Clone Debug Interface
316
+ //--------------------------------------------------------------------------
317
+
318
+ function CloneDebugTerminal()
319
+ {
320
+ var termSelf = this;
321
+ //
322
+ // listen for messages
323
+ //
324
+ window.addEventListener("message", function (event) {
325
+ if (event.origin !== window.origin)
326
+ return; // only talk with our peers
327
+ var msg = event.data;
328
+ if (msg.id == "interrupt")
329
+ contSelf.Interrupt();
330
+ else if (msg.id == "keyline")
331
+ contSelf.Return(msg.text, termSelf); // keyboard text from terminal
332
+ else if (msg.id == "start")
333
+ contSelf.Attach(term); // opener is ready
334
+ else if (msg.id == "import")
335
+ { // for workers
336
+ }
337
+ else if (msg.id == "targetin")
338
+ {
339
+ if (nideListener)
340
+ nideListener(msg.data); // target received a message
341
+ }
342
+ else if (msg.id == "debugin")
343
+ {
344
+ if (debugListener)
345
+ debugListener(msg.data); // target received a message
346
+ }
347
+ });
348
+
349
+ //
350
+ // report messages back to opener
351
+ //
352
+ termSelf.OnMessage = function OnMessage(msg) {
353
+ window.opener.postMessage(msg, window.origin);
354
+ return (msg);
355
+ };
356
+
357
+ //
358
+ // report messages back to opener
359
+ //
360
+ termSelf.OnMessageOut = function OnMessageOut(data) {
361
+ var msg = { // target is sending debug data
362
+ id: "targetout",
363
+ data: data
364
+ };
365
+ return (termSelf.OnMessage(msg));
366
+ };
367
+
368
+ //
369
+ // report debug messages back to opener
370
+ //
371
+ termSelf.OnDebugOut = function OnDebugOut(data) {
372
+ var msg = { // target is sending debug data
373
+ id: "debugout",
374
+ data: data
375
+ };
376
+ return (termSelf.OnMessage(msg));
377
+ };
378
+
379
+ //
380
+ // report status back to opener
381
+ //
382
+ termSelf.OnStatus = function OnStatus(status) {
383
+ var msg = { // target is sending debug data
384
+ id: "status",
385
+ status: status
386
+ };
387
+ return (termSelf.OnMessage(msg));
388
+ };
389
+ }
294
390
 
295
391
  //==========================================================================
296
392
  // Host Environment
@@ -299,7 +395,7 @@ exports.NaanControllerWeb = function() {
299
395
  //
300
396
  // SavePref
301
397
  //
302
- // Save a persistent preference objectc that can be retrieved in the future.
398
+ // Save a persistent preference object that can be retrieved in the future.
303
399
  //
304
400
 
305
401
  this.SavePref = function SavePref(key, value) {
@@ -333,6 +429,7 @@ exports.NaanControllerWeb = function() {
333
429
  window.addEventListener("unload", function (e) {
334
430
  window.dispatchEvent(saveEvent);
335
431
  saveLocal();
432
+ virtualClose();
336
433
  });
337
434
 
338
435
  window.addEventListener("beforeunload", function (e) {
@@ -344,15 +441,15 @@ exports.NaanControllerWeb = function() {
344
441
  var statedoc = {};
345
442
  statedoc.curversion = kStateCurrentVersion;
346
443
  statedoc.firstver = kStateFirstVersion;
347
- statedoc.licensee = "Zulch Laboratories, Inc.";
348
- statedoc.verstring = "1.0.2-1";
444
+ statedoc.licensee = "$Licensee$";
445
+ statedoc.verstring = "$Version$";
349
446
  statedoc.date = new Date().toISOString();
350
447
  statedoc.prefs = prefs;
351
- statedoc.naan = naanlib.saveState(true); // true to optimize, which is a bit slower
448
+ statedoc.naan = naanlib.saveState(false); // true to optimize, which is a bit slower
352
449
  termlist.forEach(function(term) {
353
450
  if (!replstate || term.termwin)
354
451
  replstate = term.StateSave(); // state with separate window, otherwise any state
355
- })
452
+ });
356
453
  if (replstate)
357
454
  statedoc.replstate = replstate;
358
455
  return (statedoc);
@@ -362,9 +459,12 @@ exports.NaanControllerWeb = function() {
362
459
  if (statedoc===undefined || statedoc.naan === undefined
363
460
  || statedoc.firstver > kStateCurrentVersion
364
461
  || statedoc.curversion < kStateFirstVersion
365
- || statedoc.licensee != "Zulch Laboratories, Inc."
366
- || statedoc.verstring != "1.0.2-1")
462
+ || statedoc.licensee != "$Licensee$"
463
+ || statedoc.verstring != "$Version$")
464
+ {
465
+ localStorage.removeItem("NaanState_Hosted");
367
466
  return (false);
467
+ }
368
468
  naanstate = statedoc.naan;
369
469
  replstate = statedoc.replstate; // get terminal state, if any
370
470
  if (typeof(statedoc.prefs) == "object")
@@ -381,8 +481,8 @@ exports.NaanControllerWeb = function() {
381
481
  try {
382
482
  if ("localStorage" in window && window["localStorage"] !== null)
383
483
  {
384
- localStorage.removeItem("NaanState_Nide");
385
- if (localStorage.setItem("NaanState_Nide", statestr) !== undefined)
484
+ localStorage.removeItem("NaanState_Hosted");
485
+ if (localStorage.setItem("NaanState_Hosted", statestr) !== undefined)
386
486
  return (true);
387
487
  }
388
488
  } catch(e) {
@@ -396,7 +496,7 @@ exports.NaanControllerWeb = function() {
396
496
  /*jshint sub:true */
397
497
  if ("localStorage" in window && window["localStorage"] !== null)
398
498
  {
399
- var statestr = localStorage.getItem("NaanState_Nide");
499
+ var statestr = localStorage.getItem("NaanState_Hosted");
400
500
  if (statestr)
401
501
  return (loadState(JSON.parse(statestr)));
402
502
  }
@@ -405,7 +505,28 @@ exports.NaanControllerWeb = function() {
405
505
  }
406
506
  return (false);
407
507
  }
508
+
509
+ function virtualOpen() {
510
+ vsiteName = window.document.title; // consistent name at open and close
511
+ if (window.opener && window.opener.Naanlang)
512
+ window.opener.Naanlang.naancon.DispatchMessage({
513
+ op: "VsiteOpen",
514
+ name: vsiteName,
515
+ naancont: contSelf
516
+ });
517
+ }
408
518
 
519
+ function virtualClose() {
520
+ if (window.opener && window.opener.Naanlang) {
521
+ window.opener.Naanlang.naancon.DispatchMessage({
522
+ op: "VsiteClose",
523
+ name: vsiteName,
524
+ naancont: contSelf
525
+ });
526
+ termTextOut("\x1b[90m\x1b[3m".concat("\nwindow closed", "\x1b[0m\n"));
527
+ }
528
+ }
529
+
409
530
  /*jshint sub:true */
410
531
  if (querystrings["restart"] || !loadLocal())
411
532
  { // don't load state or can't load state
@@ -423,6 +544,14 @@ exports.NaanControllerWeb = function() {
423
544
  state: naanstate
424
545
  });
425
546
  }
547
+
548
+ if (window.opener) {
549
+ virtualOpen();
550
+ var term = new CloneDebugTerminal();
551
+ term.OnMessage({
552
+ id: "loaded"
553
+ });
554
+ }
426
555
  };
427
556
 
428
557
  /*jshint sub:true */