jsf.js_next_gen 4.0.1-beta.1 → 4.0.1-beta.3

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 (103) hide show
  1. package/README.md +6 -0
  2. package/dist/docs/assets/search.js +1 -1
  3. package/dist/docs/functions/myfaces.ab.html +1 -1
  4. package/dist/docs/functions/{myfaces.onOnDomReady.html → myfaces.onDomReady.html} +5 -5
  5. package/dist/docs/index.html +9 -0
  6. package/dist/docs/modules/myfaces.html +2 -2
  7. package/dist/docs/variables/myfaces.oam.html +1 -1
  8. package/dist/window/faces-development.js +1285 -1295
  9. package/dist/window/faces-development.js.br +0 -0
  10. package/dist/window/faces-development.js.gz +0 -0
  11. package/dist/window/faces-development.js.map +1 -1
  12. package/dist/window/faces.js +1 -1
  13. package/dist/window/faces.js.br +0 -0
  14. package/dist/window/faces.js.gz +0 -0
  15. package/dist/window/faces.js.map +1 -1
  16. package/dist/window/jsf-development.js +1285 -1295
  17. package/dist/window/jsf-development.js.br +0 -0
  18. package/dist/window/jsf-development.js.gz +0 -0
  19. package/dist/window/jsf-development.js.map +1 -1
  20. package/dist/window/jsf.js +1 -1
  21. package/dist/window/jsf.js.br +0 -0
  22. package/dist/window/jsf.js.gz +0 -0
  23. package/dist/window/jsf.js.map +1 -1
  24. package/package.json +5 -5
  25. package/plans for 4.0.1.txt +8 -0
  26. package/src/main/typescript/api/_api.ts +1 -1
  27. package/src/main/typescript/impl/AjaxImpl.ts +60 -44
  28. package/src/main/typescript/impl/core/Const.ts +5 -2
  29. package/src/main/typescript/impl/util/AsyncRunnable.ts +81 -6
  30. package/src/main/typescript/impl/util/ExtDomQuery.ts +7 -9
  31. package/src/main/typescript/impl/util/FileUtils.ts +26 -22
  32. package/src/main/typescript/impl/util/HiddenInputBuilder.ts +7 -3
  33. package/src/main/typescript/impl/util/Lang.ts +61 -4
  34. package/src/main/typescript/impl/util/XhrQueueController.ts +112 -0
  35. package/src/main/typescript/impl/xhrCore/EventData.ts +3 -3
  36. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +12 -10
  37. package/src/main/typescript/impl/xhrCore/XhrFormData.ts +32 -19
  38. package/src/main/typescript/impl/xhrCore/XhrRequest.ts +51 -72
  39. package/src/main/typescript/myfaces/OamSubmit.ts +6 -6
  40. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +179 -40
  41. package/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.ts +4 -4
  42. package/src/main/typescript/test/frameworkBase/_ext/monadish/fixtures/blank.css +0 -0
  43. package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.ts +921 -0
  44. package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.ts +108 -0
  45. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +3 -2
  46. package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/jakarta.faces.resource/faces.js.jsf +0 -0
  47. package/src/main/typescript/test/myfaces/OnLoadSpec.ts +52 -0
  48. package/src/main/typescript/test/queue/AsynchronousProbe.ts +5 -5
  49. package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +4 -3
  50. package/src/main/typescript/test/xhrCore/EventTests.spec.ts +28 -22
  51. package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +4 -4
  52. package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +2 -2
  53. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +80 -6
  54. package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +6 -1
  55. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +23 -22
  56. package/target/api/_api.js +2 -2
  57. package/target/api/_api.js.map +1 -1
  58. package/target/impl/AjaxImpl.js +48 -38
  59. package/target/impl/AjaxImpl.js.map +1 -1
  60. package/target/impl/core/Const.js +7 -5
  61. package/target/impl/core/Const.js.map +1 -1
  62. package/target/impl/util/AsyncRunnable.js +60 -0
  63. package/target/impl/util/AsyncRunnable.js.map +1 -1
  64. package/target/impl/util/ExtDomQuery.js +8 -8
  65. package/target/impl/util/ExtDomQuery.js.map +1 -1
  66. package/target/impl/util/FileUtils.js +21 -20
  67. package/target/impl/util/FileUtils.js.map +1 -1
  68. package/target/impl/util/HiddenInputBuilder.js +7 -3
  69. package/target/impl/util/HiddenInputBuilder.js.map +1 -1
  70. package/target/impl/util/Lang.js +52 -1
  71. package/target/impl/util/Lang.js.map +1 -1
  72. package/target/impl/xhrCore/EventData.js +2 -2
  73. package/target/impl/xhrCore/EventData.js.map +1 -1
  74. package/target/impl/xhrCore/ResponseProcessor.js +9 -7
  75. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
  76. package/target/impl/xhrCore/XhrFormData.js +29 -15
  77. package/target/impl/xhrCore/XhrFormData.js.map +1 -1
  78. package/target/impl/xhrCore/XhrRequest.js +43 -64
  79. package/target/impl/xhrCore/XhrRequest.js.map +1 -1
  80. package/target/myfaces/OamSubmit.js +5 -3
  81. package/target/myfaces/OamSubmit.js.map +1 -1
  82. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +138 -37
  83. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
  84. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +4 -4
  85. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
  86. package/target/test/frameworkBase/_ext/shared/StandardInits.js +3 -2
  87. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  88. package/target/test/queue/AsynchronousQueueTest.spec.js +3 -3
  89. package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
  90. package/target/test/xhrCore/EventTests.spec.js +26 -19
  91. package/target/test/xhrCore/EventTests.spec.js.map +1 -1
  92. package/target/test/xhrCore/NamespacesRequestTest.spec.js +3 -3
  93. package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -1
  94. package/target/test/xhrCore/RequestParamsTest.spec.js +1 -1
  95. package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
  96. package/target/test/xhrCore/RequestTest.spec.js +73 -4
  97. package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
  98. package/target/test/xhrCore/RequestTest_23.spec.js +6 -0
  99. package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
  100. package/target/test/xhrCore/ResponseTest.spec.js +22 -15
  101. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  102. package/src/main/typescript/impl/util/AsyncQueue.ts +0 -133
  103. package/src/main/typescript/test/frameworkBase/_ext/monadish/StreamTest.spec.ts +0 -231
@@ -2,6 +2,540 @@
2
2
  /******/ "use strict";
3
3
  /******/ var __webpack_modules__ = ({
4
4
 
5
+ /***/ "./node_modules/mona-dish/src/main/typescript/AssocArray.ts":
6
+ /*!******************************************************************!*\
7
+ !*** ./node_modules/mona-dish/src/main/typescript/AssocArray.ts ***!
8
+ \******************************************************************/
9
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
10
+
11
+
12
+ /*!
13
+ * Licensed to the Apache Software Foundation (ASF) under one or more
14
+ * contributor license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright ownership.
16
+ * The ASF licenses this file to you under the Apache License, Version 2.0
17
+ * (the "License"); you may not use this file except in compliance with
18
+ * the License. You may obtain a copy of the License at
19
+ *
20
+ * http://www.apache.org/licenses/LICENSE-2.0
21
+ *
22
+ * Unless required by applicable law or agreed to in writing, software
23
+ * distributed under the License is distributed on an "AS IS" BASIS,
24
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25
+ * See the License for the specific language governing permissions and
26
+ * limitations under the License.
27
+ */
28
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
29
+ exports.shallowMerge = exports.simpleShallowMerge = exports.deepCopy = exports.buildPath = exports.resolve = exports.appendIf = exports.assignIf = exports.append = exports.assign = void 0;
30
+ const Es2019Array_1 = __webpack_require__(/*! ./Es2019Array */ "./node_modules/mona-dish/src/main/typescript/Es2019Array.ts");
31
+ /**
32
+ * A nop as assign functionality (aka ignore assign)
33
+ */
34
+ class IgnoreAssign {
35
+ constructor(parent) {
36
+ this.parent = parent;
37
+ }
38
+ set value(value) {
39
+ }
40
+ get value() {
41
+ return this.parent;
42
+ }
43
+ }
44
+ ;
45
+ /**
46
+ * uses the known pattern from config
47
+ * assign(target, key1, key2, key3).value = value;
48
+ * @param target
49
+ * @param keys
50
+ */
51
+ function assign(target, ...accessPath) {
52
+ if (accessPath.length < 1) {
53
+ return new IgnoreAssign(target);
54
+ }
55
+ const lastPathItem = buildPath(target, ...accessPath);
56
+ let assigner = new (class {
57
+ set value(value) {
58
+ lastPathItem.target[lastPathItem.key] = value;
59
+ }
60
+ get value() {
61
+ return lastPathItem.target[lastPathItem.key];
62
+ }
63
+ })();
64
+ return assigner;
65
+ }
66
+ exports.assign = assign;
67
+ function append(target, ...accessPath) {
68
+ if (accessPath.length < 1) {
69
+ return new IgnoreAssign(target);
70
+ }
71
+ const lastPathItem = buildPath(target, ...accessPath);
72
+ let appender = new (class {
73
+ set value(value) {
74
+ if (!Array.isArray(value)) {
75
+ value = [value];
76
+ }
77
+ if (!lastPathItem.target[lastPathItem.key]) {
78
+ lastPathItem.target[lastPathItem.key] = value;
79
+ }
80
+ else {
81
+ if (!Array.isArray(lastPathItem.target[lastPathItem.key])) {
82
+ lastPathItem.target[lastPathItem.key] = [lastPathItem.target[lastPathItem.key]];
83
+ }
84
+ lastPathItem.target[lastPathItem.key].push(...value);
85
+ }
86
+ }
87
+ })();
88
+ return appender;
89
+ }
90
+ exports.append = append;
91
+ /**
92
+ * uses the known pattern from config
93
+ * assign(target, key1, key2, key3).value = value;
94
+ * @param target
95
+ * @param keys
96
+ */
97
+ function assignIf(condition, target, ...accessPath) {
98
+ if ((!condition) || accessPath.length < 1) {
99
+ return new IgnoreAssign(target);
100
+ }
101
+ return assign(target, ...accessPath);
102
+ }
103
+ exports.assignIf = assignIf;
104
+ /**
105
+ * uses the known pattern from config
106
+ * assign(target, key1, key2, key3).value = value;
107
+ * @param target
108
+ * @param keys
109
+ */
110
+ function appendIf(condition, target, ...accessPath) {
111
+ if ((!condition) || accessPath.length < 1) {
112
+ return new IgnoreAssign(target);
113
+ }
114
+ return append(target, ...accessPath);
115
+ }
116
+ exports.appendIf = appendIf;
117
+ function resolve(target, ...accessPath) {
118
+ let ret = null;
119
+ accessPath = flattenAccessPath(accessPath);
120
+ let currPtr = target;
121
+ for (let cnt = 0; cnt < accessPath.length; cnt++) {
122
+ let accessKeyIndex = accessPath[cnt];
123
+ accessKeyIndex = arrayIndex(accessKeyIndex) != -1 ? arrayIndex(accessKeyIndex) : accessKeyIndex;
124
+ currPtr = currPtr === null || currPtr === void 0 ? void 0 : currPtr[accessKeyIndex];
125
+ if ('undefined' == typeof currPtr) {
126
+ return null;
127
+ }
128
+ ret = currPtr;
129
+ }
130
+ return currPtr;
131
+ }
132
+ exports.resolve = resolve;
133
+ function keyVal(key) {
134
+ let start = key.indexOf("[");
135
+ if (start >= 0) {
136
+ return key.substring(0, start);
137
+ }
138
+ else {
139
+ return key;
140
+ }
141
+ }
142
+ function arrayIndex(key) {
143
+ let start = key.indexOf("[");
144
+ let end = key.indexOf("]");
145
+ if (start >= 0 && end > 0 && start < end) {
146
+ return parseInt(key.substring(start + 1, end));
147
+ }
148
+ else {
149
+ return -1;
150
+ }
151
+ }
152
+ function isArrayPos(currKey, arrPos) {
153
+ return currKey === "" && arrPos >= 0;
154
+ }
155
+ function isNoArray(arrPos) {
156
+ return arrPos == -1;
157
+ }
158
+ function alloc(arr, length, defaultVal = {}) {
159
+ let toAdd = [];
160
+ toAdd.length = length;
161
+ toAdd[length - 1] = defaultVal;
162
+ arr.push(...toAdd);
163
+ }
164
+ function flattenAccessPath(accessPath) {
165
+ return accessPath.flatMap(path => path.split("["))
166
+ .map(path => path.indexOf("]") != -1 ? "[" + path : path)
167
+ .filter(path => path != "");
168
+ }
169
+ /**
170
+ * builds up a path, only done if no data is present!
171
+ * @param target
172
+ * @param accessPath
173
+ * @returns the last assignable entry
174
+ */
175
+ function buildPath(target, ...accessPath) {
176
+ accessPath = flattenAccessPath(accessPath);
177
+ //we now have a pattern of having the array accessors always in separate items
178
+ let parentPtr = target;
179
+ let parKeyArrPos = null;
180
+ let currKey = null;
181
+ let arrPos = -1;
182
+ for (let cnt = 0; cnt < accessPath.length; cnt++) {
183
+ currKey = keyVal(accessPath[cnt]);
184
+ arrPos = arrayIndex(accessPath[cnt]);
185
+ //it now is either key or arrPos
186
+ if (arrPos != -1) {
187
+ //case root(array)[5] -> root must be array and allocate 5 elements
188
+ //case root.item[5] root.item must be array and of 5 elements
189
+ if (!Array.isArray(parentPtr)) {
190
+ throw Error("Associative array referenced as index array in path reference");
191
+ }
192
+ //we need to look ahead for proper allocation
193
+ //not end reached
194
+ let nextArrPos = -1;
195
+ if (cnt < accessPath.length - 1) {
196
+ nextArrPos = arrayIndex(accessPath[cnt + 1]);
197
+ }
198
+ let dataPresent = 'undefined' != typeof (parentPtr === null || parentPtr === void 0 ? void 0 : parentPtr[arrPos]);
199
+ //no data present check here is needed, because alloc only reserves if not present
200
+ alloc(parentPtr, arrPos + 1, nextArrPos != -1 ? [] : {});
201
+ parKeyArrPos = arrPos;
202
+ //we now go to the reserved element
203
+ if (cnt == accessPath.length - 1) {
204
+ parentPtr[arrPos] = (dataPresent) ? parentPtr[arrPos] : null;
205
+ }
206
+ else {
207
+ parentPtr = parentPtr[arrPos];
208
+ }
209
+ }
210
+ else {
211
+ if (Array.isArray(parentPtr)) {
212
+ throw Error("Index array referenced as associative array in path reference");
213
+ }
214
+ //again look ahead whether the next value is an array or assoc array
215
+ let nextArrPos = -1;
216
+ if (cnt < accessPath.length - 1) {
217
+ nextArrPos = arrayIndex(accessPath[cnt + 1]);
218
+ }
219
+ parKeyArrPos = currKey;
220
+ let dataPresent = 'undefined' != typeof (parentPtr === null || parentPtr === void 0 ? void 0 : parentPtr[currKey]);
221
+ if (cnt == accessPath.length - 1) {
222
+ if (!dataPresent) {
223
+ parentPtr[currKey] = null;
224
+ }
225
+ }
226
+ else {
227
+ if (!dataPresent) {
228
+ parentPtr[currKey] = nextArrPos == -1 ? {} : [];
229
+ }
230
+ parentPtr = parentPtr[currKey];
231
+ }
232
+ }
233
+ }
234
+ return { target: parentPtr, key: parKeyArrPos };
235
+ }
236
+ exports.buildPath = buildPath;
237
+ function deepCopy(fromAssoc) {
238
+ return JSON.parse(JSON.stringify(fromAssoc));
239
+ }
240
+ exports.deepCopy = deepCopy;
241
+ /**
242
+ * simple left to right merge
243
+ *
244
+ * @param assocArrays
245
+ */
246
+ function simpleShallowMerge(...assocArrays) {
247
+ return shallowMerge(true, false, ...assocArrays);
248
+ }
249
+ exports.simpleShallowMerge = simpleShallowMerge;
250
+ /**
251
+ * Shallow merge as in config
252
+ *
253
+ * @param overwrite
254
+ * @param withAppend
255
+ * @param assocArrays
256
+ */
257
+ function shallowMerge(overwrite = true, withAppend = false, ...assocArrays) {
258
+ let target = {};
259
+ assocArrays.map(arr => {
260
+ return { arr, keys: Object.keys(arr) };
261
+ }).forEach(({ arr, keys }) => {
262
+ keys.forEach(key => {
263
+ let toAssign = arr[key];
264
+ if (!Array.isArray(toAssign) && withAppend) {
265
+ toAssign = new Es2019Array_1.Es2019Array(...[toAssign]);
266
+ }
267
+ if (overwrite || !(target === null || target === void 0 ? void 0 : target[key])) {
268
+ if (!withAppend) {
269
+ target[key] = arr[key];
270
+ }
271
+ else {
272
+ if ('undefined' == typeof (target === null || target === void 0 ? void 0 : target[key])) {
273
+ target[key] = toAssign;
274
+ }
275
+ else if (!Array.isArray(target[key])) {
276
+ let oldVal = target[key];
277
+ target[key] = new Es2019Array_1.Es2019Array(...[]);
278
+ target[key].push(oldVal);
279
+ target[key].push(...toAssign);
280
+ }
281
+ else {
282
+ target[key].push(...toAssign);
283
+ }
284
+ }
285
+ }
286
+ });
287
+ });
288
+ return target;
289
+ }
290
+ exports.shallowMerge = shallowMerge;
291
+
292
+
293
+ /***/ }),
294
+
295
+ /***/ "./node_modules/mona-dish/src/main/typescript/Config.ts":
296
+ /*!**************************************************************!*\
297
+ !*** ./node_modules/mona-dish/src/main/typescript/Config.ts ***!
298
+ \**************************************************************/
299
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
300
+
301
+
302
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
303
+ exports.Config = exports.CONFIG_ANY = exports.CONFIG_VALUE = void 0;
304
+ const Es2019Array_1 = __webpack_require__(/*! ./Es2019Array */ "./node_modules/mona-dish/src/main/typescript/Es2019Array.ts");
305
+ const Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
306
+ const Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
307
+ var objAssign = Lang_1.Lang.objAssign;
308
+ const AssocArray_1 = __webpack_require__(/*! ./AssocArray */ "./node_modules/mona-dish/src/main/typescript/AssocArray.ts");
309
+ /**
310
+ * specialized value embedder
311
+ * for our Configuration
312
+ */
313
+ class ConfigEntry extends Monad_1.ValueEmbedder {
314
+ constructor(rootElem, key, arrPos) {
315
+ super(rootElem, key);
316
+ this.arrPos = arrPos !== null && arrPos !== void 0 ? arrPos : -1;
317
+ }
318
+ get value() {
319
+ if (this.key == "" && this.arrPos >= 0) {
320
+ return this._value[this.arrPos];
321
+ }
322
+ else if (this.key && this.arrPos >= 0) {
323
+ return this._value[this.key][this.arrPos];
324
+ }
325
+ return this._value[this.key];
326
+ }
327
+ set value(val) {
328
+ if (this.key == "" && this.arrPos >= 0) {
329
+ this._value[this.arrPos] = val;
330
+ return;
331
+ }
332
+ else if (this.key && this.arrPos >= 0) {
333
+ this._value[this.key][this.arrPos] = val;
334
+ return;
335
+ }
336
+ this._value[this.key] = val;
337
+ }
338
+ }
339
+ /*default value for absent*/
340
+ ConfigEntry.absent = ConfigEntry.fromNullable(null);
341
+ exports.CONFIG_VALUE = "__END_POINT__";
342
+ exports.CONFIG_ANY = "__ANY_POINT__";
343
+ /**
344
+ * Config, basically an optional wrapper for a json structure
345
+ * (not Side - effect free, since we can alter the internal config state
346
+ * without generating a new config), not sure if we should make it side - effect free
347
+ * since this would swallow a lot of performance and ram
348
+ */
349
+ class Config extends Monad_1.Optional {
350
+ constructor(root, configDef) {
351
+ super(root);
352
+ this.configDef = configDef;
353
+ }
354
+ /**
355
+ * shallow copy getter, copies only the first level, references the deeper nodes
356
+ * in a shared manner
357
+ */
358
+ get shallowCopy() {
359
+ return this.shallowCopy$();
360
+ }
361
+ shallowCopy$() {
362
+ let ret = new Config({});
363
+ ret.shallowMerge(this.value);
364
+ return ret;
365
+ }
366
+ /**
367
+ * deep copy, copies all config nodes
368
+ */
369
+ get deepCopy() {
370
+ return this.deepCopy$();
371
+ }
372
+ deepCopy$() {
373
+ return new Config(objAssign({}, this.value));
374
+ }
375
+ /**
376
+ * creates a config from an initial value or null
377
+ * @param value
378
+ */
379
+ static fromNullable(value) {
380
+ return new Config(value);
381
+ }
382
+ /**
383
+ * simple merge for the root configs
384
+ */
385
+ shallowMerge(other, overwrite = true, withAppend = false) {
386
+ //shallow merge must be mutable so we have to remap
387
+ let newThis = (0, AssocArray_1.shallowMerge)(overwrite, withAppend, this.value, other.value);
388
+ if (Array.isArray(this._value)) {
389
+ this._value.length = 0;
390
+ this._value.push(...newThis);
391
+ }
392
+ else {
393
+ Object.getOwnPropertyNames(this._value).forEach(key => delete this._value[key]);
394
+ Object.getOwnPropertyNames(newThis).forEach(key => this._value[key] = newThis[key]);
395
+ }
396
+ }
397
+ /**
398
+ * assigns a single value as array, or appends it
399
+ * to an existing value mapping a single value to array
400
+ *
401
+ *
402
+ * usage myConfig.append("foobaz").value = "newValue"
403
+ * myConfig.append("foobaz").value = "newValue2"
404
+ *
405
+ * resulting in myConfig.foobaz == ["newValue, newValue2"]
406
+ *
407
+ * @param {string[]} accessPath
408
+ */
409
+ append(...accessPath) {
410
+ return (0, AssocArray_1.append)(this._value, ...accessPath);
411
+ }
412
+ /**
413
+ * appends to an existing entry (or extends into an array and appends)
414
+ * if the condition is met
415
+ * @param {boolean} condition
416
+ * @param {string[]} accessPath
417
+ */
418
+ appendIf(condition, ...accessPath) {
419
+ return (0, AssocArray_1.appendIf)(condition, this._value, ...accessPath);
420
+ }
421
+ /**
422
+ * assigns a new value on the given access path
423
+ * @param accessPath
424
+ */
425
+ assign(...accessPath) {
426
+ return (0, AssocArray_1.assign)(this.value, ...accessPath);
427
+ }
428
+ /**
429
+ * assign a value if the condition is set to true, otherwise skip it
430
+ *
431
+ * @param condition the condition, the access accessPath into the config
432
+ * @param accessPath
433
+ */
434
+ assignIf(condition, ...accessPath) {
435
+ return (0, AssocArray_1.assignIf)(condition, this._value, ...accessPath);
436
+ }
437
+ /**
438
+ * get if the access path is present (get is reserved as getter with a default, on the current path)
439
+ * TODO will be renamed to something more meaningful and deprecated, the name is ambiguous
440
+ * @param accessPath the access path
441
+ */
442
+ getIf(...accessPath) {
443
+ this.assertAccessPath(...accessPath);
444
+ return this.getClass().fromNullable((0, AssocArray_1.resolve)(this.value, ...accessPath));
445
+ }
446
+ /**
447
+ * gets the current node and if none is present returns a config with a default value
448
+ * @param defaultVal
449
+ */
450
+ get(defaultVal) {
451
+ return this.getClass().fromNullable(super.get(defaultVal).value);
452
+ }
453
+ //empties the current config entry
454
+ delete(key) {
455
+ if (key in this.value) {
456
+ delete this.value[key];
457
+ }
458
+ return this;
459
+ }
460
+ /**
461
+ * converts the entire config into a json object
462
+ */
463
+ toJson() {
464
+ return JSON.stringify(this.value);
465
+ }
466
+ getClass() {
467
+ return Config;
468
+ }
469
+ setVal(val) {
470
+ this._value = val;
471
+ }
472
+ /**
473
+ * asserts the access path for a semi typed access
474
+ * @param accessPath
475
+ * @private
476
+ */
477
+ assertAccessPath(...accessPath) {
478
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
479
+ accessPath = this.preprocessKeys(...accessPath);
480
+ if (!this.configDef) {
481
+ //untyped
482
+ return;
483
+ }
484
+ const ERR_ACCESS_PATH = "Access Path to config invalid";
485
+ let currAccessPos = Monad_1.Optional.fromNullable(Object.keys(this.configDef).map(key => {
486
+ let ret = {};
487
+ ret[key] = this.configDef[key];
488
+ return ret;
489
+ }));
490
+ for (let cnt = 0; cnt < accessPath.length; cnt++) {
491
+ let currKey = this.keyVal(accessPath[cnt]);
492
+ let arrPos = this.arrayIndex(accessPath[cnt]);
493
+ //key index
494
+ if (this.isArray(arrPos)) {
495
+ if (currKey != "") {
496
+ currAccessPos = Array.isArray(currAccessPos.value) ?
497
+ Monad_1.Optional.fromNullable((_b = (_a = new Es2019Array_1.Es2019Array(...currAccessPos.value)
498
+ .find(item => {
499
+ var _a;
500
+ return !!((_a = item === null || item === void 0 ? void 0 : item[currKey]) !== null && _a !== void 0 ? _a : false);
501
+ })) === null || _a === void 0 ? void 0 : _a[currKey]) === null || _b === void 0 ? void 0 : _b[arrPos]) :
502
+ Monad_1.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);
503
+ }
504
+ else {
505
+ currAccessPos = (Array.isArray(currAccessPos.value)) ?
506
+ Monad_1.Optional.fromNullable((_f = currAccessPos.value) === null || _f === void 0 ? void 0 : _f[arrPos]) : Monad_1.Optional.absent;
507
+ }
508
+ //we noe store either the current array or the filtered look ahead to go further
509
+ }
510
+ else {
511
+ //we now have an array and go further with a singular key
512
+ currAccessPos = (Array.isArray(currAccessPos.value)) ? Monad_1.Optional.fromNullable((_g = new Es2019Array_1.Es2019Array(...currAccessPos.value)
513
+ .find(item => {
514
+ var _a;
515
+ return !!((_a = item === null || item === void 0 ? void 0 : item[currKey]) !== null && _a !== void 0 ? _a : false);
516
+ })) === null || _g === void 0 ? void 0 : _g[currKey]) :
517
+ Monad_1.Optional.fromNullable((_j = (_h = currAccessPos.value) === null || _h === void 0 ? void 0 : _h[currKey]) !== null && _j !== void 0 ? _j : null);
518
+ }
519
+ if (!currAccessPos.isPresent()) {
520
+ throw Error(ERR_ACCESS_PATH);
521
+ }
522
+ if (currAccessPos.value == exports.CONFIG_ANY) {
523
+ return;
524
+ }
525
+ }
526
+ }
527
+ isNoArray(arrPos) {
528
+ return arrPos == -1;
529
+ }
530
+ isArray(arrPos) {
531
+ return !this.isNoArray(arrPos);
532
+ }
533
+ }
534
+ exports.Config = Config;
535
+
536
+
537
+ /***/ }),
538
+
5
539
  /***/ "./node_modules/mona-dish/src/main/typescript/DomQuery.ts":
6
540
  /*!****************************************************************!*\
7
541
  !*** ./node_modules/mona-dish/src/main/typescript/DomQuery.ts ***!
@@ -37,14 +571,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
37
571
  Object.defineProperty(exports, "__esModule", ({ value: true }));
38
572
  exports.DQ$ = exports.DQ = exports.DomQueryCollector = exports.DomQuery = exports.Style = exports.ElementAttribute = void 0;
39
573
  const Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
40
- const Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
41
574
  const SourcesCollectors_1 = __webpack_require__(/*! ./SourcesCollectors */ "./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts");
42
575
  const Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
576
+ const Global_1 = __webpack_require__(/*! ./Global */ "./node_modules/mona-dish/src/main/typescript/Global.ts");
577
+ const Es2019Array_1 = __webpack_require__(/*! ./Es2019Array */ "./node_modules/mona-dish/src/main/typescript/Es2019Array.ts");
43
578
  var trim = Lang_1.Lang.trim;
44
579
  var isString = Lang_1.Lang.isString;
45
580
  var eqi = Lang_1.Lang.equalsIgnoreCase;
46
- const Global_1 = __webpack_require__(/*! ./Global */ "./node_modules/mona-dish/src/main/typescript/Global.ts");
47
581
  var objToArray = Lang_1.Lang.objToArray;
582
+ const AssocArray_1 = __webpack_require__(/*! ./AssocArray */ "./node_modules/mona-dish/src/main/typescript/AssocArray.ts");
48
583
  /**
49
584
  *
50
585
  * // - submit checkboxes and radio inputs only if checked
@@ -271,6 +806,12 @@ class DomQuery {
271
806
  get global() {
272
807
  return Global_1._global$;
273
808
  }
809
+ get stream() {
810
+ throw Error("Not implemented, include Stream.ts for this to work");
811
+ }
812
+ get lazyStream() {
813
+ throw Error("Not implemented, include Stream.ts for this to work");
814
+ }
274
815
  /**
275
816
  * returns the id of the first element
276
817
  */
@@ -347,7 +888,7 @@ class DomQuery {
347
888
  this.id.value = value;
348
889
  }
349
890
  get checked() {
350
- return Stream_1.Stream.of(...this.values).allMatch(el => !!el.checked);
891
+ return new Es2019Array_1.Es2019Array(...this.values).every(el => !!el.checked);
351
892
  }
352
893
  set checked(newChecked) {
353
894
  this.eachElem(el => el.checked = newChecked);
@@ -405,58 +946,41 @@ class DomQuery {
405
946
  });
406
947
  return new DomQuery(...childNodeArr);
407
948
  }
408
- /**
409
- * binding into stream
410
- */
411
- get stream() {
412
- return new Stream_1.Stream(...this.asArray);
413
- }
414
- /**
415
- * fetches a lazy stream representation
416
- * lazy should be applied if you have some filters etc.
417
- * in between, this can reduce the number of post filter operations
418
- * and ram usage
419
- * significantly because the operations are done lazily and stop
420
- * once they hit a dead end.
421
- */
422
- get lazyStream() {
423
- return Stream_1.LazyStream.of(...this.asArray);
424
- }
425
949
  get asArray() {
426
950
  // filter not supported by IE11
427
- return [].concat(Stream_1.LazyStream.of(...this.rootNode).filter(item => {
951
+ let items = new Es2019Array_1.Es2019Array(...this.rootNode).filter(item => {
428
952
  return item != null;
429
- })
430
- .map(item => {
953
+ }).map(item => {
431
954
  return DomQuery.byId(item);
432
- }).collect(new SourcesCollectors_1.ArrayCollector()));
955
+ });
956
+ return items;
433
957
  }
434
958
  get offsetWidth() {
435
- return Stream_1.LazyStream.of(...this.rootNode)
959
+ return new Es2019Array_1.Es2019Array(...this.rootNode)
436
960
  .filter(item => item != null)
437
961
  .map(elem => elem.offsetWidth)
438
- .reduce((accumulate, incoming) => accumulate + incoming, 0).value;
962
+ .reduce((accumulate, incoming) => accumulate + incoming, 0);
439
963
  }
440
964
  get offsetHeight() {
441
- return Stream_1.LazyStream.of(...this.rootNode)
965
+ return new Es2019Array_1.Es2019Array(...this.rootNode)
442
966
  .filter(item => item != null)
443
967
  .map(elem => elem.offsetHeight)
444
- .reduce((accumulate, incoming) => accumulate + incoming, 0).value;
968
+ .reduce((accumulate, incoming) => accumulate + incoming, 0);
445
969
  }
446
970
  get offsetLeft() {
447
- return Stream_1.LazyStream.of(...this.rootNode)
971
+ return new Es2019Array_1.Es2019Array(...this.rootNode)
448
972
  .filter(item => item != null)
449
973
  .map(elem => elem.offsetLeft)
450
- .reduce((accumulate, incoming) => accumulate + incoming, 0).value;
974
+ .reduce((accumulate, incoming) => accumulate + incoming, 0);
451
975
  }
452
976
  get offsetTop() {
453
- return Stream_1.LazyStream.of(...this.rootNode)
977
+ return new Es2019Array_1.Es2019Array(this.rootNode)
454
978
  .filter(item => item != null)
455
979
  .map(elem => elem.offsetTop)
456
- .reduce((accumulate, incoming) => accumulate + incoming, 0).value;
980
+ .reduce((accumulate, incoming) => accumulate + incoming, 0);
457
981
  }
458
982
  get asNodeArray() {
459
- return [].concat(Stream_1.Stream.of(...this.rootNode).filter(item => item != null).collect(new SourcesCollectors_1.ArrayCollector()));
983
+ return new Es2019Array_1.Es2019Array(...this.rootNode.filter(item => item != null));
460
984
  }
461
985
  static querySelectorAllDeep(selector) {
462
986
  return new DomQuery(document).querySelectorAllDeep(selector);
@@ -520,10 +1044,10 @@ class DomQuery {
520
1044
  const doc = document.implementation.createHTMLDocument("");
521
1045
  markup = trim(markup);
522
1046
  let lowerMarkup = markup.toLowerCase();
523
- if (lowerMarkup.search(/\<\!doctype[^\w\-]+/gi) != -1 ||
524
- lowerMarkup.search(/\<html[^\w\-]+/gi) != -1 ||
525
- lowerMarkup.search(/\<head[^\w\-]+/gi) != -1 ||
526
- lowerMarkup.search(/\<body[^\w\-]+/gi) != -1) {
1047
+ if (lowerMarkup.search(/<!doctype[^\w\-]+/gi) != -1 ||
1048
+ lowerMarkup.search(/<html[^\w\-]+/gi) != -1 ||
1049
+ lowerMarkup.search(/<head[^\w\-]+/gi) != -1 ||
1050
+ lowerMarkup.search(/<body[^\w\-]+/gi) != -1) {
527
1051
  doc.documentElement.innerHTML = markup;
528
1052
  return new DomQuery(doc.documentElement);
529
1053
  }
@@ -655,10 +1179,9 @@ class DomQuery {
655
1179
  byId(id, includeRoot) {
656
1180
  let res = [];
657
1181
  if (includeRoot) {
658
- res = res.concat(Stream_1.LazyStream.of(...((this === null || this === void 0 ? void 0 : this.rootNode) || []))
659
- .filter(item => id == item.id)
660
- .map(item => new DomQuery(item))
661
- .collect(new SourcesCollectors_1.ArrayCollector()));
1182
+ res = res.concat(...new Es2019Array_1.Es2019Array(...((this === null || this === void 0 ? void 0 : this.rootNode) || []))
1183
+ .filter(((item) => id == item.id))
1184
+ .map(item => new DomQuery(item)));
662
1185
  }
663
1186
  // for some strange kind of reason the # selector fails
664
1187
  // on hidden elements we use the attributes match selector
@@ -669,10 +1192,9 @@ class DomQuery {
669
1192
  byIdDeep(id, includeRoot) {
670
1193
  let res = [];
671
1194
  if (includeRoot) {
672
- res = res.concat(Stream_1.LazyStream.of(...((this === null || this === void 0 ? void 0 : this.rootNode) || []))
1195
+ res = res.concat(new Es2019Array_1.Es2019Array(...((this === null || this === void 0 ? void 0 : this.rootNode) || []))
673
1196
  .filter(item => id == item.id)
674
- .map(item => new DomQuery(item))
675
- .collect(new SourcesCollectors_1.ArrayCollector()));
1197
+ .map(item => new DomQuery(item)));
676
1198
  }
677
1199
  let subItems = this.querySelectorAllDeep(`[id="${id}"]`);
678
1200
  if (subItems.length) {
@@ -690,10 +1212,9 @@ class DomQuery {
690
1212
  var _a;
691
1213
  let res = [];
692
1214
  if (includeRoot) {
693
- res = Stream_1.LazyStream.of(...((_a = this === null || this === void 0 ? void 0 : this.rootNode) !== null && _a !== void 0 ? _a : []))
1215
+ res = new Es2019Array_1.Es2019Array(...((_a = this === null || this === void 0 ? void 0 : this.rootNode) !== null && _a !== void 0 ? _a : []))
694
1216
  .filter(element => (element === null || element === void 0 ? void 0 : element.tagName) == tagName)
695
- .reduce((reduction, item) => reduction.concat([item]), res)
696
- .orElse(res).value;
1217
+ .reduce((reduction, item) => reduction.concat([item]), res);
697
1218
  }
698
1219
  (deep) ? res.push(this.querySelectorAllDeep(tagName)) : res.push(this.querySelectorAll(tagName));
699
1220
  return new DomQuery(...res);
@@ -826,11 +1347,8 @@ class DomQuery {
826
1347
  * @param selector
827
1348
  */
828
1349
  matchesSelector(selector) {
829
- const ret = this.lazyStream
830
- .map(item => this._mozMatchesSelector(item.getAsElem(0).value, selector))
831
- .filter(match => match)
832
- .first();
833
- return ret.isPresent();
1350
+ return this.asArray
1351
+ .some(item => this._mozMatchesSelector(item.getAsElem(0).value, selector));
834
1352
  }
835
1353
  /**
836
1354
  * easy node traversal, you can pass
@@ -871,8 +1389,8 @@ class DomQuery {
871
1389
  return this;
872
1390
  }
873
1391
  each(func) {
874
- Stream_1.Stream.of(...this.rootNode)
875
- .each((item, cnt) => {
1392
+ new Es2019Array_1.Es2019Array(...this.rootNode)
1393
+ .forEach((item, cnt) => {
876
1394
  // we could use a filter, but for the best performance we don´t
877
1395
  if (item == null) {
878
1396
  return;
@@ -1224,7 +1742,7 @@ class DomQuery {
1224
1742
  // scripts before we run the 'include' command
1225
1743
  // this.globalEval(finalScripts.join("\n"));
1226
1744
  let joinedScripts = [];
1227
- Stream_1.Stream.of(...scriptsToProcess).each(item => {
1745
+ new Es2019Array_1.Es2019Array(...scriptsToProcess).forEach(item => {
1228
1746
  if (!item.nonce) {
1229
1747
  joinedScripts.push(item.evalText);
1230
1748
  }
@@ -1310,10 +1828,10 @@ class DomQuery {
1310
1828
  try {
1311
1829
  let scriptElements = new DomQuery(this.filterSelector("script"), this.querySelectorAll("script"));
1312
1830
  // script execution order by relative pos in their dom tree
1313
- scriptElements.stream
1314
- .flatMap(item => Stream_1.Stream.of(...item.values))
1831
+ scriptElements.asArray
1832
+ .flatMap(item => [...item.values])
1315
1833
  .sort((node1, node2) => node1.compareDocumentPosition(node2) - 3) // preceding 2, following == 4)
1316
- .each(item => execScript(item));
1834
+ .forEach(item => execScript(item));
1317
1835
  evalCollectedScripts(finalScripts);
1318
1836
  }
1319
1837
  catch (e) {
@@ -1356,19 +1874,20 @@ class DomQuery {
1356
1874
  else if (tagName && eqi(tagName, "style")) {
1357
1875
  let innerText = _toReplace.innerHTML.replace(/\s+/gi, "");
1358
1876
  let styles = head.querySelectorAll("style");
1359
- styles = styles.stream.filter(style => {
1877
+ let filteredStyles = styles.asArray.filter(style => {
1360
1878
  return style.innerHTML.replace(/\s+/gi, "") == innerText;
1361
- }).collect(new DomQueryCollector());
1879
+ });
1880
+ styles = new DomQuery(...filteredStyles);
1362
1881
  if (!styles.length) { //already present
1363
1882
  head.append(_toReplace);
1364
1883
  }
1365
1884
  }
1366
1885
  };
1367
1886
  const scriptElements = new DomQuery(this.filterSelector("link, style"), this.querySelectorAll("link, style"));
1368
- scriptElements.stream
1369
- .flatMap(item => Stream_1.Stream.of(...item.values))
1887
+ scriptElements.asArray
1888
+ .flatMap(item => [...item.values])
1370
1889
  .sort((node1, node2) => node1.compareDocumentPosition(node2) - 3)
1371
- .each(item => execCss(item));
1890
+ .forEach(item => execCss(item));
1372
1891
  return this;
1373
1892
  }
1374
1893
  /**
@@ -1391,9 +1910,10 @@ class DomQuery {
1391
1910
  */
1392
1911
  fireEvent(eventName, options = {}) {
1393
1912
  // merge with last one having the highest priority
1394
- let finalOptions = Stream_1.Stream.ofAssoc({
1913
+ let finalOptions = {
1395
1914
  bubbles: true, cancelable: true
1396
- }).concat(Stream_1.Stream.ofAssoc(options)).collect(new SourcesCollectors_1.AssocArrayCollector());
1915
+ };
1916
+ finalOptions = (0, AssocArray_1.simpleShallowMerge)(finalOptions, options);
1397
1917
  this.eachElem((node) => {
1398
1918
  let doc;
1399
1919
  if (node.ownerDocument) {
@@ -1444,15 +1964,13 @@ class DomQuery {
1444
1964
  // IE-old school style, you can drop this if you don't need to support IE8 and lower
1445
1965
  let event = doc.createEventObject();
1446
1966
  event.synthetic = true; // allow detection of synthetic events
1447
- Stream_1.Stream.ofAssoc(finalOptions).each(([key, value]) => {
1448
- event[key] = value;
1449
- });
1967
+ Object.keys(finalOptions).forEach(key => event[key] = finalOptions[key]);
1450
1968
  node.fireEvent("on" + eventName, event);
1451
1969
  }
1452
1970
  });
1453
1971
  }
1454
1972
  textContent(joinString = "") {
1455
- return this.stream
1973
+ return this.asArray
1456
1974
  .map((value) => {
1457
1975
  let item = value.getAsElem(0).orElseLazy(() => {
1458
1976
  return {
@@ -1461,10 +1979,10 @@ class DomQuery {
1461
1979
  }).value;
1462
1980
  return item.textContent || "";
1463
1981
  })
1464
- .reduce((text1, text2) => [text1, joinString, text2].join(""), "").value;
1982
+ .reduce((text1, text2) => [text1, joinString, text2].join(""), "");
1465
1983
  }
1466
1984
  innerText(joinString = "") {
1467
- return this.stream
1985
+ return this.asArray
1468
1986
  .map((value) => {
1469
1987
  let item = value.getAsElem(0).orElseLazy(() => {
1470
1988
  return {
@@ -1473,7 +1991,9 @@ class DomQuery {
1473
1991
  }).value;
1474
1992
  return item.innerText || "";
1475
1993
  })
1476
- .reduce((text1, text2) => [text1, text2].join(joinString), "").value;
1994
+ .reduce((text1, text2) => {
1995
+ return [text1, text2].join(joinString);
1996
+ }, "");
1477
1997
  }
1478
1998
  /**
1479
1999
  * encodes all input elements properly into respective
@@ -1484,14 +2004,14 @@ class DomQuery {
1484
2004
  * @param toMerge optional config which can be merged in
1485
2005
  * @return a copy pf
1486
2006
  */
1487
- encodeFormElement(toMerge = new Monad_1.Config({})) {
2007
+ encodeFormElement(toMerge = {}) {
1488
2008
  // browser behavior no element name no encoding (normal submit fails in that case)
1489
2009
  // https:// issues.apache.org/jira/browse/MYFACES-2847
1490
2010
  if (this.name.isAbsent()) {
1491
2011
  return;
1492
2012
  }
1493
2013
  // let´s keep it side-effects free
1494
- let target = toMerge.shallowCopy;
2014
+ let target = (0, AssocArray_1.simpleShallowMerge)(toMerge);
1495
2015
  this.each((element) => {
1496
2016
  var _a, _b;
1497
2017
  if (element.name.isAbsent()) { // no name, no encoding
@@ -1526,7 +2046,7 @@ class DomQuery {
1526
2046
  // let subBuf = [];
1527
2047
  if (selectElem.options[u].selected) {
1528
2048
  let elementOption = selectElem.options[u];
1529
- target.append(name).value = (elementOption.getAttribute("value") != null) ?
2049
+ (0, AssocArray_1.append)(target, name).value = (elementOption.getAttribute("value") != null) ?
1530
2050
  elementOption.value : elementOption.text;
1531
2051
  }
1532
2052
  }
@@ -1546,14 +2066,14 @@ class DomQuery {
1546
2066
  let filesArr = uploadedFiles !== null && uploadedFiles !== void 0 ? uploadedFiles : [];
1547
2067
  if (filesArr === null || filesArr === void 0 ? void 0 : filesArr.length) { //files can be empty but set
1548
2068
  // xhr level2, single multiple must be passes as they are
1549
- target.assign(name).value = Array.from(filesArr);
2069
+ (0, AssocArray_1.assign)(target, name).value = Array.from(filesArr);
1550
2070
  }
1551
2071
  else {
1552
2072
  if (!!uploadedFiles) { //we skip empty file elements i
1553
2073
  return;
1554
2074
  }
1555
2075
  //checkboxes etc.. need to be appended
1556
- target.append(name).value = element.inputValue.value;
2076
+ (0, AssocArray_1.append)(target, name).value = element.inputValue.value;
1557
2077
  }
1558
2078
  }
1559
2079
  }
@@ -1562,16 +2082,27 @@ class DomQuery {
1562
2082
  }
1563
2083
  get cDATAAsString() {
1564
2084
  let TYPE_CDATA_BLOCK = 4;
1565
- let res = this.lazyStream.flatMap(item => {
1566
- return item.childNodes.stream;
1567
- }).filter(item => {
2085
+ let res = this.asArray
2086
+ .flatMap(item => {
2087
+ return item.childNodes.asArray;
2088
+ })
2089
+ .filter(item => {
1568
2090
  var _a, _b;
1569
2091
  return ((_b = (_a = item === null || item === void 0 ? void 0 : item.value) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.nodeType) == TYPE_CDATA_BLOCK;
1570
- }).reduce((reduced, item) => {
2092
+ })
2093
+ .reduce((reduced, item) => {
1571
2094
  var _a, _b, _c;
1572
2095
  reduced.push((_c = (_b = (_a = item === null || item === void 0 ? void 0 : item.value) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.data) !== null && _c !== void 0 ? _c : "");
1573
2096
  return reduced;
1574
- }, []).value;
2097
+ }, []);
2098
+ /*let res: any = this.lazyStream.flatMap(item => {
2099
+ return item.childNodes.stream
2100
+ }).filter(item => {
2101
+ return item?.value?.value?.nodeType == TYPE_CDATA_BLOCK;
2102
+ }).reduce((reduced: Array<any>, item: DomQuery) => {
2103
+ reduced.push((<any>item?.value?.value)?.data ?? "");
2104
+ return reduced;
2105
+ }, []).value;*/
1575
2106
  // response may contain several blocks
1576
2107
  return res.join("");
1577
2108
  }
@@ -1728,17 +2259,18 @@ class DomQuery {
1728
2259
  * @param filterDoubles filter out possible double elements (aka same markup)
1729
2260
  */
1730
2261
  concat(toAttach, filterDoubles = true) {
1731
- const ret = this.lazyStream.concat(toAttach.lazyStream).collect(new DomQueryCollector());
2262
+ let domQueries = this.asArray;
2263
+ const ret = new DomQuery(...domQueries.concat(toAttach.asArray));
1732
2264
  // we now filter the doubles out
1733
2265
  if (!filterDoubles) {
1734
2266
  return ret;
1735
2267
  }
1736
2268
  let idx = {}; // ie11 does not support sets, we have to fake it
1737
- return ret.lazyStream.filter(node => {
2269
+ return new DomQuery(...ret.asArray.filter(node => {
1738
2270
  const notFound = !(idx === null || idx === void 0 ? void 0 : idx[node.value.value.outerHTML]);
1739
2271
  idx[node.value.value.outerHTML] = true;
1740
2272
  return notFound;
1741
- }).collect(new DomQueryCollector());
2273
+ }));
1742
2274
  }
1743
2275
  append(elem) {
1744
2276
  this.each(item => elem.appendTo(item));
@@ -1773,7 +2305,7 @@ class DomQuery {
1773
2305
  continue;
1774
2306
  }
1775
2307
  let res = this.rootNode[cnt].querySelectorAll(selector);
1776
- nodes = nodes.concat(objToArray(res));
2308
+ nodes = nodes.concat(...objToArray(res));
1777
2309
  }
1778
2310
  return new DomQuery(...nodes);
1779
2311
  }
@@ -1976,16 +2508,142 @@ class DomQueryCollector {
1976
2508
  return new DomQuery(...this.data);
1977
2509
  }
1978
2510
  }
1979
- exports.DomQueryCollector = DomQueryCollector;
1980
- /**
1981
- * abbreviation for DomQuery
1982
- */
1983
- exports.DQ = DomQuery;
1984
- // noinspection JSUnusedGlobalSymbols
2511
+ exports.DomQueryCollector = DomQueryCollector;
2512
+ /**
2513
+ * abbreviation for DomQuery
2514
+ */
2515
+ exports.DQ = DomQuery;
2516
+ // noinspection JSUnusedGlobalSymbols
2517
+ /**
2518
+ * replacement for the jquery $
2519
+ */
2520
+ exports.DQ$ = DomQuery.querySelectorAll;
2521
+
2522
+
2523
+ /***/ }),
2524
+
2525
+ /***/ "./node_modules/mona-dish/src/main/typescript/Es2019Array.ts":
2526
+ /*!*******************************************************************!*\
2527
+ !*** ./node_modules/mona-dish/src/main/typescript/Es2019Array.ts ***!
2528
+ \*******************************************************************/
2529
+ /***/ ((__unused_webpack_module, exports) => {
2530
+
2531
+
2532
+ /**
2533
+ * Extended array
2534
+ */
2535
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
2536
+ exports.Es2019Array = exports._Es2019Array = void 0;
2537
+ /**
2538
+ * Extended array which adds various es 2019 shim functions to the normal array
2539
+ * We must remap all array producing functions in order to keep
2540
+ * the delegation active, once we are in!
2541
+ */
2542
+ class Es2019Array_ extends Array {
2543
+ constructor(...another) {
2544
+ super(...another);
2545
+ if (another._another) {
2546
+ this._another = another._another;
2547
+ }
2548
+ else {
2549
+ this._another = another;
2550
+ }
2551
+ //for testing it definitely runs into this branch because we are on es5 level
2552
+ //if (!(<any>Array.prototype).flatMap) {
2553
+ this.flatMap = (flatMapFun) => this._flatMap(flatMapFun);
2554
+ //}
2555
+ //if (!(<any>Array.prototype).flat) {
2556
+ this.flat = (flatLevel = 1) => this._flat(flatLevel);
2557
+ //}
2558
+ }
2559
+ map(callbackfn, thisArg) {
2560
+ const ret = Array.prototype.map.call(this._another, callbackfn, thisArg);
2561
+ return new _Es2019Array(...ret);
2562
+ }
2563
+ concat(...items) {
2564
+ const ret = Array.prototype.concat.call(this._another, ...items);
2565
+ return new _Es2019Array(...ret);
2566
+ }
2567
+ reverse() {
2568
+ const ret = Array.prototype.reverse.call(this._another);
2569
+ return new _Es2019Array(...ret);
2570
+ }
2571
+ slice(start, end) {
2572
+ const ret = Array.prototype.slice.call(this._another, start, end);
2573
+ return new _Es2019Array(...ret);
2574
+ }
2575
+ splice(start, deleteCount) {
2576
+ const ret = Array.prototype.splice.call(this._another, start, deleteCount);
2577
+ return new _Es2019Array(...ret);
2578
+ }
2579
+ filter(predicate, thisArg) {
2580
+ const ret = Array.prototype.filter.call(this._another, predicate, thisArg);
2581
+ return new _Es2019Array(...ret);
2582
+ }
2583
+ reduce(callbackfn, initialValue) {
2584
+ const ret = Array.prototype.reduce.call(this._another, callbackfn, initialValue);
2585
+ return ret;
2586
+ }
2587
+ /*reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T {
2588
+ const ret = Array.prototype.reduceRight.call(callbackfn, initialValue);
2589
+ return ret;
2590
+ }*/
2591
+ _flat(flatDepth = 1) {
2592
+ return this._flatResolve(this._another, flatDepth);
2593
+ }
2594
+ _flatResolve(arr, flatDepth = 1) {
2595
+ //recursion break
2596
+ if (flatDepth == 0) {
2597
+ return arr;
2598
+ }
2599
+ let res = [];
2600
+ let reFlat = item => {
2601
+ item = Array.isArray(item) ? item : [item];
2602
+ let mapped = this._flatResolve(item, flatDepth - 1);
2603
+ res = res.concat(mapped);
2604
+ };
2605
+ arr.forEach(reFlat);
2606
+ return new exports.Es2019Array(...res);
2607
+ }
2608
+ _flatMap(mapperFunction) {
2609
+ let res = this.map(item => mapperFunction(item));
2610
+ return this._flatResolve(res);
2611
+ }
2612
+ }
2613
+ //let _Es2019Array = function<T>(...data: T[]) {};
2614
+ //let oldProto = Es2019Array.prototype;
2615
+ function _Es2019Array(...data) {
2616
+ let ret = new Es2019Array_(...data);
2617
+ let proxied = new Proxy(ret, {
2618
+ get(target, p, receiver) {
2619
+ if ("symbol" == typeof p) {
2620
+ return target._another[p];
2621
+ }
2622
+ if (!isNaN(parseInt(p))) {
2623
+ return target._another[p];
2624
+ }
2625
+ else {
2626
+ return target[p];
2627
+ }
2628
+ },
2629
+ set(target, property, value) {
2630
+ target[property] = value;
2631
+ target._another[property] = value;
2632
+ return true;
2633
+ }
2634
+ });
2635
+ return proxied;
2636
+ }
2637
+ exports._Es2019Array = _Es2019Array;
2638
+ ;
1985
2639
  /**
1986
- * replacement for the jquery $
2640
+ * this is the switch between normal array and our shim
2641
+ * the shim is only provided in case the native browser
2642
+ * does not yet have flatMap support on arrays
1987
2643
  */
1988
- exports.DQ$ = DomQuery.querySelectorAll;
2644
+ exports.Es2019Array = (Array.prototype.flatMap) ? function (...data) {
2645
+ return data;
2646
+ } : _Es2019Array;
1989
2647
 
1990
2648
 
1991
2649
  /***/ }),
@@ -2063,6 +2721,7 @@ exports._global$ = _global$;
2063
2721
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2064
2722
  exports.Lang = void 0;
2065
2723
  const Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
2724
+ const Es2019Array_1 = __webpack_require__(/*! ./Es2019Array */ "./node_modules/mona-dish/src/main/typescript/Es2019Array.ts");
2066
2725
  /**
2067
2726
  * Lang helpers crossported from the apache myfaces project
2068
2727
  */
@@ -2070,7 +2729,7 @@ var Lang;
2070
2729
  (function (Lang) {
2071
2730
  //should be in lang, but for now here to avoid recursive imports, not sure if typescript still has a problem with those
2072
2731
  /**
2073
- * helper function to savely resolve anything
2732
+ * helper function to safely resolve anything
2074
2733
  * this is not an elvis operator, it resolves
2075
2734
  * a value without exception in a tree and if
2076
2735
  * it is not resolvable then an optional of
@@ -2096,6 +2755,12 @@ var Lang;
2096
2755
  }
2097
2756
  }
2098
2757
  Lang.saveResolve = saveResolve;
2758
+ /**
2759
+ * lazy resolve... aka the function is called on resolve and a default value also
2760
+ * is a producing function (called only if the original producer does not produce any result)
2761
+ * @param resolverProducer the producer for the resolve
2762
+ * @param defaultValue the default value producer function
2763
+ */
2099
2764
  function saveResolveLazy(resolverProducer, defaultValue = null) {
2100
2765
  try {
2101
2766
  let result = resolverProducer();
@@ -2150,11 +2815,11 @@ var Lang;
2150
2815
  //special condition array delivered no offset no pack
2151
2816
  if (obj instanceof Array && !offset && !pack)
2152
2817
  return obj;
2153
- return pack.concat(Array.prototype.slice.call(obj, offset));
2818
+ return new Es2019Array_1.Es2019Array(...pack.concat(Array.prototype.slice.call(obj, offset)));
2154
2819
  }
2155
2820
  Lang.objToArray = objToArray;
2156
2821
  /**
2157
- * equalsIgnoreCase, case insensitive comparison of two strings
2822
+ * equalsIgnoreCase, case-insensitive comparison of two strings
2158
2823
  *
2159
2824
  * @param source
2160
2825
  * @param destination
@@ -2177,7 +2842,7 @@ var Lang;
2177
2842
  }
2178
2843
  Lang.assertType = assertType;
2179
2844
  /**
2180
- * Backported from dojo
2845
+ * Back ported from Dojo
2181
2846
  * a failsafe string determination method
2182
2847
  * (since in javascript String != "" typeof alone fails!)
2183
2848
  * @param it {|Object|} the object to be checked for being a string
@@ -2189,6 +2854,10 @@ var Lang;
2189
2854
  return !!arguments.length && it != null && (typeof it == "string" || it instanceof String); // Boolean
2190
2855
  }
2191
2856
  Lang.isString = isString;
2857
+ /**
2858
+ * Back-ported, a failsafe determination code for checking whether an object is a function
2859
+ * @param it the object to check for being a function
2860
+ */
2192
2861
  function isFunc(it) {
2193
2862
  return it instanceof Function || typeof it === "function";
2194
2863
  }
@@ -2242,19 +2911,11 @@ var Lang;
2242
2911
  * limitations under the License.
2243
2912
  */
2244
2913
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2245
- exports.Config = exports.CONFIG_ANY = exports.CONFIG_VALUE = exports.ValueEmbedder = exports.Optional = exports.Monad = void 0;
2246
- /**
2247
- * A module which keeps basic monadish like definitions in place without any sidedependencies to other modules.
2248
- * Useful if you need the functions in another library to keep its dependencies down
2249
- */
2250
- /*IMonad definitions*/
2251
- const Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
2252
- const SourcesCollectors_1 = __webpack_require__(/*! ./SourcesCollectors */ "./node_modules/mona-dish/src/main/typescript/SourcesCollectors.ts");
2253
- const Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
2254
- var objAssign = Lang_1.Lang.objAssign;
2914
+ exports.ValueEmbedder = exports.Optional = exports.Monad = void 0;
2915
+ const Es2019Array_1 = __webpack_require__(/*! ./Es2019Array */ "./node_modules/mona-dish/src/main/typescript/Es2019Array.ts");
2255
2916
  /**
2256
2917
  * Implementation of a monad
2257
- * (Sideffect free), no write allowed directly on the monads
2918
+ * (Side - effect free), no write allowed directly on the monads
2258
2919
  * value state
2259
2920
  */
2260
2921
  class Monad {
@@ -2266,7 +2927,7 @@ class Monad {
2266
2927
  }
2267
2928
  map(fn) {
2268
2929
  if (!fn) {
2269
- fn = (inval) => inval;
2930
+ fn = (inVal) => inVal;
2270
2931
  }
2271
2932
  let result = fn(this.value);
2272
2933
  return new Monad(result);
@@ -2283,7 +2944,7 @@ exports.Monad = Monad;
2283
2944
  /**
2284
2945
  * optional implementation, an optional is basically an implementation of a Monad with additional syntactic
2285
2946
  * sugar on top
2286
- * (Sideeffect free, since value assignment is not allowed)
2947
+ * (Side - effect free, since value assignment is not allowed)
2287
2948
  * */
2288
2949
  class Optional extends Monad {
2289
2950
  constructor(value) {
@@ -2343,8 +3004,8 @@ class Optional extends Monad {
2343
3004
  }
2344
3005
  }
2345
3006
  /*
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
3007
+ * we need to implement it to fulfill the contract, although it is used only internally
3008
+ * all values are flattened when accessed anyway, so there is no need to call this method
2348
3009
  */
2349
3010
  flatMap(fn) {
2350
3011
  let val = super.flatMap(fn);
@@ -2355,7 +3016,7 @@ class Optional extends Monad {
2355
3016
  }
2356
3017
  /*
2357
3018
  * elvis operation, take care, if you use this you lose typesafety and refactoring
2358
- * capabilites, unfortunately typesceript does not allow to have its own elvis operator
3019
+ * capabilities, unfortunately typescript does not allow to have its own elvis operator
2359
3020
  * this is some syntactic sugar however which is quite useful*/
2360
3021
  getIf(...key) {
2361
3022
  key = this.preprocessKeys(...key);
@@ -2390,8 +3051,7 @@ class Optional extends Monad {
2390
3051
  currentPos = this.getClass().fromNullable(currentPos.value[arrPos]);
2391
3052
  }
2392
3053
  }
2393
- let retVal = currentPos;
2394
- return retVal;
3054
+ return currentPos;
2395
3055
  }
2396
3056
  /**
2397
3057
  * simple match, if the first order function call returns
@@ -2427,7 +3087,7 @@ class Optional extends Monad {
2427
3087
  * by having a getClass operation we can avoid direct calls into the constructor or
2428
3088
  * static methods and do not have to implement several methods which rely on the type
2429
3089
  * of "this"
2430
- * @returns {Monadish.Optional}
3090
+ * @returns the type of Optional
2431
3091
  */
2432
3092
  getClass() {
2433
3093
  return Optional;
@@ -2488,9 +3148,9 @@ class Optional extends Monad {
2488
3148
  }
2489
3149
  }
2490
3150
  preprocessKeys(...keys) {
2491
- return Stream_1.Stream.of(...keys)
3151
+ return new Es2019Array_1.Es2019Array(...keys)
2492
3152
  .flatMap(item => {
2493
- return Stream_1.Stream.of(...item.split(/\]\s*\[/gi))
3153
+ return new Es2019Array_1.Es2019Array(...item.split(/]\s*\[/gi))
2494
3154
  .map(item => {
2495
3155
  item = item.replace(/^\s+|\s+$/g, "");
2496
3156
  if (item.indexOf("[") == -1 && item.indexOf("]") != -1) {
@@ -2501,17 +3161,16 @@ class Optional extends Monad {
2501
3161
  }
2502
3162
  return item;
2503
3163
  });
2504
- })
2505
- .collect(new SourcesCollectors_1.ArrayCollector());
3164
+ });
2506
3165
  }
2507
3166
  }
2508
3167
  exports.Optional = Optional;
2509
3168
  /*default value for absent*/
2510
3169
  Optional.absent = Optional.fromNullable(null);
2511
- // --------------------- From here onwards we break out the sideffects free limits ------------
3170
+ // --------------------- From here onwards we break out the side effect free limits ------------
2512
3171
  /**
2513
3172
  * ValueEmbedder is the writeable version
2514
- * of optional, it basically is a wrappber
3173
+ * of optional, it basically is a wrapper
2515
3174
  * around a construct which has a state
2516
3175
  * and can be written to.
2517
3176
  *
@@ -2551,7 +3210,7 @@ class ValueEmbedder extends Optional {
2551
3210
  * by having a getClass operation we can avoid direct calls into the constructor or
2552
3211
  * static methods and do not have to implement several methods which rely on the type
2553
3212
  * of "this"
2554
- * @returns {Monadish.Optional}
3213
+ * @returns ValueEmbedder
2555
3214
  */
2556
3215
  getClass() {
2557
3216
  return ValueEmbedder;
@@ -2563,332 +3222,6 @@ class ValueEmbedder extends Optional {
2563
3222
  exports.ValueEmbedder = ValueEmbedder;
2564
3223
  /*default value for absent*/
2565
3224
  ValueEmbedder.absent = ValueEmbedder.fromNullable(null);
2566
- /**
2567
- * specialized value embedder
2568
- * for our Configuration
2569
- */
2570
- class ConfigEntry extends ValueEmbedder {
2571
- constructor(rootElem, key, arrPos) {
2572
- super(rootElem, key);
2573
- this.arrPos = arrPos !== null && arrPos !== void 0 ? arrPos : -1;
2574
- }
2575
- get value() {
2576
- if (this.key == "" && this.arrPos >= 0) {
2577
- return this._value[this.arrPos];
2578
- }
2579
- else if (this.key && this.arrPos >= 0) {
2580
- return this._value[this.key][this.arrPos];
2581
- }
2582
- return this._value[this.key];
2583
- }
2584
- set value(val) {
2585
- if (this.key == "" && this.arrPos >= 0) {
2586
- this._value[this.arrPos] = val;
2587
- return;
2588
- }
2589
- else if (this.key && this.arrPos >= 0) {
2590
- this._value[this.key][this.arrPos] = val;
2591
- return;
2592
- }
2593
- this._value[this.key] = val;
2594
- }
2595
- }
2596
- /*default value for absent*/
2597
- ConfigEntry.absent = ConfigEntry.fromNullable(null);
2598
- exports.CONFIG_VALUE = "__END_POINT__";
2599
- exports.CONFIG_ANY = "__ANY_POINT__";
2600
- const ALL_VALUES = "*";
2601
- /**
2602
- * Config, basically an optional wrapper for a json structure
2603
- * (not sideeffect free, since we can alter the internal config state
2604
- * without generating a new config), not sure if we should make it sideffect free
2605
- * since this would swallow a lot of performane and ram
2606
- */
2607
- class Config extends Optional {
2608
- constructor(root, configDef) {
2609
- super(root);
2610
- this.configDef = configDef;
2611
- }
2612
- /**
2613
- * shallow copy getter, copies only the first level, references the deeper nodes
2614
- * in a shared manner
2615
- */
2616
- get shallowCopy() {
2617
- return this.shallowCopy$();
2618
- }
2619
- shallowCopy$() {
2620
- return new Config(Stream_1.Stream.ofAssoc(this.value).collect(new SourcesCollectors_1.AssocArrayCollector()));
2621
- }
2622
- /**
2623
- * deep copy, copies all config nodes
2624
- */
2625
- get deepCopy() {
2626
- return this.deepCopy$();
2627
- }
2628
- deepCopy$() {
2629
- return new Config(objAssign({}, this.value));
2630
- }
2631
- /**
2632
- * creates a config from an initial value or null
2633
- * @param value
2634
- */
2635
- static fromNullable(value) {
2636
- return new Config(value);
2637
- }
2638
- /**
2639
- * simple merge for the root configs
2640
- */
2641
- shallowMerge(other, overwrite = true, withAppend = false) {
2642
- for (let key in other.value) {
2643
- if ('undefined' == typeof key || null == key) {
2644
- continue;
2645
- }
2646
- if (overwrite || !(key in this.value)) {
2647
- if (!withAppend) {
2648
- this.assign(key).value = other.getIf(key).value;
2649
- }
2650
- else {
2651
- if (Array.isArray(other.getIf(key).value)) {
2652
- Stream_1.Stream.of(...other.getIf(key).value).each(item => this.append(key).value = item);
2653
- }
2654
- else {
2655
- this.append(key).value = other.getIf(key).value;
2656
- }
2657
- }
2658
- }
2659
- }
2660
- }
2661
- /**
2662
- * assigns a single value as array, or appends it
2663
- * to an existing value mapping a single value to array
2664
- *
2665
- *
2666
- * usage myConfig.append("foobaz").value = "newValue"
2667
- * myConfig.append("foobaz").value = "newValue2"
2668
- *
2669
- * resulting in myConfig.foobaz == ["newValue, newValue2"]
2670
- *
2671
- * @param {string[]} accessPath
2672
- */
2673
- append(...accessPath) {
2674
- let noKeys = accessPath.length < 1;
2675
- if (noKeys) {
2676
- return;
2677
- }
2678
- this.assertAccessPath(...accessPath);
2679
- let lastKey = accessPath[accessPath.length - 1];
2680
- let currKey, finalKey = this.keyVal(lastKey);
2681
- let pathExists = this.getIf(...accessPath).isPresent();
2682
- this.buildPath(...accessPath);
2683
- let finalKeyArrPos = this.arrayIndex(lastKey);
2684
- if (finalKeyArrPos > -1) {
2685
- throw Error("Append only possible on non array properties, use assign on indexed data");
2686
- }
2687
- let value = this.getIf(...accessPath).value;
2688
- if (!Array.isArray(value)) {
2689
- value = this.assign(...accessPath).value = [value];
2690
- }
2691
- if (pathExists) {
2692
- value.push({});
2693
- }
2694
- finalKeyArrPos = value.length - 1;
2695
- let retVal = new ConfigEntry(accessPath.length == 1 ? this.value : this.getIf.apply(this, accessPath.slice(0, accessPath.length - 1)).value, lastKey, finalKeyArrPos);
2696
- return retVal;
2697
- }
2698
- /**
2699
- * appends to an existing entry (or extends into an array and appends)
2700
- * if the condition is met
2701
- * @param {boolean} condition
2702
- * @param {string[]} accessPath
2703
- */
2704
- appendIf(condition, ...accessPath) {
2705
- if (!condition) {
2706
- return { value: null };
2707
- }
2708
- return this.append(...accessPath);
2709
- }
2710
- /**
2711
- * assings an new value on the given access path
2712
- * @param accessPath
2713
- */
2714
- assign(...accessPath) {
2715
- if (accessPath.length < 1) {
2716
- return;
2717
- }
2718
- this.assertAccessPath(...accessPath);
2719
- this.buildPath(...accessPath);
2720
- let currKey = this.keyVal(accessPath[accessPath.length - 1]);
2721
- let arrPos = this.arrayIndex(accessPath[accessPath.length - 1]);
2722
- let retVal = new ConfigEntry(accessPath.length == 1 ? this.value : this.getIf.apply(this, accessPath.slice(0, accessPath.length - 1)).value, currKey, arrPos);
2723
- return retVal;
2724
- }
2725
- /**
2726
- * assign a value if the condition is set to true, otherwise skip it
2727
- *
2728
- * @param condition the condition, the access accessPath into the config
2729
- * @param accessPath
2730
- */
2731
- assignIf(condition, ...accessPath) {
2732
- return condition ? this.assign(...accessPath) : { value: null };
2733
- }
2734
- /**
2735
- * get if the access path is present (get is reserved as getter with a default, on the current path)
2736
- * TODO will be renamed to something more meaningful and deprecated, the name is ambigous
2737
- * @param accessPath the access path
2738
- */
2739
- getIf(...accessPath) {
2740
- this.assertAccessPath(...accessPath);
2741
- return this.getClass().fromNullable(super.getIf.apply(this, accessPath).value);
2742
- }
2743
- /**
2744
- * gets the current node and if none is present returns a config with a default value
2745
- * @param defaultVal
2746
- */
2747
- get(defaultVal) {
2748
- return this.getClass().fromNullable(super.get(defaultVal).value);
2749
- }
2750
- //empties the current config entry
2751
- delete(key) {
2752
- if (key in this.value) {
2753
- delete this.value[key];
2754
- }
2755
- return this;
2756
- }
2757
- /**
2758
- * converts the entire config into a json object
2759
- */
2760
- toJson() {
2761
- return JSON.stringify(this.value);
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
- }
2769
- getClass() {
2770
- return Config;
2771
- }
2772
- setVal(val) {
2773
- this._value = val;
2774
- }
2775
- /**
2776
- * asserts the access path for a semy typed access
2777
- * @param accessPath
2778
- * @private
2779
- */
2780
- assertAccessPath(...accessPath) {
2781
- var _a, _b;
2782
- accessPath = this.preprocessKeys(...accessPath);
2783
- if (!this.configDef) {
2784
- //untyped
2785
- return;
2786
- }
2787
- let currAccessPos = null;
2788
- const ERR_ACCESS_PATH = "Access Path to config invalid";
2789
- const ABSENT = "__ABSENT__";
2790
- currAccessPos = this.configDef;
2791
- for (let cnt = 0; cnt < accessPath.length; cnt++) {
2792
- let currKey = this.keyVal(accessPath[cnt]);
2793
- let arrPos = this.arrayIndex(accessPath[cnt]);
2794
- //key index
2795
- if (this.isArray(arrPos)) {
2796
- if (currKey != "") {
2797
- currAccessPos = (Array.isArray(currAccessPos)) ?
2798
- Stream_1.Stream.of(...currAccessPos)
2799
- .filter(item => { var _a; return !!((_a = item === null || item === void 0 ? void 0 : item[currKey]) !== null && _a !== void 0 ? _a : false); })
2800
- .map(item => item === null || item === void 0 ? void 0 : item[currKey]).first() :
2801
- Optional.fromNullable((_a = currAccessPos === null || currAccessPos === void 0 ? void 0 : currAccessPos[currKey]) !== null && _a !== void 0 ? _a : null);
2802
- }
2803
- else {
2804
- currAccessPos = (Array.isArray(currAccessPos)) ?
2805
- Stream_1.Stream.of(...currAccessPos)
2806
- .filter(item => Array.isArray(item))
2807
- .flatMap(item => Stream_1.Stream.of(...item)).first() : Optional.absent;
2808
- }
2809
- //we noe store either the current array or the filtered look ahead to go further
2810
- }
2811
- else {
2812
- //we now have an array and go further with a singular key
2813
- currAccessPos = (Array.isArray(currAccessPos)) ? Stream_1.Stream.of(...currAccessPos)
2814
- .filter(item => { var _a; return !!((_a = item === null || item === void 0 ? void 0 : item[currKey]) !== null && _a !== void 0 ? _a : false); })
2815
- .map(item => item === null || item === void 0 ? void 0 : item[currKey])
2816
- .first() :
2817
- Optional.fromNullable((_b = currAccessPos === null || currAccessPos === void 0 ? void 0 : currAccessPos[currKey]) !== null && _b !== void 0 ? _b : null);
2818
- }
2819
- if (!currAccessPos.isPresent()) {
2820
- throw Error(ERR_ACCESS_PATH);
2821
- }
2822
- currAccessPos = currAccessPos.value;
2823
- //no further testing needed, from this point onwards we are on our own
2824
- if (currAccessPos == exports.CONFIG_ANY) {
2825
- return;
2826
- }
2827
- }
2828
- }
2829
- /**
2830
- * builds the config path
2831
- *
2832
- * @param accessPath a sequential array of accessPath containing either a key name or an array reference name[<index>]
2833
- */
2834
- buildPath(...accessPath) {
2835
- accessPath = this.preprocessKeys(...accessPath);
2836
- let val = this;
2837
- let parentVal = this.getClass().fromNullable(null);
2838
- let parentPos = -1;
2839
- let alloc = function (arr, length) {
2840
- let length1 = arr.length;
2841
- let length2 = length1 + length;
2842
- for (let cnt = length1; cnt < length2; cnt++) {
2843
- arr.push({});
2844
- }
2845
- };
2846
- for (let cnt = 0; cnt < accessPath.length; cnt++) {
2847
- let currKey = this.keyVal(accessPath[cnt]);
2848
- let arrPos = this.arrayIndex(accessPath[cnt]);
2849
- if (this.isArrayPos(currKey, arrPos)) {
2850
- val.setVal((val.value instanceof Array) ? val.value : []);
2851
- alloc(val.value, arrPos + 1);
2852
- if (parentPos >= 0) {
2853
- parentVal.value[parentPos] = val.value;
2854
- }
2855
- parentVal = val;
2856
- parentPos = arrPos;
2857
- val = this.getClass().fromNullable(val.value[arrPos]);
2858
- continue;
2859
- }
2860
- let tempVal = val.getIf(currKey);
2861
- if (this.isNoArray(arrPos)) {
2862
- if (tempVal.isAbsent()) {
2863
- tempVal = this.getClass().fromNullable(val.value[currKey] = {});
2864
- }
2865
- else {
2866
- val = tempVal;
2867
- }
2868
- }
2869
- else {
2870
- let arr = (tempVal.value instanceof Array) ? tempVal.value : [];
2871
- alloc(arr, arrPos + 1);
2872
- val.value[currKey] = arr;
2873
- tempVal = this.getClass().fromNullable(arr[arrPos]);
2874
- }
2875
- parentVal = val;
2876
- parentPos = arrPos;
2877
- val = tempVal;
2878
- }
2879
- return this;
2880
- }
2881
- isNoArray(arrPos) {
2882
- return arrPos == -1;
2883
- }
2884
- isArray(arrPos) {
2885
- return !this.isNoArray(arrPos);
2886
- }
2887
- isArrayPos(currKey, arrPos) {
2888
- return currKey === "" && arrPos >= 0;
2889
- }
2890
- }
2891
- exports.Config = Config;
2892
3225
 
2893
3226
 
2894
3227
  /***/ }),
@@ -2917,17 +3250,17 @@ exports.Config = Config;
2917
3250
  * limitations under the License.
2918
3251
  */
2919
3252
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2920
- exports.QueryFormStringCollector = exports.QueryFormDataCollector = exports.FormDataCollector = exports.ConfigCollector = exports.AssocArrayCollector = exports.Run = exports.ArrayAssocArrayCollector = exports.InverseArrayCollector = exports.ArrayCollector = exports.FlatMapStreamDataSource = exports.MappedStreamDataSource = exports.FilteredStreamDatasource = exports.ArrayStreamDataSource = exports.SequenceDataSource = exports.MultiStreamDatasource = exports.ITERATION_STATUS = void 0;
2921
- const Stream_1 = __webpack_require__(/*! ./Stream */ "./node_modules/mona-dish/src/main/typescript/Stream.ts");
2922
- const Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
3253
+ 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;
3254
+ const Es2019Array_1 = __webpack_require__(/*! ./Es2019Array */ "./node_modules/mona-dish/src/main/typescript/Es2019Array.ts");
3255
+ const Config_1 = __webpack_require__(/*! ./Config */ "./node_modules/mona-dish/src/main/typescript/Config.ts");
2923
3256
  /**
2924
3257
  * special status of the datasource location pointer
2925
- * if an access, outside of the possible data boundaries is happening
3258
+ * if an access, outside - of the possible data boundaries is happening
2926
3259
  * (example for instance current without a first next call, or next
2927
3260
  * which goes over the last possible dataset), an iteration status return
2928
3261
  * value is returned marking this boundary instead of a classical element
2929
3262
  *
2930
- * Note this is only internally used but must be implemented to fullfill
3263
+ * Note this is only internally used but must be implemented to fulfill
2931
3264
  * internal contracts, the end user will never see those values if he uses
2932
3265
  * streams!
2933
3266
  */
@@ -2943,6 +3276,11 @@ function calculateSkips(next_strm) {
2943
3276
  }
2944
3277
  return --pos;
2945
3278
  }
3279
+ exports.calculateSkips = calculateSkips;
3280
+ /**
3281
+ * A data source which combines multiple streams sequentially into one
3282
+ * (this is used internally by flatmap, but also can be used externally)
3283
+ */
2946
3284
  class MultiStreamDatasource {
2947
3285
  constructor(first, ...strms) {
2948
3286
  this.first = first;
@@ -3044,7 +3382,7 @@ class SequenceDataSource {
3044
3382
  }
3045
3383
  exports.SequenceDataSource = SequenceDataSource;
3046
3384
  /**
3047
- * implementation of iteratable on top of array
3385
+ * implementation of a datasource on top of a standard array
3048
3386
  */
3049
3387
  class ArrayStreamDataSource {
3050
3388
  constructor(...value) {
@@ -3131,6 +3469,15 @@ class FilteredStreamDatasource {
3131
3469
  this._current = found;
3132
3470
  return found;
3133
3471
  }
3472
+ /**
3473
+ * looks ahead cnt without changing the internal data "pointers" of the data source
3474
+ * (this is mostly needed by LazyStreams, because they do not know by definition their
3475
+ * boundaries)
3476
+ *
3477
+ * @param cnt the elements to look ahead
3478
+ * @return either the element or ITERATION_STATUS.EO_STRM if we hit the end of the stream before
3479
+ * finding the "cnt" element
3480
+ */
3134
3481
  lookAhead(cnt = 1) {
3135
3482
  var _a;
3136
3483
  let lookupVal;
@@ -3181,105 +3528,13 @@ class MappedStreamDataSource {
3181
3528
  }
3182
3529
  }
3183
3530
  exports.MappedStreamDataSource = MappedStreamDataSource;
3184
- /**
3185
- * Same for flatmap to deal with element -> stream mappings
3186
- */
3187
- class FlatMapStreamDataSource {
3188
- constructor(func, parent) {
3189
- this.walkedDataSources = [];
3190
- this._currPos = 0;
3191
- this.mapFunc = func;
3192
- this.inputDataSource = parent;
3193
- }
3194
- hasNext() {
3195
- return this.resolveActiveHasNext() || this.resolveNextHasNext();
3196
- }
3197
- resolveActiveHasNext() {
3198
- let next = false;
3199
- if (this.activeDataSource) {
3200
- next = this.activeDataSource.hasNext();
3201
- }
3202
- return next;
3203
- }
3204
- lookAhead(cnt = 1) {
3205
- var _a;
3206
- let lookAhead = (_a = this === null || this === void 0 ? void 0 : this.activeDataSource) === null || _a === void 0 ? void 0 : _a.lookAhead(cnt);
3207
- if ((this === null || this === void 0 ? void 0 : this.activeDataSource) && lookAhead != ITERATION_STATUS.EO_STRM) {
3208
- //this should cover 95% of all cases
3209
- return lookAhead;
3210
- }
3211
- if (this.activeDataSource) {
3212
- cnt -= calculateSkips(this.activeDataSource);
3213
- }
3214
- //the idea is basically to look into the streams sub-sequentially for a match
3215
- //after each stream we have to take into consideration that the skipCnt is
3216
- //reduced by the number of datasets we already have looked into in the previous stream/datasource
3217
- //unfortunately for now we have to loop into them, so we introduce a small o2 here
3218
- for (let dsLoop = 1; true; dsLoop++) {
3219
- let datasourceData = this.inputDataSource.lookAhead(dsLoop);
3220
- //we have looped out
3221
- //no embedded data anymore? we are done, data
3222
- //can either be a scalar an array or another datasource
3223
- if (datasourceData === ITERATION_STATUS.EO_STRM) {
3224
- return ITERATION_STATUS.EO_STRM;
3225
- }
3226
- let mappedData = this.mapFunc(datasourceData);
3227
- //it either comes in as datasource or as array
3228
- //both cases must be unified into a datasource
3229
- let currentDataSource = this.toDatasource(mappedData);
3230
- //we now run again a lookahead
3231
- let ret = currentDataSource.lookAhead(cnt);
3232
- //if the value is found then we are set
3233
- if (ret != ITERATION_STATUS.EO_STRM) {
3234
- return ret;
3235
- }
3236
- //reduce the next lookahead by the number of elements
3237
- //we are now skipping in the current data source
3238
- cnt -= calculateSkips(currentDataSource);
3239
- }
3240
- }
3241
- toDatasource(mapped) {
3242
- let ds = Array.isArray(mapped) ? new ArrayStreamDataSource(...mapped) : mapped;
3243
- this.walkedDataSources.push(ds);
3244
- return ds;
3245
- }
3246
- resolveNextHasNext() {
3247
- let next = false;
3248
- while (!next && this.inputDataSource.hasNext()) {
3249
- let mapped = this.mapFunc(this.inputDataSource.next());
3250
- this.activeDataSource = this.toDatasource(mapped);
3251
- next = this.activeDataSource.hasNext();
3252
- }
3253
- return next;
3254
- }
3255
- next() {
3256
- if (this.hasNext()) {
3257
- this._currPos++;
3258
- return this.activeDataSource.next();
3259
- }
3260
- }
3261
- reset() {
3262
- this.inputDataSource.reset();
3263
- this.walkedDataSources.forEach(ds => ds.reset());
3264
- this.walkedDataSources = [];
3265
- this._currPos = 0;
3266
- this.activeDataSource = null;
3267
- }
3268
- current() {
3269
- if (!this.activeDataSource) {
3270
- this.hasNext();
3271
- }
3272
- return this.activeDataSource.current();
3273
- }
3274
- }
3275
- exports.FlatMapStreamDataSource = FlatMapStreamDataSource;
3276
3531
  /**
3277
3532
  * For the time being we only need one collector
3278
3533
  * a collector which collects a stream back into arrays
3279
3534
  */
3280
- class ArrayCollector {
3535
+ class ShimArrayCollector {
3281
3536
  constructor() {
3282
- this.data = [];
3537
+ this.data = new Es2019Array_1.Es2019Array(...[]);
3283
3538
  }
3284
3539
  collect(element) {
3285
3540
  this.data.push(element);
@@ -3288,7 +3543,7 @@ class ArrayCollector {
3288
3543
  return this.data;
3289
3544
  }
3290
3545
  }
3291
- exports.ArrayCollector = ArrayCollector;
3546
+ exports.ShimArrayCollector = ShimArrayCollector;
3292
3547
  /**
3293
3548
  * collects the values as inverse array
3294
3549
  */
@@ -3350,7 +3605,7 @@ exports.AssocArrayCollector = AssocArrayCollector;
3350
3605
  */
3351
3606
  class ConfigCollector {
3352
3607
  constructor() {
3353
- this.finalValue = new Monad_1.Config({});
3608
+ this.finalValue = new Config_1.Config({});
3354
3609
  }
3355
3610
  collect(element) {
3356
3611
  this.finalValue.append(element.key).value = element.value;
@@ -3382,478 +3637,44 @@ class QueryFormDataCollector {
3382
3637
  this.finalValue.append(element.name.value, toMerge.get(element.name).value);
3383
3638
  }
3384
3639
  }
3385
- }
3386
- exports.QueryFormDataCollector = QueryFormDataCollector;
3387
- /**
3388
- * Encoded String collector from dom query streams
3389
- */
3390
- class QueryFormStringCollector {
3391
- constructor() {
3392
- this.formData = [];
3393
- }
3394
- collect(element) {
3395
- let toMerge = element.encodeFormElement();
3396
- if (toMerge.isPresent()) {
3397
- this.formData.push([element.name.value, toMerge.get(element.name).value]);
3398
- }
3399
- }
3400
- get finalValue() {
3401
- return Stream_1.Stream.of(...this.formData)
3402
- .map(keyVal => keyVal.join("="))
3403
- .reduce((item1, item2) => [item1, item2].join("&"))
3404
- .orElse("").value;
3405
- }
3406
- }
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");
3442
- /**
3443
- * A simple typescript based reimplementation of streams
3444
- *
3445
- * This is the early eval version
3446
- * for a lazy eval version check, LazyStream, which is api compatible
3447
- * to this implementation, however with the benefit of being able
3448
- * to provide infinite data sources and generic data providers, the downside
3449
- * is, it might be a tad slower in some situations
3450
- */
3451
- class Stream {
3452
- constructor(...value) {
3453
- this._limits = -1;
3454
- this.pos = -1;
3455
- this.value = value;
3456
- }
3457
- static of(...data) {
3458
- return new Stream(...data);
3459
- }
3460
- static ofAssoc(data) {
3461
- return this.of(...Object.keys(data)).map(key => [key, data[key]]);
3462
- }
3463
- static ofDataSource(dataSource) {
3464
- let value = [];
3465
- while (dataSource.hasNext()) {
3466
- value.push(dataSource.next());
3467
- }
3468
- return new Stream(...value);
3469
- }
3470
- current() {
3471
- if (this.pos == -1) {
3472
- return SourcesCollectors_1.ITERATION_STATUS.BEF_STRM;
3473
- }
3474
- if (this.pos >= this.value.length) {
3475
- return SourcesCollectors_1.ITERATION_STATUS.EO_STRM;
3476
- }
3477
- return this.value[this.pos];
3478
- }
3479
- limits(end) {
3480
- this._limits = end;
3481
- return this;
3482
- }
3483
- /**
3484
- * concat for streams, so that you can concat two streams together
3485
- * @param toAppend
3486
- */
3487
- concat(...toAppend) {
3488
- let toConcat = [this].concat(toAppend);
3489
- return Stream.of(...toConcat).flatMap(item => item);
3490
- }
3491
- onElem(fn) {
3492
- for (let cnt = 0; cnt < this.value.length && (this._limits == -1 || cnt < this._limits); cnt++) {
3493
- if (fn(this.value[cnt], cnt) === false) {
3494
- break;
3495
- }
3496
- }
3497
- return this;
3498
- }
3499
- each(fn) {
3500
- this.onElem(fn);
3501
- this.reset();
3502
- }
3503
- map(fn) {
3504
- if (!fn) {
3505
- fn = (inval) => inval;
3506
- }
3507
- let res = [];
3508
- this.each((item) => {
3509
- res.push(fn(item));
3510
- });
3511
- return new Stream(...res);
3512
- }
3513
- /*
3514
- * we need to implement it to fullfill the contract, although it is used only internally
3515
- * all values are flattened when accessed anyway, so there is no need to call this methiod
3516
- */
3517
- flatMap(fn) {
3518
- let ret = [];
3519
- this.each(item => {
3520
- let strmR = fn(item);
3521
- ret = Array.isArray(strmR) ? ret.concat(strmR) : ret.concat(strmR.value);
3522
- });
3523
- return Stream.of(...ret);
3524
- }
3525
- filter(fn) {
3526
- let res = [];
3527
- this.each((data) => {
3528
- if (fn(data)) {
3529
- res.push(data);
3530
- }
3531
- });
3532
- return new Stream(...res);
3533
- }
3534
- reduce(fn, startVal = null) {
3535
- let offset = startVal != null ? 0 : 1;
3536
- let val1 = startVal != null ? startVal : this.value.length ? this.value[0] : null;
3537
- for (let cnt = offset; cnt < this.value.length && (this._limits == -1 || cnt < this._limits); cnt++) {
3538
- val1 = fn(val1, this.value[cnt]);
3539
- }
3540
- this.reset();
3541
- return Monad_1.Optional.fromNullable(val1);
3542
- }
3543
- first() {
3544
- this.reset();
3545
- return this.value && this.value.length ? Monad_1.Optional.fromNullable(this.value[0]) : Monad_1.Optional.absent;
3546
- }
3547
- last() {
3548
- //could be done via reduce, but is faster this way
3549
- let length = this._limits > 0 ? Math.min(this._limits, this.value.length) : this.value.length;
3550
- this.reset();
3551
- return Monad_1.Optional.fromNullable(length ? this.value[length - 1] : null);
3552
- }
3553
- anyMatch(fn) {
3554
- for (let cnt = 0; cnt < this.value.length && (this._limits == -1 || cnt < this._limits); cnt++) {
3555
- if (fn(this.value[cnt])) {
3556
- return true;
3557
- }
3558
- }
3559
- this.reset();
3560
- return false;
3561
- }
3562
- allMatch(fn) {
3563
- if (!this.value.length) {
3564
- return false;
3565
- }
3566
- let matches = 0;
3567
- for (let cnt = 0; cnt < this.value.length; cnt++) {
3568
- if (fn(this.value[cnt])) {
3569
- matches++;
3570
- }
3571
- }
3572
- this.reset();
3573
- return matches == this.value.length;
3574
- }
3575
- noneMatch(fn) {
3576
- let matches = 0;
3577
- for (let cnt = 0; cnt < this.value.length; cnt++) {
3578
- if (!fn(this.value[cnt])) {
3579
- matches++;
3580
- }
3581
- }
3582
- this.reset();
3583
- return matches == this.value.length;
3584
- }
3585
- sort(comparator) {
3586
- let newArr = this.value.slice().sort(comparator);
3587
- return Stream.of(...newArr);
3588
- }
3589
- collect(collector) {
3590
- this.each(data => collector.collect(data));
3591
- this.reset();
3592
- return collector.finalValue;
3593
- }
3594
- //-- internally exposed methods needed for the interconnectivity
3595
- hasNext() {
3596
- let isLimitsReached = this._limits != -1 && this.pos >= this._limits - 1;
3597
- let isEndOfArray = this.pos >= this.value.length - 1;
3598
- return !(isLimitsReached || isEndOfArray);
3599
- }
3600
- next() {
3601
- if (!this.hasNext()) {
3602
- return null;
3603
- }
3604
- this.pos++;
3605
- return this.value[this.pos];
3606
- }
3607
- lookAhead(cnt = 1) {
3608
- if ((this.pos + cnt) >= this.value.length) {
3609
- return SourcesCollectors_1.ITERATION_STATUS.EO_STRM;
3610
- }
3611
- return this.value[this.pos + cnt];
3612
- }
3613
- [Symbol.iterator]() {
3614
- return {
3615
- next: () => {
3616
- let done = !this.hasNext();
3617
- let val = this.next();
3618
- return {
3619
- done: done,
3620
- value: val
3621
- };
3622
- }
3623
- };
3624
- }
3625
- /*get observable(): Observable<T> {
3626
- return from(this);
3627
- }*/
3628
- reset() {
3629
- this.pos = -1;
3630
- }
3631
- }
3632
- exports.Stream = Stream;
3633
- /**
3634
- * Lazy implementation of a Stream
3635
- * The idea is to connect the intermediate
3636
- * streams as datasources like a linked list
3637
- * with reverse referencing and for special
3638
- * operations like filtering flatmapping
3639
- * have intermediate datasources in the list
3640
- * with specialized functions.
3641
- *
3642
- * Sort of a modified pipe valve pattern
3643
- * the streams are the pipes the intermediate
3644
- * data sources are the valves
3645
- *
3646
- * We then can use passed in functions to control
3647
- * the flow in the valves
3648
- *
3649
- * That way we can have a lazy evaluating stream
3650
- *
3651
- * So if an endpoint requests data
3652
- * a callback trace goes back the stream list
3653
- * which triggers an operation upwards
3654
- * which sends data down the drain which then is processed
3655
- * and filtered until one element hits the endpoint.
3656
- *
3657
- * That is repeated, until all elements are processed
3658
- * or an internal limit is hit.
3659
- *
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);
3640
+ }
3641
+ exports.QueryFormDataCollector = QueryFormDataCollector;
3642
+ /**
3643
+ * Encoded String collector from dom query streams
3644
+ */
3645
+ class QueryFormStringCollector {
3646
+ constructor() {
3647
+ this.formData = [];
3829
3648
  }
3830
- get value() {
3831
- return this.collect(new SourcesCollectors_1.ArrayCollector());
3649
+ collect(element) {
3650
+ let toMerge = element.encodeFormElement();
3651
+ if (toMerge.isPresent()) {
3652
+ this.formData.push([element.name.value, toMerge.get(element.name).value]);
3653
+ }
3832
3654
  }
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
- };
3655
+ get finalValue() {
3656
+ return new Es2019Array_1.Es2019Array(...this.formData)
3657
+ .map(keyVal => keyVal.join("="))
3658
+ .reduce((item1, item2) => [item1, item2].join("&"));
3844
3659
  }
3845
- /*get observable(): Observable<T> {
3846
- return from(this);
3847
- }*/
3848
- stop() {
3849
- this.pos = this._limits + 1000000000;
3850
- this._limits = 0;
3660
+ }
3661
+ exports.QueryFormStringCollector = QueryFormStringCollector;
3662
+ /**
3663
+ * For the time being we only need one collector
3664
+ * a collector which collects a stream back into arrays
3665
+ */
3666
+ class ArrayCollector {
3667
+ constructor() {
3668
+ this.data = [];
3669
+ }
3670
+ collect(element) {
3671
+ this.data.push(element);
3851
3672
  }
3852
- isOverLimits() {
3853
- return this._limits != -1 && this.pos >= this._limits - 1;
3673
+ get finalValue() {
3674
+ return this.data;
3854
3675
  }
3855
3676
  }
3856
- exports.LazyStream = LazyStream;
3677
+ exports.ArrayCollector = ArrayCollector;
3857
3678
 
3858
3679
 
3859
3680
  /***/ }),
@@ -3955,11 +3776,34 @@ exports.XQ = XMLQuery;
3955
3776
  /*!******************************************************************!*\
3956
3777
  !*** ./node_modules/mona-dish/src/main/typescript/index_core.ts ***!
3957
3778
  \******************************************************************/
3958
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3779
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3959
3780
 
3960
3781
 
3782
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3783
+ if (k2 === undefined) k2 = k;
3784
+ var desc = Object.getOwnPropertyDescriptor(m, k);
3785
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3786
+ desc = { enumerable: true, get: function() { return m[k]; } };
3787
+ }
3788
+ Object.defineProperty(o, k2, desc);
3789
+ }) : (function(o, m, k, k2) {
3790
+ if (k2 === undefined) k2 = k;
3791
+ o[k2] = m[k];
3792
+ }));
3793
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
3794
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
3795
+ }) : function(o, v) {
3796
+ o["default"] = v;
3797
+ });
3798
+ var __importStar = (this && this.__importStar) || function (mod) {
3799
+ if (mod && mod.__esModule) return mod;
3800
+ var result = {};
3801
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
3802
+ __setModuleDefault(result, mod);
3803
+ return result;
3804
+ };
3961
3805
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3962
- exports.QueryFormDataCollector = exports.FormDataCollector = exports.AssocArrayCollector = exports.ArrayCollector = exports.QueryFormStringCollector = exports.SequenceDataSource = exports.FlatMapStreamDataSource = exports.FilteredStreamDatasource = exports.MappedStreamDataSource = exports.ArrayStreamDataSource = exports.LazyStream = exports.Stream = exports.XQ = exports.XMLQuery = exports.ValueEmbedder = exports.Optional = exports.Monad = exports.CONFIG_ANY = exports.CONFIG_VALUE = exports.Config = exports.Lang = exports.DQ$ = exports.DQ = exports.DomQueryCollector = exports.ElementAttribute = exports.DomQuery = void 0;
3806
+ exports.Assoc = exports.CONFIG_VALUE = exports.CONFIG_ANY = exports.Config = exports.shallowMerge = exports.simpleShallowMerge = exports.append = exports.assignIf = exports.assign = exports.XQ = exports.XMLQuery = exports.ValueEmbedder = exports.Optional = exports.Monad = exports.Lang = exports.DQ$ = exports.DQ = exports.DomQueryCollector = exports.ElementAttribute = exports.DomQuery = void 0;
3963
3807
  /*!
3964
3808
  * Licensed to the Apache Software Foundation (ASF) under one
3965
3809
  * or more contributor license agreements. See the NOTICE file
@@ -3987,29 +3831,25 @@ Object.defineProperty(exports, "DQ$", ({ enumerable: true, get: function () { re
3987
3831
  var Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
3988
3832
  Object.defineProperty(exports, "Lang", ({ enumerable: true, get: function () { return Lang_1.Lang; } }));
3989
3833
  var Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
3990
- Object.defineProperty(exports, "Config", ({ enumerable: true, get: function () { return Monad_1.Config; } }));
3991
- Object.defineProperty(exports, "CONFIG_VALUE", ({ enumerable: true, get: function () { return Monad_1.CONFIG_VALUE; } }));
3992
- Object.defineProperty(exports, "CONFIG_ANY", ({ enumerable: true, get: function () { return Monad_1.CONFIG_ANY; } }));
3993
3834
  Object.defineProperty(exports, "Monad", ({ enumerable: true, get: function () { return Monad_1.Monad; } }));
3994
3835
  Object.defineProperty(exports, "Optional", ({ enumerable: true, get: function () { return Monad_1.Optional; } }));
3995
3836
  Object.defineProperty(exports, "ValueEmbedder", ({ enumerable: true, get: function () { return Monad_1.ValueEmbedder; } }));
3996
3837
  var XmlQuery_1 = __webpack_require__(/*! ./XmlQuery */ "./node_modules/mona-dish/src/main/typescript/XmlQuery.ts");
3997
3838
  Object.defineProperty(exports, "XMLQuery", ({ enumerable: true, get: function () { return XmlQuery_1.XMLQuery; } }));
3998
3839
  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; } }));
3840
+ var AssocArray_1 = __webpack_require__(/*! ./AssocArray */ "./node_modules/mona-dish/src/main/typescript/AssocArray.ts");
3841
+ Object.defineProperty(exports, "assign", ({ enumerable: true, get: function () { return AssocArray_1.assign; } }));
3842
+ Object.defineProperty(exports, "assignIf", ({ enumerable: true, get: function () { return AssocArray_1.assignIf; } }));
3843
+ Object.defineProperty(exports, "append", ({ enumerable: true, get: function () { return AssocArray_1.append; } }));
3844
+ Object.defineProperty(exports, "simpleShallowMerge", ({ enumerable: true, get: function () { return AssocArray_1.simpleShallowMerge; } }));
3845
+ Object.defineProperty(exports, "shallowMerge", ({ enumerable: true, get: function () { return AssocArray_1.shallowMerge; } }));
3846
+ var Config_1 = __webpack_require__(/*! ./Config */ "./node_modules/mona-dish/src/main/typescript/Config.ts");
3847
+ Object.defineProperty(exports, "Config", ({ enumerable: true, get: function () { return Config_1.Config; } }));
3848
+ var Config_2 = __webpack_require__(/*! ./Config */ "./node_modules/mona-dish/src/main/typescript/Config.ts");
3849
+ Object.defineProperty(exports, "CONFIG_ANY", ({ enumerable: true, get: function () { return Config_2.CONFIG_ANY; } }));
3850
+ var Config_3 = __webpack_require__(/*! ./Config */ "./node_modules/mona-dish/src/main/typescript/Config.ts");
3851
+ Object.defineProperty(exports, "CONFIG_VALUE", ({ enumerable: true, get: function () { return Config_3.CONFIG_VALUE; } }));
3852
+ exports.Assoc = __importStar(__webpack_require__(/*! ./AssocArray */ "./node_modules/mona-dish/src/main/typescript/AssocArray.ts"));
4013
3853
 
4014
3854
 
4015
3855
  /***/ }),
@@ -4283,7 +4123,7 @@ var myfaces;
4283
4123
  *
4284
4124
  * @param executionFunc the function to be executed upon ready
4285
4125
  */
4286
- function onOnDomReady(executionFunc) {
4126
+ function onDomReady(executionFunc) {
4287
4127
  if (document.readyState !== "complete") {
4288
4128
  onReadyChain.push(executionFunc);
4289
4129
  if (!readyStateListener) {
@@ -4308,7 +4148,7 @@ var myfaces;
4308
4148
  executionFunc();
4309
4149
  }
4310
4150
  }
4311
- myfaces.onOnDomReady = onOnDomReady;
4151
+ myfaces.onDomReady = onDomReady;
4312
4152
  /**
4313
4153
  * legacy oam functions
4314
4154
  */
@@ -4344,7 +4184,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
4344
4184
  exports.Implementation = void 0;
4345
4185
  const Response_1 = __webpack_require__(/*! ./xhrCore/Response */ "./src/main/typescript/impl/xhrCore/Response.ts");
4346
4186
  const XhrRequest_1 = __webpack_require__(/*! ./xhrCore/XhrRequest */ "./src/main/typescript/impl/xhrCore/XhrRequest.ts");
4347
- const AsyncQueue_1 = __webpack_require__(/*! ./util/AsyncQueue */ "./src/main/typescript/impl/util/AsyncQueue.ts");
4348
4187
  const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
4349
4188
  const Assertions_1 = __webpack_require__(/*! ./util/Assertions */ "./src/main/typescript/impl/util/Assertions.ts");
4350
4189
  const ExtDomQuery_1 = __webpack_require__(/*! ./util/ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
@@ -4353,6 +4192,7 @@ const Lang_1 = __webpack_require__(/*! ./util/Lang */ "./src/main/typescript/imp
4353
4192
  const Const_1 = __webpack_require__(/*! ./core/Const */ "./src/main/typescript/impl/core/Const.ts");
4354
4193
  const RequestDataResolver_1 = __webpack_require__(/*! ./xhrCore/RequestDataResolver */ "./src/main/typescript/impl/xhrCore/RequestDataResolver.ts");
4355
4194
  const FileUtils_1 = __webpack_require__(/*! ./util/FileUtils */ "./src/main/typescript/impl/util/FileUtils.ts");
4195
+ const XhrQueueController_1 = __webpack_require__(/*! ./util/XhrQueueController */ "./src/main/typescript/impl/util/XhrQueueController.ts");
4356
4196
  /*
4357
4197
  * allowed project stages
4358
4198
  */
@@ -4400,17 +4240,7 @@ var Implementation;
4400
4240
  it provides following
4401
4241
 
4402
4242
  a) Monad like structures for querying because this keeps the code denser and adds abstractions
4403
- that always was the strong point of jquery and it still is better in this regard than what ecmascript provides
4404
-
4405
- b) Streams and lazy streams like java has, a pull stream construct, ecmascript does not have anything like it.
4406
- (it has array filters and maps, but ES2015 does not support flatMap)
4407
- Another option would have been rxjs but that would have introduced a code dependency and probably more code. We might
4408
- move to RXJS if the need arises, however. But for now I would rather stick with my small self grown library which works
4409
- quite well and where I can patch quickly (I have used it in several industrial projects, so it works well
4410
- and is heavily fortified by unit tests (140 testcases as time of writing this))
4411
- The long term plan is to eliminate the Stream usage as soon as we can move up to ES2019 (adding the missing
4412
- functions as shims, is a no go, because we are a library, and absolutey do not Shim anything which can leak
4413
- into the global namespace!)
4243
+ that always was the strong point of jQuery, and it still is better in this regard than what ecmascript provides
4414
4244
 
4415
4245
  c) A neutral json like configuration which allows assignments of arbitrary values with reduce code which then can be
4416
4246
  transformed into different data representations
@@ -4446,6 +4276,8 @@ var Implementation;
4446
4276
  var getMessage = Lang_1.ExtLang.getMessage;
4447
4277
  var getGlobalConfig = Lang_1.ExtLang.getGlobalConfig;
4448
4278
  var assert = Assertions_1.Assertions.assert;
4279
+ var ofAssoc = Lang_1.ExtLang.ofAssoc;
4280
+ var collectAssoc = Lang_1.ExtLang.collectAssoc;
4449
4281
  let projectStage = null;
4450
4282
  let separator = null;
4451
4283
  let eventQueue = [];
@@ -4478,7 +4310,7 @@ var Implementation;
4478
4310
  /**
4479
4311
  * @return the project stage also emitted by the server:
4480
4312
  * it cannot be cached and must be delivered over the server
4481
- * The value for it comes from the request parameter of the faces.js script called "stage".
4313
+ * The value for it comes from the requestInternal parameter of the faces.js script called "stage".
4482
4314
  */
4483
4315
  function getProjectStage() {
4484
4316
  var _a, _b, _c;
@@ -4503,15 +4335,18 @@ var Implementation;
4503
4335
  * @param funcs
4504
4336
  */
4505
4337
  function chain(source, event, ...funcs) {
4506
- // we can use our lazy stream each functionality to run our chain here..
4338
+ // we can use our lazy stream each functionality to run our chain here.
4507
4339
  // by passing a boolean as return value into the onElem call
4508
4340
  // we can stop early at the first false, just like the spec requests
4509
- return mona_dish_1.LazyStream.of(...funcs)
4510
- .map(func => resolveAndExecute(source, event, func))
4511
- // we use the return false == stop as an early stop, onElem stops at the first false
4512
- .onElem((opResult) => opResult)
4513
- //last ensures we run until the first false is returned
4514
- .last().value;
4341
+ let ret;
4342
+ funcs.every(func => {
4343
+ let returnVal = resolveAndExecute(source, event, func);
4344
+ if (returnVal !== false) {
4345
+ ret = returnVal;
4346
+ }
4347
+ return returnVal !== false;
4348
+ });
4349
+ return ret;
4515
4350
  }
4516
4351
  Implementation.chain = chain;
4517
4352
  /**
@@ -4533,7 +4368,7 @@ var Implementation;
4533
4368
  * b) passThrough handling with a map copy with a filter map block map
4534
4369
  */
4535
4370
  function request(el, event, opts) {
4536
- var _a, _b, _c;
4371
+ var _a, _b, _c, _d, _e;
4537
4372
  const { options, elem, elementId, windowId, isResetValues } = (0, RequestDataResolver_1.resolveDefaults)(event, opts, el);
4538
4373
  const requestCtx = new ExtDomQuery_1.ExtConfig({});
4539
4374
  const internalCtx = new ExtDomQuery_1.ExtConfig({});
@@ -4551,7 +4386,7 @@ var Implementation;
4551
4386
  const delay = (0, RequestDataResolver_1.resolveDelay)(options);
4552
4387
  const timeout = (0, RequestDataResolver_1.resolveTimeout)(options);
4553
4388
  requestCtx.assignIf(!!windowId, Const_1.P_WINDOW_ID).value = windowId;
4554
- // old non spec behavior will be removed after it is clear whether the removal breaks any code
4389
+ // old non - spec behavior will be removed after it is clear whether the removal breaks any code
4555
4390
  requestCtx.assign(Const_1.CTX_PARAM_REQ_PASS_THR).value = extractLegacyParams(options.value);
4556
4391
  // spec conform behavior, all passthrough params must be under "passthrough
4557
4392
  const params = remapArrayToAssocArr(options.getIf(Const_1.CTX_OPTIONS_PARAMS).orElse({}).value);
@@ -4577,13 +4412,13 @@ var Implementation;
4577
4412
  requestCtx.assign(Const_1.ON_EVENT).value = (_a = options.value) === null || _a === void 0 ? void 0 : _a.onevent;
4578
4413
  requestCtx.assign(Const_1.ON_ERROR).value = (_b = options.value) === null || _b === void 0 ? void 0 : _b.onerror;
4579
4414
  /**
4580
- * lets drag the myfaces config params also in
4415
+ * Fetch the myfaces config params
4581
4416
  */
4582
4417
  requestCtx.assign(Const_1.MYFACES).value = (_c = options.value) === null || _c === void 0 ? void 0 : _c.myfaces;
4583
4418
  /**
4584
4419
  * binding contract the jakarta.faces.source must be set
4585
4420
  */
4586
- requestCtx.assign(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_PARTIAL_SOURCE).value = elementId;
4421
+ requestCtx.assign(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_AJAX_SOURCE).value = elementId;
4587
4422
  /**
4588
4423
  * jakarta.faces.partial.ajax must be set to true
4589
4424
  */
@@ -4606,6 +4441,8 @@ var Implementation;
4606
4441
  // won't hurt but for the sake of compatibility we are going to add it
4607
4442
  requestCtx.assign(Const_1.CTX_PARAM_REQ_PASS_THR, formId).value = formId;
4608
4443
  internalCtx.assign(Const_1.CTX_PARAM_SRC_CTL_ID).value = elementId;
4444
+ // reintroduction of PPS as per myfaces 2.3 (myfaces.pps = true, only the executes are submitted)
4445
+ internalCtx.assign(Const_1.CTX_PARAM_PPS).value = (_e = (_d = extractMyFacesParams(options.value)) === null || _d === void 0 ? void 0 : _d[Const_1.MYFACES_OPTION_PPS]) !== null && _e !== void 0 ? _e : false;
4609
4446
  assignClientWindowId(form, requestCtx);
4610
4447
  assignExecute(options, requestCtx, form, elementId);
4611
4448
  assignRender(options, requestCtx, form, elementId);
@@ -4682,7 +4519,7 @@ var Implementation;
4682
4519
  }
4683
4520
  finally {
4684
4521
  if (clearRequestQueue) {
4685
- Implementation.requestQueue.cleanup();
4522
+ Implementation.requestQueue.clear();
4686
4523
  }
4687
4524
  }
4688
4525
  }
@@ -4803,7 +4640,7 @@ var Implementation;
4803
4640
  // fetch all non file input form elements
4804
4641
  let formElements = element.deepElements.encodeFormElement();
4805
4642
  // encode them! (file inputs are handled differently and are not part of the viewstate)
4806
- return (0, FileUtils_1.encodeFormData)(formElements, (0, RequestDataResolver_1.resoveNamingContainerMapper)(dummyContext));
4643
+ return (0, FileUtils_1.encodeFormData)(new ExtDomQuery_1.ExtConfig(formElements), (0, RequestDataResolver_1.resoveNamingContainerMapper)(dummyContext));
4807
4644
  }
4808
4645
  Implementation.getViewState = getViewState;
4809
4646
  /**
@@ -4818,8 +4655,8 @@ var Implementation;
4818
4655
  * adds a new request to our queue for further processing
4819
4656
  */
4820
4657
  addRequestToQueue: function (elem, form, reqCtx, respPassThr, delay = 0, timeout = 0) {
4821
- Implementation.requestQueue = Implementation.requestQueue !== null && Implementation.requestQueue !== void 0 ? Implementation.requestQueue : new AsyncQueue_1.AsynchronousQueue();
4822
- Implementation.requestQueue.enqueue(new XhrRequest_1.XhrRequest(elem, form, reqCtx, respPassThr, [], timeout), delay);
4658
+ Implementation.requestQueue = Implementation.requestQueue !== null && Implementation.requestQueue !== void 0 ? Implementation.requestQueue : new XhrQueueController_1.XhrQueueController();
4659
+ Implementation.requestQueue.enqueue(new XhrRequest_1.XhrRequest(reqCtx, respPassThr, timeout), delay);
4823
4660
  }
4824
4661
  };
4825
4662
  //----------------------------------------------- Methods ---------------------------------------------------------------------
@@ -4919,7 +4756,7 @@ var Implementation;
4919
4756
  * can deal with them either prefixed ir not
4920
4757
  * also resolves the absolute id case (it was assumed the server does this, but
4921
4758
  * apparently the RI does not, so we have to follow the RI behavior here)
4922
- * @param componentIdToTransform the componentId which needs post processing
4759
+ * @param componentIdToTransform the componentId which needs post-processing
4923
4760
  */
4924
4761
  const remapNamingContainer = componentIdToTransform => {
4925
4762
  // pattern :<anything> must be prepended by viewRoot if there is one,
@@ -4933,7 +4770,7 @@ var Implementation;
4933
4770
  const hasLeadingSep = componentIdToTransform.indexOf(SEP) === 0;
4934
4771
  const isAbsolutSearchExpr = hasLeadingSep || (rootNamingContainerId.length
4935
4772
  && componentIdToTransform.indexOf(rootNamingContainerPrefix) == 0);
4936
- let finalIdentifier = "";
4773
+ let finalIdentifier;
4937
4774
  if (isAbsolutSearchExpr) {
4938
4775
  //we cut off the leading sep if there is one
4939
4776
  componentIdToTransform = hasLeadingSep ? componentIdToTransform.substring(1) : componentIdToTransform;
@@ -4952,13 +4789,13 @@ var Implementation;
4952
4789
  [rootNamingContainerPrefix, componentIdToTransform].join(Const_1.EMPTY_STR) :
4953
4790
  [nearestNamingContainerPrefix, componentIdToTransform].join(Const_1.EMPTY_STR);
4954
4791
  }
4955
- // We need to double check because we have scenarios where we have a naming container
4792
+ // We need to double-check because we have scenarios where we have a naming container
4956
4793
  // and no prepend (aka tobago testcase "must handle ':' in IDs properly", scenario 3,
4957
4794
  // in this case we return the component id, and be happy
4958
4795
  // we can roll a dom check here
4959
4796
  return (!!document.getElementById(finalIdentifier)) ? finalIdentifier : componentIdToTransform;
4960
4797
  };
4961
- // in this case we do not use lazy stream because it wont bring any code reduction
4798
+ // in this case we do not use lazy stream because it won´t bring any code reduction
4962
4799
  // or speedup
4963
4800
  for (let cnt = 0; cnt < iterValues.length; cnt++) {
4964
4801
  //avoid doubles
@@ -4998,23 +4835,36 @@ var Implementation;
4998
4835
  * the values required for params-through are processed in the ajax request
4999
4836
  *
5000
4837
  * Note this is a bug carried over from the old implementation
5001
- * the spec conform behavior is to use params for passthrough values
4838
+ * the spec conform behavior is to use params for pass - through values
5002
4839
  * this will be removed soon, after it is cleared up whether removing
5003
4840
  * it breaks any legacy code
5004
4841
  *
5005
4842
  * @param {Context} mappedOpts the options to be filtered
5006
- * @deprecated
5007
4843
  */
5008
4844
  function extractLegacyParams(mappedOpts) {
5009
4845
  //we now can use the full code reduction given by our stream api
5010
4846
  //to filter
5011
- return mona_dish_1.Stream.ofAssoc(mappedOpts)
5012
- .filter(item => !(item[0] in BlockFilter))
5013
- .collect(new mona_dish_1.AssocArrayCollector());
4847
+ return ofAssoc(mappedOpts)
4848
+ .filter((item => !(item[0] in BlockFilter)))
4849
+ .reduce(collectAssoc, {});
4850
+ }
4851
+ /**
4852
+ * extracts the myfaces config parameters which provide extra functionality
4853
+ * on top of JSF
4854
+ * @param mappedOpts
4855
+ * @private
4856
+ */
4857
+ function extractMyFacesParams(mappedOpts) {
4858
+ var _a;
4859
+ //we now can use the full code reduction given by our stream api
4860
+ //to filter
4861
+ return (_a = ofAssoc(mappedOpts)
4862
+ .filter((item => (item[0] == "myfaces")))
4863
+ .reduce(collectAssoc, {})) === null || _a === void 0 ? void 0 : _a[Const_1.MYFACES];
5014
4864
  }
5015
4865
  function remapArrayToAssocArr(arrayedParams) {
5016
4866
  if (Array.isArray(arrayedParams)) {
5017
- return mona_dish_1.Stream.of(...arrayedParams).collect(new mona_dish_1.AssocArrayCollector());
4867
+ return arrayedParams.reduce(collectAssoc, {});
5018
4868
  }
5019
4869
  return arrayedParams;
5020
4870
  }
@@ -5342,16 +5192,16 @@ var PushImpl;
5342
5192
  * limitations under the License.
5343
5193
  */
5344
5194
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5345
- exports.CTX_OPTIONS_PARAMS = exports.TIMEOUT_EVENT = exports.CLIENT_ERROR = exports.SERVER_ERROR = exports.MALFORMEDXML = exports.EMPTY_RESPONSE = exports.HTTPERROR = exports.RESPONSE_XML = exports.RESPONSE_TEXT = exports.ERROR_MESSAGE = exports.ERROR_NAME = exports.STATUS = exports.SOURCE = exports.SUCCESS = exports.COMPLETE = exports.BEGIN = exports.ON_EVENT = exports.ON_ERROR = exports.EVENT = exports.ERROR = exports.WINDOW_ID = exports.CTX_PARAM_RENDER = exports.P_BEHAVIOR_EVENT = exports.P_WINDOW_ID = exports.P_RESET_VALUES = exports.P_EVT = exports.P_RENDER_OVERRIDE = exports.P_RENDER = exports.P_EXECUTE = exports.P_AJAX = exports.IDENT_FORM = exports.IDENT_THIS = exports.IDENT_NONE = exports.IDENT_ALL = exports.HTML_CLIENT_WINDOW = exports.HTML_VIEWSTATE = exports.EMPTY_MAP = exports.EMPTY_STR = exports.EMPTY_FUNC = exports.P_RESOURCE = exports.P_VIEWBODY = exports.P_VIEWHEAD = exports.P_VIEWROOT = exports.P_CLIENT_WINDOW = exports.P_VIEWSTATE = exports.VIEW_ID = exports.NAMING_CONTAINER_ID = exports.P_PARTIAL_SOURCE = exports.NAMED_VIEWROOT = exports.XML_ATTR_NAMED_VIEWROOT = void 0;
5346
- exports.XML_TAG_AFTER = exports.XML_TAG_BEFORE = exports.XML_TAG_REDIRECT = exports.XML_TAG_EXTENSION = exports.XML_TAG_ATTRIBUTES = exports.XML_TAG_ERROR = exports.XML_TAG_EVAL = exports.XML_TAG_INSERT = exports.XML_TAG_DELETE = exports.XML_TAG_UPDATE = exports.XML_TAG_CHANGES = exports.XML_TAG_PARTIAL_RESP = exports.ATTR_ID = exports.ATTR_VALUE = exports.ATTR_NAME = exports.ATTR_URL = exports.ERR_NO_PARTIAL_RESPONSE = exports.PHASE_PROCESS_RESPONSE = exports.SEL_RESPONSE_XML = exports.SEL_CLIENT_WINDOW_ELEM = exports.SEL_VIEWSTATE_ELEM = exports.HTML_TAG_STYLE = exports.HTML_TAG_SCRIPT = exports.HTML_TAG_LINK = exports.HTML_TAG_BODY = exports.HTML_TAG_FORM = exports.HTML_TAG_HEAD = exports.STD_ACCEPT = exports.NO_TIMEOUT = exports.MULTIPART = exports.URL_ENCODED = exports.STATE_EVT_COMPLETE = exports.STATE_EVT_TIMEOUT = exports.STATE_EVT_BEGIN = exports.REQ_TYPE_POST = exports.REQ_TYPE_GET = exports.ENCODED_URL = exports.VAL_AJAX = exports.REQ_ACCEPT = exports.HEAD_FACES_REQ = exports.CONTENT_TYPE = exports.CTX_PARAM_REQ_PASS_THR = exports.CTX_PARAM_SRC_CTL_ID = exports.CTX_PARAM_SRC_FRM_ID = exports.CTX_PARAM_MF_INTERNAL = exports.CTX_OPTIONS_EXECUTE = exports.CTX_OPTIONS_RESET = exports.CTX_OPTIONS_TIMEOUT = exports.DELAY_NONE = exports.CTX_OPTIONS_DELAY = void 0;
5347
- exports.$nsp = exports.$faces = exports.UNKNOWN = exports.MAX_RECONNECT_ATTEMPTS = exports.RECONNECT_INTERVAL = exports.APPLIED_CLIENT_WINDOW = exports.APPLIED_VST = exports.REASON_EXPIRED = exports.MF_NONE = exports.MYFACES = exports.DEFERRED_HEAD_INSERTS = exports.UPDATE_ELEMS = exports.UPDATE_FORMS = exports.XML_TAG_ATTR = void 0;
5195
+ exports.CTX_OPTIONS_PARAMS = exports.TIMEOUT_EVENT = exports.CLIENT_ERROR = exports.SERVER_ERROR = exports.MALFORMEDXML = exports.EMPTY_RESPONSE = exports.HTTPERROR = exports.RESPONSE_XML = exports.RESPONSE_TEXT = exports.ERROR_MESSAGE = exports.ERROR_NAME = exports.STATUS = exports.SOURCE = exports.SUCCESS = exports.COMPLETE = exports.BEGIN = exports.ON_EVENT = exports.ON_ERROR = exports.EVENT = exports.ERROR = exports.WINDOW_ID = exports.CTX_PARAM_RENDER = exports.P_BEHAVIOR_EVENT = exports.P_WINDOW_ID = exports.P_RESET_VALUES = exports.P_EVT = exports.P_RENDER_OVERRIDE = exports.P_RENDER = exports.P_EXECUTE = exports.P_AJAX = exports.IDENT_FORM = exports.IDENT_THIS = exports.IDENT_NONE = exports.IDENT_ALL = exports.HTML_CLIENT_WINDOW = exports.HTML_VIEWSTATE = exports.EMPTY_MAP = exports.EMPTY_STR = exports.EMPTY_FUNC = exports.P_RESOURCE = exports.P_VIEWBODY = exports.P_VIEWHEAD = exports.P_VIEWROOT = exports.P_CLIENT_WINDOW = exports.P_VIEWSTATE = exports.VIEW_ID = exports.NAMING_CONTAINER_ID = exports.P_AJAX_SOURCE = exports.NAMED_VIEWROOT = exports.XML_ATTR_NAMED_VIEWROOT = void 0;
5196
+ exports.XML_TAG_REDIRECT = exports.XML_TAG_EXTENSION = exports.XML_TAG_ATTRIBUTES = exports.XML_TAG_ERROR = exports.XML_TAG_EVAL = exports.XML_TAG_INSERT = exports.XML_TAG_DELETE = exports.XML_TAG_UPDATE = exports.XML_TAG_CHANGES = exports.XML_TAG_PARTIAL_RESP = exports.ATTR_ID = exports.ATTR_VALUE = exports.ATTR_NAME = exports.ATTR_URL = exports.MYFACES_OPTION_PPS = exports.ERR_NO_PARTIAL_RESPONSE = exports.PHASE_PROCESS_RESPONSE = exports.SEL_RESPONSE_XML = exports.SEL_CLIENT_WINDOW_ELEM = exports.SEL_VIEWSTATE_ELEM = exports.HTML_TAG_STYLE = exports.HTML_TAG_SCRIPT = exports.HTML_TAG_LINK = exports.HTML_TAG_BODY = exports.HTML_TAG_FORM = exports.HTML_TAG_HEAD = exports.STD_ACCEPT = exports.NO_TIMEOUT = exports.MULTIPART = exports.URL_ENCODED = exports.STATE_EVT_COMPLETE = exports.STATE_EVT_TIMEOUT = exports.STATE_EVT_BEGIN = exports.REQ_TYPE_POST = exports.REQ_TYPE_GET = exports.ENCODED_URL = exports.VAL_AJAX = exports.REQ_ACCEPT = exports.HEAD_FACES_REQ = exports.CONTENT_TYPE = exports.CTX_PARAM_PPS = exports.CTX_PARAM_REQ_PASS_THR = exports.CTX_PARAM_SRC_CTL_ID = exports.CTX_PARAM_SRC_FRM_ID = exports.CTX_PARAM_MF_INTERNAL = exports.CTX_OPTIONS_EXECUTE = exports.CTX_OPTIONS_RESET = exports.CTX_OPTIONS_TIMEOUT = exports.DELAY_NONE = exports.CTX_OPTIONS_DELAY = void 0;
5197
+ exports.$nsp = exports.$faces = exports.UNKNOWN = exports.MAX_RECONNECT_ATTEMPTS = exports.RECONNECT_INTERVAL = exports.APPLIED_CLIENT_WINDOW = exports.APPLIED_VST = exports.REASON_EXPIRED = exports.MF_NONE = exports.MYFACES = exports.DEFERRED_HEAD_INSERTS = exports.UPDATE_ELEMS = exports.UPDATE_FORMS = exports.XML_TAG_ATTR = exports.XML_TAG_AFTER = exports.XML_TAG_BEFORE = void 0;
5348
5198
  /*
5349
5199
  * [export const] constants
5350
5200
  */
5351
5201
  exports.XML_ATTR_NAMED_VIEWROOT = "namedViewRoot";
5352
5202
  exports.NAMED_VIEWROOT = "namedViewRoot";
5353
- exports.P_PARTIAL_SOURCE = "jakarta.faces.source";
5354
- exports.NAMING_CONTAINER_ID = "myfaces.partialId";
5203
+ exports.P_AJAX_SOURCE = "jakarta.faces.source";
5204
+ exports.NAMING_CONTAINER_ID = "myfaces.NamingContainerId";
5355
5205
  exports.VIEW_ID = "myfaces.viewId";
5356
5206
  exports.P_VIEWSTATE = "jakarta.faces.ViewState";
5357
5207
  exports.P_CLIENT_WINDOW = "jakarta.faces.ClientWindow";
@@ -5414,6 +5264,7 @@ exports.CTX_PARAM_MF_INTERNAL = "myfaces.internal";
5414
5264
  exports.CTX_PARAM_SRC_FRM_ID = "myfaces.source.formId";
5415
5265
  exports.CTX_PARAM_SRC_CTL_ID = "myfaces.source.controlId";
5416
5266
  exports.CTX_PARAM_REQ_PASS_THR = "myfaces.request.passThrough";
5267
+ exports.CTX_PARAM_PPS = "myfaces.request.pps";
5417
5268
  exports.CONTENT_TYPE = "Content-Type";
5418
5269
  exports.HEAD_FACES_REQ = "Faces-Request";
5419
5270
  exports.REQ_ACCEPT = "Accept";
@@ -5439,6 +5290,7 @@ exports.SEL_CLIENT_WINDOW_ELEM = "[name='" + exports.P_CLIENT_WINDOW + "']";
5439
5290
  exports.SEL_RESPONSE_XML = "responseXML";
5440
5291
  exports.PHASE_PROCESS_RESPONSE = "processResponse";
5441
5292
  exports.ERR_NO_PARTIAL_RESPONSE = "Partial response not set";
5293
+ exports.MYFACES_OPTION_PPS = "pps";
5442
5294
  exports.ATTR_URL = "url";
5443
5295
  exports.ATTR_NAME = "name";
5444
5296
  exports.ATTR_VALUE = "value";
@@ -5774,120 +5626,89 @@ var Assertions;
5774
5626
 
5775
5627
  /***/ }),
5776
5628
 
5777
- /***/ "./src/main/typescript/impl/util/AsyncQueue.ts":
5778
- /*!*****************************************************!*\
5779
- !*** ./src/main/typescript/impl/util/AsyncQueue.ts ***!
5780
- \*****************************************************/
5629
+ /***/ "./src/main/typescript/impl/util/AsyncRunnable.ts":
5630
+ /*!********************************************************!*\
5631
+ !*** ./src/main/typescript/impl/util/AsyncRunnable.ts ***!
5632
+ \********************************************************/
5781
5633
  /***/ ((__unused_webpack_module, exports) => {
5782
5634
 
5783
5635
 
5784
- Object.defineProperty(exports, "__esModule", ({ value: true }));
5785
- exports.AsynchronousQueue = void 0;
5786
- /**
5787
- * Asynchronous queue which starts to work
5788
- * through the callbacks until the queue is empty
5636
+ /*! Licensed to the Apache Software Foundation (ASF) under one or more
5637
+ * contributor license agreements. See the NOTICE file distributed with
5638
+ * this work for additional information regarding copyright ownership.
5639
+ * The ASF licenses this file to you under the Apache License, Version 2.0
5640
+ * (the "License"); you may not use this file except in compliance with
5641
+ * the License. You may obtain a copy of the License at
5789
5642
  *
5790
- * Every callback must be of async runnable
5791
- * which is sort of an extended promise which has
5792
- * added a dedicated cancel and start point
5643
+ * http://www.apache.org/licenses/LICENSE-2.0
5793
5644
  *
5794
- * This interface can be used as wrapper contract
5795
- * for normal promises if needed.
5645
+ * Unless required by applicable law or agreed to in writing, software
5646
+ * distributed under the License is distributed on an "AS IS" BASIS,
5647
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5648
+ * See the License for the specific language governing permissions and
5649
+ * limitations under the License.
5650
+ */
5651
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
5652
+ exports.AsyncRunnable = void 0;
5653
+ /**
5654
+ * pretty much the same as cancellable Promise, but given
5655
+ * we do not have that on browser level yet this is sort
5656
+ * of a non - intrusive Shim!
5796
5657
  */
5797
- class AsynchronousQueue {
5658
+ class AsyncRunnable {
5798
5659
  constructor() {
5799
- this.runnableQueue = [];
5660
+ /**
5661
+ * helper support so that we do not have to drag in Promise shims
5662
+ */
5663
+ this.catchFunctions = [];
5664
+ this.thenFunctions = [];
5800
5665
  }
5801
5666
  /**
5802
- * simple is empty accessor, returns true if queue is empty atm
5667
+ * resolve handler function which calls the then chain
5668
+ * and after that finally
5669
+ * @param data
5803
5670
  */
5804
- get isEmpty() {
5805
- return !this.runnableQueue.length;
5671
+ resolve(data) {
5672
+ this.thenFunctions.reduce((inputVal, thenFunc) => {
5673
+ return thenFunc(inputVal);
5674
+ }, data);
5806
5675
  }
5807
5676
  /**
5808
- * enqueues an element and starts the
5809
- * asynchronous work loop if not already running
5810
- *
5811
- * @param element the element to be queued and processed
5812
- * @param delay possible delay after our usual process or drop if something newer is incoming algorithm
5677
+ * reject handler function which triggers the catch chain
5678
+ * @param data
5813
5679
  */
5814
- enqueue(element, delay = 0) {
5815
- if (this.delayTimeout) {
5816
- clearTimeout(this.delayTimeout);
5817
- this.delayTimeout = null;
5818
- }
5819
- if (delay) {
5820
- this.delayTimeout = setTimeout(() => {
5821
- this.appendElement(element);
5822
- });
5823
- }
5824
- else {
5825
- this.appendElement(element);
5826
- }
5680
+ reject(data) {
5681
+ this.catchFunctions.reduce((inputVal, catchFunc) => {
5682
+ return catchFunc(inputVal);
5683
+ }, data);
5827
5684
  }
5828
5685
  /**
5829
- * fetches the next element from the queue (first in first out order)
5686
+ * register a catch functor
5687
+ * @param func the functor for the catch monad
5830
5688
  */
5831
- dequeue() {
5832
- return this.runnableQueue.shift();
5689
+ catch(func) {
5690
+ this.catchFunctions.push(func);
5691
+ return this;
5833
5692
  }
5834
5693
  /**
5835
- * clears up all elements from the queue
5694
+ * registers a finally functor
5695
+ * @param func the functor for the finally handling chanin
5836
5696
  */
5837
- cleanup() {
5838
- this.currentlyRunning = null;
5839
- this.runnableQueue.length = 0;
5697
+ finally(func) {
5698
+ // no ie11 support we probably are going to revert to shims for that one
5699
+ this.catchFunctions.push(func);
5700
+ this.thenFunctions.push(func);
5701
+ return this;
5840
5702
  }
5841
5703
  /**
5842
- * cancels the currently running element and then cleans up the queue
5843
- * aka cancel the queue entirely
5704
+ * @param func then functor similar to promise
5844
5705
  */
5845
- cancel() {
5846
- try {
5847
- if (this.currentlyRunning) {
5848
- this.currentlyRunning.cancel();
5849
- }
5850
- }
5851
- finally {
5852
- this.cleanup();
5853
- }
5854
- }
5855
- callForNextElementToProcess() {
5856
- this.runEntry();
5857
- }
5858
- appendElement(element) {
5859
- //only if the first element is added we start with a trigger
5860
- //otherwise a process already is running and not finished yet at that
5861
- //time
5862
- this.runnableQueue.push(element);
5863
- if (!this.currentlyRunning) {
5864
- this.runEntry();
5865
- }
5866
- }
5867
- runEntry() {
5868
- if (this.isEmpty) {
5869
- this.currentlyRunning = null;
5870
- return;
5871
- }
5872
- this.currentlyRunning = this.dequeue();
5873
- this.currentlyRunning
5874
- .catch((e) => {
5875
- //in case of an error we always clean up the remaining calls
5876
- //to allow a clean recovery of the application
5877
- this.cleanup();
5878
- throw e;
5879
- })
5880
- .then(
5881
- //the idea is to trigger the next over an event to reduce
5882
- //the number of recursive calls (stacks might be limited
5883
- //compared to ram)
5884
- //naturally give we have a DOM, the DOM is the natural event dispatch system
5885
- //which we can use, to decouple the calls from a recursive stack call
5886
- //(the browser engine will take care of that)
5887
- () => this.callForNextElementToProcess()).start();
5706
+ then(func) {
5707
+ this.thenFunctions.push(func);
5708
+ return this;
5888
5709
  }
5889
5710
  }
5890
- exports.AsynchronousQueue = AsynchronousQueue;
5711
+ exports.AsyncRunnable = AsyncRunnable;
5891
5712
 
5892
5713
 
5893
5714
  /***/ }),
@@ -5996,6 +5817,7 @@ class ExtDomQuery extends mona_dish_1.DQ {
5996
5817
  * this is done once and only lazily
5997
5818
  */
5998
5819
  get nonce() {
5820
+ var _a;
5999
5821
  //already processed
6000
5822
  let myfacesConfig = new ExtConfig(window.myfaces);
6001
5823
  let nonce = myfacesConfig.getIf("config", "cspMeta", "nonce");
@@ -6010,12 +5832,10 @@ class ExtDomQuery extends mona_dish_1.DQ {
6010
5832
  }
6011
5833
  // fallback if the currentScript method fails, we just search the jsf tags for nonce, this is
6012
5834
  // the last possibility
6013
- let nonceScript = mona_dish_1.DQ
6014
- .querySelectorAll("script[src], link[src]")
6015
- .lazyStream
5835
+ let nonceScript = mona_dish_1.Optional.fromNullable((_a = mona_dish_1.DQ
5836
+ .querySelectorAll("script[src], link[src]").asArray
6016
5837
  .filter((item) => this.extractNonce(item) && item.attr(ATTR_SRC) != null)
6017
- .filter(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value))
6018
- .first();
5838
+ .filter(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value))) === null || _a === void 0 ? void 0 : _a[0]);
6019
5839
  if (nonceScript.isPresent()) {
6020
5840
  return this.extractNonce(nonceScript.value);
6021
5841
  }
@@ -6030,14 +5850,15 @@ class ExtDomQuery extends mona_dish_1.DQ {
6030
5850
  * @param regExp
6031
5851
  */
6032
5852
  searchJsfJsFor(regExp) {
5853
+ var _a;
6033
5854
  //perfect application for lazy stream
6034
- return mona_dish_1.DQ.querySelectorAll("script[src], link[src]").lazyStream
5855
+ return mona_dish_1.Optional.fromNullable((_a = mona_dish_1.DQ.querySelectorAll("script[src], link[src]").asArray
6035
5856
  .filter(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value))
6036
5857
  .map(item => item.attr(ATTR_SRC).value.match(regExp))
6037
5858
  .filter(item => item != null && item.length > 1)
6038
5859
  .map((result) => {
6039
5860
  return decodeURIComponent(result[1]);
6040
- }).first();
5861
+ })) === null || _a === void 0 ? void 0 : _a[0]);
6041
5862
  }
6042
5863
  globalEval(code, nonce) {
6043
5864
  return new ExtDomQuery(super.globalEval(code, nonce !== null && nonce !== void 0 ? nonce : this.nonce));
@@ -6196,7 +6017,7 @@ class ExtConfig extends mona_dish_1.Config {
6196
6017
  if (!this.$nspEnabled) {
6197
6018
  return accessPath;
6198
6019
  }
6199
- return mona_dish_1.Stream.of(...accessPath).map(key => (0, Const_1.$nsp)(key)).collect(new mona_dish_1.ArrayCollector());
6020
+ return [...accessPath].map(key => (0, Const_1.$nsp)(key));
6200
6021
  }
6201
6022
  }
6202
6023
  exports.ExtConfig = ExtConfig;
@@ -6212,8 +6033,7 @@ exports.ExtConfig = ExtConfig;
6212
6033
 
6213
6034
 
6214
6035
  Object.defineProperty(exports, "__esModule", ({ value: true }));
6215
- exports.getFormInputsAsStream = exports.fixEmmptyParameters = exports.resolveFiles = exports.decodeEncodedValues = exports.encodeFormData = void 0;
6216
- const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
6036
+ exports.getFormInputsAsArr = exports.fixEmptyParameters = exports.resolveFiles = exports.decodeEncodedValues = exports.encodeFormData = void 0;
6217
6037
  const ExtDomQuery_1 = __webpack_require__(/*! ./ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
6218
6038
  const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
6219
6039
  /*
@@ -6231,18 +6051,16 @@ function encodeFormData(formData, paramsMapper = (inStr, inVal) => [inStr, inVal
6231
6051
  return defaultStr;
6232
6052
  }
6233
6053
  const assocValues = formData.value;
6234
- const expandValueArrAndRename = key => mona_dish_1.Stream.of(...assocValues[key]).map(val => paramsMapper(key, val));
6054
+ const expandValueArrAndRename = key => assocValues[key].map(val => paramsMapper(key, val));
6235
6055
  const isPropertyKey = key => assocValues.hasOwnProperty(key);
6236
6056
  const isNotFile = ([, value]) => !(value instanceof ExtDomQuery_1.ExtDomQuery.global().File);
6237
6057
  const mapIntoUrlParam = keyVal => `${encodeURIComponent(keyVal[0])}=${encodeURIComponent(keyVal[1])}`;
6238
- const entries = mona_dish_1.LazyStream.of(...Object.keys(assocValues))
6058
+ return Object.keys(assocValues)
6239
6059
  .filter(isPropertyKey)
6240
6060
  .flatMap(expandValueArrAndRename)
6241
- //we cannot encode file elements that is handled by multipart requests anyway
6242
6061
  .filter(isNotFile)
6243
6062
  .map(mapIntoUrlParam)
6244
- .collect(new mona_dish_1.ArrayCollector());
6245
- return entries.join("&");
6063
+ .join("&");
6246
6064
  }
6247
6065
  exports.encodeFormData = encodeFormData;
6248
6066
  /**
@@ -6259,9 +6077,7 @@ function decodeEncodedValues(encoded) {
6259
6077
  return [line.substring(0, index), line.substring(index + 1)];
6260
6078
  };
6261
6079
  let requestParamEntries = decodeURIComponent(encoded).split(/&/gi);
6262
- return mona_dish_1.Stream.of(...requestParamEntries)
6263
- .filter(filterBlanks)
6264
- .map(splitKeyValuePair);
6080
+ return requestParamEntries.filter(filterBlanks).map(splitKeyValuePair);
6265
6081
  }
6266
6082
  exports.decodeEncodedValues = decodeEncodedValues;
6267
6083
  /**
@@ -6269,20 +6085,26 @@ exports.decodeEncodedValues = decodeEncodedValues;
6269
6085
  * @param dataSource
6270
6086
  */
6271
6087
  function resolveFiles(dataSource) {
6272
- const expandFilesArr = ([key, files]) => mona_dish_1.Stream.of(...files).map(file => [key, file]);
6273
- const remapFileInput = fileInput => [fileInput.name.value || fileInput.id.value, fileInput.filesFromElem(0)];
6274
- return dataSource
6088
+ const expandFilesArr = ([key, files]) => {
6089
+ return [...files].map(file => [key, file]);
6090
+ };
6091
+ const remapFileInput = fileInput => {
6092
+ return [fileInput.name.value || fileInput.id.value, fileInput.filesFromElem(0)];
6093
+ };
6094
+ const files = dataSource
6275
6095
  .querySelectorAllDeep("input[type='file']")
6276
- .stream
6096
+ .asArray;
6097
+ const ret = files
6277
6098
  .map(remapFileInput)
6278
6099
  .flatMap(expandFilesArr);
6100
+ return ret;
6279
6101
  }
6280
6102
  exports.resolveFiles = resolveFiles;
6281
- function fixEmmptyParameters(keyVal) {
6103
+ function fixEmptyParameters(keyVal) {
6282
6104
  var _a, _b;
6283
6105
  return (keyVal.length < 3 ? [(_a = keyVal === null || keyVal === void 0 ? void 0 : keyVal[0]) !== null && _a !== void 0 ? _a : [], (_b = keyVal === null || keyVal === void 0 ? void 0 : keyVal[1]) !== null && _b !== void 0 ? _b : []] : keyVal);
6284
6106
  }
6285
- exports.fixEmmptyParameters = fixEmmptyParameters;
6107
+ exports.fixEmptyParameters = fixEmptyParameters;
6286
6108
  /**
6287
6109
  * returns the decoded viewState from parentItem
6288
6110
  * @param parentItem
@@ -6296,15 +6118,15 @@ function resolveViewState(parentItem) {
6296
6118
  }
6297
6119
  /**
6298
6120
  * gets all the inputs under the form parentItem
6299
- * as stream
6121
+ * as array
6300
6122
  * @param parentItem
6301
6123
  */
6302
- function getFormInputsAsStream(parentItem) {
6124
+ function getFormInputsAsArr(parentItem) {
6303
6125
  const standardInputs = resolveViewState(parentItem);
6304
6126
  const fileInputs = resolveFiles(parentItem);
6305
- return standardInputs.concat(fileInputs);
6127
+ return standardInputs.concat(...fileInputs);
6306
6128
  }
6307
- exports.getFormInputsAsStream = getFormInputsAsStream;
6129
+ exports.getFormInputsAsArr = getFormInputsAsArr;
6308
6130
 
6309
6131
 
6310
6132
  /***/ }),
@@ -6367,13 +6189,17 @@ class HiddenInputBuilder {
6367
6189
  var _a, _b, _c;
6368
6190
  const SEP = (0, Const_1.$faces)().separatorchar;
6369
6191
  let existingStates = (0, mona_dish_1.DQ$)(`[name*='${(0, Const_1.$nsp)(this.name)}']`);
6370
- let cnt = existingStates.stream.map(state => {
6192
+ let cnt = existingStates.asArray.map(state => {
6371
6193
  let ident = state.id.orElse("-1").value;
6372
6194
  ident = ident.substring(ident.lastIndexOf(SEP) + 1);
6373
6195
  return parseInt(ident);
6374
6196
  })
6375
- .filter(item => !isNaN(item))
6376
- .reduce((item1, item2) => Math.max(item1, item2), -1).value;
6197
+ .filter(item => {
6198
+ return !isNaN(item);
6199
+ })
6200
+ .reduce((item1, item2) => {
6201
+ return Math.max(item1, item2);
6202
+ }, -1);
6377
6203
  //the maximum new ident is the current max + 1
6378
6204
  cnt++;
6379
6205
  const newElement = mona_dish_1.DQ.fromMarkup((0, Const_1.$nsp)(this.template));
@@ -6489,7 +6315,7 @@ var ExtLang;
6489
6315
  var _a, _b;
6490
6316
  installedLocale = installedLocale !== null && installedLocale !== void 0 ? installedLocale : new Messages_1.Messages();
6491
6317
  let msg = (_b = (_a = installedLocale[key]) !== null && _a !== void 0 ? _a : defaultMessage) !== null && _b !== void 0 ? _b : key;
6492
- mona_dish_1.Stream.of(...templateParams).each((param, cnt) => {
6318
+ templateParams.forEach((param, cnt) => {
6493
6319
  msg = msg.replace(new RegExp(["\\{", cnt, "\\}"].join(Const_1.EMPTY_STR), "g"), param);
6494
6320
  });
6495
6321
  return msg;
@@ -6597,6 +6423,57 @@ var ExtLang;
6597
6423
  return (_g = (_d = (_c = (_b = (_a = localOptions.value) === null || _a === void 0 ? void 0 : _a.myfaces) === null || _b === void 0 ? void 0 : _b.config) === null || _c === void 0 ? void 0 : _c[configName]) !== null && _d !== void 0 ? _d : (_f = (_e = window === null || window === void 0 ? void 0 : window.myfaces) === null || _e === void 0 ? void 0 : _e.config) === null || _f === void 0 ? void 0 : _f[configName]) !== null && _g !== void 0 ? _g : defaultValue;
6598
6424
  }
6599
6425
  ExtLang.getLocalOrGlobalConfig = getLocalOrGlobalConfig;
6426
+ /**
6427
+ * expands an associative array into an array of key value tuples
6428
+ * @param value
6429
+ */
6430
+ function ofAssoc(value) {
6431
+ return Object.keys(value)
6432
+ .map(key => [key, value[key]]);
6433
+ }
6434
+ ExtLang.ofAssoc = ofAssoc;
6435
+ function collectAssoc(target, item) {
6436
+ target[item[0]] = item[1];
6437
+ return target;
6438
+ }
6439
+ ExtLang.collectAssoc = collectAssoc;
6440
+ /**
6441
+ * The active timeout for the "debounce".
6442
+ * Since we only use it in the XhrController
6443
+ * we can use a local module variable here
6444
+ */
6445
+ let activeTimeouts = {};
6446
+ /**
6447
+ * a simple debounce function
6448
+ * which waits until a timeout is reached and
6449
+ * if something comes in in between debounces
6450
+ *
6451
+ * @param runnable a runnable which should go under debounce control
6452
+ * @param timeout a timeout for the debounce window
6453
+ */
6454
+ function debounce(key, runnable, timeout) {
6455
+ function clearActiveTimeout() {
6456
+ clearTimeout(activeTimeouts[key]);
6457
+ delete activeTimeouts[key];
6458
+ }
6459
+ if (!!(activeTimeouts === null || activeTimeouts === void 0 ? void 0 : activeTimeouts[key])) {
6460
+ clearActiveTimeout();
6461
+ }
6462
+ if (timeout > 0) {
6463
+ activeTimeouts[key] = setTimeout(() => {
6464
+ try {
6465
+ runnable();
6466
+ }
6467
+ finally {
6468
+ clearActiveTimeout();
6469
+ }
6470
+ }, timeout);
6471
+ }
6472
+ else {
6473
+ runnable();
6474
+ }
6475
+ }
6476
+ ExtLang.debounce = debounce;
6600
6477
  /**
6601
6478
  * assert that the form exists and throw an exception in the case it does not
6602
6479
  *
@@ -6610,6 +6487,122 @@ var ExtLang;
6610
6487
  })(ExtLang = exports.ExtLang || (exports.ExtLang = {}));
6611
6488
 
6612
6489
 
6490
+ /***/ }),
6491
+
6492
+ /***/ "./src/main/typescript/impl/util/XhrQueueController.ts":
6493
+ /*!*************************************************************!*\
6494
+ !*** ./src/main/typescript/impl/util/XhrQueueController.ts ***!
6495
+ \*************************************************************/
6496
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6497
+
6498
+
6499
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
6500
+ exports.XhrQueueController = void 0;
6501
+ const Lang_1 = __webpack_require__(/*! ./Lang */ "./src/main/typescript/impl/util/Lang.ts");
6502
+ var debounce = Lang_1.ExtLang.debounce;
6503
+ /**
6504
+ * A simple XHR queue controller
6505
+ * following the async op -> next pattern
6506
+ * Faces enforces for the XHR handling
6507
+ */
6508
+ class XhrQueueController {
6509
+ constructor() {
6510
+ this.queue = [];
6511
+ this.taskRunning = false;
6512
+ }
6513
+ /**
6514
+ * executes or enqueues an element
6515
+ * @param runnable the runnable (request) to be enqueued
6516
+ * @param timeOut timeout if > 0 which defers the execution
6517
+ * until the debounce window for the timeout is closed.
6518
+ */
6519
+ enqueue(runnable, timeOut = 0) {
6520
+ debounce("xhrQueue", () => {
6521
+ const requestHandler = this.enrichRunnable(runnable);
6522
+ if (!this.taskRunning) {
6523
+ this.signalTaskRunning();
6524
+ requestHandler.start();
6525
+ }
6526
+ else {
6527
+ this.queue.push(requestHandler);
6528
+ }
6529
+ }, timeOut);
6530
+ }
6531
+ /**
6532
+ * trigger the next element in the queue
6533
+ * to be started!
6534
+ */
6535
+ next() {
6536
+ this.updateTaskRunning();
6537
+ const next = this.queue.shift();
6538
+ next === null || next === void 0 ? void 0 : next.start();
6539
+ }
6540
+ /**
6541
+ * clears and resets the queue
6542
+ */
6543
+ clear() {
6544
+ this.queue.length = 0;
6545
+ this.updateTaskRunning();
6546
+ }
6547
+ /**
6548
+ * true if queue is empty
6549
+ */
6550
+ get isEmpty() {
6551
+ return !this.queue.length;
6552
+ }
6553
+ /**
6554
+ * Enriches the incoming async asyncRunnable
6555
+ * with the error and next handling
6556
+ * (aka: asyncRunnable is done -> next
6557
+ * error -> clear queue
6558
+ * @param asyncRunnable the async runnable which needs enrichment
6559
+ * @private
6560
+ */
6561
+ enrichRunnable(asyncRunnable) {
6562
+ /**
6563
+ * we can use the Promise pattern asyncrunnable uses
6564
+ * to trigger queue control callbacks of next element
6565
+ * and clear the queue (theoretically this
6566
+ * would work with any promise)
6567
+ */
6568
+ try {
6569
+ return asyncRunnable
6570
+ .then(() => this.next())
6571
+ .catch((e) => this.handleError(e));
6572
+ }
6573
+ catch (e) {
6574
+ this.handleError(e);
6575
+ }
6576
+ }
6577
+ /**
6578
+ * alerts the queue that a task is running
6579
+ *
6580
+ * @private
6581
+ */
6582
+ signalTaskRunning() {
6583
+ this.taskRunning = true;
6584
+ }
6585
+ /**
6586
+ * updates the task running status according to the current queue
6587
+ * @private
6588
+ */
6589
+ updateTaskRunning() {
6590
+ this.taskRunning = !this.isEmpty;
6591
+ }
6592
+ /**
6593
+ * standard error handling
6594
+ * we clear the queue and then bomb out
6595
+ * @param e
6596
+ * @private
6597
+ */
6598
+ handleError(e) {
6599
+ this.clear();
6600
+ throw e;
6601
+ }
6602
+ }
6603
+ exports.XhrQueueController = XhrQueueController;
6604
+
6605
+
6613
6606
  /***/ }),
6614
6607
 
6615
6608
  /***/ "./src/main/typescript/impl/xhrCore/ErrorData.ts":
@@ -6737,8 +6730,8 @@ class EventData {
6737
6730
  eventData.type = Const_1.EVENT;
6738
6731
  eventData.status = name;
6739
6732
  let sourceId = context.getIf(Const_1.SOURCE)
6740
- .orElseLazy(() => context.getIf(Const_1.P_PARTIAL_SOURCE).value)
6741
- .orElseLazy(() => context.getIf(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_PARTIAL_SOURCE).value)
6733
+ .orElseLazy(() => context.getIf(Const_1.P_AJAX_SOURCE).value)
6734
+ .orElseLazy(() => context.getIf(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_AJAX_SOURCE).value)
6742
6735
  .value;
6743
6736
  if (sourceId) {
6744
6737
  eventData.source = mona_dish_1.DQ.byId(sourceId, true).first().value.value;
@@ -7295,6 +7288,8 @@ const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/
7295
7288
  const ExtDomQuery_1 = __webpack_require__(/*! ../util/ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
7296
7289
  const HiddenInputBuilder_1 = __webpack_require__(/*! ../util/HiddenInputBuilder */ "./src/main/typescript/impl/util/HiddenInputBuilder.ts");
7297
7290
  var trim = mona_dish_1.Lang.trim;
7291
+ const Lang_1 = __webpack_require__(/*! ../util/Lang */ "./src/main/typescript/impl/util/Lang.ts");
7292
+ var ofAssoc = Lang_1.ExtLang.ofAssoc;
7298
7293
  /**
7299
7294
  * Response processor
7300
7295
  *
@@ -7392,7 +7387,7 @@ class ResponseProcessor {
7392
7387
  * <error>
7393
7388
  */
7394
7389
  const mergedErrorData = new ExtDomQuery_1.ExtConfig({});
7395
- mergedErrorData.assign(Const_1.SOURCE).value = this.externalContext.getIf(Const_1.P_PARTIAL_SOURCE).get(0).value;
7390
+ mergedErrorData.assign(Const_1.SOURCE).value = this.externalContext.getIf(Const_1.P_AJAX_SOURCE).get(0).value;
7396
7391
  mergedErrorData.assign(Const_1.ERROR_NAME).value = node.querySelectorAll(Const_1.ERROR_NAME).textContent(Const_1.EMPTY_STR);
7397
7392
  mergedErrorData.assign(Const_1.ERROR_MESSAGE).value = node.querySelectorAll(Const_1.ERROR_MESSAGE).cDATAAsString;
7398
7393
  const hasResponseXML = this.internalContext.get(Const_1.RESPONSE_XML).isPresent();
@@ -7540,8 +7535,8 @@ class ResponseProcessor {
7540
7535
  * as last lifecycle step, before going into the next request.
7541
7536
  */
7542
7537
  fixViewStates() {
7543
- mona_dish_1.Stream.ofAssoc(this.internalContext.getIf(Const_1.APPLIED_VST).orElse({}).value)
7544
- .each(([, value]) => {
7538
+ ofAssoc(this.internalContext.getIf(Const_1.APPLIED_VST).orElse({}).value)
7539
+ .forEach(([, value]) => {
7545
7540
  const namingContainerId = this.internalContext.getIf(Const_1.NAMING_CONTAINER_ID);
7546
7541
  const namedViewRoot = !!this.internalContext.getIf(Const_1.NAMED_VIEWROOT).value;
7547
7542
  const affectedForms = this.getContainerForms(namingContainerId)
@@ -7554,8 +7549,8 @@ class ResponseProcessor {
7554
7549
  * is done.
7555
7550
  */
7556
7551
  fixClientWindow() {
7557
- mona_dish_1.Stream.ofAssoc(this.internalContext.getIf(Const_1.APPLIED_CLIENT_WINDOW).orElse({}).value)
7558
- .each(([, value]) => {
7552
+ ofAssoc(this.internalContext.getIf(Const_1.APPLIED_CLIENT_WINDOW).orElse({}).value)
7553
+ .forEach(([, value]) => {
7559
7554
  const namingContainerId = this.internalContext.getIf(Const_1.NAMING_CONTAINER_ID);
7560
7555
  const namedViewRoot = !!this.internalContext.getIf(Const_1.NAMED_VIEWROOT).value;
7561
7556
  const affectedForms = this.getContainerForms(namingContainerId)
@@ -7698,7 +7693,7 @@ class ResponseProcessor {
7698
7693
  .orElseLazy(() => this.externalContext.getIf((0, Const_1.$nsp)(Const_1.P_RENDER)).value)
7699
7694
  .orElse(Const_1.IDENT_NONE).value.split(/\s+/gi);
7700
7695
  const executeAndRenders = executes.concat(...renders);
7701
- return mona_dish_1.LazyStream.of(...executeAndRenders).filter(nameOrId => {
7696
+ return [...executeAndRenders].filter(nameOrId => {
7702
7697
  if ([Const_1.IDENT_ALL, Const_1.IDENT_NONE].indexOf(nameOrId) != -1) {
7703
7698
  return true;
7704
7699
  }
@@ -7707,7 +7702,7 @@ class ResponseProcessor {
7707
7702
  return affectedForm.matchesSelector(NAME_OR_ID) ||
7708
7703
  affectedForm.querySelectorAll(NAME_OR_ID).isPresent() ||
7709
7704
  affectedForm.firstParent(NAME_OR_ID).isPresent();
7710
- }).first().isPresent();
7705
+ }).length > 0;
7711
7706
  }
7712
7707
  /**
7713
7708
  * gets all forms under a single naming container id
@@ -7763,6 +7758,8 @@ exports.XhrFormData = void 0;
7763
7758
  const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
7764
7759
  const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
7765
7760
  const FileUtils_1 = __webpack_require__(/*! ../util/FileUtils */ "./src/main/typescript/impl/util/FileUtils.ts");
7761
+ const Lang_1 = __webpack_require__(/*! ../util/Lang */ "./src/main/typescript/impl/util/Lang.ts");
7762
+ var ofAssoc = Lang_1.ExtLang.ofAssoc;
7766
7763
  const defaultParamsMapper = (key, item) => [key, item];
7767
7764
  /**
7768
7765
  * A unified form data class
@@ -7815,12 +7812,17 @@ class XhrFormData extends mona_dish_1.Config {
7815
7812
  */
7816
7813
  toFormData() {
7817
7814
  /*
7818
- * expands key: [item1, item2]
7819
- * to: [{key: key, value: item1}, {key: key, value: item2}]
7820
- */
7821
- let expandAssocArray = ([key, item]) => mona_dish_1.Stream.of(...item).map(value => {
7822
- return { key, value };
7823
- });
7815
+ * expands key: [item1, item2]
7816
+ * to: [{key: key, value: item1}, {key: key, value: item2}]
7817
+ */
7818
+ let expandValueArrays = ([key, item]) => {
7819
+ if (Array.isArray(item)) {
7820
+ return item.map(value => {
7821
+ return { key, value };
7822
+ });
7823
+ }
7824
+ return [{ key, value: item }];
7825
+ };
7824
7826
  /*
7825
7827
  * remaps the incoming {key, value} tuples
7826
7828
  * to naming container prefixed keys and values
@@ -7832,10 +7834,13 @@ class XhrFormData extends mona_dish_1.Config {
7832
7834
  /*
7833
7835
  * collects everything into a FormData object
7834
7836
  */
7835
- return mona_dish_1.Stream.ofAssoc(this.value)
7836
- .flatMap(expandAssocArray)
7837
+ return ofAssoc(this.value)
7838
+ .flatMap(expandValueArrays)
7837
7839
  .map(remapForNamingContainer)
7838
- .collect(new mona_dish_1.FormDataCollector());
7840
+ .reduce((formData, { key, value }) => {
7841
+ formData.append(key, value);
7842
+ return formData;
7843
+ }, new FormData());
7839
7844
  }
7840
7845
  /**
7841
7846
  * returns an encoded string representation of our xhr form data
@@ -7847,6 +7852,7 @@ class XhrFormData extends mona_dish_1.Config {
7847
7852
  }
7848
7853
  /**
7849
7854
  * generic post init code, for now, this performs some post assign data post-processing
7855
+ * @param rootElement the root element which knows the request type (usually a form)
7850
7856
  * @param executes the executable dom nodes which need to be processed into the form data, which we can send
7851
7857
  * in our ajax request
7852
7858
  */
@@ -7871,18 +7877,21 @@ class XhrFormData extends mona_dish_1.Config {
7871
7877
  }
7872
7878
  /**
7873
7879
  * determines fields to submit
7874
- * @param {Object} targetBuf - the target form buffer receiving the data
7875
7880
  * @param {Node} parentItem - form element item is nested in
7876
7881
  * @param {Array} partialIds - ids fo PPS
7877
7882
  */
7878
- encodeSubmittableFields(parentItem, partialIds) {
7879
- const formInputs = (0, FileUtils_1.getFormInputsAsStream)(parentItem);
7883
+ encodeSubmittableFields(parentItem, partialIds = []) {
7880
7884
  const mergeIntoThis = ([key, value]) => this.append(key).value = value;
7881
7885
  const namingContainerRemap = ([key, value]) => this.paramsMapper(key, value);
7882
- formInputs
7883
- .map(FileUtils_1.fixEmmptyParameters)
7886
+ const remappedPartialIds = partialIds.map(partialId => this.remapKeyForNamingContainer(partialId));
7887
+ const partialIdsFilter = ([key, value]) => (!remappedPartialIds.length || key.indexOf("@") == 0) ? true :
7888
+ remappedPartialIds.indexOf(key) != -1;
7889
+ let inputs = (0, FileUtils_1.getFormInputsAsArr)(parentItem);
7890
+ inputs
7891
+ .map(FileUtils_1.fixEmptyParameters)
7884
7892
  .map(namingContainerRemap)
7885
- .each(mergeIntoThis);
7893
+ .filter(partialIdsFilter)
7894
+ .forEach(mergeIntoThis);
7886
7895
  }
7887
7896
  remapKeyForNamingContainer(key) {
7888
7897
  return this.paramsMapper(key, "")[0];
@@ -7917,6 +7926,7 @@ exports.XhrFormData = XhrFormData;
7917
7926
  */
7918
7927
  Object.defineProperty(exports, "__esModule", ({ value: true }));
7919
7928
  exports.XhrRequest = void 0;
7929
+ const AsyncRunnable_1 = __webpack_require__(/*! ../util/AsyncRunnable */ "./src/main/typescript/impl/util/AsyncRunnable.ts");
7920
7930
  const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
7921
7931
  const AjaxImpl_1 = __webpack_require__(/*! ../AjaxImpl */ "./src/main/typescript/impl/AjaxImpl.ts");
7922
7932
  const XhrFormData_1 = __webpack_require__(/*! ./XhrFormData */ "./src/main/typescript/impl/xhrCore/XhrFormData.ts");
@@ -7929,6 +7939,10 @@ var failSaveExecute = Lang_1.ExtLang.failSaveExecute;
7929
7939
  /**
7930
7940
  * Faces XHR Request Wrapper
7931
7941
  * as AsyncRunnable for our Asynchronous queue
7942
+ * This means from the outside the
7943
+ * xhr request is similar to a Promise in a way
7944
+ * that you can add then and catch and finally callbacks.
7945
+ *
7932
7946
  *
7933
7947
  * The idea is that we basically just enqueue
7934
7948
  * a single ajax request into our queue
@@ -7936,51 +7950,35 @@ var failSaveExecute = Lang_1.ExtLang.failSaveExecute;
7936
7950
  *
7937
7951
  *
7938
7952
  */
7939
- class XhrRequest {
7953
+ class XhrRequest extends AsyncRunnable_1.AsyncRunnable {
7940
7954
  /**
7941
7955
  * Required Parameters
7942
7956
  *
7943
- * @param source the issuing element
7944
- * @param sourceForm the form which is related to the issuing element
7945
7957
  * @param requestContext the request context with all pass through values
7946
- *
7947
- * Optional Parameters
7948
- *
7949
7958
  * @param internalContext internal context with internal info which is passed through, not used by the user
7950
- * @param partialIdsArray an optional restricting partial ids array for encoding
7959
+ * Optional Parameters
7951
7960
  * @param timeout optional xhr timeout
7952
7961
  * @param ajaxType optional request type, default "POST"
7953
7962
  * @param contentType optional content type, default "application/x-www-form-urlencoded"
7954
- * @param xhrObject optional xhr object which must fulfill the XMLHTTPRequest api, default XMLHttpRequest
7955
7963
  */
7956
- constructor(source, sourceForm, requestContext, internalContext, partialIdsArray = [], timeout = Const_1.NO_TIMEOUT, ajaxType = Const_1.REQ_TYPE_POST, contentType = Const_1.URL_ENCODED, xhrObject = new XMLHttpRequest()) {
7957
- this.source = source;
7958
- this.sourceForm = sourceForm;
7964
+ constructor(requestContext, internalContext, timeout = Const_1.NO_TIMEOUT, ajaxType = Const_1.REQ_TYPE_POST, contentType = Const_1.URL_ENCODED) {
7965
+ super();
7959
7966
  this.requestContext = requestContext;
7960
7967
  this.internalContext = internalContext;
7961
- this.partialIdsArray = partialIdsArray;
7962
7968
  this.timeout = timeout;
7963
7969
  this.ajaxType = ajaxType;
7964
7970
  this.contentType = contentType;
7965
- this.xhrObject = xhrObject;
7966
7971
  this.stopProgress = false;
7967
- /**
7968
- * helper support so that we do not have to drag in Promise shims
7969
- */
7970
- this.catchFunctions = [];
7971
- this.thenFunctions = [];
7972
+ this.xhrObject = new XMLHttpRequest();
7972
7973
  // we omit promises here because we have to deal with cancel functionality,
7973
7974
  // and promises to not provide that (yet) instead we have our async queue
7974
7975
  // which uses an api internally, which is very close to promises
7975
- this.registerXhrCallbacks((data) => {
7976
- this.resolve(data);
7977
- }, (data) => {
7978
- this.reject(data);
7979
- });
7976
+ this.registerXhrCallbacks((data) => this.resolve(data), (data) => this.reject(data));
7980
7977
  }
7981
7978
  start() {
7982
7979
  let ignoreErr = failSaveExecute;
7983
7980
  let xhrObject = this.xhrObject;
7981
+ let sourceForm = mona_dish_1.DQ.byId(this.internalContext.getIf(Const_1.CTX_PARAM_SRC_FRM_ID).value);
7984
7982
  let executesArr = () => {
7985
7983
  return this.requestContext.getIf(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_EXECUTE).get(Const_1.IDENT_NONE).value.split(/\s+/gi);
7986
7984
  };
@@ -7993,13 +7991,14 @@ class XhrRequest {
7993
7991
  // whatever the formData object delivers
7994
7992
  // the partialIdsArray arr is almost deprecated legacy code where we allowed to send a separate list of partial
7995
7993
  // ids for reduced load and server processing, this will be removed soon, we can handle the same via execute
7996
- // anyway TODO reimplement the partial ids array, we still do not have it in jsf the way we need it
7997
- let formData = new XhrFormData_1.XhrFormData(this.sourceForm, (0, RequestDataResolver_1.resoveNamingContainerMapper)(this.internalContext), executesArr(), this.partialIdsArray);
7994
+ const executes = executesArr();
7995
+ const partialIdsArray = this.internalContext.getIf(Const_1.CTX_PARAM_PPS).value === true ? executes : [];
7996
+ const formData = new XhrFormData_1.XhrFormData(sourceForm, (0, RequestDataResolver_1.resoveNamingContainerMapper)(this.internalContext), executes, partialIdsArray);
7998
7997
  this.contentType = formData.isMultipartRequest ? "undefined" : this.contentType;
7999
7998
  // next step the pass through parameters are merged in for post params
8000
7999
  this.requestContext.$nspEnabled = false;
8001
- let requestContext = this.requestContext;
8002
- let requestPassThroughParams = requestContext.getIf(Const_1.CTX_PARAM_REQ_PASS_THR);
8000
+ const requestContext = this.requestContext;
8001
+ const requestPassThroughParams = requestContext.getIf(Const_1.CTX_PARAM_REQ_PASS_THR);
8003
8002
  // we are turning off here the jsf, faces remapping because we are now dealing with
8004
8003
  // pass-through parameters
8005
8004
  requestPassThroughParams.$nspEnabled = false;
@@ -8010,17 +8009,20 @@ class XhrRequest {
8010
8009
  formData.shallowMerge(requestPassThroughParams, true, true);
8011
8010
  }
8012
8011
  finally {
8012
+ // unfortunately as long as we support
8013
+ // both namespaces we have to keep manual control
8014
+ // on the key renaming before doing ops like deep copy
8013
8015
  this.requestContext.$nspEnabled = true;
8014
8016
  requestPassThroughParams.$nspEnabled = true;
8015
8017
  }
8016
8018
  this.responseContext = requestPassThroughParams.deepCopy;
8017
8019
  // we have to shift the internal passthroughs around to build up our response context
8018
- let responseContext = this.responseContext;
8020
+ const responseContext = this.responseContext;
8019
8021
  responseContext.assign(Const_1.CTX_PARAM_MF_INTERNAL).value = this.internalContext.value;
8020
- // per spec the onevent and onerror handlers must be passed through to the response
8022
+ // per spec the onEvent and onError handlers must be passed through to the response
8021
8023
  responseContext.assign(Const_1.ON_EVENT).value = requestContext.getIf(Const_1.ON_EVENT).value;
8022
8024
  responseContext.assign(Const_1.ON_ERROR).value = requestContext.getIf(Const_1.ON_ERROR).value;
8023
- xhrObject.open(this.ajaxType, (0, RequestDataResolver_1.resolveFinalUrl)(this.sourceForm, formData, this.ajaxType), true);
8025
+ xhrObject.open(this.ajaxType, (0, RequestDataResolver_1.resolveFinalUrl)(sourceForm, formData, this.ajaxType), true);
8024
8026
  // adding timeout
8025
8027
  this.timeout ? xhrObject.timeout = this.timeout : null;
8026
8028
  // a bug in the xhr stub library prevents the setRequestHeader to be properly executed on fake xhr objects
@@ -8045,36 +8047,14 @@ class XhrRequest {
8045
8047
  }
8046
8048
  cancel() {
8047
8049
  try {
8050
+ // this causes onError to be called where the error
8051
+ // handling takes over
8048
8052
  this.xhrObject.abort();
8049
8053
  }
8050
8054
  catch (e) {
8051
8055
  this.handleError(e);
8052
8056
  }
8053
8057
  }
8054
- resolve(data) {
8055
- mona_dish_1.Stream.of(...this.thenFunctions).reduce((inputVal, thenFunc) => {
8056
- return thenFunc(inputVal);
8057
- }, data);
8058
- }
8059
- reject(data) {
8060
- mona_dish_1.Stream.of(...this.catchFunctions).reduce((inputVal, catchFunc) => {
8061
- return catchFunc(inputVal);
8062
- }, data);
8063
- }
8064
- catch(func) {
8065
- this.catchFunctions.push(func);
8066
- return this;
8067
- }
8068
- finally(func) {
8069
- // no ie11 support we probably are going to revert to shims for that one
8070
- this.catchFunctions.push(func);
8071
- this.thenFunctions.push(func);
8072
- return this;
8073
- }
8074
- then(func) {
8075
- this.thenFunctions.push(func);
8076
- return this;
8077
- }
8078
8058
  /**
8079
8059
  * attaches the internal event and processing
8080
8060
  * callback within the promise to our xhr object
@@ -8083,7 +8063,7 @@ class XhrRequest {
8083
8063
  * @param reject
8084
8064
  */
8085
8065
  registerXhrCallbacks(resolve, reject) {
8086
- let xhrObject = this.xhrObject;
8066
+ const xhrObject = this.xhrObject;
8087
8067
  xhrObject.onabort = () => {
8088
8068
  this.onAbort(reject);
8089
8069
  };
@@ -8097,13 +8077,17 @@ class XhrRequest {
8097
8077
  this.onDone(this.xhrObject, resolve);
8098
8078
  };
8099
8079
  xhrObject.onerror = (errorData) => {
8100
- // some browsers trigger an error when cancelling a request internally
8080
+ // some browsers trigger an error when cancelling a request internally, or when
8081
+ // cancel is called from outside
8101
8082
  // in this case we simply ignore the request and clear up the queue, because
8102
8083
  // it is not safe anymore to proceed with the current queue
8103
8084
  // This bypasses a Safari issue where it keeps requests hanging after page unload
8104
8085
  // and then triggers a cancel error on then instead of just stopping
8105
8086
  // and clearing the code
8106
8087
  if (this.isCancelledResponse(this.xhrObject)) {
8088
+ /*
8089
+ * this triggers the catch chain and after that finally
8090
+ */
8107
8091
  reject();
8108
8092
  this.stopProgress = true;
8109
8093
  return;
@@ -8144,14 +8128,12 @@ class XhrRequest {
8144
8128
  handleMalFormedXML(resolve) {
8145
8129
  var _a;
8146
8130
  this.stopProgress = true;
8147
- let errorData = {
8131
+ const errorData = {
8148
8132
  type: Const_1.ERROR,
8149
8133
  status: Const_1.MALFORMEDXML,
8150
8134
  responseCode: 200,
8151
8135
  responseText: (_a = this.xhrObject) === null || _a === void 0 ? void 0 : _a.responseText,
8152
- // we remap the element just in case it gets replaced
8153
- // it will be unremapped
8154
- source: this.source.id.value
8136
+ source: this.internalContext.getIf(Const_1.CTX_PARAM_SRC_CTL_ID).value
8155
8137
  };
8156
8138
  try {
8157
8139
  this.handleError(errorData, true);
@@ -8168,14 +8150,20 @@ class XhrRequest {
8168
8150
  if (this.stopProgress) {
8169
8151
  return;
8170
8152
  }
8153
+ /**
8154
+ * now call the then chain
8155
+ */
8171
8156
  resolve(data);
8172
8157
  }
8173
8158
  onError(errorData, reject) {
8174
8159
  this.handleError(errorData);
8160
+ /*
8161
+ * this triggers the catch chain and after that finally
8162
+ */
8175
8163
  reject();
8176
8164
  }
8177
8165
  sendRequest(formData) {
8178
- let isPost = this.ajaxType != Const_1.REQ_TYPE_GET;
8166
+ const isPost = this.ajaxType != Const_1.REQ_TYPE_GET;
8179
8167
  if (formData.isMultipartRequest) {
8180
8168
  // in case of a multipart request we send in a formData object as body
8181
8169
  this.xhrObject.send((isPost) ? formData.toFormData() : null);
@@ -8190,7 +8178,7 @@ class XhrRequest {
8190
8178
  */
8191
8179
  sendEvent(evtType) {
8192
8180
  var _a;
8193
- let eventData = EventData_1.EventData.createFromRequest(this.xhrObject, this.requestContext, evtType);
8181
+ const eventData = EventData_1.EventData.createFromRequest(this.xhrObject, this.requestContext, evtType);
8194
8182
  try {
8195
8183
  // User code error, we might cover
8196
8184
  // this in onError, but also we cannot swallow it.
@@ -8206,8 +8194,8 @@ class XhrRequest {
8206
8194
  }
8207
8195
  }
8208
8196
  handleError(exception, responseFormatError = false) {
8209
- let errorData = (responseFormatError) ? ErrorData_1.ErrorData.fromHttpConnection(exception.source, exception.type, exception.status, exception.responseText, exception.responseCode, exception.status) : ErrorData_1.ErrorData.fromClient(exception);
8210
- let eventHandler = (0, RequestDataResolver_1.resolveHandlerFunc)(this.requestContext, this.responseContext, Const_1.ON_ERROR);
8197
+ const errorData = (responseFormatError) ? ErrorData_1.ErrorData.fromHttpConnection(exception.source, exception.type, exception.status, exception.responseText, exception.responseCode, exception.status) : ErrorData_1.ErrorData.fromClient(exception);
8198
+ const eventHandler = (0, RequestDataResolver_1.resolveHandlerFunc)(this.requestContext, this.responseContext, Const_1.ON_ERROR);
8211
8199
  AjaxImpl_1.Implementation.sendError(errorData, eventHandler);
8212
8200
  }
8213
8201
  }
@@ -8241,6 +8229,7 @@ exports.XhrRequest = XhrRequest;
8241
8229
  Object.defineProperty(exports, "__esModule", ({ value: true }));
8242
8230
  exports.oam = void 0;
8243
8231
  const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
8232
+ const Lang_1 = __webpack_require__(/*! ../impl/util/Lang */ "./src/main/typescript/impl/util/Lang.ts");
8244
8233
  /**
8245
8234
  * legacy code to enable various aspects
8246
8235
  * of myfaces, used to be rendered inline
@@ -8254,6 +8243,7 @@ const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-di
8254
8243
  */
8255
8244
  var oam;
8256
8245
  (function (oam) {
8246
+ var ofAssoc = Lang_1.ExtLang.ofAssoc;
8257
8247
  /**
8258
8248
  * sets a hidden input field
8259
8249
  * @param formName the formName
@@ -8309,8 +8299,8 @@ var oam;
8309
8299
  if (((_d = (_c = (_b = window === null || window === void 0 ? void 0 : window.myfaces) === null || _b === void 0 ? void 0 : _b.core) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.autoScroll) && (window === null || window === void 0 ? void 0 : window.getScrolling)) {
8310
8300
  myfaces.oam.setHiddenInput(formName, 'autoScroll', window === null || window === void 0 ? void 0 : window.getScrolling());
8311
8301
  }
8312
- let paramsStream = Array.isArray(params) ? mona_dish_1.Stream.of(...params) : mona_dish_1.Stream.ofAssoc(params);
8313
- paramsStream.each(([key, data]) => myfaces.oam.setHiddenInput(formName, key, data));
8302
+ let paramsStream = Array.isArray(params) ? [...params] : ofAssoc(params);
8303
+ paramsStream.forEach(([key, data]) => myfaces.oam.setHiddenInput(formName, key, data));
8314
8304
  //we call the namespaced function, to allow decoration, via a direct call we would
8315
8305
  myfaces.oam.setHiddenInput(formName, `${formName}:_idcl`, linkId !== null && linkId !== void 0 ? linkId : '');
8316
8306
  mona_dish_1.DQ.byId((_f = (_e = document.forms) === null || _e === void 0 ? void 0 : _e[formName]) !== null && _f !== void 0 ? _f : document.getElementById(formName)).each(form => {
@@ -8338,7 +8328,7 @@ var oam;
8338
8328
  form.getAsElem(0).value.setAttribute("target", oldTarget);
8339
8329
  }
8340
8330
  // noinspection JSUnusedLocalSymbols
8341
- paramsStream.each(([key, data]) => {
8331
+ paramsStream.forEach(([key, data]) => {
8342
8332
  myfaces.oam.clearHiddenInput(formName, key);
8343
8333
  });
8344
8334
  myfaces.oam.clearHiddenInput(formName, `${formName}:_idcl`);