jsf.js_next_gen 4.0.2-beta.4 → 4.0.2-beta.6
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/dist/window/faces-development.js +101 -23
- package/dist/window/faces-development.js.map +1 -1
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +101 -23
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.map +1 -1
- package/package.json +2 -2
- package/src/main/typescript/impl/util/FileUtils.ts +3 -2
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +184 -1
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +126 -4
- package/target/classes/application.properties +1 -0
- package/target/classes/com/example/jsfs_js_ts/DecoratedFacesJS.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMappingDecorator.class +0 -0
- package/target/impl/util/FileUtils.js +3 -2
- package/target/impl/util/FileUtils.js.map +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +176 -0
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +112 -3
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test-classes/.gz +0 -0
- package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
- package/target/test-classes/fileuploadtest.html +24 -0
- package/target/test-classes/jsf-development.js +3559 -0
- package/target/test-classes/jsf-development.js.br +0 -0
- package/target/test-classes/jsf-development.js.gz +0 -0
- package/target/test-classes/jsf-development.js.map +1 -0
- package/target/test-classes/jsf.js +3 -0
- package/target/test-classes/jsf.js.br +0 -0
- package/target/test-classes/jsf.js.gz +0 -0
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* limitations under the License.
|
|
27
27
|
*/
|
|
28
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;
|
|
29
|
+
exports.deepEqual = exports.shallowMerge = exports.simpleShallowMerge = exports.deepCopy = exports.buildPath = exports.resolve = exports.appendIf = exports.assignIf = exports.append = exports.assign = void 0;
|
|
30
30
|
const Es2019Array_1 = __webpack_require__(/*! ./Es2019Array */ "./node_modules/mona-dish/src/main/typescript/Es2019Array.ts");
|
|
31
31
|
/**
|
|
32
32
|
* A nop as assign functionality (aka ignore assign)
|
|
@@ -247,12 +247,71 @@ function simpleShallowMerge(...assocArrays) {
|
|
|
247
247
|
return shallowMerge(true, false, ...assocArrays);
|
|
248
248
|
}
|
|
249
249
|
exports.simpleShallowMerge = simpleShallowMerge;
|
|
250
|
+
function _appendWithOverwrite(withAppend, target, key, arr, toAssign) {
|
|
251
|
+
if (!withAppend) {
|
|
252
|
+
target[key] = arr[key];
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
//overwrite means in this case, no double entries!
|
|
256
|
+
//we do not a deep compare for now a single value compare suffices
|
|
257
|
+
if ('undefined' == typeof (target === null || target === void 0 ? void 0 : target[key])) {
|
|
258
|
+
target[key] = toAssign;
|
|
259
|
+
}
|
|
260
|
+
else if (!Array.isArray(target[key])) {
|
|
261
|
+
let oldVal = target[key];
|
|
262
|
+
let newVals = [];
|
|
263
|
+
//TODO maybe deep deep compare here, but on the other hand it is
|
|
264
|
+
//shallow
|
|
265
|
+
toAssign.forEach(item => {
|
|
266
|
+
if (oldVal != item) {
|
|
267
|
+
newVals.push(item);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
target[key] = new Es2019Array_1.Es2019Array(...[]);
|
|
271
|
+
target[key].push(oldVal);
|
|
272
|
+
target[key].push(...newVals);
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
let oldVal = target[key];
|
|
276
|
+
let newVals = [];
|
|
277
|
+
//TODO deep compare here
|
|
278
|
+
toAssign.forEach(item => {
|
|
279
|
+
if (oldVal.indexOf(item) == -1) {
|
|
280
|
+
newVals.push(item);
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
target[key].push(...newVals);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function _appendWithoutOverwrite(withAppend, target, key, arr, toAssign) {
|
|
288
|
+
if (!withAppend) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
//overwrite means in this case, no double entries!
|
|
293
|
+
//we do not a deep compare for now a single value compare suffices
|
|
294
|
+
if ('undefined' == typeof (target === null || target === void 0 ? void 0 : target[key])) {
|
|
295
|
+
target[key] = toAssign;
|
|
296
|
+
}
|
|
297
|
+
else if (!Array.isArray(target[key])) {
|
|
298
|
+
let oldVal = target[key];
|
|
299
|
+
target[key] = new Es2019Array_1.Es2019Array(...[]);
|
|
300
|
+
target[key].push(oldVal);
|
|
301
|
+
target[key].push(...toAssign);
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
target[key].push(...toAssign);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
250
308
|
/**
|
|
251
309
|
* Shallow merge as in config, but on raw associative arrays
|
|
252
310
|
*
|
|
253
|
-
* @param overwrite
|
|
254
|
-
* @param withAppend
|
|
255
|
-
*
|
|
311
|
+
* @param overwrite overwrite existing keys, if they exist with their subtrees
|
|
312
|
+
* @param withAppend if a key exist append the values or drop them
|
|
313
|
+
* Combination overwrite withappend filters doubles out of merged arrays
|
|
314
|
+
* @param assocArrays array of assoc arres reduced right to left
|
|
256
315
|
*/
|
|
257
316
|
function shallowMerge(overwrite = true, withAppend = false, ...assocArrays) {
|
|
258
317
|
let target = {};
|
|
@@ -265,29 +324,47 @@ function shallowMerge(overwrite = true, withAppend = false, ...assocArrays) {
|
|
|
265
324
|
toAssign = new Es2019Array_1.Es2019Array(...[toAssign]);
|
|
266
325
|
}
|
|
267
326
|
if (overwrite || !(target === null || target === void 0 ? void 0 : target[key])) {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
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
|
-
}
|
|
327
|
+
_appendWithOverwrite(withAppend, target, key, arr, toAssign);
|
|
328
|
+
}
|
|
329
|
+
else if (!overwrite && (target === null || target === void 0 ? void 0 : target[key])) {
|
|
330
|
+
_appendWithoutOverwrite(withAppend, target, key, arr, toAssign);
|
|
285
331
|
}
|
|
286
332
|
});
|
|
287
333
|
});
|
|
288
334
|
return target;
|
|
289
335
|
}
|
|
290
336
|
exports.shallowMerge = shallowMerge;
|
|
337
|
+
//TODO test this, slightly altered from https://medium.com/@pancemarko/deep-equality-in-javascript-determining-if-two-objects-are-equal-bf98cf47e934
|
|
338
|
+
//he overlooked some optimizations and a shortcut at typeof!
|
|
339
|
+
function deepEqual(obj1, obj2) {
|
|
340
|
+
if (obj1 == obj2) {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
if (typeof obj1 != typeof obj2) {
|
|
344
|
+
return false;
|
|
345
|
+
}
|
|
346
|
+
if (Array.isArray(obj1) && Array.isArray(obj2)) {
|
|
347
|
+
if (obj1.length != obj2.length) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
//arrays must be equal, order as well, there is no way around it
|
|
351
|
+
//this is the major limitation we have
|
|
352
|
+
return obj1.every((item, cnt) => deepEqual(item, obj2[cnt]));
|
|
353
|
+
}
|
|
354
|
+
//string number and other primitives are filtered out here
|
|
355
|
+
if ("object" == typeof obj1 && "object" == typeof obj2) {
|
|
356
|
+
let keys1 = Object.keys(obj1);
|
|
357
|
+
let keys2 = Object.keys(obj2);
|
|
358
|
+
if (keys1.length != keys2.length) {
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
return keys1.every(key => keys2.indexOf(key) != -1) &&
|
|
362
|
+
keys1.every(key => deepEqual(obj1[key], obj2[key]));
|
|
363
|
+
}
|
|
364
|
+
return false;
|
|
365
|
+
//done here no match found
|
|
366
|
+
}
|
|
367
|
+
exports.deepEqual = deepEqual;
|
|
291
368
|
|
|
292
369
|
|
|
293
370
|
/***/ }),
|
|
@@ -6099,14 +6176,15 @@ exports.encodeFormData = encodeFormData;
|
|
|
6099
6176
|
*/
|
|
6100
6177
|
function decodeEncodedValues(encoded) {
|
|
6101
6178
|
const filterBlanks = item => !!(item || '').replace(/\s+/g, '');
|
|
6102
|
-
const splitKeyValuePair =
|
|
6179
|
+
const splitKeyValuePair = _line => {
|
|
6180
|
+
let line = decodeURIComponent(_line);
|
|
6103
6181
|
let index = line.indexOf("=");
|
|
6104
6182
|
if (index == -1) {
|
|
6105
6183
|
return [line];
|
|
6106
6184
|
}
|
|
6107
6185
|
return [line.substring(0, index), line.substring(index + 1)];
|
|
6108
6186
|
};
|
|
6109
|
-
let requestParamEntries =
|
|
6187
|
+
let requestParamEntries = encoded.split(/&/gi);
|
|
6110
6188
|
return requestParamEntries.filter(filterBlanks).map(splitKeyValuePair);
|
|
6111
6189
|
}
|
|
6112
6190
|
exports.decodeEncodedValues = decodeEncodedValues;
|