jsf.js_next_gen 1.0.0-beta-20 → 4.0.0-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/.nyc_output/2303b649-59d9-485c-9228-73b0ec8787a7.json +1 -0
- package/.nyc_output/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +1 -0
- package/.nyc_output/processinfo/2303b649-59d9-485c-9228-73b0ec8787a7.json +1 -0
- package/.nyc_output/processinfo/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/README.md +12 -0
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/functions/{jsf.ajax.addOnError.html → faces.ajax.addOnError.html} +11 -11
- package/dist/docs/functions/{jsf.ajax.addOnEvent.html → faces.ajax.addOnEvent.html} +11 -11
- package/dist/docs/functions/{jsf.ajax.request.html → faces.ajax.request.html} +11 -11
- package/dist/docs/functions/{jsf.ajax.response.html → faces.ajax.response.html} +11 -11
- package/dist/docs/functions/{jsf.getClientWindow.html → faces.getClientWindow.html} +12 -12
- package/dist/docs/functions/{jsf.getProjectStage.html → faces.getProjectStage.html} +13 -13
- package/dist/docs/functions/{jsf.getViewState.html → faces.getViewState.html} +13 -13
- package/dist/docs/functions/{jsf.push.close.html → faces.push.close.html} +10 -10
- package/dist/docs/functions/{jsf.push.init.html → faces.push.init.html} +10 -10
- package/dist/docs/functions/{jsf.push.open.html → faces.push.open.html} +10 -10
- package/dist/docs/functions/{jsf.util.chain.html → faces.util.chain.html} +8 -8
- package/dist/docs/functions/myfaces.ab.html +6 -6
- package/dist/docs/index.html +13 -4
- package/dist/docs/modules/{jsf.ajax.html → faces.ajax.html} +14 -14
- package/dist/docs/modules/{jsf.html → faces.html} +22 -22
- package/dist/docs/modules/{jsf.push.html → faces.push.html} +12 -12
- package/dist/docs/modules/{jsf.util.html → faces.util.html} +8 -8
- package/dist/docs/modules/myfaces.html +4 -4
- package/dist/docs/modules.html +5 -5
- package/dist/docs/variables/{jsf.implversion.html → faces.implversion.html} +12 -12
- package/dist/docs/variables/{jsf.separatorchar.html → faces.separatorchar.html} +12 -12
- package/dist/docs/variables/{jsf.specversion.html → faces.specversion.html} +13 -13
- package/dist/docs/variables/myfaces.oam.html +4 -4
- package/dist/window/faces-development.js +7695 -0
- 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 -0
- package/dist/window/faces.js +2 -0
- package/dist/window/faces.js.br +0 -0
- package/dist/window/faces.js.gz +0 -0
- package/dist/window/faces.js.map +1 -0
- package/dist/window/jsf-development.js +192 -102
- 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 +2 -2
- package/src/main/types/typedefs.d.ts +2 -0
- package/src/main/typescript/api/{Jsf.ts → faces.ts} +14 -10
- package/src/main/typescript/api/jsf.ts +30 -0
- package/src/main/typescript/impl/AjaxImpl.ts +17 -15
- package/src/main/typescript/impl/PushImpl.ts +3 -3
- package/src/main/typescript/impl/core/Const.ts +52 -14
- package/src/main/typescript/impl/i18n/Messages.ts +1 -1
- package/src/main/typescript/impl/util/Assertions.ts +1 -1
- package/src/main/typescript/impl/util/ExtDomQuery.ts +32 -21
- package/src/main/typescript/impl/xhrCore/EventData.ts +2 -1
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +1 -1
- package/src/main/typescript/impl/xhrCore/Response.ts +2 -2
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +4 -2
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +2 -2
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +4 -5
- package/src/main/typescript/myfaces/OamSubmit.ts +0 -1
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +58 -27
- package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +4 -4
- package/src/main/typescript/test/impl/ImplTest.spec.ts +12 -12
- package/src/main/typescript/test/impl/ImplTest_23.spec.ts +134 -0
- package/src/main/typescript/test/impl/SeparatorCharsTest.spec.ts +6 -3
- package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +1 -1
- package/src/main/typescript/test/xhrCore/EventTests.spec.ts +7 -7
- package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +5 -5
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +22 -22
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +11 -11
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +26 -26
- package/src/main/typescript/test/xhrCore/ShadowDomTest.spec.ts +3 -5
- package/src/main/typescript/test/xhrCore/WebsocketTest.ts +8 -8
- package/src/main/typescript/tsconfig-typedoc.json +1 -1
- package/src/test/resources/jsf-development.js +1 -1
- package/target/api/Jsf.js +16 -244
- package/target/api/Jsf.js.map +1 -1
- package/target/api/faces.js +265 -0
- package/target/api/faces.js.map +1 -0
- package/target/impl/AjaxImpl.js +14 -13
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/PushImpl.js +3 -3
- package/target/impl/PushImpl.js.map +1 -1
- package/target/impl/core/Const.js +51 -14
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/i18n/Messages.js +1 -1
- package/target/impl/i18n/Messages.js.map +1 -1
- package/target/impl/util/Assertions.js +1 -1
- package/target/impl/util/Assertions.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +27 -16
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/xhrCore/EventData.js +2 -1
- package/target/impl/xhrCore/EventData.js.map +1 -1
- package/target/impl/xhrCore/RequestDataResolver.js +1 -1
- package/target/impl/xhrCore/Response.js +2 -2
- package/target/impl/xhrCore/ResponseProcessor.js +10 -10
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +2 -2
- package/target/impl/xhrCore/XhrRequest.js +4 -3
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +0 -1
- package/target/myfaces/OamSubmit.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +63 -25
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js +4 -4
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
- package/target/test/impl/ImplTest.spec.js +53 -12
- package/target/test/impl/ImplTest.spec.js.map +1 -1
- package/target/test/impl/ImplTest_23.spec.js +165 -0
- package/target/test/impl/ImplTest_23.spec.js.map +1 -0
- package/target/test/impl/ImplTest_23.spec_.js +165 -0
- package/target/test/impl/ImplTest_23.spec_.js.map +1 -0
- package/target/test/impl/SeparatorCharsTest.spec.js +6 -2
- package/target/test/impl/SeparatorCharsTest.spec.js.map +1 -1
- package/target/test/queue/AsynchronousQueueTest.spec.js +1 -1
- package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
- package/target/test/xhrCore/EventTests.spec.js +6 -6
- package/target/test/xhrCore/EventTests.spec.js.map +1 -1
- package/target/test/xhrCore/FileUploadTest.spec.js +4 -4
- package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +22 -22
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +10 -10
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +21 -21
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/ShadowDomTest.spec.js +2 -3
- package/target/test/xhrCore/ShadowDomTest.spec.js.map +1 -1
- package/target/test/xhrCore/WebsocketTest.js +7 -7
- package/target/test/xhrCore/WebsocketTest.js.map +1 -1
- package/webpack.config.js +7 -4
- package/webpack.config.js.map +1 -1
- package/webpack.config.ts +7 -4
- package/integrationdeploy.cmd +0 -4
- package/integrationsdeploy.sh +0 -5
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsf.js_next_gen",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta-2",
|
|
4
4
|
"description": "A next generation typescript reimplementation of jsf.js",
|
|
5
|
-
"main": "dist/window/
|
|
5
|
+
"main": "dist/window/faces.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"doc": "npx typedoc --tsconfig src/main/typescript/tsconfig-typedoc.json",
|
|
8
8
|
"test": "env TS_NODE_PROJECT=./src/main/typescript/tsconfig.json mocha",
|
|
@@ -23,13 +23,13 @@ import {oam as _oam} from "../myfaces/OamSubmit";
|
|
|
23
23
|
|
|
24
24
|
//declare const Implementation: any;
|
|
25
25
|
|
|
26
|
-
export module
|
|
26
|
+
export module faces {
|
|
27
27
|
"use strict";
|
|
28
28
|
|
|
29
29
|
/*
|
|
30
|
-
* Version of the implementation for the
|
|
30
|
+
* Version of the implementation for the faces.js.
|
|
31
31
|
* <p />
|
|
32
|
-
* as specified within the jsf specifications
|
|
32
|
+
* as specified within the jsf specifications faces.html:
|
|
33
33
|
* <ul>
|
|
34
34
|
* <li>left two digits major release number</li>
|
|
35
35
|
* <li>middle two digits minor spec release number</li>
|
|
@@ -37,7 +37,7 @@ export module jsf {
|
|
|
37
37
|
* </ul>
|
|
38
38
|
* @constant
|
|
39
39
|
*/
|
|
40
|
-
export var specversion =
|
|
40
|
+
export var specversion = 400000;
|
|
41
41
|
/**
|
|
42
42
|
* Implementation version as specified within the jsf specification.
|
|
43
43
|
* <p />
|
|
@@ -67,7 +67,7 @@ export module jsf {
|
|
|
67
67
|
* </li>
|
|
68
68
|
*
|
|
69
69
|
* @return {String} the current project state emitted by the server side method:
|
|
70
|
-
* <i>
|
|
70
|
+
* <i>jakarta.faces.application.Application.getProjectStage()</i>
|
|
71
71
|
*/
|
|
72
72
|
export function getProjectStage(): string {
|
|
73
73
|
return Implementation.getProjectStage();
|
|
@@ -75,7 +75,7 @@ export module jsf {
|
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* collect and encode data for a given form element (must be of type form)
|
|
78
|
-
* find the
|
|
78
|
+
* find the jakarta.faces.ViewState element and encode its value as well!
|
|
79
79
|
* return a concatenated string of the encoded values!
|
|
80
80
|
*
|
|
81
81
|
* @throws an exception in case of the given element not being of type form!
|
|
@@ -233,14 +233,18 @@ export module myfaces {
|
|
|
233
233
|
*
|
|
234
234
|
* @param source the event source
|
|
235
235
|
* @param event the event
|
|
236
|
-
* @param eventName event name for java.
|
|
237
|
-
* @param execute execute list as passed down in
|
|
236
|
+
* @param eventName event name for java.jakarta.faces.behavior.evemnt
|
|
237
|
+
* @param execute execute list as passed down in faces.ajax.request
|
|
238
238
|
* @param render
|
|
239
239
|
* @param options
|
|
240
240
|
*/
|
|
241
241
|
export function ab(source: Element, event: Event, eventName: string, execute: string, render: string, options: Context = {}) {
|
|
242
242
|
if (eventName) {
|
|
243
|
-
|
|
243
|
+
if(!(window as any)?.jsf) {
|
|
244
|
+
options["jakarta.faces.behavior.event"] = eventName;
|
|
245
|
+
} else {
|
|
246
|
+
options["javax.faces.behavior.event"] = eventName;
|
|
247
|
+
}
|
|
244
248
|
}
|
|
245
249
|
if (execute) {
|
|
246
250
|
options["execute"] = execute;
|
|
@@ -249,7 +253,7 @@ export module myfaces {
|
|
|
249
253
|
options["render"] = render;
|
|
250
254
|
}
|
|
251
255
|
|
|
252
|
-
|
|
256
|
+
faces.ajax.request(source, event, options);
|
|
253
257
|
}
|
|
254
258
|
|
|
255
259
|
/**
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
3
|
+
* this work for additional information regarding copyright ownership.
|
|
4
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
5
|
+
* (the "License"); you may not use this file except in compliance with
|
|
6
|
+
* the License. You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import {faces} from "./faces";
|
|
17
|
+
import {remapNamespacesFor23} from "../impl/core/Const";
|
|
18
|
+
|
|
19
|
+
declare const window: any;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* jsf.js back compatibility shim layer
|
|
23
|
+
* the entire namespace for jsf and javax still is provided
|
|
24
|
+
*/
|
|
25
|
+
if(!window.jsf) {
|
|
26
|
+
window['jsf'] = (window as any)?.jsf ?? faces;
|
|
27
|
+
window.jsf.specversion = 230000;
|
|
28
|
+
remapNamespacesFor23();
|
|
29
|
+
}
|
|
30
|
+
export var jsf = window.jsf;
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
} from "./xhrCore/RequestDataResolver";
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
declare var
|
|
62
|
+
declare var faces: any;
|
|
63
63
|
|
|
64
64
|
/*
|
|
65
65
|
* allowed project stages
|
|
@@ -149,7 +149,7 @@ export module Implementation {
|
|
|
149
149
|
import getGlobalConfig = ExtLang.getGlobalConfig;
|
|
150
150
|
import assert = Assertions.assert;
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
declare const window: any;
|
|
153
153
|
|
|
154
154
|
let projectStage: string = null;
|
|
155
155
|
let separator: string = null;
|
|
@@ -185,7 +185,7 @@ export module Implementation {
|
|
|
185
185
|
/**
|
|
186
186
|
* @return the project stage also emitted by the server:
|
|
187
187
|
* it cannot be cached and must be delivered over the server
|
|
188
|
-
* The value for it comes from the requestInternal parameter of the
|
|
188
|
+
* The value for it comes from the requestInternal parameter of the faces.js script called "stage".
|
|
189
189
|
*/
|
|
190
190
|
export function getProjectStage(): string | null {
|
|
191
191
|
return resolveGlobalConfig()?.projectStage ??
|
|
@@ -199,13 +199,13 @@ export module Implementation {
|
|
|
199
199
|
*/
|
|
200
200
|
export function resolveProjectStateFromURL(): string | null {
|
|
201
201
|
|
|
202
|
-
/* run through all script tags and try to find the one that includes
|
|
202
|
+
/* run through all script tags and try to find the one that includes faces.js */
|
|
203
203
|
const foundStage = ExtDomquery.searchJsfJsFor(/stage=([^&;]*)/).value as string;
|
|
204
204
|
return (foundStage in ProjectStages) ? foundStage : null;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
/**
|
|
208
|
-
* implementation of the
|
|
208
|
+
* implementation of the faces.util.chain functionality
|
|
209
209
|
*
|
|
210
210
|
* @param source
|
|
211
211
|
* @param event
|
|
@@ -270,6 +270,7 @@ export module Implementation {
|
|
|
270
270
|
const timeout: number = resolveTimeout(options);
|
|
271
271
|
|
|
272
272
|
requestCtx.assignIf(!!windowId, P_WINDOW_ID).value = windowId;
|
|
273
|
+
|
|
273
274
|
requestCtx.assign(CTX_PARAM_PASS_THR).value = filterPassthroughValues(options.value);
|
|
274
275
|
requestCtx.assignIf(!!resolvedEvent, CTX_PARAM_PASS_THR, P_EVT).value = resolvedEvent?.type;
|
|
275
276
|
|
|
@@ -293,18 +294,18 @@ export module Implementation {
|
|
|
293
294
|
requestCtx.assign(MYFACES).value = options.value?.myfaces;
|
|
294
295
|
|
|
295
296
|
/**
|
|
296
|
-
* binding contract the
|
|
297
|
+
* binding contract the jakarta.faces.source must be set
|
|
297
298
|
*/
|
|
298
299
|
requestCtx.assign(CTX_PARAM_PASS_THR, P_PARTIAL_SOURCE).value = elementId;
|
|
299
300
|
|
|
300
301
|
/**
|
|
301
|
-
*
|
|
302
|
+
* jakarta.faces.partial.ajax must be set to true
|
|
302
303
|
*/
|
|
303
304
|
requestCtx.assign(CTX_PARAM_PASS_THR, P_AJAX).value = true;
|
|
304
305
|
|
|
305
306
|
/**
|
|
306
307
|
* if resetValues is set to true
|
|
307
|
-
* then we have to set
|
|
308
|
+
* then we have to set jakarta.faces.resetValues as well
|
|
308
309
|
* as pass through parameter
|
|
309
310
|
* the value has to be explicitly true, according to
|
|
310
311
|
* the specs jsdoc
|
|
@@ -435,7 +436,7 @@ export module Implementation {
|
|
|
435
436
|
}
|
|
436
437
|
|
|
437
438
|
/**
|
|
438
|
-
* @node optional element or id defining a rootnode where an element with the id "
|
|
439
|
+
* @node optional element or id defining a rootnode where an element with the id "jakarta.faces.windowId" is hosted
|
|
439
440
|
* @return the client window id of the current window, if one is given if none is found, null is returned
|
|
440
441
|
*/
|
|
441
442
|
export function getClientWindow(node ?: Element | string): string | null {
|
|
@@ -496,7 +497,7 @@ export module Implementation {
|
|
|
496
497
|
|
|
497
498
|
/**
|
|
498
499
|
* collect and encode data for a given form element (must be of type form)
|
|
499
|
-
* find the
|
|
500
|
+
* find the jakarta.faces.ViewState element and encode its value as well!
|
|
500
501
|
* @return a concatenated string of the encoded values!
|
|
501
502
|
*
|
|
502
503
|
* @throws Error in case of the given element not being of type form!
|
|
@@ -543,10 +544,10 @@ export module Implementation {
|
|
|
543
544
|
*
|
|
544
545
|
* This function does it for the render parameters
|
|
545
546
|
*
|
|
546
|
-
* @param requestOptions the source options coming in as options object from
|
|
547
|
+
* @param requestOptions the source options coming in as options object from faces.ajax.request (options parameter)
|
|
547
548
|
* @param targetContext the receiving target context
|
|
548
549
|
* @param issuingForm the issuing form
|
|
549
|
-
* @param sourceElementId the executing element triggering the
|
|
550
|
+
* @param sourceElementId the executing element triggering the faces.ajax.request (id of it)
|
|
550
551
|
*/
|
|
551
552
|
function assignRender(requestOptions: Config, targetContext: Config, issuingForm: DQ, sourceElementId: string) {
|
|
552
553
|
if (requestOptions.getIf(RENDER).isPresent()) {
|
|
@@ -561,10 +562,10 @@ export module Implementation {
|
|
|
561
562
|
*
|
|
562
563
|
* This function does it for the execute parameters
|
|
563
564
|
*
|
|
564
|
-
* @param requestOptions the source options coming in as options object from
|
|
565
|
+
* @param requestOptions the source options coming in as options object from faces.ajax.request (options parameter)
|
|
565
566
|
* @param targetContext the receiving target context
|
|
566
567
|
* @param issuingForm the issuing form
|
|
567
|
-
* @param sourceElementId the executing element triggering the
|
|
568
|
+
* @param sourceElementId the executing element triggering the faces.ajax.request (id of it)
|
|
568
569
|
*/
|
|
569
570
|
function assignExecute(requestOptions: Config, targetContext: Config, issuingForm: DQ, sourceElementId: string) {
|
|
570
571
|
|
|
@@ -587,7 +588,8 @@ export module Implementation {
|
|
|
587
588
|
* @param targetContext the target context receiving the value
|
|
588
589
|
*/
|
|
589
590
|
function assignClientWindowId(form: DQ, targetContext: Config) {
|
|
590
|
-
|
|
591
|
+
|
|
592
|
+
let clientWindow = (window?.faces ?? window?.jsf).getClientWindow(form.getAsElem(0).value);
|
|
591
593
|
if (clientWindow) {
|
|
592
594
|
targetContext.assign(CTX_PARAM_PASS_THR, P_CLIENT_WINDOW).value = clientWindow;
|
|
593
595
|
}
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Typescript port of the
|
|
18
|
+
* Typescript port of the faces.push part in the myfaces implementation
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
//TODO still work in progress
|
|
22
22
|
//this is a 1:1 port for the time being
|
|
23
|
-
import {jsf} from "../api/Jsf";
|
|
24
23
|
import {MAX_RECONNECT_ATTEMPTS, REASON_EXPIRED, RECONNECT_INTERVAL} from "./core/Const";
|
|
25
24
|
|
|
25
|
+
declare const window: any;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Implementation class for the push functionality
|
|
@@ -99,7 +99,7 @@ export module PushImpl {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
if (autoconnect) {
|
|
102
|
-
jsf.push.open(socketClientId);
|
|
102
|
+
(window?.faces ?? window?.jsf).push.open(socketClientId);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
/*
|
|
18
18
|
* [export const] constants
|
|
19
19
|
*/
|
|
20
|
+
export let P_PARTIAL_SOURCE = "jakarta.faces.source";
|
|
21
|
+
export let PARTIAL_ID = "partialId";
|
|
22
|
+
export let P_VIEWSTATE = "jakarta.faces.ViewState";
|
|
23
|
+
export let P_VIEWROOT = "jakarta.faces.ViewRoot";
|
|
24
|
+
export let P_VIEWHEAD = "jakarta.faces.ViewHead";
|
|
25
|
+
export let P_VIEWBODY = "jakarta.faces.ViewBody";
|
|
20
26
|
|
|
21
|
-
export const P_PARTIAL_SOURCE = "javax.faces.source";
|
|
22
|
-
export const PARTIAL_ID = "partialId";
|
|
23
|
-
export const P_VIEWSTATE = "javax.faces.ViewState";
|
|
24
|
-
export const P_VIEWROOT = "javax.faces.ViewRoot";
|
|
25
|
-
export const P_VIEWHEAD = "javax.faces.ViewHead";
|
|
26
|
-
export const P_VIEWBODY = "javax.faces.ViewBody";
|
|
27
27
|
|
|
28
28
|
/*some useful definitions*/
|
|
29
29
|
|
|
@@ -42,14 +42,14 @@ export const IDENT_THIS = "@this";
|
|
|
42
42
|
export const IDENT_FORM = "@form";
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
export
|
|
46
|
-
export
|
|
47
|
-
export
|
|
48
|
-
export
|
|
49
|
-
export
|
|
50
|
-
export
|
|
45
|
+
export let P_AJAX = "jakarta.faces.partial.ajax";
|
|
46
|
+
export let P_EXECUTE = "jakarta.faces.partial.execute";
|
|
47
|
+
export let P_RENDER = "jakarta.faces.partial.render";
|
|
48
|
+
export let P_EVT = "jakarta.faces.partial.event";
|
|
49
|
+
export let P_CLIENT_WINDOW = "jakarta.faces.ClientWindow";
|
|
50
|
+
export let P_RESET_VALUES = "jakarta.faces.partial.resetValues";
|
|
51
|
+
export let P_WINDOW_ID = "jakarta.faces.windowId";
|
|
51
52
|
|
|
52
|
-
export const P_WINDOW_ID = "javax.faces.windowId";
|
|
53
53
|
|
|
54
54
|
export const RENDER = "render";
|
|
55
55
|
export const WINDOW_ID = "windowId";
|
|
@@ -103,7 +103,7 @@ export const CONTENT_TYPE = "Content-Type";
|
|
|
103
103
|
export const HEAD_FACES_REQ = "Faces-Request";
|
|
104
104
|
export const REQ_ACCEPT = "Accept";
|
|
105
105
|
export const VAL_AJAX = "partial/ajax";
|
|
106
|
-
export
|
|
106
|
+
export let ENCODED_URL = "jakarta.faces.encodedURL";
|
|
107
107
|
export const REQ_TYPE_GET = "GET";
|
|
108
108
|
export const REQ_TYPE_POST = "POST";
|
|
109
109
|
export const STATE_EVT_BEGIN = "begin"; //TODO remove this
|
|
@@ -171,3 +171,41 @@ export const RECONNECT_INTERVAL = 500;
|
|
|
171
171
|
export const MAX_RECONNECT_ATTEMPTS = 25;
|
|
172
172
|
|
|
173
173
|
export const UNKNOWN = "UNKNOWN";
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* helper to remap the namespaces variables for 2.3
|
|
178
|
+
* from 2.3 to 4.0 every javax namespace has been changed
|
|
179
|
+
* to faces
|
|
180
|
+
*/
|
|
181
|
+
export function remapNamespacesFor23() {
|
|
182
|
+
P_PARTIAL_SOURCE = "javax.faces.source";
|
|
183
|
+
P_VIEWSTATE = "javax.faces.ViewState";
|
|
184
|
+
P_VIEWROOT = "javax.faces.ViewRoot";
|
|
185
|
+
P_VIEWHEAD = "javax.faces.ViewHead";
|
|
186
|
+
P_VIEWBODY = "javax.faces.ViewBody";
|
|
187
|
+
P_AJAX = "javax.faces.partial.ajax";
|
|
188
|
+
P_EXECUTE = "javax.faces.partial.execute";
|
|
189
|
+
P_RENDER = "javax.faces.partial.render";
|
|
190
|
+
P_EVT = "javax.faces.partial.event";
|
|
191
|
+
P_CLIENT_WINDOW = "javax.faces.ClientWindow";
|
|
192
|
+
P_RESET_VALUES = "javax.faces.partial.resetValues";
|
|
193
|
+
P_WINDOW_ID = "javax.faces.windowId";
|
|
194
|
+
ENCODED_URL = "javax.faces.encodedURL";
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export function remapNamespacesFor40() {
|
|
198
|
+
P_PARTIAL_SOURCE = "jakarta.faces.source";
|
|
199
|
+
P_VIEWSTATE = "jakarta.faces.ViewState";
|
|
200
|
+
P_VIEWROOT = "jakarta.faces.ViewRoot";
|
|
201
|
+
P_VIEWHEAD = "jakarta.faces.ViewHead";
|
|
202
|
+
P_VIEWBODY = "jakarta.faces.ViewBody";
|
|
203
|
+
P_AJAX = "jakarta.faces.partial.ajax";
|
|
204
|
+
P_EXECUTE = "jakarta.faces.partial.execute";
|
|
205
|
+
P_RENDER = "jakarta.faces.partial.render";
|
|
206
|
+
P_EVT = "jakarta.faces.partial.event";
|
|
207
|
+
P_CLIENT_WINDOW = "jakarta.faces.ClientWindow";
|
|
208
|
+
P_RESET_VALUES = "jakarta.faces.partial.resetValues";
|
|
209
|
+
P_WINDOW_ID = "jakarta.faces.windowId";
|
|
210
|
+
ENCODED_URL = "jakarta.faces.encodedURL";
|
|
211
|
+
}
|
|
@@ -43,7 +43,7 @@ export class Messages {
|
|
|
43
43
|
/** @constant */
|
|
44
44
|
ERR_FORM = "Sourceform could not be determined, either because element is not attached to a form or we have multiple forms with named elements of the same identifier or name, stopping the ajax processing";
|
|
45
45
|
/** @constant */
|
|
46
|
-
ERR_VIEWSTATE = "
|
|
46
|
+
ERR_VIEWSTATE = "faces.viewState= param value not of type form!";
|
|
47
47
|
/** @constant */
|
|
48
48
|
ERR_TRANSPORT = "Transport type {0} does not exist";
|
|
49
49
|
/** @constant */
|
|
@@ -43,7 +43,7 @@ export module Assertions {
|
|
|
43
43
|
assertFunction(options.getIf(ON_EVENT).value);
|
|
44
44
|
//improve the error messages if an empty elem is passed
|
|
45
45
|
//Assertions.assertElementExists(elem);
|
|
46
|
-
assert(elem.isPresent(), getMessage("ERR_MUST_BE_PROVIDED1", "{0}: source must be provided or exist", "source element id"), "
|
|
46
|
+
assert(elem.isPresent(), getMessage("ERR_MUST_BE_PROVIDED1", "{0}: source must be provided or exist", "source element id"), "faces.ajax.request", "ArgNotSet", )
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export function assertUrlExists(node: XMLQuery): void | never {
|
|
@@ -20,29 +20,40 @@ declare let window: any;
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* detects whether a source is a
|
|
23
|
+
* detects whether a source is a faces.js request
|
|
24
24
|
*
|
|
25
|
-
* @param source the source string for the
|
|
26
|
-
* @return true if a
|
|
25
|
+
* @param source the source string for the faces.js request
|
|
26
|
+
* @return true if a faces.js loading pattern is detected
|
|
27
27
|
* @constructor
|
|
28
28
|
*/
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
source?.search(/\/jsf
|
|
29
|
+
const IS_FACES_SOURCE = (source?: string): boolean => {
|
|
30
|
+
//spec version smaller 4 we have to deal with the jsf namespace
|
|
31
|
+
if (window.jsf) {
|
|
32
|
+
// fallback into 2.3 api level
|
|
33
|
+
return source && !!(source?.search(/\/javax\.faces\.resource.*\/jsf\.js.*/) != -1 ||
|
|
34
|
+
source?.search(/\/jsf-development\.js.*/) != -1 ||
|
|
35
|
+
source?.search(/\/jsf-uncompressed\.js.*/) != -1 ||
|
|
36
|
+
source?.search(/\/jsf[^.]*\.js.*ln=javax.faces.*/gi) != -1);
|
|
37
|
+
}
|
|
38
|
+
return source && !!(source?.search(/\/jakarta\.faces\.resource.*\/faces\.js.*/) != -1 ||
|
|
39
|
+
source?.search(/\/faces-development\.js.*/) != -1 ||
|
|
40
|
+
source?.search(/\/faces-uncompressed\.js.*/) != -1 ||
|
|
41
|
+
source?.search(/\/faces[^.]*\.js.*ln=jakarta.faces.*/gi) != -1);
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
/**
|
|
37
45
|
* namespace myfaces.testscripts can be used as extension point for internal
|
|
38
|
-
* tests, those will be handled similarly to
|
|
46
|
+
* tests, those will be handled similarly to faces.js regarding
|
|
39
47
|
* reload blocking on ajax requests
|
|
40
48
|
*
|
|
41
49
|
* @param source the source to check
|
|
42
50
|
* @constructor
|
|
43
51
|
*/
|
|
44
52
|
const IS_INTERNAL_SOURCE = (source: string): boolean => {
|
|
45
|
-
|
|
53
|
+
if (window?.jsf) {
|
|
54
|
+
return source.search(/\/jsf[^.]*\.js.*ln=myfaces.testscripts.*/gi) != -1;
|
|
55
|
+
}
|
|
56
|
+
return source.search(/\/faces[^.]*\.js.*ln=myfaces.testscripts.*/gi) != -1;
|
|
46
57
|
}
|
|
47
58
|
|
|
48
59
|
|
|
@@ -82,7 +93,7 @@ export class ExtDomquery extends DQ {
|
|
|
82
93
|
//byId ($)
|
|
83
94
|
if (this.value.isPresent()) {
|
|
84
95
|
let result = this.querySelectorAll("form input[name='" + P_WINDOW_ID + "']");
|
|
85
|
-
if (result.length >
|
|
96
|
+
if (result.length > 1) {
|
|
86
97
|
throw Error("Multiple different windowIds found in document");
|
|
87
98
|
}
|
|
88
99
|
|
|
@@ -93,7 +104,7 @@ export class ExtDomquery extends DQ {
|
|
|
93
104
|
}
|
|
94
105
|
|
|
95
106
|
/*
|
|
96
|
-
* determines the
|
|
107
|
+
* determines the faces.js nonce and adds them to the namespace
|
|
97
108
|
* this is done once and only lazily
|
|
98
109
|
*/
|
|
99
110
|
get nonce(): string | null {
|
|
@@ -116,7 +127,7 @@ export class ExtDomquery extends DQ {
|
|
|
116
127
|
.querySelectorAll("script[src], link[src]")
|
|
117
128
|
.lazyStream
|
|
118
129
|
.filter((item) => item.attr("nonce").value != null && item.attr(ATTR_SRC) != null)
|
|
119
|
-
.map(item =>
|
|
130
|
+
.map(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value))
|
|
120
131
|
.first();
|
|
121
132
|
|
|
122
133
|
if (nonceScript.isPresent()) {
|
|
@@ -130,19 +141,19 @@ export class ExtDomquery extends DQ {
|
|
|
130
141
|
}
|
|
131
142
|
|
|
132
143
|
/**
|
|
133
|
-
* searches the embedded
|
|
144
|
+
* searches the embedded faces.js for items like separator char etc..
|
|
134
145
|
* expects a match as variable under position 1 in the result match
|
|
135
146
|
* @param rexp
|
|
136
147
|
*/
|
|
137
148
|
searchJsfJsFor(rexp: RegExp): Optional<string> {
|
|
138
149
|
//perfect application for lazy stream
|
|
139
150
|
return DQ.querySelectorAll("script[src], link[src]").lazyStream
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
151
|
+
.filter(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value))
|
|
152
|
+
.map(item => item.attr(ATTR_SRC).value.match(rexp))
|
|
153
|
+
.filter(item => item != null && item.length > 1)
|
|
154
|
+
.map((result: string[]) => {
|
|
155
|
+
return decodeURIComponent(result[1]);
|
|
156
|
+
}).first();
|
|
146
157
|
}
|
|
147
158
|
|
|
148
159
|
globalEval(code: string, nonce ?: string): DQ {
|
|
@@ -156,7 +167,7 @@ export class ExtDomquery extends DQ {
|
|
|
156
167
|
*/
|
|
157
168
|
runScripts(whilteListed?: (src: string) => boolean): DomQuery {
|
|
158
169
|
const whitelistFunc = (src: string): boolean => {
|
|
159
|
-
return (whilteListed?.(src) ?? true) && !
|
|
170
|
+
return (whilteListed?.(src) ?? true) && !IS_FACES_SOURCE(src) && !IS_INTERNAL_SOURCE(src);
|
|
160
171
|
};
|
|
161
172
|
return super.runScripts(whitelistFunc);
|
|
162
173
|
}
|
|
@@ -33,7 +33,8 @@ export class EventData {
|
|
|
33
33
|
|
|
34
34
|
let sourceId: string = context.getIf(SOURCE)
|
|
35
35
|
.orElseLazy(() => context.getIf(P_PARTIAL_SOURCE).value)
|
|
36
|
-
.orElseLazy(() => context.getIf(CTX_PARAM_PASS_THR, P_PARTIAL_SOURCE).value)
|
|
36
|
+
.orElseLazy(() => context.getIf(CTX_PARAM_PASS_THR, P_PARTIAL_SOURCE).value)
|
|
37
|
+
.value;
|
|
37
38
|
if (sourceId) {
|
|
38
39
|
eventData.source = DQ.byId(sourceId, true).first().value.value;
|
|
39
40
|
}
|
|
@@ -131,7 +131,7 @@ export function getEventTarget(evt: Event): Element {
|
|
|
131
131
|
/**
|
|
132
132
|
* resolves a bunch of default values
|
|
133
133
|
* which can be further processed from the given
|
|
134
|
-
* call parameters of
|
|
134
|
+
* call parameters of faces.ajax.request
|
|
135
135
|
*
|
|
136
136
|
* @param event
|
|
137
137
|
* @param opts
|
|
@@ -45,8 +45,8 @@ export module Response {
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
* Standardized
|
|
49
|
-
* this one is called straight from
|
|
48
|
+
* Standardized faces.js response
|
|
49
|
+
* this one is called straight from faces.js.response
|
|
50
50
|
*
|
|
51
51
|
* The processing follows the spec by going for the responseXML
|
|
52
52
|
* and processing its tags
|
|
@@ -55,6 +55,8 @@ import {
|
|
|
55
55
|
import trim = Lang.trim;
|
|
56
56
|
import {ExtDomquery} from "../util/ExtDomQuery";
|
|
57
57
|
|
|
58
|
+
declare const window: any;
|
|
59
|
+
|
|
58
60
|
/**
|
|
59
61
|
* Response processor
|
|
60
62
|
*
|
|
@@ -438,7 +440,7 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
438
440
|
* @returns true of it ii
|
|
439
441
|
*/
|
|
440
442
|
private static isViewStateNode(node: XMLQuery): boolean {
|
|
441
|
-
let separatorChar = (
|
|
443
|
+
let separatorChar = (window?.faces ?? window?.jsf).separatorchar;
|
|
442
444
|
return "undefined" != typeof node?.id?.value && (node?.id?.value == P_VIEWSTATE ||
|
|
443
445
|
node?.id?.value?.indexOf([separatorChar, P_VIEWSTATE].join(EMPTY_STR)) != -1 ||
|
|
444
446
|
node?.id?.value?.indexOf([P_VIEWSTATE, separatorChar].join(EMPTY_STR)) != -1);
|
|
@@ -451,7 +453,7 @@ export class ResponseProcessor implements IResponseProcessor {
|
|
|
451
453
|
* @returns true of it ii
|
|
452
454
|
*/
|
|
453
455
|
private static isClientWindowNode(node: XMLQuery): boolean {
|
|
454
|
-
let separatorChar = (
|
|
456
|
+
let separatorChar = (window?.faces ?? window?.jsf).separatorchar;
|
|
455
457
|
return "undefined" != typeof node?.id?.value && (node?.id?.value == P_CLIENT_WINDOW ||
|
|
456
458
|
node?.id?.value?.indexOf([separatorChar, P_CLIENT_WINDOW].join(EMPTY_STR)) != -1 ||
|
|
457
459
|
node?.id?.value?.indexOf([P_CLIENT_WINDOW, separatorChar].join(EMPTY_STR)) != -1);
|
|
@@ -24,7 +24,7 @@ import isString = Lang.isString;
|
|
|
24
24
|
*
|
|
25
25
|
* We cannot use standard html5 forms everywhere
|
|
26
26
|
* due to api constraints on the HTML Form object in IE11
|
|
27
|
-
* and due to the url encoding constraint given by the
|
|
27
|
+
* and due to the url encoding constraint given by the faces.js spec
|
|
28
28
|
*
|
|
29
29
|
* probably only one needed and one overlay!
|
|
30
30
|
* the entire file input storing probably is redundant now
|
|
@@ -201,7 +201,7 @@ export class XhrFormData extends Config {
|
|
|
201
201
|
/*
|
|
202
202
|
* Spec. 13.3.1
|
|
203
203
|
* Collect and encode input elements.
|
|
204
|
-
* Additionally the hidden element
|
|
204
|
+
* Additionally the hidden element jakarta.faces.ViewState
|
|
205
205
|
* Enhancement partial page submit
|
|
206
206
|
*
|
|
207
207
|
*/
|
|
@@ -46,7 +46,7 @@ import {resolveFinalUrl, resolveHandlerFunc} from "./RequestDataResolver";
|
|
|
46
46
|
import failSaveExecute = ExtLang.failSaveExecute;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* Faces XHR Request Wrapper
|
|
50
50
|
* as Asyncrunnable for our Asynchronous queue
|
|
51
51
|
*
|
|
52
52
|
* The idea is that we basically just enqueue
|
|
@@ -54,8 +54,7 @@ import failSaveExecute = ExtLang.failSaveExecute;
|
|
|
54
54
|
* and let the queue do the processing.
|
|
55
55
|
*
|
|
56
56
|
*/
|
|
57
|
-
|
|
58
|
-
declare let jsf: any;
|
|
57
|
+
declare const window: any;
|
|
59
58
|
|
|
60
59
|
export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
61
60
|
|
|
@@ -118,7 +117,7 @@ export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
|
118
117
|
try {
|
|
119
118
|
|
|
120
119
|
let formElement = this.sourceForm.getAsElem(0).value;
|
|
121
|
-
let viewState = jsf.getViewState(formElement);
|
|
120
|
+
let viewState = (window?.faces ?? window?.jsf).getViewState(formElement);
|
|
122
121
|
//encoded we need to decode
|
|
123
122
|
//We generated a base representation of the current form
|
|
124
123
|
//in case someone has overloaded the viewstate with addtional decorators we merge
|
|
@@ -275,7 +274,7 @@ export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
|
275
274
|
return;
|
|
276
275
|
}
|
|
277
276
|
|
|
278
|
-
jsf.ajax.response(this.xhrObject, this.responseContext.value ?? {});
|
|
277
|
+
(window?.faces ?? window.jsf).ajax.response(this.xhrObject, this.responseContext.value ?? {});
|
|
279
278
|
}
|
|
280
279
|
|
|
281
280
|
private handleMalFormedXML(resolve: Function) {
|