@naanlang/naan 1.3.2 → 1.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.
- package/LICENSE.md +1 -1
- package/README.md +1 -1
- package/bin/index.js +2 -2
- package/dist/naan.min.js +4 -4
- package/frameworks/browser/sworker.js +23 -23
- package/frameworks/browser/terminals.nlg +25 -10
- package/frameworks/browser/ws_client.nlg +1 -1
- package/frameworks/client/psm_client.nlg +1 -1
- package/frameworks/client/relaycon.nlg +2 -1
- package/frameworks/common/preferences.nlg +1 -1
- package/frameworks/node/apiserver.nlg +3 -3
- package/frameworks/node/worker.nlg +103 -45
- package/frameworks/project/build.nlg +0 -1
- package/frameworks/project/jszip.js +0 -0
- package/frameworks/project/projects.nlg +1 -1
- package/frameworks/running/executors.nlg +64 -28
- package/frameworks/running/running.nlg +85 -3
- package/frameworks/running/taskexec.nlg +24 -4
- package/frameworks/storage/dbt_pouch.nlg +1 -1
- package/frameworks/storage/psm.nlg +11 -1
- package/lib/browser/env_web.js +6 -6
- package/lib/browser/env_webworker.js +2 -0
- package/lib/core/naanlib.js +4 -4
- package/lib/env_nodeworker.js +2 -0
- package/package.json +1 -1
- package/plugins/gitClient/gitutils.nlg +2 -2
- package/plugins/nodeLib/node_https.nlg +2 -2
- package/plugins/serviceAws/lambda_naan_control.nlg +3 -3
- package/plugins/serviceGC/gc_api.nlg +1 -1
- package/plugins/serviceGitHub/gitops.nlg +4 -3
- package/plugins/serviceGitHub/psm_github.nlg +1 -1
- package/plugins/serviceGitLab/gitops.nlg +2 -1
- package/plugins/serviceGitLab/psm_gitlab.nlg +1 -1
- package/plugins/serviceYC/yc_vm.nlg +1 -1
- package/test/test_02_context.nlg +1 -1
- package/test/test_07_lingo.nlg +3 -3
package/lib/env_nodeworker.js
CHANGED
|
@@ -164,6 +164,8 @@ exports.NaanWorkerActivate = function NaanWorkerActivate(cbReady) {
|
|
|
164
164
|
naanlib.textLine(msg.text); // keyboard text from terminal
|
|
165
165
|
else if (msg.id == "start")
|
|
166
166
|
{ // start execution with optional state
|
|
167
|
+
workSelf.workerID = msg.workerID;
|
|
168
|
+
workSelf.workerGUID = msg.workerGUID;
|
|
167
169
|
if (typeof(__dirname) !== "undefined")
|
|
168
170
|
naanlib.js.h = naanlib.js.d; // set host directory path
|
|
169
171
|
if (msg.dirpath)
|
package/package.json
CHANGED
|
@@ -213,7 +213,7 @@ closure GitTree(local fs, reporoot, gtree, repodir, stagedir) {
|
|
|
213
213
|
closure fileHash(fspath, callback) {
|
|
214
214
|
if !callback
|
|
215
215
|
return (syncAdapter(fileHash, fspath))
|
|
216
|
-
fs.readFile(fspath, false, function(error, strdata
|
|
216
|
+
fs.readFile(fspath, false, function(error, strdata) {
|
|
217
217
|
if error
|
|
218
218
|
callback(error)
|
|
219
219
|
else
|
|
@@ -1025,7 +1025,7 @@ closure GitTree(local fs, reporoot, gtree, repodir, stagedir) {
|
|
|
1025
1025
|
|
|
1026
1026
|
// comrecur
|
|
1027
1027
|
// Recursively copy portions of tree that should be in commit.
|
|
1028
|
-
function comrecur(input, parpath, chout, local node, nodout, path
|
|
1028
|
+
function comrecur(input, parpath, chout, local node, nodout, path) {
|
|
1029
1029
|
for node in input {
|
|
1030
1030
|
nodout = { name: node.name }
|
|
1031
1031
|
path = joinode(parpath, node)
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
closure HttpsGetJson(hostname, pathname, query, local
|
|
20
|
+
closure HttpsGetJson(hostname, pathname, query, local options, pending, req) {
|
|
21
21
|
if query
|
|
22
22
|
pathname = EncodeQuery(pathname.concat("?"), query)
|
|
23
23
|
debuglog("HttpsGetJson", hostname, pathname)
|
|
@@ -55,7 +55,7 @@ closure HttpsGetJson(hostname, pathname, query, local https, options, pending, r
|
|
|
55
55
|
*/
|
|
56
56
|
|
|
57
57
|
closure HttpsDownloadFile(hostname, pathname, query, filepath,
|
|
58
|
-
local
|
|
58
|
+
local error, pending, writeStream, options, req)
|
|
59
59
|
{
|
|
60
60
|
filepath = nodePath.resolve("/tmp", filepath)
|
|
61
61
|
if query
|
|
@@ -33,7 +33,7 @@ closure lancoRest(local url, client) {
|
|
|
33
33
|
request.addEventListener("error", function reqFailed(event, local errtext) {
|
|
34
34
|
if request.status == 0
|
|
35
35
|
errtext = "connectivity"
|
|
36
|
-
|
|
36
|
+
else
|
|
37
37
|
errtext = "request failed"
|
|
38
38
|
error = Error(errtext, {
|
|
39
39
|
status: request.status
|
|
@@ -92,7 +92,7 @@ closure lancoWs(local url, laws) {
|
|
|
92
92
|
// onmessage
|
|
93
93
|
// A message was received from the worker via WebSockets.
|
|
94
94
|
|
|
95
|
-
laws.ws.onmessage = function onmessage(e
|
|
95
|
+
laws.ws.onmessage = function onmessage(e) {
|
|
96
96
|
laws.doMessage(e.data)
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -114,7 +114,7 @@ closure lancoWs(local url, laws) {
|
|
|
114
114
|
// doMessage
|
|
115
115
|
//
|
|
116
116
|
// Process the specified undecoded message.
|
|
117
|
-
laws.doMessage = function doMessage(text, local message
|
|
117
|
+
laws.doMessage = function doMessage(text, local message) {
|
|
118
118
|
try {
|
|
119
119
|
message = new(JSONparse(text))
|
|
120
120
|
} catch {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
closure GcApi(options, local gcapi, cacert, renew, access_token, expires_at) {
|
|
29
|
-
global(https, JSpath)
|
|
29
|
+
global(js, https, JSpath)
|
|
30
30
|
gcapi = new(object, this)
|
|
31
31
|
if options.preview {
|
|
32
32
|
gcapi.urlbase = "https://gigachat-preview.devices.sberbank.ru/api/v1/"
|
|
@@ -244,7 +244,7 @@ closure GitHubRepo(access, repodict, local gepo, url) {
|
|
|
244
244
|
// Return a list of commits in the repo, optionally matching the specified file path.
|
|
245
245
|
//
|
|
246
246
|
//
|
|
247
|
-
gepo.commits = closure commits(filepath, local pardict, query
|
|
247
|
+
gepo.commits = closure commits(filepath, local pardict, query) {
|
|
248
248
|
pardict = {
|
|
249
249
|
per_page: 100
|
|
250
250
|
}
|
|
@@ -420,7 +420,8 @@ closure GitHubRepo(access, repodict, local gepo, url) {
|
|
|
420
420
|
// ref: <commit> - branch, tag or commit hash, default to main branch
|
|
421
421
|
// }
|
|
422
422
|
//
|
|
423
|
-
gepo.readfile = closure readfile(filepath, options
|
|
423
|
+
gepo.readfile = closure readfile(filepath, options
|
|
424
|
+
local ref, params, query) {
|
|
424
425
|
if !string(filepath)
|
|
425
426
|
return (list(Error("filepath must be a string:", filepath)))
|
|
426
427
|
ref = options.ref
|
|
@@ -489,7 +490,7 @@ closure GitHubRepo(access, repodict, local gepo, url) {
|
|
|
489
490
|
|
|
490
491
|
gtopParseLinkHeaderRegExp;
|
|
491
492
|
|
|
492
|
-
function gtopParseLinkHeader(header, local
|
|
493
|
+
function gtopParseLinkHeader(header, local output) {
|
|
493
494
|
if !jsInstanceOf(gtopParseLinkHeaderRegExp, RegExp.prototype)
|
|
494
495
|
gtopParseLinkHeaderRegExp = RegExp('<([^?]+\\?[=\\w&?]+page=(\\d+))>;\\s*rel="(\\w+)"', 'g')
|
|
495
496
|
output = { }
|
|
@@ -183,7 +183,7 @@ closure phubConnector(psm, local connClassID, connector, watch) {
|
|
|
183
183
|
//
|
|
184
184
|
// Connect to an ghub bucket filesystem, returning a view.
|
|
185
185
|
|
|
186
|
-
connector.connect = function connect(resID, service, args, local error, ghub, gitremote
|
|
186
|
+
connector.connect = function connect(resID, service, args, local error, ghub, gitremote) {
|
|
187
187
|
`(error, ghub) = connector.access(resID)
|
|
188
188
|
if !error
|
|
189
189
|
`(error, gitremote) = GitHubOps(ghub) // get GitHub as a git remote
|
|
@@ -464,7 +464,8 @@ closure GitLabRepo(access, repodict, local gepo, url) {
|
|
|
464
464
|
// head: <boolean> - true to obtain metadata only without contents
|
|
465
465
|
// }
|
|
466
466
|
//
|
|
467
|
-
gepo.readfile = closure readfile(filepath, options
|
|
467
|
+
gepo.readfile = closure readfile(filepath, options
|
|
468
|
+
local ref, params, query, method) {
|
|
468
469
|
if !string(filepath)
|
|
469
470
|
return (list(Error("filepath must be a string:", filepath)))
|
|
470
471
|
ref = options.ref
|
|
@@ -183,7 +183,7 @@ closure plabConnector(psm, local connClassID, connector, watch) {
|
|
|
183
183
|
//
|
|
184
184
|
// Connect to an GitLab filesystem.
|
|
185
185
|
|
|
186
|
-
connector.connect = function connect(resID, service, args, local error, glab, gitremote
|
|
186
|
+
connector.connect = function connect(resID, service, args, local error, glab, gitremote) {
|
|
187
187
|
`(error, glab) = connector.access(resID)
|
|
188
188
|
if !error
|
|
189
189
|
`(error, gitremote) = GitLabOps(glab) // get GitLab as a git remote
|
package/test/test_02_context.nlg
CHANGED
|
@@ -263,7 +263,7 @@ RegisterTestCategory("context", [
|
|
|
263
263
|
//
|
|
264
264
|
|
|
265
265
|
[ "closure Xx(y, local xx) { xx = new(object, this) };", "Xx" ],
|
|
266
|
-
[ "x = Xx(33);", "
|
|
266
|
+
[ "x = Xx(33);", "{object Xx}" ],
|
|
267
267
|
[ "car(x@\\.closure.proc.2.0)", "33" ],
|
|
268
268
|
[ "new(object, 3)@*", "false" ]
|
|
269
269
|
]);
|
package/test/test_07_lingo.nlg
CHANGED
|
@@ -646,18 +646,18 @@ RegisterTestCategory("Lingo", [
|
|
|
646
646
|
[ "closure myob(initv, local myob) {\n"
|
|
647
647
|
" myob = new(object)\n"
|
|
648
648
|
" myob.value = initv\n"
|
|
649
|
-
" myob
|
|
649
|
+
" myob@\\.tostring = function \\.tostring(obj) {\n"
|
|
650
650
|
" \"myob-\".concat(myob.value) }\n"
|
|
651
651
|
" myob };",
|
|
652
652
|
"myob" ],
|
|
653
|
-
[ "myob(3);>", "Object{
|
|
653
|
+
[ "myob(3);>", "Object{1}" ],
|
|
654
654
|
[ "myob(3);", "myob-3" ],
|
|
655
655
|
|
|
656
656
|
//
|
|
657
657
|
// dialects
|
|
658
658
|
//
|
|
659
659
|
|
|
660
|
-
[ "dt = Dialect.derive('test');", "
|
|
660
|
+
[ "dt = Dialect.derive('test');", "{object dialect}" ],
|
|
661
661
|
[ "dt.redefine(`^, function(x,y,local z) {z=1,while y-- > 0 z *= x,z});", "^" ],
|
|
662
662
|
[ "$$ = dt.parse(new(textstream, '2^9;'));", "(false, 2^9)" ],
|
|
663
663
|
[ "eval($$);", "(false, 512)" ],
|