jsf.js_next_gen 4.0.0 → 4.0.1-beta.1

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 (34) hide show
  1. package/README.md +0 -5
  2. package/dist/docs/index.html +0 -5
  3. package/dist/window/faces-development.js +727 -311
  4. package/dist/window/faces-development.js.br +0 -0
  5. package/dist/window/faces-development.js.gz +0 -0
  6. package/dist/window/faces-development.js.map +1 -1
  7. package/dist/window/faces.js +1 -1
  8. package/dist/window/faces.js.br +0 -0
  9. package/dist/window/faces.js.gz +0 -0
  10. package/dist/window/faces.js.map +1 -1
  11. package/dist/window/jsf-development.js +727 -311
  12. package/dist/window/jsf-development.js.br +0 -0
  13. package/dist/window/jsf-development.js.gz +0 -0
  14. package/dist/window/jsf-development.js.map +1 -1
  15. package/dist/window/jsf.js +1 -1
  16. package/dist/window/jsf.js.br +0 -0
  17. package/dist/window/jsf.js.gz +0 -0
  18. package/dist/window/jsf.js.map +1 -1
  19. package/package.json +2 -2
  20. package/src/main/typescript/impl/AjaxImpl.ts +26 -9
  21. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +2 -2
  22. package/src/main/typescript/test/xhrCore/ClientWindow.spec.ts +78 -0
  23. package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +5 -5
  24. package/target/impl/AjaxImpl.js +21 -6
  25. package/target/impl/AjaxImpl.js.map +1 -1
  26. package/target/impl/util/IAsyncRunnable.js +27 -0
  27. package/target/impl/util/IAsyncRunnable.js.map +1 -0
  28. package/target/impl/util/XhrQueueController.js +33 -8
  29. package/target/impl/util/XhrQueueController.js.map +1 -1
  30. package/target/test/frameworkBase/_ext/shared/StandardInits.js +2 -2
  31. package/target/test/xhrCore/ClientWindow.spec.js +90 -0
  32. package/target/test/xhrCore/ClientWindow.spec.js.map +1 -0
  33. package/target/test/xhrCore/TobagoFileUploadTest.spec.js +5 -5
  34. package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +1 -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");
40
41
  const SourcesCollectors_1 = __webpack_require__(/*! ./SourcesCollectors */ "./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts");
41
42
  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");
44
43
  var trim = Lang_1.Lang.trim;
45
44
  var isString = Lang_1.Lang.isString;
46
45
  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,12 +271,6 @@ 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
- }
280
274
  /**
281
275
  * returns the id of the first element
282
276
  */
@@ -353,7 +347,7 @@ class DomQuery {
353
347
  this.id.value = value;
354
348
  }
355
349
  get checked() {
356
- return new Es2019Array_1.Es2019Array(...this.values).every(el => !!el.checked);
350
+ return Stream_1.Stream.of(...this.values).allMatch(el => !!el.checked);
357
351
  }
358
352
  set checked(newChecked) {
359
353
  this.eachElem(el => el.checked = newChecked);
@@ -411,41 +405,58 @@ class DomQuery {
411
405
  });
412
406
  return new DomQuery(...childNodeArr);
413
407
  }
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
+ }
414
425
  get asArray() {
415
426
  // filter not supported by IE11
416
- let items = new Es2019Array_1.Es2019Array(...this.rootNode).filter(item => {
427
+ return [].concat(Stream_1.LazyStream.of(...this.rootNode).filter(item => {
417
428
  return item != null;
418
- }).map(item => {
429
+ })
430
+ .map(item => {
419
431
  return DomQuery.byId(item);
420
- });
421
- return items;
432
+ }).collect(new SourcesCollectors_1.ArrayCollector()));
422
433
  }
423
434
  get offsetWidth() {
424
- return new Es2019Array_1.Es2019Array(...this.rootNode)
435
+ return Stream_1.LazyStream.of(...this.rootNode)
425
436
  .filter(item => item != null)
426
437
  .map(elem => elem.offsetWidth)
427
- .reduce((accumulate, incoming) => accumulate + incoming, 0);
438
+ .reduce((accumulate, incoming) => accumulate + incoming, 0).value;
428
439
  }
429
440
  get offsetHeight() {
430
- return new Es2019Array_1.Es2019Array(...this.rootNode)
441
+ return Stream_1.LazyStream.of(...this.rootNode)
431
442
  .filter(item => item != null)
432
443
  .map(elem => elem.offsetHeight)
433
- .reduce((accumulate, incoming) => accumulate + incoming, 0);
444
+ .reduce((accumulate, incoming) => accumulate + incoming, 0).value;
434
445
  }
435
446
  get offsetLeft() {
436
- return new Es2019Array_1.Es2019Array(...this.rootNode)
447
+ return Stream_1.LazyStream.of(...this.rootNode)
437
448
  .filter(item => item != null)
438
449
  .map(elem => elem.offsetLeft)
439
- .reduce((accumulate, incoming) => accumulate + incoming, 0);
450
+ .reduce((accumulate, incoming) => accumulate + incoming, 0).value;
440
451
  }
441
452
  get offsetTop() {
442
- return new Es2019Array_1.Es2019Array(this.rootNode)
453
+ return Stream_1.LazyStream.of(...this.rootNode)
443
454
  .filter(item => item != null)
444
455
  .map(elem => elem.offsetTop)
445
- .reduce((accumulate, incoming) => accumulate + incoming, 0);
456
+ .reduce((accumulate, incoming) => accumulate + incoming, 0).value;
446
457
  }
447
458
  get asNodeArray() {
448
- return new Es2019Array_1.Es2019Array(...this.rootNode.filter(item => item != null));
459
+ return [].concat(Stream_1.Stream.of(...this.rootNode).filter(item => item != null).collect(new SourcesCollectors_1.ArrayCollector()));
449
460
  }
450
461
  static querySelectorAllDeep(selector) {
451
462
  return new DomQuery(document).querySelectorAllDeep(selector);
@@ -509,10 +520,10 @@ class DomQuery {
509
520
  const doc = document.implementation.createHTMLDocument("");
510
521
  markup = trim(markup);
511
522
  let lowerMarkup = markup.toLowerCase();
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) {
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) {
516
527
  doc.documentElement.innerHTML = markup;
517
528
  return new DomQuery(doc.documentElement);
518
529
  }
@@ -644,9 +655,10 @@ class DomQuery {
644
655
  byId(id, includeRoot) {
645
656
  let res = [];
646
657
  if (includeRoot) {
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)));
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()));
650
662
  }
651
663
  // for some strange kind of reason the # selector fails
652
664
  // on hidden elements we use the attributes match selector
@@ -657,9 +669,10 @@ class DomQuery {
657
669
  byIdDeep(id, includeRoot) {
658
670
  let res = [];
659
671
  if (includeRoot) {
660
- res = res.concat(new Es2019Array_1.Es2019Array(...((this === null || this === void 0 ? void 0 : this.rootNode) || []))
672
+ res = res.concat(Stream_1.LazyStream.of(...((this === null || this === void 0 ? void 0 : this.rootNode) || []))
661
673
  .filter(item => id == item.id)
662
- .map(item => new DomQuery(item)));
674
+ .map(item => new DomQuery(item))
675
+ .collect(new SourcesCollectors_1.ArrayCollector()));
663
676
  }
664
677
  let subItems = this.querySelectorAllDeep(`[id="${id}"]`);
665
678
  if (subItems.length) {
@@ -677,9 +690,10 @@ class DomQuery {
677
690
  var _a;
678
691
  let res = [];
679
692
  if (includeRoot) {
680
- res = new Es2019Array_1.Es2019Array(...((_a = this === null || this === void 0 ? void 0 : this.rootNode) !== null && _a !== void 0 ? _a : []))
693
+ res = Stream_1.LazyStream.of(...((_a = this === null || this === void 0 ? void 0 : this.rootNode) !== null && _a !== void 0 ? _a : []))
681
694
  .filter(element => (element === null || element === void 0 ? void 0 : element.tagName) == tagName)
682
- .reduce((reduction, item) => reduction.concat([item]), res);
695
+ .reduce((reduction, item) => reduction.concat([item]), res)
696
+ .orElse(res).value;
683
697
  }
684
698
  (deep) ? res.push(this.querySelectorAllDeep(tagName)) : res.push(this.querySelectorAll(tagName));
685
699
  return new DomQuery(...res);
@@ -812,8 +826,11 @@ class DomQuery {
812
826
  * @param selector
813
827
  */
814
828
  matchesSelector(selector) {
815
- return this.asArray
816
- .some(item => this._mozMatchesSelector(item.getAsElem(0).value, 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();
817
834
  }
818
835
  /**
819
836
  * easy node traversal, you can pass
@@ -854,8 +871,8 @@ class DomQuery {
854
871
  return this;
855
872
  }
856
873
  each(func) {
857
- new Es2019Array_1.Es2019Array(...this.rootNode)
858
- .forEach((item, cnt) => {
874
+ Stream_1.Stream.of(...this.rootNode)
875
+ .each((item, cnt) => {
859
876
  // we could use a filter, but for the best performance we don´t
860
877
  if (item == null) {
861
878
  return;
@@ -1207,7 +1224,7 @@ class DomQuery {
1207
1224
  // scripts before we run the 'include' command
1208
1225
  // this.globalEval(finalScripts.join("\n"));
1209
1226
  let joinedScripts = [];
1210
- new Es2019Array_1.Es2019Array(...scriptsToProcess).forEach(item => {
1227
+ Stream_1.Stream.of(...scriptsToProcess).each(item => {
1211
1228
  if (!item.nonce) {
1212
1229
  joinedScripts.push(item.evalText);
1213
1230
  }
@@ -1293,10 +1310,10 @@ class DomQuery {
1293
1310
  try {
1294
1311
  let scriptElements = new DomQuery(this.filterSelector("script"), this.querySelectorAll("script"));
1295
1312
  // script execution order by relative pos in their dom tree
1296
- scriptElements.asArray
1297
- .flatMap(item => [...item.values])
1313
+ scriptElements.stream
1314
+ .flatMap(item => Stream_1.Stream.of(...item.values))
1298
1315
  .sort((node1, node2) => node1.compareDocumentPosition(node2) - 3) // preceding 2, following == 4)
1299
- .forEach(item => execScript(item));
1316
+ .each(item => execScript(item));
1300
1317
  evalCollectedScripts(finalScripts);
1301
1318
  }
1302
1319
  catch (e) {
@@ -1339,20 +1356,19 @@ class DomQuery {
1339
1356
  else if (tagName && eqi(tagName, "style")) {
1340
1357
  let innerText = _toReplace.innerHTML.replace(/\s+/gi, "");
1341
1358
  let styles = head.querySelectorAll("style");
1342
- let filteredStyles = styles.asArray.filter(style => {
1359
+ styles = styles.stream.filter(style => {
1343
1360
  return style.innerHTML.replace(/\s+/gi, "") == innerText;
1344
- });
1345
- styles = new DomQuery(...filteredStyles);
1361
+ }).collect(new DomQueryCollector());
1346
1362
  if (!styles.length) { //already present
1347
1363
  head.append(_toReplace);
1348
1364
  }
1349
1365
  }
1350
1366
  };
1351
1367
  const scriptElements = new DomQuery(this.filterSelector("link, style"), this.querySelectorAll("link, style"));
1352
- scriptElements.asArray
1353
- .flatMap(item => [...item.values])
1368
+ scriptElements.stream
1369
+ .flatMap(item => Stream_1.Stream.of(...item.values))
1354
1370
  .sort((node1, node2) => node1.compareDocumentPosition(node2) - 3)
1355
- .forEach(item => execCss(item));
1371
+ .each(item => execCss(item));
1356
1372
  return this;
1357
1373
  }
1358
1374
  /**
@@ -1375,11 +1391,9 @@ class DomQuery {
1375
1391
  */
1376
1392
  fireEvent(eventName, options = {}) {
1377
1393
  // merge with last one having the highest priority
1378
- let finalOptions = new Monad_1.Config({
1394
+ let finalOptions = Stream_1.Stream.ofAssoc({
1379
1395
  bubbles: true, cancelable: true
1380
- });
1381
- finalOptions.shallowMerge(new Monad_1.Config(options));
1382
- finalOptions = JSON.parse(finalOptions.toJson());
1396
+ }).concat(Stream_1.Stream.ofAssoc(options)).collect(new SourcesCollectors_1.AssocArrayCollector());
1383
1397
  this.eachElem((node) => {
1384
1398
  let doc;
1385
1399
  if (node.ownerDocument) {
@@ -1430,13 +1444,15 @@ class DomQuery {
1430
1444
  // IE-old school style, you can drop this if you don't need to support IE8 and lower
1431
1445
  let event = doc.createEventObject();
1432
1446
  event.synthetic = true; // allow detection of synthetic events
1433
- Object.keys(finalOptions).forEach(key => event[key] = finalOptions[key]);
1447
+ Stream_1.Stream.ofAssoc(finalOptions).each(([key, value]) => {
1448
+ event[key] = value;
1449
+ });
1434
1450
  node.fireEvent("on" + eventName, event);
1435
1451
  }
1436
1452
  });
1437
1453
  }
1438
1454
  textContent(joinString = "") {
1439
- return this.asArray
1455
+ return this.stream
1440
1456
  .map((value) => {
1441
1457
  let item = value.getAsElem(0).orElseLazy(() => {
1442
1458
  return {
@@ -1445,10 +1461,10 @@ class DomQuery {
1445
1461
  }).value;
1446
1462
  return item.textContent || "";
1447
1463
  })
1448
- .reduce((text1, text2) => [text1, joinString, text2].join(""), "");
1464
+ .reduce((text1, text2) => [text1, joinString, text2].join(""), "").value;
1449
1465
  }
1450
1466
  innerText(joinString = "") {
1451
- return this.asArray
1467
+ return this.stream
1452
1468
  .map((value) => {
1453
1469
  let item = value.getAsElem(0).orElseLazy(() => {
1454
1470
  return {
@@ -1457,9 +1473,7 @@ class DomQuery {
1457
1473
  }).value;
1458
1474
  return item.innerText || "";
1459
1475
  })
1460
- .reduce((text1, text2) => {
1461
- return [text1, text2].join(joinString);
1462
- }, "");
1476
+ .reduce((text1, text2) => [text1, text2].join(joinString), "").value;
1463
1477
  }
1464
1478
  /**
1465
1479
  * encodes all input elements properly into respective
@@ -1548,27 +1562,16 @@ class DomQuery {
1548
1562
  }
1549
1563
  get cDATAAsString() {
1550
1564
  let TYPE_CDATA_BLOCK = 4;
1551
- let res = this.asArray
1552
- .flatMap(item => {
1553
- return item.childNodes.asArray;
1554
- })
1555
- .filter(item => {
1565
+ let res = this.lazyStream.flatMap(item => {
1566
+ return item.childNodes.stream;
1567
+ }).filter(item => {
1556
1568
  var _a, _b;
1557
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;
1558
- })
1559
- .reduce((reduced, item) => {
1570
+ }).reduce((reduced, item) => {
1560
1571
  var _a, _b, _c;
1561
1572
  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 : "");
1562
1573
  return reduced;
1563
- }, []);
1564
- /*let res: any = this.lazyStream.flatMap(item => {
1565
- return item.childNodes.stream
1566
- }).filter(item => {
1567
- return item?.value?.value?.nodeType == TYPE_CDATA_BLOCK;
1568
- }).reduce((reduced: Array<any>, item: DomQuery) => {
1569
- reduced.push((<any>item?.value?.value)?.data ?? "");
1570
- return reduced;
1571
- }, []).value;*/
1574
+ }, []).value;
1572
1575
  // response may contain several blocks
1573
1576
  return res.join("");
1574
1577
  }
@@ -1725,18 +1728,17 @@ class DomQuery {
1725
1728
  * @param filterDoubles filter out possible double elements (aka same markup)
1726
1729
  */
1727
1730
  concat(toAttach, filterDoubles = true) {
1728
- let domQueries = this.asArray;
1729
- const ret = new DomQuery(...domQueries.concat(toAttach.asArray));
1731
+ const ret = this.lazyStream.concat(toAttach.lazyStream).collect(new DomQueryCollector());
1730
1732
  // we now filter the doubles out
1731
1733
  if (!filterDoubles) {
1732
1734
  return ret;
1733
1735
  }
1734
1736
  let idx = {}; // ie11 does not support sets, we have to fake it
1735
- return new DomQuery(...ret.asArray.filter(node => {
1737
+ return ret.lazyStream.filter(node => {
1736
1738
  const notFound = !(idx === null || idx === void 0 ? void 0 : idx[node.value.value.outerHTML]);
1737
1739
  idx[node.value.value.outerHTML] = true;
1738
1740
  return notFound;
1739
- }));
1741
+ }).collect(new DomQueryCollector());
1740
1742
  }
1741
1743
  append(elem) {
1742
1744
  this.each(item => elem.appendTo(item));
@@ -1771,7 +1773,7 @@ class DomQuery {
1771
1773
  continue;
1772
1774
  }
1773
1775
  let res = this.rootNode[cnt].querySelectorAll(selector);
1774
- nodes = nodes.concat(...objToArray(res));
1776
+ nodes = nodes.concat(objToArray(res));
1775
1777
  }
1776
1778
  return new DomQuery(...nodes);
1777
1779
  }
@@ -1986,132 +1988,6 @@ exports.DQ = DomQuery;
1986
1988
  exports.DQ$ = DomQuery.querySelectorAll;
1987
1989
 
1988
1990
 
1989
- /***/ }),
1990
-
1991
- /***/ "./node_modules/mona-dish/src/main/typescript/Es2019Array.ts":
1992
- /*!*******************************************************************!*\
1993
- !*** ./node_modules/mona-dish/src/main/typescript/Es2019Array.ts ***!
1994
- \*******************************************************************/
1995
- /***/ ((__unused_webpack_module, exports) => {
1996
-
1997
-
1998
- /**
1999
- * Extended array
2000
- */
2001
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2002
- exports.Es2019Array = exports._Es2019Array = void 0;
2003
- /**
2004
- * Extended array which adds various es 2019 shim functions to the normal array
2005
- * We must remap all array producing functions in order to keep
2006
- * the delegation active, once we are in!
2007
- */
2008
- class Es2019Array_ extends Array {
2009
- constructor(...another) {
2010
- super(...another);
2011
- if (another._another) {
2012
- this._another = another._another;
2013
- }
2014
- else {
2015
- this._another = another;
2016
- }
2017
- //for testing it definitely runs into this branch because we are on es5 level
2018
- //if (!(<any>Array.prototype).flatMap) {
2019
- this.flatMap = (flatMapFun) => this._flatMap(flatMapFun);
2020
- //}
2021
- //if (!(<any>Array.prototype).flat) {
2022
- this.flat = (flatLevel = 1) => this._flat(flatLevel);
2023
- //}
2024
- }
2025
- map(callbackfn, thisArg) {
2026
- const ret = Array.prototype.map.call(this._another, callbackfn, thisArg);
2027
- return new _Es2019Array(...ret);
2028
- }
2029
- concat(...items) {
2030
- const ret = Array.prototype.concat.call(this._another, ...items);
2031
- return new _Es2019Array(...ret);
2032
- }
2033
- reverse() {
2034
- const ret = Array.prototype.reverse.call(this._another);
2035
- return new _Es2019Array(...ret);
2036
- }
2037
- slice(start, end) {
2038
- const ret = Array.prototype.slice.call(this._another, start, end);
2039
- return new _Es2019Array(...ret);
2040
- }
2041
- splice(start, deleteCount) {
2042
- const ret = Array.prototype.splice.call(this._another, start, deleteCount);
2043
- return new _Es2019Array(...ret);
2044
- }
2045
- filter(predicate, thisArg) {
2046
- const ret = Array.prototype.filter.call(this._another, predicate, thisArg);
2047
- return new _Es2019Array(...ret);
2048
- }
2049
- reduce(callbackfn, initialValue) {
2050
- const ret = Array.prototype.reduce.call(this._another, callbackfn, initialValue);
2051
- return ret;
2052
- }
2053
- /*reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T {
2054
- const ret = Array.prototype.reduceRight.call(callbackfn, initialValue);
2055
- return ret;
2056
- }*/
2057
- _flat(flatDepth = 1) {
2058
- return this._flatResolve(this._another, flatDepth);
2059
- }
2060
- _flatResolve(arr, flatDepth = 1) {
2061
- //recursion break
2062
- if (flatDepth == 0) {
2063
- return arr;
2064
- }
2065
- let res = [];
2066
- let reFlat = item => {
2067
- item = Array.isArray(item) ? item : [item];
2068
- let mapped = this._flatResolve(item, flatDepth - 1);
2069
- res = res.concat(mapped);
2070
- };
2071
- arr.forEach(reFlat);
2072
- return new exports.Es2019Array(...res);
2073
- }
2074
- _flatMap(mapperFunction) {
2075
- let res = this.map(item => mapperFunction(item));
2076
- return this._flatResolve(res);
2077
- }
2078
- }
2079
- //let _Es2019Array = function<T>(...data: T[]) {};
2080
- //let oldProto = Es2019Array.prototype;
2081
- function _Es2019Array(...data) {
2082
- let ret = new Es2019Array_(...data);
2083
- let proxied = new Proxy(ret, {
2084
- get(target, p, receiver) {
2085
- if ("symbol" == typeof p) {
2086
- return target._another[p];
2087
- }
2088
- if (!isNaN(parseInt(p))) {
2089
- return target._another[p];
2090
- }
2091
- else {
2092
- return target[p];
2093
- }
2094
- },
2095
- set(target, property, value) {
2096
- target[property] = value;
2097
- target._another[property] = value;
2098
- return true;
2099
- }
2100
- });
2101
- return proxied;
2102
- }
2103
- exports._Es2019Array = _Es2019Array;
2104
- ;
2105
- /**
2106
- * this is the switch between normal array and our shim
2107
- * the shim is only provided in case the native browser
2108
- * does not yet have flatMap support on arrays
2109
- */
2110
- exports.Es2019Array = (Array.prototype.flatMap) ? function (...data) {
2111
- return data;
2112
- } : _Es2019Array;
2113
-
2114
-
2115
1991
  /***/ }),
2116
1992
 
2117
1993
  /***/ "./node_modules/mona-dish/src/main/typescript/Global.ts":
@@ -2187,7 +2063,6 @@ exports._global$ = _global$;
2187
2063
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2188
2064
  exports.Lang = void 0;
2189
2065
  const Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
2190
- const Es2019Array_1 = __webpack_require__(/*! ./Es2019Array */ "./node_modules/mona-dish/src/main/typescript/Es2019Array.ts");
2191
2066
  /**
2192
2067
  * Lang helpers crossported from the apache myfaces project
2193
2068
  */
@@ -2195,7 +2070,7 @@ var Lang;
2195
2070
  (function (Lang) {
2196
2071
  //should be in lang, but for now here to avoid recursive imports, not sure if typescript still has a problem with those
2197
2072
  /**
2198
- * helper function to safely resolve anything
2073
+ * helper function to savely resolve anything
2199
2074
  * this is not an elvis operator, it resolves
2200
2075
  * a value without exception in a tree and if
2201
2076
  * it is not resolvable then an optional of
@@ -2221,12 +2096,6 @@ var Lang;
2221
2096
  }
2222
2097
  }
2223
2098
  Lang.saveResolve = saveResolve;
2224
- /**
2225
- * lazy resolve... aka the function is called on resolve and a default value also
2226
- * is a producing function (called only if the original producer does not produce any result)
2227
- * @param resolverProducer the producer for the resolve
2228
- * @param defaultValue the default value producer function
2229
- */
2230
2099
  function saveResolveLazy(resolverProducer, defaultValue = null) {
2231
2100
  try {
2232
2101
  let result = resolverProducer();
@@ -2281,11 +2150,11 @@ var Lang;
2281
2150
  //special condition array delivered no offset no pack
2282
2151
  if (obj instanceof Array && !offset && !pack)
2283
2152
  return obj;
2284
- return new Es2019Array_1.Es2019Array(...pack.concat(Array.prototype.slice.call(obj, offset)));
2153
+ return pack.concat(Array.prototype.slice.call(obj, offset));
2285
2154
  }
2286
2155
  Lang.objToArray = objToArray;
2287
2156
  /**
2288
- * equalsIgnoreCase, case-insensitive comparison of two strings
2157
+ * equalsIgnoreCase, case insensitive comparison of two strings
2289
2158
  *
2290
2159
  * @param source
2291
2160
  * @param destination
@@ -2308,7 +2177,7 @@ var Lang;
2308
2177
  }
2309
2178
  Lang.assertType = assertType;
2310
2179
  /**
2311
- * Back ported from Dojo
2180
+ * Backported from dojo
2312
2181
  * a failsafe string determination method
2313
2182
  * (since in javascript String != "" typeof alone fails!)
2314
2183
  * @param it {|Object|} the object to be checked for being a string
@@ -2320,10 +2189,6 @@ var Lang;
2320
2189
  return !!arguments.length && it != null && (typeof it == "string" || it instanceof String); // Boolean
2321
2190
  }
2322
2191
  Lang.isString = isString;
2323
- /**
2324
- * Back-ported, a failsafe determination code for checking whether an object is a function
2325
- * @param it the object to check for being a function
2326
- */
2327
2192
  function isFunc(it) {
2328
2193
  return it instanceof Function || typeof it === "function";
2329
2194
  }
@@ -2379,16 +2244,17 @@ var Lang;
2379
2244
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2380
2245
  exports.Config = exports.CONFIG_ANY = exports.CONFIG_VALUE = exports.ValueEmbedder = exports.Optional = exports.Monad = void 0;
2381
2246
  /**
2382
- * A module which keeps basic monad like definitions in place
2247
+ * A module which keeps basic monadish like definitions in place without any sidedependencies to other modules.
2383
2248
  * Useful if you need the functions in another library to keep its dependencies down
2384
2249
  */
2385
2250
  /*IMonad definitions*/
2386
2251
  const Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
2387
- const Es2019Array_1 = __webpack_require__(/*! ./Es2019Array */ "./node_modules/mona-dish/src/main/typescript/Es2019Array.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");
2388
2254
  var objAssign = Lang_1.Lang.objAssign;
2389
2255
  /**
2390
2256
  * Implementation of a monad
2391
- * (Side - effect free), no write allowed directly on the monads
2257
+ * (Sideffect free), no write allowed directly on the monads
2392
2258
  * value state
2393
2259
  */
2394
2260
  class Monad {
@@ -2400,7 +2266,7 @@ class Monad {
2400
2266
  }
2401
2267
  map(fn) {
2402
2268
  if (!fn) {
2403
- fn = (inVal) => inVal;
2269
+ fn = (inval) => inval;
2404
2270
  }
2405
2271
  let result = fn(this.value);
2406
2272
  return new Monad(result);
@@ -2417,7 +2283,7 @@ exports.Monad = Monad;
2417
2283
  /**
2418
2284
  * optional implementation, an optional is basically an implementation of a Monad with additional syntactic
2419
2285
  * sugar on top
2420
- * (Side - effect free, since value assignment is not allowed)
2286
+ * (Sideeffect free, since value assignment is not allowed)
2421
2287
  * */
2422
2288
  class Optional extends Monad {
2423
2289
  constructor(value) {
@@ -2477,8 +2343,8 @@ class Optional extends Monad {
2477
2343
  }
2478
2344
  }
2479
2345
  /*
2480
- * we need to implement it to fulfill the contract, although it is used only internally
2481
- * all values are flattened when accessed anyway, so there is no need to call this method
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
2482
2348
  */
2483
2349
  flatMap(fn) {
2484
2350
  let val = super.flatMap(fn);
@@ -2489,7 +2355,7 @@ class Optional extends Monad {
2489
2355
  }
2490
2356
  /*
2491
2357
  * elvis operation, take care, if you use this you lose typesafety and refactoring
2492
- * capabilities, unfortunately typescript does not allow to have its own elvis operator
2358
+ * capabilites, unfortunately typesceript does not allow to have its own elvis operator
2493
2359
  * this is some syntactic sugar however which is quite useful*/
2494
2360
  getIf(...key) {
2495
2361
  key = this.preprocessKeys(...key);
@@ -2524,7 +2390,8 @@ class Optional extends Monad {
2524
2390
  currentPos = this.getClass().fromNullable(currentPos.value[arrPos]);
2525
2391
  }
2526
2392
  }
2527
- return currentPos;
2393
+ let retVal = currentPos;
2394
+ return retVal;
2528
2395
  }
2529
2396
  /**
2530
2397
  * simple match, if the first order function call returns
@@ -2560,7 +2427,7 @@ class Optional extends Monad {
2560
2427
  * by having a getClass operation we can avoid direct calls into the constructor or
2561
2428
  * static methods and do not have to implement several methods which rely on the type
2562
2429
  * of "this"
2563
- * @returns the type of Optional
2430
+ * @returns {Monadish.Optional}
2564
2431
  */
2565
2432
  getClass() {
2566
2433
  return Optional;
@@ -2621,9 +2488,9 @@ class Optional extends Monad {
2621
2488
  }
2622
2489
  }
2623
2490
  preprocessKeys(...keys) {
2624
- return new Es2019Array_1.Es2019Array(...keys)
2491
+ return Stream_1.Stream.of(...keys)
2625
2492
  .flatMap(item => {
2626
- return new Es2019Array_1.Es2019Array(...item.split(/]\s*\[/gi))
2493
+ return Stream_1.Stream.of(...item.split(/\]\s*\[/gi))
2627
2494
  .map(item => {
2628
2495
  item = item.replace(/^\s+|\s+$/g, "");
2629
2496
  if (item.indexOf("[") == -1 && item.indexOf("]") != -1) {
@@ -2634,16 +2501,17 @@ class Optional extends Monad {
2634
2501
  }
2635
2502
  return item;
2636
2503
  });
2637
- });
2504
+ })
2505
+ .collect(new SourcesCollectors_1.ArrayCollector());
2638
2506
  }
2639
2507
  }
2640
2508
  exports.Optional = Optional;
2641
2509
  /*default value for absent*/
2642
2510
  Optional.absent = Optional.fromNullable(null);
2643
- // --------------------- From here onwards we break out the side effect free limits ------------
2511
+ // --------------------- From here onwards we break out the sideffects free limits ------------
2644
2512
  /**
2645
2513
  * ValueEmbedder is the writeable version
2646
- * of optional, it basically is a wrapper
2514
+ * of optional, it basically is a wrappber
2647
2515
  * around a construct which has a state
2648
2516
  * and can be written to.
2649
2517
  *
@@ -2683,7 +2551,7 @@ class ValueEmbedder extends Optional {
2683
2551
  * by having a getClass operation we can avoid direct calls into the constructor or
2684
2552
  * static methods and do not have to implement several methods which rely on the type
2685
2553
  * of "this"
2686
- * @returns ValueEmbedder
2554
+ * @returns {Monadish.Optional}
2687
2555
  */
2688
2556
  getClass() {
2689
2557
  return ValueEmbedder;
@@ -2729,11 +2597,12 @@ class ConfigEntry extends ValueEmbedder {
2729
2597
  ConfigEntry.absent = ConfigEntry.fromNullable(null);
2730
2598
  exports.CONFIG_VALUE = "__END_POINT__";
2731
2599
  exports.CONFIG_ANY = "__ANY_POINT__";
2600
+ const ALL_VALUES = "*";
2732
2601
  /**
2733
2602
  * Config, basically an optional wrapper for a json structure
2734
- * (not Side - effect free, since we can alter the internal config state
2735
- * without generating a new config), not sure if we should make it side - effect free
2736
- * since this would swallow a lot of performance and ram
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
2737
2606
  */
2738
2607
  class Config extends Optional {
2739
2608
  constructor(root, configDef) {
@@ -2748,9 +2617,7 @@ class Config extends Optional {
2748
2617
  return this.shallowCopy$();
2749
2618
  }
2750
2619
  shallowCopy$() {
2751
- let ret = new Config({});
2752
- ret.shallowMerge(this.value);
2753
- return ret;
2620
+ return new Config(Stream_1.Stream.ofAssoc(this.value).collect(new SourcesCollectors_1.AssocArrayCollector()));
2754
2621
  }
2755
2622
  /**
2756
2623
  * deep copy, copies all config nodes
@@ -2782,7 +2649,7 @@ class Config extends Optional {
2782
2649
  }
2783
2650
  else {
2784
2651
  if (Array.isArray(other.getIf(key).value)) {
2785
- new Es2019Array_1.Es2019Array(...other.getIf(key).value).forEach(item => this.append(key).value = item);
2652
+ Stream_1.Stream.of(...other.getIf(key).value).each(item => this.append(key).value = item);
2786
2653
  }
2787
2654
  else {
2788
2655
  this.append(key).value = other.getIf(key).value;
@@ -2810,6 +2677,7 @@ class Config extends Optional {
2810
2677
  }
2811
2678
  this.assertAccessPath(...accessPath);
2812
2679
  let lastKey = accessPath[accessPath.length - 1];
2680
+ let currKey, finalKey = this.keyVal(lastKey);
2813
2681
  let pathExists = this.getIf(...accessPath).isPresent();
2814
2682
  this.buildPath(...accessPath);
2815
2683
  let finalKeyArrPos = this.arrayIndex(lastKey);
@@ -2824,7 +2692,8 @@ class Config extends Optional {
2824
2692
  value.push({});
2825
2693
  }
2826
2694
  finalKeyArrPos = value.length - 1;
2827
- return new ConfigEntry(accessPath.length == 1 ? this.value : this.getIf.apply(this, accessPath.slice(0, accessPath.length - 1)).value, lastKey, finalKeyArrPos);
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;
2828
2697
  }
2829
2698
  /**
2830
2699
  * appends to an existing entry (or extends into an array and appends)
@@ -2839,7 +2708,7 @@ class Config extends Optional {
2839
2708
  return this.append(...accessPath);
2840
2709
  }
2841
2710
  /**
2842
- * assigns a new value on the given access path
2711
+ * assings an new value on the given access path
2843
2712
  * @param accessPath
2844
2713
  */
2845
2714
  assign(...accessPath) {
@@ -2850,7 +2719,8 @@ class Config extends Optional {
2850
2719
  this.buildPath(...accessPath);
2851
2720
  let currKey = this.keyVal(accessPath[accessPath.length - 1]);
2852
2721
  let arrPos = this.arrayIndex(accessPath[accessPath.length - 1]);
2853
- return new ConfigEntry(accessPath.length == 1 ? this.value : this.getIf.apply(this, accessPath.slice(0, accessPath.length - 1)).value, currKey, arrPos);
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;
2854
2724
  }
2855
2725
  /**
2856
2726
  * assign a value if the condition is set to true, otherwise skip it
@@ -2863,7 +2733,7 @@ class Config extends Optional {
2863
2733
  }
2864
2734
  /**
2865
2735
  * get if the access path is present (get is reserved as getter with a default, on the current path)
2866
- * TODO will be renamed to something more meaningful and deprecated, the name is ambiguous
2736
+ * TODO will be renamed to something more meaningful and deprecated, the name is ambigous
2867
2737
  * @param accessPath the access path
2868
2738
  */
2869
2739
  getIf(...accessPath) {
@@ -2890,6 +2760,12 @@ class Config extends Optional {
2890
2760
  toJson() {
2891
2761
  return JSON.stringify(this.value);
2892
2762
  }
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
+ }
2893
2769
  getClass() {
2894
2770
  return Config;
2895
2771
  }
@@ -2897,56 +2773,55 @@ class Config extends Optional {
2897
2773
  this._value = val;
2898
2774
  }
2899
2775
  /**
2900
- * asserts the access path for a semi typed access
2776
+ * asserts the access path for a semy typed access
2901
2777
  * @param accessPath
2902
2778
  * @private
2903
2779
  */
2904
2780
  assertAccessPath(...accessPath) {
2905
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2781
+ var _a, _b;
2906
2782
  accessPath = this.preprocessKeys(...accessPath);
2907
2783
  if (!this.configDef) {
2908
2784
  //untyped
2909
2785
  return;
2910
2786
  }
2787
+ let currAccessPos = null;
2911
2788
  const ERR_ACCESS_PATH = "Access Path to config invalid";
2912
- let currAccessPos = Optional.fromNullable(Object.keys(this.configDef).map(key => {
2913
- let ret = {};
2914
- ret[key] = this.configDef[key];
2915
- return ret;
2916
- }));
2789
+ const ABSENT = "__ABSENT__";
2790
+ currAccessPos = this.configDef;
2917
2791
  for (let cnt = 0; cnt < accessPath.length; cnt++) {
2918
2792
  let currKey = this.keyVal(accessPath[cnt]);
2919
2793
  let arrPos = this.arrayIndex(accessPath[cnt]);
2920
2794
  //key index
2921
2795
  if (this.isArray(arrPos)) {
2922
2796
  if (currKey != "") {
2923
- currAccessPos = Array.isArray(currAccessPos.value) ?
2924
- Optional.fromNullable((_b = (_a = new Es2019Array_1.Es2019Array(...currAccessPos.value)
2925
- .find(item => {
2926
- var _a;
2927
- return !!((_a = item === null || item === void 0 ? void 0 : item[currKey]) !== null && _a !== void 0 ? _a : false);
2928
- })) === null || _a === void 0 ? void 0 : _a[currKey]) === null || _b === void 0 ? void 0 : _b[arrPos]) :
2929
- 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);
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);
2930
2802
  }
2931
2803
  else {
2932
- currAccessPos = (Array.isArray(currAccessPos.value)) ?
2933
- Optional.fromNullable((_f = currAccessPos.value) === null || _f === void 0 ? void 0 : _f[arrPos]) : Optional.absent;
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;
2934
2808
  }
2935
2809
  //we noe store either the current array or the filtered look ahead to go further
2936
2810
  }
2937
2811
  else {
2938
2812
  //we now have an array and go further with a singular key
2939
- currAccessPos = (Array.isArray(currAccessPos.value)) ? Optional.fromNullable((_g = new Es2019Array_1.Es2019Array(...currAccessPos.value)
2940
- .find(item => {
2941
- var _a;
2942
- return !!((_a = item === null || item === void 0 ? void 0 : item[currKey]) !== null && _a !== void 0 ? _a : false);
2943
- })) === null || _g === void 0 ? void 0 : _g[currKey]) :
2944
- Optional.fromNullable((_j = (_h = currAccessPos.value) === null || _h === void 0 ? void 0 : _h[currKey]) !== null && _j !== void 0 ? _j : null);
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);
2945
2818
  }
2946
2819
  if (!currAccessPos.isPresent()) {
2947
2820
  throw Error(ERR_ACCESS_PATH);
2948
2821
  }
2949
- if (currAccessPos.value == exports.CONFIG_ANY) {
2822
+ currAccessPos = currAccessPos.value;
2823
+ //no further testing needed, from this point onwards we are on our own
2824
+ if (currAccessPos == exports.CONFIG_ANY) {
2950
2825
  return;
2951
2826
  }
2952
2827
  }
@@ -3042,17 +2917,17 @@ exports.Config = Config;
3042
2917
  * limitations under the License.
3043
2918
  */
3044
2919
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3045
- 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;
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");
3046
2922
  const Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
3047
- const Es2019Array_1 = __webpack_require__(/*! ./Es2019Array */ "./node_modules/mona-dish/src/main/typescript/Es2019Array.ts");
3048
2923
  /**
3049
2924
  * special status of the datasource location pointer
3050
- * if an access, outside - of the possible data boundaries is happening
2925
+ * if an access, outside of the possible data boundaries is happening
3051
2926
  * (example for instance current without a first next call, or next
3052
2927
  * which goes over the last possible dataset), an iteration status return
3053
2928
  * value is returned marking this boundary instead of a classical element
3054
2929
  *
3055
- * Note this is only internally used but must be implemented to fulfill
2930
+ * Note this is only internally used but must be implemented to fullfill
3056
2931
  * internal contracts, the end user will never see those values if he uses
3057
2932
  * streams!
3058
2933
  */
@@ -3068,11 +2943,6 @@ function calculateSkips(next_strm) {
3068
2943
  }
3069
2944
  return --pos;
3070
2945
  }
3071
- exports.calculateSkips = calculateSkips;
3072
- /**
3073
- * A data source which combines multiple streams sequentially into one
3074
- * (this is used internally by flatmap, but also can be used externally)
3075
- */
3076
2946
  class MultiStreamDatasource {
3077
2947
  constructor(first, ...strms) {
3078
2948
  this.first = first;
@@ -3174,7 +3044,7 @@ class SequenceDataSource {
3174
3044
  }
3175
3045
  exports.SequenceDataSource = SequenceDataSource;
3176
3046
  /**
3177
- * implementation of a datasource on top of a standard array
3047
+ * implementation of iteratable on top of array
3178
3048
  */
3179
3049
  class ArrayStreamDataSource {
3180
3050
  constructor(...value) {
@@ -3261,15 +3131,6 @@ class FilteredStreamDatasource {
3261
3131
  this._current = found;
3262
3132
  return found;
3263
3133
  }
3264
- /**
3265
- * looks ahead cnt without changing the internal data "pointers" of the data source
3266
- * (this is mostly needed by LazyStreams, because they do not know by definition their
3267
- * boundaries)
3268
- *
3269
- * @param cnt the elements to look ahead
3270
- * @return either the element or ITERATION_STATUS.EO_STRM if we hit the end of the stream before
3271
- * finding the "cnt" element
3272
- */
3273
3134
  lookAhead(cnt = 1) {
3274
3135
  var _a;
3275
3136
  let lookupVal;
@@ -3320,13 +3181,105 @@ class MappedStreamDataSource {
3320
3181
  }
3321
3182
  }
3322
3183
  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;
3323
3276
  /**
3324
3277
  * For the time being we only need one collector
3325
3278
  * a collector which collects a stream back into arrays
3326
3279
  */
3327
- class ShimArrayCollector {
3280
+ class ArrayCollector {
3328
3281
  constructor() {
3329
- this.data = new Es2019Array_1.Es2019Array(...[]);
3282
+ this.data = [];
3330
3283
  }
3331
3284
  collect(element) {
3332
3285
  this.data.push(element);
@@ -3335,7 +3288,7 @@ class ShimArrayCollector {
3335
3288
  return this.data;
3336
3289
  }
3337
3290
  }
3338
- exports.ShimArrayCollector = ShimArrayCollector;
3291
+ exports.ArrayCollector = ArrayCollector;
3339
3292
  /**
3340
3293
  * collects the values as inverse array
3341
3294
  */
@@ -3445,28 +3398,462 @@ class QueryFormStringCollector {
3445
3398
  }
3446
3399
  }
3447
3400
  get finalValue() {
3448
- return new Es2019Array_1.Es2019Array(...this.formData)
3401
+ return Stream_1.Stream.of(...this.formData)
3449
3402
  .map(keyVal => keyVal.join("="))
3450
- .reduce((item1, item2) => [item1, item2].join("&"));
3403
+ .reduce((item1, item2) => [item1, item2].join("&"))
3404
+ .orElse("").value;
3451
3405
  }
3452
3406
  }
3453
3407
  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");
3454
3442
  /**
3455
- * For the time being we only need one collector
3456
- * a collector which collects a stream back into arrays
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
3457
3450
  */
3458
- class ArrayCollector {
3459
- constructor() {
3460
- this.data = [];
3451
+ class Stream {
3452
+ constructor(...value) {
3453
+ this._limits = -1;
3454
+ this.pos = -1;
3455
+ this.value = value;
3461
3456
  }
3462
- collect(element) {
3463
- this.data.push(element);
3457
+ static of(...data) {
3458
+ return new Stream(...data);
3464
3459
  }
3465
- get finalValue() {
3466
- return this.data;
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;
3467
3630
  }
3468
3631
  }
3469
- exports.ArrayCollector = ArrayCollector;
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
+ *
3660
+ */
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
+ };
3844
+ }
3845
+ /*get observable(): Observable<T> {
3846
+ return from(this);
3847
+ }*/
3848
+ stop() {
3849
+ this.pos = this._limits + 1000000000;
3850
+ this._limits = 0;
3851
+ }
3852
+ isOverLimits() {
3853
+ return this._limits != -1 && this.pos >= this._limits - 1;
3854
+ }
3855
+ }
3856
+ exports.LazyStream = LazyStream;
3470
3857
 
3471
3858
 
3472
3859
  /***/ }),
@@ -3572,7 +3959,7 @@ exports.XQ = XMLQuery;
3572
3959
 
3573
3960
 
3574
3961
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3575
- 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;
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;
3576
3963
  /*!
3577
3964
  * Licensed to the Apache Software Foundation (ASF) under one
3578
3965
  * or more contributor license agreements. See the NOTICE file
@@ -3609,6 +3996,20 @@ Object.defineProperty(exports, "ValueEmbedder", ({ enumerable: true, get: functi
3609
3996
  var XmlQuery_1 = __webpack_require__(/*! ./XmlQuery */ "./node_modules/mona-dish/src/main/typescript/XmlQuery.ts");
3610
3997
  Object.defineProperty(exports, "XMLQuery", ({ enumerable: true, get: function () { return XmlQuery_1.XMLQuery; } }));
3611
3998
  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; } }));
3612
4013
 
3613
4014
 
3614
4015
  /***/ }),
@@ -4322,11 +4723,26 @@ var Implementation;
4322
4723
  /*
4323
4724
  * the search root for the dom element search
4324
4725
  */
4325
- let searchRoot = new mona_dish_1.DQ(node || document.body).querySelectorAll(`form input [name='${Const_1.P_CLIENT_WINDOW}']`);
4726
+ let searchRoot = ((node) ? mona_dish_1.DQ.byId(node) : (0, mona_dish_1.DQ$)("form"));
4727
+ let inputs = searchRoot
4728
+ .filterSelector(`input[name='${(0, Const_1.$nsp)(Const_1.P_CLIENT_WINDOW)}']`)
4729
+ .orElseLazy(() => searchRoot.querySelectorAll(`input[name='${(0, Const_1.$nsp)(Const_1.P_CLIENT_WINDOW)}']`));
4730
+ /*
4731
+ * lazy helper to fetch the window id from the included faces.js
4732
+ */
4733
+ let fetchWindowIdFromJSFJS = () => ExtDomQuery_1.ExtDomQuery.searchJsfJsFor(/jfwid=([^&;]*)/).orElse(null).value;
4326
4734
  /*
4327
- * lazy helper to fetch the window id from the window url
4735
+ * fetch window id from the url
4328
4736
  */
4329
- let fetchWindowIdFromUrl = () => ExtDomQuery_1.ExtDomQuery.searchJsfJsFor(/jfwid=([^&;]*)/).orElse(null).value;
4737
+ let fetchWindowIdFromURL = function () {
4738
+ const href = window.location.href, windowId = "jfwid";
4739
+ const regex = new RegExp("[\\?&]" + windowId + "=([^&#\\;]*)");
4740
+ const results = regex.exec(href);
4741
+ //initial trial over the url and a regexp
4742
+ if (results != null)
4743
+ return results[1];
4744
+ return null;
4745
+ };
4330
4746
  /*
4331
4747
  * functional double check based on stream reduction
4332
4748
  * the values should be identical or on INIT value which is a premise to
@@ -4349,19 +4765,19 @@ var Implementation;
4349
4765
  *
4350
4766
  * @param item
4351
4767
  */
4352
- let getValue = (item) => item.attr("value").value;
4768
+ let getValue = (item) => item.val;
4353
4769
  /*
4354
4770
  * fetch the window id from the forms
4355
4771
  * window ids must be present in all forms
4356
4772
  * or non-existent. If they exist all of them must be the same
4357
4773
  */
4358
- let formWindowId = searchRoot.stream.map(getValue).reduce(differenceCheck, INIT);
4774
+ let formWindowId = inputs.stream.map(getValue).reduce(differenceCheck, INIT);
4359
4775
  //if the resulting window id is set on altered then we have an unresolvable problem
4360
4776
  assert(ALTERED != formWindowId.value, "Multiple different windowIds found in document");
4361
4777
  /*
4362
4778
  * return the window id or null
4363
4779
  */
4364
- return formWindowId.value != INIT ? formWindowId.value : fetchWindowIdFromUrl();
4780
+ return formWindowId.value != INIT ? formWindowId.value : (fetchWindowIdFromURL() || fetchWindowIdFromJSFJS());
4365
4781
  }
4366
4782
  Implementation.getClientWindow = getClientWindow;
4367
4783
  /**