@naanlang/naan 1.0.8 → 1.0.9
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/browser.nlg +1 -1
- package/frameworks/browser/sworker.js +17 -17
- package/frameworks/browser/terminals.nlg +1 -1
- package/frameworks/browser/workers.nlg +1 -1
- package/frameworks/client/psm_client.nlg +1 -1
- package/frameworks/common/common.nlg +1 -1
- package/frameworks/node/filesystem.nlg +8 -7
- package/frameworks/node/psm_server.nlg +3 -3
- package/frameworks/project/build.nlg +5 -5
- package/frameworks/project/proj_console.nlg +1 -1
- package/frameworks/project/proj_lambda.nlg +1 -1
- package/frameworks/project/projects.nlg +5 -5
- package/frameworks/running/debugnub.nlg +1 -1
- package/frameworks/running/executors.nlg +1 -1
- package/frameworks/running/sourcecode.nlg +2 -2
- package/frameworks/storage/csv.nlg +2 -2
- package/frameworks/storage/dbt_pouch.nlg +1 -1
- package/frameworks/storage/psm.nlg +1 -1
- package/frameworks/storage/psm_dbtables.nlg +4 -4
- package/frameworks/storage/resources.nlg +3 -2
- package/lib/browser/env_web.js +6 -6
- package/lib/core/naanlib.js +4 -4
- package/package.json +1 -1
- package/plugins/serviceAws/aws_dynamo.nlg +12 -12
- package/plugins/serviceAws/dbt_aws.nlg +2 -2
- package/test/harness.nlg +2 -1
- package/test/test_05_strings.nlg +2 -0
- package/test/test_06_lingoparse.nlg +6 -0
- package/test/test_07_lingo.nlg +9 -9
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* column positioning: // // !
|
|
8
8
|
*
|
|
9
|
-
* Copyright (c) 2021-
|
|
9
|
+
* Copyright (c) 2021-2023 by Richard C. Zulch
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -88,7 +88,7 @@ closure TimeKeys(prefix, baseMS, local timekeys, prelen) {
|
|
|
88
88
|
// partition key in the specified direction, or false if there are no more keys. Dates in the
|
|
89
89
|
// future are considered invalid and return false.
|
|
90
90
|
//
|
|
91
|
-
timekeys.adjustPartID = function adjustPartID(partID, adjust, local
|
|
91
|
+
timekeys.adjustPartID = function adjustPartID(partID, adjust, local yyyy, doy, dayms, msec) {
|
|
92
92
|
partID = partID.slice(prelen)
|
|
93
93
|
yyyy = toint(partID.substring(0,4))
|
|
94
94
|
doy = toint(partID.substring(4,7))
|
|
@@ -246,7 +246,7 @@ closure DynaConverter(local conv) {
|
|
|
246
246
|
// datumDynToNaan
|
|
247
247
|
// Convert a DynamoDB typed attribute to Naan format.
|
|
248
248
|
//
|
|
249
|
-
conv.datumDynToNaan = function datumDynToNaan(dtype, dvalue
|
|
249
|
+
conv.datumDynToNaan = function datumDynToNaan(dtype, dvalue) {
|
|
250
250
|
if dtype == "BS" || dtype == "SS"
|
|
251
251
|
dvalue
|
|
252
252
|
else if dtype == "NS"
|
|
@@ -305,7 +305,7 @@ closure DynaConverter(local conv) {
|
|
|
305
305
|
// specified parameter block.
|
|
306
306
|
//
|
|
307
307
|
closure genAttributeNameAdder(params, local adex) {
|
|
308
|
-
function attrib(name, local
|
|
308
|
+
function attrib(name, local key, data) {
|
|
309
309
|
if !string(name)
|
|
310
310
|
name = tostring(name) // try to make it a string
|
|
311
311
|
if !params.ExpressionAttributeNames
|
|
@@ -377,7 +377,7 @@ closure DynaConverter(local conv) {
|
|
|
377
377
|
//
|
|
378
378
|
|
|
379
379
|
conv.createKeyExpression = function createKeyExpression(params, conds
|
|
380
|
-
local
|
|
380
|
+
local attval, rangename, range, keyname, op, expr, rangex, arg1, arg2) {
|
|
381
381
|
|
|
382
382
|
// dupeop
|
|
383
383
|
//
|
|
@@ -535,7 +535,7 @@ closure DynaTable(dyna, tablename, local table) {
|
|
|
535
535
|
// rangeType: <name> // string | numeric (if exists)
|
|
536
536
|
// }
|
|
537
537
|
//
|
|
538
|
-
table.info = closure info(local params, pending
|
|
538
|
+
table.info = closure info(local params, pending) {
|
|
539
539
|
if !dyna.aws
|
|
540
540
|
return (list(Error("DynaTable.info: not logged into AWS")))
|
|
541
541
|
params = {
|
|
@@ -691,7 +691,7 @@ closure DynaTable(dyna, tablename, local table) {
|
|
|
691
691
|
}
|
|
692
692
|
params.Key = makeDynKey(list(hashValue, rangeValue))
|
|
693
693
|
pending = new(nonce)
|
|
694
|
-
dyna.aws.getItem(params, function(error, data
|
|
694
|
+
dyna.aws.getItem(params, function(error, data) {
|
|
695
695
|
if error {
|
|
696
696
|
dynaTableError = error
|
|
697
697
|
debuglog("aws.getItem failed", tablename, ErrorString(error))
|
|
@@ -716,7 +716,7 @@ closure DynaTable(dyna, tablename, local table) {
|
|
|
716
716
|
Item: dyna.conv.recordNaanToDyn(record)
|
|
717
717
|
}
|
|
718
718
|
pending = new(nonce)
|
|
719
|
-
dyna.aws.putItem(params, function(error, data
|
|
719
|
+
dyna.aws.putItem(params, function(error, data) {
|
|
720
720
|
if error {
|
|
721
721
|
dynaTableError = error
|
|
722
722
|
debuglog("aws.putItem failed", tablename, ErrorString(error))
|
|
@@ -745,7 +745,7 @@ closure DynaTable(dyna, tablename, local table) {
|
|
|
745
745
|
// The result is a standard result tuple `(error, record).
|
|
746
746
|
|
|
747
747
|
table.updateRecord = closure updateRecord(hashValue, rangeValue, options,
|
|
748
|
-
local error, params,
|
|
748
|
+
local error, params, pending) {
|
|
749
749
|
if preflightError(this)
|
|
750
750
|
return
|
|
751
751
|
params = {
|
|
@@ -817,7 +817,7 @@ closure DynaTable(dyna, tablename, local table) {
|
|
|
817
817
|
params.ReturnValues = "NONE"
|
|
818
818
|
}
|
|
819
819
|
pending = new(nonce)
|
|
820
|
-
dyna.aws.deleteItem(params, function(error, data
|
|
820
|
+
dyna.aws.deleteItem(params, function(error, data) {
|
|
821
821
|
if error {
|
|
822
822
|
dynaTableError = error
|
|
823
823
|
debuglog("aws.deleteItem failed", tablename, ErrorString(error))
|
|
@@ -868,7 +868,7 @@ closure DynaTable(dyna, tablename, local table) {
|
|
|
868
868
|
//
|
|
869
869
|
|
|
870
870
|
table.queryRecords = closure queryRecords(hashValue, options
|
|
871
|
-
local error, params, hashKey,
|
|
871
|
+
local error, params, hashKey, output)
|
|
872
872
|
{
|
|
873
873
|
if preflightError(this)
|
|
874
874
|
return
|
|
@@ -937,7 +937,7 @@ closure DynaTable(dyna, tablename, local table) {
|
|
|
937
937
|
//
|
|
938
938
|
|
|
939
939
|
table.scanRecords = closure scanRecords(options
|
|
940
|
-
local params,
|
|
940
|
+
local params, output, error)
|
|
941
941
|
{
|
|
942
942
|
if preflightError(this)
|
|
943
943
|
return
|
|
@@ -365,7 +365,7 @@ closure dawsTable(database, path, tableOptions, local table) {
|
|
|
365
365
|
//
|
|
366
366
|
// Convert an S3 get response to a new table document.
|
|
367
367
|
|
|
368
|
-
function s3resp2doc(resp, local doc
|
|
368
|
+
function s3resp2doc(resp, local doc) {
|
|
369
369
|
if resp.Metadata.naandbt
|
|
370
370
|
try {
|
|
371
371
|
doc = new(JSONparse(resp.Metadata.naandbt))
|
|
@@ -787,7 +787,7 @@ closure S3DB(s3b, local database, result) {
|
|
|
787
787
|
//
|
|
788
788
|
// Delete the database and close it.
|
|
789
789
|
|
|
790
|
-
database.destroy = function destroy(
|
|
790
|
+
database.destroy = function destroy() {
|
|
791
791
|
if !database.bucket
|
|
792
792
|
return (list(Error("database closed")))
|
|
793
793
|
list(Error("not sure how to destroy this database")) // ### delete the base object?
|
package/test/harness.nlg
CHANGED
|
@@ -28,7 +28,8 @@ Naan.module.chns("Play");;
|
|
|
28
28
|
*
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
closure Parsenv(name, local penv, gohome,
|
|
31
|
+
closure Parsenv(name, local penv, gohome, lingo, naansym) {
|
|
32
|
+
global()
|
|
32
33
|
penv = new(object, this)
|
|
33
34
|
gohome = makeActivator()
|
|
34
35
|
sleep(1)
|
package/test/test_05_strings.nlg
CHANGED
|
@@ -524,6 +524,12 @@ RegisterTestCategory("Lingo parse", [
|
|
|
524
524
|
{ errors: "undeclared global at (1, 26) found c" } ],
|
|
525
525
|
[ "function(a) { global(b), c * a };",
|
|
526
526
|
{ errors: "undeclared global at (1, 26) found c" } ],
|
|
527
|
+
[ "closure nest() { function t() { function t() { 3 } } };", "nest"],
|
|
528
|
+
[ "function errch1() { global(), while:seeking true { loop { break:seeking } } };", "errch1" ],
|
|
529
|
+
[ "closure errch2() { global(), function a() { b.proc }, function b() { a } };", "errch2" ],
|
|
530
|
+
[ "function errch3(local a) { f.g(function() { a = 3 }) };", "errch3" ],
|
|
531
|
+
[ "function errch4(local a) { try {} catch { if true { a=3 } } };", "errch4" ],
|
|
532
|
+
[ "function errch5() { function&(local a) { } };", "errch5"]
|
|
527
533
|
]);
|
|
528
534
|
|
|
529
535
|
|
package/test/test_07_lingo.nlg
CHANGED
|
@@ -301,14 +301,14 @@ RegisterTestCategory("Lingo", [
|
|
|
301
301
|
"function() {"
|
|
302
302
|
" loop {"
|
|
303
303
|
" if 1 {"
|
|
304
|
-
"
|
|
304
|
+
" f(), if false"
|
|
305
305
|
" break"
|
|
306
|
-
" }, 3, break } });>", "(function lambda false (loop false (((identity 1)
|
|
306
|
+
" }, 3, break } });>", "(function lambda false (loop false (((identity 1) (f) ((identity false) (break)))) 3 (break)))" ],
|
|
307
307
|
|
|
308
|
-
[ "quote(function(){if 1 {
|
|
308
|
+
[ "quote(function(){if 1 { f(), if 3 { if 4 5 } else 6 } else 7 });",
|
|
309
309
|
"function () {\n"
|
|
310
310
|
" if 1 {\n"
|
|
311
|
-
"
|
|
311
|
+
" (f)\n"
|
|
312
312
|
" if 3 {\n"
|
|
313
313
|
" if 4\n"
|
|
314
314
|
" 5 }\n"
|
|
@@ -387,7 +387,7 @@ RegisterTestCategory("Lingo", [
|
|
|
387
387
|
[ "for x in `(a b c) print(x);>", "abc|Dictionary{8}" ],
|
|
388
388
|
[ "function() { loop { if x > 3 break, 4 } };>", "(function lambda false (loop false ((> x 3)) 4))" ],
|
|
389
389
|
[ "function () { for xx in [a,b,c] { if true { if xx eq 3, break }, print(xx) } }();>", "abc|Dictionary{7}" ],
|
|
390
|
-
[ "function (x) { loop try {
|
|
390
|
+
[ "function (x) { loop try { f(), if x continue, 2, break } catch { 3 } }();", "2" ],
|
|
391
391
|
|
|
392
392
|
[ "miter=iterate(`(a,b,c), `x);", "{\n"
|
|
393
393
|
" target : (a, b, c),\n"
|
|
@@ -455,11 +455,11 @@ RegisterTestCategory("Lingo", [
|
|
|
455
455
|
[ "function(){function jim(){ print(\"1\"),function jim(){print(\"2\")}, jim()}, jim()}();", "12|\"2\"" ],
|
|
456
456
|
[ "closure(){function jim(){ print(\"1\"),function jim(){print(\"2\")}, jim()}, jim()}();", "12|\"2\"" ],
|
|
457
457
|
[ "function(){function jim(){print(\"1\")},function jim(){print(\"2\")}, jim()}();",
|
|
458
|
-
{ errors: "
|
|
458
|
+
{ errors: "duplicate procedure name at (1, 48) found jim" } ],
|
|
459
459
|
[ "closure(){function jim(){print(\"1\")},function jim(){print(\"2\")}, jim()}();",
|
|
460
|
-
{ errors: "
|
|
460
|
+
{ errors: "duplicate procedure name at (1, 47) found jim" } ],
|
|
461
461
|
[ "function(){function jim(){print(\"1\")}(),function jim(){print(\"2\")}, jim()}();",
|
|
462
|
-
{ errors: "
|
|
462
|
+
{ errors: "duplicate procedure name at (1, 50) found jim" } ],
|
|
463
463
|
|
|
464
464
|
[ "function(){{spawn:function(){[{ok:true}]}}};", "function () {\n"
|
|
465
465
|
" {\n"
|
|
@@ -482,7 +482,7 @@ RegisterTestCategory("Lingo", [
|
|
|
482
482
|
[ "function eee(f) { print(f), function iii(f) { print(f), ccc() }(7) } (4);", "47|f" ],
|
|
483
483
|
[ "function fff(f) { print(f), function& iii(f) { print(f), ccc() }(9) } (6);", "69|f" ],
|
|
484
484
|
|
|
485
|
-
[ "function (f
|
|
485
|
+
[ "function (f) { print(f), function jjj(f) { print(f), ccc() }, jjj(21) } (22);", "2221|f" ],
|
|
486
486
|
[ "function& (f, local jjj) { print(f), function jjj(f) { print(f), ccc() }, jjj(23) } (24);", "2423|24" ],
|
|
487
487
|
|
|
488
488
|
[ "function (g, local f) { f = 17, function f(g) { print(f, g), ccc() }, f(25) } (26);", "1725|f" ],
|