@naanlang/naan 1.3.1 → 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 +3 -3
- 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 +26 -11
- package/frameworks/browser/workers.nlg +3 -0
- 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/common.nlg +6 -10
- package/frameworks/common/preferences.nlg +1 -1
- package/frameworks/node/apiserver.nlg +3 -3
- package/frameworks/node/https_request.nlg +97 -12
- package/frameworks/node/node.nlg +1 -0
- package/frameworks/node/worker.nlg +103 -45
- package/frameworks/project/build.nlg +12 -7
- package/frameworks/project/jszip.js +0 -0
- package/frameworks/project/projects.nlg +7 -3
- 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/dbt_aws.nlg +3 -0
- package/plugins/serviceAws/lambda_naan_control.nlg +3 -3
- package/plugins/serviceGC/gc_api.nlg +263 -0
- package/plugins/serviceGC/russian_trusted_root_ca_pem.crt +33 -0
- package/plugins/serviceGC/serviceGC.nlg +31 -0
- 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_speechrec.nlg +138 -0
- package/plugins/serviceYC/yc_vm.nlg +1 -1
- package/test/test_02_context.nlg +1 -1
- package/test/test_07_lingo.nlg +3 -3
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* column positioning: // // !
|
|
8
8
|
*
|
|
9
|
-
* Copyright (c) 2021-
|
|
9
|
+
* Copyright (c) 2021-2024 by Richard C. Zulch
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
function rootproc(procdef, local parent) {
|
|
22
|
+
global()
|
|
22
23
|
loop { // can only find out proc
|
|
23
24
|
parent = procdef.1@\.parent
|
|
24
25
|
if !parent
|
|
@@ -38,6 +39,7 @@ function rootproc(procdef, local parent) {
|
|
|
38
39
|
*/
|
|
39
40
|
|
|
40
41
|
function baseproc(procdef) {
|
|
42
|
+
global()
|
|
41
43
|
if procdef.1@\.base.proc
|
|
42
44
|
{ }
|
|
43
45
|
else
|
|
@@ -58,6 +60,7 @@ function baseproc(procdef) {
|
|
|
58
60
|
*/
|
|
59
61
|
|
|
60
62
|
function pathmatch(parent, path, local segment, nth, child) {
|
|
63
|
+
global()
|
|
61
64
|
if empty(path)
|
|
62
65
|
return (parent)
|
|
63
66
|
segment = pop(path)
|
|
@@ -83,6 +86,7 @@ function pathmatch(parent, path, local segment, nth, child) {
|
|
|
83
86
|
*/
|
|
84
87
|
|
|
85
88
|
function procpath(procdef, local path, segment, parent, peers, nth, peer) {
|
|
89
|
+
global()
|
|
86
90
|
loop {
|
|
87
91
|
segment = procdef.1
|
|
88
92
|
parent = segment@\.parent
|
|
@@ -114,6 +118,7 @@ function procpath(procdef, local path, segment, parent, peers, nth, peer) {
|
|
|
114
118
|
*/
|
|
115
119
|
|
|
116
120
|
function procname(name, local parent) {
|
|
121
|
+
global()
|
|
117
122
|
parent = name@\.parent
|
|
118
123
|
name = tostring(name)
|
|
119
124
|
if parent
|
|
@@ -136,6 +141,7 @@ function procname(name, local parent) {
|
|
|
136
141
|
*/
|
|
137
142
|
|
|
138
143
|
function procstring(procdef, options, local name, output, parm) {
|
|
144
|
+
global()
|
|
139
145
|
if options.fullname || !defined(options, `fullname)
|
|
140
146
|
name = procname(procdef.1) // default is full name
|
|
141
147
|
else
|
|
@@ -156,6 +162,82 @@ function procstring(procdef, options, local name, output, parm) {
|
|
|
156
162
|
}
|
|
157
163
|
|
|
158
164
|
|
|
165
|
+
/*
|
|
166
|
+
* packageCoder
|
|
167
|
+
*
|
|
168
|
+
* Encode and decode objects for the NaaN packager to establish proxies for remote access.
|
|
169
|
+
*
|
|
170
|
+
*/
|
|
171
|
+
|
|
172
|
+
closure packageCoder(evalf, local coder) {
|
|
173
|
+
global()
|
|
174
|
+
coder = new(object, this)
|
|
175
|
+
coder.wmapEncoding = new(weakmap)
|
|
176
|
+
coder.mapDecoding = { }
|
|
177
|
+
|
|
178
|
+
// encodeObject
|
|
179
|
+
//
|
|
180
|
+
// Encode an object into the ident dictionary so that the remote end can create a proxy.
|
|
181
|
+
//
|
|
182
|
+
coder.encodeObject = closure encodeObject(obj, local objectID) {
|
|
183
|
+
if coder.wmapEncoding[obj]
|
|
184
|
+
{ }
|
|
185
|
+
else {
|
|
186
|
+
objectID = UUID()
|
|
187
|
+
coder.mapDecoding[objectID] = obj
|
|
188
|
+
coder.wmapEncoding[obj] = {
|
|
189
|
+
name: obj@\.closure || undefined
|
|
190
|
+
objectID: objectID
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// decodeObject
|
|
196
|
+
//
|
|
197
|
+
// Decode the ident dictionary into a proxy object allowing method invocation.
|
|
198
|
+
//
|
|
199
|
+
coder.decodeObject = closure decodeObject(ident, local x, obj) {
|
|
200
|
+
if coder.mapDecoding[ident.objectID]
|
|
201
|
+
{ }
|
|
202
|
+
else if ident.name {
|
|
203
|
+
putproc(ident.name, false)
|
|
204
|
+
obj = coder.mapDecoding[ident.objectID] = closure(nn, objectID) {
|
|
205
|
+
call(enclose(list(`closure, nn, list(`local, `x),
|
|
206
|
+
quote(x=new(object, nn)),
|
|
207
|
+
quote(x@\.tostring = function() { "{proxy ${nn}}" }),
|
|
208
|
+
quote(x@\.undefined = closure undef args {
|
|
209
|
+
let (result) {
|
|
210
|
+
result = evalf(list(`\.execute\-method, objectID, args))
|
|
211
|
+
if result.0
|
|
212
|
+
throw("remoting failure: ${ErrorString(result.0)}")
|
|
213
|
+
else
|
|
214
|
+
result.1
|
|
215
|
+
} ()
|
|
216
|
+
}), `x)))
|
|
217
|
+
} (ident.name, ident.objectID)
|
|
218
|
+
coder.wmapEncoding[obj] = ident
|
|
219
|
+
obj
|
|
220
|
+
} else
|
|
221
|
+
coder.mapDecoding[ident.objectID] = new(object)
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// invokeMethod
|
|
225
|
+
//
|
|
226
|
+
// Invoke a local object method from the remote proxy, returning a result tuple.
|
|
227
|
+
//
|
|
228
|
+
coder.invokeMethod = closure invokeMethod(objectID, args, local obj) {
|
|
229
|
+
obj = coder.mapDecoding[objectID]
|
|
230
|
+
if obj
|
|
231
|
+
list(false, eval(list(deref, obj, pop(args), args)))
|
|
232
|
+
else
|
|
233
|
+
list(Error("object ${objectID} not found"))
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// finis
|
|
237
|
+
coder
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
|
|
159
241
|
/*
|
|
160
242
|
* runnInit
|
|
161
243
|
*
|
|
@@ -164,8 +246,8 @@ function procstring(procdef, options, local name, output, parm) {
|
|
|
164
246
|
*/
|
|
165
247
|
|
|
166
248
|
function runnInit(local manifest) {
|
|
167
|
-
manifest = `(rootproc, baseproc, pathmatch, procpath, procname, procstring,
|
|
168
|
-
|
|
249
|
+
manifest = `(rootproc, baseproc, pathmatch, procpath, procname, procstring, packageCoder,
|
|
250
|
+
runnInit)
|
|
169
251
|
Naan.module.build(module.id, "running", closure(modobj, compobj) {
|
|
170
252
|
require("../common").LiveImport()
|
|
171
253
|
compobj.manifest = manifest
|
|
@@ -19,12 +19,27 @@
|
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
closure TaskDispatcher(replier, local contexts, gohome, util) {
|
|
22
|
+
closure TaskDispatcher(replier, local contexts, gohome, coder, util) {
|
|
23
23
|
global()
|
|
24
24
|
contexts = { }
|
|
25
25
|
gohome = makeActivator()
|
|
26
|
+
coder = packageCoder(evalf)
|
|
26
27
|
util = modlist().Util.exports
|
|
27
|
-
|
|
28
|
+
|
|
29
|
+
// sendEval
|
|
30
|
+
//
|
|
31
|
+
// Send an evaluation request to the original execution context.
|
|
32
|
+
//
|
|
33
|
+
closure evalf(expr) {
|
|
34
|
+
debuglog("TaskDispatcher doesn't yet implement reverse proxy objects")
|
|
35
|
+
list(Error("### reverse object proxy not implemented"))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// dispatcher
|
|
39
|
+
//
|
|
40
|
+
// Return a new task dispatcher.
|
|
41
|
+
//
|
|
42
|
+
closure dispatcher(data, local reply, restorens, context, expr, roots, proc, args, result) {
|
|
28
43
|
reply = {
|
|
29
44
|
xmsg: "error"
|
|
30
45
|
xid: data.xid
|
|
@@ -70,10 +85,14 @@ closure TaskDispatcher(replier, local contexts, gohome, util) {
|
|
|
70
85
|
intern: true // intern symbols
|
|
71
86
|
localroots: true // make roots local if needed to intern
|
|
72
87
|
execute: true // execute auto-running procedures
|
|
88
|
+
objectDecoder: coder.decodeObject
|
|
73
89
|
})
|
|
74
90
|
expr = caar(expr)
|
|
91
|
+
if expr.0 == `\.execute\-method
|
|
92
|
+
expr = coder.invokeMethod(expr.1, expr.2) // object method, args
|
|
93
|
+
else
|
|
94
|
+
expr = evalactive(expr) // evaluate expression
|
|
75
95
|
reply.error = undefined
|
|
76
|
-
expr = evalactive(expr)
|
|
77
96
|
if data.get
|
|
78
97
|
roots = new(data.get).map(function(sym){ // new() to get symbol from compress
|
|
79
98
|
compress(sym)
|
|
@@ -84,7 +103,8 @@ closure TaskDispatcher(replier, local contexts, gohome, util) {
|
|
|
84
103
|
roots = `(expr)
|
|
85
104
|
reply.result = util.pkgSave(`expr, roots, {
|
|
86
105
|
nsignore: true // don't report namespace errors
|
|
87
|
-
comments: true
|
|
106
|
+
comments: true
|
|
107
|
+
objectEncoder: coder.encodeObject}) // include comments
|
|
88
108
|
if context.namespace !== nsactive().0
|
|
89
109
|
{ // evaluation changed namespace
|
|
90
110
|
context.namespace = nsactive().0
|
|
@@ -260,6 +260,16 @@ closure MakePSMutil(fs, local util) {
|
|
|
260
260
|
|
|
261
261
|
util.deepcopy = closure deepcopy(inpath, sources, outfs, outpath, options, callback,
|
|
262
262
|
local errors, copies, fsopt, folders) {
|
|
263
|
+
|
|
264
|
+
// fixpath
|
|
265
|
+
// Fix the path to match the destination.
|
|
266
|
+
function fixpath(path) {
|
|
267
|
+
if fs.path.sep == outfs.path.sep
|
|
268
|
+
path
|
|
269
|
+
else
|
|
270
|
+
path.replaceAll(fs.path.sep, outfs.path.sep)
|
|
271
|
+
}
|
|
272
|
+
|
|
263
273
|
if !callback
|
|
264
274
|
return (syncAdapter(deepcopy, inpath, sources, outfs, outpath, options))
|
|
265
275
|
if sources && !array(sources) || !string(inpath) || !string(outpath)
|
|
@@ -281,7 +291,7 @@ closure MakePSMutil(fs, local util) {
|
|
|
281
291
|
asyncArray(sources, 10, closure mklist(entry,
|
|
282
292
|
local srcpath, destpath, epath, error, stat, folder, node) {
|
|
283
293
|
srcpath = fs.path.join(inpath, entry)
|
|
284
|
-
destpath = outfs.path.join(outpath, entry)
|
|
294
|
+
destpath = fixpath(outfs.path.join(outpath, entry))
|
|
285
295
|
if destpath == "."
|
|
286
296
|
destpath = "" // joined empty strings
|
|
287
297
|
`(error, stat) = fs.info(srcpath, fsopt)
|
package/lib/browser/env_web.js
CHANGED
|
@@ -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.
|
|
539
|
+
statedoc.verstring = "1.4.0+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.
|
|
557
|
+
|| statedoc.verstring != "1.4.0+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.
|
|
616
|
+
title: vsiteName + " 1.4.0+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.
|
|
630
|
+
title: vsiteName + " 1.4.0+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.
|
|
646
|
-
+ 'App.cache = "
|
|
645
|
+
cmd: 'App.version = "1.4.0+1";;\r\n'
|
|
646
|
+
+ 'App.cache = "233c1fed240ea5c0dd1c14562f30021b";;\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,
|