@naanlang/naan 1.0.2 → 1.0.5
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 +10 -8
- package/bin/index.js +2 -2
- package/dist/env_web.js +172 -22
- package/dist/naan.min.js +6 -6
- package/frameworks/browser/https_request.nlg +120 -0
- package/frameworks/browser/sworker.js +299 -91
- package/frameworks/browser/terminals.nlg +28 -13
- package/frameworks/browser/workers.nlg +27 -12
- package/frameworks/client/apiclient.nlg +17 -4
- package/frameworks/client/psm_client.nlg +184 -81
- package/frameworks/common/common.nlg +105 -25
- package/frameworks/common/preferences.nlg +1 -0
- package/frameworks/common/watching.nlg +1 -0
- package/frameworks/node/apiserver.nlg +31 -15
- package/frameworks/node/filesystem.nlg +230 -46
- package/frameworks/node/gitter.nlg +27 -6
- package/frameworks/node/https_request.nlg +119 -0
- package/frameworks/node/node.nlg +1 -0
- package/frameworks/node/psm_server.nlg +113 -37
- package/frameworks/project/build.nlg +40 -23
- package/frameworks/project/proj_cliser.nlg +11 -3
- package/frameworks/project/proj_console.nlg +13 -4
- package/frameworks/project/proj_folder.nlg +10 -1
- package/frameworks/project/proj_lambda.nlg +13 -4
- package/frameworks/project/proj_static.nlg +11 -3
- package/frameworks/project/projects.nlg +128 -40
- package/frameworks/running/debugnub.nlg +2 -5
- package/frameworks/running/executors.nlg +1 -0
- 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 +170 -20
- package/lib/browser/env_webworker.js +1 -1
- package/lib/browser/require.js +1 -1
- package/lib/core/naanlib.js +6 -6
- package/package.json +2 -1
- package/plugins/serviceAws/aws/aws-sdk-node.min.js +2 -0
- package/plugins/serviceAws/aws/aws-sdk.min.js +2 -88
- package/plugins/serviceAws/aws_cloudwatchlogs.nlg +8 -7
- package/plugins/serviceAws/aws_dynamo.nlg +715 -148
- package/plugins/serviceAws/aws_dynextra.nlg +294 -0
- package/plugins/serviceAws/aws_lambda.nlg +11 -4
- package/plugins/serviceAws/aws_s3.nlg +44 -14
- package/plugins/serviceAws/dbt_aws.nlg +58 -45
- package/plugins/serviceAws/psm_aws.nlg +61 -40
- package/plugins/serviceAws/serviceAws.nlg +7 -4
- package/plugins/serviceGitHub/psm_github.nlg +41 -25
- package/plugins/serviceGitLab/psm_gitlab.nlg +41 -25
- package/test/harness.nlg +3 -1
- package/test/test_01_core.nlg +5 -5
- package/test/test_02_context.nlg +4 -4
- package/test/test_03_jsinterop.nlg +9 -3
- package/plugins/serviceAws/aws_cognito.nlg +0 -76
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.2
|
|
7
|
+
Naan for NPM version 1.0.5-2
|
|
8
8
|
Copyright (c) 2017-2022 Zulch Laboratories, Inc.
|
|
9
9
|
|
|
10
10
|
#### Features
|
|
@@ -23,15 +23,15 @@ Naan is an async-first software platform for rapid development.
|
|
|
23
23
|
|
|
24
24
|
#### Installation
|
|
25
25
|
|
|
26
|
-
Please ensure you have a recent version of [node.js](http://nodejs.org/)
|
|
26
|
+
Please ensure you have a recent version of [node.js](http://nodejs.org/). The minimum is `v14.14.0`
|
|
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
|
|
|
@@ -42,11 +42,11 @@ It can also evaluate an expression or execute a source file.
|
|
|
42
42
|
|
|
43
43
|
##### Command line usage
|
|
44
44
|
|
|
45
|
-
-h, --help print usage information
|
|
46
45
|
-e <expression> evaluate an expression
|
|
47
46
|
-i, --interactive use REPL with -e or [source file]
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
--version print Naan version
|
|
48
|
+
--buildno print Naan version with build number
|
|
49
|
+
-h, --help print usage information
|
|
50
50
|
|
|
51
51
|
Naan prints the results of evaluating each expression with the REPL, but not
|
|
52
52
|
by default with an expression or source file. The interactive flag overrides
|
|
@@ -64,10 +64,12 @@ Now make it executable with chmod:
|
|
|
64
64
|
|
|
65
65
|
chmod a+x helloworld
|
|
66
66
|
|
|
67
|
+
#### For More Information
|
|
67
68
|
|
|
69
|
+
[NaanIDE](https://www.npmjs.com/package/@naanlang/naanide) -- the Naan IDE -- includes more detailed documentation on Naan.
|
|
68
70
|
|
|
69
71
|
#### Dependencies:
|
|
70
|
-
|
|
72
|
+
We gratefully acknowledge these software packages used with Naan:
|
|
71
73
|
- [jszip.js](http://stuartk.com/jszip) - read and write zip files
|
|
72
74
|
- [NodeJS-path](https://nodejs.org/) - NodeJS path utilities
|
|
73
75
|
- [PouchDB](https://pouchdb.com/) - synchronizing database
|
package/bin/index.js
CHANGED
|
@@ -58,11 +58,11 @@ process.argv.every((val, index) => {
|
|
|
58
58
|
return (true);
|
|
59
59
|
}
|
|
60
60
|
if (val == "--version") {
|
|
61
|
-
console.log("1.0.
|
|
61
|
+
console.log("1.0.5");
|
|
62
62
|
process.exit(0);
|
|
63
63
|
}
|
|
64
64
|
if (val == "--buildno") {
|
|
65
|
-
console.log("1.0.2
|
|
65
|
+
console.log("1.0.5-2");
|
|
66
66
|
process.exit(0);
|
|
67
67
|
}
|
|
68
68
|
if (val.substring(0,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
|
|
|
@@ -74,15 +74,19 @@ exports.NaanControllerWeb = function() {
|
|
|
74
74
|
//
|
|
75
75
|
|
|
76
76
|
var naanlib = new exports.Naanlib();
|
|
77
|
+
var dontSaveUntilWorking; // true when state loaded, must be reset to save state again
|
|
77
78
|
var contSelf = this; // this is us, for access within nested functions
|
|
78
79
|
exports.naancon = this; // access to this instance
|
|
79
80
|
contSelf.anaan = naanlib.js.n;
|
|
80
81
|
naanlib.js.t = contSelf;
|
|
82
|
+
naanlib.js.q = querystrings;
|
|
81
83
|
var replstate; // latest known state of the REPL
|
|
82
84
|
var naanstate; // desired state for the interpreter
|
|
83
85
|
var replqueue; // text destined for terminal when opened
|
|
84
86
|
var termlist = []; // list of terminals currently attached
|
|
87
|
+
contSelf.termlist = termlist;
|
|
85
88
|
var prefs = { };
|
|
89
|
+
var vsiteName;
|
|
86
90
|
|
|
87
91
|
//
|
|
88
92
|
// termTextOut
|
|
@@ -149,8 +153,15 @@ exports.NaanControllerWeb = function() {
|
|
|
149
153
|
//
|
|
150
154
|
|
|
151
155
|
this.StateGet = function StateGet() {
|
|
152
|
-
|
|
153
|
-
|
|
156
|
+
termlist.every(function(term) {
|
|
157
|
+
var state;
|
|
158
|
+
if (term.StateSave && (state = term.StateSave()))
|
|
159
|
+
{ // update the state if we can
|
|
160
|
+
replstate = state;
|
|
161
|
+
return (false);
|
|
162
|
+
}
|
|
163
|
+
return (true); // keep searching
|
|
164
|
+
});
|
|
154
165
|
return (replstate);
|
|
155
166
|
};
|
|
156
167
|
|
|
@@ -204,14 +215,14 @@ exports.NaanControllerWeb = function() {
|
|
|
204
215
|
if (term !== terminal)
|
|
205
216
|
term.OnMessage({ // send text to other terminals
|
|
206
217
|
id: "textout",
|
|
207
|
-
text: text + "\r\n"
|
|
218
|
+
text: "\x1b[90m\x1b[3m" + text + "\x1b[0m" + "\r\n"
|
|
208
219
|
});
|
|
209
220
|
});
|
|
210
221
|
window.setTimeout(function () {
|
|
211
|
-
naanlib.textLine(text)
|
|
222
|
+
naanlib.textLine(text);
|
|
212
223
|
}, 1);
|
|
213
224
|
};
|
|
214
|
-
|
|
225
|
+
|
|
215
226
|
this.ReplyMessage = function ReplyMessage(data) { // "remote" -> "local"
|
|
216
227
|
termlist.forEach(function(term) {
|
|
217
228
|
if (term.OnMessageOut)
|
|
@@ -229,9 +240,9 @@ exports.NaanControllerWeb = function() {
|
|
|
229
240
|
this.DispatchMessage = function DispatchMessage(data) { // "local" -> "remote"
|
|
230
241
|
if (nideListener)
|
|
231
242
|
setTimeout(function() {
|
|
232
|
-
nideListener(data)
|
|
243
|
+
nideListener(data);
|
|
233
244
|
}, 1);
|
|
234
|
-
}
|
|
245
|
+
};
|
|
235
246
|
|
|
236
247
|
this.ReplyDebugger = function ReplyDebugger(data) { // "remote" -> "local"
|
|
237
248
|
termlist.forEach(function(term) {
|
|
@@ -250,9 +261,9 @@ exports.NaanControllerWeb = function() {
|
|
|
250
261
|
this.DispatchDebugger = function DispatchDebugger(data) { // "local" -> "remote"
|
|
251
262
|
if (debugListener)
|
|
252
263
|
setTimeout(function() {
|
|
253
|
-
debugListener(data)
|
|
264
|
+
debugListener(data);
|
|
254
265
|
}, 1);
|
|
255
|
-
}
|
|
266
|
+
};
|
|
256
267
|
|
|
257
268
|
//
|
|
258
269
|
// Status
|
|
@@ -290,7 +301,95 @@ exports.NaanControllerWeb = function() {
|
|
|
290
301
|
this.Dimensions = function Dimensions(rows, cols) {
|
|
291
302
|
console.log("Naan terminal dimensions now (" + rows + ", " + cols + ")");
|
|
292
303
|
};
|
|
304
|
+
|
|
305
|
+
//
|
|
306
|
+
// VsiteRefresh
|
|
307
|
+
//
|
|
308
|
+
// Check if our underlying data has changed, and reload if needed.
|
|
309
|
+
//
|
|
310
|
+
|
|
311
|
+
this.VsiteRefresh = function VsiteRefresh(url_origin) {
|
|
312
|
+
if (window.location.href.startsWith(url_origin))
|
|
313
|
+
window.location.reload(); // we have changed underneath
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
//==========================================================================
|
|
318
|
+
// Clone Debug Interface
|
|
319
|
+
//--------------------------------------------------------------------------
|
|
320
|
+
|
|
321
|
+
function CloneDebugTerminal()
|
|
322
|
+
{
|
|
323
|
+
var termSelf = this;
|
|
324
|
+
//
|
|
325
|
+
// listen for messages
|
|
326
|
+
//
|
|
327
|
+
window.addEventListener("message", function (event) {
|
|
328
|
+
if (event.origin !== window.origin)
|
|
329
|
+
return; // only talk with our peers
|
|
330
|
+
var msg = event.data;
|
|
331
|
+
if (msg.id == "interrupt")
|
|
332
|
+
contSelf.Interrupt();
|
|
333
|
+
else if (msg.id == "keyline")
|
|
334
|
+
contSelf.Return(msg.text, termSelf); // keyboard text from terminal
|
|
335
|
+
else if (msg.id == "start")
|
|
336
|
+
contSelf.Attach(term); // opener is ready
|
|
337
|
+
else if (msg.id == "import")
|
|
338
|
+
{ // for workers
|
|
339
|
+
}
|
|
340
|
+
else if (msg.id == "targetin")
|
|
341
|
+
{
|
|
342
|
+
if (nideListener)
|
|
343
|
+
nideListener(msg.data); // target received a message
|
|
344
|
+
}
|
|
345
|
+
else if (msg.id == "debugin")
|
|
346
|
+
{
|
|
347
|
+
if (debugListener)
|
|
348
|
+
debugListener(msg.data); // target received a message
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
//
|
|
353
|
+
// report messages back to opener
|
|
354
|
+
//
|
|
355
|
+
termSelf.OnMessage = function OnMessage(msg) {
|
|
356
|
+
window.opener.postMessage(msg, window.origin);
|
|
357
|
+
return (msg);
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
//
|
|
361
|
+
// report messages back to opener
|
|
362
|
+
//
|
|
363
|
+
termSelf.OnMessageOut = function OnMessageOut(data) {
|
|
364
|
+
var msg = { // target is sending debug data
|
|
365
|
+
id: "targetout",
|
|
366
|
+
data: data
|
|
367
|
+
};
|
|
368
|
+
return (termSelf.OnMessage(msg));
|
|
369
|
+
};
|
|
293
370
|
|
|
371
|
+
//
|
|
372
|
+
// report debug messages back to opener
|
|
373
|
+
//
|
|
374
|
+
termSelf.OnDebugOut = function OnDebugOut(data) {
|
|
375
|
+
var msg = { // target is sending debug data
|
|
376
|
+
id: "debugout",
|
|
377
|
+
data: data
|
|
378
|
+
};
|
|
379
|
+
return (termSelf.OnMessage(msg));
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
//
|
|
383
|
+
// report status back to opener
|
|
384
|
+
//
|
|
385
|
+
termSelf.OnStatus = function OnStatus(status) {
|
|
386
|
+
var msg = { // target is sending debug data
|
|
387
|
+
id: "status",
|
|
388
|
+
status: status
|
|
389
|
+
};
|
|
390
|
+
return (termSelf.OnMessage(msg));
|
|
391
|
+
};
|
|
392
|
+
}
|
|
294
393
|
|
|
295
394
|
//==========================================================================
|
|
296
395
|
// Host Environment
|
|
@@ -299,7 +398,7 @@ exports.NaanControllerWeb = function() {
|
|
|
299
398
|
//
|
|
300
399
|
// SavePref
|
|
301
400
|
//
|
|
302
|
-
// Save a persistent preference
|
|
401
|
+
// Save a persistent preference object that can be retrieved in the future.
|
|
303
402
|
//
|
|
304
403
|
|
|
305
404
|
this.SavePref = function SavePref(key, value) {
|
|
@@ -315,6 +414,16 @@ exports.NaanControllerWeb = function() {
|
|
|
315
414
|
this.LoadPref = function LoadPref(key) {
|
|
316
415
|
return (prefs[key]);
|
|
317
416
|
};
|
|
417
|
+
|
|
418
|
+
//
|
|
419
|
+
// Working
|
|
420
|
+
//
|
|
421
|
+
// The application is working, so it is safe to save state.
|
|
422
|
+
//
|
|
423
|
+
|
|
424
|
+
this.Working = function Working() {
|
|
425
|
+
dontSaveUntilWorking = false;
|
|
426
|
+
};
|
|
318
427
|
|
|
319
428
|
var saveEvent = new Event("NaanSave");
|
|
320
429
|
|
|
@@ -333,6 +442,7 @@ exports.NaanControllerWeb = function() {
|
|
|
333
442
|
window.addEventListener("unload", function (e) {
|
|
334
443
|
window.dispatchEvent(saveEvent);
|
|
335
444
|
saveLocal();
|
|
445
|
+
virtualClose();
|
|
336
446
|
});
|
|
337
447
|
|
|
338
448
|
window.addEventListener("beforeunload", function (e) {
|
|
@@ -344,15 +454,15 @@ exports.NaanControllerWeb = function() {
|
|
|
344
454
|
var statedoc = {};
|
|
345
455
|
statedoc.curversion = kStateCurrentVersion;
|
|
346
456
|
statedoc.firstver = kStateFirstVersion;
|
|
347
|
-
statedoc.licensee = "
|
|
348
|
-
statedoc.verstring = "
|
|
457
|
+
statedoc.licensee = "$Licensee$";
|
|
458
|
+
statedoc.verstring = "$Version$";
|
|
349
459
|
statedoc.date = new Date().toISOString();
|
|
350
460
|
statedoc.prefs = prefs;
|
|
351
|
-
statedoc.naan = naanlib.saveState(
|
|
461
|
+
statedoc.naan = naanlib.saveState(false); // true to optimize, which is a bit slower
|
|
352
462
|
termlist.forEach(function(term) {
|
|
353
463
|
if (!replstate || term.termwin)
|
|
354
464
|
replstate = term.StateSave(); // state with separate window, otherwise any state
|
|
355
|
-
})
|
|
465
|
+
});
|
|
356
466
|
if (replstate)
|
|
357
467
|
statedoc.replstate = replstate;
|
|
358
468
|
return (statedoc);
|
|
@@ -362,9 +472,12 @@ exports.NaanControllerWeb = function() {
|
|
|
362
472
|
if (statedoc===undefined || statedoc.naan === undefined
|
|
363
473
|
|| statedoc.firstver > kStateCurrentVersion
|
|
364
474
|
|| statedoc.curversion < kStateFirstVersion
|
|
365
|
-
|| statedoc.licensee != "
|
|
366
|
-
|| statedoc.verstring != "
|
|
475
|
+
|| statedoc.licensee != "$Licensee$"
|
|
476
|
+
|| statedoc.verstring != "$Version$")
|
|
477
|
+
{
|
|
478
|
+
localStorage.removeItem("NaanState_Hosted");
|
|
367
479
|
return (false);
|
|
480
|
+
}
|
|
368
481
|
naanstate = statedoc.naan;
|
|
369
482
|
replstate = statedoc.replstate; // get terminal state, if any
|
|
370
483
|
if (typeof(statedoc.prefs) == "object")
|
|
@@ -374,6 +487,10 @@ exports.NaanControllerWeb = function() {
|
|
|
374
487
|
|
|
375
488
|
function saveLocal() {
|
|
376
489
|
/*jshint sub:true */
|
|
490
|
+
if (dontSaveUntilWorking) { // saved state is problematic
|
|
491
|
+
localStorage.removeItem("NaanState_Hosted");
|
|
492
|
+
return (false);
|
|
493
|
+
}
|
|
377
494
|
if (querystrings["nosave"])
|
|
378
495
|
return (false);
|
|
379
496
|
var statedoc = makeState();
|
|
@@ -381,8 +498,8 @@ exports.NaanControllerWeb = function() {
|
|
|
381
498
|
try {
|
|
382
499
|
if ("localStorage" in window && window["localStorage"] !== null)
|
|
383
500
|
{
|
|
384
|
-
localStorage.removeItem("
|
|
385
|
-
if (localStorage.setItem("
|
|
501
|
+
localStorage.removeItem("NaanState_Hosted");
|
|
502
|
+
if (localStorage.setItem("NaanState_Hosted", statestr) !== undefined)
|
|
386
503
|
return (true);
|
|
387
504
|
}
|
|
388
505
|
} catch(e) {
|
|
@@ -396,7 +513,8 @@ exports.NaanControllerWeb = function() {
|
|
|
396
513
|
/*jshint sub:true */
|
|
397
514
|
if ("localStorage" in window && window["localStorage"] !== null)
|
|
398
515
|
{
|
|
399
|
-
var statestr = localStorage.getItem("
|
|
516
|
+
var statestr = localStorage.getItem("NaanState_Hosted");
|
|
517
|
+
dontSaveUntilWorking = true;
|
|
400
518
|
if (statestr)
|
|
401
519
|
return (loadState(JSON.parse(statestr)));
|
|
402
520
|
}
|
|
@@ -405,7 +523,30 @@ exports.NaanControllerWeb = function() {
|
|
|
405
523
|
}
|
|
406
524
|
return (false);
|
|
407
525
|
}
|
|
526
|
+
|
|
527
|
+
function virtualOpen() {
|
|
528
|
+
vsiteName = window.document.title; // consistent name at open and close
|
|
529
|
+
if (window.opener && window.opener.Naanlang)
|
|
530
|
+
window.opener.Naanlang.naancon.DispatchMessage({
|
|
531
|
+
op: "VsiteOpen",
|
|
532
|
+
name: vsiteName,
|
|
533
|
+
naancont: contSelf,
|
|
534
|
+
title: vsiteName + " $Version$"
|
|
535
|
+
});
|
|
536
|
+
}
|
|
408
537
|
|
|
538
|
+
function virtualClose() {
|
|
539
|
+
if (window.opener && window.opener.Naanlang) {
|
|
540
|
+
window.opener.Naanlang.naancon.DispatchMessage({
|
|
541
|
+
op: "VsiteClose",
|
|
542
|
+
name: vsiteName,
|
|
543
|
+
naancont: contSelf,
|
|
544
|
+
title: vsiteName + " $Version$"
|
|
545
|
+
});
|
|
546
|
+
termTextOut("\x1b[90m\x1b[3m".concat("\nwindow closed", "\x1b[0m\n"));
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
409
550
|
/*jshint sub:true */
|
|
410
551
|
if (querystrings["restart"] || !loadLocal())
|
|
411
552
|
{ // don't load state or can't load state
|
|
@@ -419,8 +560,17 @@ exports.NaanControllerWeb = function() {
|
|
|
419
560
|
naanlib.banner();
|
|
420
561
|
naanlib.textLine("print();;\n");
|
|
421
562
|
}
|
|
422
|
-
naanlib.start({
|
|
423
|
-
|
|
563
|
+
if (!naanlib.start({ state: naanstate })) { // state loading failed
|
|
564
|
+
localStorage.removeItem("NaanState_Hosted");
|
|
565
|
+
window.location.reload();
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
if (window.opener) {
|
|
570
|
+
virtualOpen();
|
|
571
|
+
var term = new CloneDebugTerminal();
|
|
572
|
+
term.OnMessage({
|
|
573
|
+
id: "loaded"
|
|
424
574
|
});
|
|
425
575
|
}
|
|
426
576
|
};
|