jsf.js_next_gen 4.0.0-RC.19 → 4.0.0-RC.20

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 (48) hide show
  1. package/dist/docs/assets/main.js +56 -52
  2. package/dist/docs/assets/style.css +23 -0
  3. package/dist/window/faces-development.js +127 -12
  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 +127 -12
  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 +12 -12
  20. package/src/main/typescript/impl/AjaxImpl.ts +17 -5
  21. package/src/main/typescript/impl/util/ExtDomQuery.ts +6 -1
  22. package/src/main/typescript/impl/xhrCore/XhrRequest.ts +12 -4
  23. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +53 -0
  24. package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +7 -6
  25. package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +116 -9
  26. package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +36 -0
  27. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +1 -1
  28. package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +32 -0
  29. package/src/main/typescript/tsconfig.json +1 -1
  30. package/src/tmp/test.html +12 -88
  31. package/target/impl/AjaxImpl.js +15 -3
  32. package/target/impl/AjaxImpl.js.map +1 -1
  33. package/target/impl/util/ExtDomQuery.js +4 -0
  34. package/target/impl/util/ExtDomQuery.js.map +1 -1
  35. package/target/impl/xhrCore/XhrRequest.js +9 -1
  36. package/target/impl/xhrCore/XhrRequest.js.map +1 -1
  37. package/target/test/frameworkBase/_ext/shared/StandardInits.js +45 -0
  38. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  39. package/target/test/xhrCore/NamespacesRequestTest.spec.js +7 -6
  40. package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -1
  41. package/target/test/xhrCore/RequestParamsTest.spec.js +101 -4
  42. package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
  43. package/target/test/xhrCore/RequestTest_23.spec.js +32 -0
  44. package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
  45. package/target/test/xhrCore/ResponseTest.spec.js +1 -0
  46. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  47. package/target/test/xhrCore/ResponseTest23.spec.js +30 -0
  48. package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
@@ -2242,7 +2242,7 @@ var Lang;
2242
2242
  * limitations under the License.
2243
2243
  */
2244
2244
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2245
- exports.Config = exports.ValueEmbedder = exports.Optional = exports.Monad = void 0;
2245
+ exports.Config = exports.CONFIG_ANY = exports.CONFIG_VALUE = exports.ValueEmbedder = exports.Optional = exports.Monad = void 0;
2246
2246
  /**
2247
2247
  * A module which keeps basic monadish like definitions in place without any sidedependencies to other modules.
2248
2248
  * Useful if you need the functions in another library to keep its dependencies down
@@ -2358,6 +2358,7 @@ class Optional extends Monad {
2358
2358
  * capabilites, unfortunately typesceript does not allow to have its own elvis operator
2359
2359
  * this is some syntactic sugar however which is quite useful*/
2360
2360
  getIf(...key) {
2361
+ key = this.preprocessKeys(...key);
2361
2362
  let currentPos = this;
2362
2363
  for (let cnt = 0; cnt < key.length; cnt++) {
2363
2364
  let currKey = this.keyVal(key[cnt]);
@@ -2486,6 +2487,23 @@ class Optional extends Monad {
2486
2487
  return Optional.absent;
2487
2488
  }
2488
2489
  }
2490
+ preprocessKeys(...keys) {
2491
+ return Stream_1.Stream.of(...keys)
2492
+ .flatMap(item => {
2493
+ return Stream_1.Stream.of(...item.split(/\]\s*\[/gi))
2494
+ .map(item => {
2495
+ item = item.replace(/^\s+|\s+$/g, "");
2496
+ if (item.indexOf("[") == -1 && item.indexOf("]") != -1) {
2497
+ item = "[" + item;
2498
+ }
2499
+ if (item.indexOf("]") == -1 && item.indexOf("[") != -1) {
2500
+ item = item + "]";
2501
+ }
2502
+ return item;
2503
+ });
2504
+ })
2505
+ .collect(new SourcesCollectors_1.ArrayCollector());
2506
+ }
2489
2507
  }
2490
2508
  exports.Optional = Optional;
2491
2509
  /*default value for absent*/
@@ -2577,6 +2595,9 @@ class ConfigEntry extends ValueEmbedder {
2577
2595
  }
2578
2596
  /*default value for absent*/
2579
2597
  ConfigEntry.absent = ConfigEntry.fromNullable(null);
2598
+ exports.CONFIG_VALUE = "__END_POINT__";
2599
+ exports.CONFIG_ANY = "__ANY_POINT__";
2600
+ const ALL_VALUES = "*";
2580
2601
  /**
2581
2602
  * Config, basically an optional wrapper for a json structure
2582
2603
  * (not sideeffect free, since we can alter the internal config state
@@ -2584,8 +2605,9 @@ ConfigEntry.absent = ConfigEntry.fromNullable(null);
2584
2605
  * since this would swallow a lot of performane and ram
2585
2606
  */
2586
2607
  class Config extends Optional {
2587
- constructor(root) {
2608
+ constructor(root, configDef) {
2588
2609
  super(root);
2610
+ this.configDef = configDef;
2589
2611
  }
2590
2612
  /**
2591
2613
  * shallow copy getter, copies only the first level, references the deeper nodes
@@ -2653,10 +2675,11 @@ class Config extends Optional {
2653
2675
  if (noKeys) {
2654
2676
  return;
2655
2677
  }
2678
+ this.assertAccessPath(...accessPath);
2656
2679
  let lastKey = accessPath[accessPath.length - 1];
2657
2680
  let currKey, finalKey = this.keyVal(lastKey);
2658
2681
  let pathExists = this.getIf(...accessPath).isPresent();
2659
- this.buildPath(accessPath);
2682
+ this.buildPath(...accessPath);
2660
2683
  let finalKeyArrPos = this.arrayIndex(lastKey);
2661
2684
  if (finalKeyArrPos > -1) {
2662
2685
  throw Error("Append only possible on non array properties, use assign on indexed data");
@@ -2692,7 +2715,8 @@ class Config extends Optional {
2692
2715
  if (accessPath.length < 1) {
2693
2716
  return;
2694
2717
  }
2695
- this.buildPath(accessPath);
2718
+ this.assertAccessPath(...accessPath);
2719
+ this.buildPath(...accessPath);
2696
2720
  let currKey = this.keyVal(accessPath[accessPath.length - 1]);
2697
2721
  let arrPos = this.arrayIndex(accessPath[accessPath.length - 1]);
2698
2722
  let retVal = new ConfigEntry(accessPath.length == 1 ? this.value : this.getIf.apply(this, accessPath.slice(0, accessPath.length - 1)).value, currKey, arrPos);
@@ -2713,6 +2737,7 @@ class Config extends Optional {
2713
2737
  * @param accessPath the access path
2714
2738
  */
2715
2739
  getIf(...accessPath) {
2740
+ this.assertAccessPath(...accessPath);
2716
2741
  return this.getClass().fromNullable(super.getIf.apply(this, accessPath).value);
2717
2742
  }
2718
2743
  /**
@@ -2741,12 +2766,67 @@ class Config extends Optional {
2741
2766
  setVal(val) {
2742
2767
  this._value = val;
2743
2768
  }
2769
+ /**
2770
+ * asserts the access path for a semy typed access
2771
+ * @param accessPath
2772
+ * @private
2773
+ */
2774
+ assertAccessPath(...accessPath) {
2775
+ var _a, _b;
2776
+ accessPath = this.preprocessKeys(...accessPath);
2777
+ if (!this.configDef) {
2778
+ //untyped
2779
+ return;
2780
+ }
2781
+ let currAccessPos = null;
2782
+ const ERR_ACCESS_PATH = "Access Path to config invalid";
2783
+ const ABSENT = "__ABSENT__";
2784
+ currAccessPos = this.configDef;
2785
+ for (let cnt = 0; cnt < accessPath.length; cnt++) {
2786
+ let currKey = this.keyVal(accessPath[cnt]);
2787
+ let arrPos = this.arrayIndex(accessPath[cnt]);
2788
+ //key index
2789
+ if (this.isArray(arrPos)) {
2790
+ if (currKey != "") {
2791
+ currAccessPos = (Array.isArray(currAccessPos)) ?
2792
+ Stream_1.Stream.of(...currAccessPos)
2793
+ .filter(item => { var _a; return !!((_a = item === null || item === void 0 ? void 0 : item[currKey]) !== null && _a !== void 0 ? _a : false); })
2794
+ .map(item => item === null || item === void 0 ? void 0 : item[currKey]).first() :
2795
+ Optional.fromNullable((_a = currAccessPos === null || currAccessPos === void 0 ? void 0 : currAccessPos[currKey]) !== null && _a !== void 0 ? _a : null);
2796
+ }
2797
+ else {
2798
+ currAccessPos = (Array.isArray(currAccessPos)) ?
2799
+ Stream_1.Stream.of(...currAccessPos)
2800
+ .filter(item => Array.isArray(item))
2801
+ .flatMap(item => Stream_1.Stream.of(...item)).first() : Optional.absent;
2802
+ }
2803
+ //we noe store either the current array or the filtered look ahead to go further
2804
+ }
2805
+ else {
2806
+ //we now have an array and go further with a singular key
2807
+ currAccessPos = (Array.isArray(currAccessPos)) ? Stream_1.Stream.of(...currAccessPos)
2808
+ .filter(item => { var _a; return !!((_a = item === null || item === void 0 ? void 0 : item[currKey]) !== null && _a !== void 0 ? _a : false); })
2809
+ .map(item => item === null || item === void 0 ? void 0 : item[currKey])
2810
+ .first() :
2811
+ Optional.fromNullable((_b = currAccessPos === null || currAccessPos === void 0 ? void 0 : currAccessPos[currKey]) !== null && _b !== void 0 ? _b : null);
2812
+ }
2813
+ if (!currAccessPos.isPresent()) {
2814
+ throw Error(ERR_ACCESS_PATH);
2815
+ }
2816
+ currAccessPos = currAccessPos.value;
2817
+ //no further testing needed, from this point onwards we are on our own
2818
+ if (currAccessPos == exports.CONFIG_ANY) {
2819
+ return;
2820
+ }
2821
+ }
2822
+ }
2744
2823
  /**
2745
2824
  * builds the config path
2746
2825
  *
2747
2826
  * @param accessPath a sequential array of accessPath containing either a key name or an array reference name[<index>]
2748
2827
  */
2749
- buildPath(accessPath) {
2828
+ buildPath(...accessPath) {
2829
+ accessPath = this.preprocessKeys(...accessPath);
2750
2830
  let val = this;
2751
2831
  let parentVal = this.getClass().fromNullable(null);
2752
2832
  let parentPos = -1;
@@ -2760,7 +2840,7 @@ class Config extends Optional {
2760
2840
  for (let cnt = 0; cnt < accessPath.length; cnt++) {
2761
2841
  let currKey = this.keyVal(accessPath[cnt]);
2762
2842
  let arrPos = this.arrayIndex(accessPath[cnt]);
2763
- if (currKey === "" && arrPos >= 0) {
2843
+ if (this.isArrayPos(currKey, arrPos)) {
2764
2844
  val.setVal((val.value instanceof Array) ? val.value : []);
2765
2845
  alloc(val.value, arrPos + 1);
2766
2846
  if (parentPos >= 0) {
@@ -2772,7 +2852,7 @@ class Config extends Optional {
2772
2852
  continue;
2773
2853
  }
2774
2854
  let tempVal = val.getIf(currKey);
2775
- if (arrPos == -1) {
2855
+ if (this.isNoArray(arrPos)) {
2776
2856
  if (tempVal.isAbsent()) {
2777
2857
  tempVal = this.getClass().fromNullable(val.value[currKey] = {});
2778
2858
  }
@@ -2792,6 +2872,15 @@ class Config extends Optional {
2792
2872
  }
2793
2873
  return this;
2794
2874
  }
2875
+ isNoArray(arrPos) {
2876
+ return arrPos == -1;
2877
+ }
2878
+ isArray(arrPos) {
2879
+ return !this.isNoArray(arrPos);
2880
+ }
2881
+ isArrayPos(currKey, arrPos) {
2882
+ return currKey === "" && arrPos >= 0;
2883
+ }
2795
2884
  }
2796
2885
  exports.Config = Config;
2797
2886
 
@@ -3778,7 +3867,7 @@ exports.XQ = XMLQuery;
3778
3867
 
3779
3868
 
3780
3869
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3781
- 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 = exports.Lang = exports.DQ$ = exports.DQ = exports.DomQueryCollector = exports.ElementAttribute = exports.DomQuery = void 0;
3870
+ 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;
3782
3871
  /*!
3783
3872
  * Licensed to the Apache Software Foundation (ASF) under one
3784
3873
  * or more contributor license agreements. See the NOTICE file
@@ -3807,6 +3896,8 @@ var Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/mai
3807
3896
  Object.defineProperty(exports, "Lang", ({ enumerable: true, get: function () { return Lang_1.Lang; } }));
3808
3897
  var Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
3809
3898
  Object.defineProperty(exports, "Config", ({ enumerable: true, get: function () { return Monad_1.Config; } }));
3899
+ Object.defineProperty(exports, "CONFIG_VALUE", ({ enumerable: true, get: function () { return Monad_1.CONFIG_VALUE; } }));
3900
+ Object.defineProperty(exports, "CONFIG_ANY", ({ enumerable: true, get: function () { return Monad_1.CONFIG_ANY; } }));
3810
3901
  Object.defineProperty(exports, "Monad", ({ enumerable: true, get: function () { return Monad_1.Monad; } }));
3811
3902
  Object.defineProperty(exports, "Optional", ({ enumerable: true, get: function () { return Monad_1.Optional; } }));
3812
3903
  Object.defineProperty(exports, "ValueEmbedder", ({ enumerable: true, get: function () { return Monad_1.ValueEmbedder; } }));
@@ -4333,7 +4424,13 @@ var Implementation;
4333
4424
  requestCtx.assign(Const_1.CTX_PARAM_REQ_PASS_THR).value = extractLegacyParams(options.value);
4334
4425
  // spec conform behavior, all passthrough params must be under "passthrough
4335
4426
  const params = remapArrayToAssocArr(options.getIf(Const_1.CTX_OPTIONS_PARAMS).orElse({}).value);
4336
- requestCtx.getIf(Const_1.CTX_PARAM_REQ_PASS_THR).shallowMerge(new mona_dish_1.Config(params), true);
4427
+ //we turn off the remapping for the param merge, because we do not want to have
4428
+ //any namespacing to be remapped
4429
+ let ctxPassthrough = requestCtx.getIf(Const_1.CTX_PARAM_REQ_PASS_THR);
4430
+ ctxPassthrough.$nspEnabled = false;
4431
+ ctxPassthrough.shallowMerge(new mona_dish_1.Config(params), true);
4432
+ //now we turn it on again
4433
+ ctxPassthrough.$nspEnabled = true;
4337
4434
  requestCtx.assignIf(!!event, Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_EVT).value = event === null || event === void 0 ? void 0 : event.type;
4338
4435
  /**
4339
4436
  * ajax pass through context with the source
@@ -4669,12 +4766,13 @@ var Implementation;
4669
4766
  const hasLeadingSep = componentIdToTransform.indexOf(SEP) === 0;
4670
4767
  const isAbsolutSearchExpr = hasLeadingSep || (rootNamingContainerId.length
4671
4768
  && componentIdToTransform.indexOf(rootNamingContainerPrefix) == 0);
4769
+ let finalIdentifier = "";
4672
4770
  if (isAbsolutSearchExpr) {
4673
4771
  //we cut off the leading sep if there is one
4674
4772
  componentIdToTransform = hasLeadingSep ? componentIdToTransform.substring(1) : componentIdToTransform;
4675
4773
  componentIdToTransform = componentIdToTransform.indexOf(rootNamingContainerPrefix) == 0 ? componentIdToTransform.substring(rootNamingContainerPrefix.length) : componentIdToTransform;
4676
4774
  //now we prepend either the prefix or "" from the cut-off string to get the final result
4677
- return [rootNamingContainerPrefix, componentIdToTransform].join(Const_1.EMPTY_STR);
4775
+ finalIdentifier = [rootNamingContainerPrefix, componentIdToTransform].join(Const_1.EMPTY_STR);
4678
4776
  }
4679
4777
  else { //relative search according to the javadoc
4680
4778
  //we cut off the root naming container id from the form
@@ -4683,10 +4781,15 @@ var Implementation;
4683
4781
  }
4684
4782
  //If prependId = true, the outer form id must be present in the id if same form
4685
4783
  let hasPrependId = componentIdToTransform.indexOf(formClientId) == 0;
4686
- return hasPrependId ?
4784
+ finalIdentifier = hasPrependId ?
4687
4785
  [rootNamingContainerPrefix, componentIdToTransform].join(Const_1.EMPTY_STR) :
4688
4786
  [nearestNamingContainerPrefix, componentIdToTransform].join(Const_1.EMPTY_STR);
4689
4787
  }
4788
+ // We need to double check because we have scenarios where we have a naming container
4789
+ // and no prepend (aka tobago testcase "must handle ':' in IDs properly", scenario 3,
4790
+ // in this case we return the component id, and be happy
4791
+ // we can roll a dom check here
4792
+ return (!!document.getElementById(finalIdentifier)) ? finalIdentifier : componentIdToTransform;
4690
4793
  };
4691
4794
  // in this case we do not use lazy stream because it wont bring any code reduction
4692
4795
  // or speedup
@@ -5864,6 +5967,7 @@ exports.ExtDQ = ExtDomQuery;
5864
5967
  class ExtConfig extends mona_dish_1.Config {
5865
5968
  constructor(root) {
5866
5969
  super(root);
5970
+ this.$nspEnabled = true;
5867
5971
  }
5868
5972
  assignIf(condition, ...accessPath) {
5869
5973
  const accessPathMapped = this.remap(accessPath);
@@ -5920,6 +6024,9 @@ class ExtConfig extends mona_dish_1.Config {
5920
6024
  * @private returns an array of access paths with version remapped namespaces
5921
6025
  */
5922
6026
  remap(accessPath) {
6027
+ if (!this.$nspEnabled) {
6028
+ return accessPath;
6029
+ }
5923
6030
  return mona_dish_1.Stream.of(...accessPath).map(key => (0, Const_1.$nsp)(key)).collect(new mona_dish_1.ArrayCollector());
5924
6031
  }
5925
6032
  }
@@ -7647,12 +7754,20 @@ class XhrRequest {
7647
7754
  let formData = new XhrFormData_1.XhrFormData(this.sourceForm, viewState, executesArr(), this.partialIdsArray);
7648
7755
  this.contentType = formData.isMultipartRequest ? "undefined" : this.contentType;
7649
7756
  // next step the pass through parameters are merged in for post params
7757
+ this.requestContext.$nspEnabled = false;
7650
7758
  let requestContext = this.requestContext;
7651
7759
  let requestPassThroughParams = requestContext.getIf(Const_1.CTX_PARAM_REQ_PASS_THR);
7760
+ requestPassThroughParams.$nspEnabled = false;
7652
7761
  // this is an extension where we allow pass through parameters to be sent down additionally
7653
7762
  // this can be used and is used in the impl to enrich the post request parameters with additional
7654
7763
  // information
7655
- formData.shallowMerge(requestPassThroughParams, true, true);
7764
+ try {
7765
+ formData.shallowMerge(requestPassThroughParams, true, true);
7766
+ }
7767
+ finally {
7768
+ this.requestContext.$nspEnabled = true;
7769
+ requestPassThroughParams.$nspEnabled = true;
7770
+ }
7656
7771
  this.responseContext = requestPassThroughParams.deepCopy;
7657
7772
  // we have to shift the internal passthroughs around to build up our response context
7658
7773
  let responseContext = this.responseContext;
Binary file
Binary file