jsf.js_next_gen 4.0.1-beta.5 → 4.0.1-beta.7
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/docs/assets/style.css +4 -5
- package/dist/window/faces-development.js +111 -91
- 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 +111 -91
- 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 +10 -10
- package/src/main/typescript/impl/util/XhrQueueController.ts +3 -17
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +94 -51
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +1 -1
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +126 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +60 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/css/bootstrap-icons.css +15 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/css/tobago.css +15 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/js/tobago.js +15 -0
- package/src/main/typescript/test/myfaces/{OnLoadSpec.ts → OnLoad.spec.ts} +2 -2
- package/src/main/typescript/test/xhrCore/ErrorChainTest.spec.ts +136 -0
- package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +9 -12
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +1 -1
- package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +18 -0
- package/target/AssocArray.js +281 -0
- package/target/AssocArray.js.map +1 -0
- package/target/Config.js +235 -0
- package/target/Config.js.map +1 -0
- package/target/CryptoExtensions.js +112 -0
- package/target/CryptoExtensions.js.map +1 -0
- package/target/DomQuery.js +1963 -0
- package/target/DomQuery.js.map +1 -0
- package/target/Es2019Array.js +117 -0
- package/target/Es2019Array.js.map +1 -0
- package/target/Global.js +38 -0
- package/target/Global.js.map +1 -0
- package/target/IDomQuery.js +3 -0
- package/target/IDomQuery.js.map +1 -0
- package/target/Lang.js +183 -0
- package/target/Lang.js.map +1 -0
- package/target/Messaging.js +645 -0
- package/target/Messaging.js.map +1 -0
- package/target/Monad.js +330 -0
- package/target/Monad.js.map +1 -0
- package/target/Promise.js +296 -0
- package/target/Promise.js.map +1 -0
- package/target/PromiseShim.js +30 -0
- package/target/PromiseShim.js.map +1 -0
- package/target/SourcesCollectors.js +444 -0
- package/target/SourcesCollectors.js.map +1 -0
- package/target/Stream.js +562 -0
- package/target/Stream.js.map +1 -0
- package/target/TagBuilder.js +178 -0
- package/target/TagBuilder.js.map +1 -0
- package/target/XmlQuery.js +84 -0
- package/target/XmlQuery.js.map +1 -0
- package/target/impl/util/XhrQueueController.js +3 -18
- package/target/impl/util/XhrQueueController.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +89 -45
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/index.js +80 -0
- package/target/index.js.map +1 -0
- package/target/index_core.js +76 -0
- package/target/index_core.js.map +1 -0
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +124 -0
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js +57 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
- package/target/test/myfaces/OnLoad.spec.js +57 -0
- package/target/test/myfaces/OnLoad.spec.js.map +1 -0
- package/target/test/myfaces/OnLoadSpec.js +2 -2
- package/target/test/myfaces/OnLoadSpec.js.map +1 -1
- package/target/test/xhrCore/ErrorChainTest.spec.js +156 -0
- package/target/test/xhrCore/ErrorChainTest.spec.js.map +1 -0
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +8 -5
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest23.spec.js +13 -0
- package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
- package/target/types/main/typescript/AssocArray.d.ts +86 -0
- package/target/types/main/typescript/Config.d.ts +94 -0
- package/target/types/main/typescript/CryptoExtensions.d.ts +87 -0
- package/target/types/main/typescript/DomQuery.d.ts +587 -0
- package/target/types/main/typescript/Es2019Array.d.ts +30 -0
- package/target/types/main/typescript/Global.d.ts +23 -0
- package/target/types/main/typescript/IDomQuery.d.ts +480 -0
- package/target/types/main/typescript/Lang.d.ts +97 -0
- package/target/types/main/typescript/Messaging.d.ts +285 -0
- package/target/types/main/typescript/Monad.d.ts +161 -0
- package/target/types/main/typescript/Promise.d.ts +58 -0
- package/target/types/main/typescript/PromiseShim.d.ts +22 -0
- package/target/types/main/typescript/SourcesCollectors.d.ts +280 -0
- package/target/types/main/typescript/Stream.d.ts +284 -0
- package/target/types/main/typescript/TagBuilder.d.ts +50 -0
- package/target/types/main/typescript/XmlQuery.d.ts +31 -0
- package/target/types/main/typescript/api/_api.d.ts +182 -0
- package/target/types/main/typescript/api/faces.d.ts +17 -0
- package/target/types/main/typescript/api/jsf.d.ts +17 -0
- package/target/types/main/typescript/impl/AjaxImpl.d.ts +164 -0
- package/target/types/main/typescript/impl/PushImpl.d.ts +38 -0
- package/target/types/main/typescript/impl/core/Const.d.ts +138 -0
- package/target/types/main/typescript/impl/core/ImplTypes.d.ts +16 -0
- package/target/types/main/typescript/impl/i18n/Messages.d.ts +102 -0
- package/target/types/main/typescript/impl/util/Assertions.d.ts +46 -0
- package/target/types/main/typescript/impl/util/AsyncRunnable.d.ts +112 -0
- package/target/types/main/typescript/impl/util/ExtDomQuery.d.ts +100 -0
- package/target/types/main/typescript/impl/util/FileUtils.d.ts +25 -0
- package/target/types/main/typescript/impl/util/HiddenInputBuilder.d.ts +37 -0
- package/target/types/main/typescript/impl/util/IListener.d.ts +18 -0
- package/target/types/main/typescript/impl/util/Lang.d.ts +138 -0
- package/target/types/main/typescript/impl/util/XhrQueueController.d.ts +51 -0
- package/target/types/main/typescript/impl/xhrCore/ErrorData.d.ts +37 -0
- package/target/types/main/typescript/impl/xhrCore/EventData.d.ts +25 -0
- package/target/types/main/typescript/impl/xhrCore/IResponseProcessor.d.ts +136 -0
- package/target/types/main/typescript/impl/xhrCore/RequestDataResolver.d.ts +84 -0
- package/target/types/main/typescript/impl/xhrCore/ResonseDataResolver.d.ts +60 -0
- package/target/types/main/typescript/impl/xhrCore/Response.d.ts +29 -0
- package/target/types/main/typescript/impl/xhrCore/ResponseProcessor.d.ts +208 -0
- package/target/types/main/typescript/impl/xhrCore/XhrFormData.d.ts +83 -0
- package/target/types/main/typescript/impl/xhrCore/XhrRequest.d.ts +102 -0
- package/target/types/main/typescript/index.d.ts +34 -0
- package/target/types/main/typescript/index_core.d.ts +29 -0
- package/target/types/main/typescript/myfaces/OamSubmit.d.ts +53 -0
- package/target/types/main/typescript/test/frameworkBase/LangTest.spec.d.ts +1 -0
- package/target/types/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.d.ts +1 -0
- package/target/types/main/typescript/test/frameworkBase/_ext/monadish/LangTest.spec.d.ts +16 -0
- package/target/types/main/typescript/test/frameworkBase/_ext/monadish/MappingProbes.d.ts +39 -0
- package/target/types/main/typescript/test/frameworkBase/_ext/monadish/MappingTest.spec.d.ts +16 -0
- package/target/types/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.d.ts +16 -0
- package/target/types/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.d.ts +0 -0
- package/target/types/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.d.ts +1 -0
- package/target/types/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.d.ts +1 -0
- package/target/types/main/typescript/test/frameworkBase/_ext/shared/StandardInits.d.ts +63 -0
- package/target/types/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.d.ts +23 -0
- package/target/types/main/typescript/test/impl/ImplTest.spec.d.ts +16 -0
- package/target/types/main/typescript/test/impl/ImplTest_23.spec.d.ts +16 -0
- package/target/types/main/typescript/test/impl/SeparatorCharsTest.spec.d.ts +16 -0
- package/target/types/main/typescript/test/myfaces/OamSubmit.spec.d.ts +16 -0
- package/target/types/main/typescript/test/myfaces/OnLoad.spec.d.ts +16 -0
- package/target/types/main/typescript/test/queue/AsynchronousProbe.d.ts +38 -0
- package/target/types/main/typescript/test/queue/AsynchronousQueueTest.spec.d.ts +16 -0
- package/target/types/main/typescript/test/xhrCore/ClientWindow.spec.d.ts +1 -0
- package/target/types/main/typescript/test/xhrCore/ErrorChainTest.spec.d.ts +16 -0
- package/target/types/main/typescript/test/xhrCore/EventTests.spec.d.ts +16 -0
- package/target/types/main/typescript/test/xhrCore/FakeWebsocket.d.ts +24 -0
- package/target/types/main/typescript/test/xhrCore/FileUploadTest.spec.d.ts +1 -0
- package/target/types/main/typescript/test/xhrCore/NamespacesRequestTest.spec.d.ts +16 -0
- package/target/types/main/typescript/test/xhrCore/OamSubmitTest.spec.d.ts +16 -0
- package/target/types/main/typescript/test/xhrCore/RequestParamsTest.spec.d.ts +1 -0
- package/target/types/main/typescript/test/xhrCore/RequestTest.spec.d.ts +16 -0
- package/target/types/main/typescript/test/xhrCore/RequestTest_23.spec.d.ts +16 -0
- package/target/types/main/typescript/test/xhrCore/ResponseTest.spec.d.ts +16 -0
- package/target/types/main/typescript/test/xhrCore/ResponseTest23.spec.d.ts +16 -0
- package/target/types/main/typescript/test/xhrCore/ShadowDomTest.spec.d.ts +16 -0
- package/target/types/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.d.ts +1 -0
- package/target/types/main/typescript/test/xhrCore/WebsocketTest.d.ts +1 -0
- package/target/types/main/typescript/test/xhrCore/XhrFormDataTest.spec.d.ts +16 -0
- package/target/types/test/typescript/AssocArrayTest.spec.d.ts +1 -0
- package/target/types/test/typescript/DomQueryTest.spec.d.ts +1 -0
- package/target/types/test/typescript/ExtendedArrayTest.spec.d.ts +1 -0
- package/target/types/test/typescript/LangTest.spec.d.ts +1 -0
- package/target/types/test/typescript/MappingProbes.d.ts +24 -0
- package/target/types/test/typescript/MappingTest.spec.d.ts +1 -0
- package/target/types/test/typescript/MessagingTest.spec.d.ts +1 -0
- package/target/types/test/typescript/MonadTest.spec.d.ts +16 -0
- package/target/types/test/typescript/PromiseTest.spec.d.ts +1 -0
- package/target/types/test/typescript/StreamTest.spec.d.ts +1 -0
- package/target/types/test/typescript/XmlQueryTest.spec.d.ts +1 -0
- package/target/types/test/typescript/markups/tobago-with-header.d.ts +1 -0
- package/target/types/test/typescript/markups/tobago-without-header.d.ts +1 -0
- package/webpack.config.js +1 -1
- package/webpack.config.js.map +1 -1
- package/.nyc_output/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +0 -1
- package/.nyc_output/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +0 -1
- package/.nyc_output/processinfo/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +0 -1
- package/.nyc_output/processinfo/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/src/test.html +0 -75
- package/src/tmp/test.html +0 -16
- package/tmp.xml +0 -36
|
@@ -248,7 +248,7 @@ function simpleShallowMerge(...assocArrays) {
|
|
|
248
248
|
}
|
|
249
249
|
exports.simpleShallowMerge = simpleShallowMerge;
|
|
250
250
|
/**
|
|
251
|
-
* Shallow merge as in config
|
|
251
|
+
* Shallow merge as in config, but on raw associative arrays
|
|
252
252
|
*
|
|
253
253
|
* @param overwrite
|
|
254
254
|
* @param withAppend
|
|
@@ -1859,33 +1859,19 @@ class DomQuery {
|
|
|
1859
1859
|
const execCss = (toReplace) => {
|
|
1860
1860
|
const _toReplace = DomQuery.byId(toReplace);
|
|
1861
1861
|
const tagName = _toReplace.tagName.orElse("").value;
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
matches.replace(_toReplace);
|
|
1869
|
-
}
|
|
1870
|
-
else {
|
|
1871
|
-
head.append(_toReplace);
|
|
1872
|
-
}
|
|
1873
|
-
}
|
|
1874
|
-
else if (tagName && eqi(tagName, "style")) {
|
|
1875
|
-
let innerText = _toReplace.innerHTML.replace(/\s+/gi, "");
|
|
1876
|
-
let styles = head.querySelectorAll("style");
|
|
1877
|
-
let filteredStyles = styles.asArray.filter(style => {
|
|
1878
|
-
return style.innerHTML.replace(/\s+/gi, "") == innerText;
|
|
1879
|
-
});
|
|
1880
|
-
styles = new DomQuery(...filteredStyles);
|
|
1881
|
-
if (!styles.length) { //already present
|
|
1882
|
-
head.append(_toReplace);
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
1862
|
+
let newElement = DomQuery.fromMarkup(`<${tagName.toLowerCase()} />`);
|
|
1863
|
+
newElement = newElement.copyAttrs(_toReplace);
|
|
1864
|
+
newElement.innerHTML = toReplace.innerHTML;
|
|
1865
|
+
// css suffices a simple replace to get it eval-ed, no need
|
|
1866
|
+
// for a full head replace
|
|
1867
|
+
_toReplace.replace(newElement);
|
|
1885
1868
|
};
|
|
1886
1869
|
const scriptElements = new DomQuery(this.filterSelector("link, style"), this.querySelectorAll("link, style"));
|
|
1887
1870
|
scriptElements.asArray
|
|
1888
1871
|
.flatMap(item => [...item.values])
|
|
1872
|
+
// sort to make sure the execution order is correct
|
|
1873
|
+
// this is needed because we mix 2 queries together
|
|
1874
|
+
// -3 is needed due to the compareDocumentPosition return value
|
|
1889
1875
|
.sort((node1, node2) => node1.compareDocumentPosition(node2) - 3)
|
|
1890
1876
|
.forEach(item => execCss(item));
|
|
1891
1877
|
return this;
|
|
@@ -2482,12 +2468,12 @@ class DomQuery {
|
|
|
2482
2468
|
}
|
|
2483
2469
|
}
|
|
2484
2470
|
}
|
|
2485
|
-
exports.DomQuery = DomQuery;
|
|
2486
2471
|
DomQuery.absent = new DomQuery();
|
|
2487
2472
|
/**
|
|
2488
2473
|
* reference to the environmental global object
|
|
2489
2474
|
*/
|
|
2490
2475
|
DomQuery.global = Global_1._global$;
|
|
2476
|
+
exports.DomQuery = DomQuery;
|
|
2491
2477
|
/**
|
|
2492
2478
|
* Various collectors
|
|
2493
2479
|
* which can be used in conjunction with Streams
|
|
@@ -2642,7 +2628,12 @@ exports._Es2019Array = _Es2019Array;
|
|
|
2642
2628
|
* does not yet have flatMap support on arrays
|
|
2643
2629
|
*/
|
|
2644
2630
|
exports.Es2019Array = (Array.prototype.flatMap) ? function (...data) {
|
|
2645
|
-
|
|
2631
|
+
// sometimes the typescript compiler produces
|
|
2632
|
+
// an array without flatmap between boundaries (the result produces True for Array.isArray
|
|
2633
|
+
// but has no flatMap function, could be a node issue also or Typescript!
|
|
2634
|
+
// we remap that (could be related to: https://github.com/microsoft/TypeScript/issues/31033
|
|
2635
|
+
// the check and remap fixes the issue which should not exist in the first place
|
|
2636
|
+
return (data === null || data === void 0 ? void 0 : data.flatMap) ? data : _Es2019Array(...data);
|
|
2646
2637
|
} : _Es2019Array;
|
|
2647
2638
|
|
|
2648
2639
|
|
|
@@ -3164,9 +3155,9 @@ class Optional extends Monad {
|
|
|
3164
3155
|
});
|
|
3165
3156
|
}
|
|
3166
3157
|
}
|
|
3167
|
-
exports.Optional = Optional;
|
|
3168
3158
|
/*default value for absent*/
|
|
3169
3159
|
Optional.absent = Optional.fromNullable(null);
|
|
3160
|
+
exports.Optional = Optional;
|
|
3170
3161
|
// --------------------- From here onwards we break out the side effect free limits ------------
|
|
3171
3162
|
/**
|
|
3172
3163
|
* ValueEmbedder is the writeable version
|
|
@@ -3219,9 +3210,9 @@ class ValueEmbedder extends Optional {
|
|
|
3219
3210
|
return new ValueEmbedder(value, valueKey);
|
|
3220
3211
|
}
|
|
3221
3212
|
}
|
|
3222
|
-
exports.ValueEmbedder = ValueEmbedder;
|
|
3223
3213
|
/*default value for absent*/
|
|
3224
3214
|
ValueEmbedder.absent = ValueEmbedder.fromNullable(null);
|
|
3215
|
+
exports.ValueEmbedder = ValueEmbedder;
|
|
3225
3216
|
|
|
3226
3217
|
|
|
3227
3218
|
/***/ }),
|
|
@@ -6570,14 +6561,9 @@ class XhrQueueController {
|
|
|
6570
6561
|
* and clear the queue (theoretically this
|
|
6571
6562
|
* would work with any promise)
|
|
6572
6563
|
*/
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
.catch((e) => this.handleError(e));
|
|
6577
|
-
}
|
|
6578
|
-
catch (e) {
|
|
6579
|
-
this.handleError(e);
|
|
6580
|
-
}
|
|
6564
|
+
return asyncRunnable
|
|
6565
|
+
.then(() => this.next())
|
|
6566
|
+
.catch(() => this.clear());
|
|
6581
6567
|
}
|
|
6582
6568
|
/**
|
|
6583
6569
|
* alerts the queue that a task is running
|
|
@@ -6594,16 +6580,6 @@ class XhrQueueController {
|
|
|
6594
6580
|
updateTaskRunning() {
|
|
6595
6581
|
this.taskRunning = !this.isEmpty;
|
|
6596
6582
|
}
|
|
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
6583
|
}
|
|
6608
6584
|
exports.XhrQueueController = XhrQueueController;
|
|
6609
6585
|
|
|
@@ -8046,8 +8022,10 @@ class XhrRequest extends AsyncRunnable_1.AsyncRunnable {
|
|
|
8046
8022
|
this.sendRequest(formData);
|
|
8047
8023
|
}
|
|
8048
8024
|
catch (e) {
|
|
8049
|
-
//
|
|
8050
|
-
|
|
8025
|
+
// this happens usually in a client side condition, hence we have to deal in with it in a client
|
|
8026
|
+
// side manner
|
|
8027
|
+
this.handleErrorAndClearQueue(e);
|
|
8028
|
+
throw e;
|
|
8051
8029
|
}
|
|
8052
8030
|
return this;
|
|
8053
8031
|
}
|
|
@@ -8071,102 +8049,138 @@ class XhrRequest extends AsyncRunnable_1.AsyncRunnable {
|
|
|
8071
8049
|
registerXhrCallbacks(resolve, reject) {
|
|
8072
8050
|
const xhrObject = this.xhrObject;
|
|
8073
8051
|
xhrObject.onabort = () => {
|
|
8074
|
-
this.onAbort(reject);
|
|
8052
|
+
this.onAbort(resolve, reject);
|
|
8075
8053
|
};
|
|
8076
8054
|
xhrObject.ontimeout = () => {
|
|
8077
|
-
this.onTimeout(reject);
|
|
8055
|
+
this.onTimeout(resolve, reject);
|
|
8078
8056
|
};
|
|
8079
8057
|
xhrObject.onload = () => {
|
|
8080
|
-
this.
|
|
8058
|
+
this.onResponseReceived(resolve);
|
|
8081
8059
|
};
|
|
8082
8060
|
xhrObject.onloadend = () => {
|
|
8083
|
-
this.
|
|
8061
|
+
this.onResponseProcessed(this.xhrObject, resolve);
|
|
8084
8062
|
};
|
|
8085
8063
|
xhrObject.onerror = (errorData) => {
|
|
8086
|
-
//
|
|
8087
|
-
// cancel is called from outside
|
|
8064
|
+
// Safari in rare cases triggers an error when cancelling a request internally, or when
|
|
8088
8065
|
// in this case we simply ignore the request and clear up the queue, because
|
|
8089
8066
|
// it is not safe anymore to proceed with the current queue
|
|
8090
8067
|
// This bypasses a Safari issue where it keeps requests hanging after page unload
|
|
8091
8068
|
// and then triggers a cancel error on then instead of just stopping
|
|
8092
8069
|
// and clearing the code
|
|
8070
|
+
// in a page unload case it is safe to clear the queue
|
|
8071
|
+
// in the exact safari case any request after this one in the queue is invalid
|
|
8072
|
+
// because the queue references xhr requests to a page which already is gone!
|
|
8093
8073
|
if (this.isCancelledResponse(this.xhrObject)) {
|
|
8094
8074
|
/*
|
|
8095
8075
|
* this triggers the catch chain and after that finally
|
|
8096
8076
|
*/
|
|
8097
|
-
reject();
|
|
8098
8077
|
this.stopProgress = true;
|
|
8078
|
+
reject();
|
|
8079
|
+
return;
|
|
8080
|
+
}
|
|
8081
|
+
// error already processed somewhere else
|
|
8082
|
+
if (this.stopProgress) {
|
|
8099
8083
|
return;
|
|
8100
8084
|
}
|
|
8101
|
-
this.
|
|
8085
|
+
this.handleError(errorData);
|
|
8102
8086
|
};
|
|
8103
8087
|
}
|
|
8104
8088
|
isCancelledResponse(currentTarget) {
|
|
8105
|
-
return (currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.status) === 0 && // cancelled by browser
|
|
8089
|
+
return (currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.status) === 0 && // cancelled internally by browser
|
|
8106
8090
|
(currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.readyState) === 4 &&
|
|
8107
8091
|
(currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.responseText) === '' &&
|
|
8108
8092
|
(currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.responseXML) === null;
|
|
8109
8093
|
}
|
|
8110
8094
|
/*
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8095
|
+
* xhr processing callbacks
|
|
8096
|
+
*
|
|
8097
|
+
* Those methods are the callbacks called by
|
|
8098
|
+
* the xhr object depending on its own state
|
|
8099
|
+
*/
|
|
8100
|
+
/**
|
|
8101
|
+
* client side abort... also here for now we clean the queue
|
|
8102
|
+
*
|
|
8103
|
+
* @param resolve
|
|
8104
|
+
* @param reject
|
|
8105
|
+
* @private
|
|
8106
|
+
*/
|
|
8107
|
+
onAbort(resolve, reject) {
|
|
8108
|
+
// reject means clear queue, in this case we abort entirely the processing
|
|
8109
|
+
// does not happen yet, we have to probably rethink this strategy in the future
|
|
8110
|
+
// when we introduce cancel functionality
|
|
8111
|
+
this.handleGenericError(reject);
|
|
8118
8112
|
}
|
|
8119
|
-
|
|
8113
|
+
/**
|
|
8114
|
+
* request timeout, this must be handled like a generic server error per spec
|
|
8115
|
+
* unfortunately, so we have to jump to the next item (we cancelled before)
|
|
8116
|
+
* @param resolve
|
|
8117
|
+
* @param reject
|
|
8118
|
+
* @private
|
|
8119
|
+
*/
|
|
8120
|
+
onTimeout(resolve, reject) {
|
|
8121
|
+
// timeout also means we we probably should clear the queue,
|
|
8122
|
+
// the state is unsafe for the next requests
|
|
8120
8123
|
this.sendEvent(Const_1.STATE_EVT_TIMEOUT);
|
|
8121
|
-
|
|
8124
|
+
this.handleGenericError(resolve);
|
|
8122
8125
|
}
|
|
8123
|
-
|
|
8124
|
-
|
|
8126
|
+
/**
|
|
8127
|
+
* the response is received and normally is a normal response
|
|
8128
|
+
* but also can be some kind of error (http code >= 300)
|
|
8129
|
+
* In any case the response will be resolved either as error or response
|
|
8130
|
+
* and the next item in the queue will be processed
|
|
8131
|
+
* @param resolve
|
|
8132
|
+
* @private
|
|
8133
|
+
*/
|
|
8134
|
+
onResponseReceived(resolve) {
|
|
8135
|
+
var _a, _b, _c, _d;
|
|
8125
8136
|
this.sendEvent(Const_1.COMPLETE);
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8137
|
+
/*
|
|
8138
|
+
* second on error path
|
|
8139
|
+
*/
|
|
8140
|
+
if (((_b = (_a = this.xhrObject) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 0) >= 300 || !((_c = this === null || this === void 0 ? void 0 : this.xhrObject) === null || _c === void 0 ? void 0 : _c.responseXML)) {
|
|
8141
|
+
// all errors from the server are resolved without interfering in the queue
|
|
8142
|
+
this.handleGenericError(resolve);
|
|
8130
8143
|
return;
|
|
8131
8144
|
}
|
|
8132
|
-
(0, Const_1.$faces)().ajax.response(this.xhrObject, (
|
|
8145
|
+
(0, Const_1.$faces)().ajax.response(this.xhrObject, (_d = this.responseContext.value) !== null && _d !== void 0 ? _d : {});
|
|
8133
8146
|
}
|
|
8134
|
-
|
|
8135
|
-
var _a;
|
|
8147
|
+
handleGenericError(resolveOrReject) {
|
|
8148
|
+
var _a, _b, _c, _d;
|
|
8136
8149
|
this.stopProgress = true;
|
|
8137
8150
|
const errorData = {
|
|
8138
8151
|
type: Const_1.ERROR,
|
|
8139
8152
|
status: Const_1.MALFORMEDXML,
|
|
8140
|
-
responseCode:
|
|
8141
|
-
responseText: (
|
|
8153
|
+
responseCode: (_b = (_a = this.xhrObject) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 400,
|
|
8154
|
+
responseText: (_d = (_c = this.xhrObject) === null || _c === void 0 ? void 0 : _c.responseText) !== null && _d !== void 0 ? _d : "Error",
|
|
8142
8155
|
source: this.internalContext.getIf(Const_1.CTX_PARAM_SRC_CTL_ID).value
|
|
8143
8156
|
};
|
|
8144
8157
|
try {
|
|
8145
8158
|
this.handleError(errorData, true);
|
|
8146
8159
|
}
|
|
8147
8160
|
finally {
|
|
8148
|
-
// we issue a
|
|
8161
|
+
// we issue a resolveOrReject in this case to allow the system to recover
|
|
8149
8162
|
// reject would clean up the queue
|
|
8150
|
-
resolve
|
|
8163
|
+
// resolve would trigger the next element in the queue to be processed
|
|
8164
|
+
resolveOrReject(errorData);
|
|
8151
8165
|
}
|
|
8152
8166
|
// non blocking non clearing
|
|
8153
8167
|
}
|
|
8154
|
-
|
|
8155
|
-
|
|
8168
|
+
/**
|
|
8169
|
+
* last minute cleanup, the request now either is fully done
|
|
8170
|
+
* or not by having had a cancel or error event be
|
|
8171
|
+
* @param data
|
|
8172
|
+
* @param resolve
|
|
8173
|
+
* @private
|
|
8174
|
+
*/
|
|
8175
|
+
onResponseProcessed(data, resolve) {
|
|
8176
|
+
// if stop progress true, the cleanup already has been performed
|
|
8156
8177
|
if (this.stopProgress) {
|
|
8157
8178
|
return;
|
|
8158
8179
|
}
|
|
8159
|
-
/**
|
|
8160
|
-
* now call the then chain
|
|
8161
|
-
*/
|
|
8162
|
-
resolve(data);
|
|
8163
|
-
}
|
|
8164
|
-
onError(errorData, reject) {
|
|
8165
|
-
this.handleError(errorData);
|
|
8166
8180
|
/*
|
|
8167
|
-
*
|
|
8181
|
+
* normal case, cleanup == next item if possible
|
|
8168
8182
|
*/
|
|
8169
|
-
|
|
8183
|
+
resolve(data);
|
|
8170
8184
|
}
|
|
8171
8185
|
sendRequest(formData) {
|
|
8172
8186
|
const isPost = this.ajaxType != Const_1.REQ_TYPE_GET;
|
|
@@ -8195,10 +8209,16 @@ class XhrRequest extends AsyncRunnable_1.AsyncRunnable {
|
|
|
8195
8209
|
}
|
|
8196
8210
|
catch (e) {
|
|
8197
8211
|
e.source = (_a = e === null || e === void 0 ? void 0 : e.source) !== null && _a !== void 0 ? _a : this.requestContext.getIf(Const_1.SOURCE).value;
|
|
8198
|
-
this
|
|
8212
|
+
// this is a client error, no save state anymore for queue processing!
|
|
8213
|
+
this.handleErrorAndClearQueue(e);
|
|
8214
|
+
// we forward the error upward like all client side errors
|
|
8199
8215
|
throw e;
|
|
8200
8216
|
}
|
|
8201
8217
|
}
|
|
8218
|
+
handleErrorAndClearQueue(e, responseFormatError = false) {
|
|
8219
|
+
this.handleError(e, responseFormatError);
|
|
8220
|
+
this.reject(e);
|
|
8221
|
+
}
|
|
8202
8222
|
handleError(exception, responseFormatError = false) {
|
|
8203
8223
|
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
8224
|
const eventHandler = (0, RequestDataResolver_1.resolveHandlerFunc)(this.requestContext, this.responseContext, Const_1.ON_ERROR);
|
|
Binary file
|
|
Binary file
|