@naanlang/naan 1.4.4 → 1.5.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 +2 -2
- package/README.md +4 -4
- package/bin/index.js +20 -2
- package/dist/env_web.js +2 -2
- package/dist/naan.min.js +4 -4
- package/frameworks/browser/browser.nlg +2 -2
- package/frameworks/browser/sworker.js +23 -23
- package/frameworks/browser/terminals.nlg +14 -8
- package/frameworks/client/apiclient.nlg +31 -18
- package/frameworks/client/client.nlg +22 -2
- package/frameworks/client/psm_client.nlg +12 -3
- package/frameworks/node/filesystem.nlg +9 -7
- package/frameworks/node/gitter.nlg +9 -7
- package/frameworks/node/shell.nlg +4 -4
- package/frameworks/project/projects.nlg +2 -1
- package/frameworks/storage/dbt_pouch.nlg +26 -13
- package/frameworks/storage/psm.nlg +39 -5
- package/frameworks/storage/psm_dbtables.nlg +10 -2
- package/lib/browser/env_web.js +9 -9
- package/lib/browser/env_webworker.js +1 -2
- package/lib/core/naanlib.js +4 -4
- package/package.json +1 -1
- package/plugins/serviceAws/aws_cloudwatchlogs.nlg +2 -1
- package/plugins/serviceAws/aws_dynamo.nlg +1 -0
- package/plugins/serviceAws/aws_s3.nlg +3 -3
- package/plugins/serviceAws/aws_sqs.nlg +3 -1
- package/plugins/serviceAws/aws_utils.nlg +3 -1
- package/plugins/serviceAws/dbt_aws.nlg +22 -20
- package/plugins/serviceAws/psm_aws.nlg +2 -1
- package/test/test_03_jsinterop.nlg +32 -3
- package/plugins/serviceGC/russian_trusted_root_ca_pem.crt +0 -33
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* column positioning: // // !
|
|
8
8
|
*
|
|
9
|
-
* Copyright (c) 2021-
|
|
9
|
+
* Copyright (c) 2021-2025 by Richard C. Zulch
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
closure CloudWatchLogs(local cwlogs) {
|
|
22
|
+
global(awsSDK)
|
|
22
23
|
cwlogs = new(object, this)
|
|
23
24
|
|
|
24
25
|
//
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* column positioning: // // !
|
|
8
8
|
*
|
|
9
|
-
* Copyright (c) 2020-
|
|
9
|
+
* Copyright (c) 2020-2025 by Richard C. Zulch
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
closure S3bucket(s3, name, bucketOptions, local bucket) {
|
|
25
|
+
global()
|
|
25
26
|
bucket = new(object, this)
|
|
26
27
|
bucket.name = name
|
|
27
28
|
|
|
@@ -83,8 +84,6 @@ closure S3bucket(s3, name, bucketOptions, local bucket) {
|
|
|
83
84
|
// }
|
|
84
85
|
//
|
|
85
86
|
bucket.put = closure put(key, data, options, local params, pending) {
|
|
86
|
-
if !contentType
|
|
87
|
-
contentType = "application/octet-stream"
|
|
88
87
|
params = {
|
|
89
88
|
Bucket: bucket.name
|
|
90
89
|
Key: key
|
|
@@ -246,6 +245,7 @@ closure S3bucket(s3, name, bucketOptions, local bucket) {
|
|
|
246
245
|
*/
|
|
247
246
|
|
|
248
247
|
closure S3(local s3) {
|
|
248
|
+
global(awsSDK)
|
|
249
249
|
s3 = new(object, this)
|
|
250
250
|
|
|
251
251
|
//
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* column positioning: // // !
|
|
8
8
|
*
|
|
9
|
-
* Copyright (c) 2023 by Richard C. Zulch
|
|
9
|
+
* Copyright (c) 2023-2025 by Richard C. Zulch
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
closure SqsMQ(sqs, queueUrl, local sqsq) {
|
|
22
|
+
global()
|
|
22
23
|
sqsq = new(object, this)
|
|
23
24
|
|
|
24
25
|
//
|
|
@@ -55,6 +56,7 @@ closure SqsMQ(sqs, queueUrl, local sqsq) {
|
|
|
55
56
|
*/
|
|
56
57
|
|
|
57
58
|
closure SQS(local sqs) {
|
|
59
|
+
global(awsSDK)
|
|
58
60
|
sqs = new(object, this)
|
|
59
61
|
|
|
60
62
|
//
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* column positioning: // // !
|
|
8
8
|
*
|
|
9
|
-
* Copyright (c) 2021 by Richard C. Zulch
|
|
9
|
+
* Copyright (c) 2021-2025 by Richard C. Zulch
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
closure queryPager(apiobject, procname, params, xargs, doneCB, local pending, looping, result) {
|
|
25
|
+
global()
|
|
25
26
|
if !apiobject[procname]
|
|
26
27
|
return (list(Error("queryPager method undefined:", procname)))
|
|
27
28
|
pending = new(nonce)
|
|
@@ -55,6 +56,7 @@ closure queryPager(apiobject, procname, params, xargs, doneCB, local pending, lo
|
|
|
55
56
|
*/
|
|
56
57
|
|
|
57
58
|
function QueryPager args {
|
|
59
|
+
global()
|
|
58
60
|
closure(local apiobject, procname, params, xargs, doneCB) {
|
|
59
61
|
apiobject = pop(args)
|
|
60
62
|
procname = pop(args)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* column positioning: // // !
|
|
8
8
|
*
|
|
9
|
-
* Copyright (c) 2020-
|
|
9
|
+
* Copyright (c) 2020-2025 by Richard C. Zulch
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
closure dawsBucket(s3b, local bucket, s3) {
|
|
25
|
+
global(JSpath)
|
|
25
26
|
bucket = new(object, this)
|
|
26
27
|
s3 = s3b.s3
|
|
27
28
|
bucket.name = s3b.bucketName
|
|
@@ -311,6 +312,7 @@ closure dawsBucket(s3b, local bucket, s3) {
|
|
|
311
312
|
*/
|
|
312
313
|
|
|
313
314
|
closure dawsTable(database, path, tableOptions, local table) {
|
|
315
|
+
global(js, TextDecoder)
|
|
314
316
|
table = new(object, this)
|
|
315
317
|
table.type = database.type
|
|
316
318
|
table.db = database
|
|
@@ -411,9 +413,10 @@ closure dawsTable(database, path, tableOptions, local table) {
|
|
|
411
413
|
|
|
412
414
|
// add
|
|
413
415
|
//
|
|
414
|
-
// Add a new record to the table with
|
|
415
|
-
//
|
|
416
|
-
//
|
|
416
|
+
// Add a new record to the table with options. This will fail if the key already exists. Optional
|
|
417
|
+
// metadata is stored with the record and cannot be changed without calling update. Metadata keys
|
|
418
|
+
// cannot begin with underscore ("_"). If optional cacheControl is not specified then the default
|
|
419
|
+
// tableOptions.cacheControl is used.
|
|
417
420
|
//
|
|
418
421
|
// The returned document, which can be used with update, has the following keys:
|
|
419
422
|
// key - the key name of the record
|
|
@@ -421,26 +424,25 @@ closure dawsTable(database, path, tableOptions, local table) {
|
|
|
421
424
|
// md5 - the MD5 hash of the content
|
|
422
425
|
// <...> - the various metadata keys
|
|
423
426
|
|
|
424
|
-
table.add = closure add(key, content,
|
|
427
|
+
table.add = closure add(key, content, options, callback, local id, doc) {
|
|
425
428
|
if !callback
|
|
426
|
-
return (syncAdapter(add, key, content,
|
|
429
|
+
return (syncAdapter(add, key, content, options))
|
|
427
430
|
id = makeID(key)
|
|
428
431
|
if !string(id)
|
|
429
|
-
return (asyncResult(callback, id))
|
|
430
|
-
if metadata && !dictionary(metadata)
|
|
432
|
+
return (asyncResult(callback, id)) // error from makeID
|
|
433
|
+
if options.metadata && !dictionary(options.metadata)
|
|
431
434
|
return (asyncResult(callback, Error("invalid arguments")))
|
|
432
|
-
if metadata
|
|
433
|
-
doc = new(metadata)
|
|
435
|
+
if options.metadata
|
|
436
|
+
doc = new(options.metadata) // start with metadata
|
|
434
437
|
else
|
|
435
438
|
doc = { }
|
|
436
439
|
doc.key = key
|
|
437
440
|
doc.id = id
|
|
438
441
|
if content
|
|
439
442
|
doc.content = content
|
|
440
|
-
metadata = metadata2s3(metadata) // filter out any invalid metadata
|
|
441
443
|
database.bucket.put(id, content, {
|
|
442
|
-
metadata: metadata
|
|
443
|
-
cacheControl: tableOptions.cacheControl
|
|
444
|
+
metadata: metadata2s3(options.metadata) // filter metadata for s3
|
|
445
|
+
cacheControl: options.cacheControl || tableOptions.cacheControl
|
|
444
446
|
}, function(error, resp) {
|
|
445
447
|
if error
|
|
446
448
|
error = Error("add failed", error, id, { status: error.status })
|
|
@@ -453,17 +455,17 @@ closure dawsTable(database, path, tableOptions, local table) {
|
|
|
453
455
|
|
|
454
456
|
// update
|
|
455
457
|
//
|
|
456
|
-
// Update a record in the table using the document previously returned by add or get.
|
|
458
|
+
// Update a record in the table using the document previously returned by add or get. Specify
|
|
459
|
+
// options to update those values, otherwise existing/default values are used.
|
|
457
460
|
|
|
458
|
-
table.update = closure update(doc,
|
|
461
|
+
table.update = closure update(doc, options, callback) {
|
|
459
462
|
if !callback
|
|
460
|
-
return (syncAdapter(update, doc))
|
|
463
|
+
return (syncAdapter(update, doc, options))
|
|
461
464
|
if !doc._id || !doc._id.startsWith(table.s3prefix) || !doc._md5
|
|
462
465
|
return (asyncResult(callback, Error("invalid argument")))
|
|
463
|
-
metadata = metadata2s3(doc)
|
|
464
466
|
database.bucket.put(doc._id, doc.content, {
|
|
465
|
-
metadata: metadata
|
|
466
|
-
cacheControl: tableOptions.cacheControl
|
|
467
|
+
metadata: metadata2s3(options.metadata || doc)
|
|
468
|
+
cacheControl: options.cacheControl || tableOptions.cacheControl
|
|
467
469
|
}, function(error, resp) {
|
|
468
470
|
if error
|
|
469
471
|
error = Error("update failed", error, doc._id, { status: error.status })
|
|
@@ -519,7 +521,7 @@ closure dawsTable(database, path, tableOptions, local table) {
|
|
|
519
521
|
resp.content = readableStreamToArrayBuffer(resp.content)
|
|
520
522
|
else if jsTypedArray(resp.content)
|
|
521
523
|
resp.content = xnew(TextDecoder, "utf-8").decode(resp.content)
|
|
522
|
-
else if jsInstanceOf(resp.content, js.w.ReadableStream)
|
|
524
|
+
else if jsInstanceOf(resp.content, js.w.ReadableStream) // for browsers only
|
|
523
525
|
resp.content = xnew(TextDecoder, "utf-8").decode(readableStreamToArrayBuffer(resp.content))
|
|
524
526
|
resp._id = id }
|
|
525
527
|
callback(error, resp)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* column positioning: // // !
|
|
8
8
|
*
|
|
9
|
-
* Copyright (c) 2020-
|
|
9
|
+
* Copyright (c) 2020-2025 by Richard C. Zulch
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
closure psmaConnector(psm, local connClassID, connector, watch) {
|
|
22
|
+
global(awsSDK)
|
|
22
23
|
connClassID = "S3DB"
|
|
23
24
|
require("./dbt_aws.nlg")
|
|
24
25
|
connector = new(object, this)
|
|
@@ -35,11 +35,11 @@ RegisterTestCategory("JSinterop", [
|
|
|
35
35
|
|
|
36
36
|
[ "o(3);", {
|
|
37
37
|
"dev": { errors: "xcall \"[object Object]\": TypeError: object.apply is not a function" }
|
|
38
|
-
"prod": { errors: "xcall \"[object Object]\": TypeError:
|
|
38
|
+
"prod": { errors: "xcall \"[object Object]\": TypeError: e[3].apply is not a function" }
|
|
39
39
|
}[ "prod"]],
|
|
40
40
|
[ "o(Number);", {
|
|
41
41
|
"dev": { errors: "xcall \"[object Object]\": TypeError: object.apply is not a function" }
|
|
42
|
-
"prod": { errors: "xcall \"[object Object]\": TypeError:
|
|
42
|
+
"prod": { errors: "xcall \"[object Object]\": TypeError: e[3].apply is not a function" }
|
|
43
43
|
}[ "prod"]],
|
|
44
44
|
[ "Number(3);", "[Number 3]" ],
|
|
45
45
|
[ "Number(3).toString();", "\"3\"" ],
|
|
@@ -158,6 +158,35 @@ RegisterTestCategory("JSinterop", [
|
|
|
158
158
|
" } }" ],
|
|
159
159
|
|
|
160
160
|
[ "function&(top,local nth){ nth=0, loop { print(nth), closure(nth) { stacktrap(nth,function&(x) { print(\" loop-\",x,\"-\",nth) }) }(nth), if nth >= top break else nth = nth+1 }, }(9);",
|
|
161
|
-
"0 loop-Dictionary{0}-01 loop-Dictionary{0}-123456789 loop-true-2 loop-true-3 loop-true-4 loop-true-5 loop-true-6 loop-true-7 loop-true-8 loop-true-9|true" ]
|
|
161
|
+
"0 loop-Dictionary{0}-01 loop-Dictionary{0}-123456789 loop-true-2 loop-true-3 loop-true-4 loop-true-5 loop-true-6 loop-true-7 loop-true-8 loop-true-9|true" ],
|
|
162
|
+
|
|
163
|
+
//
|
|
164
|
+
// Callbacks
|
|
165
|
+
//
|
|
166
|
+
|
|
167
|
+
[ "function mycb() { mynon.wait(), 15 };", "mycb"],
|
|
168
|
+
[ "oocb=xnew()", "[object Object]" ],
|
|
169
|
+
[ "oocb.mycb=mycb.proc;>", "(function mycb false (`. mynon wait false) 15)" ],
|
|
170
|
+
[ "oocb.mycb();", "15" ],
|
|
171
|
+
[ "mynon = new(nonce);", "Nonce{3}" ],
|
|
172
|
+
[ "oocb.mycb();", "true" ],
|
|
173
|
+
|
|
174
|
+
[ "@\\.suspend = 7", "7" ],
|
|
175
|
+
[ "function mycb() { mynon.wait(), 16 };", "==> redefined: mycb|mycb"],
|
|
176
|
+
[ "oocb.mycb=mycb.proc;>", "(function mycb false (`. mynon wait false) 16)" ],
|
|
177
|
+
[ "oocb.mycb();", "7" ],
|
|
178
|
+
|
|
179
|
+
//
|
|
180
|
+
// JavaScript compiled functions
|
|
181
|
+
//
|
|
182
|
+
|
|
183
|
+
[ "putproc(`arbyarb, 'return(_lib.pl(narg,nthf));');", "[Compiled arbyarb]" ],
|
|
184
|
+
[ "arbyarb(3,5,2,4);", "3524|4" ],
|
|
185
|
+
|
|
186
|
+
[ "putproc(`bobbuiltin, 'builtin: return(_lib.j2n(_lib.n2j(cx)+_lib.n2j(cy)+_lib.n2j(cz)));');", "[Compiled bobbuiltin]" ],
|
|
187
|
+
[ "bobbuiltin(1,2,3,4);", "6" ],
|
|
188
|
+
|
|
189
|
+
[ "putproc(`joemacro, 'macro: _lib.idle();return(_lib.j2n(_lib.n2j(args[1])(_lib.n2j(args[2][1]))));');", "[Compiled joemacro]" ],
|
|
190
|
+
[ "joemacro(function(x){x+1}, 8);", "9" ]
|
|
162
191
|
|
|
163
192
|
]);
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
|
2
|
-
MIIFwjCCA6qgAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwcDELMAkGA1UEBhMCUlUx
|
|
3
|
-
PzA9BgNVBAoMNlRoZSBNaW5pc3RyeSBvZiBEaWdpdGFsIERldmVsb3BtZW50IGFu
|
|
4
|
-
ZCBDb21tdW5pY2F0aW9uczEgMB4GA1UEAwwXUnVzc2lhbiBUcnVzdGVkIFJvb3Qg
|
|
5
|
-
Q0EwHhcNMjIwMzAxMjEwNDE1WhcNMzIwMjI3MjEwNDE1WjBwMQswCQYDVQQGEwJS
|
|
6
|
-
VTE/MD0GA1UECgw2VGhlIE1pbmlzdHJ5IG9mIERpZ2l0YWwgRGV2ZWxvcG1lbnQg
|
|
7
|
-
YW5kIENvbW11bmljYXRpb25zMSAwHgYDVQQDDBdSdXNzaWFuIFRydXN0ZWQgUm9v
|
|
8
|
-
dCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMfFOZ8pUAL3+r2n
|
|
9
|
-
qqE0Zp52selXsKGFYoG0GM5bwz1bSFtCt+AZQMhkWQheI3poZAToYJu69pHLKS6Q
|
|
10
|
-
XBiwBC1cvzYmUYKMYZC7jE5YhEU2bSL0mX7NaMxMDmH2/NwuOVRj8OImVa5s1F4U
|
|
11
|
-
zn4Kv3PFlDB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