jsf.js_next_gen 4.0.0-RC.33 → 4.0.0-RC.34

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.
@@ -2936,6 +2936,13 @@ var ITERATION_STATUS;
2936
2936
  ITERATION_STATUS["EO_STRM"] = "__EO_STRM__";
2937
2937
  ITERATION_STATUS["BEF_STRM"] = "___BEF_STRM__";
2938
2938
  })(ITERATION_STATUS = exports.ITERATION_STATUS || (exports.ITERATION_STATUS = {}));
2939
+ function calculateSkips(next_strm) {
2940
+ let pos = 1;
2941
+ while (next_strm.lookAhead(pos) != ITERATION_STATUS.EO_STRM) {
2942
+ pos++;
2943
+ }
2944
+ return --pos;
2945
+ }
2939
2946
  class MultiStreamDatasource {
2940
2947
  constructor(first, ...strms) {
2941
2948
  this.first = first;
@@ -2966,33 +2973,22 @@ class MultiStreamDatasource {
2966
2973
  }
2967
2974
  return hasNext ? cnt : -1;
2968
2975
  }
2969
- lookAhead(cnt) {
2970
- let posPtr = 1;
2971
- let strmPos = this.selectedPos;
2972
- let valueFound = null;
2973
- if (this.strms[strmPos].lookAhead(cnt) != ITERATION_STATUS.EO_STRM) {
2974
- //speedup
2975
- return this.strms[strmPos].lookAhead(cnt);
2976
+ lookAhead(cnt = 1) {
2977
+ //lets clone
2978
+ const strms = this.strms.slice(this.selectedPos);
2979
+ if (!strms.length) {
2980
+ return ITERATION_STATUS.EO_STRM;
2976
2981
  }
2977
- for (let loop = posPtr; loop <= cnt; loop++) {
2978
- if (!this.strms[strmPos]) {
2979
- return ITERATION_STATUS.EO_STRM;
2980
- }
2981
- let val = (posPtr > 0) ? this.strms[strmPos].lookAhead(posPtr) : this.strms[strmPos].current();
2982
- valueFound = val;
2983
- if (val != ITERATION_STATUS.EO_STRM) {
2984
- posPtr++;
2985
- }
2986
- else {
2987
- if (strmPos >= this.strms.length) {
2988
- return ITERATION_STATUS.EO_STRM;
2989
- }
2990
- strmPos++;
2991
- posPtr = 1;
2992
- loop--; //empty iteration
2982
+ const all_strms = [...strms];
2983
+ while (all_strms.length) {
2984
+ let next_strm = all_strms.shift();
2985
+ let lookAhead = next_strm.lookAhead(cnt);
2986
+ if (lookAhead != ITERATION_STATUS.EO_STRM) {
2987
+ return lookAhead;
2993
2988
  }
2989
+ cnt = cnt - calculateSkips(next_strm);
2994
2990
  }
2995
- return valueFound;
2991
+ return ITERATION_STATUS.EO_STRM;
2996
2992
  }
2997
2993
  next() {
2998
2994
  if (this.activeStrm.hasNext()) {
@@ -3207,29 +3203,13 @@ class FlatMapStreamDataSource {
3207
3203
  }
3208
3204
  lookAhead(cnt = 1) {
3209
3205
  var _a;
3210
- //easy access trial
3211
- 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) {
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) {
3212
3208
  //this should cover 95% of all cases
3213
- return this === null || this === void 0 ? void 0 : this.activeDataSource.lookAhead(cnt);
3214
- }
3215
- /**
3216
- * we only can determine how many elems datasource has by going up
3217
- * (for now this suffices, however not ideal, we might have to introduce a numElements or so)
3218
- * @param datasource
3219
- */
3220
- function howManyElems(datasource) {
3221
- let cnt = 1;
3222
- while (datasource.lookAhead(cnt) !== ITERATION_STATUS.EO_STRM) {
3223
- cnt++;
3224
- }
3225
- return cnt - 1;
3226
- }
3227
- function readjustSkip(dataSource) {
3228
- let skippedElems = (dataSource) ? howManyElems(dataSource) : 0;
3229
- cnt = cnt - skippedElems;
3209
+ return lookAhead;
3230
3210
  }
3231
3211
  if (this.activeDataSource) {
3232
- readjustSkip(this.activeDataSource);
3212
+ cnt -= calculateSkips(this.activeDataSource);
3233
3213
  }
3234
3214
  //the idea is basically to look into the streams sub-sequentially for a match
3235
3215
  //after each stream we have to take into consideration that the skipCnt is
@@ -3255,9 +3235,8 @@ class FlatMapStreamDataSource {
3255
3235
  }
3256
3236
  //reduce the next lookahead by the number of elements
3257
3237
  //we are now skipping in the current data source
3258
- readjustSkip(currentDataSource);
3238
+ cnt -= calculateSkips(currentDataSource);
3259
3239
  }
3260
- return ITERATION_STATUS.EO_STRM;
3261
3240
  }
3262
3241
  toDatasource(mapped) {
3263
3242
  let ds = Array.isArray(mapped) ? new ArrayStreamDataSource(...mapped) : mapped;
@@ -7790,15 +7769,10 @@ class XhrFormData extends mona_dish_1.Config {
7790
7769
  /*
7791
7770
  * collects everything into a FormData object
7792
7771
  */
7793
- let ret = new FormData();
7794
- let collectFormData = ({ key, item }) => {
7795
- ret.append(key, item);
7796
- };
7797
- mona_dish_1.Stream.ofAssoc(this.value)
7772
+ return mona_dish_1.Stream.ofAssoc(this.value)
7798
7773
  .flatMap(expandAssocArray)
7799
7774
  .map(remapForNamingContainer)
7800
- .each(collectFormData);
7801
- return ret;
7775
+ .collect(new mona_dish_1.FormDataCollector());
7802
7776
  }
7803
7777
  /**
7804
7778
  * returns an encoded string representation of our xhr form data
Binary file
Binary file