jsf.js_next_gen 4.1.0-beta.2 → 4.1.0-beta.21
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/AI_CONTRIBUTIONS.md +71 -0
- package/README.md +254 -78
- package/api-extractor.faces.json +38 -0
- package/dist/docs/assets/hierarchy.js +1 -1
- package/dist/docs/assets/navigation.js +1 -1
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/functions/faces.ajax.addOnError.html +2 -2
- package/dist/docs/functions/faces.ajax.addOnEvent.html +2 -2
- package/dist/docs/functions/faces.ajax.request.html +2 -2
- package/dist/docs/functions/faces.ajax.response.html +2 -2
- package/dist/docs/functions/faces.getClientWindow.html +2 -2
- package/dist/docs/functions/faces.getProjectStage.html +2 -2
- package/dist/docs/functions/faces.getViewState.html +1 -1
- package/dist/docs/functions/faces.push.close.html +1 -1
- package/dist/docs/functions/faces.push.init.html +6 -6
- package/dist/docs/functions/faces.push.open.html +1 -1
- package/dist/docs/functions/faces.util.chain.html +2 -2
- package/dist/docs/functions/myfaces.ab.html +3 -3
- package/dist/docs/functions/myfaces.onDomReady.html +1 -1
- package/dist/docs/functions/myfaces.reserveNamespace.html +1 -1
- package/dist/docs/hierarchy.html +1 -1
- package/dist/docs/index.html +292 -71
- package/dist/docs/interfaces/faces.AjaxData.html +6 -0
- package/dist/docs/interfaces/faces.AjaxError.html +18 -0
- package/dist/docs/interfaces/faces.AjaxEvent.html +8 -0
- package/dist/docs/interfaces/faces.ajax.RequestContext.html +6 -0
- package/dist/docs/interfaces/faces.ajax.RequestOptions.html +10 -0
- package/dist/docs/modules/faces.ajax.html +1 -1
- package/dist/docs/modules/faces.html +1 -1
- package/dist/docs/modules/faces.push.html +1 -1
- package/dist/docs/modules/faces.util.html +1 -1
- package/dist/docs/modules/myfaces.html +1 -1
- package/dist/docs/modules.html +1 -1
- package/dist/docs/types/faces.AjaxErrorStatus.html +2 -0
- package/dist/docs/types/faces.AjaxEventStatus.html +2 -0
- package/dist/docs/types/faces.ProjectStage.html +2 -0
- package/dist/docs/types/faces.ajax.OnErrorCallback.html +2 -0
- package/dist/docs/types/faces.ajax.OnEventCallback.html +2 -0
- package/dist/docs/types/faces.push.OnCloseHandler.html +2 -0
- package/dist/docs/types/faces.push.OnErrorHandler.html +2 -0
- package/dist/docs/types/faces.push.OnMessageHandler.html +2 -0
- package/dist/docs/types/faces.push.OnOpenHandler.html +2 -0
- package/dist/docs/variables/faces.contextpath.html +1 -1
- package/dist/docs/variables/faces.implversion.html +1 -1
- package/dist/docs/variables/faces.separatorchar.html +1 -1
- package/dist/docs/variables/faces.specversion.html +1 -1
- package/dist/docs/variables/myfaces.oam.html +1 -1
- package/dist/window/faces-development.js +1801 -499
- package/dist/window/faces-development.js.map +1 -1
- package/{target/api/_api.js → dist/window/faces.d.ts} +124 -151
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.LICENSE.txt +0 -17
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +1806 -513
- package/dist/window/jsf-development.js.map +1 -1
- package/{target/src/main/typescript/api/_api.js → dist/window/jsf.d.ts} +125 -153
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.LICENSE.txt +0 -17
- package/dist/window/jsf.js.map +1 -1
- package/package.json +22 -18
- package/scripts/build-dts.mjs +239 -0
- package/src/main/typescript/@types/definitions/index.d.ts +22 -122
- package/{target/test/frameworkBase/_ext/monadish/fixtures/test2.js → src/main/typescript/@types/definitions/modules.d.ts} +18 -2
- package/src/main/typescript/api/_api.ts +132 -29
- package/{target/test/frameworkBase/_ext/monadish/fixtures/test.js → src/main/typescript/api/_api_ae_stub.d.ts} +6 -2
- package/src/main/typescript/api/faces.ts +2 -2
- package/src/main/typescript/api/jsf.ts +15 -23
- package/src/main/typescript/impl/AjaxImpl.ts +15 -15
- package/src/main/typescript/impl/PushImpl.ts +139 -69
- package/src/main/typescript/impl/core/Const.ts +2 -2
- package/src/main/typescript/impl/i18n/Messages.ts +1 -1
- package/src/main/typescript/impl/util/Assertions.ts +1 -2
- package/src/main/typescript/impl/util/AsyncRunnable.ts +3 -4
- package/src/main/typescript/impl/util/ExtDomQuery.ts +19 -19
- package/src/main/typescript/impl/util/FileUtils.ts +30 -14
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +34 -34
- package/src/main/typescript/impl/util/Lang.ts +19 -22
- package/src/main/typescript/impl/util/XhrQueueController.ts +25 -3
- package/src/main/typescript/impl/xhrCore/ErrorData.ts +17 -12
- package/src/main/typescript/impl/xhrCore/EventData.ts +8 -7
- package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +3 -3
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +7 -6
- package/src/main/typescript/impl/xhrCore/Response.ts +3 -3
- package/src/main/typescript/impl/xhrCore/ResponseDataResolver.ts +0 -38
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +17 -15
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +72 -63
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +80 -134
- package/src/main/typescript/mona_dish_shim.ts +6 -2
- package/src/main/typescript/myfaces/OamSubmit.ts +10 -6
- package/src/main/typescript/test/api/JsfPushShimTest.spec.ts +126 -0
- package/src/main/typescript/test/api/MyFacesABTest.spec.ts +16 -0
- package/src/main/typescript/test/api/PushTypeCompatibility.ts +65 -0
- package/src/main/typescript/test/frameworkBase/LangTest.spec.ts +16 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +1 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.ts +16 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.ts +16 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.ts +16 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +55 -9
- package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +16 -0
- package/src/main/typescript/test/impl/AssertionsTest.spec.ts +168 -0
- package/src/main/typescript/test/impl/FileUtilsTest.spec.ts +126 -0
- package/src/main/typescript/test/impl/ImplTest.spec.ts +75 -1
- package/src/main/typescript/test/impl/ResponseDataResolverTest.spec.ts +62 -0
- package/src/main/typescript/test/impl/util/ExtDomQueryTest.spec.ts +91 -1
- package/src/main/typescript/test/impl/util/ExtLangTest.spec.ts +110 -0
- package/src/main/typescript/test/impl/util/HiddenInputBuilderTest.spec.ts +74 -0
- package/src/main/typescript/test/myfaces/OamSubmit.spec.ts +61 -1
- package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +191 -2
- package/src/main/typescript/test/xhrCore/ClientWindow.spec.ts +16 -0
- package/src/main/typescript/test/xhrCore/ErrorChainTest.spec.ts +14 -0
- package/src/main/typescript/test/xhrCore/FakeWebsocket.ts +21 -5
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +363 -4
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +218 -4
- package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +1 -1
- package/src/main/typescript/test/xhrCore/WebsocketTest.spec.ts +764 -0
- package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +265 -62
- package/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.ts +16 -0
- package/{target/src/main/typescript/test/xhrCore/FakeWebsocket.js → src/main/typescript/tsconfig.ae.json} +16 -23
- package/src/main/typescript/{tsconfig.json → tsconfig.dts.json} +11 -27
- package/src/main/typescript/tsconfig.test.json +17 -0
- package/tsconfig.api-extractor.json +17 -0
- package/.claude/settings.local.json +0 -16
- package/.github/workflows/codeql-analysis.yml +0 -83
- package/.github/workflows/nodejs.yml +0 -26
- package/.mocharc.json +0 -10
- package/.nyc_output/384344d4-4f46-455f-84c3-010f829098cb.json +0 -1
- package/.nyc_output/a0f90016-f4f9-4039-bb51-57f4f7050541.json +0 -1
- package/.nyc_output/db388b5d-0b79-4bce-afd2-001aaf6f0245.json +0 -1
- package/.nyc_output/processinfo/384344d4-4f46-455f-84c3-010f829098cb.json +0 -1
- package/.nyc_output/processinfo/a0f90016-f4f9-4039-bb51-57f4f7050541.json +0 -1
- package/.nyc_output/processinfo/db388b5d-0b79-4bce-afd2-001aaf6f0245.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/.nycrc +0 -6
- package/build.cmd +0 -1
- package/build.sh +0 -3
- package/mvnw +0 -286
- package/mvnw.cmd +0 -161
- package/plans for 4.0.1.txt +0 -8
- package/remap.ts +0 -51
- package/src/main/typescript/test/xhrCore/WebsocketTest.ts +0 -221
- package/target/api/_api.js.map +0 -1
- package/target/api/faces.js +0 -45
- package/target/api/faces.js.map +0 -1
- package/target/api/jsf.js +0 -56
- package/target/api/jsf.js.map +0 -1
- package/target/impl/AjaxImpl.js +0 -748
- package/target/impl/AjaxImpl.js.map +0 -1
- package/target/impl/PushImpl.js +0 -265
- package/target/impl/PushImpl.js.map +0 -1
- package/target/impl/core/Const.js +0 -177
- package/target/impl/core/Const.js.map +0 -1
- package/target/impl/core/ImplTypes.js +0 -38
- package/target/impl/core/ImplTypes.js.map +0 -1
- package/target/impl/i18n/Messages.js +0 -113
- package/target/impl/i18n/Messages.js.map +0 -1
- package/target/impl/util/Assertions.js +0 -101
- package/target/impl/util/Assertions.js.map +0 -1
- package/target/impl/util/AsyncRunnable.js +0 -78
- package/target/impl/util/AsyncRunnable.js.map +0 -1
- package/target/impl/util/ExtDomQuery.js +0 -306
- package/target/impl/util/ExtDomQuery.js.map +0 -1
- package/target/impl/util/FileUtils.js +0 -98
- package/target/impl/util/FileUtils.js.map +0 -1
- package/target/impl/util/HiddenInputBuilder.js +0 -83
- package/target/impl/util/HiddenInputBuilder.js.map +0 -1
- package/target/impl/util/IListener.js +0 -3
- package/target/impl/util/IListener.js.map +0 -1
- package/target/impl/util/Lang.js +0 -263
- package/target/impl/util/Lang.js.map +0 -1
- package/target/impl/util/XhrQueueController.js +0 -92
- package/target/impl/util/XhrQueueController.js.map +0 -1
- package/target/impl/xhrCore/ErrorData.js +0 -87
- package/target/impl/xhrCore/ErrorData.js.map +0 -1
- package/target/impl/xhrCore/EventData.js +0 -52
- package/target/impl/xhrCore/EventData.js.map +0 -1
- package/target/impl/xhrCore/IResponseProcessor.js +0 -3
- package/target/impl/xhrCore/IResponseProcessor.js.map +0 -1
- package/target/impl/xhrCore/RequestDataResolver.js +0 -186
- package/target/impl/xhrCore/RequestDataResolver.js.map +0 -1
- package/target/impl/xhrCore/ResonseDataResolver.js +0 -104
- package/target/impl/xhrCore/ResonseDataResolver.js.map +0 -1
- package/target/impl/xhrCore/Response.js +0 -186
- package/target/impl/xhrCore/Response.js.map +0 -1
- package/target/impl/xhrCore/ResponseDataResolver.js +0 -104
- package/target/impl/xhrCore/ResponseDataResolver.js.map +0 -1
- package/target/impl/xhrCore/ResponseProcessor.js +0 -468
- package/target/impl/xhrCore/ResponseProcessor.js.map +0 -1
- package/target/impl/xhrCore/XhrFormData.js +0 -163
- package/target/impl/xhrCore/XhrFormData.js.map +0 -1
- package/target/impl/xhrCore/XhrRequest.js +0 -433
- package/target/impl/xhrCore/XhrRequest.js.map +0 -1
- package/target/mona_dish_shim.js +0 -70
- package/target/mona_dish_shim.js.map +0 -1
- package/target/myfaces/OamSubmit.js +0 -128
- package/target/myfaces/OamSubmit.js.map +0 -1
- package/target/src/main/typescript/api/_api.js.map +0 -1
- package/target/src/main/typescript/api/faces.js +0 -45
- package/target/src/main/typescript/api/faces.js.map +0 -1
- package/target/src/main/typescript/api/jsf.js +0 -56
- package/target/src/main/typescript/api/jsf.js.map +0 -1
- package/target/src/main/typescript/impl/AjaxImpl.js +0 -748
- package/target/src/main/typescript/impl/AjaxImpl.js.map +0 -1
- package/target/src/main/typescript/impl/PushImpl.js +0 -265
- package/target/src/main/typescript/impl/PushImpl.js.map +0 -1
- package/target/src/main/typescript/impl/core/Const.js +0 -177
- package/target/src/main/typescript/impl/core/Const.js.map +0 -1
- package/target/src/main/typescript/impl/core/ImplTypes.js +0 -38
- package/target/src/main/typescript/impl/core/ImplTypes.js.map +0 -1
- package/target/src/main/typescript/impl/i18n/Messages.js +0 -113
- package/target/src/main/typescript/impl/i18n/Messages.js.map +0 -1
- package/target/src/main/typescript/impl/util/Assertions.js +0 -101
- package/target/src/main/typescript/impl/util/Assertions.js.map +0 -1
- package/target/src/main/typescript/impl/util/AsyncRunnable.js +0 -78
- package/target/src/main/typescript/impl/util/AsyncRunnable.js.map +0 -1
- package/target/src/main/typescript/impl/util/ExtDomQuery.js +0 -306
- package/target/src/main/typescript/impl/util/ExtDomQuery.js.map +0 -1
- package/target/src/main/typescript/impl/util/FileUtils.js +0 -98
- package/target/src/main/typescript/impl/util/FileUtils.js.map +0 -1
- package/target/src/main/typescript/impl/util/HiddenInputBuilder.js +0 -83
- package/target/src/main/typescript/impl/util/HiddenInputBuilder.js.map +0 -1
- package/target/src/main/typescript/impl/util/IListener.js +0 -3
- package/target/src/main/typescript/impl/util/IListener.js.map +0 -1
- package/target/src/main/typescript/impl/util/Lang.js +0 -263
- package/target/src/main/typescript/impl/util/Lang.js.map +0 -1
- package/target/src/main/typescript/impl/util/XhrQueueController.js +0 -92
- package/target/src/main/typescript/impl/util/XhrQueueController.js.map +0 -1
- package/target/src/main/typescript/impl/xhrCore/ErrorData.js +0 -87
- package/target/src/main/typescript/impl/xhrCore/ErrorData.js.map +0 -1
- package/target/src/main/typescript/impl/xhrCore/EventData.js +0 -52
- package/target/src/main/typescript/impl/xhrCore/EventData.js.map +0 -1
- package/target/src/main/typescript/impl/xhrCore/IResponseProcessor.js +0 -3
- package/target/src/main/typescript/impl/xhrCore/IResponseProcessor.js.map +0 -1
- package/target/src/main/typescript/impl/xhrCore/RequestDataResolver.js +0 -186
- package/target/src/main/typescript/impl/xhrCore/RequestDataResolver.js.map +0 -1
- package/target/src/main/typescript/impl/xhrCore/Response.js +0 -186
- package/target/src/main/typescript/impl/xhrCore/Response.js.map +0 -1
- package/target/src/main/typescript/impl/xhrCore/ResponseDataResolver.js +0 -104
- package/target/src/main/typescript/impl/xhrCore/ResponseDataResolver.js.map +0 -1
- package/target/src/main/typescript/impl/xhrCore/ResponseProcessor.js +0 -468
- package/target/src/main/typescript/impl/xhrCore/ResponseProcessor.js.map +0 -1
- package/target/src/main/typescript/impl/xhrCore/XhrFormData.js +0 -163
- package/target/src/main/typescript/impl/xhrCore/XhrFormData.js.map +0 -1
- package/target/src/main/typescript/impl/xhrCore/XhrRequest.js +0 -433
- package/target/src/main/typescript/impl/xhrCore/XhrRequest.js.map +0 -1
- package/target/src/main/typescript/mona_dish_shim.js +0 -70
- package/target/src/main/typescript/mona_dish_shim.js.map +0 -1
- package/target/src/main/typescript/myfaces/OamSubmit.js +0 -128
- package/target/src/main/typescript/myfaces/OamSubmit.js.map +0 -1
- package/target/src/main/typescript/test/api/MyFacesABTest.spec.js +0 -117
- package/target/src/main/typescript/test/api/MyFacesABTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/LangTest.spec.js +0 -123
- package/target/src/main/typescript/test/frameworkBase/LangTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +0 -657
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/LangTest.spec.js +0 -107
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/LangTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingProbes.js +0 -106
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingProbes.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingTest.spec.js +0 -39
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.js +0 -153
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js +0 -2
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +0 -925
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +0 -112
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.js +0 -728
- package/target/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.js +0 -296
- package/target/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.js.map +0 -1
- package/target/src/main/typescript/test/impl/ImplTest.spec.js +0 -225
- package/target/src/main/typescript/test/impl/ImplTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/impl/ImplTest_23.spec.js +0 -143
- package/target/src/main/typescript/test/impl/ImplTest_23.spec.js.map +0 -1
- package/target/src/main/typescript/test/impl/SeparatorCharsTest.spec.js +0 -106
- package/target/src/main/typescript/test/impl/SeparatorCharsTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/impl/util/ExtDomQueryTest.spec.js +0 -77
- package/target/src/main/typescript/test/impl/util/ExtDomQueryTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/myfaces/OamSubmit.spec.js +0 -118
- package/target/src/main/typescript/test/myfaces/OamSubmit.spec.js.map +0 -1
- package/target/src/main/typescript/test/myfaces/OnLoad.spec.js +0 -57
- package/target/src/main/typescript/test/myfaces/OnLoad.spec.js.map +0 -1
- package/target/src/main/typescript/test/myfaces/ReserveNamespace.spec.js +0 -60
- package/target/src/main/typescript/test/myfaces/ReserveNamespace.spec.js.map +0 -1
- package/target/src/main/typescript/test/queue/AsynchronousProbe.js +0 -93
- package/target/src/main/typescript/test/queue/AsynchronousProbe.js.map +0 -1
- package/target/src/main/typescript/test/queue/AsynchronousQueueTest.spec.js +0 -133
- package/target/src/main/typescript/test/queue/AsynchronousQueueTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/ClientWindow.spec.js +0 -101
- package/target/src/main/typescript/test/xhrCore/ClientWindow.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/ErrorChainTest.spec.js +0 -175
- package/target/src/main/typescript/test/xhrCore/ErrorChainTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/EventTests.spec.js +0 -184
- package/target/src/main/typescript/test/xhrCore/EventTests.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/FakeWebsocket.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/FileUploadTest.spec.js +0 -181
- package/target/src/main/typescript/test/xhrCore/FileUploadTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.js +0 -226
- package/target/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/OamSubmitTest.spec.js +0 -199
- package/target/src/main/typescript/test/xhrCore/OamSubmitTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/RequestParamsTest.spec.js +0 -567
- package/target/src/main/typescript/test/xhrCore/RequestParamsTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/RequestTest.spec.js +0 -845
- package/target/src/main/typescript/test/xhrCore/RequestTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/RequestTest_23.spec.js +0 -382
- package/target/src/main/typescript/test/xhrCore/RequestTest_23.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/ResponseTest.spec.js +0 -667
- package/target/src/main/typescript/test/xhrCore/ResponseTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/ResponseTest23.spec.js +0 -367
- package/target/src/main/typescript/test/xhrCore/ResponseTest23.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/ShadowDomTest.spec.js +0 -123
- package/target/src/main/typescript/test/xhrCore/ShadowDomTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.js +0 -147
- package/target/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/WebsocketTest.js +0 -207
- package/target/src/main/typescript/test/xhrCore/WebsocketTest.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.js +0 -149
- package/target/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.js +0 -130
- package/target/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.js.map +0 -1
- package/target/test/api/MyFacesABTest.spec.js +0 -117
- package/target/test/api/MyFacesABTest.spec.js.map +0 -1
- package/target/test/frameworkBase/LangTest.spec.js +0 -123
- package/target/test/frameworkBase/LangTest.spec.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +0 -657
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js +0 -107
- package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/MappingProbes.js +0 -106
- package/target/test/frameworkBase/_ext/monadish/MappingProbes.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js +0 -39
- package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +0 -153
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js +0 -1
- package/target/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/fixtures/test.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/fixtures/test2.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +0 -925
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +0 -112
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +0 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +0 -728
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +0 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js +0 -296
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +0 -1
- package/target/test/frameworkBase/_ext/shared/fixtures/js/tobago.js +0 -16
- package/target/test/frameworkBase/_ext/shared/fixtures/js/tobago.js.map +0 -1
- package/target/test/impl/ImplTest.spec.js +0 -225
- package/target/test/impl/ImplTest.spec.js.map +0 -1
- package/target/test/impl/ImplTest_23.spec.js +0 -143
- package/target/test/impl/ImplTest_23.spec.js.map +0 -1
- package/target/test/impl/SeparatorCharsTest.spec.js +0 -106
- package/target/test/impl/SeparatorCharsTest.spec.js.map +0 -1
- package/target/test/impl/util/ExtDomQueryTest.spec.js +0 -77
- package/target/test/impl/util/ExtDomQueryTest.spec.js.map +0 -1
- package/target/test/myfaces/OamSubmit.spec.js +0 -118
- package/target/test/myfaces/OamSubmit.spec.js.map +0 -1
- package/target/test/myfaces/OnLoad.spec.js +0 -57
- package/target/test/myfaces/OnLoad.spec.js.map +0 -1
- package/target/test/myfaces/ReserveNamespace.spec.js +0 -60
- package/target/test/myfaces/ReserveNamespace.spec.js.map +0 -1
- package/target/test/queue/AsynchronousProbe.js +0 -93
- package/target/test/queue/AsynchronousProbe.js.map +0 -1
- package/target/test/queue/AsynchronousQueueTest.spec.js +0 -133
- package/target/test/queue/AsynchronousQueueTest.spec.js.map +0 -1
- package/target/test/xhrCore/ClientWindow.spec.js +0 -101
- package/target/test/xhrCore/ClientWindow.spec.js.map +0 -1
- package/target/test/xhrCore/ErrorChainTest.spec.js +0 -175
- package/target/test/xhrCore/ErrorChainTest.spec.js.map +0 -1
- package/target/test/xhrCore/EventTests.spec.js +0 -184
- package/target/test/xhrCore/EventTests.spec.js.map +0 -1
- package/target/test/xhrCore/FakeWebsocket.js +0 -38
- package/target/test/xhrCore/FakeWebsocket.js.map +0 -1
- package/target/test/xhrCore/FileUploadTest.spec.js +0 -181
- package/target/test/xhrCore/FileUploadTest.spec.js.map +0 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +0 -226
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +0 -1
- package/target/test/xhrCore/OamSubmitTest.spec.js +0 -199
- package/target/test/xhrCore/OamSubmitTest.spec.js.map +0 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +0 -567
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +0 -1
- package/target/test/xhrCore/RequestTest.spec.js +0 -845
- package/target/test/xhrCore/RequestTest.spec.js.map +0 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +0 -382
- package/target/test/xhrCore/RequestTest_23.spec.js.map +0 -1
- package/target/test/xhrCore/ResponseTest.spec.js +0 -667
- package/target/test/xhrCore/ResponseTest.spec.js.map +0 -1
- package/target/test/xhrCore/ResponseTest23.spec.js +0 -367
- package/target/test/xhrCore/ResponseTest23.spec.js.map +0 -1
- package/target/test/xhrCore/ShadowDomTest.spec.js +0 -123
- package/target/test/xhrCore/ShadowDomTest.spec.js.map +0 -1
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js +0 -147
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +0 -1
- package/target/test/xhrCore/WebsocketTest.js +0 -207
- package/target/test/xhrCore/WebsocketTest.js.map +0 -1
- package/target/test/xhrCore/XhrFormDataTest.spec.js +0 -149
- package/target/test/xhrCore/XhrFormDataTest.spec.js.map +0 -1
- package/target/test/xhrCore/XhrRequestProgress.spec.js +0 -130
- package/target/test/xhrCore/XhrRequestProgress.spec.js.map +0 -1
- package/target/test/xhrCore/fixtures/addedViewHead1.js +0 -17
- package/target/test/xhrCore/fixtures/addedViewHead1.js.map +0 -1
- package/target/test/xhrCore/fixtures/addedViewHead2.js +0 -17
- package/target/test/xhrCore/fixtures/addedViewHead2.js.map +0 -1
- package/target/test/xhrCore/fixtures/addedViewHead3.js +0 -17
- package/target/test/xhrCore/fixtures/addedViewHead3.js.map +0 -1
- package/target/test/xhrCore/fixtures/nonce_script.js +0 -17
- package/target/test/xhrCore/fixtures/nonce_script.js.map +0 -1
- package/tsconfig.json +0 -9
- package/webpack.config.ts +0 -54
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
/**
|
|
18
18
|
* Typescript port of the faces\.push part in the myfaces implementation
|
|
19
19
|
*/
|
|
20
|
-
import {MAX_RECONNECT_ATTEMPTS,
|
|
20
|
+
import {MAX_RECONNECT_ATTEMPTS, RECONNECT_INTERVAL} from "./core/Const";
|
|
21
21
|
import {DQ} from "mona-dish";
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -34,18 +34,37 @@ export namespace PushImpl {
|
|
|
34
34
|
// they are not directly touched outside of tests
|
|
35
35
|
|
|
36
36
|
/* socket map by token */
|
|
37
|
-
export
|
|
37
|
+
export type OpenCallback = (channel: string) => void;
|
|
38
|
+
export type MessageCallback = (message: any, channel: string, event: MessageEvent) => void;
|
|
39
|
+
export type ErrorCallback = (code: number, channel: string, event: CloseEvent) => void;
|
|
40
|
+
export type CloseCallback = (code: number, channel: string, event?: CloseEvent) => void;
|
|
41
|
+
|
|
42
|
+
type ComponentData = {
|
|
43
|
+
channelToken: string;
|
|
44
|
+
onopen: OpenCallback;
|
|
45
|
+
onmessage: MessageCallback;
|
|
46
|
+
onerror: ErrorCallback;
|
|
47
|
+
onclose: CloseCallback;
|
|
48
|
+
behaviors: any;
|
|
49
|
+
autoconnect: boolean;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** @internal */
|
|
53
|
+
export let sockets: {[key: string]: Socket} = {};
|
|
38
54
|
/* component attributes by clientId */
|
|
39
|
-
|
|
55
|
+
/** @internal */
|
|
56
|
+
export let components: {[key: string]: ComponentData} = {};
|
|
40
57
|
/* client ids by token (share websocket connection) */
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
/** @internal */
|
|
59
|
+
export let clientIdsByTokens: {[key: string]: string[]} = {};
|
|
43
60
|
|
|
44
61
|
// needed for testing
|
|
62
|
+
/** @internal */
|
|
45
63
|
export function reset() {
|
|
64
|
+
Object.values(sockets).forEach(s => { try { s.close(); } catch(e) { /* ignore */ } });
|
|
46
65
|
sockets = {};
|
|
47
|
-
components = {}
|
|
48
|
-
clientIdsByTokens = {}
|
|
66
|
+
components = {};
|
|
67
|
+
clientIdsByTokens = {};
|
|
49
68
|
}
|
|
50
69
|
|
|
51
70
|
/*
|
|
@@ -66,13 +85,13 @@ export namespace PushImpl {
|
|
|
66
85
|
export function init(socketClientId: string,
|
|
67
86
|
url: string,
|
|
68
87
|
channel: string,
|
|
69
|
-
onopen:
|
|
70
|
-
onmessage:
|
|
71
|
-
onerror:
|
|
72
|
-
onclose:
|
|
88
|
+
onopen: OpenCallback | string,
|
|
89
|
+
onmessage: MessageCallback | string,
|
|
90
|
+
onerror: ErrorCallback | string,
|
|
91
|
+
onclose: CloseCallback | string,
|
|
73
92
|
behaviors: any,
|
|
74
93
|
autoConnect: boolean) {
|
|
75
|
-
onclose = resolveFunction(onclose);
|
|
94
|
+
onclose = resolveFunction(onclose) as CloseCallback;
|
|
76
95
|
|
|
77
96
|
if (!DQ.global().WebSocket) { // IE6-9.
|
|
78
97
|
onclose(-1, channel);
|
|
@@ -84,9 +103,9 @@ export namespace PushImpl {
|
|
|
84
103
|
if (!components[socketClientId]) {
|
|
85
104
|
components[socketClientId] = {
|
|
86
105
|
'channelToken': channelToken,
|
|
87
|
-
'onopen': resolveFunction(onopen),
|
|
88
|
-
'onmessage' : resolveFunction(onmessage),
|
|
89
|
-
'onerror' : resolveFunction(onerror),
|
|
106
|
+
'onopen': resolveFunction(onopen) as OpenCallback,
|
|
107
|
+
'onmessage' : resolveFunction(onmessage) as MessageCallback,
|
|
108
|
+
'onerror' : resolveFunction(onerror) as ErrorCallback,
|
|
90
109
|
'onclose': onclose,
|
|
91
110
|
'behaviors': behaviors,
|
|
92
111
|
'autoconnect': autoConnect};
|
|
@@ -127,58 +146,40 @@ export namespace PushImpl {
|
|
|
127
146
|
|
|
128
147
|
class Socket {
|
|
129
148
|
|
|
130
|
-
socket: WebSocket;
|
|
131
|
-
reconnectAttempts = 0;
|
|
149
|
+
private socket: WebSocket | null = null;
|
|
150
|
+
private reconnectAttempts = 0;
|
|
151
|
+
private hasEverConnected = false;
|
|
152
|
+
private hasNotifiedInitialOpenAttempt = false;
|
|
132
153
|
|
|
133
154
|
constructor(private channelToken: string, private url: string, private channel: string) {
|
|
134
155
|
}
|
|
135
156
|
|
|
136
157
|
open() {
|
|
137
|
-
if (this.socket && this.socket.readyState
|
|
158
|
+
if (this.socket && this.socket.readyState === 1) {
|
|
138
159
|
return;
|
|
139
160
|
}
|
|
140
161
|
this.socket = new WebSocket(this.url);
|
|
141
|
-
|
|
142
162
|
this.bindCallbacks();
|
|
163
|
+
this.notifyInitialOpenAttempt();
|
|
143
164
|
}
|
|
144
165
|
|
|
145
166
|
// noinspection JSUnusedLocalSymbols
|
|
146
167
|
onopen(event: any) {
|
|
147
|
-
|
|
148
|
-
let clientIds = clientIdsByTokens[this.channelToken];
|
|
149
|
-
for (let i = clientIds.length - 1; i >= 0; i--) {
|
|
150
|
-
let socketClientId = clientIds[i];
|
|
151
|
-
components[socketClientId]?.['onopen']?.(this.channel);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
168
|
+
this.hasEverConnected = true;
|
|
154
169
|
this.reconnectAttempts = 0;
|
|
155
170
|
}
|
|
156
171
|
|
|
157
172
|
onerror(event: any) {
|
|
158
|
-
|
|
159
|
-
//
|
|
160
|
-
for (let i = clientIdsByTokens[this.channelToken].length - 1; i >= 0; i--) {
|
|
161
|
-
let socketClientId = clientIdsByTokens[this.channelToken][i];
|
|
162
|
-
if (document.getElementById(socketClientId)) {
|
|
163
|
-
try {
|
|
164
|
-
components[socketClientId]?.['onerror']?.(message, this.channel, event);
|
|
165
|
-
} catch (e) {
|
|
166
|
-
//Ignore
|
|
167
|
-
}
|
|
168
|
-
} else {
|
|
169
|
-
clientIdsByTokens[this.channelToken].splice(i, 1);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
if (clientIdsByTokens[this.channelToken].length == 0) {
|
|
173
|
-
// tag disappeared
|
|
174
|
-
this.close();
|
|
175
|
-
}
|
|
173
|
+
// Native WebSocket error events do not expose the close reason code.
|
|
174
|
+
// Faces onerror is fired from onclose only when a reconnect is attempted.
|
|
176
175
|
}
|
|
177
176
|
|
|
178
|
-
|
|
177
|
+
onmessage(event: any) {
|
|
179
178
|
let message = JSON.parse(event.data);
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
let clientIds = clientIdsByTokens[this.channelToken];
|
|
180
|
+
if (!clientIds) return; // socket was torn down (reset()) while message was pending
|
|
181
|
+
for (let i = clientIds.length - 1; i >= 0; i--) {
|
|
182
|
+
let socketClientId = clientIds[i];
|
|
182
183
|
if (document.getElementById(socketClientId)) {
|
|
183
184
|
try {
|
|
184
185
|
components[socketClientId]?.['onmessage']?.(message, this.channel, event);
|
|
@@ -197,29 +198,26 @@ export namespace PushImpl {
|
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
200
|
} else {
|
|
200
|
-
|
|
201
|
+
clientIds.splice(i, 1);
|
|
201
202
|
}
|
|
202
203
|
}
|
|
203
|
-
if (
|
|
204
|
+
if (clientIds.length === 0) {
|
|
204
205
|
// tag disappeared
|
|
205
206
|
this.close();
|
|
206
207
|
}
|
|
207
208
|
}
|
|
208
209
|
|
|
209
210
|
onclose(event: any) {
|
|
210
|
-
if (
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|| (this.reconnectAttempts >= MAX_RECONNECT_ATTEMPTS)) {
|
|
215
|
-
let clientIds = clientIdsByTokens[this.channelToken];
|
|
216
|
-
for (let i = clientIds.length - 1; i >= 0; i--) {
|
|
217
|
-
let socketClientId = clientIds[i];
|
|
218
|
-
components?.[socketClientId]?.['onclose']?.(event?.code, this?.channel, event);
|
|
219
|
-
}
|
|
220
|
-
} else {
|
|
221
|
-
setTimeout(this.open, RECONNECT_INTERVAL * this.reconnectAttempts++);
|
|
211
|
+
if (this.isTerminalClose(event)) {
|
|
212
|
+
this.notifyClose(event);
|
|
213
|
+
this.resetConnectionState();
|
|
214
|
+
return;
|
|
222
215
|
}
|
|
216
|
+
|
|
217
|
+
if (!this.notifyErrorAndPruneMissingComponents(event)) return;
|
|
218
|
+
if (this.closeIfChannelHasNoComponents()) return;
|
|
219
|
+
|
|
220
|
+
this.scheduleReconnect();
|
|
223
221
|
};
|
|
224
222
|
|
|
225
223
|
close() {
|
|
@@ -230,14 +228,85 @@ export namespace PushImpl {
|
|
|
230
228
|
}
|
|
231
229
|
}
|
|
232
230
|
|
|
231
|
+
private notifyInitialOpenAttempt() {
|
|
232
|
+
if (this.reconnectAttempts || this.hasNotifiedInitialOpenAttempt) return;
|
|
233
|
+
|
|
234
|
+
this.hasNotifiedInitialOpenAttempt = true;
|
|
235
|
+
let clientIds = clientIdsByTokens[this.channelToken];
|
|
236
|
+
if (!clientIds) return; // socket was torn down (reset()) while timer was pending
|
|
237
|
+
for (let i = clientIds.length - 1; i >= 0; i--) {
|
|
238
|
+
let socketClientId = clientIds[i];
|
|
239
|
+
components[socketClientId]?.['onopen']?.(this.channel);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
private isTerminalClose(event: any): boolean {
|
|
244
|
+
return !this.socket
|
|
245
|
+
// Spec: no reconnect when the very first connection attempt fails.
|
|
246
|
+
// onerror must also not be invoked in this case, only onclose.
|
|
247
|
+
|| !this.hasEverConnected
|
|
248
|
+
// Spec: code 1000 (normal closure) is always terminal, regardless of reason.
|
|
249
|
+
|| event.code === 1000
|
|
250
|
+
// 1008 = Policy Violation. Reconnecting would hit the same rejection again.
|
|
251
|
+
|| event.code === 1008
|
|
252
|
+
|| this.reconnectAttempts >= MAX_RECONNECT_ATTEMPTS;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
private notifyClose(event: any) {
|
|
256
|
+
let clientIds = clientIdsByTokens[this.channelToken];
|
|
257
|
+
if (!clientIds) return; // already torn down (reset() called while socket was open)
|
|
258
|
+
for (let i = clientIds.length - 1; i >= 0; i--) {
|
|
259
|
+
let socketClientId = clientIds[i];
|
|
260
|
+
components?.[socketClientId]?.['onclose']?.(event?.code, this?.channel, event);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
private resetConnectionState() {
|
|
265
|
+
this.reconnectAttempts = 0;
|
|
266
|
+
this.hasEverConnected = false;
|
|
267
|
+
this.hasNotifiedInitialOpenAttempt = false;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
private notifyErrorAndPruneMissingComponents(event: any): boolean {
|
|
271
|
+
let clientIds = clientIdsByTokens[this.channelToken];
|
|
272
|
+
if (!clientIds) return false; // already torn down (reset() called while socket was open)
|
|
273
|
+
for (let i = clientIds.length - 1; i >= 0; i--) {
|
|
274
|
+
let socketClientId = clientIds[i];
|
|
275
|
+
if (document.getElementById(socketClientId)) {
|
|
276
|
+
try {
|
|
277
|
+
components?.[socketClientId]?.['onerror']?.(event?.code, this?.channel, event);
|
|
278
|
+
} catch (e) {
|
|
279
|
+
//Ignore
|
|
280
|
+
}
|
|
281
|
+
} else {
|
|
282
|
+
clientIds.splice(i, 1);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
private closeIfChannelHasNoComponents(): boolean {
|
|
289
|
+
if (clientIdsByTokens[this.channelToken]?.length !== 0) return false;
|
|
290
|
+
|
|
291
|
+
// tag disappeared
|
|
292
|
+
this.close();
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
private scheduleReconnect() {
|
|
297
|
+
const reconnectAttempt = ++this.reconnectAttempts;
|
|
298
|
+
this.socket = null;
|
|
299
|
+
setTimeout(() => this.open(), RECONNECT_INTERVAL * reconnectAttempt);
|
|
300
|
+
}
|
|
301
|
+
|
|
233
302
|
/**
|
|
234
303
|
* bind the callbacks to the socket callbacks
|
|
235
304
|
*/
|
|
236
305
|
private bindCallbacks() {
|
|
237
|
-
this.socket
|
|
238
|
-
this.socket
|
|
239
|
-
this.socket
|
|
240
|
-
this.socket
|
|
306
|
+
this.socket!.onopen = (event: Event) => this.onopen(event);
|
|
307
|
+
this.socket!.onmessage = (event: Event) => this.onmessage(event);
|
|
308
|
+
this.socket!.onclose = (event: Event) => this.onclose(event);
|
|
309
|
+
this.socket!.onerror = (event: Event) => this.onerror(event);
|
|
241
310
|
}
|
|
242
311
|
}
|
|
243
312
|
|
|
@@ -271,9 +340,10 @@ export namespace PushImpl {
|
|
|
271
340
|
}
|
|
272
341
|
}
|
|
273
342
|
|
|
274
|
-
function resolveFunction(fn
|
|
275
|
-
|
|
276
|
-
|
|
343
|
+
function resolveFunction<T extends Function>(fn?: T | string | null): T {
|
|
344
|
+
if (typeof fn === "function") return fn as T;
|
|
345
|
+
if (typeof fn === "string" && typeof DQ.global()[fn] === "function") return DQ.global()[fn] as T;
|
|
346
|
+
return (() => {}) as unknown as T;
|
|
277
347
|
}
|
|
278
348
|
|
|
279
|
-
}
|
|
349
|
+
}
|
|
@@ -206,8 +206,8 @@ export const UNKNOWN = "UNKNOWN";
|
|
|
206
206
|
* changed to a simple value passthrough
|
|
207
207
|
*/
|
|
208
208
|
|
|
209
|
-
export function $faces():
|
|
210
|
-
return
|
|
209
|
+
export function $faces(): typeof faces {
|
|
210
|
+
return window?.faces ?? window?.jsf;
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
export function $nsp(inputNamespace?: any): any {
|
|
@@ -47,7 +47,7 @@ export class Messages {
|
|
|
47
47
|
/** @constant */
|
|
48
48
|
ERR_TRANSPORT = "Transport type {0} does not exist";
|
|
49
49
|
/** @constant */
|
|
50
|
-
ERR_EVT_PASS = "an event must be passed down (either
|
|
50
|
+
ERR_EVT_PASS = "an event must be passed down (either an event object null or undefined) ";
|
|
51
51
|
/** @constant */
|
|
52
52
|
ERR_CONSTRUCT = "Parts of the response couldn't be retrieved when constructing the event data= {0} ";
|
|
53
53
|
/** @constant */
|
|
@@ -49,7 +49,7 @@ export namespace Assertions {
|
|
|
49
49
|
|
|
50
50
|
export function assertUrlExists(node: XMLQuery): void | never {
|
|
51
51
|
if (node.attr(ATTR_URL).isAbsent()) {
|
|
52
|
-
throw Assertions.raiseError(new Error(), ExtLang.getMessage("ERR_RED_URL",
|
|
52
|
+
throw Assertions.raiseError(new Error(), ExtLang.getMessage("ERR_RED_URL", undefined, "processRedirect"), "processRedirect");
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -113,4 +113,3 @@ export namespace Assertions {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
|
|
@@ -30,12 +30,12 @@ export interface IAsyncRunnable<T> {
|
|
|
30
30
|
/**
|
|
31
31
|
* starts the runnable
|
|
32
32
|
*/
|
|
33
|
-
start();
|
|
33
|
+
start(): void;
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* cancel the current ongoing op if possible
|
|
37
37
|
*/
|
|
38
|
-
cancel();
|
|
38
|
+
cancel(): void;
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* callback for then functionality
|
|
@@ -127,7 +127,7 @@ export abstract class AsyncRunnable<T> implements IAsyncRunnable<T>{
|
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
129
|
* registers a finally functor
|
|
130
|
-
* @param func the functor for the finally handling
|
|
130
|
+
* @param func the functor for the finally handling chain
|
|
131
131
|
*/
|
|
132
132
|
finally(func: () => void): IAsyncRunnable<T> {
|
|
133
133
|
// no ie11 support we probably are going to revert to shims for that one
|
|
@@ -144,4 +144,3 @@ export abstract class AsyncRunnable<T> implements IAsyncRunnable<T>{
|
|
|
144
144
|
return this;
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
|
|
@@ -27,7 +27,7 @@ import {$faces, $nsp, P_WINDOW_ID} from "../core/Const";
|
|
|
27
27
|
const IS_FACES_SOURCE = (source?: string): boolean => {
|
|
28
28
|
//spec version smaller 4 we have to deal with the jsf namespace
|
|
29
29
|
|
|
30
|
-
return source && !!(source
|
|
30
|
+
return !!source && !!(source.search(/\/jakarta\.faces\.resource.*\/faces\.js.*/) != -1 ||
|
|
31
31
|
source?.search(/\/faces-development\.js.*/) != -1 ||
|
|
32
32
|
source?.search(/\/faces-uncompressed\.js.*/) != -1 ||
|
|
33
33
|
source?.search(/\/faces[^.]*\.js.*ln=jakarta.faces.*/gi) != -1 ||
|
|
@@ -56,6 +56,10 @@ const IS_INTERNAL_SOURCE = (source: string): boolean => {
|
|
|
56
56
|
|
|
57
57
|
const ATTR_SRC = 'src';
|
|
58
58
|
|
|
59
|
+
function isRegExpMatchArray(value: RegExpMatchArray | null): value is RegExpMatchArray {
|
|
60
|
+
return value != null && value.length > 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
59
63
|
/**
|
|
60
64
|
* Extension which adds implementation specific
|
|
61
65
|
* meta-data to our dom query
|
|
@@ -123,8 +127,8 @@ export class ExtDomQuery extends DQ {
|
|
|
123
127
|
// the last possibility
|
|
124
128
|
let nonceScript: Optional<DomQuery> = Optional.fromNullable(DQ
|
|
125
129
|
.querySelectorAll("script[src], link[src]").asArray
|
|
126
|
-
.filter((item) => item.nonce.isPresent() && item.attr(ATTR_SRC) != null)
|
|
127
|
-
.filter(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value))?.[0]);
|
|
130
|
+
.filter((item) => item.nonce.isPresent() && item.attr(ATTR_SRC).value != null)
|
|
131
|
+
.filter(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value ?? undefined))?.[0]);
|
|
128
132
|
if(!nonceScript?.value) {
|
|
129
133
|
return ValueEmbedder.absent as ValueEmbedder<string>;
|
|
130
134
|
}
|
|
@@ -144,18 +148,14 @@ export class ExtDomQuery extends DQ {
|
|
|
144
148
|
searchJsfJsFor(regExp: RegExp): Optional<string> {
|
|
145
149
|
//perfect application for lazy stream
|
|
146
150
|
return Optional.fromNullable(DQ.querySelectorAll("script[src], link[src]").asArray
|
|
147
|
-
.filter(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value))
|
|
148
|
-
.map(item => item.attr(ATTR_SRC).value.match(regExp))
|
|
149
|
-
.filter(
|
|
150
|
-
.map((result
|
|
151
|
+
.filter(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value ?? undefined))
|
|
152
|
+
.map(item => (item.attr(ATTR_SRC).value ?? "").match(regExp))
|
|
153
|
+
.filter(isRegExpMatchArray)
|
|
154
|
+
.map((result) => {
|
|
151
155
|
return decodeURIComponent(result[1]);
|
|
152
156
|
})?.[0]);
|
|
153
157
|
}
|
|
154
158
|
|
|
155
|
-
globalEval(code: string, nonce ?: string): DQ {
|
|
156
|
-
return new ExtDomQuery(super.globalEval(code, nonce ?? this.nonce.value));
|
|
157
|
-
}
|
|
158
|
-
|
|
159
159
|
// called from base class runScripts, do not delete
|
|
160
160
|
// noinspection JSUnusedGlobalSymbols
|
|
161
161
|
globalEvalSticky(code: string, nonce ?: string): DQ {
|
|
@@ -183,7 +183,7 @@ export class ExtDomQuery extends DQ {
|
|
|
183
183
|
runHeadInserts(suppressDoubleIncludes = true): void {
|
|
184
184
|
let head = ExtDomQuery.byId(document.head);
|
|
185
185
|
//automated nonce handling
|
|
186
|
-
let processedScripts = [];
|
|
186
|
+
let processedScripts: DomQuery[] = [];
|
|
187
187
|
|
|
188
188
|
// the idea is only to run head inserts on resources
|
|
189
189
|
// which do not exist already, that way
|
|
@@ -264,26 +264,26 @@ export class ExtConfig extends Config {
|
|
|
264
264
|
super(root);
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
assignIf(condition: boolean, ...accessPath): IValueHolder<any> {
|
|
267
|
+
assignIf(condition: boolean, ...accessPath: string[]): IValueHolder<any> {
|
|
268
268
|
const accessPathMapped = this.remap(accessPath);
|
|
269
269
|
return super.assignIf(condition, ...accessPathMapped);
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
assign(...accessPath): IValueHolder<any> {
|
|
272
|
+
assign(...accessPath: string[]): IValueHolder<any> {
|
|
273
273
|
const accessPathMapped = this.remap(accessPath);
|
|
274
274
|
return super.assign(...accessPathMapped);
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
append(...accessPath): IValueHolder<any> {
|
|
277
|
+
append(...accessPath: string[]): IValueHolder<any> {
|
|
278
278
|
return super.append(...accessPath);
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
appendIf(condition: boolean, ...accessPath): IValueHolder<any> {
|
|
281
|
+
appendIf(condition: boolean, ...accessPath: string[]): IValueHolder<any> {
|
|
282
282
|
const accessPathMapped = this.remap(accessPath);
|
|
283
283
|
return super.appendIf(condition, ...accessPathMapped);
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
getIf(...accessPath): Config {
|
|
286
|
+
getIf(...accessPath: string[]): Config {
|
|
287
287
|
const accessPathMapped = this.remap(accessPath);
|
|
288
288
|
return super.getIf(...accessPathMapped);
|
|
289
289
|
}
|
|
@@ -333,6 +333,6 @@ export class ExtConfig extends Config {
|
|
|
333
333
|
if(!this.$nspEnabled) {
|
|
334
334
|
return accessPath;
|
|
335
335
|
}
|
|
336
|
-
return new Es2019Array(...accessPath).map(key => $nsp(key));
|
|
336
|
+
return new Es2019Array(...accessPath).map((key: string) => $nsp(key));
|
|
337
337
|
}
|
|
338
|
-
}
|
|
338
|
+
}
|
|
@@ -1,3 +1,19 @@
|
|
|
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
|
+
|
|
1
17
|
import {Config, DomQuery, DQ, Es2019Array} from "mona-dish";
|
|
2
18
|
import {ExtDomQuery} from "./ExtDomQuery";
|
|
3
19
|
import {$faces, EMPTY_STR} from "../core/Const";
|
|
@@ -15,17 +31,17 @@ import {$faces, EMPTY_STR} from "../core/Const";
|
|
|
15
31
|
* @param defaultStr a default string if nothing comes out of it
|
|
16
32
|
*/
|
|
17
33
|
export function encodeFormData(formData: Config,
|
|
18
|
-
paramsMapper = (inStr, inVal) => [inStr, inVal],
|
|
34
|
+
paramsMapper = (inStr: string, inVal: any) => [inStr, inVal],
|
|
19
35
|
defaultStr = EMPTY_STR): string {
|
|
20
36
|
if (formData.isAbsent()) {
|
|
21
37
|
return defaultStr;
|
|
22
38
|
}
|
|
23
39
|
const assocValues = formData.value;
|
|
24
40
|
|
|
25
|
-
const expandValueArrAndRename = key => assocValues[key].map(val => paramsMapper(key, val));
|
|
26
|
-
const isPropertyKey = key => assocValues.hasOwnProperty(key);
|
|
27
|
-
const isNotFile = ([, value]) => !(value instanceof ExtDomQuery.global().File);
|
|
28
|
-
const mapIntoUrlParam = keyVal => `${encodeURIComponent(keyVal[0])}=${encodeURIComponent(keyVal[1])}`;
|
|
41
|
+
const expandValueArrAndRename = (key: string) => assocValues[key].map((val: any) => paramsMapper(key, val));
|
|
42
|
+
const isPropertyKey = (key: string) => assocValues.hasOwnProperty(key);
|
|
43
|
+
const isNotFile = ([, value]: [string, any]) => !(value instanceof ExtDomQuery.global().File);
|
|
44
|
+
const mapIntoUrlParam = (keyVal: [string, any]) => `${encodeURIComponent(keyVal[0])}=${encodeURIComponent(keyVal[1])}`;
|
|
29
45
|
|
|
30
46
|
return new Es2019Array(...Object.keys(assocValues))
|
|
31
47
|
.filter(isPropertyKey)
|
|
@@ -40,17 +56,17 @@ export function encodeFormData(formData: Config,
|
|
|
40
56
|
* @param encoded encoded string
|
|
41
57
|
*/
|
|
42
58
|
export function decodeEncodedValues(encoded: string): string[][] {
|
|
43
|
-
const filterBlanks = item => !!(item || '').replace(/\s+/g, '');
|
|
44
|
-
const splitKeyValuePair = _line => {
|
|
59
|
+
const filterBlanks = (item: string) => !!(item || '').replace(/\s+/g, '');
|
|
60
|
+
const splitKeyValuePair = (_line: string) => {
|
|
45
61
|
let line = decodeURIComponent(_line);
|
|
46
62
|
let index = line.indexOf("=");
|
|
47
|
-
if (index
|
|
63
|
+
if (index === -1) {
|
|
48
64
|
return [line];
|
|
49
65
|
}
|
|
50
66
|
return [line.substring(0, index), line.substring(index + 1)];
|
|
51
67
|
};
|
|
52
68
|
|
|
53
|
-
let requestParamEntries = encoded.split(
|
|
69
|
+
let requestParamEntries = encoded.split("&");
|
|
54
70
|
return requestParamEntries.filter(filterBlanks).map(splitKeyValuePair);
|
|
55
71
|
}
|
|
56
72
|
|
|
@@ -61,10 +77,10 @@ export function decodeEncodedValues(encoded: string): string[][] {
|
|
|
61
77
|
*/
|
|
62
78
|
export function resolveFiles(dataSource: DQ): [string, File][] {
|
|
63
79
|
|
|
64
|
-
const expandFilesArr = ([key, files]) => {
|
|
65
|
-
return [...files].map(file => [key, file]);
|
|
80
|
+
const expandFilesArr = ([key, files]: any[]) => {
|
|
81
|
+
return [...files].map((file: File) => [key, file]);
|
|
66
82
|
}
|
|
67
|
-
const remapFileInput = fileInput => {
|
|
83
|
+
const remapFileInput = (fileInput: DQ) => {
|
|
68
84
|
return [fileInput.name.value || fileInput.id.value, fileInput.filesFromElem(0)];
|
|
69
85
|
}
|
|
70
86
|
|
|
@@ -105,5 +121,5 @@ function resolveViewState(parentItem: DomQuery): string[][] | [string, File][] {
|
|
|
105
121
|
export function getFormInputsAsArr(parentItem: DomQuery): string[][] | [string, File][] {
|
|
106
122
|
const standardInputs: any = resolveViewState(parentItem);
|
|
107
123
|
const fileInputs = resolveFiles(parentItem);
|
|
108
|
-
return standardInputs.concat(fileInputs)
|
|
109
|
-
}
|
|
124
|
+
return standardInputs.concat(fileInputs);
|
|
125
|
+
}
|
|
@@ -28,14 +28,14 @@ import {$faces, $nsp, HTML_CLIENT_WINDOW, HTML_VIEWSTATE, P_CLIENT_WINDOW, P_VIE
|
|
|
28
28
|
export class HiddenInputBuilder {
|
|
29
29
|
private namingContainerId?: string;
|
|
30
30
|
private parent?: DomQuery;
|
|
31
|
-
private namedViewRoot
|
|
31
|
+
private namedViewRoot = false;
|
|
32
32
|
private readonly name: string;
|
|
33
33
|
private readonly template: string;
|
|
34
34
|
|
|
35
|
-
constructor(
|
|
36
|
-
const isViewState = selector.
|
|
37
|
-
this.name = isViewState ? P_VIEWSTATE : P_CLIENT_WINDOW
|
|
38
|
-
this.template = isViewState ? HTML_VIEWSTATE : HTML_CLIENT_WINDOW
|
|
35
|
+
constructor(selector: string) {
|
|
36
|
+
const isViewState = selector.includes($nsp(P_VIEWSTATE));
|
|
37
|
+
this.name = isViewState ? P_VIEWSTATE : P_CLIENT_WINDOW;
|
|
38
|
+
this.template = isViewState ? HTML_VIEWSTATE : HTML_CLIENT_WINDOW;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
withNamingContainerId(namingContainer: string): HiddenInputBuilder {
|
|
@@ -55,39 +55,39 @@ export class HiddenInputBuilder {
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
build(): DomQuery {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return parseInt(ident);
|
|
65
|
-
})
|
|
66
|
-
.filter(item => {
|
|
67
|
-
return !isNaN(item);
|
|
68
|
-
})
|
|
69
|
-
.reduce((item1, item2) => {
|
|
70
|
-
return Math.max(item1, item2);
|
|
71
|
-
}, 0); //we start with 1 (see cnt++)
|
|
72
|
-
//the maximum new ident is the current max + 1
|
|
73
|
-
cnt++;
|
|
58
|
+
const newElement = DQ.fromMarkup($nsp(this.template));
|
|
59
|
+
newElement.id.value = this.buildId();
|
|
60
|
+
newElement.name.value = this.buildName();
|
|
61
|
+
this.parent?.append(newElement);
|
|
62
|
+
return newElement;
|
|
63
|
+
}
|
|
74
64
|
|
|
65
|
+
private buildId(): string {
|
|
66
|
+
const separator = $faces().separatorchar;
|
|
67
|
+
const parts = this.namingContainerId?.length ?
|
|
68
|
+
[this.namingContainerId, $nsp(this.name), this.nextIndex()] :
|
|
69
|
+
[$nsp(this.name), this.nextIndex()];
|
|
75
70
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
[this.namingContainerId, $nsp(this.name), cnt]:
|
|
79
|
-
[$nsp(this.name), cnt]).join(SEP);
|
|
71
|
+
return parts.join(separator);
|
|
72
|
+
}
|
|
80
73
|
|
|
81
|
-
|
|
82
|
-
if(this.namedViewRoot) {
|
|
83
|
-
|
|
84
|
-
[this.namingContainerId, $nsp(this.name)].join(SEP): $nsp(this.name);
|
|
85
|
-
} else {
|
|
86
|
-
newElement.name.value = $nsp(this.name);
|
|
74
|
+
private buildName(): string {
|
|
75
|
+
if (!this.namedViewRoot) {
|
|
76
|
+
return $nsp(this.name);
|
|
87
77
|
}
|
|
88
78
|
|
|
79
|
+
return this.namingContainerId?.length ?
|
|
80
|
+
[this.namingContainerId, $nsp(this.name)].join($faces().separatorchar) :
|
|
81
|
+
$nsp(this.name);
|
|
82
|
+
}
|
|
89
83
|
|
|
90
|
-
|
|
91
|
-
|
|
84
|
+
private nextIndex(): number {
|
|
85
|
+
const separator = $faces().separatorchar;
|
|
86
|
+
return DQ$(`[name*='${$nsp(this.name)}']`).asArray
|
|
87
|
+
.map(state => state.id.orElse("0").value)
|
|
88
|
+
.map(id => id.substring(id.lastIndexOf(separator) + 1))
|
|
89
|
+
.map(idSuffix => parseInt(idSuffix))
|
|
90
|
+
.filter(idSuffix => !isNaN(idSuffix))
|
|
91
|
+
.reduce((max, idSuffix) => Math.max(max, idSuffix), 0) + 1;
|
|
92
92
|
}
|
|
93
|
-
}
|
|
93
|
+
}
|