jsf.js_next_gen 4.0.0-RC.35 → 4.0.0-RC.37

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 (59) hide show
  1. package/.nyc_output/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
  2. package/.nyc_output/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
  3. package/.nyc_output/processinfo/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
  4. package/.nyc_output/processinfo/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
  5. package/.nyc_output/processinfo/index.json +1 -1
  6. package/dist/docs/assets/search.js +1 -1
  7. package/dist/docs/functions/faces.ajax.addOnError.html +6 -4
  8. package/dist/docs/functions/faces.ajax.addOnEvent.html +2 -0
  9. package/dist/docs/functions/faces.ajax.request.html +7 -7
  10. package/dist/docs/functions/faces.ajax.response.html +0 -1
  11. package/dist/docs/functions/faces.push.close.html +3 -1
  12. package/dist/docs/functions/faces.push.open.html +3 -1
  13. package/dist/docs/functions/faces.util.chain.html +3 -3
  14. package/dist/docs/functions/myfaces.ab.html +8 -3
  15. package/dist/docs/functions/myfaces.onOnDomReady.html +72 -0
  16. package/dist/docs/modules/myfaces.html +3 -1
  17. package/dist/docs/variables/myfaces.oam.html +2 -1
  18. package/dist/window/faces-development.js +303 -728
  19. package/dist/window/faces-development.js.br +0 -0
  20. package/dist/window/faces-development.js.gz +0 -0
  21. package/dist/window/faces-development.js.map +1 -1
  22. package/dist/window/faces.js +1 -1
  23. package/dist/window/faces.js.br +0 -0
  24. package/dist/window/faces.js.gz +0 -0
  25. package/dist/window/faces.js.map +1 -1
  26. package/dist/window/jsf-development.js +303 -728
  27. package/dist/window/jsf-development.js.br +0 -0
  28. package/dist/window/jsf-development.js.gz +0 -0
  29. package/dist/window/jsf-development.js.map +1 -1
  30. package/dist/window/jsf.js +1 -1
  31. package/dist/window/jsf.js.br +0 -0
  32. package/dist/window/jsf.js.gz +0 -0
  33. package/dist/window/jsf.js.map +1 -1
  34. package/package.json +7 -6
  35. package/src/main/typescript/@types/definitions/index.d.ts +5 -5
  36. package/src/main/typescript/api/_api.ts +55 -20
  37. package/src/main/typescript/impl/AjaxImpl.ts +10 -7
  38. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +3 -3
  39. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +35 -0
  40. package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +109 -0
  41. package/target/api/_api.js +53 -18
  42. package/target/api/_api.js.map +1 -1
  43. package/target/impl/AjaxImpl.js +8 -4
  44. package/target/impl/AjaxImpl.js.map +1 -1
  45. package/target/impl/util/XhrQueueController.js +82 -0
  46. package/target/impl/util/XhrQueueController.js.map +1 -0
  47. package/target/impl/xhrCore/XhrQueHandler.js +11 -0
  48. package/target/impl/xhrCore/XhrQueHandler.js.map +1 -0
  49. package/target/impl/xhrCore/XhrQueueController.js +62 -0
  50. package/target/impl/xhrCore/XhrQueueController.js.map +1 -0
  51. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
  52. package/target/test/frameworkBase/_ext/shared/StandardInits.js +36 -0
  53. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  54. package/target/test/xhrCore/TobagoFileUploadTest.spec.js +128 -0
  55. package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +1 -0
  56. package/.nyc_output/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
  57. package/.nyc_output/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
  58. package/.nyc_output/processinfo/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
  59. package/.nyc_output/processinfo/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
@@ -37,13 +37,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
37
37
  Object.defineProperty(exports, "__esModule", ({ value: true }));
38
38
  exports.DQ$ = exports.DQ = exports.DomQueryCollector = exports.DomQuery = exports.Style = exports.ElementAttribute = void 0;
39
39
  const Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
40
- const Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
41
40
  const SourcesCollectors_1 = __webpack_require__(/*! ./SourcesCollectors */ "./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts");
42
41
  const Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
42
+ const Global_1 = __webpack_require__(/*! ./Global */ "./node_modules/mona-dish/src/main/typescript/Global.ts");
43
+ const Es2019Array_1 = __webpack_require__(/*! ./Es2019Array */ "./node_modules/mona-dish/src/main/typescript/Es2019Array.ts");
43
44
  var trim = Lang_1.Lang.trim;
44
45
  var isString = Lang_1.Lang.isString;
45
46
  var eqi = Lang_1.Lang.equalsIgnoreCase;
46
- const Global_1 = __webpack_require__(/*! ./Global */ "./node_modules/mona-dish/src/main/typescript/Global.ts");
47
47
  var objToArray = Lang_1.Lang.objToArray;
48
48
  /**
49
49
  *
@@ -271,6 +271,12 @@ class DomQuery {
271
271
  get global() {
272
272
  return Global_1._global$;
273
273
  }
274
+ get stream() {
275
+ throw Error("Not implemented, include Stream.ts for this to work");
276
+ }
277
+ get lazyStream() {
278
+ throw Error("Not implemented, include Stream.ts for this to work");
279
+ }
274
280
  /**
275
281
  * returns the id of the first element
276
282
  */
@@ -347,7 +353,7 @@ class DomQuery {
347
353
  this.id.value = value;
348
354
  }
349
355
  get checked() {
350
- return Stream_1.Stream.of(...this.values).allMatch(el => !!el.checked);
356
+ return new Es2019Array_1.Es2019Array(...this.values).every(el => !!el.checked);
351
357
  }
352
358
  set checked(newChecked) {
353
359
  this.eachElem(el => el.checked = newChecked);
@@ -405,58 +411,41 @@ class DomQuery {
405
411
  });
406
412
  return new DomQuery(...childNodeArr);
407
413
  }
408
- /**
409
- * binding into stream
410
- */
411
- get stream() {
412
- return new Stream_1.Stream(...this.asArray);
413
- }
414
- /**
415
- * fetches a lazy stream representation
416
- * lazy should be applied if you have some filters etc.
417
- * in between, this can reduce the number of post filter operations
418
- * and ram usage
419
- * significantly because the operations are done lazily and stop
420
- * once they hit a dead end.
421
- */
422
- get lazyStream() {
423
- return Stream_1.LazyStream.of(...this.asArray);
424
- }
425
414
  get asArray() {
426
415
  // filter not supported by IE11
427
- return [].concat(Stream_1.LazyStream.of(...this.rootNode).filter(item => {
416
+ let items = new Es2019Array_1.Es2019Array(...this.rootNode).filter(item => {
428
417
  return item != null;
429
- })
430
- .map(item => {
418
+ }).map(item => {
431
419
  return DomQuery.byId(item);
432
- }).collect(new SourcesCollectors_1.ArrayCollector()));
420
+ });
421
+ return items;
433
422
  }
434
423
  get offsetWidth() {
435
- return Stream_1.LazyStream.of(...this.rootNode)
424
+ return new Es2019Array_1.Es2019Array(...this.rootNode)
436
425
  .filter(item => item != null)
437
426
  .map(elem => elem.offsetWidth)
438
- .reduce((accumulate, incoming) => accumulate + incoming, 0).value;
427
+ .reduce((accumulate, incoming) => accumulate + incoming, 0);
439
428
  }
440
429
  get offsetHeight() {
441
- return Stream_1.LazyStream.of(...this.rootNode)
430
+ return new Es2019Array_1.Es2019Array(...this.rootNode)
442
431
  .filter(item => item != null)
443
432
  .map(elem => elem.offsetHeight)
444
- .reduce((accumulate, incoming) => accumulate + incoming, 0).value;
433
+ .reduce((accumulate, incoming) => accumulate + incoming, 0);
445
434
  }
446
435
  get offsetLeft() {
447
- return Stream_1.LazyStream.of(...this.rootNode)
436
+ return new Es2019Array_1.Es2019Array(...this.rootNode)
448
437
  .filter(item => item != null)
449
438
  .map(elem => elem.offsetLeft)
450
- .reduce((accumulate, incoming) => accumulate + incoming, 0).value;
439
+ .reduce((accumulate, incoming) => accumulate + incoming, 0);
451
440
  }
452
441
  get offsetTop() {
453
- return Stream_1.LazyStream.of(...this.rootNode)
442
+ return new Es2019Array_1.Es2019Array(this.rootNode)
454
443
  .filter(item => item != null)
455
444
  .map(elem => elem.offsetTop)
456
- .reduce((accumulate, incoming) => accumulate + incoming, 0).value;
445
+ .reduce((accumulate, incoming) => accumulate + incoming, 0);
457
446
  }
458
447
  get asNodeArray() {
459
- return [].concat(Stream_1.Stream.of(...this.rootNode).filter(item => item != null).collect(new SourcesCollectors_1.ArrayCollector()));
448
+ return new Es2019Array_1.Es2019Array(...this.rootNode.filter(item => item != null));
460
449
  }
461
450
  static querySelectorAllDeep(selector) {
462
451
  return new DomQuery(document).querySelectorAllDeep(selector);
@@ -520,10 +509,10 @@ class DomQuery {
520
509
  const doc = document.implementation.createHTMLDocument("");
521
510
  markup = trim(markup);
522
511
  let lowerMarkup = markup.toLowerCase();
523
- if (lowerMarkup.search(/\<\!doctype[^\w\-]+/gi) != -1 ||
524
- lowerMarkup.search(/\<html[^\w\-]+/gi) != -1 ||
525
- lowerMarkup.search(/\<head[^\w\-]+/gi) != -1 ||
526
- lowerMarkup.search(/\<body[^\w\-]+/gi) != -1) {
512
+ if (lowerMarkup.search(/<!doctype[^\w\-]+/gi) != -1 ||
513
+ lowerMarkup.search(/<html[^\w\-]+/gi) != -1 ||
514
+ lowerMarkup.search(/<head[^\w\-]+/gi) != -1 ||
515
+ lowerMarkup.search(/<body[^\w\-]+/gi) != -1) {
527
516
  doc.documentElement.innerHTML = markup;
528
517
  return new DomQuery(doc.documentElement);
529
518
  }
@@ -655,10 +644,9 @@ class DomQuery {
655
644
  byId(id, includeRoot) {
656
645
  let res = [];
657
646
  if (includeRoot) {
658
- res = res.concat(Stream_1.LazyStream.of(...((this === null || this === void 0 ? void 0 : this.rootNode) || []))
659
- .filter(item => id == item.id)
660
- .map(item => new DomQuery(item))
661
- .collect(new SourcesCollectors_1.ArrayCollector()));
647
+ res = res.concat(...new Es2019Array_1.Es2019Array(...((this === null || this === void 0 ? void 0 : this.rootNode) || []))
648
+ .filter(((item) => id == item.id))
649
+ .map(item => new DomQuery(item)));
662
650
  }
663
651
  // for some strange kind of reason the # selector fails
664
652
  // on hidden elements we use the attributes match selector
@@ -669,10 +657,9 @@ class DomQuery {
669
657
  byIdDeep(id, includeRoot) {
670
658
  let res = [];
671
659
  if (includeRoot) {
672
- res = res.concat(Stream_1.LazyStream.of(...((this === null || this === void 0 ? void 0 : this.rootNode) || []))
660
+ res = res.concat(new Es2019Array_1.Es2019Array(...((this === null || this === void 0 ? void 0 : this.rootNode) || []))
673
661
  .filter(item => id == item.id)
674
- .map(item => new DomQuery(item))
675
- .collect(new SourcesCollectors_1.ArrayCollector()));
662
+ .map(item => new DomQuery(item)));
676
663
  }
677
664
  let subItems = this.querySelectorAllDeep(`[id="${id}"]`);
678
665
  if (subItems.length) {
@@ -690,10 +677,9 @@ class DomQuery {
690
677
  var _a;
691
678
  let res = [];
692
679
  if (includeRoot) {
693
- res = Stream_1.LazyStream.of(...((_a = this === null || this === void 0 ? void 0 : this.rootNode) !== null && _a !== void 0 ? _a : []))
680
+ res = new Es2019Array_1.Es2019Array(...((_a = this === null || this === void 0 ? void 0 : this.rootNode) !== null && _a !== void 0 ? _a : []))
694
681
  .filter(element => (element === null || element === void 0 ? void 0 : element.tagName) == tagName)
695
- .reduce((reduction, item) => reduction.concat([item]), res)
696
- .orElse(res).value;
682
+ .reduce((reduction, item) => reduction.concat([item]), res);
697
683
  }
698
684
  (deep) ? res.push(this.querySelectorAllDeep(tagName)) : res.push(this.querySelectorAll(tagName));
699
685
  return new DomQuery(...res);
@@ -826,11 +812,8 @@ class DomQuery {
826
812
  * @param selector
827
813
  */
828
814
  matchesSelector(selector) {
829
- const ret = this.lazyStream
830
- .map(item => this._mozMatchesSelector(item.getAsElem(0).value, selector))
831
- .filter(match => match)
832
- .first();
833
- return ret.isPresent();
815
+ return this.asArray
816
+ .some(item => this._mozMatchesSelector(item.getAsElem(0).value, selector));
834
817
  }
835
818
  /**
836
819
  * easy node traversal, you can pass
@@ -871,8 +854,8 @@ class DomQuery {
871
854
  return this;
872
855
  }
873
856
  each(func) {
874
- Stream_1.Stream.of(...this.rootNode)
875
- .each((item, cnt) => {
857
+ new Es2019Array_1.Es2019Array(...this.rootNode)
858
+ .forEach((item, cnt) => {
876
859
  // we could use a filter, but for the best performance we don´t
877
860
  if (item == null) {
878
861
  return;
@@ -1224,7 +1207,7 @@ class DomQuery {
1224
1207
  // scripts before we run the 'include' command
1225
1208
  // this.globalEval(finalScripts.join("\n"));
1226
1209
  let joinedScripts = [];
1227
- Stream_1.Stream.of(...scriptsToProcess).each(item => {
1210
+ new Es2019Array_1.Es2019Array(...scriptsToProcess).forEach(item => {
1228
1211
  if (!item.nonce) {
1229
1212
  joinedScripts.push(item.evalText);
1230
1213
  }
@@ -1310,10 +1293,10 @@ class DomQuery {
1310
1293
  try {
1311
1294
  let scriptElements = new DomQuery(this.filterSelector("script"), this.querySelectorAll("script"));
1312
1295
  // script execution order by relative pos in their dom tree
1313
- scriptElements.stream
1314
- .flatMap(item => Stream_1.Stream.of(...item.values))
1296
+ scriptElements.asArray
1297
+ .flatMap(item => [...item.values])
1315
1298
  .sort((node1, node2) => node1.compareDocumentPosition(node2) - 3) // preceding 2, following == 4)
1316
- .each(item => execScript(item));
1299
+ .forEach(item => execScript(item));
1317
1300
  evalCollectedScripts(finalScripts);
1318
1301
  }
1319
1302
  catch (e) {
@@ -1356,19 +1339,20 @@ class DomQuery {
1356
1339
  else if (tagName && eqi(tagName, "style")) {
1357
1340
  let innerText = _toReplace.innerHTML.replace(/\s+/gi, "");
1358
1341
  let styles = head.querySelectorAll("style");
1359
- styles = styles.stream.filter(style => {
1342
+ let filteredStyles = styles.asArray.filter(style => {
1360
1343
  return style.innerHTML.replace(/\s+/gi, "") == innerText;
1361
- }).collect(new DomQueryCollector());
1344
+ });
1345
+ styles = new DomQuery(...filteredStyles);
1362
1346
  if (!styles.length) { //already present
1363
1347
  head.append(_toReplace);
1364
1348
  }
1365
1349
  }
1366
1350
  };
1367
1351
  const scriptElements = new DomQuery(this.filterSelector("link, style"), this.querySelectorAll("link, style"));
1368
- scriptElements.stream
1369
- .flatMap(item => Stream_1.Stream.of(...item.values))
1352
+ scriptElements.asArray
1353
+ .flatMap(item => [...item.values])
1370
1354
  .sort((node1, node2) => node1.compareDocumentPosition(node2) - 3)
1371
- .each(item => execCss(item));
1355
+ .forEach(item => execCss(item));
1372
1356
  return this;
1373
1357
  }
1374
1358
  /**
@@ -1391,9 +1375,11 @@ class DomQuery {
1391
1375
  */
1392
1376
  fireEvent(eventName, options = {}) {
1393
1377
  // merge with last one having the highest priority
1394
- let finalOptions = Stream_1.Stream.ofAssoc({
1378
+ let finalOptions = new Monad_1.Config({
1395
1379
  bubbles: true, cancelable: true
1396
- }).concat(Stream_1.Stream.ofAssoc(options)).collect(new SourcesCollectors_1.AssocArrayCollector());
1380
+ });
1381
+ finalOptions.shallowMerge(new Monad_1.Config(options));
1382
+ finalOptions = JSON.parse(finalOptions.toJson());
1397
1383
  this.eachElem((node) => {
1398
1384
  let doc;
1399
1385
  if (node.ownerDocument) {
@@ -1444,15 +1430,13 @@ class DomQuery {
1444
1430
  // IE-old school style, you can drop this if you don't need to support IE8 and lower
1445
1431
  let event = doc.createEventObject();
1446
1432
  event.synthetic = true; // allow detection of synthetic events
1447
- Stream_1.Stream.ofAssoc(finalOptions).each(([key, value]) => {
1448
- event[key] = value;
1449
- });
1433
+ Object.keys(finalOptions).forEach(key => event[key] = finalOptions[key]);
1450
1434
  node.fireEvent("on" + eventName, event);
1451
1435
  }
1452
1436
  });
1453
1437
  }
1454
1438
  textContent(joinString = "") {
1455
- return this.stream
1439
+ return this.asArray
1456
1440
  .map((value) => {
1457
1441
  let item = value.getAsElem(0).orElseLazy(() => {
1458
1442
  return {
@@ -1461,10 +1445,10 @@ class DomQuery {
1461
1445
  }).value;
1462
1446
  return item.textContent || "";
1463
1447
  })
1464
- .reduce((text1, text2) => [text1, joinString, text2].join(""), "").value;
1448
+ .reduce((text1, text2) => [text1, joinString, text2].join(""), "");
1465
1449
  }
1466
1450
  innerText(joinString = "") {
1467
- return this.stream
1451
+ return this.asArray
1468
1452
  .map((value) => {
1469
1453
  let item = value.getAsElem(0).orElseLazy(() => {
1470
1454
  return {
@@ -1473,7 +1457,9 @@ class DomQuery {
1473
1457
  }).value;
1474
1458
  return item.innerText || "";
1475
1459
  })
1476
- .reduce((text1, text2) => [text1, text2].join(joinString), "").value;
1460
+ .reduce((text1, text2) => {
1461
+ return [text1, text2].join(joinString);
1462
+ }, "");
1477
1463
  }
1478
1464
  /**
1479
1465
  * encodes all input elements properly into respective
@@ -1562,16 +1548,22 @@ class DomQuery {
1562
1548
  }
1563
1549
  get cDATAAsString() {
1564
1550
  let TYPE_CDATA_BLOCK = 4;
1565
- let res = this.lazyStream.flatMap(item => {
1566
- return item.childNodes.stream;
1567
- }).filter(item => {
1568
- var _a, _b;
1569
- return ((_b = (_a = item === null || item === void 0 ? void 0 : item.value) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.nodeType) == TYPE_CDATA_BLOCK;
1570
- }).reduce((reduced, item) => {
1551
+ let res = this.asArray
1552
+ .flatMap(item => item.childNodes.asArray)
1553
+ .filter(item => { var _a, _b; return ((_b = (_a = item === null || item === void 0 ? void 0 : item.value) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.nodeType) == TYPE_CDATA_BLOCK; })
1554
+ .reduce((reduced, item) => {
1571
1555
  var _a, _b, _c;
1572
1556
  reduced.push((_c = (_b = (_a = item === null || item === void 0 ? void 0 : item.value) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.data) !== null && _c !== void 0 ? _c : "");
1573
1557
  return reduced;
1574
- }, []).value;
1558
+ }, []);
1559
+ /*let res: any = this.lazyStream.flatMap(item => {
1560
+ return item.childNodes.stream
1561
+ }).filter(item => {
1562
+ return item?.value?.value?.nodeType == TYPE_CDATA_BLOCK;
1563
+ }).reduce((reduced: Array<any>, item: DomQuery) => {
1564
+ reduced.push((<any>item?.value?.value)?.data ?? "");
1565
+ return reduced;
1566
+ }, []).value;*/
1575
1567
  // response may contain several blocks
1576
1568
  return res.join("");
1577
1569
  }
@@ -1728,17 +1720,17 @@ class DomQuery {
1728
1720
  * @param filterDoubles filter out possible double elements (aka same markup)
1729
1721
  */
1730
1722
  concat(toAttach, filterDoubles = true) {
1731
- const ret = this.lazyStream.concat(toAttach.lazyStream).collect(new DomQueryCollector());
1723
+ const ret = new DomQuery(...this.asArray.concat(toAttach.asArray));
1732
1724
  // we now filter the doubles out
1733
1725
  if (!filterDoubles) {
1734
1726
  return ret;
1735
1727
  }
1736
1728
  let idx = {}; // ie11 does not support sets, we have to fake it
1737
- return ret.lazyStream.filter(node => {
1729
+ return new DomQuery(...ret.asArray.filter(node => {
1738
1730
  const notFound = !(idx === null || idx === void 0 ? void 0 : idx[node.value.value.outerHTML]);
1739
1731
  idx[node.value.value.outerHTML] = true;
1740
1732
  return notFound;
1741
- }).collect(new DomQueryCollector());
1733
+ }));
1742
1734
  }
1743
1735
  append(elem) {
1744
1736
  this.each(item => elem.appendTo(item));
@@ -1988,6 +1980,76 @@ exports.DQ = DomQuery;
1988
1980
  exports.DQ$ = DomQuery.querySelectorAll;
1989
1981
 
1990
1982
 
1983
+ /***/ }),
1984
+
1985
+ /***/ "./node_modules/mona-dish/src/main/typescript/Es2019Array.ts":
1986
+ /*!*******************************************************************!*\
1987
+ !*** ./node_modules/mona-dish/src/main/typescript/Es2019Array.ts ***!
1988
+ \*******************************************************************/
1989
+ /***/ ((__unused_webpack_module, exports) => {
1990
+
1991
+
1992
+ /**
1993
+ * Extended array
1994
+ */
1995
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1996
+ exports.Es2019Array = void 0;
1997
+ /**
1998
+ * Extended array which adds various es 2019 shim functions to the normal array
1999
+ * We must remap all array producing functions in order to keep
2000
+ * the delegation active, once we are in!
2001
+ */
2002
+ class Es2019Array extends Array {
2003
+ constructor(...another) {
2004
+ super(...another);
2005
+ //for testing it definitely runs into this branch because we are on es5 level
2006
+ if (!Array.prototype.flatMap) {
2007
+ this.flatMap = (flatMapFun) => this._flatMap(flatMapFun);
2008
+ }
2009
+ if (!Array.prototype.flat) {
2010
+ this.flat = (flatLevel = 1) => this._flat(flatLevel);
2011
+ }
2012
+ }
2013
+ concat(...items) {
2014
+ return new Es2019Array(...super.concat(...items));
2015
+ }
2016
+ reverse() {
2017
+ return new Es2019Array(...super.reverse());
2018
+ }
2019
+ slice(start, end) {
2020
+ return new Es2019Array(...super.slice(start, end));
2021
+ }
2022
+ splice(start, deleteCount) {
2023
+ return new Es2019Array(...super.splice(start, deleteCount));
2024
+ }
2025
+ filter(predicate, thisArg) {
2026
+ return new Es2019Array(...super.filter(predicate, thisArg));
2027
+ }
2028
+ _flat(flatDepth = 1) {
2029
+ return this._flatResolve(this, flatDepth);
2030
+ }
2031
+ _flatResolve(arr, flatDepth = 1) {
2032
+ //recursion break
2033
+ if (flatDepth == 0) {
2034
+ return arr;
2035
+ }
2036
+ let res = [];
2037
+ let reFlat = item => {
2038
+ item = Array.isArray(item) ? item : [item];
2039
+ let mapped = this._flatResolve(item, flatDepth - 1);
2040
+ res = res.concat(mapped);
2041
+ };
2042
+ arr.forEach(reFlat);
2043
+ return new Es2019Array(...res);
2044
+ }
2045
+ _flatMap(mapperFunction, noFallback = false) {
2046
+ let res = this.map(item => mapperFunction(item));
2047
+ return this._flatResolve(res);
2048
+ }
2049
+ }
2050
+ exports.Es2019Array = Es2019Array;
2051
+
2052
+
1991
2053
  /***/ }),
1992
2054
 
1993
2055
  /***/ "./node_modules/mona-dish/src/main/typescript/Global.ts":
@@ -2070,7 +2132,7 @@ var Lang;
2070
2132
  (function (Lang) {
2071
2133
  //should be in lang, but for now here to avoid recursive imports, not sure if typescript still has a problem with those
2072
2134
  /**
2073
- * helper function to savely resolve anything
2135
+ * helper function to safely resolve anything
2074
2136
  * this is not an elvis operator, it resolves
2075
2137
  * a value without exception in a tree and if
2076
2138
  * it is not resolvable then an optional of
@@ -2096,6 +2158,12 @@ var Lang;
2096
2158
  }
2097
2159
  }
2098
2160
  Lang.saveResolve = saveResolve;
2161
+ /**
2162
+ * lazy resolve... aka the function is called on resolve and a default value also
2163
+ * is a producing function (called only if the original producer does not produce any result)
2164
+ * @param resolverProducer the producer for the resolve
2165
+ * @param defaultValue the default value producer function
2166
+ */
2099
2167
  function saveResolveLazy(resolverProducer, defaultValue = null) {
2100
2168
  try {
2101
2169
  let result = resolverProducer();
@@ -2154,7 +2222,7 @@ var Lang;
2154
2222
  }
2155
2223
  Lang.objToArray = objToArray;
2156
2224
  /**
2157
- * equalsIgnoreCase, case insensitive comparison of two strings
2225
+ * equalsIgnoreCase, case-insensitive comparison of two strings
2158
2226
  *
2159
2227
  * @param source
2160
2228
  * @param destination
@@ -2177,7 +2245,7 @@ var Lang;
2177
2245
  }
2178
2246
  Lang.assertType = assertType;
2179
2247
  /**
2180
- * Backported from dojo
2248
+ * Back ported from Dojo
2181
2249
  * a failsafe string determination method
2182
2250
  * (since in javascript String != "" typeof alone fails!)
2183
2251
  * @param it {|Object|} the object to be checked for being a string
@@ -2189,6 +2257,10 @@ var Lang;
2189
2257
  return !!arguments.length && it != null && (typeof it == "string" || it instanceof String); // Boolean
2190
2258
  }
2191
2259
  Lang.isString = isString;
2260
+ /**
2261
+ * Back-ported, a failsafe determination code for checking whether an object is a function
2262
+ * @param it the object to check for being a function
2263
+ */
2192
2264
  function isFunc(it) {
2193
2265
  return it instanceof Function || typeof it === "function";
2194
2266
  }
@@ -2244,17 +2316,16 @@ var Lang;
2244
2316
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2245
2317
  exports.Config = exports.CONFIG_ANY = exports.CONFIG_VALUE = exports.ValueEmbedder = exports.Optional = exports.Monad = void 0;
2246
2318
  /**
2247
- * A module which keeps basic monadish like definitions in place without any sidedependencies to other modules.
2319
+ * A module which keeps basic monad like definitions in place
2248
2320
  * Useful if you need the functions in another library to keep its dependencies down
2249
2321
  */
2250
2322
  /*IMonad definitions*/
2251
2323
  const Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
2252
- const SourcesCollectors_1 = __webpack_require__(/*! ./SourcesCollectors */ "./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts");
2253
- const Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
2324
+ const Es2019Array_1 = __webpack_require__(/*! ./Es2019Array */ "./node_modules/mona-dish/src/main/typescript/Es2019Array.ts");
2254
2325
  var objAssign = Lang_1.Lang.objAssign;
2255
2326
  /**
2256
2327
  * Implementation of a monad
2257
- * (Sideffect free), no write allowed directly on the monads
2328
+ * (Side - effect free), no write allowed directly on the monads
2258
2329
  * value state
2259
2330
  */
2260
2331
  class Monad {
@@ -2266,7 +2337,7 @@ class Monad {
2266
2337
  }
2267
2338
  map(fn) {
2268
2339
  if (!fn) {
2269
- fn = (inval) => inval;
2340
+ fn = (inVal) => inVal;
2270
2341
  }
2271
2342
  let result = fn(this.value);
2272
2343
  return new Monad(result);
@@ -2283,7 +2354,7 @@ exports.Monad = Monad;
2283
2354
  /**
2284
2355
  * optional implementation, an optional is basically an implementation of a Monad with additional syntactic
2285
2356
  * sugar on top
2286
- * (Sideeffect free, since value assignment is not allowed)
2357
+ * (Side - effect free, since value assignment is not allowed)
2287
2358
  * */
2288
2359
  class Optional extends Monad {
2289
2360
  constructor(value) {
@@ -2343,8 +2414,8 @@ class Optional extends Monad {
2343
2414
  }
2344
2415
  }
2345
2416
  /*
2346
- * we need to implement it to fullfill the contract, although it is used only internally
2347
- * all values are flattened when accessed anyway, so there is no need to call this methiod
2417
+ * we need to implement it to fulfill the contract, although it is used only internally
2418
+ * all values are flattened when accessed anyway, so there is no need to call this method
2348
2419
  */
2349
2420
  flatMap(fn) {
2350
2421
  let val = super.flatMap(fn);
@@ -2355,7 +2426,7 @@ class Optional extends Monad {
2355
2426
  }
2356
2427
  /*
2357
2428
  * elvis operation, take care, if you use this you lose typesafety and refactoring
2358
- * capabilites, unfortunately typesceript does not allow to have its own elvis operator
2429
+ * capabilities, unfortunately typescript does not allow to have its own elvis operator
2359
2430
  * this is some syntactic sugar however which is quite useful*/
2360
2431
  getIf(...key) {
2361
2432
  key = this.preprocessKeys(...key);
@@ -2390,8 +2461,7 @@ class Optional extends Monad {
2390
2461
  currentPos = this.getClass().fromNullable(currentPos.value[arrPos]);
2391
2462
  }
2392
2463
  }
2393
- let retVal = currentPos;
2394
- return retVal;
2464
+ return currentPos;
2395
2465
  }
2396
2466
  /**
2397
2467
  * simple match, if the first order function call returns
@@ -2427,7 +2497,7 @@ class Optional extends Monad {
2427
2497
  * by having a getClass operation we can avoid direct calls into the constructor or
2428
2498
  * static methods and do not have to implement several methods which rely on the type
2429
2499
  * of "this"
2430
- * @returns {Monadish.Optional}
2500
+ * @returns the type of Optional
2431
2501
  */
2432
2502
  getClass() {
2433
2503
  return Optional;
@@ -2488,9 +2558,9 @@ class Optional extends Monad {
2488
2558
  }
2489
2559
  }
2490
2560
  preprocessKeys(...keys) {
2491
- return Stream_1.Stream.of(...keys)
2561
+ return new Es2019Array_1.Es2019Array(...keys)
2492
2562
  .flatMap(item => {
2493
- return Stream_1.Stream.of(...item.split(/\]\s*\[/gi))
2563
+ return new Es2019Array_1.Es2019Array(...item.split(/]\s*\[/gi))
2494
2564
  .map(item => {
2495
2565
  item = item.replace(/^\s+|\s+$/g, "");
2496
2566
  if (item.indexOf("[") == -1 && item.indexOf("]") != -1) {
@@ -2501,17 +2571,16 @@ class Optional extends Monad {
2501
2571
  }
2502
2572
  return item;
2503
2573
  });
2504
- })
2505
- .collect(new SourcesCollectors_1.ArrayCollector());
2574
+ });
2506
2575
  }
2507
2576
  }
2508
2577
  exports.Optional = Optional;
2509
2578
  /*default value for absent*/
2510
2579
  Optional.absent = Optional.fromNullable(null);
2511
- // --------------------- From here onwards we break out the sideffects free limits ------------
2580
+ // --------------------- From here onwards we break out the side effect free limits ------------
2512
2581
  /**
2513
2582
  * ValueEmbedder is the writeable version
2514
- * of optional, it basically is a wrappber
2583
+ * of optional, it basically is a wrapper
2515
2584
  * around a construct which has a state
2516
2585
  * and can be written to.
2517
2586
  *
@@ -2551,7 +2620,7 @@ class ValueEmbedder extends Optional {
2551
2620
  * by having a getClass operation we can avoid direct calls into the constructor or
2552
2621
  * static methods and do not have to implement several methods which rely on the type
2553
2622
  * of "this"
2554
- * @returns {Monadish.Optional}
2623
+ * @returns ValueEmbedder
2555
2624
  */
2556
2625
  getClass() {
2557
2626
  return ValueEmbedder;
@@ -2597,12 +2666,11 @@ class ConfigEntry extends ValueEmbedder {
2597
2666
  ConfigEntry.absent = ConfigEntry.fromNullable(null);
2598
2667
  exports.CONFIG_VALUE = "__END_POINT__";
2599
2668
  exports.CONFIG_ANY = "__ANY_POINT__";
2600
- const ALL_VALUES = "*";
2601
2669
  /**
2602
2670
  * Config, basically an optional wrapper for a json structure
2603
- * (not sideeffect free, since we can alter the internal config state
2604
- * without generating a new config), not sure if we should make it sideffect free
2605
- * since this would swallow a lot of performane and ram
2671
+ * (not Side - effect free, since we can alter the internal config state
2672
+ * without generating a new config), not sure if we should make it side - effect free
2673
+ * since this would swallow a lot of performance and ram
2606
2674
  */
2607
2675
  class Config extends Optional {
2608
2676
  constructor(root, configDef) {
@@ -2617,7 +2685,9 @@ class Config extends Optional {
2617
2685
  return this.shallowCopy$();
2618
2686
  }
2619
2687
  shallowCopy$() {
2620
- return new Config(Stream_1.Stream.ofAssoc(this.value).collect(new SourcesCollectors_1.AssocArrayCollector()));
2688
+ let ret = new Config({});
2689
+ ret.shallowMerge(this.value);
2690
+ return ret;
2621
2691
  }
2622
2692
  /**
2623
2693
  * deep copy, copies all config nodes
@@ -2649,7 +2719,7 @@ class Config extends Optional {
2649
2719
  }
2650
2720
  else {
2651
2721
  if (Array.isArray(other.getIf(key).value)) {
2652
- Stream_1.Stream.of(...other.getIf(key).value).each(item => this.append(key).value = item);
2722
+ new Es2019Array_1.Es2019Array(...other.getIf(key).value).forEach(item => this.append(key).value = item);
2653
2723
  }
2654
2724
  else {
2655
2725
  this.append(key).value = other.getIf(key).value;
@@ -2677,7 +2747,6 @@ class Config extends Optional {
2677
2747
  }
2678
2748
  this.assertAccessPath(...accessPath);
2679
2749
  let lastKey = accessPath[accessPath.length - 1];
2680
- let currKey, finalKey = this.keyVal(lastKey);
2681
2750
  let pathExists = this.getIf(...accessPath).isPresent();
2682
2751
  this.buildPath(...accessPath);
2683
2752
  let finalKeyArrPos = this.arrayIndex(lastKey);
@@ -2692,8 +2761,7 @@ class Config extends Optional {
2692
2761
  value.push({});
2693
2762
  }
2694
2763
  finalKeyArrPos = value.length - 1;
2695
- let retVal = new ConfigEntry(accessPath.length == 1 ? this.value : this.getIf.apply(this, accessPath.slice(0, accessPath.length - 1)).value, lastKey, finalKeyArrPos);
2696
- return retVal;
2764
+ return new ConfigEntry(accessPath.length == 1 ? this.value : this.getIf.apply(this, accessPath.slice(0, accessPath.length - 1)).value, lastKey, finalKeyArrPos);
2697
2765
  }
2698
2766
  /**
2699
2767
  * appends to an existing entry (or extends into an array and appends)
@@ -2708,7 +2776,7 @@ class Config extends Optional {
2708
2776
  return this.append(...accessPath);
2709
2777
  }
2710
2778
  /**
2711
- * assings an new value on the given access path
2779
+ * assigns a new value on the given access path
2712
2780
  * @param accessPath
2713
2781
  */
2714
2782
  assign(...accessPath) {
@@ -2719,8 +2787,7 @@ class Config extends Optional {
2719
2787
  this.buildPath(...accessPath);
2720
2788
  let currKey = this.keyVal(accessPath[accessPath.length - 1]);
2721
2789
  let arrPos = this.arrayIndex(accessPath[accessPath.length - 1]);
2722
- let retVal = new ConfigEntry(accessPath.length == 1 ? this.value : this.getIf.apply(this, accessPath.slice(0, accessPath.length - 1)).value, currKey, arrPos);
2723
- return retVal;
2790
+ return new ConfigEntry(accessPath.length == 1 ? this.value : this.getIf.apply(this, accessPath.slice(0, accessPath.length - 1)).value, currKey, arrPos);
2724
2791
  }
2725
2792
  /**
2726
2793
  * assign a value if the condition is set to true, otherwise skip it
@@ -2733,7 +2800,7 @@ class Config extends Optional {
2733
2800
  }
2734
2801
  /**
2735
2802
  * get if the access path is present (get is reserved as getter with a default, on the current path)
2736
- * TODO will be renamed to something more meaningful and deprecated, the name is ambigous
2803
+ * TODO will be renamed to something more meaningful and deprecated, the name is ambiguous
2737
2804
  * @param accessPath the access path
2738
2805
  */
2739
2806
  getIf(...accessPath) {
@@ -2760,12 +2827,6 @@ class Config extends Optional {
2760
2827
  toJson() {
2761
2828
  return JSON.stringify(this.value);
2762
2829
  }
2763
- /**
2764
- * returns the first config level as streeam
2765
- */
2766
- get stream() {
2767
- return Stream_1.Stream.of(...Object.keys(this.value)).map(key => [key, this.value[key]]);
2768
- }
2769
2830
  getClass() {
2770
2831
  return Config;
2771
2832
  }
@@ -2773,55 +2834,56 @@ class Config extends Optional {
2773
2834
  this._value = val;
2774
2835
  }
2775
2836
  /**
2776
- * asserts the access path for a semy typed access
2837
+ * asserts the access path for a semi typed access
2777
2838
  * @param accessPath
2778
2839
  * @private
2779
2840
  */
2780
2841
  assertAccessPath(...accessPath) {
2781
- var _a, _b;
2842
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2782
2843
  accessPath = this.preprocessKeys(...accessPath);
2783
2844
  if (!this.configDef) {
2784
2845
  //untyped
2785
2846
  return;
2786
2847
  }
2787
- let currAccessPos = null;
2788
2848
  const ERR_ACCESS_PATH = "Access Path to config invalid";
2789
- const ABSENT = "__ABSENT__";
2790
- currAccessPos = this.configDef;
2849
+ let currAccessPos = Optional.fromNullable(Object.keys(this.configDef).map(key => {
2850
+ let ret = {};
2851
+ ret[key] = this.configDef[key];
2852
+ return ret;
2853
+ }));
2791
2854
  for (let cnt = 0; cnt < accessPath.length; cnt++) {
2792
2855
  let currKey = this.keyVal(accessPath[cnt]);
2793
2856
  let arrPos = this.arrayIndex(accessPath[cnt]);
2794
2857
  //key index
2795
2858
  if (this.isArray(arrPos)) {
2796
2859
  if (currKey != "") {
2797
- currAccessPos = (Array.isArray(currAccessPos)) ?
2798
- Stream_1.Stream.of(...currAccessPos)
2799
- .filter(item => { var _a; return !!((_a = item === null || item === void 0 ? void 0 : item[currKey]) !== null && _a !== void 0 ? _a : false); })
2800
- .map(item => item === null || item === void 0 ? void 0 : item[currKey]).first() :
2801
- Optional.fromNullable((_a = currAccessPos === null || currAccessPos === void 0 ? void 0 : currAccessPos[currKey]) !== null && _a !== void 0 ? _a : null);
2860
+ currAccessPos = Array.isArray(currAccessPos.value) ?
2861
+ Optional.fromNullable((_b = (_a = new Es2019Array_1.Es2019Array(...currAccessPos.value)
2862
+ .find(item => {
2863
+ var _a;
2864
+ return !!((_a = item === null || item === void 0 ? void 0 : item[currKey]) !== null && _a !== void 0 ? _a : false);
2865
+ })) === null || _a === void 0 ? void 0 : _a[currKey]) === null || _b === void 0 ? void 0 : _b[arrPos]) :
2866
+ Optional.fromNullable((_e = (_d = (_c = currAccessPos.value) === null || _c === void 0 ? void 0 : _c[currKey]) === null || _d === void 0 ? void 0 : _d[arrPos]) !== null && _e !== void 0 ? _e : null);
2802
2867
  }
2803
2868
  else {
2804
- currAccessPos = (Array.isArray(currAccessPos)) ?
2805
- Stream_1.Stream.of(...currAccessPos)
2806
- .filter(item => Array.isArray(item))
2807
- .flatMap(item => Stream_1.Stream.of(...item)).first() : Optional.absent;
2869
+ currAccessPos = (Array.isArray(currAccessPos.value)) ?
2870
+ Optional.fromNullable((_f = currAccessPos.value) === null || _f === void 0 ? void 0 : _f[arrPos]) : Optional.absent;
2808
2871
  }
2809
2872
  //we noe store either the current array or the filtered look ahead to go further
2810
2873
  }
2811
2874
  else {
2812
2875
  //we now have an array and go further with a singular key
2813
- currAccessPos = (Array.isArray(currAccessPos)) ? Stream_1.Stream.of(...currAccessPos)
2814
- .filter(item => { var _a; return !!((_a = item === null || item === void 0 ? void 0 : item[currKey]) !== null && _a !== void 0 ? _a : false); })
2815
- .map(item => item === null || item === void 0 ? void 0 : item[currKey])
2816
- .first() :
2817
- Optional.fromNullable((_b = currAccessPos === null || currAccessPos === void 0 ? void 0 : currAccessPos[currKey]) !== null && _b !== void 0 ? _b : null);
2876
+ currAccessPos = (Array.isArray(currAccessPos.value)) ? Optional.fromNullable((_g = new Es2019Array_1.Es2019Array(...currAccessPos.value)
2877
+ .find(item => {
2878
+ var _a;
2879
+ return !!((_a = item === null || item === void 0 ? void 0 : item[currKey]) !== null && _a !== void 0 ? _a : false);
2880
+ })) === null || _g === void 0 ? void 0 : _g[currKey]) :
2881
+ Optional.fromNullable((_j = (_h = currAccessPos.value) === null || _h === void 0 ? void 0 : _h[currKey]) !== null && _j !== void 0 ? _j : null);
2818
2882
  }
2819
2883
  if (!currAccessPos.isPresent()) {
2820
2884
  throw Error(ERR_ACCESS_PATH);
2821
2885
  }
2822
- currAccessPos = currAccessPos.value;
2823
- //no further testing needed, from this point onwards we are on our own
2824
- if (currAccessPos == exports.CONFIG_ANY) {
2886
+ if (currAccessPos.value == exports.CONFIG_ANY) {
2825
2887
  return;
2826
2888
  }
2827
2889
  }
@@ -2917,17 +2979,17 @@ exports.Config = Config;
2917
2979
  * limitations under the License.
2918
2980
  */
2919
2981
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2920
- exports.QueryFormStringCollector = exports.QueryFormDataCollector = exports.FormDataCollector = exports.ConfigCollector = exports.AssocArrayCollector = exports.Run = exports.ArrayAssocArrayCollector = exports.InverseArrayCollector = exports.ArrayCollector = exports.FlatMapStreamDataSource = exports.MappedStreamDataSource = exports.FilteredStreamDatasource = exports.ArrayStreamDataSource = exports.SequenceDataSource = exports.MultiStreamDatasource = exports.ITERATION_STATUS = void 0;
2921
- const Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
2982
+ exports.ArrayCollector = exports.QueryFormStringCollector = exports.QueryFormDataCollector = exports.FormDataCollector = exports.ConfigCollector = exports.AssocArrayCollector = exports.Run = exports.ArrayAssocArrayCollector = exports.InverseArrayCollector = exports.ShimArrayCollector = exports.MappedStreamDataSource = exports.FilteredStreamDatasource = exports.ArrayStreamDataSource = exports.SequenceDataSource = exports.MultiStreamDatasource = exports.calculateSkips = exports.ITERATION_STATUS = void 0;
2922
2983
  const Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
2984
+ const Es2019Array_1 = __webpack_require__(/*! ./Es2019Array */ "./node_modules/mona-dish/src/main/typescript/Es2019Array.ts");
2923
2985
  /**
2924
2986
  * special status of the datasource location pointer
2925
- * if an access, outside of the possible data boundaries is happening
2987
+ * if an access, outside - of the possible data boundaries is happening
2926
2988
  * (example for instance current without a first next call, or next
2927
2989
  * which goes over the last possible dataset), an iteration status return
2928
2990
  * value is returned marking this boundary instead of a classical element
2929
2991
  *
2930
- * Note this is only internally used but must be implemented to fullfill
2992
+ * Note this is only internally used but must be implemented to fulfill
2931
2993
  * internal contracts, the end user will never see those values if he uses
2932
2994
  * streams!
2933
2995
  */
@@ -2943,6 +3005,11 @@ function calculateSkips(next_strm) {
2943
3005
  }
2944
3006
  return --pos;
2945
3007
  }
3008
+ exports.calculateSkips = calculateSkips;
3009
+ /**
3010
+ * A data source which combines multiple streams sequentially into one
3011
+ * (this is used internally by flatmap, but also can be used externally)
3012
+ */
2946
3013
  class MultiStreamDatasource {
2947
3014
  constructor(first, ...strms) {
2948
3015
  this.first = first;
@@ -3044,7 +3111,7 @@ class SequenceDataSource {
3044
3111
  }
3045
3112
  exports.SequenceDataSource = SequenceDataSource;
3046
3113
  /**
3047
- * implementation of iteratable on top of array
3114
+ * implementation of a datasource on top of a standard array
3048
3115
  */
3049
3116
  class ArrayStreamDataSource {
3050
3117
  constructor(...value) {
@@ -3131,6 +3198,15 @@ class FilteredStreamDatasource {
3131
3198
  this._current = found;
3132
3199
  return found;
3133
3200
  }
3201
+ /**
3202
+ * looks ahead cnt without changing the internal data "pointers" of the data source
3203
+ * (this is mostly needed by LazyStreams, because they do not know by definition their
3204
+ * boundaries)
3205
+ *
3206
+ * @param cnt the elements to look ahead
3207
+ * @return either the element or ITERATION_STATUS.EO_STRM if we hit the end of the stream before
3208
+ * finding the "cnt" element
3209
+ */
3134
3210
  lookAhead(cnt = 1) {
3135
3211
  var _a;
3136
3212
  let lookupVal;
@@ -3181,105 +3257,13 @@ class MappedStreamDataSource {
3181
3257
  }
3182
3258
  }
3183
3259
  exports.MappedStreamDataSource = MappedStreamDataSource;
3184
- /**
3185
- * Same for flatmap to deal with element -> stream mappings
3186
- */
3187
- class FlatMapStreamDataSource {
3188
- constructor(func, parent) {
3189
- this.walkedDataSources = [];
3190
- this._currPos = 0;
3191
- this.mapFunc = func;
3192
- this.inputDataSource = parent;
3193
- }
3194
- hasNext() {
3195
- return this.resolveActiveHasNext() || this.resolveNextHasNext();
3196
- }
3197
- resolveActiveHasNext() {
3198
- let next = false;
3199
- if (this.activeDataSource) {
3200
- next = this.activeDataSource.hasNext();
3201
- }
3202
- return next;
3203
- }
3204
- lookAhead(cnt = 1) {
3205
- var _a;
3206
- let lookAhead = (_a = this === null || this === void 0 ? void 0 : this.activeDataSource) === null || _a === void 0 ? void 0 : _a.lookAhead(cnt);
3207
- if ((this === null || this === void 0 ? void 0 : this.activeDataSource) && lookAhead != ITERATION_STATUS.EO_STRM) {
3208
- //this should cover 95% of all cases
3209
- return lookAhead;
3210
- }
3211
- if (this.activeDataSource) {
3212
- cnt -= calculateSkips(this.activeDataSource);
3213
- }
3214
- //the idea is basically to look into the streams sub-sequentially for a match
3215
- //after each stream we have to take into consideration that the skipCnt is
3216
- //reduced by the number of datasets we already have looked into in the previous stream/datasource
3217
- //unfortunately for now we have to loop into them, so we introduce a small o2 here
3218
- for (let dsLoop = 1; true; dsLoop++) {
3219
- let datasourceData = this.inputDataSource.lookAhead(dsLoop);
3220
- //we have looped out
3221
- //no embedded data anymore? we are done, data
3222
- //can either be a scalar an array or another datasource
3223
- if (datasourceData === ITERATION_STATUS.EO_STRM) {
3224
- return ITERATION_STATUS.EO_STRM;
3225
- }
3226
- let mappedData = this.mapFunc(datasourceData);
3227
- //it either comes in as datasource or as array
3228
- //both cases must be unified into a datasource
3229
- let currentDataSource = this.toDatasource(mappedData);
3230
- //we now run again a lookahead
3231
- let ret = currentDataSource.lookAhead(cnt);
3232
- //if the value is found then we are set
3233
- if (ret != ITERATION_STATUS.EO_STRM) {
3234
- return ret;
3235
- }
3236
- //reduce the next lookahead by the number of elements
3237
- //we are now skipping in the current data source
3238
- cnt -= calculateSkips(currentDataSource);
3239
- }
3240
- }
3241
- toDatasource(mapped) {
3242
- let ds = Array.isArray(mapped) ? new ArrayStreamDataSource(...mapped) : mapped;
3243
- this.walkedDataSources.push(ds);
3244
- return ds;
3245
- }
3246
- resolveNextHasNext() {
3247
- let next = false;
3248
- while (!next && this.inputDataSource.hasNext()) {
3249
- let mapped = this.mapFunc(this.inputDataSource.next());
3250
- this.activeDataSource = this.toDatasource(mapped);
3251
- next = this.activeDataSource.hasNext();
3252
- }
3253
- return next;
3254
- }
3255
- next() {
3256
- if (this.hasNext()) {
3257
- this._currPos++;
3258
- return this.activeDataSource.next();
3259
- }
3260
- }
3261
- reset() {
3262
- this.inputDataSource.reset();
3263
- this.walkedDataSources.forEach(ds => ds.reset());
3264
- this.walkedDataSources = [];
3265
- this._currPos = 0;
3266
- this.activeDataSource = null;
3267
- }
3268
- current() {
3269
- if (!this.activeDataSource) {
3270
- this.hasNext();
3271
- }
3272
- return this.activeDataSource.current();
3273
- }
3274
- }
3275
- exports.FlatMapStreamDataSource = FlatMapStreamDataSource;
3276
3260
  /**
3277
3261
  * For the time being we only need one collector
3278
3262
  * a collector which collects a stream back into arrays
3279
3263
  */
3280
- class ArrayCollector {
3264
+ class ShimArrayCollector {
3281
3265
  constructor() {
3282
- this.data = [];
3266
+ this.data = new Es2019Array_1.Es2019Array(...[]);
3283
3267
  }
3284
3268
  collect(element) {
3285
3269
  this.data.push(element);
@@ -3288,7 +3272,7 @@ class ArrayCollector {
3288
3272
  return this.data;
3289
3273
  }
3290
3274
  }
3291
- exports.ArrayCollector = ArrayCollector;
3275
+ exports.ShimArrayCollector = ShimArrayCollector;
3292
3276
  /**
3293
3277
  * collects the values as inverse array
3294
3278
  */
@@ -3398,462 +3382,28 @@ class QueryFormStringCollector {
3398
3382
  }
3399
3383
  }
3400
3384
  get finalValue() {
3401
- return Stream_1.Stream.of(...this.formData)
3385
+ return new Es2019Array_1.Es2019Array(...this.formData)
3402
3386
  .map(keyVal => keyVal.join("="))
3403
- .reduce((item1, item2) => [item1, item2].join("&"))
3404
- .orElse("").value;
3387
+ .reduce((item1, item2) => [item1, item2].join("&"));
3405
3388
  }
3406
3389
  }
3407
3390
  exports.QueryFormStringCollector = QueryFormStringCollector;
3408
-
3409
-
3410
- /***/ }),
3411
-
3412
- /***/ "./node_modules/mona-dish/src/main/typescript/Stream.ts":
3413
- /*!**************************************************************!*\
3414
- !*** ./node_modules/mona-dish/src/main/typescript/Stream.ts ***!
3415
- \**************************************************************/
3416
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3417
-
3418
-
3419
- /*!
3420
- * Licensed to the Apache Software Foundation (ASF) under one or more
3421
- * contributor license agreements. See the NOTICE file distributed with
3422
- * this work for additional information regarding copyright ownership.
3423
- * The ASF licenses this file to you under the Apache License, Version 2.0
3424
- * (the "License"); you may not use this file except in compliance with
3425
- * the License. You may obtain a copy of the License at
3426
- *
3427
- * http://www.apache.org/licenses/LICENSE-2.0
3428
- *
3429
- * Unless required by applicable law or agreed to in writing, software
3430
- * distributed under the License is distributed on an "AS IS" BASIS,
3431
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3432
- * See the License for the specific language governing permissions and
3433
- * limitations under the License.
3434
- */
3435
- Object.defineProperty(exports, "__esModule", ({ value: true }));
3436
- exports.LazyStream = exports.Stream = void 0;
3437
- /*
3438
- * A small stream implementation
3439
- */
3440
- const Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
3441
- const SourcesCollectors_1 = __webpack_require__(/*! ./SourcesCollectors */ "./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts");
3442
3391
  /**
3443
- * A simple typescript based reimplementation of streams
3444
- *
3445
- * This is the early eval version
3446
- * for a lazy eval version check, LazyStream, which is api compatible
3447
- * to this implementation, however with the benefit of being able
3448
- * to provide infinite data sources and generic data providers, the downside
3449
- * is, it might be a tad slower in some situations
3450
- */
3451
- class Stream {
3452
- constructor(...value) {
3453
- this._limits = -1;
3454
- this.pos = -1;
3455
- this.value = value;
3456
- }
3457
- static of(...data) {
3458
- return new Stream(...data);
3459
- }
3460
- static ofAssoc(data) {
3461
- return this.of(...Object.keys(data)).map(key => [key, data[key]]);
3462
- }
3463
- static ofDataSource(dataSource) {
3464
- let value = [];
3465
- while (dataSource.hasNext()) {
3466
- value.push(dataSource.next());
3467
- }
3468
- return new Stream(...value);
3469
- }
3470
- current() {
3471
- if (this.pos == -1) {
3472
- return SourcesCollectors_1.ITERATION_STATUS.BEF_STRM;
3473
- }
3474
- if (this.pos >= this.value.length) {
3475
- return SourcesCollectors_1.ITERATION_STATUS.EO_STRM;
3476
- }
3477
- return this.value[this.pos];
3478
- }
3479
- limits(end) {
3480
- this._limits = end;
3481
- return this;
3482
- }
3483
- /**
3484
- * concat for streams, so that you can concat two streams together
3485
- * @param toAppend
3486
- */
3487
- concat(...toAppend) {
3488
- let toConcat = [this].concat(toAppend);
3489
- return Stream.of(...toConcat).flatMap(item => item);
3490
- }
3491
- onElem(fn) {
3492
- for (let cnt = 0; cnt < this.value.length && (this._limits == -1 || cnt < this._limits); cnt++) {
3493
- if (fn(this.value[cnt], cnt) === false) {
3494
- break;
3495
- }
3496
- }
3497
- return this;
3498
- }
3499
- each(fn) {
3500
- this.onElem(fn);
3501
- this.reset();
3502
- }
3503
- map(fn) {
3504
- if (!fn) {
3505
- fn = (inval) => inval;
3506
- }
3507
- let res = [];
3508
- this.each((item) => {
3509
- res.push(fn(item));
3510
- });
3511
- return new Stream(...res);
3512
- }
3513
- /*
3514
- * we need to implement it to fullfill the contract, although it is used only internally
3515
- * all values are flattened when accessed anyway, so there is no need to call this methiod
3516
- */
3517
- flatMap(fn) {
3518
- let ret = [];
3519
- this.each(item => {
3520
- let strmR = fn(item);
3521
- ret = Array.isArray(strmR) ? ret.concat(strmR) : ret.concat(strmR.value);
3522
- });
3523
- return Stream.of(...ret);
3524
- }
3525
- filter(fn) {
3526
- let res = [];
3527
- this.each((data) => {
3528
- if (fn(data)) {
3529
- res.push(data);
3530
- }
3531
- });
3532
- return new Stream(...res);
3533
- }
3534
- reduce(fn, startVal = null) {
3535
- let offset = startVal != null ? 0 : 1;
3536
- let val1 = startVal != null ? startVal : this.value.length ? this.value[0] : null;
3537
- for (let cnt = offset; cnt < this.value.length && (this._limits == -1 || cnt < this._limits); cnt++) {
3538
- val1 = fn(val1, this.value[cnt]);
3539
- }
3540
- this.reset();
3541
- return Monad_1.Optional.fromNullable(val1);
3542
- }
3543
- first() {
3544
- this.reset();
3545
- return this.value && this.value.length ? Monad_1.Optional.fromNullable(this.value[0]) : Monad_1.Optional.absent;
3546
- }
3547
- last() {
3548
- //could be done via reduce, but is faster this way
3549
- let length = this._limits > 0 ? Math.min(this._limits, this.value.length) : this.value.length;
3550
- this.reset();
3551
- return Monad_1.Optional.fromNullable(length ? this.value[length - 1] : null);
3552
- }
3553
- anyMatch(fn) {
3554
- for (let cnt = 0; cnt < this.value.length && (this._limits == -1 || cnt < this._limits); cnt++) {
3555
- if (fn(this.value[cnt])) {
3556
- return true;
3557
- }
3558
- }
3559
- this.reset();
3560
- return false;
3561
- }
3562
- allMatch(fn) {
3563
- if (!this.value.length) {
3564
- return false;
3565
- }
3566
- let matches = 0;
3567
- for (let cnt = 0; cnt < this.value.length; cnt++) {
3568
- if (fn(this.value[cnt])) {
3569
- matches++;
3570
- }
3571
- }
3572
- this.reset();
3573
- return matches == this.value.length;
3574
- }
3575
- noneMatch(fn) {
3576
- let matches = 0;
3577
- for (let cnt = 0; cnt < this.value.length; cnt++) {
3578
- if (!fn(this.value[cnt])) {
3579
- matches++;
3580
- }
3581
- }
3582
- this.reset();
3583
- return matches == this.value.length;
3584
- }
3585
- sort(comparator) {
3586
- let newArr = this.value.slice().sort(comparator);
3587
- return Stream.of(...newArr);
3588
- }
3589
- collect(collector) {
3590
- this.each(data => collector.collect(data));
3591
- this.reset();
3592
- return collector.finalValue;
3593
- }
3594
- //-- internally exposed methods needed for the interconnectivity
3595
- hasNext() {
3596
- let isLimitsReached = this._limits != -1 && this.pos >= this._limits - 1;
3597
- let isEndOfArray = this.pos >= this.value.length - 1;
3598
- return !(isLimitsReached || isEndOfArray);
3599
- }
3600
- next() {
3601
- if (!this.hasNext()) {
3602
- return null;
3603
- }
3604
- this.pos++;
3605
- return this.value[this.pos];
3606
- }
3607
- lookAhead(cnt = 1) {
3608
- if ((this.pos + cnt) >= this.value.length) {
3609
- return SourcesCollectors_1.ITERATION_STATUS.EO_STRM;
3610
- }
3611
- return this.value[this.pos + cnt];
3612
- }
3613
- [Symbol.iterator]() {
3614
- return {
3615
- next: () => {
3616
- let done = !this.hasNext();
3617
- let val = this.next();
3618
- return {
3619
- done: done,
3620
- value: val
3621
- };
3622
- }
3623
- };
3624
- }
3625
- /*get observable(): Observable<T> {
3626
- return from(this);
3627
- }*/
3628
- reset() {
3629
- this.pos = -1;
3630
- }
3631
- }
3632
- exports.Stream = Stream;
3633
- /**
3634
- * Lazy implementation of a Stream
3635
- * The idea is to connect the intermediate
3636
- * streams as datasources like a linked list
3637
- * with reverse referencing and for special
3638
- * operations like filtering flatmapping
3639
- * have intermediate datasources in the list
3640
- * with specialized functions.
3641
- *
3642
- * Sort of a modified pipe valve pattern
3643
- * the streams are the pipes the intermediate
3644
- * data sources are the valves
3645
- *
3646
- * We then can use passed in functions to control
3647
- * the flow in the valves
3648
- *
3649
- * That way we can have a lazy evaluating stream
3650
- *
3651
- * So if an endpoint requests data
3652
- * a callback trace goes back the stream list
3653
- * which triggers an operation upwards
3654
- * which sends data down the drain which then is processed
3655
- * and filtered until one element hits the endpoint.
3656
- *
3657
- * That is repeated, until all elements are processed
3658
- * or an internal limit is hit.
3659
- *
3392
+ * For the time being we only need one collector
3393
+ * a collector which collects a stream back into arrays
3660
3394
  */
3661
- class LazyStream {
3662
- static of(...values) {
3663
- return new LazyStream(new SourcesCollectors_1.ArrayStreamDataSource(...values));
3664
- }
3665
- static ofAssoc(data) {
3666
- return this.of(...Object.keys(data)).map(key => [key, data[key]]);
3667
- }
3668
- static ofStreamDataSource(value) {
3669
- return new LazyStream(value);
3670
- }
3671
- constructor(parent) {
3672
- this._limits = -1;
3673
- /*
3674
- * needed to have the limits check working
3675
- * we need to keep track of the current position
3676
- * in the stream
3677
- */
3678
- this.pos = -1;
3679
- this.dataSource = parent;
3680
- }
3681
- hasNext() {
3682
- if (this.isOverLimits()) {
3683
- return false;
3684
- }
3685
- return this.dataSource.hasNext();
3686
- }
3687
- next() {
3688
- let next = this.dataSource.next();
3689
- // @ts-ignore
3690
- this.pos++;
3691
- return next;
3692
- }
3693
- lookAhead(cnt = 1) {
3694
- return this.dataSource.lookAhead(cnt);
3695
- }
3696
- current() {
3697
- return this.dataSource.current();
3698
- }
3699
- reset() {
3700
- this.dataSource.reset();
3701
- this.pos = -1;
3702
- this._limits = -1;
3703
- }
3704
- /**
3705
- * concat for streams, so that you can concat two streams together
3706
- * @param toAppend
3707
- */
3708
- concat(...toAppend) {
3709
- //this.dataSource = new MultiStreamDatasource<T>(this, ... toAppend);
3710
- //return this;
3711
- return LazyStream.ofStreamDataSource(new SourcesCollectors_1.MultiStreamDatasource(this, toAppend));
3712
- //return LazyStream.of(<IStream<T>>this, ...toAppend).flatMap(item => item);
3713
- }
3714
- nextFilter(fn) {
3715
- if (this.hasNext()) {
3716
- let newVal = this.next();
3717
- if (!fn(newVal)) {
3718
- return this.nextFilter(fn);
3719
- }
3720
- return newVal;
3721
- }
3722
- return null;
3723
- }
3724
- limits(max) {
3725
- this._limits = max;
3726
- return this;
3727
- }
3728
- //main stream methods
3729
- collect(collector) {
3730
- while (this.hasNext()) {
3731
- let t = this.next();
3732
- collector.collect(t);
3733
- }
3734
- this.reset();
3735
- return collector.finalValue;
3736
- }
3737
- onElem(fn) {
3738
- return new LazyStream(new SourcesCollectors_1.MappedStreamDataSource((el) => {
3739
- if (fn(el, this.pos) === false) {
3740
- this.stop();
3741
- }
3742
- return el;
3743
- }, this));
3744
- }
3745
- filter(fn) {
3746
- return new LazyStream(new SourcesCollectors_1.FilteredStreamDatasource(fn, this));
3747
- }
3748
- map(fn) {
3749
- return new LazyStream(new SourcesCollectors_1.MappedStreamDataSource(fn, this));
3750
- }
3751
- flatMap(fn) {
3752
- return new LazyStream(new SourcesCollectors_1.FlatMapStreamDataSource(fn, this));
3753
- }
3754
- //endpoint
3755
- each(fn) {
3756
- while (this.hasNext()) {
3757
- if (fn(this.next()) === false) {
3758
- this.stop();
3759
- }
3760
- }
3761
- this.reset();
3762
- }
3763
- reduce(fn, startVal = null) {
3764
- if (!this.hasNext()) {
3765
- return Monad_1.Optional.absent;
3766
- }
3767
- let value1;
3768
- let value2 = null;
3769
- if (startVal != null) {
3770
- value1 = startVal;
3771
- value2 = this.next();
3772
- }
3773
- else {
3774
- value1 = this.next();
3775
- if (!this.hasNext()) {
3776
- return Monad_1.Optional.fromNullable(value1);
3777
- }
3778
- value2 = this.next();
3779
- }
3780
- value1 = fn(value1, value2);
3781
- while (this.hasNext()) {
3782
- value2 = this.next();
3783
- value1 = fn(value1, value2);
3784
- }
3785
- this.reset();
3786
- return Monad_1.Optional.fromNullable(value1);
3787
- }
3788
- last() {
3789
- if (!this.hasNext()) {
3790
- return Monad_1.Optional.absent;
3791
- }
3792
- return this.reduce((el1, el2) => el2);
3793
- }
3794
- first() {
3795
- this.reset();
3796
- if (!this.hasNext()) {
3797
- return Monad_1.Optional.absent;
3798
- }
3799
- return Monad_1.Optional.fromNullable(this.next());
3800
- }
3801
- anyMatch(fn) {
3802
- while (this.hasNext()) {
3803
- if (fn(this.next())) {
3804
- return true;
3805
- }
3806
- }
3807
- return false;
3808
- }
3809
- allMatch(fn) {
3810
- while (this.hasNext()) {
3811
- if (!fn(this.next())) {
3812
- return false;
3813
- }
3814
- }
3815
- return true;
3816
- }
3817
- noneMatch(fn) {
3818
- while (this.hasNext()) {
3819
- if (fn(this.next())) {
3820
- return false;
3821
- }
3822
- }
3823
- return true;
3824
- }
3825
- sort(comparator) {
3826
- let arr = this.collect(new SourcesCollectors_1.ArrayCollector());
3827
- arr = arr.sort(comparator);
3828
- return LazyStream.of(...arr);
3829
- }
3830
- get value() {
3831
- return this.collect(new SourcesCollectors_1.ArrayCollector());
3832
- }
3833
- [Symbol.iterator]() {
3834
- return {
3835
- next: () => {
3836
- let done = !this.hasNext();
3837
- let val = this.next();
3838
- return {
3839
- done: done,
3840
- value: val
3841
- };
3842
- }
3843
- };
3395
+ class ArrayCollector {
3396
+ constructor() {
3397
+ this.data = [];
3844
3398
  }
3845
- /*get observable(): Observable<T> {
3846
- return from(this);
3847
- }*/
3848
- stop() {
3849
- this.pos = this._limits + 1000000000;
3850
- this._limits = 0;
3399
+ collect(element) {
3400
+ this.data.push(element);
3851
3401
  }
3852
- isOverLimits() {
3853
- return this._limits != -1 && this.pos >= this._limits - 1;
3402
+ get finalValue() {
3403
+ return this.data;
3854
3404
  }
3855
3405
  }
3856
- exports.LazyStream = LazyStream;
3406
+ exports.ArrayCollector = ArrayCollector;
3857
3407
 
3858
3408
 
3859
3409
  /***/ }),
@@ -3959,7 +3509,7 @@ exports.XQ = XMLQuery;
3959
3509
 
3960
3510
 
3961
3511
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3962
- exports.QueryFormDataCollector = exports.FormDataCollector = exports.AssocArrayCollector = exports.ArrayCollector = exports.QueryFormStringCollector = exports.SequenceDataSource = exports.FlatMapStreamDataSource = exports.FilteredStreamDatasource = exports.MappedStreamDataSource = exports.ArrayStreamDataSource = exports.LazyStream = exports.Stream = exports.XQ = exports.XMLQuery = exports.ValueEmbedder = exports.Optional = exports.Monad = exports.CONFIG_ANY = exports.CONFIG_VALUE = exports.Config = exports.Lang = exports.DQ$ = exports.DQ = exports.DomQueryCollector = exports.ElementAttribute = exports.DomQuery = void 0;
3512
+ exports.XQ = exports.XMLQuery = exports.ValueEmbedder = exports.Optional = exports.Monad = exports.CONFIG_ANY = exports.CONFIG_VALUE = exports.Config = exports.Lang = exports.DQ$ = exports.DQ = exports.DomQueryCollector = exports.ElementAttribute = exports.DomQuery = void 0;
3963
3513
  /*!
3964
3514
  * Licensed to the Apache Software Foundation (ASF) under one
3965
3515
  * or more contributor license agreements. See the NOTICE file
@@ -3996,20 +3546,6 @@ Object.defineProperty(exports, "ValueEmbedder", ({ enumerable: true, get: functi
3996
3546
  var XmlQuery_1 = __webpack_require__(/*! ./XmlQuery */ "./node_modules/mona-dish/src/main/typescript/XmlQuery.ts");
3997
3547
  Object.defineProperty(exports, "XMLQuery", ({ enumerable: true, get: function () { return XmlQuery_1.XMLQuery; } }));
3998
3548
  Object.defineProperty(exports, "XQ", ({ enumerable: true, get: function () { return XmlQuery_1.XQ; } }));
3999
- var Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
4000
- Object.defineProperty(exports, "Stream", ({ enumerable: true, get: function () { return Stream_1.Stream; } }));
4001
- Object.defineProperty(exports, "LazyStream", ({ enumerable: true, get: function () { return Stream_1.LazyStream; } }));
4002
- var SourcesCollectors_1 = __webpack_require__(/*! ./SourcesCollectors */ "./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts");
4003
- Object.defineProperty(exports, "ArrayStreamDataSource", ({ enumerable: true, get: function () { return SourcesCollectors_1.ArrayStreamDataSource; } }));
4004
- Object.defineProperty(exports, "MappedStreamDataSource", ({ enumerable: true, get: function () { return SourcesCollectors_1.MappedStreamDataSource; } }));
4005
- Object.defineProperty(exports, "FilteredStreamDatasource", ({ enumerable: true, get: function () { return SourcesCollectors_1.FilteredStreamDatasource; } }));
4006
- Object.defineProperty(exports, "FlatMapStreamDataSource", ({ enumerable: true, get: function () { return SourcesCollectors_1.FlatMapStreamDataSource; } }));
4007
- Object.defineProperty(exports, "SequenceDataSource", ({ enumerable: true, get: function () { return SourcesCollectors_1.SequenceDataSource; } }));
4008
- Object.defineProperty(exports, "QueryFormStringCollector", ({ enumerable: true, get: function () { return SourcesCollectors_1.QueryFormStringCollector; } }));
4009
- Object.defineProperty(exports, "ArrayCollector", ({ enumerable: true, get: function () { return SourcesCollectors_1.ArrayCollector; } }));
4010
- Object.defineProperty(exports, "AssocArrayCollector", ({ enumerable: true, get: function () { return SourcesCollectors_1.AssocArrayCollector; } }));
4011
- Object.defineProperty(exports, "FormDataCollector", ({ enumerable: true, get: function () { return SourcesCollectors_1.FormDataCollector; } }));
4012
- Object.defineProperty(exports, "QueryFormDataCollector", ({ enumerable: true, get: function () { return SourcesCollectors_1.QueryFormDataCollector; } }));
4013
3549
 
4014
3550
 
4015
3551
  /***/ }),
@@ -4117,7 +3653,7 @@ var faces;
4117
3653
  return AjaxImpl_1.Implementation.getClientWindow(rootNode);
4118
3654
  }
4119
3655
  faces.getClientWindow = getClientWindow;
4120
- //private helper functions
3656
+ // private helper functions
4121
3657
  function getSeparatorChar() {
4122
3658
  const sep = '#{facesContext.namingContainerSeparatorChar}';
4123
3659
  //We now enable standalone mode, the separator char was not mapped we make a fallback to 2.3 behavior
@@ -4131,12 +3667,12 @@ var faces;
4131
3667
  /**
4132
3668
  * this function has to send the ajax requests
4133
3669
  *
4134
- * following requestInternal conditions must be met:
3670
+ * following request conditions must be met:
4135
3671
  * <ul>
4136
- * <li> the requestInternal must be sent asynchronously! </li>
4137
- * <li> the requestInternal must be a POST!!! requestInternal </li>
4138
- * <li> the requestInternal url must be the form action attribute </li>
4139
- * <li> all requests must be queued with a client side requestInternal queue to ensure the requestInternal ordering!</li>
3672
+ * <li> the request must be sent asynchronously! </li>
3673
+ * <li> the request must be a POST!!! request </li>
3674
+ * <li> the request url must be the form action attribute </li>
3675
+ * <li> all requests must be queued with a client side request queue to ensure the request ordering!</li>
4140
3676
  * </ul>
4141
3677
  *
4142
3678
  * @param {String|Node} element: any dom element no matter being it html or jsf, from which the event is emitted
@@ -4152,7 +3688,6 @@ var faces;
4152
3688
  * @param request the request object having triggered this response
4153
3689
  * @param context the request context
4154
3690
  *
4155
- * TODO add info on what can be in the context
4156
3691
  */
4157
3692
  function response(request, context) {
4158
3693
  AjaxImpl_1.Implementation.response(request, context);
@@ -4167,13 +3702,13 @@ var faces;
4167
3702
  * <li> errorData.status : the error status message</li>
4168
3703
  * <li> errorData.serverErrorName : the server error name in case of a server error</li>
4169
3704
  * <li> errorData.serverErrorMessage : the server error message in case of a server error</li>
4170
- * <li> errorData.source : the issuing source element which triggered the requestInternal </li>
4171
- * <li> eventData.responseCode: the response code (aka http requestInternal response code, 401 etc...) </li>
4172
- * <li> eventData.responseText: the requestInternal response text </li>
4173
- * <li> eventData.responseXML: the requestInternal response xml </li>
3705
+ * <li> errorData.source : the issuing source element which triggered the request </li>
3706
+ * <li> eventData.responseCode: the response code (aka http request response code, 401 etc...) </li>
3707
+ * <li> eventData.responseText: the request response text </li>
3708
+ * <li> eventData.responseXML: the request response xml </li>
4174
3709
  * </ul>
4175
3710
  *
4176
- * @param errorListener error handler must be of the format <i>function errorListener(&lt;errorData&gt;)</i>
3711
+ * @param errorFunc error handler must be of the format <i>function errorListener(&lt;errorData&gt;)</i>
4177
3712
  */
4178
3713
  function addOnError(errorFunc) {
4179
3714
  AjaxImpl_1.Implementation.addOnError(errorFunc);
@@ -4183,7 +3718,7 @@ var faces;
4183
3718
  * Adds a global event listener to the ajax event queue. The event listener must be a function
4184
3719
  * of following format: <i>function eventListener(&lt;eventData&gt;)</i>
4185
3720
  *
4186
- * @param eventListener event must be of the format <i>function eventListener(&lt;eventData&gt;)</i>
3721
+ * @param eventFunc event must be of the format <i>function eventListener(&lt;eventData&gt;)</i>
4187
3722
  */
4188
3723
  function addOnEvent(eventFunc) {
4189
3724
  AjaxImpl_1.Implementation.addOnEvent(eventFunc);
@@ -4198,7 +3733,7 @@ var faces;
4198
3733
  * if any of the code returns false, the execution
4199
3734
  * is terminated prematurely skipping the rest of the code!
4200
3735
  *
4201
- * @param {DomNode} source, the callee object
3736
+ * @param {HTMLElement | String} source, the callee object
4202
3737
  * @param {Event} event, the event object of the callee event triggering this function
4203
3738
  * @param funcs ... arbitrary array of functions or strings
4204
3739
  * @returns true if the chain has succeeded false otherwise
@@ -4227,7 +3762,7 @@ var faces;
4227
3762
  push.init = init;
4228
3763
  /**
4229
3764
  * Open the web socket on the given channel.
4230
- * @param channel The name of the web socket channel.
3765
+ * @param socketClientId The name of the web socket channel.
4231
3766
  * @throws Error is thrown, if the channel is unknown.
4232
3767
  */
4233
3768
  function open(socketClientId) {
@@ -4236,7 +3771,7 @@ var faces;
4236
3771
  push.open = open;
4237
3772
  /**
4238
3773
  * Close the web socket on the given channel.
4239
- * @param channel The name of the web socket channel.
3774
+ * @param socketClientId The id of the web socket client.
4240
3775
  * @throws Error is thrown, if the channel is unknown.
4241
3776
  */
4242
3777
  function close(socketClientId) {
@@ -4256,8 +3791,8 @@ var myfaces;
4256
3791
  * @param event the event
4257
3792
  * @param eventName event name for java.jakarta.faces.behavior.evemnt
4258
3793
  * @param execute execute list as passed down in faces.ajax.request
4259
- * @param render
4260
- * @param options
3794
+ * @param render the render list as string
3795
+ * @param options the options which need to be mered in
4261
3796
  */
4262
3797
  function ab(source, event, eventName, execute, render, options = {}) {
4263
3798
  var _a, _b;
@@ -4274,6 +3809,42 @@ var myfaces;
4274
3809
  ((_b = window === null || window === void 0 ? void 0 : window.faces) !== null && _b !== void 0 ? _b : window.jsf).ajax.request(source, event, options);
4275
3810
  }
4276
3811
  myfaces.ab = ab;
3812
+ const onReadyChain = [];
3813
+ let readyStateListener = null;
3814
+ // noinspection JSUnusedGlobalSymbols
3815
+ /**
3816
+ * Helper function in the myfaces namespace to handle document ready properly for the load case
3817
+ * the ajax case, does not need proper treatment, since it is deferred anyway.
3818
+ * Used by command script as helper function!
3819
+ *
3820
+ * @param executionFunc the function to be executed upon ready
3821
+ */
3822
+ function onOnDomReady(executionFunc) {
3823
+ if (document.readyState !== "complete") {
3824
+ onReadyChain.push(executionFunc);
3825
+ if (!readyStateListener) {
3826
+ readyStateListener = () => {
3827
+ window.removeEventListener("DOMContentLoaded", readyStateListener);
3828
+ readyStateListener = null;
3829
+ try {
3830
+ onReadyChain.forEach(func => func());
3831
+ }
3832
+ finally {
3833
+ //done we clear now the ready chain
3834
+ onReadyChain.length = 0;
3835
+ }
3836
+ };
3837
+ window.addEventListener("DOMContentLoaded", readyStateListener);
3838
+ }
3839
+ }
3840
+ else {
3841
+ if (readyStateListener) {
3842
+ readyStateListener();
3843
+ }
3844
+ executionFunc();
3845
+ }
3846
+ }
3847
+ myfaces.onOnDomReady = onOnDomReady;
4277
3848
  /**
4278
3849
  * legacy oam functions
4279
3850
  */
@@ -4367,11 +3938,15 @@ var Implementation;
4367
3938
  a) Monad like structures for querying because this keeps the code denser and adds abstractions
4368
3939
  that always was the strong point of jquery and it still is better in this regard than what ecmascript provides
4369
3940
 
4370
- b) Streams and lazystreams like java has, a pull like construct, ecmascript does not have anything like Lazystreams.
3941
+ b) Streams and lazy streams like java has, a pull stream construct, ecmascript does not have anything like it.
3942
+ (it has array filters and maps, but ES2015 does not support flatMap)
4371
3943
  Another option would have been rxjs but that would have introduced a code dependency and probably more code. We might
4372
- move to RXJS if the need arises however. But for now I would rather stick with my small self grown library which works
3944
+ move to RXJS if the need arises, however. But for now I would rather stick with my small self grown library which works
4373
3945
  quite well and where I can patch quickly (I have used it in several industrial projects, so it works well
4374
3946
  and is heavily fortified by unit tests (140 testcases as time of writing this))
3947
+ The long term plan is to eliminate the Stream usage as soon as we can move up to ES2019 (adding the missing
3948
+ functions as shims, is a no go, because we are a library, and absolutey do not Shim anything which can leak
3949
+ into the global namespace!)
4375
3950
 
4376
3951
  c) A neutral json like configuration which allows assignments of arbitrary values with reduce code which then can be
4377
3952
  transformed into different data representations
@@ -4439,7 +4014,7 @@ var Implementation;
4439
4014
  /**
4440
4015
  * @return the project stage also emitted by the server:
4441
4016
  * it cannot be cached and must be delivered over the server
4442
- * The value for it comes from the requestInternal parameter of the faces.js script called "stage".
4017
+ * The value for it comes from the request parameter of the faces.js script called "stage".
4443
4018
  */
4444
4019
  function getProjectStage() {
4445
4020
  var _a, _b, _c;
@@ -4453,7 +4028,7 @@ var Implementation;
4453
4028
  function resolveProjectStateFromURL() {
4454
4029
  /* run through all script tags and try to find the one that includes faces.js */
4455
4030
  const foundStage = ExtDomQuery_1.ExtDomQuery.searchJsfJsFor(/stage=([^&;]*)/).value;
4456
- return (foundStage in ProjectStages) ? foundStage : null;
4031
+ return (foundStage in ProjectStages) ? foundStage : ProjectStages.Production; // MYFACES-4572: default is production
4457
4032
  }
4458
4033
  Implementation.resolveProjectStateFromURL = resolveProjectStateFromURL;
4459
4034
  /**