jsf.js_next_gen 4.0.2-beta.9 → 4.0.3-beta.1
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 +61 -35
- 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 +61 -35
- 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 +1 -1
- package/src/main/typescript/impl/PushImpl.ts +1 -1
- package/src/main/typescript/impl/core/Const.ts +1 -1
- package/src/main/typescript/impl/xhrCore/ErrorData.ts +20 -15
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +72 -25
- package/src/main/typescript/test/xhrCore/EventTests.spec.ts +1 -1
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +3 -3
- package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +3 -3
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +2 -2
- package/target/impl/PushImpl.js +3 -3
- package/target/impl/PushImpl.js.map +1 -1
- package/target/impl/core/Const.js +2 -2
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/xhrCore/ErrorData.js +11 -10
- package/target/impl/xhrCore/ErrorData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +45 -20
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/test/xhrCore/EventTests.spec.js +1 -1
- package/target/test/xhrCore/EventTests.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +3 -4
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +3 -3
- package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +2 -2
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/webpack.config.js +54 -0
- package/webpack.config.js.map +1 -0
|
@@ -5154,14 +5154,14 @@ var PushImpl;
|
|
|
5154
5154
|
this.reconnectAttempts = 0;
|
|
5155
5155
|
}
|
|
5156
5156
|
onerror(event) {
|
|
5157
|
-
var _a, _b;
|
|
5158
|
-
let message = JSON.parse(event.data);
|
|
5157
|
+
var _a, _b, _c;
|
|
5158
|
+
let message = JSON.parse((_a = event === null || event === void 0 ? void 0 : event.data) !== null && _a !== void 0 ? _a : null);
|
|
5159
5159
|
//TODO replace this with a more readable Stream code
|
|
5160
5160
|
for (let i = PushImpl.clientIdsByTokens[this.channelToken].length - 1; i >= 0; i--) {
|
|
5161
5161
|
let socketClientId = PushImpl.clientIdsByTokens[this.channelToken][i];
|
|
5162
5162
|
if (document.getElementById(socketClientId)) {
|
|
5163
5163
|
try {
|
|
5164
|
-
(
|
|
5164
|
+
(_c = (_b = PushImpl.components[socketClientId]) === null || _b === void 0 ? void 0 : _b['onerror']) === null || _c === void 0 ? void 0 : _c.call(_b, message, this.channel, event);
|
|
5165
5165
|
}
|
|
5166
5166
|
catch (e) {
|
|
5167
5167
|
//Ignore
|
|
@@ -5303,7 +5303,7 @@ var PushImpl;
|
|
|
5303
5303
|
* limitations under the License.
|
|
5304
5304
|
*/
|
|
5305
5305
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5306
|
-
exports.CTX_OPTIONS_PARAMS = exports.TIMEOUT_EVENT = exports.CLIENT_ERROR = exports.SERVER_ERROR = exports.MALFORMEDXML = exports.EMPTY_RESPONSE = exports.
|
|
5306
|
+
exports.CTX_OPTIONS_PARAMS = exports.TIMEOUT_EVENT = exports.CLIENT_ERROR = exports.SERVER_ERROR = exports.MALFORMEDXML = exports.EMPTY_RESPONSE = exports.HTTP_ERROR = 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;
|
|
5307
5307
|
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;
|
|
5308
5308
|
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;
|
|
5309
5309
|
/*
|
|
@@ -5359,7 +5359,7 @@ exports.ERROR_MESSAGE = "error-message";
|
|
|
5359
5359
|
exports.RESPONSE_TEXT = "responseText";
|
|
5360
5360
|
exports.RESPONSE_XML = "responseXML";
|
|
5361
5361
|
/*ajax errors spec 14.4.2*/
|
|
5362
|
-
exports.
|
|
5362
|
+
exports.HTTP_ERROR = "httpError";
|
|
5363
5363
|
exports.EMPTY_RESPONSE = "emptyResponse";
|
|
5364
5364
|
exports.MALFORMEDXML = "malformedXML";
|
|
5365
5365
|
exports.SERVER_ERROR = "serverError";
|
|
@@ -6746,18 +6746,19 @@ var ErrorType;
|
|
|
6746
6746
|
* I will add deprecated myfaces backwards compatibility attributes as well
|
|
6747
6747
|
*/
|
|
6748
6748
|
class ErrorData extends EventData_1.EventData {
|
|
6749
|
-
constructor(source, errorName, errorMessage, responseText = null, responseXML = null, responseCode =
|
|
6749
|
+
constructor(source, errorName, errorMessage, responseText = null, responseXML = null, responseCode = -1, statusOverride = null, type = ErrorType.CLIENT_ERROR) {
|
|
6750
6750
|
super();
|
|
6751
6751
|
this.type = "error";
|
|
6752
|
-
this.source =
|
|
6753
|
-
this.sourceId = source;
|
|
6752
|
+
this.source = source;
|
|
6754
6753
|
this.type = Const_1.ERROR;
|
|
6755
6754
|
this.errorName = errorName;
|
|
6756
6755
|
//tck requires that the type is prefixed to the message itself (jsdoc also) in case of a server error
|
|
6757
|
-
this.
|
|
6758
|
-
this.responseCode = responseCode
|
|
6756
|
+
this.errorMessage = errorMessage;
|
|
6757
|
+
this.responseCode = `${responseCode}`;
|
|
6759
6758
|
this.responseText = responseText;
|
|
6760
|
-
this.
|
|
6759
|
+
this.responseXML = responseXML;
|
|
6760
|
+
this.status = statusOverride;
|
|
6761
|
+
this.description = `Status: ${this.status}\nResponse Code: ${this.responseCode}\nError Message: ${this.errorMessage}`;
|
|
6761
6762
|
this.typeDetails = type;
|
|
6762
6763
|
if (type == ErrorType.SERVER_ERROR) {
|
|
6763
6764
|
this.serverErrorName = this.errorName;
|
|
@@ -6768,8 +6769,8 @@ class ErrorData extends EventData_1.EventData {
|
|
|
6768
6769
|
var _a, _b, _c, _d;
|
|
6769
6770
|
return new ErrorData((_a = e === null || e === void 0 ? void 0 : e.source) !== null && _a !== void 0 ? _a : "client", (_b = e === null || e === void 0 ? void 0 : e.name) !== null && _b !== void 0 ? _b : Const_1.EMPTY_STR, (_c = e === null || e === void 0 ? void 0 : e.message) !== null && _c !== void 0 ? _c : Const_1.EMPTY_STR, (_d = e === null || e === void 0 ? void 0 : e.stack) !== null && _d !== void 0 ? _d : Const_1.EMPTY_STR);
|
|
6770
6771
|
}
|
|
6771
|
-
static fromHttpConnection(source, name, message, responseText, responseCode, status = Const_1.EMPTY_STR) {
|
|
6772
|
-
return new ErrorData(source, name, message, responseText,
|
|
6772
|
+
static fromHttpConnection(source, name, message, responseText, responseXML, responseCode, status = Const_1.EMPTY_STR) {
|
|
6773
|
+
return new ErrorData(source, name, message, responseText, responseXML, responseCode, status, ErrorType.HTTP_ERROR);
|
|
6773
6774
|
}
|
|
6774
6775
|
static fromGeneric(context, errorCode, errorType = ErrorType.SERVER_ERROR) {
|
|
6775
6776
|
let getMsg = this.getMsg;
|
|
@@ -6778,8 +6779,8 @@ class ErrorData extends EventData_1.EventData {
|
|
|
6778
6779
|
let errorMessage = getMsg(context, Const_1.ERROR_MESSAGE);
|
|
6779
6780
|
let status = getMsg(context, Const_1.STATUS);
|
|
6780
6781
|
let responseText = getMsg(context, Const_1.RESPONSE_TEXT);
|
|
6781
|
-
let responseXML =
|
|
6782
|
-
return new ErrorData(source, errorName, errorMessage, responseText, responseXML, errorCode
|
|
6782
|
+
let responseXML = context.getIf(Const_1.RESPONSE_XML).value;
|
|
6783
|
+
return new ErrorData(source, errorName, errorMessage, responseText, responseXML, errorCode, status, errorType);
|
|
6783
6784
|
}
|
|
6784
6785
|
static getMsg(context, param) {
|
|
6785
6786
|
return getMessage(context.getIf(param).orElse(Const_1.EMPTY_STR).value);
|
|
@@ -8225,7 +8226,7 @@ class XhrRequest extends AsyncRunnable_1.AsyncRunnable {
|
|
|
8225
8226
|
// reject means clear queue, in this case we abort entirely the processing
|
|
8226
8227
|
// does not happen yet, we have to probably rethink this strategy in the future
|
|
8227
8228
|
// when we introduce cancel functionality
|
|
8228
|
-
this.
|
|
8229
|
+
this.handleHttpError(reject);
|
|
8229
8230
|
}
|
|
8230
8231
|
/**
|
|
8231
8232
|
* request timeout, this must be handled like a generic server error per spec
|
|
@@ -8238,7 +8239,7 @@ class XhrRequest extends AsyncRunnable_1.AsyncRunnable {
|
|
|
8238
8239
|
// timeout also means we we probably should clear the queue,
|
|
8239
8240
|
// the state is unsafe for the next requests
|
|
8240
8241
|
this.sendEvent(Const_1.STATE_EVT_TIMEOUT);
|
|
8241
|
-
this.
|
|
8242
|
+
this.handleHttpError(resolve);
|
|
8242
8243
|
}
|
|
8243
8244
|
/**
|
|
8244
8245
|
* the response is received and normally is a normal response
|
|
@@ -8249,28 +8250,52 @@ class XhrRequest extends AsyncRunnable_1.AsyncRunnable {
|
|
|
8249
8250
|
* @private
|
|
8250
8251
|
*/
|
|
8251
8252
|
onResponseReceived(resolve) {
|
|
8252
|
-
var _a
|
|
8253
|
+
var _a;
|
|
8253
8254
|
this.sendEvent(Const_1.COMPLETE);
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8255
|
+
//request error resolution as per spec:
|
|
8256
|
+
if (!this.processRequestErrors(resolve)) {
|
|
8257
|
+
(0, Const_1.$faces)().ajax.response(this.xhrObject, (_a = this.responseContext.value) !== null && _a !== void 0 ? _a : {});
|
|
8258
|
+
}
|
|
8259
|
+
}
|
|
8260
|
+
processRequestErrors(resolve) {
|
|
8261
|
+
var _a, _b, _c;
|
|
8262
|
+
const responseXML = new mona_dish_1.XMLQuery((_a = this.xhrObject) === null || _a === void 0 ? void 0 : _a.responseXML);
|
|
8263
|
+
const responseCode = (_c = (_b = this.xhrObject) === null || _b === void 0 ? void 0 : _b.status) !== null && _c !== void 0 ? _c : -1;
|
|
8264
|
+
if (responseXML.isXMLParserError()) {
|
|
8265
|
+
// invalid response
|
|
8266
|
+
const errorName = "Invalid Response";
|
|
8267
|
+
const errorMessage = "The response xml is invalid";
|
|
8268
|
+
this.handleGenericResponseError(errorName, errorMessage, Const_1.MALFORMEDXML, resolve);
|
|
8269
|
+
return true;
|
|
8270
|
+
}
|
|
8271
|
+
else if (responseXML.isAbsent()) {
|
|
8272
|
+
// empty response
|
|
8273
|
+
const errorName = "Empty Response";
|
|
8274
|
+
const errorMessage = "The response has provided no data";
|
|
8275
|
+
this.handleGenericResponseError(errorName, errorMessage, Const_1.EMPTY_RESPONSE, resolve);
|
|
8276
|
+
return true;
|
|
8277
|
+
}
|
|
8278
|
+
else if (responseCode >= 300 || responseCode < 200) {
|
|
8279
|
+
// other server errors
|
|
8258
8280
|
// all errors from the server are resolved without interfering in the queue
|
|
8259
|
-
this.
|
|
8260
|
-
return;
|
|
8281
|
+
this.handleHttpError(resolve);
|
|
8282
|
+
return true;
|
|
8261
8283
|
}
|
|
8262
|
-
|
|
8284
|
+
//additional errors are application errors and must be handled within the response
|
|
8285
|
+
return false;
|
|
8263
8286
|
}
|
|
8264
|
-
|
|
8287
|
+
handleGenericResponseError(errorName, errorMessage, responseStatus, resolve) {
|
|
8265
8288
|
var _a, _b, _c, _d;
|
|
8289
|
+
const errorData = new ErrorData_1.ErrorData(this.internalContext.getIf(Const_1.CTX_PARAM_SRC_CTL_ID).value, errorName, errorMessage, (_b = (_a = this.xhrObject) === null || _a === void 0 ? void 0 : _a.responseText) !== null && _b !== void 0 ? _b : "", (_d = (_c = this.xhrObject) === null || _c === void 0 ? void 0 : _c.responseXML) !== null && _d !== void 0 ? _d : null, this.xhrObject.status, responseStatus);
|
|
8290
|
+
this.finalizeError(errorData, resolve);
|
|
8291
|
+
}
|
|
8292
|
+
handleHttpError(resolveOrReject, errorMessage = "Generic HTTP Serror") {
|
|
8293
|
+
var _a, _b, _c, _d, _e, _f;
|
|
8266
8294
|
this.stopProgress = true;
|
|
8267
|
-
const errorData =
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
responseText: (_d = (_c = this.xhrObject) === null || _c === void 0 ? void 0 : _c.responseText) !== null && _d !== void 0 ? _d : "Error",
|
|
8272
|
-
source: this.internalContext.getIf(Const_1.CTX_PARAM_SRC_CTL_ID).value
|
|
8273
|
-
};
|
|
8295
|
+
const errorData = new ErrorData_1.ErrorData(this.internalContext.getIf(Const_1.CTX_PARAM_SRC_CTL_ID).value, Const_1.HTTP_ERROR, errorMessage, (_b = (_a = this.xhrObject) === null || _a === void 0 ? void 0 : _a.responseText) !== null && _b !== void 0 ? _b : "", (_d = (_c = this.xhrObject) === null || _c === void 0 ? void 0 : _c.responseXML) !== null && _d !== void 0 ? _d : null, (_f = (_e = this.xhrObject) === null || _e === void 0 ? void 0 : _e.status) !== null && _f !== void 0 ? _f : -1, Const_1.HTTP_ERROR);
|
|
8296
|
+
this.finalizeError(errorData, resolveOrReject);
|
|
8297
|
+
}
|
|
8298
|
+
finalizeError(errorData, resolveOrReject) {
|
|
8274
8299
|
try {
|
|
8275
8300
|
this.handleError(errorData, true);
|
|
8276
8301
|
}
|
|
@@ -8279,8 +8304,8 @@ class XhrRequest extends AsyncRunnable_1.AsyncRunnable {
|
|
|
8279
8304
|
// reject would clean up the queue
|
|
8280
8305
|
// resolve would trigger the next element in the queue to be processed
|
|
8281
8306
|
resolveOrReject(errorData);
|
|
8307
|
+
this.stopProgress = true;
|
|
8282
8308
|
}
|
|
8283
|
-
// non blocking non clearing
|
|
8284
8309
|
}
|
|
8285
8310
|
/**
|
|
8286
8311
|
* last minute cleanup, the request now either is fully done
|
|
@@ -8337,7 +8362,8 @@ class XhrRequest extends AsyncRunnable_1.AsyncRunnable {
|
|
|
8337
8362
|
this.reject(e);
|
|
8338
8363
|
}
|
|
8339
8364
|
handleError(exception, responseFormatError = false) {
|
|
8340
|
-
|
|
8365
|
+
var _a;
|
|
8366
|
+
const errorData = (responseFormatError) ? ErrorData_1.ErrorData.fromHttpConnection(exception.source, exception.type, (_a = exception.message) !== null && _a !== void 0 ? _a : Const_1.EMPTY_STR, exception.responseText, exception.responseXML, exception.responseCode, exception.status) : ErrorData_1.ErrorData.fromClient(exception);
|
|
8341
8367
|
const eventHandler = (0, RequestDataResolver_1.resolveHandlerFunc)(this.requestContext, this.responseContext, Const_1.ON_ERROR);
|
|
8342
8368
|
AjaxImpl_1.Implementation.sendError(errorData, eventHandler);
|
|
8343
8369
|
}
|