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