jsf.js_next_gen 4.0.1-alpha.0 → 4.0.1-beta.2
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 +0 -12
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/functions/faces.ajax.addOnError.html +4 -4
- package/dist/docs/functions/faces.ajax.request.html +7 -7
- package/dist/docs/functions/faces.ajax.response.html +0 -1
- package/dist/docs/functions/faces.util.chain.html +3 -3
- package/dist/docs/functions/myfaces.ab.html +1 -1
- package/dist/docs/functions/{myfaces.onDomReady.html → myfaces.onOnDomReady.html} +5 -5
- package/dist/docs/index.html +0 -14
- package/dist/docs/modules/myfaces.html +2 -2
- package/dist/docs/variables/myfaces.oam.html +1 -1
- package/dist/window/faces-development.js +1323 -1300
- 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 +1323 -1300
- package/dist/window/jsf-development.js.br +0 -0
- package/dist/window/jsf-development.js.gz +0 -0
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.br +0 -0
- package/dist/window/jsf.js.gz +0 -0
- package/dist/window/jsf.js.map +1 -1
- package/package.json +3 -3
- package/pom.xml +1 -1
- package/src/main/typescript/@types/definitions/index.d.ts +5 -5
- package/src/main/typescript/api/_api.ts +12 -13
- package/src/main/typescript/impl/AjaxImpl.ts +68 -65
- package/src/main/typescript/impl/core/Const.ts +2 -5
- package/src/main/typescript/impl/util/AsyncQueue.ts +133 -0
- package/src/main/typescript/impl/util/AsyncRunnable.ts +6 -81
- package/src/main/typescript/impl/util/ExtDomQuery.ts +9 -7
- package/src/main/typescript/impl/util/FileUtils.ts +22 -26
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +3 -7
- package/src/main/typescript/impl/util/Lang.ts +4 -61
- package/src/main/typescript/impl/xhrCore/EventData.ts +3 -3
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +10 -12
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +19 -32
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +72 -51
- package/src/main/typescript/myfaces/OamSubmit.ts +6 -6
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +40 -179
- package/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.ts +4 -4
- package/src/main/typescript/test/frameworkBase/_ext/monadish/StreamTest.spec.ts +231 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +4 -5
- package/src/main/typescript/test/queue/AsynchronousProbe.ts +5 -5
- package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +3 -4
- package/src/main/typescript/test/xhrCore/ClientWindow.spec.ts +78 -0
- package/src/main/typescript/test/xhrCore/EventTests.spec.ts +22 -28
- package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +4 -4
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +2 -2
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +6 -80
- package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +1 -6
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +22 -23
- package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +5 -5
- package/target/api/_api.js +11 -12
- package/target/api/_api.js.map +1 -1
- package/target/impl/AjaxImpl.js +59 -55
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/core/Const.js +5 -7
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/util/AsyncRunnable.js +0 -60
- 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 +20 -21
- package/target/impl/util/FileUtils.js.map +1 -1
- package/target/impl/util/HiddenInputBuilder.js +3 -7
- package/target/impl/util/HiddenInputBuilder.js.map +1 -1
- package/target/impl/util/Lang.js +1 -52
- 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 +7 -9
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +15 -29
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +64 -43
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +3 -5
- package/target/myfaces/OamSubmit.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +37 -138
- 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 +4 -5
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/queue/AsynchronousQueueTest.spec.js +3 -3
- package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
- package/target/test/xhrCore/ClientWindow.spec.js +90 -0
- package/target/test/xhrCore/ClientWindow.spec.js.map +1 -0
- package/target/test/xhrCore/EventTests.spec.js +19 -26
- package/target/test/xhrCore/EventTests.spec.js.map +1 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +3 -3
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +4 -73
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +0 -6
- package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +15 -22
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js +5 -5
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +1 -1
- package/plans for 4.0.1.txt +0 -8
- package/src/main/typescript/impl/util/XhrQueueController.ts +0 -112
- 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 +0 -921
- package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.ts +0 -108
- package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/jakarta.faces.resource/faces.js.jsf +0 -0
- package/src/main/typescript/test/myfaces/OnLoadSpec.ts +0 -52
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {AsyncRunnable
|
|
18
|
-
import {Config, DQ} from "mona-dish";
|
|
17
|
+
import {AsyncRunnable} from "../util/AsyncRunnable";
|
|
18
|
+
import {Config, DQ, DQ$, Stream} from "mona-dish";
|
|
19
19
|
import {Implementation} from "../AjaxImpl";
|
|
20
20
|
|
|
21
21
|
import {XhrFormData} from "./XhrFormData";
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
STATE_EVT_TIMEOUT,
|
|
42
42
|
STD_ACCEPT,
|
|
43
43
|
URL_ENCODED,
|
|
44
|
-
VAL_AJAX, IDENT_NONE
|
|
44
|
+
VAL_AJAX, IDENT_NONE
|
|
45
45
|
} from "../core/Const";
|
|
46
46
|
import {
|
|
47
47
|
resolveFinalUrl,
|
|
@@ -54,10 +54,6 @@ import {ExtConfig} from "../util/ExtDomQuery";
|
|
|
54
54
|
/**
|
|
55
55
|
* Faces XHR Request Wrapper
|
|
56
56
|
* as AsyncRunnable for our Asynchronous queue
|
|
57
|
-
* This means from the outside the
|
|
58
|
-
* xhr request is similar to a Promise in a way
|
|
59
|
-
* that you can add then and catch and finally callbacks.
|
|
60
|
-
*
|
|
61
57
|
*
|
|
62
58
|
* The idea is that we basically just enqueue
|
|
63
59
|
* a single ajax request into our queue
|
|
@@ -66,43 +62,60 @@ import {ExtConfig} from "../util/ExtDomQuery";
|
|
|
66
62
|
*
|
|
67
63
|
*/
|
|
68
64
|
|
|
69
|
-
export class XhrRequest
|
|
65
|
+
export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
70
66
|
|
|
71
67
|
private responseContext: Config;
|
|
72
68
|
|
|
73
69
|
private stopProgress = false;
|
|
74
70
|
|
|
71
|
+
/**
|
|
72
|
+
* helper support so that we do not have to drag in Promise shims
|
|
73
|
+
*/
|
|
74
|
+
private catchFunctions: Array<Function> = [];
|
|
75
|
+
private thenFunctions: Array<Function> = [];
|
|
75
76
|
|
|
76
|
-
private xhrObject = new XMLHttpRequest();
|
|
77
77
|
/**
|
|
78
78
|
* Required Parameters
|
|
79
79
|
*
|
|
80
|
+
* @param source the issuing element
|
|
81
|
+
* @param sourceForm the form which is related to the issuing element
|
|
80
82
|
* @param requestContext the request context with all pass through values
|
|
81
|
-
*
|
|
83
|
+
*
|
|
82
84
|
* Optional Parameters
|
|
85
|
+
*
|
|
86
|
+
* @param internalContext internal context with internal info which is passed through, not used by the user
|
|
87
|
+
* @param partialIdsArray an optional restricting partial ids array for encoding
|
|
83
88
|
* @param timeout optional xhr timeout
|
|
84
89
|
* @param ajaxType optional request type, default "POST"
|
|
85
90
|
* @param contentType optional content type, default "application/x-www-form-urlencoded"
|
|
91
|
+
* @param xhrObject optional xhr object which must fulfill the XMLHTTPRequest api, default XMLHttpRequest
|
|
86
92
|
*/
|
|
87
93
|
constructor(
|
|
94
|
+
private source: DQ,
|
|
95
|
+
private sourceForm: DQ,
|
|
88
96
|
private requestContext: ExtConfig,
|
|
89
97
|
private internalContext: Config,
|
|
98
|
+
private partialIdsArray = [],
|
|
90
99
|
private timeout = NO_TIMEOUT,
|
|
91
100
|
private ajaxType = REQ_TYPE_POST,
|
|
92
|
-
private contentType = URL_ENCODED
|
|
101
|
+
private contentType = URL_ENCODED,
|
|
102
|
+
private xhrObject = new XMLHttpRequest()
|
|
93
103
|
) {
|
|
94
|
-
|
|
104
|
+
|
|
95
105
|
// we omit promises here because we have to deal with cancel functionality,
|
|
96
106
|
// and promises to not provide that (yet) instead we have our async queue
|
|
97
107
|
// which uses an api internally, which is very close to promises
|
|
98
|
-
this.registerXhrCallbacks((data: any) =>
|
|
108
|
+
this.registerXhrCallbacks((data: any) => {
|
|
109
|
+
this.resolve(data)
|
|
110
|
+
}, (data: any) => {
|
|
111
|
+
this.reject(data)
|
|
112
|
+
});
|
|
99
113
|
}
|
|
100
114
|
|
|
101
|
-
start():
|
|
115
|
+
start(): AsyncRunnable<XMLHttpRequest> {
|
|
102
116
|
|
|
103
117
|
let ignoreErr = failSaveExecute;
|
|
104
118
|
let xhrObject = this.xhrObject;
|
|
105
|
-
let sourceForm = DQ.byId(this.internalContext.getIf(CTX_PARAM_SRC_FRM_ID).value)
|
|
106
119
|
|
|
107
120
|
let executesArr = () => {
|
|
108
121
|
return this.requestContext.getIf(CTX_PARAM_REQ_PASS_THR, P_EXECUTE).get(IDENT_NONE).value.split(/\s+/gi);
|
|
@@ -117,20 +130,15 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
117
130
|
// whatever the formData object delivers
|
|
118
131
|
// the partialIdsArray arr is almost deprecated legacy code where we allowed to send a separate list of partial
|
|
119
132
|
// ids for reduced load and server processing, this will be removed soon, we can handle the same via execute
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const formData: XhrFormData = new XhrFormData(
|
|
123
|
-
sourceForm,
|
|
124
|
-
resoveNamingContainerMapper(this.internalContext),
|
|
125
|
-
executes, partialIdsArray
|
|
126
|
-
);
|
|
133
|
+
// anyway TODO reimplement the partial ids array, we still do not have it in jsf the way we need it
|
|
134
|
+
let formData: XhrFormData = new XhrFormData(this.sourceForm, resoveNamingContainerMapper(this.internalContext), executesArr(), this.partialIdsArray);
|
|
127
135
|
|
|
128
136
|
this.contentType = formData.isMultipartRequest ? "undefined" : this.contentType;
|
|
129
137
|
|
|
130
138
|
// next step the pass through parameters are merged in for post params
|
|
131
139
|
this.requestContext.$nspEnabled = false;
|
|
132
|
-
|
|
133
|
-
|
|
140
|
+
let requestContext = this.requestContext;
|
|
141
|
+
let requestPassThroughParams = requestContext.getIf(CTX_PARAM_REQ_PASS_THR) as ExtConfig;
|
|
134
142
|
|
|
135
143
|
// we are turning off here the jsf, faces remapping because we are now dealing with
|
|
136
144
|
// pass-through parameters
|
|
@@ -141,9 +149,6 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
141
149
|
try {
|
|
142
150
|
formData.shallowMerge(requestPassThroughParams, true, true);
|
|
143
151
|
} finally {
|
|
144
|
-
// unfortunately as long as we support
|
|
145
|
-
// both namespaces we have to keep manual control
|
|
146
|
-
// on the key renaming before doing ops like deep copy
|
|
147
152
|
this.requestContext.$nspEnabled = true;
|
|
148
153
|
requestPassThroughParams.$nspEnabled = true;
|
|
149
154
|
}
|
|
@@ -151,15 +156,15 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
151
156
|
this.responseContext = requestPassThroughParams.deepCopy;
|
|
152
157
|
|
|
153
158
|
// we have to shift the internal passthroughs around to build up our response context
|
|
154
|
-
|
|
159
|
+
let responseContext = this.responseContext;
|
|
155
160
|
|
|
156
161
|
responseContext.assign(CTX_PARAM_MF_INTERNAL).value = this.internalContext.value;
|
|
157
162
|
|
|
158
|
-
// per spec the
|
|
163
|
+
// per spec the onevent and onerror handlers must be passed through to the response
|
|
159
164
|
responseContext.assign(ON_EVENT).value = requestContext.getIf(ON_EVENT).value;
|
|
160
165
|
responseContext.assign(ON_ERROR).value = requestContext.getIf(ON_ERROR).value;
|
|
161
166
|
|
|
162
|
-
xhrObject.open(this.ajaxType, resolveFinalUrl(sourceForm, formData, this.ajaxType), true);
|
|
167
|
+
xhrObject.open(this.ajaxType, resolveFinalUrl(this.sourceForm, formData, this.ajaxType), true);
|
|
163
168
|
|
|
164
169
|
// adding timeout
|
|
165
170
|
this.timeout ? xhrObject.timeout = this.timeout : null;
|
|
@@ -189,15 +194,40 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
189
194
|
|
|
190
195
|
cancel() {
|
|
191
196
|
try {
|
|
192
|
-
// this causes onError to be called where the error
|
|
193
|
-
// handling takes over
|
|
194
197
|
this.xhrObject.abort();
|
|
195
198
|
} catch (e) {
|
|
196
199
|
this.handleError(e);
|
|
197
200
|
}
|
|
198
201
|
}
|
|
199
202
|
|
|
203
|
+
resolve(data: any) {
|
|
204
|
+
Stream.of(...this.thenFunctions).reduce((inputVal: any, thenFunc: any) => {
|
|
205
|
+
return thenFunc(inputVal);
|
|
206
|
+
}, data);
|
|
207
|
+
}
|
|
200
208
|
|
|
209
|
+
reject(data: any) {
|
|
210
|
+
Stream.of(...this.catchFunctions).reduce((inputVal: any, catchFunc: any) => {
|
|
211
|
+
return catchFunc(inputVal);
|
|
212
|
+
}, data);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
catch(func: (data: any) => any): AsyncRunnable<XMLHttpRequest> {
|
|
216
|
+
this.catchFunctions.push(func);
|
|
217
|
+
return this;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
finally(func: () => void): AsyncRunnable<XMLHttpRequest> {
|
|
221
|
+
// no ie11 support we probably are going to revert to shims for that one
|
|
222
|
+
this.catchFunctions.push(func);
|
|
223
|
+
this.thenFunctions.push(func);
|
|
224
|
+
return this;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
then(func: (data: any) => any): AsyncRunnable<XMLHttpRequest> {
|
|
228
|
+
this.thenFunctions.push(func);
|
|
229
|
+
return this;
|
|
230
|
+
}
|
|
201
231
|
|
|
202
232
|
/**
|
|
203
233
|
* attaches the internal event and processing
|
|
@@ -207,7 +237,7 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
207
237
|
* @param reject
|
|
208
238
|
*/
|
|
209
239
|
private registerXhrCallbacks(resolve: Consumer<any>, reject: Consumer<any>) {
|
|
210
|
-
|
|
240
|
+
let xhrObject = this.xhrObject;
|
|
211
241
|
|
|
212
242
|
xhrObject.onabort = () => {
|
|
213
243
|
this.onAbort(reject);
|
|
@@ -223,17 +253,13 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
223
253
|
};
|
|
224
254
|
xhrObject.onerror = (errorData: any) => {
|
|
225
255
|
|
|
226
|
-
// some browsers trigger an error when cancelling a request internally
|
|
227
|
-
// cancel is called from outside
|
|
256
|
+
// some browsers trigger an error when cancelling a request internally
|
|
228
257
|
// in this case we simply ignore the request and clear up the queue, because
|
|
229
258
|
// it is not safe anymore to proceed with the current queue
|
|
230
259
|
// This bypasses a Safari issue where it keeps requests hanging after page unload
|
|
231
260
|
// and then triggers a cancel error on then instead of just stopping
|
|
232
261
|
// and clearing the code
|
|
233
262
|
if(this.isCancelledResponse(this.xhrObject)) {
|
|
234
|
-
/*
|
|
235
|
-
* this triggers the catch chain and after that finally
|
|
236
|
-
*/
|
|
237
263
|
reject();
|
|
238
264
|
this.stopProgress = true;
|
|
239
265
|
return;
|
|
@@ -281,12 +307,14 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
281
307
|
|
|
282
308
|
private handleMalFormedXML(resolve: Function) {
|
|
283
309
|
this.stopProgress = true;
|
|
284
|
-
|
|
310
|
+
let errorData = {
|
|
285
311
|
type: ERROR,
|
|
286
312
|
status: MALFORMEDXML,
|
|
287
313
|
responseCode: 200,
|
|
288
314
|
responseText: this.xhrObject?.responseText,
|
|
289
|
-
|
|
315
|
+
// we remap the element just in case it gets replaced
|
|
316
|
+
// it will be unremapped
|
|
317
|
+
source: this.source.id.value
|
|
290
318
|
};
|
|
291
319
|
try {
|
|
292
320
|
this.handleError(errorData, true);
|
|
@@ -303,22 +331,16 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
303
331
|
if (this.stopProgress) {
|
|
304
332
|
return;
|
|
305
333
|
}
|
|
306
|
-
/**
|
|
307
|
-
* now call the then chain
|
|
308
|
-
*/
|
|
309
334
|
resolve(data);
|
|
310
335
|
}
|
|
311
336
|
|
|
312
337
|
private onError(errorData: any, reject: Consumer<any>) {
|
|
313
338
|
this.handleError(errorData);
|
|
314
|
-
/*
|
|
315
|
-
* this triggers the catch chain and after that finally
|
|
316
|
-
*/
|
|
317
339
|
reject();
|
|
318
340
|
}
|
|
319
341
|
|
|
320
342
|
private sendRequest(formData: XhrFormData) {
|
|
321
|
-
|
|
343
|
+
let isPost = this.ajaxType != REQ_TYPE_GET;
|
|
322
344
|
if (formData.isMultipartRequest) {
|
|
323
345
|
// in case of a multipart request we send in a formData object as body
|
|
324
346
|
this.xhrObject.send((isPost) ? formData.toFormData() : null);
|
|
@@ -332,7 +354,7 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
332
354
|
* other helpers
|
|
333
355
|
*/
|
|
334
356
|
private sendEvent(evtType: string) {
|
|
335
|
-
|
|
357
|
+
let eventData = EventData.createFromRequest(this.xhrObject, this.requestContext, evtType);
|
|
336
358
|
try {
|
|
337
359
|
// User code error, we might cover
|
|
338
360
|
// this in onError, but also we cannot swallow it.
|
|
@@ -344,15 +366,14 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
344
366
|
} catch (e) {
|
|
345
367
|
e.source = e?.source ?? this.requestContext.getIf(SOURCE).value;
|
|
346
368
|
this.handleError(e);
|
|
347
|
-
|
|
348
369
|
throw e;
|
|
349
370
|
}
|
|
350
371
|
}
|
|
351
372
|
|
|
352
373
|
private handleError(exception, responseFormatError: boolean = false) {
|
|
353
|
-
|
|
354
|
-
const eventHandler = resolveHandlerFunc(this.requestContext, this.responseContext, ON_ERROR);
|
|
374
|
+
let errorData = (responseFormatError) ? ErrorData.fromHttpConnection(exception.source, exception.type, exception.status, exception.responseText, exception.responseCode, exception.status) : ErrorData.fromClient(exception);
|
|
355
375
|
|
|
376
|
+
let eventHandler = resolveHandlerFunc(this.requestContext, this.responseContext, ON_ERROR);
|
|
356
377
|
Implementation.sendError(errorData, eventHandler);
|
|
357
378
|
}
|
|
358
379
|
}
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {DQ} from "mona-dish";
|
|
18
|
-
import {ExtLang} from "../impl/util/Lang";
|
|
17
|
+
import {DQ, Stream} from "mona-dish";
|
|
19
18
|
|
|
20
19
|
/**
|
|
21
20
|
* legacy code to enable various aspects
|
|
@@ -29,7 +28,6 @@ import {ExtLang} from "../impl/util/Lang";
|
|
|
29
28
|
* we might move the code over in the future, but for now a straight 1:1 port suffices
|
|
30
29
|
*/
|
|
31
30
|
export module oam {
|
|
32
|
-
import ofAssoc = ExtLang.ofAssoc;
|
|
33
31
|
/**
|
|
34
32
|
* sets a hidden input field
|
|
35
33
|
* @param formName the formName
|
|
@@ -88,8 +86,8 @@ export module oam {
|
|
|
88
86
|
if (window?.myfaces?.core?.config?.autoScroll && (window as any)?.getScrolling) {
|
|
89
87
|
myfaces.oam.setHiddenInput(formName, 'autoScroll', (window as any)?.getScrolling());
|
|
90
88
|
}
|
|
91
|
-
let paramsStream:
|
|
92
|
-
paramsStream.
|
|
89
|
+
let paramsStream: Stream<[string, any]> = Array.isArray(params) ? Stream.of(...params) : Stream.ofAssoc(params);
|
|
90
|
+
paramsStream.each(([key, data]) => myfaces.oam.setHiddenInput(formName, key, data));
|
|
93
91
|
|
|
94
92
|
//we call the namespaced function, to allow decoration, via a direct call we would
|
|
95
93
|
myfaces.oam.setHiddenInput(formName, `${formName}:_idcl`, linkId ?? '');
|
|
@@ -104,6 +102,8 @@ export module oam {
|
|
|
104
102
|
(form.getAsElem(0).value as HTMLFormElement).setAttribute("target", target);
|
|
105
103
|
}
|
|
106
104
|
|
|
105
|
+
|
|
106
|
+
|
|
107
107
|
const result = formElement?.onsubmit?.(null);
|
|
108
108
|
|
|
109
109
|
try {
|
|
@@ -120,7 +120,7 @@ export module oam {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
// noinspection JSUnusedLocalSymbols
|
|
123
|
-
paramsStream.
|
|
123
|
+
paramsStream.each(([key, data]) => {
|
|
124
124
|
myfaces.oam.clearHiddenInput(formName, key);
|
|
125
125
|
});
|
|
126
126
|
myfaces.oam.clearHiddenInput(formName, `${formName}:_idcl`);
|