jsf.js_next_gen 1.0.0-beta-16 → 1.0.0-beta-17

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.
@@ -2699,6 +2699,14 @@ exports.QueryFormStringCollector = exports.QueryFormDataCollector = exports.Form
2699
2699
  var Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
2700
2700
  /**
2701
2701
  * special status of the datasource location pointer
2702
+ * if an access, outside of the possible data boundaries is happening
2703
+ * (example for instance current without a first next call, or next
2704
+ * which goes over the last possible dataset), an iteration status return
2705
+ * value is returned marking this boundary instead of a classical element
2706
+ *
2707
+ * Note this is only internally used but must be implemented to fullfill
2708
+ * internal contracts, the end user will never see those values if he uses
2709
+ * streams!
2702
2710
  */
2703
2711
  var ITERATION_STATUS;
2704
2712
  (function (ITERATION_STATUS) {
@@ -2910,33 +2918,50 @@ var FlatMapStreamDataSource = /** @class */ (function () {
2910
2918
  };
2911
2919
  FlatMapStreamDataSource.prototype.lookAhead = function (cnt) {
2912
2920
  var _a;
2921
+ if (cnt === void 0) { cnt = 1; }
2913
2922
  //easy access trial
2914
2923
  if ((this === null || this === void 0 ? void 0 : this.activeDataSource) && ((_a = this === null || this === void 0 ? void 0 : this.activeDataSource) === null || _a === void 0 ? void 0 : _a.lookAhead(cnt)) != ITERATION_STATUS.EO_STRM) {
2915
2924
  //this should coverr 95% of all accesses
2916
2925
  return this === null || this === void 0 ? void 0 : this.activeDataSource.lookAhead(cnt);
2917
2926
  }
2918
- //slower method we have to look ahead forward one by one until we hit the end or
2919
- //have to move on
2920
- for (var lookAheadPos = 1, topLevelLookAhead = 1; lookAheadPos <= cnt; topLevelLookAhead++) {
2921
- var foundItem = null;
2922
- var item = this.inputDataSource.lookAhead(topLevelLookAhead);
2923
- if (item === ITERATION_STATUS.EO_STRM) {
2924
- return item;
2927
+ /**
2928
+ * we only can determine how many elems datasource has by going up
2929
+ * (for now this suffices, however not ideal, we might have to introduce a numElements or so)
2930
+ * @param datasource
2931
+ */
2932
+ function howManyElems(datasource) {
2933
+ var cnt = 1;
2934
+ while (datasource.lookAhead(cnt) !== ITERATION_STATUS.EO_STRM) {
2935
+ cnt++;
2936
+ }
2937
+ return cnt - 1;
2938
+ }
2939
+ function readjustSkip(dataSource) {
2940
+ var skippedElems = (dataSource) ? howManyElems(dataSource) : 0;
2941
+ cnt = cnt - skippedElems;
2942
+ }
2943
+ if (this.activeDataSource) {
2944
+ readjustSkip(this.activeDataSource);
2945
+ }
2946
+ //the idea is basically to look into the streams subsequentially for a match
2947
+ //after each stream we have to take into consideration that the skipCnt is
2948
+ //reduced by the number of datasets we already have looked into in the previous stream/datasource
2949
+ //unfortunately for now we have to loop into them so we introduce a small o2 here
2950
+ for (var dsLoop = 1; true; dsLoop++) {
2951
+ var currDatasource = this.inputDataSource.lookAhead(dsLoop);
2952
+ //we have looped out
2953
+ if (currDatasource === ITERATION_STATUS.EO_STRM) {
2954
+ return ITERATION_STATUS.EO_STRM;
2925
2955
  }
2926
- var mapped = this.mapFunc(item);
2956
+ var mapped = this.mapFunc(currDatasource);
2927
2957
  //it either comes in as datasource or as array
2928
2958
  var currentDataSource = this.toDatasource(mapped);
2929
- //this is the inner loop which looks ahead on our flatmapped datasource
2930
- //we need an inner counter, but every look ahead also increases our loop
2931
- return currentDataSource.lookAhead(cnt);
2932
- /* for(let flatmapLookAhead = 1; lookAheadPos <= cnt && foundItem != ITERATION_STATUS.EO_STRM; flatmapLookAhead++, lookAheadPos++) {
2933
- foundItem = currentDataSource.lookAhead(flatmapLookAhead);
2934
- if(lookAheadPos >= cnt) {
2935
- return foundItem;
2936
- }
2937
- }*/
2938
- }
2939
- return ITERATION_STATUS.EO_STRM;
2959
+ var ret = currentDataSource.lookAhead(cnt);
2960
+ if (ret != ITERATION_STATUS.EO_STRM) {
2961
+ return ret;
2962
+ }
2963
+ readjustSkip(currDatasource);
2964
+ }
2940
2965
  };
2941
2966
  FlatMapStreamDataSource.prototype.toDatasource = function (mapped) {
2942
2967
  var ds = Array.isArray(mapped) ? new (ArrayStreamDataSource.bind.apply(ArrayStreamDataSource, __spreadArray([void 0], mapped, false)))() : mapped;