@naanlang/naan 1.3.2 → 1.4.1

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 (56) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +1 -1
  3. package/bin/index.js +25 -15
  4. package/dist/naan.min.js +5 -5
  5. package/frameworks/browser/sworker.js +23 -23
  6. package/frameworks/browser/terminals.nlg +26 -11
  7. package/frameworks/browser/ws_client.nlg +1 -1
  8. package/frameworks/client/psm_client.nlg +3 -1
  9. package/frameworks/client/relaycon.nlg +3 -2
  10. package/frameworks/common/common.nlg +5 -2
  11. package/frameworks/common/preferences.nlg +1 -1
  12. package/frameworks/node/apiserver.nlg +3 -3
  13. package/frameworks/node/filesystem.nlg +5 -4
  14. package/frameworks/node/psm_server.nlg +1 -1
  15. package/frameworks/node/shell.nlg +134 -0
  16. package/frameworks/node/worker.nlg +104 -46
  17. package/frameworks/project/build.nlg +1 -2
  18. package/frameworks/project/jszip.js +0 -0
  19. package/frameworks/project/projects.nlg +1 -1
  20. package/frameworks/running/debugnub.nlg +102 -12
  21. package/frameworks/running/debugutil.nlg +30 -13
  22. package/frameworks/running/executors.nlg +64 -28
  23. package/frameworks/running/running.nlg +85 -3
  24. package/frameworks/running/sourcecode.nlg +3 -1
  25. package/frameworks/running/taskexec.nlg +24 -4
  26. package/frameworks/storage/dbt_pouch.nlg +30 -17
  27. package/frameworks/storage/file_manager.nlg +1 -1
  28. package/frameworks/storage/psm.nlg +11 -1
  29. package/frameworks/storage/psm_dbtables.nlg +21 -22
  30. package/frameworks/storage/resources.nlg +12 -4
  31. package/frameworks/storage/storage.nlg +2 -2
  32. package/lib/browser/env_web.js +6 -6
  33. package/lib/browser/env_webworker.js +2 -0
  34. package/lib/core/naanlib.js +5 -5
  35. package/lib/env_nodeworker.js +2 -0
  36. package/package.json +1 -1
  37. package/plugins/gitClient/gitClient.nlg +3 -3
  38. package/plugins/gitClient/gitutils.nlg +2 -2
  39. package/plugins/nodeLib/node_https.nlg +2 -2
  40. package/plugins/openSearch/openSearch.nlg +2 -2
  41. package/plugins/serviceAws/lambda_naan_control.nlg +3 -3
  42. package/plugins/serviceAws/psm_aws.nlg +4 -2
  43. package/plugins/serviceAws/serviceAws.nlg +1 -1
  44. package/plugins/serviceGC/gc_api.nlg +5 -5
  45. package/plugins/serviceGitHub/gitops.nlg +4 -3
  46. package/plugins/serviceGitHub/psm_github.nlg +1 -1
  47. package/plugins/serviceGitHub/serviceGitHub.nlg +1 -1
  48. package/plugins/serviceGitLab/gitops.nlg +2 -1
  49. package/plugins/serviceGitLab/psm_gitlab.nlg +2 -2
  50. package/plugins/serviceGitLab/serviceGitLab.nlg +1 -1
  51. package/plugins/serviceYC/yc_vm.nlg +1 -1
  52. package/test/harness.nlg +9 -9
  53. package/test/test_01_core.nlg +24 -2
  54. package/test/test_02_context.nlg +2 -2
  55. package/test/test_07_lingo.nlg +3 -3
  56. package/plugins/serviceGC/russian_trusted_root_ca_pem.crt +0 -33
@@ -38,10 +38,12 @@
38
38
 
39
39
  closure FSview(table, rootpath, local view) {
40
40
  global(JSpath)
41
- if !table
41
+ if !table || !string(rootpath)
42
42
  return (list(Error("invalid arguments")))
43
43
  view = new(object, this)
44
44
  view.table = table
45
+ if rootpath != "" && rootpath.slice(-1) != "/"
46
+ rootpath = rootpath.concat("/") // "" or "<path>/"
45
47
  view.rootpath = rootpath
46
48
  view.path = JSpath.posix // for view.path.join(), etc.
47
49
 
@@ -118,23 +120,21 @@ closure FSview(table, rootpath, local view) {
118
120
  // checkPathName
119
121
  //
120
122
  // Return a `(path, name) tuple for a directory, or false if callback executed due to error. The
121
- // name is the empty string if the path is empty. Path "/" has name "/". Otherwise the name is
122
- // the last segment of the path, omitting the trailing slash.
123
+ // name is the empty string if the path is empty. Path "/" has name "". Otherwise the name is the
124
+ // last segment of the path, omitting any trailing slash. A key invariant is that the information
125
+ // should be the same whether the pathname was part of the rootpath or specified in the source
126
+ // path to an operation. That is why this "steals" the rootpath name if needed.
123
127
  //
124
- function checkPathName(path, callback, local name, slashdex) {
125
- if path == ""
126
- name = ""
127
- else {
128
- if checkPath(path, callback)
129
- return (false) // non-string
130
- if path.slice(-1) != "/"
131
- path = path.concat("/") // force to be directory
132
- slashdex = path.lastIndexOf("/", path.length-2)
133
- if path == "/" || slashdex < 0
134
- name = path
135
- else
136
- name = path.slice(slashdex+1, -1) // omit trailing "/"
137
- }
128
+ function checkPathName(path, callback, local name) {
129
+ if checkPath(path, callback)
130
+ return (false) // non-string
131
+ if path != "" && path.slice(-1) != "/"
132
+ path = path.concat("/") // force to be directory
133
+ if path == "/" && rootpath != ""
134
+ name = rootpath // avoid making "//"
135
+ else
136
+ name = rootpath.concat(path)
137
+ name = name.split("/").slice(0,-1).pop() || "" // <|| ""> not needed
138
138
  list(path, name)
139
139
  }
140
140
 
@@ -683,7 +683,7 @@ closure FSview(table, rootpath, local view) {
683
683
  return // already executed callback with error
684
684
  dirdict = {
685
685
  name: name
686
- path: path
686
+ path: rootpath.concat(path)
687
687
  data: {
688
688
  platform: table.type
689
689
  semantics: "dbfs"
@@ -743,14 +743,13 @@ closure FSview(table, rootpath, local view) {
743
743
  `(path, name) = checkPathName(path, callback)
744
744
  if !path
745
745
  return // already executed callback with error
746
- options = { // ### might want to allow some options
746
+ options = merge({
747
747
  prefix: path
748
748
  deep: true
749
- }
750
- if name == "" && rootpath != ""
751
- name = rootpath.split("/").slice(0,-1).pop() || ""
749
+ }, options)
752
750
  treedict = {
753
751
  name: name
752
+ path: rootpath.concat(path)
754
753
  data: {
755
754
  platform: table.type
756
755
  semantics: "dbfs"
@@ -142,9 +142,14 @@ closure ResourceManager(dbname, prefix, local reman, watch, result) {
142
142
  reman.unWatch = watch.unWatch
143
143
  reman.dbname = dbname
144
144
  reman.conns = {}
145
- result = PouchDB(dbname)
145
+ try {
146
+ require("./dbt_pouch.nlg")
147
+ result = PouchDB(dbname)
148
+ } catch {
149
+ result = list(Error("PouchDB not available", exception))
150
+ }
146
151
  if result.0
147
- return (result) // can't access our vault database
152
+ return (list(result)) // can't access our vault database
148
153
  reman.db = result.1
149
154
 
150
155
  // vault
@@ -423,19 +428,22 @@ closure ResourceTracker(reman, local retor, watch) {
423
428
  // Start tracking resources.
424
429
  retor.open = function open() {
425
430
  if retor.classIdList
426
- return // already open
431
+ return (list(false, { open: true })) // already open
427
432
  watch.reset()
428
433
  retor.resids = { } // start empty
429
434
  retor.classIdList = []
430
435
  for classID in reman.connectors()
431
436
  addConnResources(classID)
432
437
  reman.watch(remanUpdateOnChange)
438
+ list(false, { ok: true })
433
439
  }
434
440
 
435
441
  // close
436
442
  //
437
443
  // stop tracking resources.
438
444
  retor.close = function close(local classID, connector) {
445
+ if !retor.classIdList
446
+ return (list(false, { open: false }))
439
447
  watch.reset()
440
448
  if retor.classIdList {
441
449
  for classID in retor.classIdList {
@@ -446,6 +454,7 @@ closure ResourceTracker(reman, local retor, watch) {
446
454
  }
447
455
  reman.unWatch(remanUpdateOnChange)
448
456
  retor.resids = false
457
+ list(false, { ok: true })
449
458
  }
450
459
 
451
460
  // finis
@@ -466,7 +475,6 @@ function rsrcInit(local manifest) {
466
475
 
467
476
  Naan.module.build(module.id, "resources", function(modobj, compobj) {
468
477
  require("./storage.nlg")
469
- require("./dbt_pouch.nlg")
470
478
  commonWatching = require("../common/watching.nlg")
471
479
  compobj.manifest = manifest
472
480
  module.exports.ResourceManager = ResourceManager
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * column positioning: // // !
8
8
  *
9
- * Copyright (c) 2020-2022 by Richard C. Zulch
9
+ * Copyright (c) 2020-2024 by Richard C. Zulch
10
10
  *
11
11
  */
12
12
 
@@ -26,7 +26,7 @@ function storInit(local manifest) {
26
26
  require("../common/common.nlg").LiveImport()
27
27
  require("../common/watching.nlg")
28
28
  compobj.manifest = manifest
29
- LoadComponentOnDemand(list(DbConnector, ListBrowserDBs, PouchDB), "./dbt_pouch.nlg")
29
+ LoadComponentOnDemand(list(DbConnector, ListBrowserDBs, PouchDB), "naanlib:storage/dbt_pouch.nlg")
30
30
 
31
31
 
32
32
  // storReload
@@ -536,7 +536,7 @@ exports.NaanControllerWeb = function() {
536
536
  statedoc.curversion = kStateCurrentVersion;
537
537
  statedoc.firstver = kStateFirstVersion;
538
538
  statedoc.licensee = "MIT-License";
539
- statedoc.verstring = "1.3.2+1";
539
+ statedoc.verstring = "1.4.1+1";
540
540
  statedoc.date = new Date().toISOString();
541
541
  statedoc.prefs = prefs;
542
542
  statedoc.naan = naanlib.saveState(false); // true to optimize, which is a bit slower
@@ -554,7 +554,7 @@ exports.NaanControllerWeb = function() {
554
554
  || statedoc.firstver > kStateCurrentVersion
555
555
  || statedoc.curversion < kStateFirstVersion
556
556
  || statedoc.licensee != "MIT-License"
557
- || statedoc.verstring != "1.3.2+1")
557
+ || statedoc.verstring != "1.4.1+1")
558
558
  {
559
559
  localStorage.removeItem("NaanState_Hosted");
560
560
  return (false);
@@ -613,7 +613,7 @@ exports.NaanControllerWeb = function() {
613
613
  op: "VsiteOpen",
614
614
  name: vsiteName,
615
615
  naancont: contSelf,
616
- title: vsiteName + " 1.3.2+1"
616
+ title: vsiteName + " 1.4.1+1"
617
617
  });
618
618
  }
619
619
  } catch (e) {
@@ -627,7 +627,7 @@ exports.NaanControllerWeb = function() {
627
627
  op: "VsiteClose",
628
628
  name: vsiteName,
629
629
  naancont: contSelf,
630
- title: vsiteName + " 1.3.2+1"
630
+ title: vsiteName + " 1.4.1+1"
631
631
  });
632
632
  termTextOut("\x1b[90m\x1b[3m".concat("\nwindow closed", "\x1b[0m\n"));
633
633
  }
@@ -642,8 +642,8 @@ exports.NaanControllerWeb = function() {
642
642
  naanlib.banner();
643
643
  var hostpath = window.location.origin.concat(naanlib.js.r("path").dirname(window.location.pathname));
644
644
  naanlib.start({
645
- cmd: 'App.version = "1.3.2+1";;\r\n'
646
- + 'App.cache = "a8f6e5b80d3b14e762d56efbef3ae771";;\r\n'
645
+ cmd: 'App.version = "1.4.1+1";;\r\n'
646
+ + 'App.cache = "e319a60c34bb3a4866dfc9f6c698b9aa";;\r\n'
647
647
  + 'Naan.module.requireQuery({ naanver: App.cache });;\r\n'
648
648
  + 'Naan.module.webparse("naan_init.nlg", "' + hostpath + '", { naanver: App.cache });;\r\n'
649
649
  });
@@ -145,6 +145,8 @@ exports.NaanControllerWebWorker = function NaanControllerWebWorker() {
145
145
  naanlib.textLine(msg.text); // keyboard text from terminal
146
146
  else if (msg.id == "start")
147
147
  { // start execution with optional state
148
+ targSelf.workerID = msg.workerID;
149
+ targSelf.workerGUID = msg.workerGUID;
148
150
  naanlib.banner();
149
151
  naanlib.start({
150
152
  state: msg.state,