@naanlang/naan 1.0.1 → 1.0.4
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 +5 -5
- package/bin/index.js +18 -15
- package/dist/env_web.js +146 -16
- package/dist/naan.min.js +5 -5
- package/frameworks/browser/sworker.js +299 -91
- package/frameworks/browser/terminals.nlg +23 -10
- package/frameworks/browser/workers.nlg +26 -12
- package/frameworks/client/apiclient.nlg +17 -4
- package/frameworks/client/psm_client.nlg +178 -81
- package/frameworks/common/common.nlg +14 -4
- package/frameworks/node/apiserver.nlg +31 -15
- package/frameworks/node/filesystem.nlg +230 -46
- package/frameworks/node/gitter.nlg +27 -6
- package/frameworks/node/psm_server.nlg +113 -37
- package/frameworks/project/build.nlg +40 -23
- package/frameworks/project/projects.nlg +50 -27
- package/frameworks/running/debugnub.nlg +2 -5
- package/frameworks/storage/csv.nlg +120 -0
- package/frameworks/storage/dbt_pouch.nlg +41 -25
- package/frameworks/storage/psm.nlg +108 -28
- package/frameworks/storage/psm_dbtables.nlg +7 -3
- package/frameworks/storage/resources.nlg +30 -2
- package/lib/browser/env_web.js +148 -18
- package/lib/browser/env_webworker.js +1 -1
- package/lib/browser/require.js +1 -1
- package/lib/core/naanlib.js +5 -5
- package/lib/env_node.js +9 -1
- package/package.json +2 -1
- package/plugins/serviceAws/aws_cloudwatchlogs.nlg +1 -1
- package/plugins/serviceAws/aws_dynamo.nlg +625 -141
- package/plugins/serviceAws/aws_dynextra.nlg +294 -0
- package/plugins/serviceAws/dbt_aws.nlg +31 -11
- package/plugins/serviceAws/psm_aws.nlg +42 -26
- package/plugins/serviceAws/serviceAws.nlg +1 -0
- package/plugins/serviceGitHub/psm_github.nlg +41 -25
- package/plugins/serviceGitLab/psm_gitlab.nlg +41 -25
package/LICENSE.md
CHANGED
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
Naan is an async-first software platform for rapid development.
|
|
5
5
|
|
|
6
6
|
#### Release:
|
|
7
|
-
Naan for NPM version 1.0.
|
|
7
|
+
Naan for NPM version 1.0.4-2
|
|
8
8
|
Copyright (c) 2017-2022 Zulch Laboratories, Inc.
|
|
9
9
|
|
|
10
10
|
#### Features
|
|
@@ -17,7 +17,7 @@ Naan is an async-first software platform for rapid development.
|
|
|
17
17
|
- Preserves referential integrity when communicating among workers or hosts
|
|
18
18
|
- Plugin architecture enables alternate languages and functionality
|
|
19
19
|
- Custom language syntax can be added through simplified dialect extensions
|
|
20
|
-
- Integrates transparently with all
|
|
20
|
+
- Integrates transparently with all existing JavaScript libraries
|
|
21
21
|
- Can save and reload running program state across page loads or lambda invocations
|
|
22
22
|
- Lightweight and efficient
|
|
23
23
|
|
|
@@ -27,11 +27,11 @@ Please ensure you have a recent version of [node.js](http://nodejs.org/)
|
|
|
27
27
|
|
|
28
28
|
For use everywhere as a command line app:
|
|
29
29
|
|
|
30
|
-
npm install naan -g
|
|
30
|
+
npm install @naanlang/naan -g
|
|
31
31
|
|
|
32
32
|
For use as a library in the current project:
|
|
33
33
|
|
|
34
|
-
npm install naan
|
|
34
|
+
npm install @naanlang/naan
|
|
35
35
|
|
|
36
36
|
#### Command line execution
|
|
37
37
|
|
|
@@ -67,7 +67,7 @@ Now make it executable with chmod:
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
#### Dependencies:
|
|
70
|
-
We
|
|
70
|
+
We gratefully acknowledge these software packages used with Naan:
|
|
71
71
|
- [jszip.js](http://stuartk.com/jszip) - read and write zip files
|
|
72
72
|
- [NodeJS-path](https://nodejs.org/) - NodeJS path utilities
|
|
73
73
|
- [PouchDB](https://pouchdb.com/) - synchronizing database
|
package/bin/index.js
CHANGED
|
@@ -32,50 +32,53 @@ var eval_text;
|
|
|
32
32
|
var do_interactive;
|
|
33
33
|
var cmd_text = "nodeparse('node_repl_init.nlg');;\n";
|
|
34
34
|
|
|
35
|
-
process.argv.
|
|
35
|
+
process.argv.every((val, index) => {
|
|
36
36
|
if (index < 2)
|
|
37
|
-
return;
|
|
37
|
+
return (true);
|
|
38
38
|
if (val == "-e") {
|
|
39
39
|
eval_text = 1;
|
|
40
|
-
return;
|
|
40
|
+
return (true);
|
|
41
41
|
}
|
|
42
|
+
if (eval_text == 1 && val.substring(0,1) == "-")
|
|
43
|
+
return (false);
|
|
42
44
|
if (val == "-h" || val == "--help") {
|
|
43
45
|
console.log(
|
|
44
46
|
"Usage: naan [options] [source file] [arguments]\n\n" +
|
|
45
47
|
"Options:\n" +
|
|
46
48
|
" -e <expression> evaluate an expression\n" +
|
|
47
49
|
" -i, --interactive use REPL with -e or [source file]\n" +
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
+
" --version print the Naan version\n" +
|
|
51
|
+
" --buildno print the version and build\n" +
|
|
52
|
+
" -h, --help print this usage information\n"
|
|
50
53
|
);
|
|
51
54
|
process.exit(0);
|
|
52
55
|
}
|
|
53
56
|
if (val == "-i" || val == "--interactive") {
|
|
54
57
|
do_interactive = true;
|
|
55
|
-
return;
|
|
58
|
+
return (true);
|
|
56
59
|
}
|
|
57
|
-
if (val == "
|
|
58
|
-
console.log("1.0.
|
|
60
|
+
if (val == "--version") {
|
|
61
|
+
console.log("1.0.4");
|
|
59
62
|
process.exit(0);
|
|
60
63
|
}
|
|
61
|
-
if (val == "
|
|
62
|
-
console.log("1.0.
|
|
64
|
+
if (val == "--buildno") {
|
|
65
|
+
console.log("1.0.4-2");
|
|
63
66
|
process.exit(0);
|
|
64
67
|
}
|
|
65
68
|
if (val.substring(0,1) == "-") {
|
|
66
69
|
console.log("naan: bad option: " + val);
|
|
67
70
|
process.exit(9);
|
|
68
71
|
}
|
|
69
|
-
if (eval_text) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return;
|
|
72
|
+
if (eval_text == 1) {
|
|
73
|
+
eval_text = val + '\n';
|
|
74
|
+
return (true);
|
|
73
75
|
}
|
|
74
76
|
if (!cmd_file) {
|
|
75
77
|
cmd_file = val;
|
|
76
|
-
return;
|
|
78
|
+
return (true);
|
|
77
79
|
}
|
|
78
80
|
// ignore extra arguments
|
|
81
|
+
return (true);
|
|
79
82
|
});
|
|
80
83
|
|
|
81
84
|
if (eval_text == 1) {
|
package/dist/env_web.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* column positioning: // // !
|
|
8
8
|
*
|
|
9
|
-
* Copyright (c) 2017-
|
|
9
|
+
* Copyright (c) 2017-2022 by Richard C. Zulch
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -82,7 +82,9 @@ exports.NaanControllerWeb = function() {
|
|
|
82
82
|
var naanstate; // desired state for the interpreter
|
|
83
83
|
var replqueue; // text destined for terminal when opened
|
|
84
84
|
var termlist = []; // list of terminals currently attached
|
|
85
|
+
contSelf.termlist = termlist;
|
|
85
86
|
var prefs = { };
|
|
87
|
+
var vsiteName;
|
|
86
88
|
|
|
87
89
|
//
|
|
88
90
|
// termTextOut
|
|
@@ -149,8 +151,15 @@ exports.NaanControllerWeb = function() {
|
|
|
149
151
|
//
|
|
150
152
|
|
|
151
153
|
this.StateGet = function StateGet() {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
+
termlist.every(function(term) {
|
|
155
|
+
var state;
|
|
156
|
+
if (term.StateSave && (state = term.StateSave()))
|
|
157
|
+
{ // update the state if we can
|
|
158
|
+
replstate = state;
|
|
159
|
+
return (false);
|
|
160
|
+
}
|
|
161
|
+
return (true); // keep searching
|
|
162
|
+
});
|
|
154
163
|
return (replstate);
|
|
155
164
|
};
|
|
156
165
|
|
|
@@ -204,14 +213,14 @@ exports.NaanControllerWeb = function() {
|
|
|
204
213
|
if (term !== terminal)
|
|
205
214
|
term.OnMessage({ // send text to other terminals
|
|
206
215
|
id: "textout",
|
|
207
|
-
text: text + "\r\n"
|
|
216
|
+
text: "\x1b[90m\x1b[3m" + text + "\x1b[0m" + "\r\n"
|
|
208
217
|
});
|
|
209
218
|
});
|
|
210
219
|
window.setTimeout(function () {
|
|
211
|
-
naanlib.textLine(text)
|
|
220
|
+
naanlib.textLine(text);
|
|
212
221
|
}, 1);
|
|
213
222
|
};
|
|
214
|
-
|
|
223
|
+
|
|
215
224
|
this.ReplyMessage = function ReplyMessage(data) { // "remote" -> "local"
|
|
216
225
|
termlist.forEach(function(term) {
|
|
217
226
|
if (term.OnMessageOut)
|
|
@@ -229,9 +238,9 @@ exports.NaanControllerWeb = function() {
|
|
|
229
238
|
this.DispatchMessage = function DispatchMessage(data) { // "local" -> "remote"
|
|
230
239
|
if (nideListener)
|
|
231
240
|
setTimeout(function() {
|
|
232
|
-
nideListener(data)
|
|
241
|
+
nideListener(data);
|
|
233
242
|
}, 1);
|
|
234
|
-
}
|
|
243
|
+
};
|
|
235
244
|
|
|
236
245
|
this.ReplyDebugger = function ReplyDebugger(data) { // "remote" -> "local"
|
|
237
246
|
termlist.forEach(function(term) {
|
|
@@ -250,9 +259,9 @@ exports.NaanControllerWeb = function() {
|
|
|
250
259
|
this.DispatchDebugger = function DispatchDebugger(data) { // "local" -> "remote"
|
|
251
260
|
if (debugListener)
|
|
252
261
|
setTimeout(function() {
|
|
253
|
-
debugListener(data)
|
|
262
|
+
debugListener(data);
|
|
254
263
|
}, 1);
|
|
255
|
-
}
|
|
264
|
+
};
|
|
256
265
|
|
|
257
266
|
//
|
|
258
267
|
// Status
|
|
@@ -290,7 +299,95 @@ exports.NaanControllerWeb = function() {
|
|
|
290
299
|
this.Dimensions = function Dimensions(rows, cols) {
|
|
291
300
|
console.log("Naan terminal dimensions now (" + rows + ", " + cols + ")");
|
|
292
301
|
};
|
|
302
|
+
|
|
303
|
+
//
|
|
304
|
+
// VsiteRefresh
|
|
305
|
+
//
|
|
306
|
+
// Check if our underlying data has changed, and reload if needed.
|
|
307
|
+
//
|
|
308
|
+
|
|
309
|
+
this.VsiteRefresh = function VsiteRefresh(url_origin) {
|
|
310
|
+
if (window.location.href.startsWith(url_origin))
|
|
311
|
+
window.location.reload(); // we have changed underneath
|
|
312
|
+
};
|
|
313
|
+
|
|
293
314
|
|
|
315
|
+
//==========================================================================
|
|
316
|
+
// Clone Debug Interface
|
|
317
|
+
//--------------------------------------------------------------------------
|
|
318
|
+
|
|
319
|
+
function CloneDebugTerminal()
|
|
320
|
+
{
|
|
321
|
+
var termSelf = this;
|
|
322
|
+
//
|
|
323
|
+
// listen for messages
|
|
324
|
+
//
|
|
325
|
+
window.addEventListener("message", function (event) {
|
|
326
|
+
if (event.origin !== window.origin)
|
|
327
|
+
return; // only talk with our peers
|
|
328
|
+
var msg = event.data;
|
|
329
|
+
if (msg.id == "interrupt")
|
|
330
|
+
contSelf.Interrupt();
|
|
331
|
+
else if (msg.id == "keyline")
|
|
332
|
+
contSelf.Return(msg.text, termSelf); // keyboard text from terminal
|
|
333
|
+
else if (msg.id == "start")
|
|
334
|
+
contSelf.Attach(term); // opener is ready
|
|
335
|
+
else if (msg.id == "import")
|
|
336
|
+
{ // for workers
|
|
337
|
+
}
|
|
338
|
+
else if (msg.id == "targetin")
|
|
339
|
+
{
|
|
340
|
+
if (nideListener)
|
|
341
|
+
nideListener(msg.data); // target received a message
|
|
342
|
+
}
|
|
343
|
+
else if (msg.id == "debugin")
|
|
344
|
+
{
|
|
345
|
+
if (debugListener)
|
|
346
|
+
debugListener(msg.data); // target received a message
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
//
|
|
351
|
+
// report messages back to opener
|
|
352
|
+
//
|
|
353
|
+
termSelf.OnMessage = function OnMessage(msg) {
|
|
354
|
+
window.opener.postMessage(msg, window.origin);
|
|
355
|
+
return (msg);
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
//
|
|
359
|
+
// report messages back to opener
|
|
360
|
+
//
|
|
361
|
+
termSelf.OnMessageOut = function OnMessageOut(data) {
|
|
362
|
+
var msg = { // target is sending debug data
|
|
363
|
+
id: "targetout",
|
|
364
|
+
data: data
|
|
365
|
+
};
|
|
366
|
+
return (termSelf.OnMessage(msg));
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
//
|
|
370
|
+
// report debug messages back to opener
|
|
371
|
+
//
|
|
372
|
+
termSelf.OnDebugOut = function OnDebugOut(data) {
|
|
373
|
+
var msg = { // target is sending debug data
|
|
374
|
+
id: "debugout",
|
|
375
|
+
data: data
|
|
376
|
+
};
|
|
377
|
+
return (termSelf.OnMessage(msg));
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
//
|
|
381
|
+
// report status back to opener
|
|
382
|
+
//
|
|
383
|
+
termSelf.OnStatus = function OnStatus(status) {
|
|
384
|
+
var msg = { // target is sending debug data
|
|
385
|
+
id: "status",
|
|
386
|
+
status: status
|
|
387
|
+
};
|
|
388
|
+
return (termSelf.OnMessage(msg));
|
|
389
|
+
};
|
|
390
|
+
}
|
|
294
391
|
|
|
295
392
|
//==========================================================================
|
|
296
393
|
// Host Environment
|
|
@@ -299,7 +396,7 @@ exports.NaanControllerWeb = function() {
|
|
|
299
396
|
//
|
|
300
397
|
// SavePref
|
|
301
398
|
//
|
|
302
|
-
// Save a persistent preference
|
|
399
|
+
// Save a persistent preference object that can be retrieved in the future.
|
|
303
400
|
//
|
|
304
401
|
|
|
305
402
|
this.SavePref = function SavePref(key, value) {
|
|
@@ -333,6 +430,7 @@ exports.NaanControllerWeb = function() {
|
|
|
333
430
|
window.addEventListener("unload", function (e) {
|
|
334
431
|
window.dispatchEvent(saveEvent);
|
|
335
432
|
saveLocal();
|
|
433
|
+
virtualClose();
|
|
336
434
|
});
|
|
337
435
|
|
|
338
436
|
window.addEventListener("beforeunload", function (e) {
|
|
@@ -348,11 +446,11 @@ exports.NaanControllerWeb = function() {
|
|
|
348
446
|
statedoc.verstring = "$Version$";
|
|
349
447
|
statedoc.date = new Date().toISOString();
|
|
350
448
|
statedoc.prefs = prefs;
|
|
351
|
-
statedoc.naan = naanlib.saveState(
|
|
449
|
+
statedoc.naan = naanlib.saveState(false); // true to optimize, which is a bit slower
|
|
352
450
|
termlist.forEach(function(term) {
|
|
353
451
|
if (!replstate || term.termwin)
|
|
354
452
|
replstate = term.StateSave(); // state with separate window, otherwise any state
|
|
355
|
-
})
|
|
453
|
+
});
|
|
356
454
|
if (replstate)
|
|
357
455
|
statedoc.replstate = replstate;
|
|
358
456
|
return (statedoc);
|
|
@@ -364,7 +462,10 @@ exports.NaanControllerWeb = function() {
|
|
|
364
462
|
|| statedoc.curversion < kStateFirstVersion
|
|
365
463
|
|| statedoc.licensee != "$Licensee$"
|
|
366
464
|
|| statedoc.verstring != "$Version$")
|
|
465
|
+
{
|
|
466
|
+
localStorage.removeItem("NaanState_Hosted");
|
|
367
467
|
return (false);
|
|
468
|
+
}
|
|
368
469
|
naanstate = statedoc.naan;
|
|
369
470
|
replstate = statedoc.replstate; // get terminal state, if any
|
|
370
471
|
if (typeof(statedoc.prefs) == "object")
|
|
@@ -381,8 +482,8 @@ exports.NaanControllerWeb = function() {
|
|
|
381
482
|
try {
|
|
382
483
|
if ("localStorage" in window && window["localStorage"] !== null)
|
|
383
484
|
{
|
|
384
|
-
localStorage.removeItem("
|
|
385
|
-
if (localStorage.setItem("
|
|
485
|
+
localStorage.removeItem("NaanState_Hosted");
|
|
486
|
+
if (localStorage.setItem("NaanState_Hosted", statestr) !== undefined)
|
|
386
487
|
return (true);
|
|
387
488
|
}
|
|
388
489
|
} catch(e) {
|
|
@@ -396,7 +497,7 @@ exports.NaanControllerWeb = function() {
|
|
|
396
497
|
/*jshint sub:true */
|
|
397
498
|
if ("localStorage" in window && window["localStorage"] !== null)
|
|
398
499
|
{
|
|
399
|
-
var statestr = localStorage.getItem("
|
|
500
|
+
var statestr = localStorage.getItem("NaanState_Hosted");
|
|
400
501
|
if (statestr)
|
|
401
502
|
return (loadState(JSON.parse(statestr)));
|
|
402
503
|
}
|
|
@@ -405,7 +506,28 @@ exports.NaanControllerWeb = function() {
|
|
|
405
506
|
}
|
|
406
507
|
return (false);
|
|
407
508
|
}
|
|
509
|
+
|
|
510
|
+
function virtualOpen() {
|
|
511
|
+
vsiteName = window.document.title; // consistent name at open and close
|
|
512
|
+
if (window.opener && window.opener.Naanlang)
|
|
513
|
+
window.opener.Naanlang.naancon.DispatchMessage({
|
|
514
|
+
op: "VsiteOpen",
|
|
515
|
+
name: vsiteName,
|
|
516
|
+
naancont: contSelf
|
|
517
|
+
});
|
|
518
|
+
}
|
|
408
519
|
|
|
520
|
+
function virtualClose() {
|
|
521
|
+
if (window.opener && window.opener.Naanlang) {
|
|
522
|
+
window.opener.Naanlang.naancon.DispatchMessage({
|
|
523
|
+
op: "VsiteClose",
|
|
524
|
+
name: vsiteName,
|
|
525
|
+
naancont: contSelf
|
|
526
|
+
});
|
|
527
|
+
termTextOut("\x1b[90m\x1b[3m".concat("\nwindow closed", "\x1b[0m\n"));
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
409
531
|
/*jshint sub:true */
|
|
410
532
|
if (querystrings["restart"] || !loadLocal())
|
|
411
533
|
{ // don't load state or can't load state
|
|
@@ -423,6 +545,14 @@ exports.NaanControllerWeb = function() {
|
|
|
423
545
|
state: naanstate
|
|
424
546
|
});
|
|
425
547
|
}
|
|
548
|
+
|
|
549
|
+
if (window.opener) {
|
|
550
|
+
virtualOpen();
|
|
551
|
+
var term = new CloneDebugTerminal();
|
|
552
|
+
term.OnMessage({
|
|
553
|
+
id: "loaded"
|
|
554
|
+
});
|
|
555
|
+
}
|
|
426
556
|
};
|
|
427
557
|
|
|
428
558
|
/*jshint sub:true */
|