@naanlang/naan 1.4.4 → 1.5.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 +2 -2
- package/README.md +4 -4
- package/bin/index.js +20 -2
- package/dist/env_web.js +2 -2
- package/dist/naan.min.js +4 -4
- package/frameworks/browser/browser.nlg +2 -2
- package/frameworks/browser/sworker.js +23 -23
- package/frameworks/browser/terminals.nlg +14 -8
- package/frameworks/client/apiclient.nlg +31 -18
- package/frameworks/client/client.nlg +22 -2
- package/frameworks/client/psm_client.nlg +12 -3
- package/frameworks/node/filesystem.nlg +9 -7
- package/frameworks/node/gitter.nlg +9 -7
- package/frameworks/node/shell.nlg +4 -4
- package/frameworks/project/projects.nlg +2 -1
- package/frameworks/storage/dbt_pouch.nlg +26 -13
- package/frameworks/storage/psm.nlg +39 -5
- package/frameworks/storage/psm_dbtables.nlg +10 -2
- package/lib/browser/env_web.js +9 -9
- package/lib/browser/env_webworker.js +1 -2
- package/lib/core/naanlib.js +4 -4
- package/package.json +1 -1
- package/plugins/serviceAws/aws_cloudwatchlogs.nlg +2 -1
- package/plugins/serviceAws/aws_dynamo.nlg +1 -0
- package/plugins/serviceAws/aws_s3.nlg +3 -3
- package/plugins/serviceAws/aws_sqs.nlg +3 -1
- package/plugins/serviceAws/aws_utils.nlg +3 -1
- package/plugins/serviceAws/dbt_aws.nlg +22 -20
- package/plugins/serviceAws/psm_aws.nlg +2 -1
- package/test/test_03_jsinterop.nlg +32 -3
- package/plugins/serviceGC/russian_trusted_root_ca_pem.crt +0 -33
|
@@ -252,6 +252,14 @@ closure MakePSMutil(fs, local util) {
|
|
|
252
252
|
// follow: <boolean> -- follow links instead of treating them as files
|
|
253
253
|
// idmode: <boolean> -- preserve id/mode where possible
|
|
254
254
|
// times: <boolean> -- preserve time where possible
|
|
255
|
+
// cacheControl: [
|
|
256
|
+
// { -- apply cacheControl to files matching regex
|
|
257
|
+
// match: <regex-string>
|
|
258
|
+
// flags: <regex-flags> -- default "i" ignore case
|
|
259
|
+
// cacheControl: <string>
|
|
260
|
+
// }
|
|
261
|
+
// ...
|
|
262
|
+
// ]
|
|
255
263
|
// }
|
|
256
264
|
//
|
|
257
265
|
// Limitations:
|
|
@@ -295,10 +303,13 @@ closure MakePSMutil(fs, local util) {
|
|
|
295
303
|
if destpath == "."
|
|
296
304
|
destpath = "" // joined empty strings
|
|
297
305
|
`(error, stat) = fs.info(srcpath, fsopt)
|
|
298
|
-
if stat.type
|
|
306
|
+
if stat.type == "symlink" && options.follow && !fs.dirList(srcpath).0
|
|
307
|
+
stat.type = "directory" // for our purposes this is a directory
|
|
308
|
+
if stat.type != "directory" {
|
|
299
309
|
copies.push({ // copy file or symlink
|
|
300
310
|
source: srcpath
|
|
301
311
|
dest: destpath
|
|
312
|
+
entry: entry
|
|
302
313
|
})
|
|
303
314
|
return (list(false, { ok: true })) // generic success not used
|
|
304
315
|
}
|
|
@@ -346,10 +357,29 @@ closure MakePSMutil(fs, local util) {
|
|
|
346
357
|
}).wait()
|
|
347
358
|
}
|
|
348
359
|
//
|
|
360
|
+
// Pass 3 - determine cache control values
|
|
361
|
+
//
|
|
362
|
+
let (regexes, item, file) {
|
|
363
|
+
regexes = new(options.cacheControl)
|
|
364
|
+
try {
|
|
365
|
+
for item in regexes
|
|
366
|
+
item.regex = RegExp(item.match, item.flags || "i")
|
|
367
|
+
} catch {
|
|
368
|
+
ErrorDebuglog("PsmUtil.deepcopy: RegExp exception", exception)
|
|
369
|
+
regexes = []
|
|
370
|
+
}
|
|
371
|
+
for file in copies
|
|
372
|
+
for item in regexes
|
|
373
|
+
if item.regex.test(file.entry) {
|
|
374
|
+
file.cacheControl = item.cacheControl
|
|
375
|
+
break
|
|
376
|
+
}
|
|
377
|
+
} ()
|
|
378
|
+
//
|
|
349
379
|
// Pass 3 - copy files and links
|
|
350
380
|
//
|
|
351
381
|
asyncArray(copies, 10, closure cpfiles(entry,
|
|
352
|
-
local error, data, dest, instat, outstat) {
|
|
382
|
+
local error, data, dest, instat, outstat, foptions) {
|
|
353
383
|
`(error, instat) = fs.info(entry.source, fsopt)
|
|
354
384
|
if !error {
|
|
355
385
|
`(error, outstat) = outfs.info(entry.dest)
|
|
@@ -372,9 +402,13 @@ closure MakePSMutil(fs, local util) {
|
|
|
372
402
|
`(error, data) = outfs.symlink(data, entry.dest)
|
|
373
403
|
}
|
|
374
404
|
else {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
405
|
+
foptions = { encoding: "binary"}
|
|
406
|
+
`(error, data) = fs.readFile(entry.source, foptions)
|
|
407
|
+
if !error {
|
|
408
|
+
if entry.cacheControl
|
|
409
|
+
foptions.cacheControl = entry.cacheControl
|
|
410
|
+
`(error, data) = outfs.writeFile(entry.dest, data, foptions)
|
|
411
|
+
}
|
|
378
412
|
if !error && (options.idmode || options.times) {
|
|
379
413
|
if !options.idmode
|
|
380
414
|
instat.mode = instat.uid = instat.gid = false
|
|
@@ -185,6 +185,7 @@ closure FSview(table, rootpath, local view) {
|
|
|
185
185
|
// emptyok: true -- allow empty directory names (leading "/" or embdedded "//")
|
|
186
186
|
// md5: <hash> -- existing file content must match hash
|
|
187
187
|
// writenew: true -- write as a new file, with updated create time
|
|
188
|
+
// cacheControl: <string> -- set the cacheControl header
|
|
188
189
|
|
|
189
190
|
closure dbWriteRecord(path, content, options, callback) {
|
|
190
191
|
if !callback
|
|
@@ -247,9 +248,15 @@ closure FSview(table, rootpath, local view) {
|
|
|
247
248
|
path: path
|
|
248
249
|
})))
|
|
249
250
|
if doc
|
|
250
|
-
`(error, data) = view.table.update(doc
|
|
251
|
+
`(error, data) = view.table.update(doc, { // update existing record
|
|
252
|
+
metadata: metadata
|
|
253
|
+
cacheControl: options.cacheControl
|
|
254
|
+
})
|
|
251
255
|
else
|
|
252
|
-
`(error, data) = view.table.add(path, content,
|
|
256
|
+
`(error, data) = view.table.add(path, content, { // create new record
|
|
257
|
+
metadata: metadata
|
|
258
|
+
cacheControl: options.cacheControl
|
|
259
|
+
})
|
|
253
260
|
if error
|
|
254
261
|
callback(error)
|
|
255
262
|
else
|
|
@@ -553,6 +560,7 @@ closure FSview(table, rootpath, local view) {
|
|
|
553
560
|
// available:
|
|
554
561
|
// exclusive: true -- file must not already exist
|
|
555
562
|
// md5: <hash> -- existing file content must match hash
|
|
563
|
+
// cacheControl: <string> -- set the cacheControl header (if supported by underlying storage)
|
|
556
564
|
|
|
557
565
|
view.write = closure write(path, content, options, callback) {
|
|
558
566
|
if !callback
|
package/lib/browser/env_web.js
CHANGED
|
@@ -514,7 +514,7 @@ exports.NaanControllerWeb = function() {
|
|
|
514
514
|
statedoc.curversion = kStateCurrentVersion;
|
|
515
515
|
statedoc.firstver = kStateFirstVersion;
|
|
516
516
|
statedoc.licensee = "MIT-License";
|
|
517
|
-
statedoc.verstring = "1.
|
|
517
|
+
statedoc.verstring = "1.5.0+1";
|
|
518
518
|
statedoc.date = new Date().toISOString();
|
|
519
519
|
statedoc.prefs = prefs;
|
|
520
520
|
statedoc.naan = naanlib.saveState(false); // true to optimize, which is a bit slower
|
|
@@ -532,7 +532,7 @@ exports.NaanControllerWeb = function() {
|
|
|
532
532
|
|| statedoc.firstver > kStateCurrentVersion
|
|
533
533
|
|| statedoc.curversion < kStateFirstVersion
|
|
534
534
|
|| statedoc.licensee != "MIT-License"
|
|
535
|
-
|| statedoc.verstring != "1.
|
|
535
|
+
|| statedoc.verstring != "1.5.0+1"
|
|
536
536
|
|| !(naanstate = statedoc.naan))
|
|
537
537
|
{
|
|
538
538
|
localStorage.removeItem("NaanState_Hosted");
|
|
@@ -550,7 +550,7 @@ exports.NaanControllerWeb = function() {
|
|
|
550
550
|
localStorage.removeItem("NaanState_Hosted");
|
|
551
551
|
return (false);
|
|
552
552
|
}
|
|
553
|
-
if (
|
|
553
|
+
if ("nosave" in querystrings)
|
|
554
554
|
return (false);
|
|
555
555
|
var statedoc = makeState();
|
|
556
556
|
var statestr = JSON.stringify(statedoc);
|
|
@@ -591,7 +591,7 @@ exports.NaanControllerWeb = function() {
|
|
|
591
591
|
op: "VsiteOpen",
|
|
592
592
|
name: vsiteName,
|
|
593
593
|
naancont: contSelf,
|
|
594
|
-
title: vsiteName + " 1.
|
|
594
|
+
title: vsiteName + " 1.5.0+1"
|
|
595
595
|
});
|
|
596
596
|
}
|
|
597
597
|
} catch (e) {
|
|
@@ -605,7 +605,7 @@ exports.NaanControllerWeb = function() {
|
|
|
605
605
|
op: "VsiteClose",
|
|
606
606
|
name: vsiteName,
|
|
607
607
|
naancont: contSelf,
|
|
608
|
-
title: vsiteName + " 1.
|
|
608
|
+
title: vsiteName + " 1.5.0+1"
|
|
609
609
|
});
|
|
610
610
|
termTextOut("\x1b[90m\x1b[3m".concat("\nwindow closed", "\x1b[0m\n"));
|
|
611
611
|
}
|
|
@@ -621,7 +621,7 @@ exports.NaanControllerWeb = function() {
|
|
|
621
621
|
op: "VsiteVisibilityChange",
|
|
622
622
|
name: vsiteName,
|
|
623
623
|
naancont: contSelf,
|
|
624
|
-
title: vsiteName + " 1.
|
|
624
|
+
title: vsiteName + " 1.5.0+1",
|
|
625
625
|
hidden: window.document.visibilityState == "hidden",
|
|
626
626
|
window: window
|
|
627
627
|
});
|
|
@@ -631,13 +631,13 @@ exports.NaanControllerWeb = function() {
|
|
|
631
631
|
}
|
|
632
632
|
|
|
633
633
|
/*jshint sub:true */
|
|
634
|
-
if (
|
|
634
|
+
if ("restart" in querystrings || !loadLocal())
|
|
635
635
|
{ // don't load state or can't load state
|
|
636
636
|
naanlib.banner();
|
|
637
637
|
var hostpath = window.location.origin.concat(naanlib.js.r("path").dirname(window.location.pathname));
|
|
638
638
|
naanlib.start({
|
|
639
|
-
cmd: 'App.version = "1.
|
|
640
|
-
+ 'App.cache = "
|
|
639
|
+
cmd: 'App.version = "1.5.0+1";;\r\n'
|
|
640
|
+
+ 'App.cache = "8a52678888a755df427e58396a70e4f9";;\r\n'
|
|
641
641
|
+ 'Naan.module.requireQuery({ naanver: App.cache });;\r\n'
|
|
642
642
|
+ 'Naan.module.webparse("naan_init.nlg", "' + hostpath + '", { naanver: App.cache });;\r\n'
|
|
643
643
|
});
|