@naanlang/naan 1.0.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 +21 -0
- package/README.md +46 -0
- package/dist/env_web.js +431 -0
- package/dist/naan.min.js +73 -0
- package/frameworks/browser/browser.nlg +30 -0
- package/frameworks/browser/pouchdb/pouchdb.min.js +7 -0
- package/frameworks/browser/spark-md5/spark-md5.min.js +1 -0
- package/frameworks/browser/sworker.js +192 -0
- package/frameworks/browser/terminals.nlg +787 -0
- package/frameworks/browser/workers.nlg +386 -0
- package/frameworks/client/apiclient.nlg +183 -0
- package/frameworks/client/client.nlg +29 -0
- package/frameworks/client/psm_client.nlg +572 -0
- package/frameworks/common/common.nlg +464 -0
- package/frameworks/common/preferences.nlg +131 -0
- package/frameworks/common/repltools.nlg +100 -0
- package/frameworks/common/watching.nlg +97 -0
- package/frameworks/node/apiserver.nlg +399 -0
- package/frameworks/node/filesystem.nlg +1012 -0
- package/frameworks/node/gitter.nlg +234 -0
- package/frameworks/node/node.nlg +81 -0
- package/frameworks/node/psm_server.nlg +465 -0
- package/frameworks/node/worker.nlg +560 -0
- package/frameworks/project/build.nlg +1229 -0
- package/frameworks/project/jszip.js +30 -0
- package/frameworks/project/jszip.nlg +87 -0
- package/frameworks/project/proj_cliser.nlg +139 -0
- package/frameworks/project/proj_console.nlg +137 -0
- package/frameworks/project/proj_folder.nlg +143 -0
- package/frameworks/project/proj_lambda.nlg +137 -0
- package/frameworks/project/proj_static.nlg +138 -0
- package/frameworks/project/project.nlg +29 -0
- package/frameworks/project/projects.nlg +587 -0
- package/frameworks/project/uglifyjs.js +1 -0
- package/frameworks/project/uglifyjs.nlg +79 -0
- package/frameworks/running/debugcom.nlg +163 -0
- package/frameworks/running/debugnub.nlg +565 -0
- package/frameworks/running/debugutil.nlg +510 -0
- package/frameworks/running/executors.nlg +767 -0
- package/frameworks/running/running.nlg +151 -0
- package/frameworks/running/sourcecode.nlg +346 -0
- package/frameworks/running/taskexec.nlg +196 -0
- package/frameworks/storage/dbt_pouch.nlg +773 -0
- package/frameworks/storage/file_manager.nlg +772 -0
- package/frameworks/storage/psm.nlg +326 -0
- package/frameworks/storage/psm_dbtables.nlg +814 -0
- package/frameworks/storage/resources.nlg +445 -0
- package/frameworks/storage/storage.nlg +52 -0
- package/lib/browser/env_web.js +431 -0
- package/lib/browser/env_webworker.js +146 -0
- package/lib/browser/require.js +1653 -0
- package/lib/core/naanlib.js +73 -0
- package/lib/env_node.js +282 -0
- package/lib/env_nodeworker.js +165 -0
- package/lib/node_repl.js +25 -0
- package/lib/node_repl_init.nlg +52 -0
- package/package.json +13 -0
- package/plugins/gitClient/clientops.nlg +317 -0
- package/plugins/gitClient/gitClient.nlg +63 -0
- package/plugins/gitClient/gitutils.nlg +1331 -0
- package/plugins/gitClient/minimatch.js +945 -0
- package/plugins/gitClient/minimatch_license.txt +15 -0
- package/plugins/gitClient/minimatch_readme.md +208 -0
- package/plugins/nodeLib/nodeLib.nlg +26 -0
- package/plugins/nodeLib/node_cp.nlg +65 -0
- package/plugins/nodeLib/node_fs.nlg +137 -0
- package/plugins/nodeLib/node_https.nlg +172 -0
- package/plugins/nodeLib/node_util.nlg +180 -0
- package/plugins/serviceAws/aws/aws-sdk.min.js +88 -0
- package/plugins/serviceAws/aws/lambda_rest_index.js +122 -0
- package/plugins/serviceAws/aws/lambda_rest_init.nlg +58 -0
- package/plugins/serviceAws/aws/lambda_ws_index.js +498 -0
- package/plugins/serviceAws/aws/lambda_ws_init.nlg +49 -0
- package/plugins/serviceAws/aws_cloudwatchlogs.nlg +122 -0
- package/plugins/serviceAws/aws_cognito.nlg +76 -0
- package/plugins/serviceAws/aws_dynamo.nlg +509 -0
- package/plugins/serviceAws/aws_lambda.nlg +95 -0
- package/plugins/serviceAws/aws_s3.nlg +134 -0
- package/plugins/serviceAws/aws_utils.nlg +86 -0
- package/plugins/serviceAws/dbt_aws.nlg +769 -0
- package/plugins/serviceAws/lambda_naan_control.nlg +175 -0
- package/plugins/serviceAws/psm_aws.nlg +258 -0
- package/plugins/serviceAws/serviceAws.nlg +38 -0
- package/plugins/serviceGitHub/gitops.nlg +522 -0
- package/plugins/serviceGitHub/psm_github.nlg +205 -0
- package/plugins/serviceGitHub/serviceGitHub.nlg +65 -0
- package/plugins/serviceGitLab/gitops.nlg +528 -0
- package/plugins/serviceGitLab/psm_gitlab.nlg +205 -0
- package/plugins/serviceGitLab/serviceGitLab.nlg +65 -0
- package/test/harness.nlg +312 -0
- package/test/node_test.js +33 -0
- package/test/test_01_core.nlg +768 -0
- package/test/test_02_context.nlg +269 -0
- package/test/test_03_jsinterop.nlg +137 -0
- package/test/test_04_numerics.nlg +450 -0
- package/test/test_05_strings.nlg +63 -0
- package/test/test_06_lingoparse.nlg +500 -0
- package/test/test_07_lingo.nlg +623 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* lambda_init.nlg
|
|
3
|
+
* serviceAws
|
|
4
|
+
*
|
|
5
|
+
* Initialize the AWS Lambda function in Naan for WebSockets.
|
|
6
|
+
*
|
|
7
|
+
* column positioning: // // !
|
|
8
|
+
*
|
|
9
|
+
* Copyright (c) 2019-2020 by Richard C. Zulch
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* initPreload
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
loglevel(2);
|
|
20
|
+
|
|
21
|
+
function initPreload() {
|
|
22
|
+
Naan.module.chns("Play")
|
|
23
|
+
sudo(putproc(exception, false)) // ### need a better mechanism
|
|
24
|
+
};
|
|
25
|
+
initPreload();
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
/*
|
|
29
|
+
* versionCheck
|
|
30
|
+
*
|
|
31
|
+
* Ensure that Node is at least as new as the specified version.
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
function versionCheck(minver, local rxver, curver) {
|
|
36
|
+
rxver = RegExp("([0-9]+)[.]([0-9]+)[.]([0-9]+)")
|
|
37
|
+
minver = minver.match(rxver).map(function(x){Number.parseInt(x)})
|
|
38
|
+
curver = js.g.process.version.match(rxver).map(function(x){Number.parseInt(x)})
|
|
39
|
+
minver[1] < curver[1] || minver[1] == curver[1] && (minver[2] < curver[2] || minver[2] == curver[2] && minver[3] <= curver[3])
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
cond (
|
|
43
|
+
if not versionCheck("10.0.0") {
|
|
44
|
+
debuglog("NodeJS too old; version 10.0.0 required.")
|
|
45
|
+
js.r("process").exit(2)
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
debuglog("end of lambda_init.nlg")
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* aws_cloudwatchlogs.nlg
|
|
3
|
+
* serviceAws
|
|
4
|
+
*
|
|
5
|
+
* Access to the CloudWatchLogs services for AWS.
|
|
6
|
+
*
|
|
7
|
+
* column positioning: // // !
|
|
8
|
+
*
|
|
9
|
+
* Copyright (c) 2021 by Richard C. Zulch
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* CloudWatchLogs
|
|
16
|
+
*
|
|
17
|
+
* CloudWatch service functions.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
closure CloudWatchLogs(local cwlogs) {
|
|
22
|
+
cwlogs = new(object, this)
|
|
23
|
+
|
|
24
|
+
//
|
|
25
|
+
// login
|
|
26
|
+
//
|
|
27
|
+
cwlogs.login = closure login(creds) {
|
|
28
|
+
cwlogs.aws = xnew(awsSDK.CloudWatchLogs, {
|
|
29
|
+
apiVersion: "2014-03-28",
|
|
30
|
+
accessKeyId: creds.keyID,
|
|
31
|
+
secretAccessKey: creds.keySecret,
|
|
32
|
+
region: creds.region })
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//
|
|
36
|
+
// cwlQueryPager
|
|
37
|
+
//
|
|
38
|
+
// Perform a CWL paged query. This implements paging conventions specific to CWL. The callback
|
|
39
|
+
// should return the number of items found in the data, or false to stop looping.
|
|
40
|
+
//
|
|
41
|
+
closure cwlQueryPager(procname, params, remaining, doneCB) {
|
|
42
|
+
if !remaining
|
|
43
|
+
remaining = 10 // default retrieve limit
|
|
44
|
+
params.limit = remaining
|
|
45
|
+
QueryPager(cwlogs.aws, procname, params, function(data, local processed) {
|
|
46
|
+
processed = doneCB(data)
|
|
47
|
+
if processed
|
|
48
|
+
remaining -= processed
|
|
49
|
+
if processed && remaining > 0 && data.nextToken && data.nextToken != params.nextToken {
|
|
50
|
+
params.limit = remaining // set up for next iteration
|
|
51
|
+
params.nextToken = data.nextToken
|
|
52
|
+
true // continue looping
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
//
|
|
58
|
+
// describeLogStreams
|
|
59
|
+
//
|
|
60
|
+
cwlogs.describeLogStreams = closure describeLogStreams(name, options,
|
|
61
|
+
local params, remaining, output, error)
|
|
62
|
+
{
|
|
63
|
+
params = {
|
|
64
|
+
logGroupName: name
|
|
65
|
+
descending: true
|
|
66
|
+
orderBy: LastEventTime
|
|
67
|
+
}
|
|
68
|
+
output = []
|
|
69
|
+
`(error) = cwlQueryPager(`describeLogStreams, params, options.limit, function(data) {
|
|
70
|
+
debuglog("describeLogStreams:", params.limit, data.logStreams.length, output.length)
|
|
71
|
+
if data.logStreams.length > 0
|
|
72
|
+
output = output.concat(new(data.logStreams))
|
|
73
|
+
data.logStreams.length
|
|
74
|
+
})
|
|
75
|
+
if error
|
|
76
|
+
output = false
|
|
77
|
+
list(error, output)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//
|
|
81
|
+
// getLogEvents
|
|
82
|
+
//
|
|
83
|
+
cwlogs.getLogEvents = closure getLogEvents(groupName, streamName, options
|
|
84
|
+
local params, remaining, output, error)
|
|
85
|
+
{
|
|
86
|
+
params = {
|
|
87
|
+
logGroupName: groupName
|
|
88
|
+
logStreamName: streamName
|
|
89
|
+
}
|
|
90
|
+
output = []
|
|
91
|
+
`(error) = cwlQueryPager(`getLogEvents, params, options.limit, function(data) {
|
|
92
|
+
debuglog("getLogEvents:", params.limit, data.events.length, output.length)
|
|
93
|
+
if data.events.length > 0
|
|
94
|
+
output = output.concat(new(data.events))
|
|
95
|
+
data.events.length
|
|
96
|
+
})
|
|
97
|
+
if error
|
|
98
|
+
output = false
|
|
99
|
+
list(error, output)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// finis
|
|
103
|
+
cwlogs
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/*
|
|
107
|
+
* cwlogsInit
|
|
108
|
+
*
|
|
109
|
+
* Initialize the CloudwatchLogs module.
|
|
110
|
+
*
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
function cwlogsInit(local manifest) {
|
|
114
|
+
manifest = `(CloudWatchLogs, cwlogsInit)
|
|
115
|
+
|
|
116
|
+
Naan.module.build(module.id, "aws_cloudwatchlogs", function(modobj, compobj) {
|
|
117
|
+
require("./aws_utils.nlg")
|
|
118
|
+
compobj.manifest = manifest
|
|
119
|
+
modobj.exports.CloudWatchLogs = CloudWatchLogs
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
} ();
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
} ();
|