jsf.js_next_gen 4.0.0 → 4.0.1-alpha.0
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.
- package/README.md +7 -0
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/functions/faces.ajax.addOnError.html +4 -4
- package/dist/docs/functions/faces.ajax.request.html +7 -7
- package/dist/docs/functions/faces.ajax.response.html +1 -0
- package/dist/docs/functions/faces.util.chain.html +3 -3
- package/dist/docs/functions/myfaces.ab.html +1 -1
- package/dist/docs/functions/{myfaces.onOnDomReady.html → myfaces.onDomReady.html} +5 -5
- package/dist/docs/index.html +9 -0
- package/dist/docs/modules/myfaces.html +2 -2
- package/dist/docs/variables/myfaces.oam.html +1 -1
- package/dist/window/faces-development.js +1021 -628
- package/dist/window/faces-development.js.br +0 -0
- package/dist/window/faces-development.js.gz +0 -0
- package/dist/window/faces-development.js.map +1 -1
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.br +0 -0
- package/dist/window/faces.js.gz +0 -0
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +1021 -628
- package/dist/window/jsf-development.js.br +0 -0
- package/dist/window/jsf-development.js.gz +0 -0
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.br +0 -0
- package/dist/window/jsf.js.gz +0 -0
- package/dist/window/jsf.js.map +1 -1
- package/package.json +3 -3
- package/plans for 4.0.1.txt +8 -0
- package/pom.xml +1 -1
- package/src/main/typescript/@types/definitions/index.d.ts +5 -5
- package/src/main/typescript/api/_api.ts +13 -12
- package/src/main/typescript/impl/AjaxImpl.ts +59 -45
- package/src/main/typescript/impl/core/Const.ts +5 -2
- package/src/main/typescript/impl/util/AsyncRunnable.ts +81 -6
- package/src/main/typescript/impl/util/ExtDomQuery.ts +7 -9
- package/src/main/typescript/impl/util/FileUtils.ts +26 -22
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +7 -3
- package/src/main/typescript/impl/util/Lang.ts +61 -4
- package/src/main/typescript/impl/util/XhrQueueController.ts +112 -0
- package/src/main/typescript/impl/xhrCore/EventData.ts +3 -3
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +12 -10
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +32 -19
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +51 -72
- package/src/main/typescript/myfaces/OamSubmit.ts +6 -6
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +179 -40
- package/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.ts +4 -4
- package/src/main/typescript/test/frameworkBase/_ext/monadish/fixtures/blank.css +0 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.ts +921 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.ts +108 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +3 -2
- package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/jakarta.faces.resource/faces.js.jsf +0 -0
- package/src/main/typescript/test/myfaces/OnLoadSpec.ts +52 -0
- package/src/main/typescript/test/queue/AsynchronousProbe.ts +5 -5
- package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +4 -3
- package/src/main/typescript/test/xhrCore/EventTests.spec.ts +28 -22
- package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +4 -4
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +2 -2
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +80 -6
- package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +6 -1
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +23 -22
- package/target/api/_api.js +12 -11
- package/target/api/_api.js.map +1 -1
- package/target/impl/AjaxImpl.js +50 -39
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/core/Const.js +7 -5
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/util/AsyncRunnable.js +60 -0
- package/target/impl/util/AsyncRunnable.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +8 -8
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/FileUtils.js +21 -20
- package/target/impl/util/FileUtils.js.map +1 -1
- package/target/impl/util/HiddenInputBuilder.js +7 -3
- package/target/impl/util/HiddenInputBuilder.js.map +1 -1
- package/target/impl/util/IAsyncRunnable.js +27 -0
- package/target/impl/util/IAsyncRunnable.js.map +1 -0
- package/target/impl/util/Lang.js +52 -1
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/util/XhrQueueController.js +33 -8
- package/target/impl/util/XhrQueueController.js.map +1 -1
- package/target/impl/xhrCore/EventData.js +2 -2
- package/target/impl/xhrCore/EventData.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +9 -7
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +29 -15
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +43 -64
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +5 -3
- package/target/myfaces/OamSubmit.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +138 -37
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +4 -4
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +3 -2
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/queue/AsynchronousQueueTest.spec.js +3 -3
- package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
- package/target/test/xhrCore/EventTests.spec.js +26 -19
- package/target/test/xhrCore/EventTests.spec.js.map +1 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +3 -3
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +73 -4
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +6 -0
- package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +22 -15
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/src/main/typescript/impl/util/AsyncQueue.ts +0 -133
- 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 ***!
|
|
@@ -45,6 +579,7 @@ var trim = Lang_1.Lang.trim;
|
|
|
45
579
|
var isString = Lang_1.Lang.isString;
|
|
46
580
|
var eqi = Lang_1.Lang.equalsIgnoreCase;
|
|
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
|
|
@@ -1375,11 +1910,10 @@ class DomQuery {
|
|
|
1375
1910
|
*/
|
|
1376
1911
|
fireEvent(eventName, options = {}) {
|
|
1377
1912
|
// merge with last one having the highest priority
|
|
1378
|
-
let finalOptions =
|
|
1913
|
+
let finalOptions = {
|
|
1379
1914
|
bubbles: true, cancelable: true
|
|
1380
|
-
}
|
|
1381
|
-
finalOptions
|
|
1382
|
-
finalOptions = JSON.parse(finalOptions.toJson());
|
|
1915
|
+
};
|
|
1916
|
+
finalOptions = (0, AssocArray_1.simpleShallowMerge)(finalOptions, options);
|
|
1383
1917
|
this.eachElem((node) => {
|
|
1384
1918
|
let doc;
|
|
1385
1919
|
if (node.ownerDocument) {
|
|
@@ -1470,14 +2004,14 @@ class DomQuery {
|
|
|
1470
2004
|
* @param toMerge optional config which can be merged in
|
|
1471
2005
|
* @return a copy pf
|
|
1472
2006
|
*/
|
|
1473
|
-
encodeFormElement(toMerge =
|
|
2007
|
+
encodeFormElement(toMerge = {}) {
|
|
1474
2008
|
// browser behavior no element name no encoding (normal submit fails in that case)
|
|
1475
2009
|
// https:// issues.apache.org/jira/browse/MYFACES-2847
|
|
1476
2010
|
if (this.name.isAbsent()) {
|
|
1477
2011
|
return;
|
|
1478
2012
|
}
|
|
1479
2013
|
// let´s keep it side-effects free
|
|
1480
|
-
let target = toMerge
|
|
2014
|
+
let target = (0, AssocArray_1.simpleShallowMerge)(toMerge);
|
|
1481
2015
|
this.each((element) => {
|
|
1482
2016
|
var _a, _b;
|
|
1483
2017
|
if (element.name.isAbsent()) { // no name, no encoding
|
|
@@ -1512,7 +2046,7 @@ class DomQuery {
|
|
|
1512
2046
|
// let subBuf = [];
|
|
1513
2047
|
if (selectElem.options[u].selected) {
|
|
1514
2048
|
let elementOption = selectElem.options[u];
|
|
1515
|
-
|
|
2049
|
+
(0, AssocArray_1.append)(target, name).value = (elementOption.getAttribute("value") != null) ?
|
|
1516
2050
|
elementOption.value : elementOption.text;
|
|
1517
2051
|
}
|
|
1518
2052
|
}
|
|
@@ -1532,14 +2066,14 @@ class DomQuery {
|
|
|
1532
2066
|
let filesArr = uploadedFiles !== null && uploadedFiles !== void 0 ? uploadedFiles : [];
|
|
1533
2067
|
if (filesArr === null || filesArr === void 0 ? void 0 : filesArr.length) { //files can be empty but set
|
|
1534
2068
|
// xhr level2, single multiple must be passes as they are
|
|
1535
|
-
|
|
2069
|
+
(0, AssocArray_1.assign)(target, name).value = Array.from(filesArr);
|
|
1536
2070
|
}
|
|
1537
2071
|
else {
|
|
1538
2072
|
if (!!uploadedFiles) { //we skip empty file elements i
|
|
1539
2073
|
return;
|
|
1540
2074
|
}
|
|
1541
2075
|
//checkboxes etc.. need to be appended
|
|
1542
|
-
|
|
2076
|
+
(0, AssocArray_1.append)(target, name).value = element.inputValue.value;
|
|
1543
2077
|
}
|
|
1544
2078
|
}
|
|
1545
2079
|
}
|
|
@@ -2377,15 +2911,8 @@ var Lang;
|
|
|
2377
2911
|
* limitations under the License.
|
|
2378
2912
|
*/
|
|
2379
2913
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2380
|
-
exports.
|
|
2381
|
-
/**
|
|
2382
|
-
* A module which keeps basic monad like definitions in place
|
|
2383
|
-
* Useful if you need the functions in another library to keep its dependencies down
|
|
2384
|
-
*/
|
|
2385
|
-
/*IMonad definitions*/
|
|
2386
|
-
const Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
|
|
2914
|
+
exports.ValueEmbedder = exports.Optional = exports.Monad = void 0;
|
|
2387
2915
|
const Es2019Array_1 = __webpack_require__(/*! ./Es2019Array */ "./node_modules/mona-dish/src/main/typescript/Es2019Array.ts");
|
|
2388
|
-
var objAssign = Lang_1.Lang.objAssign;
|
|
2389
2916
|
/**
|
|
2390
2917
|
* Implementation of a monad
|
|
2391
2918
|
* (Side - effect free), no write allowed directly on the monads
|
|
@@ -2672,348 +3199,29 @@ class ValueEmbedder extends Optional {
|
|
|
2672
3199
|
if (this.isPresent()) {
|
|
2673
3200
|
return this;
|
|
2674
3201
|
}
|
|
2675
|
-
else {
|
|
2676
|
-
let alternative = {};
|
|
2677
|
-
alternative[this.key] = func();
|
|
2678
|
-
return new ValueEmbedder(alternative, this.key);
|
|
2679
|
-
}
|
|
2680
|
-
}
|
|
2681
|
-
/**
|
|
2682
|
-
* helper to override several implementations in a more fluent way
|
|
2683
|
-
* by having a getClass operation we can avoid direct calls into the constructor or
|
|
2684
|
-
* static methods and do not have to implement several methods which rely on the type
|
|
2685
|
-
* of "this"
|
|
2686
|
-
* @returns ValueEmbedder
|
|
2687
|
-
*/
|
|
2688
|
-
getClass() {
|
|
2689
|
-
return ValueEmbedder;
|
|
2690
|
-
}
|
|
2691
|
-
static fromNullable(value, valueKey = "value") {
|
|
2692
|
-
return new ValueEmbedder(value, valueKey);
|
|
2693
|
-
}
|
|
2694
|
-
}
|
|
2695
|
-
exports.ValueEmbedder = ValueEmbedder;
|
|
2696
|
-
/*default value for absent*/
|
|
2697
|
-
ValueEmbedder.absent = ValueEmbedder.fromNullable(null);
|
|
2698
|
-
/**
|
|
2699
|
-
* specialized value embedder
|
|
2700
|
-
* for our Configuration
|
|
2701
|
-
*/
|
|
2702
|
-
class ConfigEntry extends ValueEmbedder {
|
|
2703
|
-
constructor(rootElem, key, arrPos) {
|
|
2704
|
-
super(rootElem, key);
|
|
2705
|
-
this.arrPos = arrPos !== null && arrPos !== void 0 ? arrPos : -1;
|
|
2706
|
-
}
|
|
2707
|
-
get value() {
|
|
2708
|
-
if (this.key == "" && this.arrPos >= 0) {
|
|
2709
|
-
return this._value[this.arrPos];
|
|
2710
|
-
}
|
|
2711
|
-
else if (this.key && this.arrPos >= 0) {
|
|
2712
|
-
return this._value[this.key][this.arrPos];
|
|
2713
|
-
}
|
|
2714
|
-
return this._value[this.key];
|
|
2715
|
-
}
|
|
2716
|
-
set value(val) {
|
|
2717
|
-
if (this.key == "" && this.arrPos >= 0) {
|
|
2718
|
-
this._value[this.arrPos] = val;
|
|
2719
|
-
return;
|
|
2720
|
-
}
|
|
2721
|
-
else if (this.key && this.arrPos >= 0) {
|
|
2722
|
-
this._value[this.key][this.arrPos] = val;
|
|
2723
|
-
return;
|
|
2724
|
-
}
|
|
2725
|
-
this._value[this.key] = val;
|
|
2726
|
-
}
|
|
2727
|
-
}
|
|
2728
|
-
/*default value for absent*/
|
|
2729
|
-
ConfigEntry.absent = ConfigEntry.fromNullable(null);
|
|
2730
|
-
exports.CONFIG_VALUE = "__END_POINT__";
|
|
2731
|
-
exports.CONFIG_ANY = "__ANY_POINT__";
|
|
2732
|
-
/**
|
|
2733
|
-
* Config, basically an optional wrapper for a json structure
|
|
2734
|
-
* (not Side - effect free, since we can alter the internal config state
|
|
2735
|
-
* without generating a new config), not sure if we should make it side - effect free
|
|
2736
|
-
* since this would swallow a lot of performance and ram
|
|
2737
|
-
*/
|
|
2738
|
-
class Config extends Optional {
|
|
2739
|
-
constructor(root, configDef) {
|
|
2740
|
-
super(root);
|
|
2741
|
-
this.configDef = configDef;
|
|
2742
|
-
}
|
|
2743
|
-
/**
|
|
2744
|
-
* shallow copy getter, copies only the first level, references the deeper nodes
|
|
2745
|
-
* in a shared manner
|
|
2746
|
-
*/
|
|
2747
|
-
get shallowCopy() {
|
|
2748
|
-
return this.shallowCopy$();
|
|
2749
|
-
}
|
|
2750
|
-
shallowCopy$() {
|
|
2751
|
-
let ret = new Config({});
|
|
2752
|
-
ret.shallowMerge(this.value);
|
|
2753
|
-
return ret;
|
|
2754
|
-
}
|
|
2755
|
-
/**
|
|
2756
|
-
* deep copy, copies all config nodes
|
|
2757
|
-
*/
|
|
2758
|
-
get deepCopy() {
|
|
2759
|
-
return this.deepCopy$();
|
|
2760
|
-
}
|
|
2761
|
-
deepCopy$() {
|
|
2762
|
-
return new Config(objAssign({}, this.value));
|
|
2763
|
-
}
|
|
2764
|
-
/**
|
|
2765
|
-
* creates a config from an initial value or null
|
|
2766
|
-
* @param value
|
|
2767
|
-
*/
|
|
2768
|
-
static fromNullable(value) {
|
|
2769
|
-
return new Config(value);
|
|
2770
|
-
}
|
|
2771
|
-
/**
|
|
2772
|
-
* simple merge for the root configs
|
|
2773
|
-
*/
|
|
2774
|
-
shallowMerge(other, overwrite = true, withAppend = false) {
|
|
2775
|
-
for (let key in other.value) {
|
|
2776
|
-
if ('undefined' == typeof key || null == key) {
|
|
2777
|
-
continue;
|
|
2778
|
-
}
|
|
2779
|
-
if (overwrite || !(key in this.value)) {
|
|
2780
|
-
if (!withAppend) {
|
|
2781
|
-
this.assign(key).value = other.getIf(key).value;
|
|
2782
|
-
}
|
|
2783
|
-
else {
|
|
2784
|
-
if (Array.isArray(other.getIf(key).value)) {
|
|
2785
|
-
new Es2019Array_1.Es2019Array(...other.getIf(key).value).forEach(item => this.append(key).value = item);
|
|
2786
|
-
}
|
|
2787
|
-
else {
|
|
2788
|
-
this.append(key).value = other.getIf(key).value;
|
|
2789
|
-
}
|
|
2790
|
-
}
|
|
2791
|
-
}
|
|
2792
|
-
}
|
|
2793
|
-
}
|
|
2794
|
-
/**
|
|
2795
|
-
* assigns a single value as array, or appends it
|
|
2796
|
-
* to an existing value mapping a single value to array
|
|
2797
|
-
*
|
|
2798
|
-
*
|
|
2799
|
-
* usage myConfig.append("foobaz").value = "newValue"
|
|
2800
|
-
* myConfig.append("foobaz").value = "newValue2"
|
|
2801
|
-
*
|
|
2802
|
-
* resulting in myConfig.foobaz == ["newValue, newValue2"]
|
|
2803
|
-
*
|
|
2804
|
-
* @param {string[]} accessPath
|
|
2805
|
-
*/
|
|
2806
|
-
append(...accessPath) {
|
|
2807
|
-
let noKeys = accessPath.length < 1;
|
|
2808
|
-
if (noKeys) {
|
|
2809
|
-
return;
|
|
2810
|
-
}
|
|
2811
|
-
this.assertAccessPath(...accessPath);
|
|
2812
|
-
let lastKey = accessPath[accessPath.length - 1];
|
|
2813
|
-
let pathExists = this.getIf(...accessPath).isPresent();
|
|
2814
|
-
this.buildPath(...accessPath);
|
|
2815
|
-
let finalKeyArrPos = this.arrayIndex(lastKey);
|
|
2816
|
-
if (finalKeyArrPos > -1) {
|
|
2817
|
-
throw Error("Append only possible on non array properties, use assign on indexed data");
|
|
2818
|
-
}
|
|
2819
|
-
let value = this.getIf(...accessPath).value;
|
|
2820
|
-
if (!Array.isArray(value)) {
|
|
2821
|
-
value = this.assign(...accessPath).value = [value];
|
|
2822
|
-
}
|
|
2823
|
-
if (pathExists) {
|
|
2824
|
-
value.push({});
|
|
2825
|
-
}
|
|
2826
|
-
finalKeyArrPos = value.length - 1;
|
|
2827
|
-
return new ConfigEntry(accessPath.length == 1 ? this.value : this.getIf.apply(this, accessPath.slice(0, accessPath.length - 1)).value, lastKey, finalKeyArrPos);
|
|
2828
|
-
}
|
|
2829
|
-
/**
|
|
2830
|
-
* appends to an existing entry (or extends into an array and appends)
|
|
2831
|
-
* if the condition is met
|
|
2832
|
-
* @param {boolean} condition
|
|
2833
|
-
* @param {string[]} accessPath
|
|
2834
|
-
*/
|
|
2835
|
-
appendIf(condition, ...accessPath) {
|
|
2836
|
-
if (!condition) {
|
|
2837
|
-
return { value: null };
|
|
2838
|
-
}
|
|
2839
|
-
return this.append(...accessPath);
|
|
2840
|
-
}
|
|
2841
|
-
/**
|
|
2842
|
-
* assigns a new value on the given access path
|
|
2843
|
-
* @param accessPath
|
|
2844
|
-
*/
|
|
2845
|
-
assign(...accessPath) {
|
|
2846
|
-
if (accessPath.length < 1) {
|
|
2847
|
-
return;
|
|
2848
|
-
}
|
|
2849
|
-
this.assertAccessPath(...accessPath);
|
|
2850
|
-
this.buildPath(...accessPath);
|
|
2851
|
-
let currKey = this.keyVal(accessPath[accessPath.length - 1]);
|
|
2852
|
-
let arrPos = this.arrayIndex(accessPath[accessPath.length - 1]);
|
|
2853
|
-
return new ConfigEntry(accessPath.length == 1 ? this.value : this.getIf.apply(this, accessPath.slice(0, accessPath.length - 1)).value, currKey, arrPos);
|
|
2854
|
-
}
|
|
2855
|
-
/**
|
|
2856
|
-
* assign a value if the condition is set to true, otherwise skip it
|
|
2857
|
-
*
|
|
2858
|
-
* @param condition the condition, the access accessPath into the config
|
|
2859
|
-
* @param accessPath
|
|
2860
|
-
*/
|
|
2861
|
-
assignIf(condition, ...accessPath) {
|
|
2862
|
-
return condition ? this.assign(...accessPath) : { value: null };
|
|
2863
|
-
}
|
|
2864
|
-
/**
|
|
2865
|
-
* get if the access path is present (get is reserved as getter with a default, on the current path)
|
|
2866
|
-
* TODO will be renamed to something more meaningful and deprecated, the name is ambiguous
|
|
2867
|
-
* @param accessPath the access path
|
|
2868
|
-
*/
|
|
2869
|
-
getIf(...accessPath) {
|
|
2870
|
-
this.assertAccessPath(...accessPath);
|
|
2871
|
-
return this.getClass().fromNullable(super.getIf.apply(this, accessPath).value);
|
|
2872
|
-
}
|
|
2873
|
-
/**
|
|
2874
|
-
* gets the current node and if none is present returns a config with a default value
|
|
2875
|
-
* @param defaultVal
|
|
2876
|
-
*/
|
|
2877
|
-
get(defaultVal) {
|
|
2878
|
-
return this.getClass().fromNullable(super.get(defaultVal).value);
|
|
2879
|
-
}
|
|
2880
|
-
//empties the current config entry
|
|
2881
|
-
delete(key) {
|
|
2882
|
-
if (key in this.value) {
|
|
2883
|
-
delete this.value[key];
|
|
2884
|
-
}
|
|
2885
|
-
return this;
|
|
2886
|
-
}
|
|
2887
|
-
/**
|
|
2888
|
-
* converts the entire config into a json object
|
|
2889
|
-
*/
|
|
2890
|
-
toJson() {
|
|
2891
|
-
return JSON.stringify(this.value);
|
|
2892
|
-
}
|
|
2893
|
-
getClass() {
|
|
2894
|
-
return Config;
|
|
2895
|
-
}
|
|
2896
|
-
setVal(val) {
|
|
2897
|
-
this._value = val;
|
|
2898
|
-
}
|
|
2899
|
-
/**
|
|
2900
|
-
* asserts the access path for a semi typed access
|
|
2901
|
-
* @param accessPath
|
|
2902
|
-
* @private
|
|
2903
|
-
*/
|
|
2904
|
-
assertAccessPath(...accessPath) {
|
|
2905
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2906
|
-
accessPath = this.preprocessKeys(...accessPath);
|
|
2907
|
-
if (!this.configDef) {
|
|
2908
|
-
//untyped
|
|
2909
|
-
return;
|
|
2910
|
-
}
|
|
2911
|
-
const ERR_ACCESS_PATH = "Access Path to config invalid";
|
|
2912
|
-
let currAccessPos = Optional.fromNullable(Object.keys(this.configDef).map(key => {
|
|
2913
|
-
let ret = {};
|
|
2914
|
-
ret[key] = this.configDef[key];
|
|
2915
|
-
return ret;
|
|
2916
|
-
}));
|
|
2917
|
-
for (let cnt = 0; cnt < accessPath.length; cnt++) {
|
|
2918
|
-
let currKey = this.keyVal(accessPath[cnt]);
|
|
2919
|
-
let arrPos = this.arrayIndex(accessPath[cnt]);
|
|
2920
|
-
//key index
|
|
2921
|
-
if (this.isArray(arrPos)) {
|
|
2922
|
-
if (currKey != "") {
|
|
2923
|
-
currAccessPos = Array.isArray(currAccessPos.value) ?
|
|
2924
|
-
Optional.fromNullable((_b = (_a = new Es2019Array_1.Es2019Array(...currAccessPos.value)
|
|
2925
|
-
.find(item => {
|
|
2926
|
-
var _a;
|
|
2927
|
-
return !!((_a = item === null || item === void 0 ? void 0 : item[currKey]) !== null && _a !== void 0 ? _a : false);
|
|
2928
|
-
})) === null || _a === void 0 ? void 0 : _a[currKey]) === null || _b === void 0 ? void 0 : _b[arrPos]) :
|
|
2929
|
-
Optional.fromNullable((_e = (_d = (_c = currAccessPos.value) === null || _c === void 0 ? void 0 : _c[currKey]) === null || _d === void 0 ? void 0 : _d[arrPos]) !== null && _e !== void 0 ? _e : null);
|
|
2930
|
-
}
|
|
2931
|
-
else {
|
|
2932
|
-
currAccessPos = (Array.isArray(currAccessPos.value)) ?
|
|
2933
|
-
Optional.fromNullable((_f = currAccessPos.value) === null || _f === void 0 ? void 0 : _f[arrPos]) : Optional.absent;
|
|
2934
|
-
}
|
|
2935
|
-
//we noe store either the current array or the filtered look ahead to go further
|
|
2936
|
-
}
|
|
2937
|
-
else {
|
|
2938
|
-
//we now have an array and go further with a singular key
|
|
2939
|
-
currAccessPos = (Array.isArray(currAccessPos.value)) ? Optional.fromNullable((_g = new Es2019Array_1.Es2019Array(...currAccessPos.value)
|
|
2940
|
-
.find(item => {
|
|
2941
|
-
var _a;
|
|
2942
|
-
return !!((_a = item === null || item === void 0 ? void 0 : item[currKey]) !== null && _a !== void 0 ? _a : false);
|
|
2943
|
-
})) === null || _g === void 0 ? void 0 : _g[currKey]) :
|
|
2944
|
-
Optional.fromNullable((_j = (_h = currAccessPos.value) === null || _h === void 0 ? void 0 : _h[currKey]) !== null && _j !== void 0 ? _j : null);
|
|
2945
|
-
}
|
|
2946
|
-
if (!currAccessPos.isPresent()) {
|
|
2947
|
-
throw Error(ERR_ACCESS_PATH);
|
|
2948
|
-
}
|
|
2949
|
-
if (currAccessPos.value == exports.CONFIG_ANY) {
|
|
2950
|
-
return;
|
|
2951
|
-
}
|
|
2952
|
-
}
|
|
3202
|
+
else {
|
|
3203
|
+
let alternative = {};
|
|
3204
|
+
alternative[this.key] = func();
|
|
3205
|
+
return new ValueEmbedder(alternative, this.key);
|
|
3206
|
+
}
|
|
2953
3207
|
}
|
|
2954
3208
|
/**
|
|
2955
|
-
*
|
|
2956
|
-
*
|
|
2957
|
-
*
|
|
3209
|
+
* helper to override several implementations in a more fluent way
|
|
3210
|
+
* by having a getClass operation we can avoid direct calls into the constructor or
|
|
3211
|
+
* static methods and do not have to implement several methods which rely on the type
|
|
3212
|
+
* of "this"
|
|
3213
|
+
* @returns ValueEmbedder
|
|
2958
3214
|
*/
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
let val = this;
|
|
2962
|
-
let parentVal = this.getClass().fromNullable(null);
|
|
2963
|
-
let parentPos = -1;
|
|
2964
|
-
let alloc = function (arr, length) {
|
|
2965
|
-
let length1 = arr.length;
|
|
2966
|
-
let length2 = length1 + length;
|
|
2967
|
-
for (let cnt = length1; cnt < length2; cnt++) {
|
|
2968
|
-
arr.push({});
|
|
2969
|
-
}
|
|
2970
|
-
};
|
|
2971
|
-
for (let cnt = 0; cnt < accessPath.length; cnt++) {
|
|
2972
|
-
let currKey = this.keyVal(accessPath[cnt]);
|
|
2973
|
-
let arrPos = this.arrayIndex(accessPath[cnt]);
|
|
2974
|
-
if (this.isArrayPos(currKey, arrPos)) {
|
|
2975
|
-
val.setVal((val.value instanceof Array) ? val.value : []);
|
|
2976
|
-
alloc(val.value, arrPos + 1);
|
|
2977
|
-
if (parentPos >= 0) {
|
|
2978
|
-
parentVal.value[parentPos] = val.value;
|
|
2979
|
-
}
|
|
2980
|
-
parentVal = val;
|
|
2981
|
-
parentPos = arrPos;
|
|
2982
|
-
val = this.getClass().fromNullable(val.value[arrPos]);
|
|
2983
|
-
continue;
|
|
2984
|
-
}
|
|
2985
|
-
let tempVal = val.getIf(currKey);
|
|
2986
|
-
if (this.isNoArray(arrPos)) {
|
|
2987
|
-
if (tempVal.isAbsent()) {
|
|
2988
|
-
tempVal = this.getClass().fromNullable(val.value[currKey] = {});
|
|
2989
|
-
}
|
|
2990
|
-
else {
|
|
2991
|
-
val = tempVal;
|
|
2992
|
-
}
|
|
2993
|
-
}
|
|
2994
|
-
else {
|
|
2995
|
-
let arr = (tempVal.value instanceof Array) ? tempVal.value : [];
|
|
2996
|
-
alloc(arr, arrPos + 1);
|
|
2997
|
-
val.value[currKey] = arr;
|
|
2998
|
-
tempVal = this.getClass().fromNullable(arr[arrPos]);
|
|
2999
|
-
}
|
|
3000
|
-
parentVal = val;
|
|
3001
|
-
parentPos = arrPos;
|
|
3002
|
-
val = tempVal;
|
|
3003
|
-
}
|
|
3004
|
-
return this;
|
|
3005
|
-
}
|
|
3006
|
-
isNoArray(arrPos) {
|
|
3007
|
-
return arrPos == -1;
|
|
3008
|
-
}
|
|
3009
|
-
isArray(arrPos) {
|
|
3010
|
-
return !this.isNoArray(arrPos);
|
|
3215
|
+
getClass() {
|
|
3216
|
+
return ValueEmbedder;
|
|
3011
3217
|
}
|
|
3012
|
-
|
|
3013
|
-
return
|
|
3218
|
+
static fromNullable(value, valueKey = "value") {
|
|
3219
|
+
return new ValueEmbedder(value, valueKey);
|
|
3014
3220
|
}
|
|
3015
3221
|
}
|
|
3016
|
-
exports.
|
|
3222
|
+
exports.ValueEmbedder = ValueEmbedder;
|
|
3223
|
+
/*default value for absent*/
|
|
3224
|
+
ValueEmbedder.absent = ValueEmbedder.fromNullable(null);
|
|
3017
3225
|
|
|
3018
3226
|
|
|
3019
3227
|
/***/ }),
|
|
@@ -3043,8 +3251,8 @@ exports.Config = Config;
|
|
|
3043
3251
|
*/
|
|
3044
3252
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3045
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;
|
|
3046
|
-
const Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
|
|
3047
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");
|
|
3048
3256
|
/**
|
|
3049
3257
|
* special status of the datasource location pointer
|
|
3050
3258
|
* if an access, outside - of the possible data boundaries is happening
|
|
@@ -3397,7 +3605,7 @@ exports.AssocArrayCollector = AssocArrayCollector;
|
|
|
3397
3605
|
*/
|
|
3398
3606
|
class ConfigCollector {
|
|
3399
3607
|
constructor() {
|
|
3400
|
-
this.finalValue = new
|
|
3608
|
+
this.finalValue = new Config_1.Config({});
|
|
3401
3609
|
}
|
|
3402
3610
|
collect(element) {
|
|
3403
3611
|
this.finalValue.append(element.key).value = element.value;
|
|
@@ -3568,11 +3776,34 @@ exports.XQ = XMLQuery;
|
|
|
3568
3776
|
/*!******************************************************************!*\
|
|
3569
3777
|
!*** ./node_modules/mona-dish/src/main/typescript/index_core.ts ***!
|
|
3570
3778
|
\******************************************************************/
|
|
3571
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
3779
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3572
3780
|
|
|
3573
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
|
+
};
|
|
3574
3805
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3575
|
-
exports.
|
|
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;
|
|
3576
3807
|
/*!
|
|
3577
3808
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
3578
3809
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -3600,15 +3831,25 @@ Object.defineProperty(exports, "DQ$", ({ enumerable: true, get: function () { re
|
|
|
3600
3831
|
var Lang_1 = __webpack_require__(/*! ./Lang */ "./node_modules/mona-dish/src/main/typescript/Lang.ts");
|
|
3601
3832
|
Object.defineProperty(exports, "Lang", ({ enumerable: true, get: function () { return Lang_1.Lang; } }));
|
|
3602
3833
|
var Monad_1 = __webpack_require__(/*! ./Monad */ "./node_modules/mona-dish/src/main/typescript/Monad.ts");
|
|
3603
|
-
Object.defineProperty(exports, "Config", ({ enumerable: true, get: function () { return Monad_1.Config; } }));
|
|
3604
|
-
Object.defineProperty(exports, "CONFIG_VALUE", ({ enumerable: true, get: function () { return Monad_1.CONFIG_VALUE; } }));
|
|
3605
|
-
Object.defineProperty(exports, "CONFIG_ANY", ({ enumerable: true, get: function () { return Monad_1.CONFIG_ANY; } }));
|
|
3606
3834
|
Object.defineProperty(exports, "Monad", ({ enumerable: true, get: function () { return Monad_1.Monad; } }));
|
|
3607
3835
|
Object.defineProperty(exports, "Optional", ({ enumerable: true, get: function () { return Monad_1.Optional; } }));
|
|
3608
3836
|
Object.defineProperty(exports, "ValueEmbedder", ({ enumerable: true, get: function () { return Monad_1.ValueEmbedder; } }));
|
|
3609
3837
|
var XmlQuery_1 = __webpack_require__(/*! ./XmlQuery */ "./node_modules/mona-dish/src/main/typescript/XmlQuery.ts");
|
|
3610
3838
|
Object.defineProperty(exports, "XMLQuery", ({ enumerable: true, get: function () { return XmlQuery_1.XMLQuery; } }));
|
|
3611
3839
|
Object.defineProperty(exports, "XQ", ({ enumerable: true, get: function () { return XmlQuery_1.XQ; } }));
|
|
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"));
|
|
3612
3853
|
|
|
3613
3854
|
|
|
3614
3855
|
/***/ }),
|
|
@@ -3730,12 +3971,12 @@ var faces;
|
|
|
3730
3971
|
/**
|
|
3731
3972
|
* this function has to send the ajax requests
|
|
3732
3973
|
*
|
|
3733
|
-
* following
|
|
3974
|
+
* following requestInternal conditions must be met:
|
|
3734
3975
|
* <ul>
|
|
3735
|
-
* <li> the
|
|
3736
|
-
* <li> the
|
|
3737
|
-
* <li> the
|
|
3738
|
-
* <li> all requests must be queued with a client side
|
|
3976
|
+
* <li> the requestInternal must be sent asynchronously! </li>
|
|
3977
|
+
* <li> the requestInternal must be a POST!!! requestInternal </li>
|
|
3978
|
+
* <li> the requestInternal url must be the form action attribute </li>
|
|
3979
|
+
* <li> all requests must be queued with a client side requestInternal queue to ensure the requestInternal ordering!</li>
|
|
3739
3980
|
* </ul>
|
|
3740
3981
|
*
|
|
3741
3982
|
* @param {String|Node} element: any dom element no matter being it html or jsf, from which the event is emitted
|
|
@@ -3751,6 +3992,7 @@ var faces;
|
|
|
3751
3992
|
* @param request the request object having triggered this response
|
|
3752
3993
|
* @param context the request context
|
|
3753
3994
|
*
|
|
3995
|
+
* TODO add info on what can be in the context
|
|
3754
3996
|
*/
|
|
3755
3997
|
function response(request, context) {
|
|
3756
3998
|
AjaxImpl_1.Implementation.response(request, context);
|
|
@@ -3765,10 +4007,10 @@ var faces;
|
|
|
3765
4007
|
* <li> errorData.status : the error status message</li>
|
|
3766
4008
|
* <li> errorData.serverErrorName : the server error name in case of a server error</li>
|
|
3767
4009
|
* <li> errorData.serverErrorMessage : the server error message in case of a server error</li>
|
|
3768
|
-
* <li> errorData.source : the issuing source element which triggered the
|
|
3769
|
-
* <li> eventData.responseCode: the response code (aka http
|
|
3770
|
-
* <li> eventData.responseText: the
|
|
3771
|
-
* <li> eventData.responseXML: the
|
|
4010
|
+
* <li> errorData.source : the issuing source element which triggered the requestInternal </li>
|
|
4011
|
+
* <li> eventData.responseCode: the response code (aka http requestInternal response code, 401 etc...) </li>
|
|
4012
|
+
* <li> eventData.responseText: the requestInternal response text </li>
|
|
4013
|
+
* <li> eventData.responseXML: the requestInternal response xml </li>
|
|
3772
4014
|
* </ul>
|
|
3773
4015
|
*
|
|
3774
4016
|
* @param errorFunc error handler must be of the format <i>function errorListener(<errorData>)</i>
|
|
@@ -3882,7 +4124,7 @@ var myfaces;
|
|
|
3882
4124
|
*
|
|
3883
4125
|
* @param executionFunc the function to be executed upon ready
|
|
3884
4126
|
*/
|
|
3885
|
-
function
|
|
4127
|
+
function onDomReady(executionFunc) {
|
|
3886
4128
|
if (document.readyState !== "complete") {
|
|
3887
4129
|
onReadyChain.push(executionFunc);
|
|
3888
4130
|
if (!readyStateListener) {
|
|
@@ -3907,7 +4149,7 @@ var myfaces;
|
|
|
3907
4149
|
executionFunc();
|
|
3908
4150
|
}
|
|
3909
4151
|
}
|
|
3910
|
-
myfaces.
|
|
4152
|
+
myfaces.onDomReady = onDomReady;
|
|
3911
4153
|
/**
|
|
3912
4154
|
* legacy oam functions
|
|
3913
4155
|
*/
|
|
@@ -3943,7 +4185,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
3943
4185
|
exports.Implementation = void 0;
|
|
3944
4186
|
const Response_1 = __webpack_require__(/*! ./xhrCore/Response */ "./src/main/typescript/impl/xhrCore/Response.ts");
|
|
3945
4187
|
const XhrRequest_1 = __webpack_require__(/*! ./xhrCore/XhrRequest */ "./src/main/typescript/impl/xhrCore/XhrRequest.ts");
|
|
3946
|
-
const AsyncQueue_1 = __webpack_require__(/*! ./util/AsyncQueue */ "./src/main/typescript/impl/util/AsyncQueue.ts");
|
|
3947
4188
|
const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
3948
4189
|
const Assertions_1 = __webpack_require__(/*! ./util/Assertions */ "./src/main/typescript/impl/util/Assertions.ts");
|
|
3949
4190
|
const ExtDomQuery_1 = __webpack_require__(/*! ./util/ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
|
|
@@ -3952,6 +4193,7 @@ const Lang_1 = __webpack_require__(/*! ./util/Lang */ "./src/main/typescript/imp
|
|
|
3952
4193
|
const Const_1 = __webpack_require__(/*! ./core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
3953
4194
|
const RequestDataResolver_1 = __webpack_require__(/*! ./xhrCore/RequestDataResolver */ "./src/main/typescript/impl/xhrCore/RequestDataResolver.ts");
|
|
3954
4195
|
const FileUtils_1 = __webpack_require__(/*! ./util/FileUtils */ "./src/main/typescript/impl/util/FileUtils.ts");
|
|
4196
|
+
const XhrQueueController_1 = __webpack_require__(/*! ./util/XhrQueueController */ "./src/main/typescript/impl/util/XhrQueueController.ts");
|
|
3955
4197
|
/*
|
|
3956
4198
|
* allowed project stages
|
|
3957
4199
|
*/
|
|
@@ -3999,17 +4241,7 @@ var Implementation;
|
|
|
3999
4241
|
it provides following
|
|
4000
4242
|
|
|
4001
4243
|
a) Monad like structures for querying because this keeps the code denser and adds abstractions
|
|
4002
|
-
that always was the strong point of
|
|
4003
|
-
|
|
4004
|
-
b) Streams and lazy streams like java has, a pull stream construct, ecmascript does not have anything like it.
|
|
4005
|
-
(it has array filters and maps, but ES2015 does not support flatMap)
|
|
4006
|
-
Another option would have been rxjs but that would have introduced a code dependency and probably more code. We might
|
|
4007
|
-
move to RXJS if the need arises, however. But for now I would rather stick with my small self grown library which works
|
|
4008
|
-
quite well and where I can patch quickly (I have used it in several industrial projects, so it works well
|
|
4009
|
-
and is heavily fortified by unit tests (140 testcases as time of writing this))
|
|
4010
|
-
The long term plan is to eliminate the Stream usage as soon as we can move up to ES2019 (adding the missing
|
|
4011
|
-
functions as shims, is a no go, because we are a library, and absolutey do not Shim anything which can leak
|
|
4012
|
-
into the global namespace!)
|
|
4244
|
+
that always was the strong point of jQuery, and it still is better in this regard than what ecmascript provides
|
|
4013
4245
|
|
|
4014
4246
|
c) A neutral json like configuration which allows assignments of arbitrary values with reduce code which then can be
|
|
4015
4247
|
transformed into different data representations
|
|
@@ -4045,6 +4277,8 @@ var Implementation;
|
|
|
4045
4277
|
var getMessage = Lang_1.ExtLang.getMessage;
|
|
4046
4278
|
var getGlobalConfig = Lang_1.ExtLang.getGlobalConfig;
|
|
4047
4279
|
var assert = Assertions_1.Assertions.assert;
|
|
4280
|
+
var ofAssoc = Lang_1.ExtLang.ofAssoc;
|
|
4281
|
+
var collectAssoc = Lang_1.ExtLang.collectAssoc;
|
|
4048
4282
|
let projectStage = null;
|
|
4049
4283
|
let separator = null;
|
|
4050
4284
|
let eventQueue = [];
|
|
@@ -4077,7 +4311,7 @@ var Implementation;
|
|
|
4077
4311
|
/**
|
|
4078
4312
|
* @return the project stage also emitted by the server:
|
|
4079
4313
|
* it cannot be cached and must be delivered over the server
|
|
4080
|
-
* The value for it comes from the
|
|
4314
|
+
* The value for it comes from the requestInternal parameter of the faces.js script called "stage".
|
|
4081
4315
|
*/
|
|
4082
4316
|
function getProjectStage() {
|
|
4083
4317
|
var _a, _b, _c;
|
|
@@ -4102,15 +4336,18 @@ var Implementation;
|
|
|
4102
4336
|
* @param funcs
|
|
4103
4337
|
*/
|
|
4104
4338
|
function chain(source, event, ...funcs) {
|
|
4105
|
-
// we can use our lazy stream each functionality to run our chain here
|
|
4339
|
+
// we can use our lazy stream each functionality to run our chain here.
|
|
4106
4340
|
// by passing a boolean as return value into the onElem call
|
|
4107
4341
|
// we can stop early at the first false, just like the spec requests
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4342
|
+
let ret;
|
|
4343
|
+
funcs.every(func => {
|
|
4344
|
+
let returnVal = resolveAndExecute(source, event, func);
|
|
4345
|
+
if (returnVal !== false) {
|
|
4346
|
+
ret = returnVal;
|
|
4347
|
+
}
|
|
4348
|
+
return returnVal !== false;
|
|
4349
|
+
});
|
|
4350
|
+
return ret;
|
|
4114
4351
|
}
|
|
4115
4352
|
Implementation.chain = chain;
|
|
4116
4353
|
/**
|
|
@@ -4132,7 +4369,7 @@ var Implementation;
|
|
|
4132
4369
|
* b) passThrough handling with a map copy with a filter map block map
|
|
4133
4370
|
*/
|
|
4134
4371
|
function request(el, event, opts) {
|
|
4135
|
-
var _a, _b, _c;
|
|
4372
|
+
var _a, _b, _c, _d, _e;
|
|
4136
4373
|
const { options, elem, elementId, windowId, isResetValues } = (0, RequestDataResolver_1.resolveDefaults)(event, opts, el);
|
|
4137
4374
|
const requestCtx = new ExtDomQuery_1.ExtConfig({});
|
|
4138
4375
|
const internalCtx = new ExtDomQuery_1.ExtConfig({});
|
|
@@ -4150,7 +4387,7 @@ var Implementation;
|
|
|
4150
4387
|
const delay = (0, RequestDataResolver_1.resolveDelay)(options);
|
|
4151
4388
|
const timeout = (0, RequestDataResolver_1.resolveTimeout)(options);
|
|
4152
4389
|
requestCtx.assignIf(!!windowId, Const_1.P_WINDOW_ID).value = windowId;
|
|
4153
|
-
// old non spec behavior will be removed after it is clear whether the removal breaks any code
|
|
4390
|
+
// old non - spec behavior will be removed after it is clear whether the removal breaks any code
|
|
4154
4391
|
requestCtx.assign(Const_1.CTX_PARAM_REQ_PASS_THR).value = extractLegacyParams(options.value);
|
|
4155
4392
|
// spec conform behavior, all passthrough params must be under "passthrough
|
|
4156
4393
|
const params = remapArrayToAssocArr(options.getIf(Const_1.CTX_OPTIONS_PARAMS).orElse({}).value);
|
|
@@ -4176,13 +4413,13 @@ var Implementation;
|
|
|
4176
4413
|
requestCtx.assign(Const_1.ON_EVENT).value = (_a = options.value) === null || _a === void 0 ? void 0 : _a.onevent;
|
|
4177
4414
|
requestCtx.assign(Const_1.ON_ERROR).value = (_b = options.value) === null || _b === void 0 ? void 0 : _b.onerror;
|
|
4178
4415
|
/**
|
|
4179
|
-
*
|
|
4416
|
+
* Fetch the myfaces config params
|
|
4180
4417
|
*/
|
|
4181
4418
|
requestCtx.assign(Const_1.MYFACES).value = (_c = options.value) === null || _c === void 0 ? void 0 : _c.myfaces;
|
|
4182
4419
|
/**
|
|
4183
4420
|
* binding contract the jakarta.faces.source must be set
|
|
4184
4421
|
*/
|
|
4185
|
-
requestCtx.assign(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.
|
|
4422
|
+
requestCtx.assign(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_AJAX_SOURCE).value = elementId;
|
|
4186
4423
|
/**
|
|
4187
4424
|
* jakarta.faces.partial.ajax must be set to true
|
|
4188
4425
|
*/
|
|
@@ -4205,6 +4442,8 @@ var Implementation;
|
|
|
4205
4442
|
// won't hurt but for the sake of compatibility we are going to add it
|
|
4206
4443
|
requestCtx.assign(Const_1.CTX_PARAM_REQ_PASS_THR, formId).value = formId;
|
|
4207
4444
|
internalCtx.assign(Const_1.CTX_PARAM_SRC_CTL_ID).value = elementId;
|
|
4445
|
+
// reintroduction of PPS as per myfaces 2.3 (myfaces.pps = true, only the executes are submitted)
|
|
4446
|
+
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;
|
|
4208
4447
|
assignClientWindowId(form, requestCtx);
|
|
4209
4448
|
assignExecute(options, requestCtx, form, elementId);
|
|
4210
4449
|
assignRender(options, requestCtx, form, elementId);
|
|
@@ -4281,7 +4520,7 @@ var Implementation;
|
|
|
4281
4520
|
}
|
|
4282
4521
|
finally {
|
|
4283
4522
|
if (clearRequestQueue) {
|
|
4284
|
-
Implementation.requestQueue.
|
|
4523
|
+
Implementation.requestQueue.clear();
|
|
4285
4524
|
}
|
|
4286
4525
|
}
|
|
4287
4526
|
}
|
|
@@ -4355,7 +4594,8 @@ var Implementation;
|
|
|
4355
4594
|
* window ids must be present in all forms
|
|
4356
4595
|
* or non-existent. If they exist all of them must be the same
|
|
4357
4596
|
*/
|
|
4358
|
-
let formWindowId =
|
|
4597
|
+
let formWindowId = mona_dish_1.Optional.fromNullable(searchRoot.asArray
|
|
4598
|
+
.map(getValue).reduce(differenceCheck, INIT));
|
|
4359
4599
|
//if the resulting window id is set on altered then we have an unresolvable problem
|
|
4360
4600
|
assert(ALTERED != formWindowId.value, "Multiple different windowIds found in document");
|
|
4361
4601
|
/*
|
|
@@ -4387,7 +4627,7 @@ var Implementation;
|
|
|
4387
4627
|
// fetch all non file input form elements
|
|
4388
4628
|
let formElements = element.deepElements.encodeFormElement();
|
|
4389
4629
|
// encode them! (file inputs are handled differently and are not part of the viewstate)
|
|
4390
|
-
return (0, FileUtils_1.encodeFormData)(formElements, (0, RequestDataResolver_1.resoveNamingContainerMapper)(dummyContext));
|
|
4630
|
+
return (0, FileUtils_1.encodeFormData)(new ExtDomQuery_1.ExtConfig(formElements), (0, RequestDataResolver_1.resoveNamingContainerMapper)(dummyContext));
|
|
4391
4631
|
}
|
|
4392
4632
|
Implementation.getViewState = getViewState;
|
|
4393
4633
|
/**
|
|
@@ -4402,8 +4642,8 @@ var Implementation;
|
|
|
4402
4642
|
* adds a new request to our queue for further processing
|
|
4403
4643
|
*/
|
|
4404
4644
|
addRequestToQueue: function (elem, form, reqCtx, respPassThr, delay = 0, timeout = 0) {
|
|
4405
|
-
Implementation.requestQueue = Implementation.requestQueue !== null && Implementation.requestQueue !== void 0 ? Implementation.requestQueue : new
|
|
4406
|
-
Implementation.requestQueue.enqueue(new XhrRequest_1.XhrRequest(
|
|
4645
|
+
Implementation.requestQueue = Implementation.requestQueue !== null && Implementation.requestQueue !== void 0 ? Implementation.requestQueue : new XhrQueueController_1.XhrQueueController();
|
|
4646
|
+
Implementation.requestQueue.enqueue(new XhrRequest_1.XhrRequest(reqCtx, respPassThr, timeout), delay);
|
|
4407
4647
|
}
|
|
4408
4648
|
};
|
|
4409
4649
|
//----------------------------------------------- Methods ---------------------------------------------------------------------
|
|
@@ -4503,7 +4743,7 @@ var Implementation;
|
|
|
4503
4743
|
* can deal with them either prefixed ir not
|
|
4504
4744
|
* also resolves the absolute id case (it was assumed the server does this, but
|
|
4505
4745
|
* apparently the RI does not, so we have to follow the RI behavior here)
|
|
4506
|
-
* @param componentIdToTransform the componentId which needs post
|
|
4746
|
+
* @param componentIdToTransform the componentId which needs post-processing
|
|
4507
4747
|
*/
|
|
4508
4748
|
const remapNamingContainer = componentIdToTransform => {
|
|
4509
4749
|
// pattern :<anything> must be prepended by viewRoot if there is one,
|
|
@@ -4517,7 +4757,7 @@ var Implementation;
|
|
|
4517
4757
|
const hasLeadingSep = componentIdToTransform.indexOf(SEP) === 0;
|
|
4518
4758
|
const isAbsolutSearchExpr = hasLeadingSep || (rootNamingContainerId.length
|
|
4519
4759
|
&& componentIdToTransform.indexOf(rootNamingContainerPrefix) == 0);
|
|
4520
|
-
let finalIdentifier
|
|
4760
|
+
let finalIdentifier;
|
|
4521
4761
|
if (isAbsolutSearchExpr) {
|
|
4522
4762
|
//we cut off the leading sep if there is one
|
|
4523
4763
|
componentIdToTransform = hasLeadingSep ? componentIdToTransform.substring(1) : componentIdToTransform;
|
|
@@ -4536,13 +4776,13 @@ var Implementation;
|
|
|
4536
4776
|
[rootNamingContainerPrefix, componentIdToTransform].join(Const_1.EMPTY_STR) :
|
|
4537
4777
|
[nearestNamingContainerPrefix, componentIdToTransform].join(Const_1.EMPTY_STR);
|
|
4538
4778
|
}
|
|
4539
|
-
// We need to double
|
|
4779
|
+
// We need to double-check because we have scenarios where we have a naming container
|
|
4540
4780
|
// and no prepend (aka tobago testcase "must handle ':' in IDs properly", scenario 3,
|
|
4541
4781
|
// in this case we return the component id, and be happy
|
|
4542
4782
|
// we can roll a dom check here
|
|
4543
4783
|
return (!!document.getElementById(finalIdentifier)) ? finalIdentifier : componentIdToTransform;
|
|
4544
4784
|
};
|
|
4545
|
-
// in this case we do not use lazy stream because it
|
|
4785
|
+
// in this case we do not use lazy stream because it won´t bring any code reduction
|
|
4546
4786
|
// or speedup
|
|
4547
4787
|
for (let cnt = 0; cnt < iterValues.length; cnt++) {
|
|
4548
4788
|
//avoid doubles
|
|
@@ -4582,23 +4822,36 @@ var Implementation;
|
|
|
4582
4822
|
* the values required for params-through are processed in the ajax request
|
|
4583
4823
|
*
|
|
4584
4824
|
* Note this is a bug carried over from the old implementation
|
|
4585
|
-
* the spec conform behavior is to use params for
|
|
4825
|
+
* the spec conform behavior is to use params for pass - through values
|
|
4586
4826
|
* this will be removed soon, after it is cleared up whether removing
|
|
4587
4827
|
* it breaks any legacy code
|
|
4588
4828
|
*
|
|
4589
4829
|
* @param {Context} mappedOpts the options to be filtered
|
|
4590
|
-
* @deprecated
|
|
4591
4830
|
*/
|
|
4592
4831
|
function extractLegacyParams(mappedOpts) {
|
|
4593
4832
|
//we now can use the full code reduction given by our stream api
|
|
4594
4833
|
//to filter
|
|
4595
|
-
return
|
|
4596
|
-
.filter(item => !(item[0] in BlockFilter))
|
|
4597
|
-
.
|
|
4834
|
+
return ofAssoc(mappedOpts)
|
|
4835
|
+
.filter((item => !(item[0] in BlockFilter)))
|
|
4836
|
+
.reduce(collectAssoc, {});
|
|
4837
|
+
}
|
|
4838
|
+
/**
|
|
4839
|
+
* extracts the myfaces config parameters which provide extra functionality
|
|
4840
|
+
* on top of JSF
|
|
4841
|
+
* @param mappedOpts
|
|
4842
|
+
* @private
|
|
4843
|
+
*/
|
|
4844
|
+
function extractMyFacesParams(mappedOpts) {
|
|
4845
|
+
var _a;
|
|
4846
|
+
//we now can use the full code reduction given by our stream api
|
|
4847
|
+
//to filter
|
|
4848
|
+
return (_a = ofAssoc(mappedOpts)
|
|
4849
|
+
.filter((item => (item[0] == "myfaces")))
|
|
4850
|
+
.reduce(collectAssoc, {})) === null || _a === void 0 ? void 0 : _a[Const_1.MYFACES];
|
|
4598
4851
|
}
|
|
4599
4852
|
function remapArrayToAssocArr(arrayedParams) {
|
|
4600
4853
|
if (Array.isArray(arrayedParams)) {
|
|
4601
|
-
return
|
|
4854
|
+
return arrayedParams.reduce(collectAssoc, {});
|
|
4602
4855
|
}
|
|
4603
4856
|
return arrayedParams;
|
|
4604
4857
|
}
|
|
@@ -4926,16 +5179,16 @@ var PushImpl;
|
|
|
4926
5179
|
* limitations under the License.
|
|
4927
5180
|
*/
|
|
4928
5181
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4929
|
-
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.
|
|
4930
|
-
exports.
|
|
4931
|
-
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;
|
|
5182
|
+
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;
|
|
5183
|
+
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;
|
|
5184
|
+
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;
|
|
4932
5185
|
/*
|
|
4933
5186
|
* [export const] constants
|
|
4934
5187
|
*/
|
|
4935
5188
|
exports.XML_ATTR_NAMED_VIEWROOT = "namedViewRoot";
|
|
4936
5189
|
exports.NAMED_VIEWROOT = "namedViewRoot";
|
|
4937
|
-
exports.
|
|
4938
|
-
exports.NAMING_CONTAINER_ID = "myfaces.
|
|
5190
|
+
exports.P_AJAX_SOURCE = "jakarta.faces.source";
|
|
5191
|
+
exports.NAMING_CONTAINER_ID = "myfaces.NamingContainerId";
|
|
4939
5192
|
exports.VIEW_ID = "myfaces.viewId";
|
|
4940
5193
|
exports.P_VIEWSTATE = "jakarta.faces.ViewState";
|
|
4941
5194
|
exports.P_CLIENT_WINDOW = "jakarta.faces.ClientWindow";
|
|
@@ -4998,6 +5251,7 @@ exports.CTX_PARAM_MF_INTERNAL = "myfaces.internal";
|
|
|
4998
5251
|
exports.CTX_PARAM_SRC_FRM_ID = "myfaces.source.formId";
|
|
4999
5252
|
exports.CTX_PARAM_SRC_CTL_ID = "myfaces.source.controlId";
|
|
5000
5253
|
exports.CTX_PARAM_REQ_PASS_THR = "myfaces.request.passThrough";
|
|
5254
|
+
exports.CTX_PARAM_PPS = "myfaces.request.pps";
|
|
5001
5255
|
exports.CONTENT_TYPE = "Content-Type";
|
|
5002
5256
|
exports.HEAD_FACES_REQ = "Faces-Request";
|
|
5003
5257
|
exports.REQ_ACCEPT = "Accept";
|
|
@@ -5023,6 +5277,7 @@ exports.SEL_CLIENT_WINDOW_ELEM = "[name='" + exports.P_CLIENT_WINDOW + "']";
|
|
|
5023
5277
|
exports.SEL_RESPONSE_XML = "responseXML";
|
|
5024
5278
|
exports.PHASE_PROCESS_RESPONSE = "processResponse";
|
|
5025
5279
|
exports.ERR_NO_PARTIAL_RESPONSE = "Partial response not set";
|
|
5280
|
+
exports.MYFACES_OPTION_PPS = "pps";
|
|
5026
5281
|
exports.ATTR_URL = "url";
|
|
5027
5282
|
exports.ATTR_NAME = "name";
|
|
5028
5283
|
exports.ATTR_VALUE = "value";
|
|
@@ -5358,120 +5613,89 @@ var Assertions;
|
|
|
5358
5613
|
|
|
5359
5614
|
/***/ }),
|
|
5360
5615
|
|
|
5361
|
-
/***/ "./src/main/typescript/impl/util/
|
|
5362
|
-
|
|
5363
|
-
!*** ./src/main/typescript/impl/util/
|
|
5364
|
-
|
|
5616
|
+
/***/ "./src/main/typescript/impl/util/AsyncRunnable.ts":
|
|
5617
|
+
/*!********************************************************!*\
|
|
5618
|
+
!*** ./src/main/typescript/impl/util/AsyncRunnable.ts ***!
|
|
5619
|
+
\********************************************************/
|
|
5365
5620
|
/***/ ((__unused_webpack_module, exports) => {
|
|
5366
5621
|
|
|
5367
5622
|
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
*
|
|
5372
|
-
*
|
|
5623
|
+
/*! Licensed to the Apache Software Foundation (ASF) under one or more
|
|
5624
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
5625
|
+
* this work for additional information regarding copyright ownership.
|
|
5626
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
5627
|
+
* (the "License"); you may not use this file except in compliance with
|
|
5628
|
+
* the License. You may obtain a copy of the License at
|
|
5373
5629
|
*
|
|
5374
|
-
*
|
|
5375
|
-
* which is sort of an extended promise which has
|
|
5376
|
-
* added a dedicated cancel and start point
|
|
5630
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5377
5631
|
*
|
|
5378
|
-
*
|
|
5379
|
-
*
|
|
5632
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5633
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5634
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5635
|
+
* See the License for the specific language governing permissions and
|
|
5636
|
+
* limitations under the License.
|
|
5637
|
+
*/
|
|
5638
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5639
|
+
exports.AsyncRunnable = void 0;
|
|
5640
|
+
/**
|
|
5641
|
+
* pretty much the same as cancellable Promise, but given
|
|
5642
|
+
* we do not have that on browser level yet this is sort
|
|
5643
|
+
* of a non - intrusive Shim!
|
|
5380
5644
|
*/
|
|
5381
|
-
class
|
|
5645
|
+
class AsyncRunnable {
|
|
5382
5646
|
constructor() {
|
|
5383
|
-
|
|
5647
|
+
/**
|
|
5648
|
+
* helper support so that we do not have to drag in Promise shims
|
|
5649
|
+
*/
|
|
5650
|
+
this.catchFunctions = [];
|
|
5651
|
+
this.thenFunctions = [];
|
|
5384
5652
|
}
|
|
5385
5653
|
/**
|
|
5386
|
-
*
|
|
5654
|
+
* resolve handler function which calls the then chain
|
|
5655
|
+
* and after that finally
|
|
5656
|
+
* @param data
|
|
5387
5657
|
*/
|
|
5388
|
-
|
|
5389
|
-
|
|
5658
|
+
resolve(data) {
|
|
5659
|
+
this.thenFunctions.reduce((inputVal, thenFunc) => {
|
|
5660
|
+
return thenFunc(inputVal);
|
|
5661
|
+
}, data);
|
|
5390
5662
|
}
|
|
5391
5663
|
/**
|
|
5392
|
-
*
|
|
5393
|
-
*
|
|
5394
|
-
*
|
|
5395
|
-
* @param element the element to be queued and processed
|
|
5396
|
-
* @param delay possible delay after our usual process or drop if something newer is incoming algorithm
|
|
5664
|
+
* reject handler function which triggers the catch chain
|
|
5665
|
+
* @param data
|
|
5397
5666
|
*/
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
}
|
|
5403
|
-
if (delay) {
|
|
5404
|
-
this.delayTimeout = setTimeout(() => {
|
|
5405
|
-
this.appendElement(element);
|
|
5406
|
-
});
|
|
5407
|
-
}
|
|
5408
|
-
else {
|
|
5409
|
-
this.appendElement(element);
|
|
5410
|
-
}
|
|
5667
|
+
reject(data) {
|
|
5668
|
+
this.catchFunctions.reduce((inputVal, catchFunc) => {
|
|
5669
|
+
return catchFunc(inputVal);
|
|
5670
|
+
}, data);
|
|
5411
5671
|
}
|
|
5412
5672
|
/**
|
|
5413
|
-
*
|
|
5673
|
+
* register a catch functor
|
|
5674
|
+
* @param func the functor for the catch monad
|
|
5414
5675
|
*/
|
|
5415
|
-
|
|
5416
|
-
|
|
5676
|
+
catch(func) {
|
|
5677
|
+
this.catchFunctions.push(func);
|
|
5678
|
+
return this;
|
|
5417
5679
|
}
|
|
5418
5680
|
/**
|
|
5419
|
-
*
|
|
5681
|
+
* registers a finally functor
|
|
5682
|
+
* @param func the functor for the finally handling chanin
|
|
5420
5683
|
*/
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
this.
|
|
5684
|
+
finally(func) {
|
|
5685
|
+
// no ie11 support we probably are going to revert to shims for that one
|
|
5686
|
+
this.catchFunctions.push(func);
|
|
5687
|
+
this.thenFunctions.push(func);
|
|
5688
|
+
return this;
|
|
5424
5689
|
}
|
|
5425
5690
|
/**
|
|
5426
|
-
*
|
|
5427
|
-
* aka cancel the queue entirely
|
|
5691
|
+
* @param func then functor similar to promise
|
|
5428
5692
|
*/
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
this.currentlyRunning.cancel();
|
|
5433
|
-
}
|
|
5434
|
-
}
|
|
5435
|
-
finally {
|
|
5436
|
-
this.cleanup();
|
|
5437
|
-
}
|
|
5438
|
-
}
|
|
5439
|
-
callForNextElementToProcess() {
|
|
5440
|
-
this.runEntry();
|
|
5441
|
-
}
|
|
5442
|
-
appendElement(element) {
|
|
5443
|
-
//only if the first element is added we start with a trigger
|
|
5444
|
-
//otherwise a process already is running and not finished yet at that
|
|
5445
|
-
//time
|
|
5446
|
-
this.runnableQueue.push(element);
|
|
5447
|
-
if (!this.currentlyRunning) {
|
|
5448
|
-
this.runEntry();
|
|
5449
|
-
}
|
|
5450
|
-
}
|
|
5451
|
-
runEntry() {
|
|
5452
|
-
if (this.isEmpty) {
|
|
5453
|
-
this.currentlyRunning = null;
|
|
5454
|
-
return;
|
|
5455
|
-
}
|
|
5456
|
-
this.currentlyRunning = this.dequeue();
|
|
5457
|
-
this.currentlyRunning
|
|
5458
|
-
.catch((e) => {
|
|
5459
|
-
//in case of an error we always clean up the remaining calls
|
|
5460
|
-
//to allow a clean recovery of the application
|
|
5461
|
-
this.cleanup();
|
|
5462
|
-
throw e;
|
|
5463
|
-
})
|
|
5464
|
-
.then(
|
|
5465
|
-
//the idea is to trigger the next over an event to reduce
|
|
5466
|
-
//the number of recursive calls (stacks might be limited
|
|
5467
|
-
//compared to ram)
|
|
5468
|
-
//naturally give we have a DOM, the DOM is the natural event dispatch system
|
|
5469
|
-
//which we can use, to decouple the calls from a recursive stack call
|
|
5470
|
-
//(the browser engine will take care of that)
|
|
5471
|
-
() => this.callForNextElementToProcess()).start();
|
|
5693
|
+
then(func) {
|
|
5694
|
+
this.thenFunctions.push(func);
|
|
5695
|
+
return this;
|
|
5472
5696
|
}
|
|
5473
5697
|
}
|
|
5474
|
-
exports.
|
|
5698
|
+
exports.AsyncRunnable = AsyncRunnable;
|
|
5475
5699
|
|
|
5476
5700
|
|
|
5477
5701
|
/***/ }),
|
|
@@ -5580,6 +5804,7 @@ class ExtDomQuery extends mona_dish_1.DQ {
|
|
|
5580
5804
|
* this is done once and only lazily
|
|
5581
5805
|
*/
|
|
5582
5806
|
get nonce() {
|
|
5807
|
+
var _a;
|
|
5583
5808
|
//already processed
|
|
5584
5809
|
let myfacesConfig = new ExtConfig(window.myfaces);
|
|
5585
5810
|
let nonce = myfacesConfig.getIf("config", "cspMeta", "nonce");
|
|
@@ -5594,12 +5819,10 @@ class ExtDomQuery extends mona_dish_1.DQ {
|
|
|
5594
5819
|
}
|
|
5595
5820
|
// fallback if the currentScript method fails, we just search the jsf tags for nonce, this is
|
|
5596
5821
|
// the last possibility
|
|
5597
|
-
let nonceScript = mona_dish_1.DQ
|
|
5598
|
-
.querySelectorAll("script[src], link[src]")
|
|
5599
|
-
.lazyStream
|
|
5822
|
+
let nonceScript = mona_dish_1.Optional.fromNullable((_a = mona_dish_1.DQ
|
|
5823
|
+
.querySelectorAll("script[src], link[src]").asArray
|
|
5600
5824
|
.filter((item) => this.extractNonce(item) && item.attr(ATTR_SRC) != null)
|
|
5601
|
-
.filter(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value))
|
|
5602
|
-
.first();
|
|
5825
|
+
.filter(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value))) === null || _a === void 0 ? void 0 : _a[0]);
|
|
5603
5826
|
if (nonceScript.isPresent()) {
|
|
5604
5827
|
return this.extractNonce(nonceScript.value);
|
|
5605
5828
|
}
|
|
@@ -5614,14 +5837,15 @@ class ExtDomQuery extends mona_dish_1.DQ {
|
|
|
5614
5837
|
* @param regExp
|
|
5615
5838
|
*/
|
|
5616
5839
|
searchJsfJsFor(regExp) {
|
|
5840
|
+
var _a;
|
|
5617
5841
|
//perfect application for lazy stream
|
|
5618
|
-
return mona_dish_1.DQ.querySelectorAll("script[src], link[src]").
|
|
5842
|
+
return mona_dish_1.Optional.fromNullable((_a = mona_dish_1.DQ.querySelectorAll("script[src], link[src]").asArray
|
|
5619
5843
|
.filter(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value))
|
|
5620
5844
|
.map(item => item.attr(ATTR_SRC).value.match(regExp))
|
|
5621
5845
|
.filter(item => item != null && item.length > 1)
|
|
5622
5846
|
.map((result) => {
|
|
5623
5847
|
return decodeURIComponent(result[1]);
|
|
5624
|
-
})
|
|
5848
|
+
})) === null || _a === void 0 ? void 0 : _a[0]);
|
|
5625
5849
|
}
|
|
5626
5850
|
globalEval(code, nonce) {
|
|
5627
5851
|
return new ExtDomQuery(super.globalEval(code, nonce !== null && nonce !== void 0 ? nonce : this.nonce));
|
|
@@ -5780,7 +6004,7 @@ class ExtConfig extends mona_dish_1.Config {
|
|
|
5780
6004
|
if (!this.$nspEnabled) {
|
|
5781
6005
|
return accessPath;
|
|
5782
6006
|
}
|
|
5783
|
-
return
|
|
6007
|
+
return [...accessPath].map(key => (0, Const_1.$nsp)(key));
|
|
5784
6008
|
}
|
|
5785
6009
|
}
|
|
5786
6010
|
exports.ExtConfig = ExtConfig;
|
|
@@ -5796,8 +6020,7 @@ exports.ExtConfig = ExtConfig;
|
|
|
5796
6020
|
|
|
5797
6021
|
|
|
5798
6022
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5799
|
-
exports.
|
|
5800
|
-
const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
6023
|
+
exports.getFormInputsAsArr = exports.fixEmptyParameters = exports.resolveFiles = exports.decodeEncodedValues = exports.encodeFormData = void 0;
|
|
5801
6024
|
const ExtDomQuery_1 = __webpack_require__(/*! ./ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
|
|
5802
6025
|
const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
5803
6026
|
/*
|
|
@@ -5815,18 +6038,16 @@ function encodeFormData(formData, paramsMapper = (inStr, inVal) => [inStr, inVal
|
|
|
5815
6038
|
return defaultStr;
|
|
5816
6039
|
}
|
|
5817
6040
|
const assocValues = formData.value;
|
|
5818
|
-
const expandValueArrAndRename = key =>
|
|
6041
|
+
const expandValueArrAndRename = key => assocValues[key].map(val => paramsMapper(key, val));
|
|
5819
6042
|
const isPropertyKey = key => assocValues.hasOwnProperty(key);
|
|
5820
6043
|
const isNotFile = ([, value]) => !(value instanceof ExtDomQuery_1.ExtDomQuery.global().File);
|
|
5821
6044
|
const mapIntoUrlParam = keyVal => `${encodeURIComponent(keyVal[0])}=${encodeURIComponent(keyVal[1])}`;
|
|
5822
|
-
|
|
6045
|
+
return Object.keys(assocValues)
|
|
5823
6046
|
.filter(isPropertyKey)
|
|
5824
6047
|
.flatMap(expandValueArrAndRename)
|
|
5825
|
-
//we cannot encode file elements that is handled by multipart requests anyway
|
|
5826
6048
|
.filter(isNotFile)
|
|
5827
6049
|
.map(mapIntoUrlParam)
|
|
5828
|
-
.
|
|
5829
|
-
return entries.join("&");
|
|
6050
|
+
.join("&");
|
|
5830
6051
|
}
|
|
5831
6052
|
exports.encodeFormData = encodeFormData;
|
|
5832
6053
|
/**
|
|
@@ -5843,9 +6064,7 @@ function decodeEncodedValues(encoded) {
|
|
|
5843
6064
|
return [line.substring(0, index), line.substring(index + 1)];
|
|
5844
6065
|
};
|
|
5845
6066
|
let requestParamEntries = decodeURIComponent(encoded).split(/&/gi);
|
|
5846
|
-
return
|
|
5847
|
-
.filter(filterBlanks)
|
|
5848
|
-
.map(splitKeyValuePair);
|
|
6067
|
+
return requestParamEntries.filter(filterBlanks).map(splitKeyValuePair);
|
|
5849
6068
|
}
|
|
5850
6069
|
exports.decodeEncodedValues = decodeEncodedValues;
|
|
5851
6070
|
/**
|
|
@@ -5853,20 +6072,26 @@ exports.decodeEncodedValues = decodeEncodedValues;
|
|
|
5853
6072
|
* @param dataSource
|
|
5854
6073
|
*/
|
|
5855
6074
|
function resolveFiles(dataSource) {
|
|
5856
|
-
const expandFilesArr = ([key, files]) =>
|
|
5857
|
-
|
|
5858
|
-
|
|
6075
|
+
const expandFilesArr = ([key, files]) => {
|
|
6076
|
+
return [...files].map(file => [key, file]);
|
|
6077
|
+
};
|
|
6078
|
+
const remapFileInput = fileInput => {
|
|
6079
|
+
return [fileInput.name.value || fileInput.id.value, fileInput.filesFromElem(0)];
|
|
6080
|
+
};
|
|
6081
|
+
const files = dataSource
|
|
5859
6082
|
.querySelectorAllDeep("input[type='file']")
|
|
5860
|
-
.
|
|
6083
|
+
.asArray;
|
|
6084
|
+
const ret = files
|
|
5861
6085
|
.map(remapFileInput)
|
|
5862
6086
|
.flatMap(expandFilesArr);
|
|
6087
|
+
return ret;
|
|
5863
6088
|
}
|
|
5864
6089
|
exports.resolveFiles = resolveFiles;
|
|
5865
|
-
function
|
|
6090
|
+
function fixEmptyParameters(keyVal) {
|
|
5866
6091
|
var _a, _b;
|
|
5867
6092
|
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);
|
|
5868
6093
|
}
|
|
5869
|
-
exports.
|
|
6094
|
+
exports.fixEmptyParameters = fixEmptyParameters;
|
|
5870
6095
|
/**
|
|
5871
6096
|
* returns the decoded viewState from parentItem
|
|
5872
6097
|
* @param parentItem
|
|
@@ -5880,15 +6105,15 @@ function resolveViewState(parentItem) {
|
|
|
5880
6105
|
}
|
|
5881
6106
|
/**
|
|
5882
6107
|
* gets all the inputs under the form parentItem
|
|
5883
|
-
* as
|
|
6108
|
+
* as array
|
|
5884
6109
|
* @param parentItem
|
|
5885
6110
|
*/
|
|
5886
|
-
function
|
|
6111
|
+
function getFormInputsAsArr(parentItem) {
|
|
5887
6112
|
const standardInputs = resolveViewState(parentItem);
|
|
5888
6113
|
const fileInputs = resolveFiles(parentItem);
|
|
5889
|
-
return standardInputs.concat(fileInputs);
|
|
6114
|
+
return standardInputs.concat(...fileInputs);
|
|
5890
6115
|
}
|
|
5891
|
-
exports.
|
|
6116
|
+
exports.getFormInputsAsArr = getFormInputsAsArr;
|
|
5892
6117
|
|
|
5893
6118
|
|
|
5894
6119
|
/***/ }),
|
|
@@ -5951,13 +6176,17 @@ class HiddenInputBuilder {
|
|
|
5951
6176
|
var _a, _b, _c;
|
|
5952
6177
|
const SEP = (0, Const_1.$faces)().separatorchar;
|
|
5953
6178
|
let existingStates = (0, mona_dish_1.DQ$)(`[name*='${(0, Const_1.$nsp)(this.name)}']`);
|
|
5954
|
-
let cnt = existingStates.
|
|
6179
|
+
let cnt = existingStates.asArray.map(state => {
|
|
5955
6180
|
let ident = state.id.orElse("-1").value;
|
|
5956
6181
|
ident = ident.substring(ident.lastIndexOf(SEP) + 1);
|
|
5957
6182
|
return parseInt(ident);
|
|
5958
6183
|
})
|
|
5959
|
-
.filter(item =>
|
|
5960
|
-
|
|
6184
|
+
.filter(item => {
|
|
6185
|
+
return !isNaN(item);
|
|
6186
|
+
})
|
|
6187
|
+
.reduce((item1, item2) => {
|
|
6188
|
+
return Math.max(item1, item2);
|
|
6189
|
+
}, -1);
|
|
5961
6190
|
//the maximum new ident is the current max + 1
|
|
5962
6191
|
cnt++;
|
|
5963
6192
|
const newElement = mona_dish_1.DQ.fromMarkup((0, Const_1.$nsp)(this.template));
|
|
@@ -6073,7 +6302,7 @@ var ExtLang;
|
|
|
6073
6302
|
var _a, _b;
|
|
6074
6303
|
installedLocale = installedLocale !== null && installedLocale !== void 0 ? installedLocale : new Messages_1.Messages();
|
|
6075
6304
|
let msg = (_b = (_a = installedLocale[key]) !== null && _a !== void 0 ? _a : defaultMessage) !== null && _b !== void 0 ? _b : key;
|
|
6076
|
-
|
|
6305
|
+
templateParams.forEach((param, cnt) => {
|
|
6077
6306
|
msg = msg.replace(new RegExp(["\\{", cnt, "\\}"].join(Const_1.EMPTY_STR), "g"), param);
|
|
6078
6307
|
});
|
|
6079
6308
|
return msg;
|
|
@@ -6181,6 +6410,57 @@ var ExtLang;
|
|
|
6181
6410
|
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;
|
|
6182
6411
|
}
|
|
6183
6412
|
ExtLang.getLocalOrGlobalConfig = getLocalOrGlobalConfig;
|
|
6413
|
+
/**
|
|
6414
|
+
* expands an associative array into an array of key value tuples
|
|
6415
|
+
* @param value
|
|
6416
|
+
*/
|
|
6417
|
+
function ofAssoc(value) {
|
|
6418
|
+
return Object.keys(value)
|
|
6419
|
+
.map(key => [key, value[key]]);
|
|
6420
|
+
}
|
|
6421
|
+
ExtLang.ofAssoc = ofAssoc;
|
|
6422
|
+
function collectAssoc(target, item) {
|
|
6423
|
+
target[item[0]] = item[1];
|
|
6424
|
+
return target;
|
|
6425
|
+
}
|
|
6426
|
+
ExtLang.collectAssoc = collectAssoc;
|
|
6427
|
+
/**
|
|
6428
|
+
* The active timeout for the "debounce".
|
|
6429
|
+
* Since we only use it in the XhrController
|
|
6430
|
+
* we can use a local module variable here
|
|
6431
|
+
*/
|
|
6432
|
+
let activeTimeouts = {};
|
|
6433
|
+
/**
|
|
6434
|
+
* a simple debounce function
|
|
6435
|
+
* which waits until a timeout is reached and
|
|
6436
|
+
* if something comes in in between debounces
|
|
6437
|
+
*
|
|
6438
|
+
* @param runnable a runnable which should go under debounce control
|
|
6439
|
+
* @param timeout a timeout for the debounce window
|
|
6440
|
+
*/
|
|
6441
|
+
function debounce(key, runnable, timeout) {
|
|
6442
|
+
function clearActiveTimeout() {
|
|
6443
|
+
clearTimeout(activeTimeouts[key]);
|
|
6444
|
+
delete activeTimeouts[key];
|
|
6445
|
+
}
|
|
6446
|
+
if (!!(activeTimeouts === null || activeTimeouts === void 0 ? void 0 : activeTimeouts[key])) {
|
|
6447
|
+
clearActiveTimeout();
|
|
6448
|
+
}
|
|
6449
|
+
if (timeout > 0) {
|
|
6450
|
+
activeTimeouts[key] = setTimeout(() => {
|
|
6451
|
+
try {
|
|
6452
|
+
runnable();
|
|
6453
|
+
}
|
|
6454
|
+
finally {
|
|
6455
|
+
clearActiveTimeout();
|
|
6456
|
+
}
|
|
6457
|
+
}, timeout);
|
|
6458
|
+
}
|
|
6459
|
+
else {
|
|
6460
|
+
runnable();
|
|
6461
|
+
}
|
|
6462
|
+
}
|
|
6463
|
+
ExtLang.debounce = debounce;
|
|
6184
6464
|
/**
|
|
6185
6465
|
* assert that the form exists and throw an exception in the case it does not
|
|
6186
6466
|
*
|
|
@@ -6194,6 +6474,122 @@ var ExtLang;
|
|
|
6194
6474
|
})(ExtLang = exports.ExtLang || (exports.ExtLang = {}));
|
|
6195
6475
|
|
|
6196
6476
|
|
|
6477
|
+
/***/ }),
|
|
6478
|
+
|
|
6479
|
+
/***/ "./src/main/typescript/impl/util/XhrQueueController.ts":
|
|
6480
|
+
/*!*************************************************************!*\
|
|
6481
|
+
!*** ./src/main/typescript/impl/util/XhrQueueController.ts ***!
|
|
6482
|
+
\*************************************************************/
|
|
6483
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6484
|
+
|
|
6485
|
+
|
|
6486
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6487
|
+
exports.XhrQueueController = void 0;
|
|
6488
|
+
const Lang_1 = __webpack_require__(/*! ./Lang */ "./src/main/typescript/impl/util/Lang.ts");
|
|
6489
|
+
var debounce = Lang_1.ExtLang.debounce;
|
|
6490
|
+
/**
|
|
6491
|
+
* A simple XHR queue controller
|
|
6492
|
+
* following the async op -> next pattern
|
|
6493
|
+
* Faces enforces for the XHR handling
|
|
6494
|
+
*/
|
|
6495
|
+
class XhrQueueController {
|
|
6496
|
+
constructor() {
|
|
6497
|
+
this.queue = [];
|
|
6498
|
+
this.taskRunning = false;
|
|
6499
|
+
}
|
|
6500
|
+
/**
|
|
6501
|
+
* executes or enqueues an element
|
|
6502
|
+
* @param runnable the runnable (request) to be enqueued
|
|
6503
|
+
* @param timeOut timeout if > 0 which defers the execution
|
|
6504
|
+
* until the debounce window for the timeout is closed.
|
|
6505
|
+
*/
|
|
6506
|
+
enqueue(runnable, timeOut = 0) {
|
|
6507
|
+
debounce("xhrQueue", () => {
|
|
6508
|
+
const requestHandler = this.enrichRunnable(runnable);
|
|
6509
|
+
if (!this.taskRunning) {
|
|
6510
|
+
this.signalTaskRunning();
|
|
6511
|
+
requestHandler.start();
|
|
6512
|
+
}
|
|
6513
|
+
else {
|
|
6514
|
+
this.queue.push(requestHandler);
|
|
6515
|
+
}
|
|
6516
|
+
}, timeOut);
|
|
6517
|
+
}
|
|
6518
|
+
/**
|
|
6519
|
+
* trigger the next element in the queue
|
|
6520
|
+
* to be started!
|
|
6521
|
+
*/
|
|
6522
|
+
next() {
|
|
6523
|
+
this.updateTaskRunning();
|
|
6524
|
+
const next = this.queue.shift();
|
|
6525
|
+
next === null || next === void 0 ? void 0 : next.start();
|
|
6526
|
+
}
|
|
6527
|
+
/**
|
|
6528
|
+
* clears and resets the queue
|
|
6529
|
+
*/
|
|
6530
|
+
clear() {
|
|
6531
|
+
this.queue.length = 0;
|
|
6532
|
+
this.updateTaskRunning();
|
|
6533
|
+
}
|
|
6534
|
+
/**
|
|
6535
|
+
* true if queue is empty
|
|
6536
|
+
*/
|
|
6537
|
+
get isEmpty() {
|
|
6538
|
+
return !this.queue.length;
|
|
6539
|
+
}
|
|
6540
|
+
/**
|
|
6541
|
+
* Enriches the incoming async asyncRunnable
|
|
6542
|
+
* with the error and next handling
|
|
6543
|
+
* (aka: asyncRunnable is done -> next
|
|
6544
|
+
* error -> clear queue
|
|
6545
|
+
* @param asyncRunnable the async runnable which needs enrichment
|
|
6546
|
+
* @private
|
|
6547
|
+
*/
|
|
6548
|
+
enrichRunnable(asyncRunnable) {
|
|
6549
|
+
/**
|
|
6550
|
+
* we can use the Promise pattern asyncrunnable uses
|
|
6551
|
+
* to trigger queue control callbacks of next element
|
|
6552
|
+
* and clear the queue (theoretically this
|
|
6553
|
+
* would work with any promise)
|
|
6554
|
+
*/
|
|
6555
|
+
try {
|
|
6556
|
+
return asyncRunnable
|
|
6557
|
+
.then(() => this.next())
|
|
6558
|
+
.catch((e) => this.handleError(e));
|
|
6559
|
+
}
|
|
6560
|
+
catch (e) {
|
|
6561
|
+
this.handleError(e);
|
|
6562
|
+
}
|
|
6563
|
+
}
|
|
6564
|
+
/**
|
|
6565
|
+
* alerts the queue that a task is running
|
|
6566
|
+
*
|
|
6567
|
+
* @private
|
|
6568
|
+
*/
|
|
6569
|
+
signalTaskRunning() {
|
|
6570
|
+
this.taskRunning = true;
|
|
6571
|
+
}
|
|
6572
|
+
/**
|
|
6573
|
+
* updates the task running status according to the current queue
|
|
6574
|
+
* @private
|
|
6575
|
+
*/
|
|
6576
|
+
updateTaskRunning() {
|
|
6577
|
+
this.taskRunning = !this.isEmpty;
|
|
6578
|
+
}
|
|
6579
|
+
/**
|
|
6580
|
+
* standard error handling
|
|
6581
|
+
* we clear the queue and then bomb out
|
|
6582
|
+
* @param e
|
|
6583
|
+
* @private
|
|
6584
|
+
*/
|
|
6585
|
+
handleError(e) {
|
|
6586
|
+
this.clear();
|
|
6587
|
+
throw e;
|
|
6588
|
+
}
|
|
6589
|
+
}
|
|
6590
|
+
exports.XhrQueueController = XhrQueueController;
|
|
6591
|
+
|
|
6592
|
+
|
|
6197
6593
|
/***/ }),
|
|
6198
6594
|
|
|
6199
6595
|
/***/ "./src/main/typescript/impl/xhrCore/ErrorData.ts":
|
|
@@ -6321,8 +6717,8 @@ class EventData {
|
|
|
6321
6717
|
eventData.type = Const_1.EVENT;
|
|
6322
6718
|
eventData.status = name;
|
|
6323
6719
|
let sourceId = context.getIf(Const_1.SOURCE)
|
|
6324
|
-
.orElseLazy(() => context.getIf(Const_1.
|
|
6325
|
-
.orElseLazy(() => context.getIf(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.
|
|
6720
|
+
.orElseLazy(() => context.getIf(Const_1.P_AJAX_SOURCE).value)
|
|
6721
|
+
.orElseLazy(() => context.getIf(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_AJAX_SOURCE).value)
|
|
6326
6722
|
.value;
|
|
6327
6723
|
if (sourceId) {
|
|
6328
6724
|
eventData.source = mona_dish_1.DQ.byId(sourceId, true).first().value.value;
|
|
@@ -6879,6 +7275,8 @@ const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/
|
|
|
6879
7275
|
const ExtDomQuery_1 = __webpack_require__(/*! ../util/ExtDomQuery */ "./src/main/typescript/impl/util/ExtDomQuery.ts");
|
|
6880
7276
|
const HiddenInputBuilder_1 = __webpack_require__(/*! ../util/HiddenInputBuilder */ "./src/main/typescript/impl/util/HiddenInputBuilder.ts");
|
|
6881
7277
|
var trim = mona_dish_1.Lang.trim;
|
|
7278
|
+
const Lang_1 = __webpack_require__(/*! ../util/Lang */ "./src/main/typescript/impl/util/Lang.ts");
|
|
7279
|
+
var ofAssoc = Lang_1.ExtLang.ofAssoc;
|
|
6882
7280
|
/**
|
|
6883
7281
|
* Response processor
|
|
6884
7282
|
*
|
|
@@ -6976,7 +7374,7 @@ class ResponseProcessor {
|
|
|
6976
7374
|
* <error>
|
|
6977
7375
|
*/
|
|
6978
7376
|
const mergedErrorData = new ExtDomQuery_1.ExtConfig({});
|
|
6979
|
-
mergedErrorData.assign(Const_1.SOURCE).value = this.externalContext.getIf(Const_1.
|
|
7377
|
+
mergedErrorData.assign(Const_1.SOURCE).value = this.externalContext.getIf(Const_1.P_AJAX_SOURCE).get(0).value;
|
|
6980
7378
|
mergedErrorData.assign(Const_1.ERROR_NAME).value = node.querySelectorAll(Const_1.ERROR_NAME).textContent(Const_1.EMPTY_STR);
|
|
6981
7379
|
mergedErrorData.assign(Const_1.ERROR_MESSAGE).value = node.querySelectorAll(Const_1.ERROR_MESSAGE).cDATAAsString;
|
|
6982
7380
|
const hasResponseXML = this.internalContext.get(Const_1.RESPONSE_XML).isPresent();
|
|
@@ -7124,8 +7522,8 @@ class ResponseProcessor {
|
|
|
7124
7522
|
* as last lifecycle step, before going into the next request.
|
|
7125
7523
|
*/
|
|
7126
7524
|
fixViewStates() {
|
|
7127
|
-
|
|
7128
|
-
.
|
|
7525
|
+
ofAssoc(this.internalContext.getIf(Const_1.APPLIED_VST).orElse({}).value)
|
|
7526
|
+
.forEach(([, value]) => {
|
|
7129
7527
|
const namingContainerId = this.internalContext.getIf(Const_1.NAMING_CONTAINER_ID);
|
|
7130
7528
|
const namedViewRoot = !!this.internalContext.getIf(Const_1.NAMED_VIEWROOT).value;
|
|
7131
7529
|
const affectedForms = this.getContainerForms(namingContainerId)
|
|
@@ -7138,8 +7536,8 @@ class ResponseProcessor {
|
|
|
7138
7536
|
* is done.
|
|
7139
7537
|
*/
|
|
7140
7538
|
fixClientWindow() {
|
|
7141
|
-
|
|
7142
|
-
.
|
|
7539
|
+
ofAssoc(this.internalContext.getIf(Const_1.APPLIED_CLIENT_WINDOW).orElse({}).value)
|
|
7540
|
+
.forEach(([, value]) => {
|
|
7143
7541
|
const namingContainerId = this.internalContext.getIf(Const_1.NAMING_CONTAINER_ID);
|
|
7144
7542
|
const namedViewRoot = !!this.internalContext.getIf(Const_1.NAMED_VIEWROOT).value;
|
|
7145
7543
|
const affectedForms = this.getContainerForms(namingContainerId)
|
|
@@ -7282,7 +7680,7 @@ class ResponseProcessor {
|
|
|
7282
7680
|
.orElseLazy(() => this.externalContext.getIf((0, Const_1.$nsp)(Const_1.P_RENDER)).value)
|
|
7283
7681
|
.orElse(Const_1.IDENT_NONE).value.split(/\s+/gi);
|
|
7284
7682
|
const executeAndRenders = executes.concat(...renders);
|
|
7285
|
-
return
|
|
7683
|
+
return [...executeAndRenders].filter(nameOrId => {
|
|
7286
7684
|
if ([Const_1.IDENT_ALL, Const_1.IDENT_NONE].indexOf(nameOrId) != -1) {
|
|
7287
7685
|
return true;
|
|
7288
7686
|
}
|
|
@@ -7291,7 +7689,7 @@ class ResponseProcessor {
|
|
|
7291
7689
|
return affectedForm.matchesSelector(NAME_OR_ID) ||
|
|
7292
7690
|
affectedForm.querySelectorAll(NAME_OR_ID).isPresent() ||
|
|
7293
7691
|
affectedForm.firstParent(NAME_OR_ID).isPresent();
|
|
7294
|
-
}).
|
|
7692
|
+
}).length > 0;
|
|
7295
7693
|
}
|
|
7296
7694
|
/**
|
|
7297
7695
|
* gets all forms under a single naming container id
|
|
@@ -7347,6 +7745,8 @@ exports.XhrFormData = void 0;
|
|
|
7347
7745
|
const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
7348
7746
|
const Const_1 = __webpack_require__(/*! ../core/Const */ "./src/main/typescript/impl/core/Const.ts");
|
|
7349
7747
|
const FileUtils_1 = __webpack_require__(/*! ../util/FileUtils */ "./src/main/typescript/impl/util/FileUtils.ts");
|
|
7748
|
+
const Lang_1 = __webpack_require__(/*! ../util/Lang */ "./src/main/typescript/impl/util/Lang.ts");
|
|
7749
|
+
var ofAssoc = Lang_1.ExtLang.ofAssoc;
|
|
7350
7750
|
const defaultParamsMapper = (key, item) => [key, item];
|
|
7351
7751
|
/**
|
|
7352
7752
|
* A unified form data class
|
|
@@ -7399,12 +7799,17 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7399
7799
|
*/
|
|
7400
7800
|
toFormData() {
|
|
7401
7801
|
/*
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
let
|
|
7406
|
-
|
|
7407
|
-
|
|
7802
|
+
* expands key: [item1, item2]
|
|
7803
|
+
* to: [{key: key, value: item1}, {key: key, value: item2}]
|
|
7804
|
+
*/
|
|
7805
|
+
let expandValueArrays = ([key, item]) => {
|
|
7806
|
+
if (Array.isArray(item)) {
|
|
7807
|
+
return item.map(value => {
|
|
7808
|
+
return { key, value };
|
|
7809
|
+
});
|
|
7810
|
+
}
|
|
7811
|
+
return [{ key, value: item }];
|
|
7812
|
+
};
|
|
7408
7813
|
/*
|
|
7409
7814
|
* remaps the incoming {key, value} tuples
|
|
7410
7815
|
* to naming container prefixed keys and values
|
|
@@ -7416,10 +7821,13 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7416
7821
|
/*
|
|
7417
7822
|
* collects everything into a FormData object
|
|
7418
7823
|
*/
|
|
7419
|
-
return
|
|
7420
|
-
.flatMap(
|
|
7824
|
+
return ofAssoc(this.value)
|
|
7825
|
+
.flatMap(expandValueArrays)
|
|
7421
7826
|
.map(remapForNamingContainer)
|
|
7422
|
-
.
|
|
7827
|
+
.reduce((formData, { key, value }) => {
|
|
7828
|
+
formData.append(key, value);
|
|
7829
|
+
return formData;
|
|
7830
|
+
}, new FormData());
|
|
7423
7831
|
}
|
|
7424
7832
|
/**
|
|
7425
7833
|
* returns an encoded string representation of our xhr form data
|
|
@@ -7431,6 +7839,7 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7431
7839
|
}
|
|
7432
7840
|
/**
|
|
7433
7841
|
* generic post init code, for now, this performs some post assign data post-processing
|
|
7842
|
+
* @param rootElement the root element which knows the request type (usually a form)
|
|
7434
7843
|
* @param executes the executable dom nodes which need to be processed into the form data, which we can send
|
|
7435
7844
|
* in our ajax request
|
|
7436
7845
|
*/
|
|
@@ -7455,18 +7864,21 @@ class XhrFormData extends mona_dish_1.Config {
|
|
|
7455
7864
|
}
|
|
7456
7865
|
/**
|
|
7457
7866
|
* determines fields to submit
|
|
7458
|
-
* @param {Object} targetBuf - the target form buffer receiving the data
|
|
7459
7867
|
* @param {Node} parentItem - form element item is nested in
|
|
7460
7868
|
* @param {Array} partialIds - ids fo PPS
|
|
7461
7869
|
*/
|
|
7462
|
-
encodeSubmittableFields(parentItem, partialIds) {
|
|
7463
|
-
const formInputs = (0, FileUtils_1.getFormInputsAsStream)(parentItem);
|
|
7870
|
+
encodeSubmittableFields(parentItem, partialIds = []) {
|
|
7464
7871
|
const mergeIntoThis = ([key, value]) => this.append(key).value = value;
|
|
7465
7872
|
const namingContainerRemap = ([key, value]) => this.paramsMapper(key, value);
|
|
7466
|
-
|
|
7467
|
-
|
|
7873
|
+
const remappedPartialIds = partialIds.map(partialId => this.remapKeyForNamingContainer(partialId));
|
|
7874
|
+
const partialIdsFilter = ([key, value]) => (!remappedPartialIds.length || key.indexOf("@") == 0) ? true :
|
|
7875
|
+
remappedPartialIds.indexOf(key) != -1;
|
|
7876
|
+
let inputs = (0, FileUtils_1.getFormInputsAsArr)(parentItem);
|
|
7877
|
+
inputs
|
|
7878
|
+
.map(FileUtils_1.fixEmptyParameters)
|
|
7468
7879
|
.map(namingContainerRemap)
|
|
7469
|
-
.
|
|
7880
|
+
.filter(partialIdsFilter)
|
|
7881
|
+
.forEach(mergeIntoThis);
|
|
7470
7882
|
}
|
|
7471
7883
|
remapKeyForNamingContainer(key) {
|
|
7472
7884
|
return this.paramsMapper(key, "")[0];
|
|
@@ -7501,6 +7913,7 @@ exports.XhrFormData = XhrFormData;
|
|
|
7501
7913
|
*/
|
|
7502
7914
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7503
7915
|
exports.XhrRequest = void 0;
|
|
7916
|
+
const AsyncRunnable_1 = __webpack_require__(/*! ../util/AsyncRunnable */ "./src/main/typescript/impl/util/AsyncRunnable.ts");
|
|
7504
7917
|
const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
7505
7918
|
const AjaxImpl_1 = __webpack_require__(/*! ../AjaxImpl */ "./src/main/typescript/impl/AjaxImpl.ts");
|
|
7506
7919
|
const XhrFormData_1 = __webpack_require__(/*! ./XhrFormData */ "./src/main/typescript/impl/xhrCore/XhrFormData.ts");
|
|
@@ -7513,6 +7926,10 @@ var failSaveExecute = Lang_1.ExtLang.failSaveExecute;
|
|
|
7513
7926
|
/**
|
|
7514
7927
|
* Faces XHR Request Wrapper
|
|
7515
7928
|
* as AsyncRunnable for our Asynchronous queue
|
|
7929
|
+
* This means from the outside the
|
|
7930
|
+
* xhr request is similar to a Promise in a way
|
|
7931
|
+
* that you can add then and catch and finally callbacks.
|
|
7932
|
+
*
|
|
7516
7933
|
*
|
|
7517
7934
|
* The idea is that we basically just enqueue
|
|
7518
7935
|
* a single ajax request into our queue
|
|
@@ -7520,51 +7937,35 @@ var failSaveExecute = Lang_1.ExtLang.failSaveExecute;
|
|
|
7520
7937
|
*
|
|
7521
7938
|
*
|
|
7522
7939
|
*/
|
|
7523
|
-
class XhrRequest {
|
|
7940
|
+
class XhrRequest extends AsyncRunnable_1.AsyncRunnable {
|
|
7524
7941
|
/**
|
|
7525
7942
|
* Required Parameters
|
|
7526
7943
|
*
|
|
7527
|
-
* @param source the issuing element
|
|
7528
|
-
* @param sourceForm the form which is related to the issuing element
|
|
7529
7944
|
* @param requestContext the request context with all pass through values
|
|
7530
|
-
*
|
|
7531
|
-
* Optional Parameters
|
|
7532
|
-
*
|
|
7533
7945
|
* @param internalContext internal context with internal info which is passed through, not used by the user
|
|
7534
|
-
*
|
|
7946
|
+
* Optional Parameters
|
|
7535
7947
|
* @param timeout optional xhr timeout
|
|
7536
7948
|
* @param ajaxType optional request type, default "POST"
|
|
7537
7949
|
* @param contentType optional content type, default "application/x-www-form-urlencoded"
|
|
7538
|
-
* @param xhrObject optional xhr object which must fulfill the XMLHTTPRequest api, default XMLHttpRequest
|
|
7539
7950
|
*/
|
|
7540
|
-
constructor(
|
|
7541
|
-
|
|
7542
|
-
this.sourceForm = sourceForm;
|
|
7951
|
+
constructor(requestContext, internalContext, timeout = Const_1.NO_TIMEOUT, ajaxType = Const_1.REQ_TYPE_POST, contentType = Const_1.URL_ENCODED) {
|
|
7952
|
+
super();
|
|
7543
7953
|
this.requestContext = requestContext;
|
|
7544
7954
|
this.internalContext = internalContext;
|
|
7545
|
-
this.partialIdsArray = partialIdsArray;
|
|
7546
7955
|
this.timeout = timeout;
|
|
7547
7956
|
this.ajaxType = ajaxType;
|
|
7548
7957
|
this.contentType = contentType;
|
|
7549
|
-
this.xhrObject = xhrObject;
|
|
7550
7958
|
this.stopProgress = false;
|
|
7551
|
-
|
|
7552
|
-
* helper support so that we do not have to drag in Promise shims
|
|
7553
|
-
*/
|
|
7554
|
-
this.catchFunctions = [];
|
|
7555
|
-
this.thenFunctions = [];
|
|
7959
|
+
this.xhrObject = new XMLHttpRequest();
|
|
7556
7960
|
// we omit promises here because we have to deal with cancel functionality,
|
|
7557
7961
|
// and promises to not provide that (yet) instead we have our async queue
|
|
7558
7962
|
// which uses an api internally, which is very close to promises
|
|
7559
|
-
this.registerXhrCallbacks((data) =>
|
|
7560
|
-
this.resolve(data);
|
|
7561
|
-
}, (data) => {
|
|
7562
|
-
this.reject(data);
|
|
7563
|
-
});
|
|
7963
|
+
this.registerXhrCallbacks((data) => this.resolve(data), (data) => this.reject(data));
|
|
7564
7964
|
}
|
|
7565
7965
|
start() {
|
|
7566
7966
|
let ignoreErr = failSaveExecute;
|
|
7567
7967
|
let xhrObject = this.xhrObject;
|
|
7968
|
+
let sourceForm = mona_dish_1.DQ.byId(this.internalContext.getIf(Const_1.CTX_PARAM_SRC_FRM_ID).value);
|
|
7568
7969
|
let executesArr = () => {
|
|
7569
7970
|
return this.requestContext.getIf(Const_1.CTX_PARAM_REQ_PASS_THR, Const_1.P_EXECUTE).get(Const_1.IDENT_NONE).value.split(/\s+/gi);
|
|
7570
7971
|
};
|
|
@@ -7577,13 +7978,14 @@ class XhrRequest {
|
|
|
7577
7978
|
// whatever the formData object delivers
|
|
7578
7979
|
// the partialIdsArray arr is almost deprecated legacy code where we allowed to send a separate list of partial
|
|
7579
7980
|
// ids for reduced load and server processing, this will be removed soon, we can handle the same via execute
|
|
7580
|
-
|
|
7581
|
-
|
|
7981
|
+
const executes = executesArr();
|
|
7982
|
+
const partialIdsArray = this.internalContext.getIf(Const_1.CTX_PARAM_PPS).value === true ? executes : [];
|
|
7983
|
+
const formData = new XhrFormData_1.XhrFormData(sourceForm, (0, RequestDataResolver_1.resoveNamingContainerMapper)(this.internalContext), executes, partialIdsArray);
|
|
7582
7984
|
this.contentType = formData.isMultipartRequest ? "undefined" : this.contentType;
|
|
7583
7985
|
// next step the pass through parameters are merged in for post params
|
|
7584
7986
|
this.requestContext.$nspEnabled = false;
|
|
7585
|
-
|
|
7586
|
-
|
|
7987
|
+
const requestContext = this.requestContext;
|
|
7988
|
+
const requestPassThroughParams = requestContext.getIf(Const_1.CTX_PARAM_REQ_PASS_THR);
|
|
7587
7989
|
// we are turning off here the jsf, faces remapping because we are now dealing with
|
|
7588
7990
|
// pass-through parameters
|
|
7589
7991
|
requestPassThroughParams.$nspEnabled = false;
|
|
@@ -7594,17 +7996,20 @@ class XhrRequest {
|
|
|
7594
7996
|
formData.shallowMerge(requestPassThroughParams, true, true);
|
|
7595
7997
|
}
|
|
7596
7998
|
finally {
|
|
7999
|
+
// unfortunately as long as we support
|
|
8000
|
+
// both namespaces we have to keep manual control
|
|
8001
|
+
// on the key renaming before doing ops like deep copy
|
|
7597
8002
|
this.requestContext.$nspEnabled = true;
|
|
7598
8003
|
requestPassThroughParams.$nspEnabled = true;
|
|
7599
8004
|
}
|
|
7600
8005
|
this.responseContext = requestPassThroughParams.deepCopy;
|
|
7601
8006
|
// we have to shift the internal passthroughs around to build up our response context
|
|
7602
|
-
|
|
8007
|
+
const responseContext = this.responseContext;
|
|
7603
8008
|
responseContext.assign(Const_1.CTX_PARAM_MF_INTERNAL).value = this.internalContext.value;
|
|
7604
|
-
// per spec the
|
|
8009
|
+
// per spec the onEvent and onError handlers must be passed through to the response
|
|
7605
8010
|
responseContext.assign(Const_1.ON_EVENT).value = requestContext.getIf(Const_1.ON_EVENT).value;
|
|
7606
8011
|
responseContext.assign(Const_1.ON_ERROR).value = requestContext.getIf(Const_1.ON_ERROR).value;
|
|
7607
|
-
xhrObject.open(this.ajaxType, (0, RequestDataResolver_1.resolveFinalUrl)(
|
|
8012
|
+
xhrObject.open(this.ajaxType, (0, RequestDataResolver_1.resolveFinalUrl)(sourceForm, formData, this.ajaxType), true);
|
|
7608
8013
|
// adding timeout
|
|
7609
8014
|
this.timeout ? xhrObject.timeout = this.timeout : null;
|
|
7610
8015
|
// a bug in the xhr stub library prevents the setRequestHeader to be properly executed on fake xhr objects
|
|
@@ -7629,36 +8034,14 @@ class XhrRequest {
|
|
|
7629
8034
|
}
|
|
7630
8035
|
cancel() {
|
|
7631
8036
|
try {
|
|
8037
|
+
// this causes onError to be called where the error
|
|
8038
|
+
// handling takes over
|
|
7632
8039
|
this.xhrObject.abort();
|
|
7633
8040
|
}
|
|
7634
8041
|
catch (e) {
|
|
7635
8042
|
this.handleError(e);
|
|
7636
8043
|
}
|
|
7637
8044
|
}
|
|
7638
|
-
resolve(data) {
|
|
7639
|
-
mona_dish_1.Stream.of(...this.thenFunctions).reduce((inputVal, thenFunc) => {
|
|
7640
|
-
return thenFunc(inputVal);
|
|
7641
|
-
}, data);
|
|
7642
|
-
}
|
|
7643
|
-
reject(data) {
|
|
7644
|
-
mona_dish_1.Stream.of(...this.catchFunctions).reduce((inputVal, catchFunc) => {
|
|
7645
|
-
return catchFunc(inputVal);
|
|
7646
|
-
}, data);
|
|
7647
|
-
}
|
|
7648
|
-
catch(func) {
|
|
7649
|
-
this.catchFunctions.push(func);
|
|
7650
|
-
return this;
|
|
7651
|
-
}
|
|
7652
|
-
finally(func) {
|
|
7653
|
-
// no ie11 support we probably are going to revert to shims for that one
|
|
7654
|
-
this.catchFunctions.push(func);
|
|
7655
|
-
this.thenFunctions.push(func);
|
|
7656
|
-
return this;
|
|
7657
|
-
}
|
|
7658
|
-
then(func) {
|
|
7659
|
-
this.thenFunctions.push(func);
|
|
7660
|
-
return this;
|
|
7661
|
-
}
|
|
7662
8045
|
/**
|
|
7663
8046
|
* attaches the internal event and processing
|
|
7664
8047
|
* callback within the promise to our xhr object
|
|
@@ -7667,7 +8050,7 @@ class XhrRequest {
|
|
|
7667
8050
|
* @param reject
|
|
7668
8051
|
*/
|
|
7669
8052
|
registerXhrCallbacks(resolve, reject) {
|
|
7670
|
-
|
|
8053
|
+
const xhrObject = this.xhrObject;
|
|
7671
8054
|
xhrObject.onabort = () => {
|
|
7672
8055
|
this.onAbort(reject);
|
|
7673
8056
|
};
|
|
@@ -7681,13 +8064,17 @@ class XhrRequest {
|
|
|
7681
8064
|
this.onDone(this.xhrObject, resolve);
|
|
7682
8065
|
};
|
|
7683
8066
|
xhrObject.onerror = (errorData) => {
|
|
7684
|
-
// some browsers trigger an error when cancelling a request internally
|
|
8067
|
+
// some browsers trigger an error when cancelling a request internally, or when
|
|
8068
|
+
// cancel is called from outside
|
|
7685
8069
|
// in this case we simply ignore the request and clear up the queue, because
|
|
7686
8070
|
// it is not safe anymore to proceed with the current queue
|
|
7687
8071
|
// This bypasses a Safari issue where it keeps requests hanging after page unload
|
|
7688
8072
|
// and then triggers a cancel error on then instead of just stopping
|
|
7689
8073
|
// and clearing the code
|
|
7690
8074
|
if (this.isCancelledResponse(this.xhrObject)) {
|
|
8075
|
+
/*
|
|
8076
|
+
* this triggers the catch chain and after that finally
|
|
8077
|
+
*/
|
|
7691
8078
|
reject();
|
|
7692
8079
|
this.stopProgress = true;
|
|
7693
8080
|
return;
|
|
@@ -7728,14 +8115,12 @@ class XhrRequest {
|
|
|
7728
8115
|
handleMalFormedXML(resolve) {
|
|
7729
8116
|
var _a;
|
|
7730
8117
|
this.stopProgress = true;
|
|
7731
|
-
|
|
8118
|
+
const errorData = {
|
|
7732
8119
|
type: Const_1.ERROR,
|
|
7733
8120
|
status: Const_1.MALFORMEDXML,
|
|
7734
8121
|
responseCode: 200,
|
|
7735
8122
|
responseText: (_a = this.xhrObject) === null || _a === void 0 ? void 0 : _a.responseText,
|
|
7736
|
-
|
|
7737
|
-
// it will be unremapped
|
|
7738
|
-
source: this.source.id.value
|
|
8123
|
+
source: this.internalContext.getIf(Const_1.CTX_PARAM_SRC_CTL_ID).value
|
|
7739
8124
|
};
|
|
7740
8125
|
try {
|
|
7741
8126
|
this.handleError(errorData, true);
|
|
@@ -7752,14 +8137,20 @@ class XhrRequest {
|
|
|
7752
8137
|
if (this.stopProgress) {
|
|
7753
8138
|
return;
|
|
7754
8139
|
}
|
|
8140
|
+
/**
|
|
8141
|
+
* now call the then chain
|
|
8142
|
+
*/
|
|
7755
8143
|
resolve(data);
|
|
7756
8144
|
}
|
|
7757
8145
|
onError(errorData, reject) {
|
|
7758
8146
|
this.handleError(errorData);
|
|
8147
|
+
/*
|
|
8148
|
+
* this triggers the catch chain and after that finally
|
|
8149
|
+
*/
|
|
7759
8150
|
reject();
|
|
7760
8151
|
}
|
|
7761
8152
|
sendRequest(formData) {
|
|
7762
|
-
|
|
8153
|
+
const isPost = this.ajaxType != Const_1.REQ_TYPE_GET;
|
|
7763
8154
|
if (formData.isMultipartRequest) {
|
|
7764
8155
|
// in case of a multipart request we send in a formData object as body
|
|
7765
8156
|
this.xhrObject.send((isPost) ? formData.toFormData() : null);
|
|
@@ -7774,7 +8165,7 @@ class XhrRequest {
|
|
|
7774
8165
|
*/
|
|
7775
8166
|
sendEvent(evtType) {
|
|
7776
8167
|
var _a;
|
|
7777
|
-
|
|
8168
|
+
const eventData = EventData_1.EventData.createFromRequest(this.xhrObject, this.requestContext, evtType);
|
|
7778
8169
|
try {
|
|
7779
8170
|
// User code error, we might cover
|
|
7780
8171
|
// this in onError, but also we cannot swallow it.
|
|
@@ -7790,8 +8181,8 @@ class XhrRequest {
|
|
|
7790
8181
|
}
|
|
7791
8182
|
}
|
|
7792
8183
|
handleError(exception, responseFormatError = false) {
|
|
7793
|
-
|
|
7794
|
-
|
|
8184
|
+
const errorData = (responseFormatError) ? ErrorData_1.ErrorData.fromHttpConnection(exception.source, exception.type, exception.status, exception.responseText, exception.responseCode, exception.status) : ErrorData_1.ErrorData.fromClient(exception);
|
|
8185
|
+
const eventHandler = (0, RequestDataResolver_1.resolveHandlerFunc)(this.requestContext, this.responseContext, Const_1.ON_ERROR);
|
|
7795
8186
|
AjaxImpl_1.Implementation.sendError(errorData, eventHandler);
|
|
7796
8187
|
}
|
|
7797
8188
|
}
|
|
@@ -7825,6 +8216,7 @@ exports.XhrRequest = XhrRequest;
|
|
|
7825
8216
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7826
8217
|
exports.oam = void 0;
|
|
7827
8218
|
const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-dish/src/main/typescript/index_core.ts");
|
|
8219
|
+
const Lang_1 = __webpack_require__(/*! ../impl/util/Lang */ "./src/main/typescript/impl/util/Lang.ts");
|
|
7828
8220
|
/**
|
|
7829
8221
|
* legacy code to enable various aspects
|
|
7830
8222
|
* of myfaces, used to be rendered inline
|
|
@@ -7838,6 +8230,7 @@ const mona_dish_1 = __webpack_require__(/*! mona-dish */ "./node_modules/mona-di
|
|
|
7838
8230
|
*/
|
|
7839
8231
|
var oam;
|
|
7840
8232
|
(function (oam) {
|
|
8233
|
+
var ofAssoc = Lang_1.ExtLang.ofAssoc;
|
|
7841
8234
|
/**
|
|
7842
8235
|
* sets a hidden input field
|
|
7843
8236
|
* @param formName the formName
|
|
@@ -7893,8 +8286,8 @@ var oam;
|
|
|
7893
8286
|
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)) {
|
|
7894
8287
|
myfaces.oam.setHiddenInput(formName, 'autoScroll', window === null || window === void 0 ? void 0 : window.getScrolling());
|
|
7895
8288
|
}
|
|
7896
|
-
let paramsStream = Array.isArray(params) ?
|
|
7897
|
-
paramsStream.
|
|
8289
|
+
let paramsStream = Array.isArray(params) ? [...params] : ofAssoc(params);
|
|
8290
|
+
paramsStream.forEach(([key, data]) => myfaces.oam.setHiddenInput(formName, key, data));
|
|
7898
8291
|
//we call the namespaced function, to allow decoration, via a direct call we would
|
|
7899
8292
|
myfaces.oam.setHiddenInput(formName, `${formName}:_idcl`, linkId !== null && linkId !== void 0 ? linkId : '');
|
|
7900
8293
|
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 => {
|
|
@@ -7922,7 +8315,7 @@ var oam;
|
|
|
7922
8315
|
form.getAsElem(0).value.setAttribute("target", oldTarget);
|
|
7923
8316
|
}
|
|
7924
8317
|
// noinspection JSUnusedLocalSymbols
|
|
7925
|
-
paramsStream.
|
|
8318
|
+
paramsStream.forEach(([key, data]) => {
|
|
7926
8319
|
myfaces.oam.clearHiddenInput(formName, key);
|
|
7927
8320
|
});
|
|
7928
8321
|
myfaces.oam.clearHiddenInput(formName, `${formName}:_idcl`);
|