@naanlang/naan 1.0.13 → 1.0.14
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/naan.min.js +4 -4
- package/frameworks/browser/https_request.nlg +9 -1
- package/frameworks/browser/sworker.js +23 -23
- package/frameworks/node/https_request.nlg +28 -6
- package/frameworks/project/build.nlg +18 -17
- package/frameworks/project/projects.nlg +1 -1
- package/lib/browser/env_web.js +6 -6
- package/lib/core/naanlib.js +4 -4
- package/package.json +1 -1
- package/plugins/openSearch/openSearch.nlg +16 -14
- package/plugins/serviceAws/aws_dynamo.nlg +48 -13
- package/test/test_01_core.nlg +24 -4
- package/test/test_03_jsinterop.nlg +9 -0
- package/test/test_05_strings.nlg +1 -1
- package/test/test_06_lingoparse.nlg +24 -2
- package/test/test_07_lingo.nlg +11 -1
|
@@ -26,6 +26,14 @@
|
|
|
26
26
|
* headers: [`(key, value)] // add header(s) to the request, overriding defaults
|
|
27
27
|
* }
|
|
28
28
|
*
|
|
29
|
+
* The return is a result tuple comprising:
|
|
30
|
+
* (<error>, -- false on success
|
|
31
|
+
* <content>, -- returned data
|
|
32
|
+
* {
|
|
33
|
+
* status: <integer> -- http response status
|
|
34
|
+
* headers: <array> -- headers if available
|
|
35
|
+
* })
|
|
36
|
+
*
|
|
29
37
|
*/
|
|
30
38
|
|
|
31
39
|
closure HttpsApiRequest(url, options,
|
|
@@ -81,7 +89,7 @@ closure HttpsApiRequest(url, options,
|
|
|
81
89
|
if response.status < 200 || response.status >= 300
|
|
82
90
|
return (list(Error("HttpsApiRequest status:", url, response.status, {
|
|
83
91
|
status: response.status
|
|
84
|
-
})))
|
|
92
|
+
}), false, { status: response.status }))
|
|
85
93
|
if contentType.startsWith("application/json") {
|
|
86
94
|
`(error, content) = await(response.text())
|
|
87
95
|
if !error
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
*
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
|
-
var CurrentCacheName = "Naanlang-1.0.
|
|
39
|
+
var CurrentCacheName = "Naanlang-1.0.14+1";
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
//
|
|
@@ -92,18 +92,18 @@ var terminated; // flag that this service worker
|
|
|
92
92
|
var pubVersion = event.data.hereIsMyVersion;
|
|
93
93
|
var sourceId = event.source.id; // client id of sender of message
|
|
94
94
|
msgPorts[sourceId] = msgport;
|
|
95
|
-
console.log("[1.0.
|
|
96
|
-
if (pubVersion != "1.0.
|
|
95
|
+
console.log("[1.0.14+1] received new msgport for", sourceId, pubID, "-", pubVersion);
|
|
96
|
+
if (pubVersion != "1.0.14+1") {
|
|
97
97
|
if (upgradeMsgPorts) { // if not activated
|
|
98
|
-
console.log("[1.0.
|
|
98
|
+
console.log("[1.0.14+1] update pending for", sourceId);
|
|
99
99
|
upgradeMsgPorts[sourceId] = msgport;
|
|
100
100
|
}
|
|
101
101
|
else {
|
|
102
102
|
msgport.postMessage({ // notify new version available
|
|
103
103
|
id: "upgrade",
|
|
104
|
-
version: "1.0.
|
|
104
|
+
version: "1.0.14+1"
|
|
105
105
|
});
|
|
106
|
-
console.log("[1.0.
|
|
106
|
+
console.log("[1.0.14+1] update sent for:", sourceId);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
Reaper(); // clean up obsolete info
|
|
@@ -134,10 +134,10 @@ var terminated; // flag that this service worker
|
|
|
134
134
|
msgport.onmessage = function(msg) {
|
|
135
135
|
msg = msg.data;
|
|
136
136
|
if (msg.id == "skipWaiting") { // try to activate this SW now
|
|
137
|
-
console.log("[1.0.
|
|
137
|
+
console.log("[1.0.14+1] attempting skipWaiting");
|
|
138
138
|
self.skipWaiting();
|
|
139
139
|
} else if (msg.id == "terminate") { // termiante this SW now
|
|
140
|
-
console.log("[1.0.
|
|
140
|
+
console.log("[1.0.14+1] terminated");
|
|
141
141
|
terminate();
|
|
142
142
|
} else if (msg.id == "abortURL") { // abort an I/O transaction
|
|
143
143
|
var href = new URL(msg.url).href;
|
|
@@ -150,7 +150,7 @@ var terminated; // flag that this service worker
|
|
|
150
150
|
} else if (msg.id == "response") // response from fetch request
|
|
151
151
|
processResponse(msg);
|
|
152
152
|
else if (msg.id == "text") // just log some text
|
|
153
|
-
console.log("[1.0.
|
|
153
|
+
console.log("[1.0.14+1] msg received:", msg.text);
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
// send text to IDE log
|
|
@@ -161,7 +161,7 @@ var terminated; // flag that this service worker
|
|
|
161
161
|
// don't clutter the log
|
|
162
162
|
msgport.postMessage({
|
|
163
163
|
id: "text",
|
|
164
|
-
text: "port received by 1.0.
|
|
164
|
+
text: "port received by 1.0.14+1",
|
|
165
165
|
});
|
|
166
166
|
*/
|
|
167
167
|
if (--pending === 0)
|
|
@@ -178,7 +178,7 @@ var terminated; // flag that this service worker
|
|
|
178
178
|
includeUncontrolled: true
|
|
179
179
|
}).then(function(clientList) {
|
|
180
180
|
clientList.every(function(client) {
|
|
181
|
-
console.log("[1.0.
|
|
181
|
+
console.log("[1.0.14+1] requesting new msgport for", client.id);
|
|
182
182
|
++pending;
|
|
183
183
|
client.postMessage({ // tell client(s) we need this fetch source
|
|
184
184
|
msg: "Naan_need_fetch_port",
|
|
@@ -224,12 +224,12 @@ function Reaper() {
|
|
|
224
224
|
clients[clientList[clidex].id] = clientList[clidex];
|
|
225
225
|
for (var sourceId in msgPorts)
|
|
226
226
|
if (!clients[sourceId]) {
|
|
227
|
-
console.log("[1.0.
|
|
227
|
+
console.log("[1.0.14+1] source gone:", sourceId);
|
|
228
228
|
delete msgPorts[sourceId]; // no longer a source
|
|
229
229
|
}
|
|
230
230
|
for (var clientId in fetchPorts)
|
|
231
231
|
if (!clients[clientId]) {
|
|
232
|
-
console.log("[1.0.
|
|
232
|
+
console.log("[1.0.14+1] client gone:", clientId);
|
|
233
233
|
delete fetchPorts[clientId]; // no longer a client
|
|
234
234
|
}
|
|
235
235
|
for (var fqdex = 0; fqdex < fetchQueue.length; ++fqdex) {
|
|
@@ -263,16 +263,16 @@ function ClearCaches() {
|
|
|
263
263
|
return (Promise.all(
|
|
264
264
|
cacheNames.map(function(cacheName) {
|
|
265
265
|
if (cacheName != CurrentCacheName) {
|
|
266
|
-
console.log('[1.0.
|
|
266
|
+
console.log('[1.0.14+1] deleting old cache:', cacheName);
|
|
267
267
|
return (caches.delete(cacheName));
|
|
268
268
|
}
|
|
269
269
|
})
|
|
270
270
|
));
|
|
271
271
|
}).then(function() { // claim all clients
|
|
272
|
-
console.log('[1.0.
|
|
272
|
+
console.log('[1.0.14+1] claiming clients');
|
|
273
273
|
return (self.clients.claim());
|
|
274
274
|
}).then(function() {
|
|
275
|
-
console.log('[1.0.
|
|
275
|
+
console.log('[1.0.14+1] clients claimed');
|
|
276
276
|
return (Promise.resolve(true));
|
|
277
277
|
});
|
|
278
278
|
return (promise);
|
|
@@ -315,7 +315,7 @@ function GetClientResponse(event, urlpath) {
|
|
|
315
315
|
msgport.postMessage({
|
|
316
316
|
id: "fetch",
|
|
317
317
|
seq: seqno,
|
|
318
|
-
version: "1.0.
|
|
318
|
+
version: "1.0.14+1",
|
|
319
319
|
request: {
|
|
320
320
|
method: event.request.method,
|
|
321
321
|
url: event.request.url
|
|
@@ -363,7 +363,7 @@ function GetClientResponse(event, urlpath) {
|
|
|
363
363
|
*/
|
|
364
364
|
|
|
365
365
|
self.addEventListener('install', function(event) {
|
|
366
|
-
console.log("[1.0.
|
|
366
|
+
console.log("[1.0.14+1] install");
|
|
367
367
|
self.skipWaiting();
|
|
368
368
|
});
|
|
369
369
|
|
|
@@ -376,20 +376,20 @@ self.addEventListener('install', function(event) {
|
|
|
376
376
|
*/
|
|
377
377
|
|
|
378
378
|
self.addEventListener('activate', function(event) {
|
|
379
|
-
console.log("[1.0.
|
|
379
|
+
console.log("[1.0.14+1] activate");
|
|
380
380
|
self.clients.matchAll({ // for debugging, list controlled clients
|
|
381
381
|
includeUncontrolled: true
|
|
382
382
|
}).then(function(clientList) {
|
|
383
383
|
var urls = clientList.map(function(client) {
|
|
384
384
|
return (client.url);
|
|
385
385
|
});
|
|
386
|
-
console.log('[1.0.
|
|
386
|
+
console.log('[1.0.14+1] matching clients:', urls.join(', '));
|
|
387
387
|
});
|
|
388
388
|
var promise = ClearCaches().then(function() {
|
|
389
389
|
for (var sourceId in upgradeMsgPorts) {
|
|
390
390
|
upgradeMsgPorts[sourceId].postMessage({ // notify new version available
|
|
391
391
|
id: "upgrade",
|
|
392
|
-
version: "1.0.
|
|
392
|
+
version: "1.0.14+1"
|
|
393
393
|
});
|
|
394
394
|
}
|
|
395
395
|
upgradeMsgPorts = false;
|
|
@@ -421,7 +421,7 @@ self.addEventListener('fetch', function(event) {
|
|
|
421
421
|
var promise;
|
|
422
422
|
var url = new URL(request.url);
|
|
423
423
|
var nocache = request.method != "GET"
|
|
424
|
-
|| url.search.length !== 0 && url.searchParams.get("naanver") !== "
|
|
424
|
+
|| url.search.length !== 0 && url.searchParams.get("naanver") !== "3551208545a0b7d226925e1a7a47bc6d"
|
|
425
425
|
|| request.headers.get('range');
|
|
426
426
|
if (url.pathname.startsWith("/run/")) {
|
|
427
427
|
nocache = true;
|
|
@@ -454,7 +454,7 @@ self.addEventListener('fetch', function(event) {
|
|
|
454
454
|
statusText: "Request Cancelled"
|
|
455
455
|
}));
|
|
456
456
|
}
|
|
457
|
-
console.log("[1.0.
|
|
457
|
+
console.log("[1.0.14+1] fetch failed", request.url, e);
|
|
458
458
|
return (new Response(undefined, {
|
|
459
459
|
status: 404,
|
|
460
460
|
statusText: "Fetch Failed"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
*
|
|
2
|
+
* https_request.nlg
|
|
3
3
|
*
|
|
4
4
|
* Https operations for NodeJS.
|
|
5
5
|
*
|
|
@@ -24,10 +24,25 @@
|
|
|
24
24
|
* range: <string> // sets range header
|
|
25
25
|
* headers: [`(key, value)] // add header(s) to the request, overriding defaults
|
|
26
26
|
* auth: <string> // username:password string
|
|
27
|
-
* cacert: <data> // ca for verifying peer
|
|
27
|
+
* cacert: <data> // deprecated: ca for verifying peer
|
|
28
|
+
* ssl: {
|
|
29
|
+
* ca: <data> // replacemenet certificate authority or self-signed cert
|
|
30
|
+
* cert: <data>
|
|
31
|
+
* key: <data>
|
|
32
|
+
* passphrase: <data> // optional
|
|
33
|
+
* }
|
|
34
|
+
* allowSelfSigned: <boolean> // allow a self-signed certificate at the servera
|
|
28
35
|
* debug: <boolean> // log errors and status results
|
|
29
36
|
* }
|
|
30
37
|
*
|
|
38
|
+
* The return is a result tuple comprising:
|
|
39
|
+
* (<error>, -- false on success
|
|
40
|
+
* <content>, -- returned data
|
|
41
|
+
* {
|
|
42
|
+
* status: <integer> -- http response status
|
|
43
|
+
* headers: <array> -- headers if available
|
|
44
|
+
* })
|
|
45
|
+
*
|
|
31
46
|
*/
|
|
32
47
|
|
|
33
48
|
closure HttpsApiRequest(url, options,
|
|
@@ -63,8 +78,6 @@ closure HttpsApiRequest(url, options,
|
|
|
63
78
|
reqOptions.headers[item.0] = item.1
|
|
64
79
|
if options.auth
|
|
65
80
|
reqOptions.auth = options.auth
|
|
66
|
-
if options.cacert
|
|
67
|
-
reqOptions.ca = options.cacert
|
|
68
81
|
if options.allowSelfSigned {
|
|
69
82
|
xurl = nodeUrl.parse(url)
|
|
70
83
|
reqOptions.agent = xnew(nodeHttps.Agent({
|
|
@@ -72,8 +85,17 @@ closure HttpsApiRequest(url, options,
|
|
|
72
85
|
port: xurl.port
|
|
73
86
|
path: xurl.path
|
|
74
87
|
rejectUnauthorized: false
|
|
75
|
-
|
|
88
|
+
// keepAlive: false
|
|
89
|
+
ca: options.ssl.ca || options.cacert || [ selfSignedRootCaPemCrtBuffer ]
|
|
90
|
+
cert: options.ssl.cert || undefined
|
|
91
|
+
key: options.ssl.key || undefined
|
|
92
|
+
passphrase: options.ssl.passphrase || undefined
|
|
76
93
|
}))
|
|
94
|
+
} else {
|
|
95
|
+
reqOptions.ca = options.ssl.ca || options.cacert || undefined
|
|
96
|
+
reqOptions.cert = options.ssl.cert || undefined
|
|
97
|
+
reqOptions.key = options.ssl.key || undefined
|
|
98
|
+
reqOptions.passphrase = options.ssl.passphrase || undefined
|
|
77
99
|
}
|
|
78
100
|
pending = new(nonce)
|
|
79
101
|
chunks = []
|
|
@@ -88,7 +110,7 @@ closure HttpsApiRequest(url, options,
|
|
|
88
110
|
debuglog("HttpsApiRequest status:", url, response.statusCode, "message:", content)
|
|
89
111
|
pending.signal(list(Error("HttpsApiRequest statusCode:", url, response.statusCode, {
|
|
90
112
|
status: response.statusCode
|
|
91
|
-
})))
|
|
113
|
+
}), false, { status: response.statusCode }))
|
|
92
114
|
return
|
|
93
115
|
}
|
|
94
116
|
if response.complete {
|
|
@@ -994,7 +994,7 @@ closure Builder(rules, operation, fs, srcpath, destpath, local build, group, new
|
|
|
994
994
|
`(error, content) = parseAndPack(content, entry.readpath, { jspack: true })
|
|
995
995
|
else if entry.syntax
|
|
996
996
|
`(error) = parseAndPack(content, entry.readpath, { syntax: true })
|
|
997
|
-
if entry.minimize {
|
|
997
|
+
if !error && entry.minimize {
|
|
998
998
|
`(error, content) = build.uglify.minify(
|
|
999
999
|
new(dictionary, list(cons(entry.readpath, content))), {
|
|
1000
1000
|
mangle: { eval: true }
|
|
@@ -1005,25 +1005,26 @@ closure Builder(rules, operation, fs, srcpath, destpath, local build, group, new
|
|
|
1005
1005
|
else if entry.minprefix
|
|
1006
1006
|
content = entry.minprefix.concat(content)
|
|
1007
1007
|
}
|
|
1008
|
-
if
|
|
1009
|
-
if entry.
|
|
1010
|
-
|
|
1011
|
-
|
|
1008
|
+
if entry.catcount {
|
|
1009
|
+
if !catenates[entry.writepath]
|
|
1010
|
+
catenates[entry.writepath] = new(Array(entry.catcount))
|
|
1011
|
+
if error
|
|
1012
|
+
entry.error = error
|
|
1013
|
+
else
|
|
1012
1014
|
entry.content = content
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
}
|
|
1015
|
+
catenates[entry.writepath][entry.catindex] = entry
|
|
1016
|
+
if catReady(entry.writepath) {
|
|
1017
|
+
`(error, result) = writeCatenate(entry.writepath)
|
|
1018
|
+
if error
|
|
1019
|
+
build.errorlist.push(error)
|
|
1020
|
+
catenates[entry.writepath].0.done.signal(error)
|
|
1020
1021
|
}
|
|
1021
|
-
|
|
1022
|
+
}
|
|
1023
|
+
else {
|
|
1024
|
+
if !error
|
|
1022
1025
|
`(error, result) = fs.writeFile(entry.writepath, content)
|
|
1023
|
-
entry.done.signal(error)
|
|
1024
|
-
}
|
|
1025
|
-
} else
|
|
1026
1026
|
entry.done.signal(error)
|
|
1027
|
+
}
|
|
1027
1028
|
}
|
|
1028
1029
|
if error
|
|
1029
1030
|
build.errorlist.push(error)
|
|
@@ -1050,7 +1051,7 @@ closure Builder(rules, operation, fs, srcpath, destpath, local build, group, new
|
|
|
1050
1051
|
//
|
|
1051
1052
|
function catReady(writepath, local entry) {
|
|
1052
1053
|
for entry in catenates[writepath]
|
|
1053
|
-
if !entry.content
|
|
1054
|
+
if !entry.content && !entry.error
|
|
1054
1055
|
return (false)
|
|
1055
1056
|
true
|
|
1056
1057
|
}
|
|
@@ -296,7 +296,7 @@ closure projConnector(projman, projtype, local connector, watch) {
|
|
|
296
296
|
*
|
|
297
297
|
* Nide.proj/
|
|
298
298
|
* nide_cliser.cfg - JSON definition of the project (see below)
|
|
299
|
-
* NaanIDE_version.txt - [default] substitution file defining 1.0.
|
|
299
|
+
* NaanIDE_version.txt - [default] substitution file defining 1.0.14+1 etc.
|
|
300
300
|
* NaanIDE_version_builds.txt - [default] contains current build number as decimal string
|
|
301
301
|
* build/ - [optional] default build output location
|
|
302
302
|
* NaanIDE.lic - [optional] defines Zulch Laboratories, Inc. and other license info
|
package/lib/browser/env_web.js
CHANGED
|
@@ -526,7 +526,7 @@ exports.NaanControllerWeb = function() {
|
|
|
526
526
|
statedoc.curversion = kStateCurrentVersion;
|
|
527
527
|
statedoc.firstver = kStateFirstVersion;
|
|
528
528
|
statedoc.licensee = "MIT-License";
|
|
529
|
-
statedoc.verstring = "1.0.
|
|
529
|
+
statedoc.verstring = "1.0.14+1";
|
|
530
530
|
statedoc.date = new Date().toISOString();
|
|
531
531
|
statedoc.prefs = prefs;
|
|
532
532
|
statedoc.naan = naanlib.saveState(false); // true to optimize, which is a bit slower
|
|
@@ -544,7 +544,7 @@ exports.NaanControllerWeb = function() {
|
|
|
544
544
|
|| statedoc.firstver > kStateCurrentVersion
|
|
545
545
|
|| statedoc.curversion < kStateFirstVersion
|
|
546
546
|
|| statedoc.licensee != "MIT-License"
|
|
547
|
-
|| statedoc.verstring != "1.0.
|
|
547
|
+
|| statedoc.verstring != "1.0.14+1")
|
|
548
548
|
{
|
|
549
549
|
localStorage.removeItem("NaanState_Hosted");
|
|
550
550
|
return (false);
|
|
@@ -603,7 +603,7 @@ exports.NaanControllerWeb = function() {
|
|
|
603
603
|
op: "VsiteOpen",
|
|
604
604
|
name: vsiteName,
|
|
605
605
|
naancont: contSelf,
|
|
606
|
-
title: vsiteName + " 1.0.
|
|
606
|
+
title: vsiteName + " 1.0.14+1"
|
|
607
607
|
});
|
|
608
608
|
}
|
|
609
609
|
} catch (e) {
|
|
@@ -617,7 +617,7 @@ exports.NaanControllerWeb = function() {
|
|
|
617
617
|
op: "VsiteClose",
|
|
618
618
|
name: vsiteName,
|
|
619
619
|
naancont: contSelf,
|
|
620
|
-
title: vsiteName + " 1.0.
|
|
620
|
+
title: vsiteName + " 1.0.14+1"
|
|
621
621
|
});
|
|
622
622
|
termTextOut("\x1b[90m\x1b[3m".concat("\nwindow closed", "\x1b[0m\n"));
|
|
623
623
|
}
|
|
@@ -632,8 +632,8 @@ exports.NaanControllerWeb = function() {
|
|
|
632
632
|
naanlib.banner();
|
|
633
633
|
var hostpath = naanlib.js.r("path").dirname(window.location.href);
|
|
634
634
|
naanlib.start({
|
|
635
|
-
cmd: 'App.version = "1.0.
|
|
636
|
-
+ 'App.cache = "
|
|
635
|
+
cmd: 'App.version = "1.0.14+1";;\r\n'
|
|
636
|
+
+ 'App.cache = "7d35a97d7bea57c619edd042aaf5b648";;\r\n'
|
|
637
637
|
+ 'Naan.module.requireQuery({ naanver: App.cache });;\r\n'
|
|
638
638
|
+ 'Naan.module.webparse("naan_init.nlg", "' + hostpath + '", { naanver: App.cache });;\r\n'
|
|
639
639
|
});
|