@naanlang/naan 1.0.3 → 1.0.6
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 +8 -6
- package/bin/index.js +2 -2
- package/dist/env_web.js +30 -6
- package/dist/naan.min.js +4 -4
- package/frameworks/browser/https_request.nlg +120 -0
- package/frameworks/browser/sworker.js +29 -39
- package/frameworks/browser/terminals.nlg +6 -4
- package/frameworks/browser/workers.nlg +13 -6
- package/frameworks/client/apiclient.nlg +1 -1
- package/frameworks/client/psm_client.nlg +80 -32
- package/frameworks/common/common.nlg +104 -26
- package/frameworks/common/preferences.nlg +1 -0
- package/frameworks/common/watching.nlg +1 -0
- package/frameworks/node/apiserver.nlg +9 -5
- package/frameworks/node/filesystem.nlg +89 -31
- 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 +29 -7
- package/frameworks/project/build.nlg +13 -7
- 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 +102 -20
- package/lib/browser/env_web.js +32 -8
- package/lib/core/naanlib.js +4 -4
- 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 +7 -6
- package/plugins/serviceAws/aws_dynamo.nlg +128 -45
- package/plugins/serviceAws/aws_lambda.nlg +11 -4
- package/plugins/serviceAws/aws_s3.nlg +44 -14
- package/plugins/serviceAws/dbt_aws.nlg +29 -36
- package/plugins/serviceAws/psm_aws.nlg +21 -16
- package/plugins/serviceAws/serviceAws.nlg +6 -4
- 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
|
@@ -11,18 +11,6 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
/*
|
|
15
|
-
* dawsValidateName
|
|
16
|
-
*
|
|
17
|
-
* True iff the specified name is valid here.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
function dawsValidateName(key, path) {
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
|
|
26
14
|
/*
|
|
27
15
|
* dawsBucket
|
|
28
16
|
*
|
|
@@ -33,12 +21,12 @@ function dawsValidateName(key, path) {
|
|
|
33
21
|
*
|
|
34
22
|
*/
|
|
35
23
|
|
|
36
|
-
closure dawsBucket(
|
|
24
|
+
closure dawsBucket(s3b, local bucket, s3) {
|
|
37
25
|
bucket = new(object, this)
|
|
38
|
-
|
|
39
|
-
bucket.name =
|
|
40
|
-
bucket.region =
|
|
41
|
-
if
|
|
26
|
+
s3 = s3b.s3
|
|
27
|
+
bucket.name = s3b.bucketName
|
|
28
|
+
bucket.region = s3b.region
|
|
29
|
+
if !s3 || !string(bucket.region) || bucket.region.length == 0 || !string(bucket.name) || bucket.bucket.length == 0
|
|
42
30
|
return (list(Error("invalid S3 parameter")))
|
|
43
31
|
|
|
44
32
|
// asyncResult
|
|
@@ -56,7 +44,7 @@ closure dawsBucket(s3, local bucket) {
|
|
|
56
44
|
// that the bucket is still open before beginning (or continuing) any operations.
|
|
57
45
|
|
|
58
46
|
bucket.close = function close() {
|
|
59
|
-
bucket.s3 = false
|
|
47
|
+
bucket.s3 = s3 = false // just remove access
|
|
60
48
|
list(false, { })
|
|
61
49
|
}
|
|
62
50
|
|
|
@@ -70,6 +58,7 @@ closure dawsBucket(s3, local bucket) {
|
|
|
70
58
|
if !s3
|
|
71
59
|
return (asyncResult(callback, Error("database closed")))
|
|
72
60
|
params = {
|
|
61
|
+
Bucket: bucket.name
|
|
73
62
|
Key: key
|
|
74
63
|
}
|
|
75
64
|
|
|
@@ -100,6 +89,7 @@ closure dawsBucket(s3, local bucket) {
|
|
|
100
89
|
if !s3
|
|
101
90
|
return (asyncResult(callback, Error("database closed")))
|
|
102
91
|
params = {
|
|
92
|
+
Bucket: bucket.name
|
|
103
93
|
Key: key
|
|
104
94
|
}
|
|
105
95
|
if data {
|
|
@@ -110,6 +100,7 @@ closure dawsBucket(s3, local bucket) {
|
|
|
110
100
|
mimeType = {
|
|
111
101
|
"css": "text/css",
|
|
112
102
|
"csv": "text/csv",
|
|
103
|
+
"gif": "image/gif",
|
|
113
104
|
"htm": "text/html",
|
|
114
105
|
"html": "text/html",
|
|
115
106
|
"ico": "image/x-icon",
|
|
@@ -170,6 +161,7 @@ closure dawsBucket(s3, local bucket) {
|
|
|
170
161
|
if !s3
|
|
171
162
|
return (asyncResult(callback, Error("database closed")))
|
|
172
163
|
params = {
|
|
164
|
+
Bucket: bucket.name
|
|
173
165
|
Key: key
|
|
174
166
|
}
|
|
175
167
|
s3.deleteObject(params, function(error, resp) {
|
|
@@ -251,7 +243,9 @@ closure dawsBucket(s3, local bucket) {
|
|
|
251
243
|
|
|
252
244
|
if !s3
|
|
253
245
|
return (asyncResult(callback, Error("database closed")))
|
|
254
|
-
params = {
|
|
246
|
+
params = {
|
|
247
|
+
Bucket: bucket.name
|
|
248
|
+
}
|
|
255
249
|
if string(prefix)
|
|
256
250
|
params.Prefix = prefix
|
|
257
251
|
if onelevel
|
|
@@ -402,7 +396,7 @@ closure dawsTable(database, path, local table) {
|
|
|
402
396
|
metadata = metadata2s3(metadata) // filter out any invalid metadata
|
|
403
397
|
database.bucket.put(id, content, metadata, function(error, resp) {
|
|
404
398
|
if error
|
|
405
|
-
error = Error("add failed", error, id, { status: error.
|
|
399
|
+
error = Error("add failed", error, id, { status: error.$metadata.httpStatusCode })
|
|
406
400
|
else {
|
|
407
401
|
doc.md5 = resp.md5 // update the original doc
|
|
408
402
|
doc.length = resp.length }
|
|
@@ -422,7 +416,7 @@ closure dawsTable(database, path, local table) {
|
|
|
422
416
|
metadata = metadata2s3(doc)
|
|
423
417
|
database.bucket.put(doc._id, doc.content, metadata, function(error, resp) {
|
|
424
418
|
if error
|
|
425
|
-
error = Error("update failed", error, doc._id, { status: error.
|
|
419
|
+
error = Error("update failed", error, doc._id, { status: error.$metadata.httpStatusCode })
|
|
426
420
|
else {
|
|
427
421
|
doc.md5 = resp.md5 // update the original doc
|
|
428
422
|
doc.modified = undefined // we don't know exact modify date
|
|
@@ -443,7 +437,7 @@ closure dawsTable(database, path, local table) {
|
|
|
443
437
|
return (asyncResult(callback, Error("invalid argument")))
|
|
444
438
|
database.bucket.delete(doc._id, function(error, resp) {
|
|
445
439
|
if error
|
|
446
|
-
error = Error("delete failed", error, doc._id, { status: error.
|
|
440
|
+
error = Error("delete failed", error, doc._id, { status: error.$metadata.httpStatusCode })
|
|
447
441
|
callback(error, resp)
|
|
448
442
|
})
|
|
449
443
|
}
|
|
@@ -460,7 +454,7 @@ closure dawsTable(database, path, local table) {
|
|
|
460
454
|
return (asyncResult(callback, id)) // error from makeID
|
|
461
455
|
database.bucket.get(id, false, function(error, resp) {
|
|
462
456
|
if error
|
|
463
|
-
error = Error("get failed", error, id, { status: error.
|
|
457
|
+
error = Error("get failed", error, id, { status: error.$metadata.httpStatusCode })
|
|
464
458
|
else {
|
|
465
459
|
resp.key = key
|
|
466
460
|
resp = s3resp2doc(resp)
|
|
@@ -493,7 +487,7 @@ closure dawsTable(database, path, local table) {
|
|
|
493
487
|
return (asyncResult(callback, id)) // error from makeID
|
|
494
488
|
database.bucket.get(id, true, function(error, resp) {
|
|
495
489
|
if error
|
|
496
|
-
error = Error("md5 failed", error, id, { status: error.
|
|
490
|
+
error = Error("md5 failed", error, id, { status: error.$metadata.httpStatusCode })
|
|
497
491
|
else if resp._md5
|
|
498
492
|
resp = resp._md5
|
|
499
493
|
else
|
|
@@ -518,7 +512,7 @@ closure dawsTable(database, path, local table) {
|
|
|
518
512
|
if id.slice(-1) == "/"
|
|
519
513
|
database.bucket.list(id.slice(0,-1), true, function blcb(error, resp) {
|
|
520
514
|
if error
|
|
521
|
-
error = Error("head failed", error, id, { status: error.
|
|
515
|
+
error = Error("head failed", error, id, { status: error.$metadata.httpStatusCode })
|
|
522
516
|
else if id != resp.CommonPrefixes.0.Prefix {
|
|
523
517
|
error = Error("head not found", id, resp.CommonPrefixes.0.Prefix, { status: 404 })
|
|
524
518
|
resp = false
|
|
@@ -532,7 +526,7 @@ closure dawsTable(database, path, local table) {
|
|
|
532
526
|
else
|
|
533
527
|
database.bucket.get(id, true, function bgcb(error, resp) {
|
|
534
528
|
if error
|
|
535
|
-
error = Error("head failed", error, id, { status: error.
|
|
529
|
+
error = Error("head failed", error, id, { status: error.$metadata.httpStatusCode })
|
|
536
530
|
else {
|
|
537
531
|
resp.key = key
|
|
538
532
|
resp = s3resp2doc(resp)
|
|
@@ -559,7 +553,7 @@ closure dawsTable(database, path, local table) {
|
|
|
559
553
|
error = Error("copy failed", {
|
|
560
554
|
source: srckey
|
|
561
555
|
destination: destkey
|
|
562
|
-
status: error.
|
|
556
|
+
status: error.$metadata.httpStatusCode
|
|
563
557
|
}, error)
|
|
564
558
|
callback(error, resp)
|
|
565
559
|
})
|
|
@@ -651,7 +645,7 @@ closure dawsTable(database, path, local table) {
|
|
|
651
645
|
s3prefix = table.s3prefix
|
|
652
646
|
database.bucket.list(s3prefix, !options.deep, function(error, objects, local obj, key) {
|
|
653
647
|
if error
|
|
654
|
-
error = Error("records list failed", error, options.prefix, { status: error.
|
|
648
|
+
error = Error("records list failed", error, options.prefix, { status: error.$metadata.httpStatusCode })
|
|
655
649
|
else {
|
|
656
650
|
for obj in objects.Contents {
|
|
657
651
|
if obj.Key.startsWith(table.s3prefix)
|
|
@@ -694,13 +688,13 @@ closure dawsTable(database, path, local table) {
|
|
|
694
688
|
*
|
|
695
689
|
*/
|
|
696
690
|
|
|
697
|
-
closure S3DB(
|
|
691
|
+
closure S3DB(s3b, local database, result) {
|
|
698
692
|
database = new(object, this)
|
|
699
|
-
result = dawsBucket(
|
|
693
|
+
result = dawsBucket(s3b)
|
|
700
694
|
if result.0
|
|
701
695
|
return (result) // can't access bucket
|
|
702
696
|
database.bucket = result.1
|
|
703
|
-
database.
|
|
697
|
+
database.s3b = s3b
|
|
704
698
|
database.type = "Amazon S3"
|
|
705
699
|
|
|
706
700
|
// isopen
|
|
@@ -720,7 +714,6 @@ closure S3DB(s3, local database, result) {
|
|
|
720
714
|
return (list(Error("database closed")))
|
|
721
715
|
database.bucket.close()
|
|
722
716
|
database.bucket = false
|
|
723
|
-
database.s3 = false
|
|
724
717
|
list(false, { ok: true })
|
|
725
718
|
}
|
|
726
719
|
|
|
@@ -732,10 +725,10 @@ closure S3DB(s3, local database, result) {
|
|
|
732
725
|
if !database.bucket
|
|
733
726
|
return (list(Error("database closed")))
|
|
734
727
|
result = {
|
|
735
|
-
type:
|
|
728
|
+
type: database.type
|
|
736
729
|
info: {
|
|
737
|
-
region:
|
|
738
|
-
bucket:
|
|
730
|
+
region: s3b.region
|
|
731
|
+
bucket: s3b.bucketName
|
|
739
732
|
}
|
|
740
733
|
}
|
|
741
734
|
list(false, result)
|
|
@@ -778,7 +771,7 @@ closure S3DB(s3, local database, result) {
|
|
|
778
771
|
|
|
779
772
|
function dawsInit(local manifest) {
|
|
780
773
|
|
|
781
|
-
manifest = `(
|
|
774
|
+
manifest = `(dawsBucket, dawsTable, S3DB, dawsInit)
|
|
782
775
|
|
|
783
776
|
Naan.module.build(module.id, "dbt_aws", function(modobj, compobj) {
|
|
784
777
|
require("./serviceAws.nlg")
|
|
@@ -54,12 +54,12 @@ closure psmaConnector(psm, local connClassID, connector, watch) {
|
|
|
54
54
|
// findResource
|
|
55
55
|
//
|
|
56
56
|
// Find a resource with the specified contents, returning the resID or false.
|
|
57
|
-
connector.findResource = function findResource(resource, local resID, creds) {
|
|
57
|
+
connector.findResource = function findResource(resource, local resID, error, creds) {
|
|
58
58
|
for resID in listResources().1 {
|
|
59
|
-
creds =
|
|
60
|
-
if (
|
|
59
|
+
`(error, creds) = connector.vault.accessResource(resID)
|
|
60
|
+
if creds && (!resource.region || resource.region == creds.region)
|
|
61
61
|
&& (!resource.bucketName || resource.bucketName == creds.bucketName)
|
|
62
|
-
&& (!resource.label || resource.label == creds.
|
|
62
|
+
&& (!resource.label || resource.label == creds.label)
|
|
63
63
|
return (resID)
|
|
64
64
|
}
|
|
65
65
|
false
|
|
@@ -209,28 +209,33 @@ closure psmaConnector(psm, local connClassID, connector, watch) {
|
|
|
209
209
|
//
|
|
210
210
|
// Return an S3 access object, which is the credentials to access an AWS S3 bucket.
|
|
211
211
|
|
|
212
|
-
connector.access = function access(resID, local error, creds,
|
|
212
|
+
connector.access = function access(resID, local error, creds, s3b) {
|
|
213
213
|
`(error, creds) = connector.vault.accessResource(resID)
|
|
214
214
|
if error
|
|
215
215
|
return (list(error)) // can't access that resource
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
216
|
+
if !awsSDK.S3
|
|
217
|
+
return (list(Error("S3 connector: no AWS SDK available")))
|
|
218
|
+
s3b = {
|
|
219
|
+
s3: xnew(awsSDK.S3, {
|
|
220
|
+
region: creds.region
|
|
221
|
+
credentials: {
|
|
222
|
+
accessKeyId: creds.keyID
|
|
223
|
+
secretAccessKey: creds.keySecret
|
|
224
|
+
}})
|
|
225
|
+
bucketName: creds.bucketName
|
|
226
|
+
region: creds.region
|
|
227
|
+
}
|
|
228
|
+
list(false, s3b)
|
|
224
229
|
}
|
|
225
230
|
|
|
226
231
|
// connect
|
|
227
232
|
//
|
|
228
233
|
// Connect to an AWS bucket filesystem, returning a view.
|
|
229
234
|
|
|
230
|
-
connector.connect = function connect(resID, service, args, local error,
|
|
231
|
-
`(error,
|
|
235
|
+
connector.connect = function connect(resID, service, args, local error, s3b, db, table) {
|
|
236
|
+
`(error, s3b) = connector.access(resID)
|
|
232
237
|
if !error
|
|
233
|
-
`(error, db) = S3DB(
|
|
238
|
+
`(error, db) = S3DB(s3b) // get S3 bucket as a database
|
|
234
239
|
if error
|
|
235
240
|
list(error)
|
|
236
241
|
else if service == "NideDB"
|
|
@@ -19,17 +19,19 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
function sawsInit(local manifest) {
|
|
22
|
-
manifest = `(sawsInit)
|
|
22
|
+
manifest = `(awsSDK, sawsLoadList, sawsSetPostLoadCall, sawsCallPostload, sawsInit)
|
|
23
23
|
|
|
24
24
|
Naan.module.build(module.id, "serviceAws", function(modobj, compobj) {
|
|
25
25
|
compobj.manifest = manifest
|
|
26
26
|
require("frameworks/common").LiveImport()
|
|
27
27
|
require("./aws_utils.nlg")
|
|
28
28
|
function sawsPostload() {
|
|
29
|
-
if js.
|
|
30
|
-
awsSDK = js.r("aws-sdk")
|
|
29
|
+
if js.lambda
|
|
30
|
+
awsSDK = js.r("/opt/aws-sdk-node.min.js") // SDK is a layer
|
|
31
|
+
else if js.g
|
|
32
|
+
awsSDK = js.r("aws-sdk-node.min") // SDK must be in search path
|
|
31
33
|
else
|
|
32
|
-
awsSDK = JsLoadScript(JSpath.join(module.locpath, "./aws/aws-sdk.min.js"), "
|
|
34
|
+
awsSDK = JsLoadScript(JSpath.join(module.locpath, "./aws/aws-sdk.min.js"), "awsSdk")
|
|
33
35
|
module.exports.awsSDK = awsSDK
|
|
34
36
|
if App.psm
|
|
35
37
|
require("./psm_aws.nlg").AwsConnector(App.psm)
|
package/test/harness.nlg
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* column positioning: // // !
|
|
8
8
|
*
|
|
9
|
-
* Copyright (c) 2020-
|
|
9
|
+
* Copyright (c) 2020-2022 by Richard C. Zulch
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -224,6 +224,8 @@ function RunTests(local totalTestCount, totalPassCount, totalTimeMS) {
|
|
|
224
224
|
result = parsenv.parse(cmd.concat("\n"))
|
|
225
225
|
else
|
|
226
226
|
return ("invalid cmd at test ".concat(testCounter, ": ", typeof(cmd), "\n"))
|
|
227
|
+
if symbol(expect)
|
|
228
|
+
expect = tostring(expect)
|
|
227
229
|
if string(expect) {
|
|
228
230
|
if result.errors.length > 0
|
|
229
231
|
return (strcat("test(\"", cmd, "\") failed:\n ", result.errors.join("|"), "\n"))
|
package/test/test_01_core.nlg
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
|
|
|
@@ -223,8 +223,8 @@ RegisterTestCategory("core", [
|
|
|
223
223
|
[ "unicode(\"Z\");", "0x5a" ],
|
|
224
224
|
[ "unicode(0x2609);", "\"☉\"" ],
|
|
225
225
|
[ "unicode(\"☉\");", "0x2609" ],
|
|
226
|
-
[ "unicode(
|
|
227
|
-
[ "unicode(\"
|
|
226
|
+
[ "unicode(0x1fad3);", "\"🫓\"" ], // "flatbread", i.e. naan
|
|
227
|
+
[ "unicode(\"🫓\");", "0x1fad3" ],
|
|
228
228
|
[ "unicode(0x1f35e);", "\"🍞\"" ],
|
|
229
229
|
[ "unicode(\"🍞\");", "0x1f35e" ],
|
|
230
230
|
[ "unicode(0x1f95c);", "\"🥜\"" ], // peanut, UNICODE 9.0 2016
|
|
@@ -707,7 +707,7 @@ RegisterTestCategory("core", [
|
|
|
707
707
|
[ "cons(`a);>", "(a)" ],
|
|
708
708
|
[ "cons(`a,`b);>", "(a . b)" ],
|
|
709
709
|
[ "cons(`a,`b,`c);>", "(a b . c)" ],
|
|
710
|
-
[ "length(stacktrace());", "
|
|
710
|
+
[ "length(stacktrace());", "55" ],
|
|
711
711
|
|
|
712
712
|
//
|
|
713
713
|
// lower builtin
|
|
@@ -764,5 +764,5 @@ RegisterTestCategory("core", [
|
|
|
764
764
|
// mangled
|
|
765
765
|
//
|
|
766
766
|
|
|
767
|
-
[ "mangled();", "
|
|
767
|
+
[ "mangled();", equal( "prod", "prod") ],
|
|
768
768
|
]);
|
package/test/test_02_context.nlg
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
|
|
|
@@ -206,10 +206,10 @@ RegisterTestCategory("context", [
|
|
|
206
206
|
[ "test2(6);", { errors: "exception: recursed 102" } ],
|
|
207
207
|
|
|
208
208
|
[ "function test1(x) { if x > 10000 printline(x) else 0+test2(x+1) };", "==> redefined: test1|test1" ],
|
|
209
|
-
[ "test2(7);", { errors: "exception: recursed
|
|
209
|
+
[ "test2(7);", { errors: "exception: recursed 149" } ],
|
|
210
210
|
|
|
211
211
|
[ "function test2(x) { testRecurCheck(x), if true test1(x+1) else print(x) };", "==> redefined: test2|test2" ],
|
|
212
|
-
[ "test2(8);", { errors: "exception: recursed
|
|
212
|
+
[ "test2(8);", { errors: "exception: recursed 150" } ],
|
|
213
213
|
|
|
214
214
|
[ "function test1(x) { if x > 10000 printline(x) else loop test2(x+1, 4, 5) };", "==> redefined: test1|test1" ],
|
|
215
215
|
[ "function test2(x,y,z) { testRecurCheck(x), loop if true { test1(x+1),break } else print(x) };", "==> redefined: test2|test2" ],
|
|
@@ -222,7 +222,7 @@ RegisterTestCategory("context", [
|
|
|
222
222
|
[ "oo=new(object);", "Object{0}"],
|
|
223
223
|
[ "oo.test1 = function test1(x) { if x > 10000 printline(x) else test2(x+1) };", "==> redefined: test1|test1"],
|
|
224
224
|
[ "oo.test2 = function test2 xt { testRecurCheck(car(xt)), oo.test1(car(xt)+1) };", "==> redefined: test2|test2"],
|
|
225
|
-
[ "oo.test1(11);", { errors: "exception: recursed
|
|
225
|
+
[ "oo.test1(11);", { errors: "exception: recursed 154" } ],
|
|
226
226
|
|
|
227
227
|
[ "function test1 xt { testRecurCheck(car(xt)), if car(xt) > 10000 printline(xt) else test1(car(xt)+1) };",
|
|
228
228
|
"==> redefined: test1|test1" ],
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* column positioning: // // !
|
|
8
8
|
*
|
|
9
|
-
* Copyright (c) 2020-
|
|
9
|
+
* Copyright (c) 2020-2022 by Richard C. Zulch
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -33,8 +33,14 @@ RegisterTestCategory("JSinterop", [
|
|
|
33
33
|
[ "o.a;", "undefined" ],
|
|
34
34
|
[ "o.nodef;", "undefined" ],
|
|
35
35
|
|
|
36
|
-
[ "o(3);", {
|
|
37
|
-
|
|
36
|
+
[ "o(3);", {
|
|
37
|
+
"dev": { errors: "xcall \"[object Object]\": TypeError: object.apply is not a function" }
|
|
38
|
+
"prod": { errors: "xcall \"[object Object]\": TypeError: e[3].apply is not a function" }
|
|
39
|
+
}[ "prod"]],
|
|
40
|
+
[ "o(Number);", {
|
|
41
|
+
"dev": { errors: "xcall \"[object Object]\": TypeError: object.apply is not a function" }
|
|
42
|
+
"prod": { errors: "xcall \"[object Object]\": TypeError: e[3].apply is not a function" }
|
|
43
|
+
}[ "prod"]],
|
|
38
44
|
[ "Number(3);", "[Number 3]" ],
|
|
39
45
|
[ "Number(3).toString();", "\"3\"" ],
|
|
40
46
|
[ "tostring(Number(3));", "\"[Number 3]\"" ],
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* aws_cognito.nlg
|
|
3
|
-
* serviceAws
|
|
4
|
-
*
|
|
5
|
-
* Access to Cognito services for AWS.
|
|
6
|
-
*
|
|
7
|
-
* column positioning: // // !
|
|
8
|
-
*
|
|
9
|
-
* Copyright (c) 2022 by Richard C. Zulch
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/*
|
|
15
|
-
* Cognito
|
|
16
|
-
*
|
|
17
|
-
* Cognito service functions.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
closure Cognito(userPoolID, local cogo) {
|
|
22
|
-
cogo = new(object, this)
|
|
23
|
-
cogo.userPoolID = userPoolID
|
|
24
|
-
|
|
25
|
-
//
|
|
26
|
-
// login
|
|
27
|
-
//
|
|
28
|
-
cogo.login = closure login(creds) {
|
|
29
|
-
cogo.aws = xnew(awsSDK.CognitoIdentityServiceProvider, {
|
|
30
|
-
apiVersion: '2016-04-18'
|
|
31
|
-
accessKeyId: creds.keyID,
|
|
32
|
-
secretAccessKey: creds.keySecret,
|
|
33
|
-
region: creds.region })
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
//
|
|
37
|
-
// getUser
|
|
38
|
-
//
|
|
39
|
-
cogo.adminGetUser = closure adminGetUser(username, local params, pending) {
|
|
40
|
-
params = {
|
|
41
|
-
UserPoolId: cogo.userPoolID
|
|
42
|
-
Username: username
|
|
43
|
-
}
|
|
44
|
-
pending = new(nonce)
|
|
45
|
-
cogo.aws.getFunction(params, function(error, data) {
|
|
46
|
-
if error {
|
|
47
|
-
cogoError = error
|
|
48
|
-
debuglog("aws.cognito.adminGetUser failed", error)
|
|
49
|
-
}
|
|
50
|
-
pending.signal(list(error, data))
|
|
51
|
-
})
|
|
52
|
-
pending.wait()
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// finis
|
|
56
|
-
cogo
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
/*
|
|
61
|
-
* cogoInit
|
|
62
|
-
*
|
|
63
|
-
* Initialize the Lambda module.
|
|
64
|
-
*
|
|
65
|
-
*/
|
|
66
|
-
|
|
67
|
-
function lambdaInit(local manifest) {
|
|
68
|
-
manifest = `(cogoInit, Cognito)
|
|
69
|
-
|
|
70
|
-
Naan.module.build(module.id, "aws_cognito", function(modobj, compobj) {
|
|
71
|
-
require("./serviceAws.nlg")
|
|
72
|
-
compobj.manifest = manifest
|
|
73
|
-
modobj.exports.Cognito = Cognito
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
} ();
|