@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.
Files changed (98) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +46 -0
  3. package/dist/env_web.js +431 -0
  4. package/dist/naan.min.js +73 -0
  5. package/frameworks/browser/browser.nlg +30 -0
  6. package/frameworks/browser/pouchdb/pouchdb.min.js +7 -0
  7. package/frameworks/browser/spark-md5/spark-md5.min.js +1 -0
  8. package/frameworks/browser/sworker.js +192 -0
  9. package/frameworks/browser/terminals.nlg +787 -0
  10. package/frameworks/browser/workers.nlg +386 -0
  11. package/frameworks/client/apiclient.nlg +183 -0
  12. package/frameworks/client/client.nlg +29 -0
  13. package/frameworks/client/psm_client.nlg +572 -0
  14. package/frameworks/common/common.nlg +464 -0
  15. package/frameworks/common/preferences.nlg +131 -0
  16. package/frameworks/common/repltools.nlg +100 -0
  17. package/frameworks/common/watching.nlg +97 -0
  18. package/frameworks/node/apiserver.nlg +399 -0
  19. package/frameworks/node/filesystem.nlg +1012 -0
  20. package/frameworks/node/gitter.nlg +234 -0
  21. package/frameworks/node/node.nlg +81 -0
  22. package/frameworks/node/psm_server.nlg +465 -0
  23. package/frameworks/node/worker.nlg +560 -0
  24. package/frameworks/project/build.nlg +1229 -0
  25. package/frameworks/project/jszip.js +30 -0
  26. package/frameworks/project/jszip.nlg +87 -0
  27. package/frameworks/project/proj_cliser.nlg +139 -0
  28. package/frameworks/project/proj_console.nlg +137 -0
  29. package/frameworks/project/proj_folder.nlg +143 -0
  30. package/frameworks/project/proj_lambda.nlg +137 -0
  31. package/frameworks/project/proj_static.nlg +138 -0
  32. package/frameworks/project/project.nlg +29 -0
  33. package/frameworks/project/projects.nlg +587 -0
  34. package/frameworks/project/uglifyjs.js +1 -0
  35. package/frameworks/project/uglifyjs.nlg +79 -0
  36. package/frameworks/running/debugcom.nlg +163 -0
  37. package/frameworks/running/debugnub.nlg +565 -0
  38. package/frameworks/running/debugutil.nlg +510 -0
  39. package/frameworks/running/executors.nlg +767 -0
  40. package/frameworks/running/running.nlg +151 -0
  41. package/frameworks/running/sourcecode.nlg +346 -0
  42. package/frameworks/running/taskexec.nlg +196 -0
  43. package/frameworks/storage/dbt_pouch.nlg +773 -0
  44. package/frameworks/storage/file_manager.nlg +772 -0
  45. package/frameworks/storage/psm.nlg +326 -0
  46. package/frameworks/storage/psm_dbtables.nlg +814 -0
  47. package/frameworks/storage/resources.nlg +445 -0
  48. package/frameworks/storage/storage.nlg +52 -0
  49. package/lib/browser/env_web.js +431 -0
  50. package/lib/browser/env_webworker.js +146 -0
  51. package/lib/browser/require.js +1653 -0
  52. package/lib/core/naanlib.js +73 -0
  53. package/lib/env_node.js +282 -0
  54. package/lib/env_nodeworker.js +165 -0
  55. package/lib/node_repl.js +25 -0
  56. package/lib/node_repl_init.nlg +52 -0
  57. package/package.json +13 -0
  58. package/plugins/gitClient/clientops.nlg +317 -0
  59. package/plugins/gitClient/gitClient.nlg +63 -0
  60. package/plugins/gitClient/gitutils.nlg +1331 -0
  61. package/plugins/gitClient/minimatch.js +945 -0
  62. package/plugins/gitClient/minimatch_license.txt +15 -0
  63. package/plugins/gitClient/minimatch_readme.md +208 -0
  64. package/plugins/nodeLib/nodeLib.nlg +26 -0
  65. package/plugins/nodeLib/node_cp.nlg +65 -0
  66. package/plugins/nodeLib/node_fs.nlg +137 -0
  67. package/plugins/nodeLib/node_https.nlg +172 -0
  68. package/plugins/nodeLib/node_util.nlg +180 -0
  69. package/plugins/serviceAws/aws/aws-sdk.min.js +88 -0
  70. package/plugins/serviceAws/aws/lambda_rest_index.js +122 -0
  71. package/plugins/serviceAws/aws/lambda_rest_init.nlg +58 -0
  72. package/plugins/serviceAws/aws/lambda_ws_index.js +498 -0
  73. package/plugins/serviceAws/aws/lambda_ws_init.nlg +49 -0
  74. package/plugins/serviceAws/aws_cloudwatchlogs.nlg +122 -0
  75. package/plugins/serviceAws/aws_cognito.nlg +76 -0
  76. package/plugins/serviceAws/aws_dynamo.nlg +509 -0
  77. package/plugins/serviceAws/aws_lambda.nlg +95 -0
  78. package/plugins/serviceAws/aws_s3.nlg +134 -0
  79. package/plugins/serviceAws/aws_utils.nlg +86 -0
  80. package/plugins/serviceAws/dbt_aws.nlg +769 -0
  81. package/plugins/serviceAws/lambda_naan_control.nlg +175 -0
  82. package/plugins/serviceAws/psm_aws.nlg +258 -0
  83. package/plugins/serviceAws/serviceAws.nlg +38 -0
  84. package/plugins/serviceGitHub/gitops.nlg +522 -0
  85. package/plugins/serviceGitHub/psm_github.nlg +205 -0
  86. package/plugins/serviceGitHub/serviceGitHub.nlg +65 -0
  87. package/plugins/serviceGitLab/gitops.nlg +528 -0
  88. package/plugins/serviceGitLab/psm_gitlab.nlg +205 -0
  89. package/plugins/serviceGitLab/serviceGitLab.nlg +65 -0
  90. package/test/harness.nlg +312 -0
  91. package/test/node_test.js +33 -0
  92. package/test/test_01_core.nlg +768 -0
  93. package/test/test_02_context.nlg +269 -0
  94. package/test/test_03_jsinterop.nlg +137 -0
  95. package/test/test_04_numerics.nlg +450 -0
  96. package/test/test_05_strings.nlg +63 -0
  97. package/test/test_06_lingoparse.nlg +500 -0
  98. package/test/test_07_lingo.nlg +623 -0
@@ -0,0 +1,134 @@
1
+ /*
2
+ * aws_s3.nlg
3
+ * serviceAws
4
+ *
5
+ * Access to S3 services for AWS.
6
+ *
7
+ * column positioning: // // !
8
+ *
9
+ * Copyright (c) 2020-2021 by Richard C. Zulch
10
+ *
11
+ */
12
+
13
+
14
+ /*
15
+ * S3bucket
16
+ *
17
+ * S3 buckets.
18
+ *
19
+ */
20
+
21
+ closure S3bucket(s3, name, local bucket) {
22
+ bucket = new(object, this)
23
+ bucket.name = name
24
+
25
+ //
26
+ // list
27
+ //
28
+ bucket.listObjects = closure listObjects(local pending) {
29
+ pending = new(nonce)
30
+ s3.aws.listObjectsV2({
31
+ Bucket: bucket.name
32
+ }, function (error, data) {
33
+ if error
34
+ error = Error("S3bucket.list failed", error)
35
+ pending.signal(list(error, data))
36
+ })
37
+ pending.wait()
38
+ }
39
+
40
+ //
41
+ // upload
42
+ //
43
+ bucket.upload = closure upload(key, data, local pending) {
44
+ pending = new(nonce)
45
+ s3.aws.upload({
46
+ Bucket: bucket.name
47
+ ACL: "public-read"
48
+ Body: data
49
+ Key: key
50
+ ContentType: "application/octet-stream" // force download from browser
51
+ })
52
+ .on("httpUploadProgress", function(evt) {
53
+ debuglog("upload progress", totuple(evt))
54
+ })
55
+ .send(function(error, data) {
56
+ if error
57
+ error = Error("S3bucket.upload failed", error)
58
+ pending.signal(list(error, data))
59
+ })
60
+ pending.wait()
61
+ }
62
+
63
+ // finis
64
+ bucket
65
+ };
66
+
67
+
68
+ /*
69
+ * S3
70
+ *
71
+ * S3 access objects.
72
+ *
73
+ */
74
+
75
+ closure S3(local s3) {
76
+ s3 = new(object, this)
77
+
78
+ //
79
+ // login
80
+ //
81
+ s3.login = closure login(creds, local params) {
82
+ if !awsSDK
83
+ return (list(Error("S3.login: no AWS SDK available")))
84
+ params = {
85
+ apiVersion: "2012-08-10"
86
+ }
87
+ if creds {
88
+ params.accessKeyId = creds.keyID,
89
+ params.secretAccessKey = creds.keySecret,
90
+ params.region = creds.region
91
+ }
92
+ s3.aws = xnew(awsSDK.S3, params)
93
+ `(false, { ok: true })
94
+ }
95
+
96
+ //
97
+ // bucket
98
+ //
99
+ // Return a new bucket access object for the table of the specified name. The bucket may not
100
+ // yet exist; see S3bucket for methods.
101
+ //
102
+ // parameters:
103
+ // {
104
+ // hash: <name> // primary hash key attribute name (required)
105
+ // hashType: <type> // string | numeric (required)
106
+ // range: <name> // primary range key attribute name (optional)
107
+ // rangeType: <name> // string | numeric (required if range specified)
108
+ // }
109
+ //
110
+ s3.bucket = closure bucket(name) {
111
+ S3bucket(s3, name)
112
+ }
113
+
114
+ // finis
115
+ s3
116
+ };
117
+
118
+
119
+ /*
120
+ * s3Init
121
+ *
122
+ * Initialize the AWS module.
123
+ *
124
+ */
125
+
126
+ function s3Init(local manifest) {
127
+ manifest = `(S3bucket, S3, s3Init)
128
+
129
+ Naan.module.build(module.id, "S3", function(modobj, compobj) {
130
+ require("./serviceAws.nlg")
131
+ compobj.manifest = manifest
132
+ modobj.exports.S3 = S3
133
+ })
134
+ } ();
@@ -0,0 +1,86 @@
1
+ /*
2
+ * aws_utils.nlg
3
+ * serviceAws
4
+ *
5
+ * AWS SDK access utilities.
6
+ *
7
+ * column positioning: // // !
8
+ *
9
+ * Copyright (c) 2021 by Richard C. Zulch
10
+ *
11
+ */
12
+
13
+
14
+ /*
15
+ * queryPager
16
+ *
17
+ * Low-level paginator for AWS queries of the following form:
18
+ * apiproc(params, [<args>,] callback(error, data))
19
+ * The caller/callback are responsible for initializing the params and adjusting them for each
20
+ * iteration. The callback should return false to stop looping.
21
+ *
22
+ */
23
+
24
+ closure queryPager(apiobject, procname, params, xargs, doneCB, local pending, looping, result) {
25
+ if !apiobject[procname]
26
+ return (list(Error("queryPager method undefined:", procname)))
27
+ pending = new(nonce)
28
+ looping = true
29
+ while looping { // loop for multiple pages
30
+ pending.reset()
31
+ xapply(apiobject, procname, append(cons(params, xargs), cons(function (error, data) {
32
+ if error {
33
+ qpPagerError = error
34
+ debuglog(procname, "failed", error)
35
+ looping = false
36
+ pending.signal(list(error))
37
+ }
38
+ else {
39
+ looping = doneCB(data)
40
+ pending.signal(list(false, {ok: true}))
41
+ }
42
+ })))
43
+ result = pending.wait()
44
+ }
45
+ result
46
+ };
47
+
48
+
49
+ /*
50
+ * QueryPager
51
+ *
52
+ * Paginator for AWS queries, called as:
53
+ * QueryPager(apiobject, procname, params, [<args>,] function(data){})
54
+ *
55
+ */
56
+
57
+ function QueryPager args {
58
+ closure(local apiobject, procname, params, xargs, doneCB) {
59
+ apiobject = pop(args)
60
+ procname = pop(args)
61
+ params = pop(args)
62
+ args = args.reverse()
63
+ doneCB = pop(args)
64
+ xargs = args.reverse()
65
+ queryPager(apiobject, procname, params, xargs, doneCB)
66
+ } ()
67
+ };
68
+
69
+
70
+ /*
71
+ * utilsInit
72
+ *
73
+ * Initialize the Lambda module.
74
+ *
75
+ */
76
+
77
+ function utilsInit(local manifest) {
78
+ manifest = `(queryPager, QueryPager, utilsInit)
79
+
80
+ Naan.module.build(module.id, "aws_utils", function(modobj, compobj) {
81
+ require("./serviceAws.nlg")
82
+ compobj.manifest = manifest
83
+ modobj.exports.QueryPager = QueryPager
84
+ })
85
+
86
+ } ();