@naanlang/naan 1.4.0 → 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 (39) 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 +1 -1
  7. package/frameworks/client/psm_client.nlg +2 -0
  8. package/frameworks/client/relaycon.nlg +1 -1
  9. package/frameworks/common/common.nlg +5 -2
  10. package/frameworks/node/filesystem.nlg +5 -4
  11. package/frameworks/node/psm_server.nlg +1 -1
  12. package/frameworks/node/shell.nlg +134 -0
  13. package/frameworks/node/worker.nlg +1 -1
  14. package/frameworks/project/build.nlg +1 -1
  15. package/frameworks/project/projects.nlg +1 -1
  16. package/frameworks/running/debugnub.nlg +102 -12
  17. package/frameworks/running/debugutil.nlg +30 -13
  18. package/frameworks/running/running.nlg +2 -2
  19. package/frameworks/running/sourcecode.nlg +3 -1
  20. package/frameworks/storage/dbt_pouch.nlg +29 -16
  21. package/frameworks/storage/file_manager.nlg +1 -1
  22. package/frameworks/storage/psm_dbtables.nlg +21 -22
  23. package/frameworks/storage/resources.nlg +12 -4
  24. package/frameworks/storage/storage.nlg +2 -2
  25. package/lib/browser/env_web.js +6 -6
  26. package/lib/core/naanlib.js +5 -5
  27. package/package.json +1 -1
  28. package/plugins/gitClient/gitClient.nlg +3 -3
  29. package/plugins/openSearch/openSearch.nlg +2 -2
  30. package/plugins/serviceAws/psm_aws.nlg +4 -2
  31. package/plugins/serviceAws/serviceAws.nlg +1 -1
  32. package/plugins/serviceGC/gc_api.nlg +4 -4
  33. package/plugins/serviceGitHub/serviceGitHub.nlg +1 -1
  34. package/plugins/serviceGitLab/psm_gitlab.nlg +1 -1
  35. package/plugins/serviceGitLab/serviceGitLab.nlg +1 -1
  36. package/test/harness.nlg +9 -9
  37. package/test/test_01_core.nlg +24 -2
  38. package/test/test_02_context.nlg +1 -1
  39. package/plugins/serviceGC/russian_trusted_root_ca_pem.crt +0 -33
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naanlang/naan",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "author": "Richard C. Zulch",
5
5
  "description": "Naan™ software platform",
6
6
  "main": "./lib/core/naanlib.js",
@@ -54,9 +54,9 @@ function gitcInit(local manifest) {
54
54
  })
55
55
  nideCommon = require("nideCommon/nideCommon.nlg")
56
56
  letimport(nideCommon)
57
- require("plugins/gitClient/clientops.nlg")
58
- require("plugins/gitClient/gitutils.nlg")
59
- gitcRequireJS("plugins/gitClient/minimatch.js", function(error, result) {
57
+ require("./clientops.nlg")
58
+ require("./gitutils.nlg")
59
+ gitcRequireJS("./minimatch.js", function(error, result) {
60
60
  if error
61
61
  ErrorDebugLog(error)
62
62
  })
@@ -567,8 +567,8 @@ function opseInit(local manifest) {
567
567
 
568
568
  Naan.module.build(module.id, "openSearch", function(modobj, compobj) {
569
569
  compobj.manifest = manifest
570
- require("frameworks/common").LiveImport()
571
- letimport(require("frameworks/node/https_request.nlg"))
570
+ require("naanlib:frameworks/common").LiveImport()
571
+ letimport(require("naanlib:frameworks/node/https_request.nlg"))
572
572
  modobj.exports.OpenSearchClient = OpenSearchClient
573
573
  })
574
574
  } ();
@@ -252,6 +252,8 @@ closure psmaConnector(psm, local connClassID, connector, watch) {
252
252
 
253
253
  connector.connect = function connect(resID, service, args,
254
254
  local error, s3b, db, rootpath, table) {
255
+ if !resID || args && !tuple(args)
256
+ return (list(Error("invalid arguments")))
255
257
  `(error, s3b) = connector.access(resID)
256
258
  if !error
257
259
  `(error, db) = S3DB(s3b, args.1) // get S3 bucket as a database
@@ -262,12 +264,12 @@ closure psmaConnector(psm, local connClassID, connector, watch) {
262
264
  else if service == "NideFS" {
263
265
  rootpath = args.0 // connect to a NideFS filesystem
264
266
  if !rootpath
265
- return (Error("mandatory rootpath missing"))
267
+ return (list(Error("mandatory rootpath missing")))
266
268
  `(error, table) = db.table(rootpath, args.1) // args.1 is table options; see dawsTable
267
269
  if error
268
270
  list(error)
269
271
  else
270
- require("frameworks/storage/psm_dbtables.nlg").FSview(table, rootpath)
272
+ require("naanlib:frameworks/storage/psm_dbtables.nlg").FSview(table, rootpath)
271
273
  } else
272
274
  list(Error("unsupported service", service))
273
275
  }
@@ -23,7 +23,7 @@ function sawsInit(local manifest) {
23
23
 
24
24
  Naan.module.build(module.id, "serviceAws", function(modobj, compobj) {
25
25
  compobj.manifest = manifest
26
- require("frameworks/common").LiveImport()
26
+ require("naanlib:frameworks/common").LiveImport()
27
27
  require("./aws_utils.nlg")
28
28
  function sawsPostload() {
29
29
  if js.g
@@ -74,7 +74,7 @@ closure GcApi(options, local gcapi, cacert, renew, access_token, expires_at) {
74
74
  //
75
75
  // Make an HTTPS request on the API, renewing the access token first if needed.
76
76
  //
77
- closure request(url, put, local error, data, status) {
77
+ closure request(url, put, sseHook, local error, data, status) {
78
78
  if !(milliseconds() < expires_at - 60000) {
79
79
  `(error, data) = auth(renew)
80
80
  if error
@@ -87,7 +87,7 @@ closure GcApi(options, local gcapi, cacert, renew, access_token, expires_at) {
87
87
  `(Accept, "application/json"),
88
88
  list(`Authorization, "Bearer ".concat(access_token))
89
89
  ]
90
- sseHook: options.sseHook || undefined
90
+ sseHook: sseHook || options.sseHook || undefined
91
91
  })
92
92
  if error
93
93
  list(error)
@@ -172,13 +172,13 @@ closure GcApi(options, local gcapi, cacert, renew, access_token, expires_at) {
172
172
  // object: <string>
173
173
  // }
174
174
  //
175
- gcapi.chatCompletion = closure chatCompletion(query) {
175
+ gcapi.chatCompletion = closure chatCompletion(query, sseHook) {
176
176
  if options.preview {
177
177
  query = new(query)
178
178
  if !query.model.endsWith("-preview")
179
179
  query.model = query.model.concat("-preview")
180
180
  }
181
- request(gcapi.urlbase.concat("chat/completions"), query)
181
+ request(gcapi.urlbase.concat("chat/completions"), query, sseHook)
182
182
  }
183
183
 
184
184
  // uploadFile
@@ -60,6 +60,6 @@ function ghubInit(local manifest) {
60
60
  Naan.module.build(module.id, "serviceGitHub", function(modobj, compobj) {
61
61
  compobj.manifest = manifest
62
62
  })
63
- require("frameworks/common", { in: naanlib }).LiveImport()
63
+ require("naanlib:frameworks/common").LiveImport()
64
64
  require("./psm_github.nlg").GitHubConnector(App.psm)
65
65
  } ();
@@ -20,7 +20,7 @@
20
20
 
21
21
  closure plabConnector(psm, local connClassID, connector, watch) {
22
22
  connClassID = "GLAB"
23
- require("plugins/serviceGitLab/gitops.nlg")
23
+ require("./gitops.nlg")
24
24
  connector = new(object, this)
25
25
  connector.psm = psm
26
26
  connector.vault = psm.vault(connClassID)
@@ -60,6 +60,6 @@ function glabInit(local manifest) {
60
60
  Naan.module.build(module.id, "serviceGitLab", function(modobj, compobj) {
61
61
  compobj.manifest = manifest
62
62
  })
63
- require("frameworks/common", { in: naanlib }).LiveImport()
63
+ require("naanlib:frameworks/common").LiveImport()
64
64
  require("./psm_gitlab.nlg").GitLabConnector(App.psm)
65
65
  } ();
package/test/harness.nlg CHANGED
@@ -83,15 +83,15 @@ closure Parsenv(name, local penv, gohome, lingo, naansym) {
83
83
  `(errors, expr) = lingo.parse(source)
84
84
  for error in errors
85
85
  output.errors.push(penv.lib.ParseErrorString(error))
86
- if expr {
87
- output.exprs.push(expr)
88
- expr = function() { evalactive(expr) }() // return here if return executed outside procedure
89
- output.results.push(expr)
90
- if source.tokenlast().atom == `;>
91
- output.pretty.push(tostring(expr, { quote: true }))
92
- else if source.tokenlast().atom != `;;
93
- output.pretty.push(lingo.print(expr))
94
- }
86
+ output.exprs.push(expr)
87
+ expr = function() { evalactive(expr) }() // return here if return executed outside procedure
88
+ output.results.push(expr)
89
+ if expr === Naan.local.mu
90
+ { }
91
+ else if source.tokenlast().atom == `;>
92
+ output.pretty.push(tostring(expr, { quote: true }))
93
+ else if source.tokenlast().atom != `;;
94
+ output.pretty.push(lingo.print(expr))
95
95
  } finally {
96
96
  sudo(putproc(`exception, savex)) }
97
97
  }
@@ -23,7 +23,7 @@ RegisterTestCategory("core", [
23
23
  // booleans and/or undefined
24
24
  //
25
25
 
26
- [ "false;", "" ],
26
+ [ "false;", "false" ],
27
27
  [ "true;", "true" ],
28
28
  [ "not true;", "false" ],
29
29
  [ "not false;", "true" ],
@@ -61,9 +61,16 @@ RegisterTestCategory("core", [
61
61
  [ "lambda(unintern(\"lambda\"));", "true" ],
62
62
 
63
63
  [ "car(`;);", ";" ],
64
+
65
+ [ "null;", "null" ],
66
+ [ "null();", "(null)" ],
67
+ [ "mu;", "mu" ],
68
+ [ "mu();", "" ],
69
+ [ "mu.tostring;", '"mu"' ],
70
+ [ "mu().tostring;", '"mu"' ],
64
71
 
65
72
  //
66
- // basic lists and dotted pairs
73
+ // basic tuples and dotted pairs
67
74
  //
68
75
 
69
76
  [ "`();>", "false" ],
@@ -82,6 +89,21 @@ RegisterTestCategory("core", [
82
89
  [ "`((a . b) . (c d));>", "((a . b) c d)" ],
83
90
  [ "`((a b) . (c . d));>", "((a b) c . d)" ],
84
91
 
92
+ //
93
+ // tuple manipulation
94
+ //
95
+
96
+ [ "append(`(a,b,c), d, `(e,f));>", "(a b c d e f)" ],
97
+ [ "append(`(3), `((4)));>", "(3 (4))" ],
98
+ [ "append(`(3), 5);>", "(3 5)" ],
99
+ [ "append(3, 4, 5);>", "(3 4 5)" ],
100
+
101
+ [ "subatq(list(a,3), list(a, 4));", "list(4, 3)" ],
102
+ [ "subatq(list(a,3), [list(a, 4)]);", "list(4, 3)" ],
103
+ [ "subatq(function joe(x) { 4*x }, [list(joe, bob), list(x,y)]);>",
104
+ "(Lib::defproc function bob (y) (* 4 y))" ],
105
+ [ "subat(list(a, { b: c }, [d, e]), [list(a,1), list(b,2), list(c,3), list(e,d), list(d,e)]);",
106
+ "(1, { 2: 3 }, [e, d])" ],
85
107
 
86
108
  //
87
109
  // assignment
@@ -38,7 +38,7 @@ RegisterTestCategory("context", [
38
38
  [ "function setNS(ns) { ns=reverse(ns),sudo(nsactive(reverse(ns, defNS))) };", "setNS" ],
39
39
  [ "x;", "x" ],
40
40
  [ "y;", "y" ],
41
- [ "length(symlist(nsactive(true).0));", "171"],
41
+ [ "length(symlist(nsactive(true).0));", "173"],
42
42
  [ "testvar;", "testvar" ],
43
43
  [ "function setTestvar(v) { testvar=v };", "setTestvar" ],
44
44
  [ "naanvar;", "naanvar" ],
@@ -1,33 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIFwjCCA6qgAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwcDELMAkGA1UEBhMCUlUx
3
- PzA9BgNVBAoMNlRoZSBNaW5pc3RyeSBvZiBEaWdpdGFsIERldmVsb3BtZW50IGFu
4
- ZCBDb21tdW5pY2F0aW9uczEgMB4GA1UEAwwXUnVzc2lhbiBUcnVzdGVkIFJvb3Qg
5
- Q0EwHhcNMjIwMzAxMjEwNDE1WhcNMzIwMjI3MjEwNDE1WjBwMQswCQYDVQQGEwJS
6
- VTE/MD0GA1UECgw2VGhlIE1pbmlzdHJ5IG9mIERpZ2l0YWwgRGV2ZWxvcG1lbnQg
7
- YW5kIENvbW11bmljYXRpb25zMSAwHgYDVQQDDBdSdXNzaWFuIFRydXN0ZWQgUm9v
8
- dCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMfFOZ8pUAL3+r2n
9
- qqE0Zp52selXsKGFYoG0GM5bwz1bSFtCt+AZQMhkWQheI3poZAToYJu69pHLKS6Q
10
- XBiwBC1cvzYmUYKMYZC7jE5YhEU2bSL0mX7NaMxMDmH2/NwuOVRj8OImVa5s1F4U
11
- zn4Kv3PFlDBjjSjXKVY9kmjUBsXQrIHeaqmUIsPIlNWUnimXS0I0abExqkbdrXbX
12
- YwCOXhOO2pDUx3ckmJlCMUGacUTnylyQW2VsJIyIGA8V0xzdaeUXg0VZ6ZmNUr5Y
13
- Ber/EAOLPb8NYpsAhJe2mXjMB/J9HNsoF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