@naanlang/naan 1.0.6 → 1.0.7
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/env_web.js +6 -2
- package/dist/naan.min.js +5 -5
- package/frameworks/browser/browser.nlg +67 -2
- package/frameworks/browser/https_request.nlg +2 -2
- package/frameworks/browser/sworker.js +17 -17
- package/frameworks/browser/terminals.nlg +14 -12
- package/frameworks/browser/workers.nlg +6 -6
- package/frameworks/common/common.nlg +8 -5
- package/frameworks/project/build.nlg +13 -9
- package/frameworks/project/projects.nlg +42 -17
- package/frameworks/running/running.nlg +1 -1
- package/frameworks/running/taskexec.nlg +1 -1
- package/frameworks/storage/file_manager.nlg +2 -1
- package/frameworks/storage/psm_dbtables.nlg +13 -3
- package/lib/browser/env_web.js +10 -6
- package/lib/browser/env_webworker.js +10 -0
- package/lib/core/naanlib.js +5 -5
- package/package.json +2 -1
- package/plugins/serviceAws/aws_dynamo.nlg +18 -6
- package/plugins/serviceAws/aws_dynextra.nlg +48 -28
- package/plugins/serviceAws/aws_s3.nlg +74 -28
- package/plugins/serviceAws/dbt_aws.nlg +73 -24
- package/plugins/serviceAws/psm_aws.nlg +30 -11
- package/plugins/serviceAws/serviceAws.nlg +2 -4
|
@@ -47,7 +47,11 @@ closure psmaConnector(psm, local connClassID, connector, watch) {
|
|
|
47
47
|
{
|
|
48
48
|
label: "Bucket"
|
|
49
49
|
placeholder: "e.g. myBucketName"
|
|
50
|
-
key: "bucketName" }
|
|
50
|
+
key: "bucketName" },
|
|
51
|
+
{
|
|
52
|
+
label: "Endpoint"
|
|
53
|
+
placeholder: "custom URL"
|
|
54
|
+
key: "endpoint" }
|
|
51
55
|
]
|
|
52
56
|
}
|
|
53
57
|
|
|
@@ -59,6 +63,7 @@ closure psmaConnector(psm, local connClassID, connector, watch) {
|
|
|
59
63
|
`(error, creds) = connector.vault.accessResource(resID)
|
|
60
64
|
if creds && (!resource.region || resource.region == creds.region)
|
|
61
65
|
&& (!resource.bucketName || resource.bucketName == creds.bucketName)
|
|
66
|
+
&& (!resource.endpoint || resource.endpoint == creds.endpoint)
|
|
62
67
|
&& (!resource.label || resource.label == creds.label)
|
|
63
68
|
return (resID)
|
|
64
69
|
}
|
|
@@ -75,6 +80,7 @@ closure psmaConnector(psm, local connClassID, connector, watch) {
|
|
|
75
80
|
// keySecret - AWS IAM keySecret
|
|
76
81
|
// region - AWS region
|
|
77
82
|
// bucketName - AWS bucketName
|
|
83
|
+
// endpoint - custom URL
|
|
78
84
|
// hidden - [optional] don't enumerate to user
|
|
79
85
|
// locked - [optional] don't allow user delete
|
|
80
86
|
// The return value is an (error, resID) tuple. Error, if non-false, is a dictionary of field
|
|
@@ -90,6 +96,8 @@ closure psmaConnector(psm, local connClassID, connector, watch) {
|
|
|
90
96
|
region: resource.region,
|
|
91
97
|
bucketName: resource.bucketName
|
|
92
98
|
}
|
|
99
|
+
if resource.endpoint
|
|
100
|
+
creds.endpoint = resource.endpoint
|
|
93
101
|
errors = { }
|
|
94
102
|
if resource.label
|
|
95
103
|
creds.label = resource.label
|
|
@@ -107,6 +115,8 @@ closure psmaConnector(psm, local connClassID, connector, watch) {
|
|
|
107
115
|
errors.region = "required field"
|
|
108
116
|
if badField(resource.bucketName)
|
|
109
117
|
errors.bucketName = "required field"
|
|
118
|
+
if resource.endpoint && badField(resource.endpoint)
|
|
119
|
+
errors.endpoint = "invalid field"
|
|
110
120
|
if length(errors) > 0
|
|
111
121
|
error = errors
|
|
112
122
|
else {
|
|
@@ -164,6 +174,8 @@ closure psmaConnector(psm, local connClassID, connector, watch) {
|
|
|
164
174
|
resource.region = creds.region
|
|
165
175
|
if string(creds.bucketName)
|
|
166
176
|
resource.bucketName = creds.bucketName
|
|
177
|
+
if string(creds.endpoint)
|
|
178
|
+
resource.endpoint = creds.endpoint
|
|
167
179
|
list(false, resource)
|
|
168
180
|
}
|
|
169
181
|
|
|
@@ -209,22 +221,28 @@ closure psmaConnector(psm, local connClassID, connector, watch) {
|
|
|
209
221
|
//
|
|
210
222
|
// Return an S3 access object, which is the credentials to access an AWS S3 bucket.
|
|
211
223
|
|
|
212
|
-
connector.access = function access(resID, local error, creds, s3b) {
|
|
224
|
+
connector.access = function access(resID, local error, creds, params, s3b) {
|
|
213
225
|
`(error, creds) = connector.vault.accessResource(resID)
|
|
214
226
|
if error
|
|
215
227
|
return (list(error)) // can't access that resource
|
|
216
228
|
if !awsSDK.S3
|
|
217
229
|
return (list(Error("S3 connector: no AWS SDK available")))
|
|
230
|
+
params = {
|
|
231
|
+
region: creds.region
|
|
232
|
+
credentials: {
|
|
233
|
+
accessKeyId: creds.keyID
|
|
234
|
+
secretAccessKey: creds.keySecret
|
|
235
|
+
}
|
|
236
|
+
}
|
|
218
237
|
s3b = {
|
|
219
|
-
s3: xnew(awsSDK.S3, {
|
|
220
|
-
region: creds.region
|
|
221
|
-
credentials: {
|
|
222
|
-
accessKeyId: creds.keyID
|
|
223
|
-
secretAccessKey: creds.keySecret
|
|
224
|
-
}})
|
|
225
238
|
bucketName: creds.bucketName
|
|
226
239
|
region: creds.region
|
|
227
240
|
}
|
|
241
|
+
if creds.endpoint {
|
|
242
|
+
params.endpoint = creds.endpoint
|
|
243
|
+
s3b.endpoint = creds.endpoint
|
|
244
|
+
}
|
|
245
|
+
s3b.s3 = xnew(awsSDK.S3, params)
|
|
228
246
|
list(false, s3b)
|
|
229
247
|
}
|
|
230
248
|
|
|
@@ -232,10 +250,11 @@ closure psmaConnector(psm, local connClassID, connector, watch) {
|
|
|
232
250
|
//
|
|
233
251
|
// Connect to an AWS bucket filesystem, returning a view.
|
|
234
252
|
|
|
235
|
-
connector.connect = function connect(resID, service, args,
|
|
253
|
+
connector.connect = function connect(resID, service, args,
|
|
254
|
+
local error, s3b, db, rootpath, table) {
|
|
236
255
|
`(error, s3b) = connector.access(resID)
|
|
237
256
|
if !error
|
|
238
|
-
`(error, db) = S3DB(s3b)
|
|
257
|
+
`(error, db) = S3DB(s3b, args.1) // get S3 bucket as a database
|
|
239
258
|
if error
|
|
240
259
|
list(error)
|
|
241
260
|
else if service == "NideDB"
|
|
@@ -244,7 +263,7 @@ closure psmaConnector(psm, local connClassID, connector, watch) {
|
|
|
244
263
|
rootpath = args.0 // connect to a NideFS filesystem
|
|
245
264
|
if !rootpath
|
|
246
265
|
return (Error("mandatory rootpath missing"))
|
|
247
|
-
`(error, table) = db.table(rootpath)
|
|
266
|
+
`(error, table) = db.table(rootpath, args.1) // args.1 is table options; see dawsTable
|
|
248
267
|
if error
|
|
249
268
|
list(error)
|
|
250
269
|
else
|
|
@@ -26,10 +26,8 @@ function sawsInit(local manifest) {
|
|
|
26
26
|
require("frameworks/common").LiveImport()
|
|
27
27
|
require("./aws_utils.nlg")
|
|
28
28
|
function sawsPostload() {
|
|
29
|
-
if js.
|
|
30
|
-
awsSDK = js.r("/
|
|
31
|
-
else if js.g
|
|
32
|
-
awsSDK = js.r("aws-sdk-node.min") // SDK must be in search path
|
|
29
|
+
if js.g
|
|
30
|
+
awsSDK = js.r(JSpath.join(js.d, module.locpath, "./aws/aws-sdk-node.min.js"))
|
|
33
31
|
else
|
|
34
32
|
awsSDK = JsLoadScript(JSpath.join(module.locpath, "./aws/aws-sdk.min.js"), "awsSdk")
|
|
35
33
|
module.exports.awsSDK = awsSDK
|