@naanlang/naan 1.4.4 → 1.6.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 (61) hide show
  1. package/LICENSE.md +2 -2
  2. package/README.md +4 -4
  3. package/bin/index.js +25 -3
  4. package/dist/env_web.js +164 -22
  5. package/dist/naan.min.js +5 -5
  6. package/frameworks/browser/browser.nlg +2 -2
  7. package/frameworks/browser/https_request.nlg +2 -2
  8. package/frameworks/browser/sworker.js +28 -26
  9. package/frameworks/browser/terminals.nlg +342 -700
  10. package/frameworks/browser/worker.nlg +255 -0
  11. package/frameworks/browser/workers.nlg +5 -5
  12. package/frameworks/browser/ws_client.nlg +15 -10
  13. package/frameworks/client/apiclient.nlg +204 -19
  14. package/frameworks/client/client.nlg +22 -2
  15. package/frameworks/client/psm_client.nlg +12 -3
  16. package/frameworks/client/relaycon.nlg +87 -161
  17. package/frameworks/common/events.nlg +101 -0
  18. package/frameworks/common/repltools.nlg +80 -1
  19. package/frameworks/node/apiserver.nlg +39 -246
  20. package/frameworks/node/filesystem.nlg +39 -12
  21. package/frameworks/node/gitter.nlg +9 -7
  22. package/frameworks/node/http_request.nlg +34 -13
  23. package/frameworks/node/https_request.nlg +8 -3
  24. package/frameworks/node/node.nlg +2 -0
  25. package/frameworks/node/pty.nlg +346 -0
  26. package/frameworks/node/shell.nlg +4 -4
  27. package/frameworks/node/worker.nlg +409 -539
  28. package/frameworks/node/ws_client.nlg +2 -2
  29. package/frameworks/project/build.nlg +1 -1
  30. package/frameworks/project/projects.nlg +2 -1
  31. package/frameworks/running/debugnub.nlg +17 -4
  32. package/frameworks/running/executors.nlg +27 -274
  33. package/frameworks/running/instances.nlg +393 -0
  34. package/frameworks/running/remote_req.nlg +143 -0
  35. package/frameworks/running/remote_res.nlg +89 -0
  36. package/frameworks/running/taskexec.nlg +2 -2
  37. package/frameworks/service/imp.nlg +736 -0
  38. package/frameworks/service/model.nlg +71 -0
  39. package/frameworks/service/nubnode.nlg +105 -0
  40. package/frameworks/service/nubweb.nlg +106 -0
  41. package/frameworks/service/service.nlg +28 -0
  42. package/frameworks/storage/dbt_pouch.nlg +26 -13
  43. package/frameworks/storage/psm.nlg +39 -5
  44. package/frameworks/storage/psm_dbtables.nlg +10 -2
  45. package/lib/browser/env_web.js +171 -29
  46. package/lib/browser/env_webworker.js +91 -5
  47. package/lib/core/naanlib.js +5 -5
  48. package/lib/env_node.js +184 -8
  49. package/lib/env_nodeworker.js +74 -1
  50. package/package.json +1 -1
  51. package/plugins/serviceAws/aws_cloudwatchlogs.nlg +2 -1
  52. package/plugins/serviceAws/aws_dynamo.nlg +1 -0
  53. package/plugins/serviceAws/aws_s3.nlg +3 -3
  54. package/plugins/serviceAws/aws_sqs.nlg +3 -1
  55. package/plugins/serviceAws/aws_utils.nlg +3 -1
  56. package/plugins/serviceAws/dbt_aws.nlg +22 -20
  57. package/plugins/serviceAws/psm_aws.nlg +2 -1
  58. package/plugins/serviceNexara/speechrec.nlg +10 -6
  59. package/test/test_02_context.nlg +24 -1
  60. package/test/test_03_jsinterop.nlg +32 -3
  61. package/plugins/serviceGC/russian_trusted_root_ca_pem.crt +0 -33
@@ -100,7 +100,7 @@ closure NexaraSpeechRec(local nxspr) {
100
100
  // Convert a Nexara response to a Yandex SpeechKit structure. Hey, it was first.
101
101
  //
102
102
  function nexaraToYCSK(resp,
103
- local output, wordx, segment, chunk, word, wordet) {
103
+ local output, wordx, segment, chunk, syncerror, word, wordet, wordtrim, tstart) {
104
104
  output = {
105
105
  \@type: "type.googleapis.com/yandex.cloud.ai.stt.v2.LongRunningRecognitionResponse"
106
106
  chunks: []
@@ -120,14 +120,18 @@ closure NexaraSpeechRec(local nxspr) {
120
120
  ]
121
121
  }
122
122
  for word in segment.text.split(" ") {
123
+ if word == ""
124
+ continue // ignore extra spaces
123
125
  wordet = resp.words[wordx++]
124
- if wordet.word != word {
125
- debuglog("nexaraToYCSK: expected ${word} but got ${wordet.word}")
126
- return (false)
126
+ wordtrim = wordet.word.trim() // detected word without spaces
127
+ tstart = wordet.start.toFixed(3).concat("s")
128
+ if !syncerror && wordtrim != word {
129
+ syncerror = true
130
+ debuglog("nexaraToYCSK: warning: at ${tstart} expected '${word}' but got '${wordtrim}'")
127
131
  }
128
132
  chunk.alternatives.0.words.push({
129
- word: wordet.word
130
- startTime: wordet.start.toFixed(3).concat("s")
133
+ word: wordtrim
134
+ startTime: tstart
131
135
  endTime: wordet.end.toFixed(3).concat("s")
132
136
  })
133
137
  }
@@ -265,5 +265,28 @@ RegisterTestCategory("context", [
265
265
  [ "closure Xx(y, local xx) { xx = new(object, this) };", "Xx" ],
266
266
  [ "x = Xx(33);", "{object Xx}" ],
267
267
  [ "car(x@\\.closure.proc.2.0)", "33" ],
268
- [ "new(object, 3)@*", "false" ]
268
+ [ "new(object, 3)@*", "false" ],
269
+
270
+ //
271
+ // undefined objects
272
+ //
273
+
274
+ [ "closure undef(local o) {\n"
275
+ " o = new(object, undef)\n"
276
+ " put(o,'.undefined', function udef args {\n"
277
+ " print('udef:', args)\n"
278
+ " })\n"
279
+ " o\n"
280
+ "};", "undef" ],
281
+ [ "oo = undef();", "{object undef}"],
282
+ [ "closure(c) {\n"
283
+ "xset(c, joe2, macro mjoe args {\n"
284
+ " printline(args)\n"
285
+ " deref(c, joe, args)\n"
286
+ "})\n"
287
+ "}(oo);>", "(macro mjoe args (printline args) (deref c joe args))"],
288
+ [ "oo.joe(8,2+5);", "udef:(joe 8 7)|(joe, 8, 7)" ],
289
+ [ "oo.joe2(5,9+3);", "(5 (+ 9 3))|udef:(joe 5 (+ 9 3))|(joe, 5, 9+3)" ],
290
+ [ "dargs = list(3,quote(2+4));", "(3, 2+4)"],
291
+ [ "deref(oo, joe, dargs);", "udef:(joe 3 (+ 2 4))|(joe, 3, 2+4)"]
269
292
  ]);
@@ -35,11 +35,11 @@ RegisterTestCategory("JSinterop", [
35
35
 
36
36
  [ "o(3);", {
37
37
  "dev": { errors: "xcall \"[object Object]\": TypeError: object.apply is not a function" }
38
- "prod": { errors: "xcall \"[object Object]\": TypeError: r[3].apply is not a function" }
38
+ "prod": { errors: "xcall \"[object Object]\": TypeError: e[3].apply is not a function" }
39
39
  }[ "prod"]],
40
40
  [ "o(Number);", {
41
41
  "dev": { errors: "xcall \"[object Object]\": TypeError: object.apply is not a function" }
42
- "prod": { errors: "xcall \"[object Object]\": TypeError: r[3].apply is not a function" }
42
+ "prod": { errors: "xcall \"[object Object]\": TypeError: e[3].apply is not a function" }
43
43
  }[ "prod"]],
44
44
  [ "Number(3);", "[Number 3]" ],
45
45
  [ "Number(3).toString();", "\"3\"" ],
@@ -158,6 +158,35 @@ RegisterTestCategory("JSinterop", [
158
158
  " } }" ],
159
159
 
160
160
  [ "function&(top,local nth){ nth=0, loop { print(nth), closure(nth) { stacktrap(nth,function&(x) { print(\" loop-\",x,\"-\",nth) }) }(nth), if nth >= top break else nth = nth+1 }, }(9);",
161
- "0 loop-Dictionary{0}-01 loop-Dictionary{0}-123456789 loop-true-2 loop-true-3 loop-true-4 loop-true-5 loop-true-6 loop-true-7 loop-true-8 loop-true-9|true" ]
161
+ "0 loop-Dictionary{0}-01 loop-Dictionary{0}-123456789 loop-true-2 loop-true-3 loop-true-4 loop-true-5 loop-true-6 loop-true-7 loop-true-8 loop-true-9|true" ],
162
+
163
+ //
164
+ // Callbacks
165
+ //
166
+
167
+ [ "function mycb() { mynon.wait(), 15 };", "mycb"],
168
+ [ "oocb=xnew()", "[object Object]" ],
169
+ [ "oocb.mycb=mycb.proc;>", "(function mycb false (`. mynon wait false) 15)" ],
170
+ [ "oocb.mycb();", "15" ],
171
+ [ "mynon = new(nonce);", "Nonce{3}" ],
172
+ [ "oocb.mycb();", "true" ],
173
+
174
+ [ "@\\.suspend = 7", "7" ],
175
+ [ "function mycb() { mynon.wait(), 16 };", "==> redefined: mycb|mycb"],
176
+ [ "oocb.mycb=mycb.proc;>", "(function mycb false (`. mynon wait false) 16)" ],
177
+ [ "oocb.mycb();", "7" ],
178
+
179
+ //
180
+ // JavaScript compiled functions
181
+ //
182
+
183
+ [ "putproc(`arbyarb, 'return(_lib.pl(narg,nthf));');", "[Compiled arbyarb]" ],
184
+ [ "arbyarb(3,5,2,4);", "3524|4" ],
185
+
186
+ [ "putproc(`bobbuiltin, 'builtin: return(_lib.j2n(_lib.n2j(cx)+_lib.n2j(cy)+_lib.n2j(cz)));');", "[Compiled bobbuiltin]" ],
187
+ [ "bobbuiltin(1,2,3,4);", "6" ],
188
+
189
+ [ "putproc(`joemacro, 'macro: _lib.idle();return(_lib.j2n(_lib.n2j(args[1])(_lib.n2j(args[2][1]))));');", "[Compiled joemacro]" ],
190
+ [ "joemacro(function(x){x+1}, 8);", "9" ]
162
191
 
163
192
  ]);
@@ -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
- z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