@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,509 @@
1
+ /*
2
+ * aws_dynamo.nlg
3
+ * serviceAws
4
+ *
5
+ * Access to DynamoDB services for AWS.
6
+ *
7
+ * column positioning: // // !
8
+ *
9
+ * Copyright (c) 2021 by Richard C. Zulch
10
+ *
11
+ */
12
+
13
+
14
+ /*
15
+ * DynaTable
16
+ *
17
+ * DynamoDB table.
18
+ *
19
+ */
20
+
21
+ closure DynaTable(dyna, tablename, local table) {
22
+ table = new(object, this)
23
+ table.name = tablename
24
+
25
+ // fieldTypeDynToNaan
26
+ // Convert field type from DynamoDB to Naan
27
+ //
28
+ function fieldTypeDynToNaan(dtype) {
29
+ if dtype == "S",
30
+ "utf8"
31
+ else if dtype == "N",
32
+ "numeric"
33
+ else if dtype == "B",
34
+ "binary"
35
+ else
36
+ "unknown"
37
+ }
38
+
39
+ // fieldTypeNaanToDyn
40
+ // Convert field type from Naan to DynamoDB
41
+ //
42
+ function fieldTypeNaanToDyn(ntype) {
43
+ if ntype == "utf8",
44
+ "S"
45
+ else if ntype == "numeric",
46
+ "N"
47
+ else if ntype == "binary",
48
+ "B"
49
+ else
50
+ false
51
+ }
52
+
53
+ // datumNaanToDyn
54
+ // Convert a Naan datum to DynamoDB format.
55
+ //
56
+ function datumNaanToDyn(datum, local output, ntype, dtype) {
57
+ output = { }
58
+ if tuple(datum)
59
+ datum = datum.toarray
60
+ if array(datum) {
61
+ dtype = "L" // heterogenous list
62
+ datum = datum.map(function(item) {
63
+ datumNaanToDyn(item)
64
+ })
65
+ } else {
66
+ ntype = typeof(datum)
67
+ if ntype == xobject
68
+ dtype = "B" // assume binary
69
+ else if ntype == dictionary {
70
+ dtype = "M"
71
+ datum = recordNaanToDyn(datum)
72
+ }
73
+ else if numeric(datum) {
74
+ dtype = "N"
75
+ datum = tostring(datum)
76
+ }
77
+ else if ntype == string
78
+ dtype = "S"
79
+ else if ntype == symbol {
80
+ if datum === null {
81
+ dtype = "NULL"
82
+ datum = "true"
83
+ }
84
+ else if datum === true || datum === false
85
+ dtype = "BOOL"
86
+ else if datum === undefined
87
+ datum = undefined
88
+ else
89
+ dtype = "S" // some other symbol is string
90
+ } else
91
+ debuglog("DynaTable.datumNaanToDyn: invalid type", ntype)
92
+ }
93
+ output[dtype] = datum
94
+ output
95
+ }
96
+
97
+ // recordNaanToDyn
98
+ // Convert a Naan dictionary to DynamoDB format.
99
+ //
100
+ function recordNaanToDyn(nitem, local output, key, data) {
101
+ output = { }
102
+ for `(key, data) in nitem
103
+ output[key] = datumNaanToDyn(data)
104
+ output
105
+ }
106
+
107
+ // datumDynToNaan
108
+ // Convert a DynamoDB typed attribute to Naan format.
109
+ //
110
+ function datumDynToNaan(dtype, dvalue, local output) {
111
+ if dtype == "BS" || dtype == "SS"
112
+ dvalue
113
+ else if dtype == "NS"
114
+ new(dvalue).map(function(item) {
115
+ if item.indexOf(".") >= 0
116
+ Number.parseFloat(item)
117
+ else
118
+ Number.parseInt(item)
119
+ })
120
+ else if dtype == "M"
121
+ recordDynToNaan(dvalue)
122
+ else if dtype == "L"
123
+ new(dvalue).map(function(item, local itype) {
124
+ itype = item.*.0
125
+ datumDynToNaan(itype, item[itype])
126
+ })
127
+ else if dtype == "BOOL"
128
+ dvalue && true
129
+ else if dtype == "N" {
130
+ if dvalue.indexOf(".") >= 0
131
+ Number.parseFloat(dvalue)
132
+ else
133
+ Number.parseInt(dvalue) }
134
+ else if dtype == "NULL"
135
+ null
136
+ else if dtype == "B" || dtype == "S"
137
+ dvalue
138
+ else {
139
+ debuglog("DynaTable.datumDynToNaan: unknown type", dtype, typeof(dvalue), dvalue)
140
+ false }
141
+ }
142
+
143
+ // recordDynToNaan
144
+ // Convert a DynamoDB typed item dictionary to Naan format.
145
+ //
146
+ function recordDynToNaan(ditem, local output, key, data, dtype, dvalue) {
147
+ output = { }
148
+ for `(key, data) in ditem {
149
+ dtype = data.*.0
150
+ dvalue = data[dtype]
151
+ output[key] = datumDynToNaan(dtype, dvalue)
152
+ }
153
+ output
154
+ }
155
+
156
+ //
157
+ // dynQueryPager
158
+ //
159
+ // Perform a dynamo paged query. This implements paging conventions specific to CWL. The callback
160
+ // should return the number of items found in the data, or false to stop looping.
161
+ //
162
+ closure dynQueryPager(procname, params, remaining, doneCB) {
163
+ params.Limit = remaining
164
+ QueryPager(cwlogs.aws, procname, params, function(data, local processed) {
165
+ processed = doneCB(data)
166
+ if processed
167
+ remaining -= processed
168
+ if processed && (!remaining || remaining > 0)
169
+ && data.LastEvaluatedKey && data.LastEvaluatedKey != params.ExclusiveStartKey {
170
+ params.Limit = remaining // set up for next iteration
171
+ params.ExclusiveStartKey = data.LastEvaluatedKey
172
+ true // continue looping
173
+ }
174
+ })
175
+ }
176
+
177
+ //
178
+ // info
179
+ //
180
+ // Return info about the table, or an error, in standard (error, dictionary) tuple format.
181
+ //
182
+ // info dictionary:
183
+ // {
184
+ // name: <name> // table name
185
+ // created: <date-time> // when created
186
+ // size: <number> // size of table in bytes
187
+ // length: <number> // number of items in table
188
+ // status: <string> // ACTIVE | CREATING | etc.
189
+ // hash: <name> // primary hash key attribute name
190
+ // hashType: <type> // string | numeric
191
+ // range: <name> // primary range key attribute name (if exists)
192
+ // rangeType: <name> // string | numeric (if exists)
193
+ // }
194
+ //
195
+ table.info = closure info(local params, pending, info) {
196
+ if !dyna.aws
197
+ return (list(Error("DynaTable.info: not logged into AWS")))
198
+ params = {
199
+ TableName: tablename
200
+ }
201
+ pending = new(nonce)
202
+ dyna.aws.describeTable(params, function(error, data, local output, key) {
203
+ if error {
204
+ dynaTableError = error
205
+ debuglog("aws.describeTable failed", tablename, error)
206
+ } else {
207
+ data = data.Table
208
+ output = {
209
+ name: data.TableName // table name
210
+ created: data.CreationDateTime // when created
211
+ byteSize: data.TableSizeBytes // size of table in bytes
212
+ length: data.ItemCount // number of items in table
213
+ status: data.TableStatus // ACTIVE | CREATING | etc.
214
+ }
215
+ for key in data.KeySchema
216
+ if key.KeyType == "HASH"
217
+ output.hash = key.AttributeName
218
+ else if key.KeyType == "RANGE"
219
+ output.range = key.AttributeName
220
+ for key in data.AttributeDefinitions
221
+ if key.AttributeName == output.hash
222
+ output.hashType = fieldTypeDynToNaan(key.AttributeType)
223
+ else if key.AttributeName == output.range
224
+ output.rangeType = fieldTypeDynToNaan(key.AttributeType)
225
+ table.hashKey = output.hash // hash attribute name
226
+ table.rangeKey = output.range // range attribute name or false
227
+ }
228
+ pending.signal(list(error, output))
229
+ })
230
+ pending.wait()
231
+ }
232
+
233
+ //
234
+ // create
235
+ //
236
+ // Create the table with specified parameters, blocking until the table is ready for use.
237
+ //
238
+ // parameters dictionary:
239
+ // {
240
+ // hash: <name> // primary hash key attribute name
241
+ // hashType: <type> // string | numeric
242
+ // range: <name> // primary range key attribute name (optional)
243
+ // rangeType: <name> // string | numeric (if range specified)
244
+ // }
245
+
246
+ table.create = closure create(parameters, local hashType, rangeType, params, pending, error, data, start) {
247
+ if !dyna.aws
248
+ return (list(Error("DynaTable.create: not logged into AWS")))
249
+ hashType = fieldTypeNaanToDyn(parameters.hashType)
250
+ if !parameters.hash || !hashType
251
+ return (list(Error("DynoTable.create: primary key hash/hashType required")))
252
+ params = {
253
+ TableName: tablename
254
+ AttributeDefinitions: [
255
+ {
256
+ AttributeName: parameters.hash
257
+ AttributeType: hashType
258
+ }
259
+ ]
260
+ KeySchema: [
261
+ {
262
+ AttributeName: parameters.hash
263
+ KeyType: "HASH"
264
+ }
265
+ ]
266
+ }
267
+ if parameters.range {
268
+ rangeType = fieldTypeNaanToDyn(parameters.rangeType)
269
+ if !rangeType
270
+ return (list(Error("DynoTable.create: range requires rangeType")))
271
+ params.AttributeDefinitions.push({
272
+ AttributeName: parameters.range
273
+ AttributeType: rangeType
274
+ })
275
+ params.KeySchema.push({
276
+ AttributeName: parameters.range
277
+ KeyType: "RANGE"
278
+ })
279
+ }
280
+ pending = new(nonce)
281
+ dyna.aws.createTable(params, function(error, data) {
282
+ if error {
283
+ dynaTableError = error
284
+ debuglog("aws.createTable failed", tablename, error)
285
+ }
286
+ pending.signal(list(error, data))
287
+ })
288
+ `(error, data) = pending.wait()
289
+ if error
290
+ return(list(Error("aws.createTable failed", error)))
291
+ start = milliseconds()
292
+ loop {
293
+ `(error, data) = info()
294
+ if data.status == "ACTIVE"
295
+ break
296
+ if milliseconds() - start > 20000 { // 20 seconds
297
+ if !error
298
+ error = data.status
299
+ return(list(Error("DynoTable.create: timeout waiting for new table to become active", error)))
300
+ }
301
+ sleep(2000)
302
+ }
303
+ list(false, data)
304
+ }
305
+
306
+ //
307
+ // putRecord
308
+ //
309
+ // Put an record in the table, replacing any existing record with the same key.
310
+
311
+ table.putRecord = closure putRecord(record, local result, params, pending) {
312
+ if !table.hashKey {
313
+ result = info()
314
+ if result.0
315
+ return(result)
316
+ }
317
+ params = {
318
+ TableName: tablename
319
+ Item: recordNaanToDyn(record)
320
+ }
321
+ pending = new(nonce)
322
+ dyna.aws.putItem(params, function(error, data, local output) {
323
+ if error {
324
+ dynaTableError = error
325
+ debuglog("aws.putItem failed", tablename, error)
326
+ }
327
+ pending.signal(list(error, data))
328
+ })
329
+ pending.wait()
330
+ }
331
+
332
+ //
333
+ // getRecord
334
+ //
335
+ // Get a record from the table with the specified hash value, and optional range value.
336
+
337
+ table.getRecord = closure getRecord(hashValue, rangeValue, local result, params, pending) {
338
+ if !table.hashKey {
339
+ result = info()
340
+ if result.0
341
+ return(result)
342
+ }
343
+ params = {
344
+ TableName: tablename
345
+ Key: { }
346
+ }
347
+ params.Key[table.hashKey] = datumNaanToDyn(hashValue)
348
+ if table.rangeKey
349
+ params.Key[table.rangeKey] = datumNaanToDyn(rangeValue)
350
+ pending = new(nonce)
351
+ dyna.aws.getItem(params, function(error, data, local output) {
352
+ if error {
353
+ dynaTableError = error
354
+ debuglog("aws.getItem failed", tablename, error)
355
+ } else
356
+ data = recordDynToNaan(data.Item)
357
+ pending.signal(list(error, data))
358
+ })
359
+ pending.wait()
360
+ }
361
+
362
+ //
363
+ // queryRecords
364
+ //
365
+ // Options:
366
+ // {
367
+ // index: <string> // index name in table
368
+ // range: <expression-dictionary> // range of keys to retrieve
369
+ // reverse: <boolean> // reverse order
370
+ // limit: <number> // maximum count of results
371
+ // }
372
+ //
373
+ // range dictionary:
374
+ // {
375
+ // "=": <expression> // exclusive of other comparisons
376
+ // ">": <expression> // exclusive of other comparisons
377
+ // "<": <expression> // exclusive of other comparisons
378
+ // beginsWith: <string-expression> // exclusive of other comparisons
379
+ // ">=": <expression> // with <= or alone
380
+ // "<=": <expression> // with >= or alone
381
+ // }
382
+ //
383
+
384
+ table.queryRecords = closure queryRecords(hashValue, options
385
+ local result, params, op, expr, rangex, output, error)
386
+ {
387
+ if !table.hashKey {
388
+ result = info()
389
+ if result.0
390
+ return(result)
391
+ }
392
+ params = {
393
+ TableName: tablename
394
+ ExpressionAttributeValues: {
395
+ ":v1": datumNaanToDyn(hashValue)
396
+ }
397
+ KeyConditionExpression: strcat(table.hashKey, " = :v1")
398
+ }
399
+ if options.range {
400
+ for `(op, expr) in options.range {
401
+ function dupeop() { list(Error("DynaTable.queryRecords: cannot combine", op, "with", rangex.0)) }
402
+ if op == ">=" {
403
+ if rangex.0 == "<="
404
+ rangex = list("between", expr, rangex.1)
405
+ else if rangex.0
406
+ return (dupeop())
407
+ else
408
+ rangex = list(op, expr) }
409
+ else if op == "<=" {
410
+ if rangex.0 == ">="
411
+ rangex = list("between", rangex.1, expr)
412
+ else if rangex.0
413
+ return (dupeop())
414
+ else
415
+ rangex = list(op, expr) }
416
+ else if rangex.0
417
+ return (dupeop())
418
+ else
419
+ rangex = list(op, expr)
420
+ }
421
+ if rangex {
422
+ params.ExpressionAttributeValues[":v2"] = datumNaanToDyn(rangex.1)
423
+ if rangex.0 == "between" {
424
+ params.ExpressionAttributeValues[":v3"] = datumNaanToDyn(rangex.2)
425
+ expr = strcat(" between :v2 and :v3")
426
+ }
427
+ else
428
+ expr = strcat(space, rangex.0, " :v2")
429
+ params.KeyConditionExpression = params.KeyConditionExpression.concat(" and ", table.rangeKey, expr)
430
+ }
431
+ }
432
+ output = []
433
+ `(error) = cwlQueryPager(`query, params, options.limit, function(data) {
434
+ if data.Count >= 0
435
+ output = output.concat(recordDynToNaan(data.Items))
436
+ data.Count
437
+ })
438
+ if error
439
+ output = false
440
+ list(error, output)
441
+ }
442
+
443
+ // finis
444
+
445
+ table
446
+ };
447
+
448
+
449
+ /*
450
+ * DynamoDB
451
+ *
452
+ * DynamoDB access objects.
453
+ *
454
+ */
455
+
456
+ closure DynamoDB(local dyna) {
457
+ dyna = new(object, this)
458
+
459
+ //
460
+ // login
461
+ //
462
+ dyna.login = closure login(creds) {
463
+ dyna.aws = xnew(awsSDK.DynamoDB, {
464
+ apiVersion: "2012-08-10",
465
+ accessKeyId: creds.keyID,
466
+ secretAccessKey: creds.keySecret,
467
+ region: creds.region })
468
+ }
469
+
470
+ //
471
+ // table
472
+ //
473
+ // Return a new table access object for the table of the specified name. The table may not
474
+ // yet exist; see DynaTable for methods.
475
+ //
476
+ // parameters:
477
+ // {
478
+ // hash: <name> // primary hash key attribute name (required)
479
+ // hashType: <type> // string | numeric (required)
480
+ // range: <name> // primary range key attribute name (optional)
481
+ // rangeType: <name> // string | numeric (required if range specified)
482
+ // }
483
+ //
484
+ dyna.table = closure table(name) {
485
+ DynaTable(dyna, name)
486
+ }
487
+
488
+ // finis
489
+ dyna
490
+ }
491
+
492
+
493
+ /*
494
+ * dynadaInit
495
+ *
496
+ * Initialize the DynamoDB module.
497
+ *
498
+ */
499
+
500
+ function dynadaInit(local manifest) {
501
+ manifest = `(DynaTable, DynamoDB, dynadaInit)
502
+
503
+ Naan.module.build(module.id, "aws_dynamo", function(modobj, compobj) {
504
+ require("./serviceAws.nlg")
505
+ compobj.manifest = manifest
506
+ modobj.exports.DynamoDB = DynamoDB
507
+ })
508
+
509
+ } ();
@@ -0,0 +1,95 @@
1
+ /*
2
+ * aws_lambda.nlg
3
+ * serviceAws
4
+ *
5
+ * Access to lambda function management services for AWS.
6
+ *
7
+ * column positioning: // // !
8
+ *
9
+ * Copyright (c) 2021 by Richard C. Zulch
10
+ *
11
+ */
12
+
13
+
14
+ /*
15
+ * Lambda
16
+ *
17
+ * Lambda service functions.
18
+ *
19
+ */
20
+
21
+ closure Lambda(local lamb) {
22
+ lamb = new(object, this)
23
+
24
+ //
25
+ // login
26
+ //
27
+ lamb.login = closure login(creds) {
28
+ lamb.aws = xnew(awsSDK.Lambda, {
29
+ apiVersion: "2015-03-31",
30
+ accessKeyId: creds.keyID,
31
+ secretAccessKey: creds.keySecret,
32
+ region: creds.region })
33
+ }
34
+
35
+ //
36
+ // getFunction
37
+ //
38
+ lamb.getFunction = closure getFunction(name, qualifier, local params, pending) {
39
+ params = {
40
+ FunctionName: name
41
+ }
42
+ if qualifier
43
+ params.Qualifier = qualifier
44
+ pending = new(nonce)
45
+ lamb.aws.getFunction(params, function(error, data) {
46
+ if error {
47
+ lambdaError = error
48
+ debuglog("aws.getFunction failed", error)
49
+ }
50
+ pending.signal(list(error, data))
51
+ })
52
+ pending.wait()
53
+ }
54
+
55
+ //
56
+ // updateFunctionCode
57
+ //
58
+ lamb.updateFunctionCode = closure updateFunctionCode(name, zipfile, local params, pending) {
59
+ params = {
60
+ FunctionName: name
61
+ ZipFile: zipfile
62
+ }
63
+ pending = new(nonce)
64
+ lamb.aws.updateFunctionCode(params, function(error, data) {
65
+ if error {
66
+ lambdaError = error
67
+ debuglog("aws.updateFunctionCode failed", error)
68
+ }
69
+ pending.signal(list(error, data))
70
+ })
71
+ pending.wait()
72
+ }
73
+
74
+ // finis
75
+ lamb
76
+ }
77
+
78
+
79
+ /*
80
+ * lambdaInit
81
+ *
82
+ * Initialize the Lambda module.
83
+ *
84
+ */
85
+
86
+ function lambdaInit(local manifest) {
87
+ manifest = `(lambdaInit, Lambda)
88
+
89
+ Naan.module.build(module.id, "aws_lambda", function(modobj, compobj) {
90
+ require("./serviceAws.nlg")
91
+ compobj.manifest = manifest
92
+ modobj.exports.Lambda = Lambda
93
+ })
94
+
95
+ } ();