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
|
@@ -25,8 +25,8 @@ const ofAssoc = ExtLang.ofAssoc;
|
|
|
25
25
|
import {Es2019Array} from "mona-dish";
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
type ParamsMapper
|
|
29
|
-
const defaultParamsMapper: ParamsMapper
|
|
28
|
+
type ParamsMapper = (key: string, value: any) => [string, any];
|
|
29
|
+
const defaultParamsMapper: ParamsMapper = (key, item) => [key, item];
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* A unified form data class
|
|
@@ -59,56 +59,20 @@ export class XhrFormData extends Config {
|
|
|
59
59
|
* @param executes the executes id list for the elements to being processed
|
|
60
60
|
* @param partialIds partial ids to collect, to reduce the data sent down
|
|
61
61
|
*/
|
|
62
|
-
constructor(
|
|
62
|
+
constructor(dataSource: DQ, private paramsMapper: ParamsMapper = defaultParamsMapper, executes?: string[], partialIds?: string[]) {
|
|
63
63
|
super({});
|
|
64
|
-
//encode and append the issuing item if not a partial ids array of ids is passed
|
|
65
64
|
/*
|
|
66
|
-
* Spec. 13.3.1
|
|
67
|
-
*
|
|
68
|
-
* Additionally the hidden element jakarta.faces.ViewState
|
|
69
|
-
* Enhancement partial page submit
|
|
65
|
+
* Spec. 13.3.1 — order matters: detect multipart first, encode fields second,
|
|
66
|
+
* apply view state last (so it is not double-counted if already present in fields).
|
|
70
67
|
*/
|
|
71
|
-
this.
|
|
72
|
-
this.encodeSubmittableFields(this.dataSource, this.partialIds);
|
|
73
|
-
this.applyViewState(this.dataSource);
|
|
68
|
+
this.initFormData(dataSource, executes, partialIds);
|
|
74
69
|
}
|
|
75
70
|
|
|
76
71
|
/**
|
|
77
72
|
* @returns a Form data representation, this is needed for file submits
|
|
78
73
|
*/
|
|
79
74
|
toFormData(): FormData {
|
|
80
|
-
|
|
81
|
-
* expands key: [item1, item2]
|
|
82
|
-
* to: [{key: key, value: item1}, {key: key, value: item2}]
|
|
83
|
-
*/
|
|
84
|
-
let expandValueArrays = ([key, item]) => {
|
|
85
|
-
if (Array.isArray(item)) {
|
|
86
|
-
return new Es2019Array(...item).map(value => {
|
|
87
|
-
return {key, value}
|
|
88
|
-
})
|
|
89
|
-
}
|
|
90
|
-
return [{key, value: item}]
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/*
|
|
94
|
-
* remaps the incoming {key, value} tuples
|
|
95
|
-
* to naming container prefixed keys and values
|
|
96
|
-
*/
|
|
97
|
-
let remapForNamingContainer = ({key, value}) => {
|
|
98
|
-
key = this.remapKeyForNamingContainer(key);
|
|
99
|
-
return {key, value}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
/*
|
|
103
|
-
* collects everything into a FormData object
|
|
104
|
-
*/
|
|
105
|
-
return ofAssoc(this.value)
|
|
106
|
-
.flatMap(expandValueArrays)
|
|
107
|
-
.map(remapForNamingContainer)
|
|
108
|
-
.reduce((formData: FormData, {key, value}: any) => {
|
|
109
|
-
formData.append(key, value);
|
|
110
|
-
return formData;
|
|
111
|
-
}, new FormData()) as FormData;
|
|
75
|
+
return this.buildFormData();
|
|
112
76
|
}
|
|
113
77
|
|
|
114
78
|
/**
|
|
@@ -121,13 +85,19 @@ export class XhrFormData extends Config {
|
|
|
121
85
|
}
|
|
122
86
|
|
|
123
87
|
/**
|
|
124
|
-
*
|
|
125
|
-
* @param rootElement the root element which knows the request type (usually a form)
|
|
126
|
-
* @param executes the executable dom nodes which need to be processed into the form data, which we can send
|
|
127
|
-
* in our ajax request
|
|
88
|
+
* Drives the three-phase form data initialisation in the required order.
|
|
128
89
|
*/
|
|
129
|
-
private
|
|
130
|
-
|
|
90
|
+
private initFormData(dataSource: DQ, executes?: string[], partialIds?: string[]): void {
|
|
91
|
+
this.detectMultipartRequest(dataSource, executes);
|
|
92
|
+
this.encodeSubmittableFields(dataSource, partialIds);
|
|
93
|
+
this.applyViewState(dataSource);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Sets isMultipartRequest when any of the executed elements is a file input.
|
|
98
|
+
*/
|
|
99
|
+
private detectMultipartRequest(rootElement: DQ, executes?: Array<string>): void {
|
|
100
|
+
if (!executes || executes.includes(IDENT_NONE)) {
|
|
131
101
|
return;
|
|
132
102
|
}
|
|
133
103
|
this.isMultipartRequest = rootElement.isMultipartCandidate(true);
|
|
@@ -138,12 +108,12 @@ export class XhrFormData extends Config {
|
|
|
138
108
|
*
|
|
139
109
|
* @param form the form holding the view state value
|
|
140
110
|
*/
|
|
141
|
-
private applyViewState(form: DQ) {
|
|
111
|
+
private applyViewState(form: DQ): void {
|
|
142
112
|
if (this.getIf($nsp(P_VIEWSTATE)).isPresent()) {
|
|
143
113
|
return;
|
|
144
114
|
}
|
|
145
|
-
|
|
146
|
-
|
|
115
|
+
const viewStateElement = form.querySelectorAllDeep(`[name*='${$nsp(P_VIEWSTATE)}'`);
|
|
116
|
+
const viewState = viewStateElement.inputValue;
|
|
147
117
|
this.appendIf(viewState.isPresent(), this.remapKeyForNamingContainer(viewStateElement.name.value)).value = viewState.value;
|
|
148
118
|
}
|
|
149
119
|
|
|
@@ -152,24 +122,63 @@ export class XhrFormData extends Config {
|
|
|
152
122
|
* @param {Node} parentItem - form element item is nested in
|
|
153
123
|
* @param {Array} partialIds - ids fo PPS
|
|
154
124
|
*/
|
|
155
|
-
private encodeSubmittableFields(parentItem: DQ, partialIds: string[] = []) {
|
|
156
|
-
|
|
157
|
-
const
|
|
158
|
-
const namingContainerRemap = ([key, value]) => this.paramsMapper(key as string, value);
|
|
125
|
+
private encodeSubmittableFields(parentItem: DQ, partialIds: string[] = []): void {
|
|
126
|
+
const mergeIntoThis = ([key, value]: [string, any]) => this.append(key).value = value;
|
|
127
|
+
const namingContainerRemap = ([key, value]: [string, any]) => this.paramsMapper(key as string, value);
|
|
159
128
|
|
|
160
|
-
const remappedPartialIds = partialIds.map(
|
|
161
|
-
const partialIdsFilter = ([key, value]) => (!remappedPartialIds.length || key.indexOf("@") == 0) ? true :
|
|
162
|
-
remappedPartialIds.indexOf(key) != -1;
|
|
129
|
+
const remappedPartialIds = partialIds.map(id => this.remapKeyForNamingContainer(id));
|
|
163
130
|
|
|
164
|
-
|
|
165
|
-
inputs
|
|
131
|
+
getFormInputsAsArr(parentItem)
|
|
166
132
|
.map(fixEmptyParameters)
|
|
167
133
|
.map(namingContainerRemap)
|
|
168
|
-
.filter(
|
|
134
|
+
.filter(([key]) => this.isFieldIncluded(key, remappedPartialIds))
|
|
169
135
|
.forEach(mergeIntoThis);
|
|
170
136
|
}
|
|
171
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Returns true when the field should be included in the submission.
|
|
140
|
+
* Special "@"-prefixed keys (internal markers) are always included.
|
|
141
|
+
* When no partial ids are specified, everything passes through.
|
|
142
|
+
*/
|
|
143
|
+
private isFieldIncluded(key: string, remappedPartialIds: string[]): boolean {
|
|
144
|
+
if (!remappedPartialIds.length || key.startsWith("@")) {
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
return remappedPartialIds.includes(key);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Builds the FormData object from the internal key→value[] map.
|
|
152
|
+
* Arrays are expanded so each value becomes a separate FormData entry.
|
|
153
|
+
*/
|
|
154
|
+
private buildFormData(): FormData {
|
|
155
|
+
const expandValueArrays = ([key, item]: [string, any]) => {
|
|
156
|
+
if (Array.isArray(item)) {
|
|
157
|
+
return new Es2019Array(...item).map((value: any) => ({key, value}));
|
|
158
|
+
}
|
|
159
|
+
return [{key, value: item}];
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const remapForNamingContainer = ({key, value}: {key: string, value: any}) => ({
|
|
163
|
+
key: this.remapKeyForNamingContainer(key),
|
|
164
|
+
value
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
return ofAssoc(this.value)
|
|
168
|
+
.flatMap(expandValueArrays)
|
|
169
|
+
.map(remapForNamingContainer)
|
|
170
|
+
.reduce((formData: FormData, {key, value}: any) => {
|
|
171
|
+
formData.append(key, value);
|
|
172
|
+
return formData;
|
|
173
|
+
}, new FormData()) as FormData;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Applies paramsMapper to remap only the key, ignoring the value transformation.
|
|
178
|
+
* EMPTY_STR is passed as a placeholder since only the remapped key is used.
|
|
179
|
+
*/
|
|
172
180
|
private remapKeyForNamingContainer(key: string): string {
|
|
173
|
-
|
|
181
|
+
const [remappedKey] = this.paramsMapper(key, EMPTY_STR); // value is a required arg but irrelevant here; only the remapped key is used
|
|
182
|
+
return remappedKey;
|
|
174
183
|
}
|
|
175
184
|
}
|
|
@@ -29,7 +29,6 @@ import {
|
|
|
29
29
|
CONTENT_TYPE,
|
|
30
30
|
CTX_PARAM_MF_INTERNAL,
|
|
31
31
|
CTX_PARAM_REQ_PASS_THR,
|
|
32
|
-
ERROR,
|
|
33
32
|
HEAD_FACES_REQ,
|
|
34
33
|
MALFORMEDXML,
|
|
35
34
|
NO_TIMEOUT,
|
|
@@ -87,16 +86,14 @@ import {ExtConfig} from "../util/ExtDomQuery";
|
|
|
87
86
|
|
|
88
87
|
export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
89
88
|
|
|
90
|
-
private
|
|
91
|
-
|
|
92
|
-
private stopProgress = false;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
private xhrObject = new XMLHttpRequest();
|
|
96
|
-
|
|
89
|
+
private readonly ERR_INVALID_RESPONSE = "Invalid Response";
|
|
90
|
+
private readonly ERR_EMPTY_RESPONSE = "Empty Response";
|
|
97
91
|
static readonly TYPE_CHECKBOX = "checkbox";
|
|
98
92
|
static readonly TYPE_RADIO = "radio";
|
|
99
93
|
|
|
94
|
+
private responseContext!: Config;
|
|
95
|
+
private stopProgress = false;
|
|
96
|
+
private xhrObject = new XMLHttpRequest();
|
|
100
97
|
|
|
101
98
|
/**
|
|
102
99
|
* Required Parameters
|
|
@@ -124,14 +121,9 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
124
121
|
|
|
125
122
|
start(): IAsyncRunnable<XMLHttpRequest> {
|
|
126
123
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
let executesArr = () => {
|
|
133
|
-
return this.requestContext.getIf(CTX_PARAM_REQ_PASS_THR, P_EXECUTE).get(IDENT_NONE).value.split(/\s+/gi);
|
|
134
|
-
};
|
|
124
|
+
const ignoreErr = failSaveExecute;
|
|
125
|
+
const xhrObject = this.xhrObject;
|
|
126
|
+
const sourceForm = DQ.byId(this.internalContext.getIf(CTX_PARAM_SRC_FRM_ID).value);
|
|
135
127
|
|
|
136
128
|
try {
|
|
137
129
|
// encoded we need to decode
|
|
@@ -142,7 +134,7 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
142
134
|
// whatever the formData object delivers
|
|
143
135
|
// the partialIdsArray arr is almost deprecated legacy code where we allowed to send a separate list of partial
|
|
144
136
|
// ids for reduced load and server processing, this will be removed soon, we can handle the same via execute
|
|
145
|
-
const executes =
|
|
137
|
+
const executes = this.requestContext.getIf(CTX_PARAM_REQ_PASS_THR, P_EXECUTE).get(IDENT_NONE).value.split(/\s+/gi);
|
|
146
138
|
const partialIdsArray = this.internalContext.getIf(CTX_PARAM_PPS).value === true ? executes : [];
|
|
147
139
|
const formData: XhrFormData = new XhrFormData(
|
|
148
140
|
sourceForm,
|
|
@@ -150,8 +142,6 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
150
142
|
executes, partialIdsArray
|
|
151
143
|
);
|
|
152
144
|
|
|
153
|
-
this.contentType = formData.isMultipartRequest ? "undefined" : this.contentType;
|
|
154
|
-
|
|
155
145
|
// next step the pass through parameters are merged in for post params
|
|
156
146
|
this.requestContext.$nspEnabled = false;
|
|
157
147
|
const requestContext = this.requestContext;
|
|
@@ -188,21 +178,17 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
188
178
|
|
|
189
179
|
xhrObject.open(this.ajaxType, resolveFinalUrl(sourceForm, formData, this.ajaxType), true);
|
|
190
180
|
|
|
191
|
-
|
|
192
|
-
this.timeout ? xhrObject.timeout = this.timeout : null;
|
|
181
|
+
if (this.timeout) xhrObject.timeout = this.timeout;
|
|
193
182
|
|
|
194
183
|
// a bug in the xhr stub library prevents the setRequestHeader to be properly executed on fake xhr objects
|
|
195
184
|
// normal browsers should resolve this
|
|
196
185
|
// tests can quietly fail on this one
|
|
197
|
-
if (
|
|
186
|
+
if (!formData.isMultipartRequest) {
|
|
198
187
|
ignoreErr(() => xhrObject.setRequestHeader(CONTENT_TYPE, `${this.contentType}; charset=utf-8`));
|
|
199
188
|
}
|
|
200
189
|
|
|
201
190
|
ignoreErr(() => xhrObject.setRequestHeader(HEAD_FACES_REQ, VAL_AJAX));
|
|
202
|
-
|
|
203
|
-
// probably not needed anymore, will test this
|
|
204
|
-
// some webkit based mobile browsers do not follow the w3c spec of
|
|
205
|
-
// setting, they accept headers automatically
|
|
191
|
+
// some webkit based mobile browsers do not follow the w3c spec for Accept headers
|
|
206
192
|
ignoreErr(() => xhrObject.setRequestHeader(REQ_ACCEPT, STD_ACCEPT));
|
|
207
193
|
|
|
208
194
|
this.sendEvent(BEGIN);
|
|
@@ -216,8 +202,6 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
216
202
|
return this;
|
|
217
203
|
}
|
|
218
204
|
|
|
219
|
-
|
|
220
|
-
|
|
221
205
|
cancel() {
|
|
222
206
|
try {
|
|
223
207
|
// this causes onError to be called where the error
|
|
@@ -252,46 +236,12 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
252
236
|
this.onResponseProcessed(this.xhrObject, resolve);
|
|
253
237
|
};
|
|
254
238
|
|
|
255
|
-
|
|
256
|
-
//this is an extension so that we can send the upload object of the current
|
|
257
|
-
//request before any operation
|
|
258
|
-
this.internalContext.getIf(CTX_PARAM_UPLOAD_PREINIT).value?.(xhrObject.upload);
|
|
259
|
-
//now we hook in the upload events
|
|
260
|
-
xhrObject.upload.addEventListener("progress", (event: ProgressEvent) => {
|
|
261
|
-
this.internalContext.getIf(CTX_PARAM_UPLOAD_ON_PROGRESS).value?.(xhrObject.upload, event);
|
|
262
|
-
});
|
|
263
|
-
xhrObject.upload.addEventListener("load", (event: ProgressEvent) => {
|
|
264
|
-
this.internalContext.getIf(CTX_PARAM_UPLOAD_LOAD).value?.(xhrObject.upload, event);
|
|
265
|
-
});
|
|
266
|
-
xhrObject.upload.addEventListener("loadstart", (event: ProgressEvent) => {
|
|
267
|
-
this.internalContext.getIf(CTX_PARAM_UPLOAD_LOADSTART).value?.(xhrObject.upload, event);
|
|
268
|
-
});
|
|
269
|
-
xhrObject.upload.addEventListener("loadend", (event: ProgressEvent) => {
|
|
270
|
-
this.internalContext.getIf(CTX_PARAM_UPLOAD_LOADEND).value?.(xhrObject.upload, event);
|
|
271
|
-
});
|
|
272
|
-
xhrObject.upload.addEventListener("abort", (event: ProgressEvent) => {
|
|
273
|
-
this.internalContext.getIf(CTX_PARAM_UPLOAD_ABORT).value?.(xhrObject.upload, event);
|
|
274
|
-
});
|
|
275
|
-
xhrObject.upload.addEventListener("timeout", (event: ProgressEvent) => {
|
|
276
|
-
this.internalContext.getIf(CTX_PARAM_UPLOAD_TIMEOUT).value?.(xhrObject.upload, event);
|
|
277
|
-
});
|
|
278
|
-
xhrObject.upload.addEventListener("error", (event: ProgressEvent) => {
|
|
279
|
-
this.internalContext.getIf(CTX_PARAM_UPLOAD_ERROR).value?.(xhrObject.upload, event);
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
}
|
|
239
|
+
this.registerUploadCallbacks(xhrObject);
|
|
283
240
|
|
|
284
241
|
xhrObject.onerror = (errorData: any) => {
|
|
285
|
-
// Safari
|
|
286
|
-
//
|
|
287
|
-
//
|
|
288
|
-
|
|
289
|
-
// This bypasses a Safari issue where it keeps requests hanging after page unload
|
|
290
|
-
// and then triggers a cancel error on then instead of just stopping
|
|
291
|
-
// and clearing the code
|
|
292
|
-
// in a page unload case it is safe to clear the queue
|
|
293
|
-
// in the exact safari case any request after this one in the queue is invalid
|
|
294
|
-
// because the queue references xhr requests to a page which already is gone!
|
|
242
|
+
// Older Safari/WebKit and Chrome/Chromium versions can cancel XHRs during
|
|
243
|
+
// navigation or download handoff by triggering onerror with status=0/readyState=4.
|
|
244
|
+
// Treat that as queue cleanup rather than reporting a user-facing Ajax error.
|
|
295
245
|
if (this.isCancelledResponse(this.xhrObject)) {
|
|
296
246
|
/*
|
|
297
247
|
* this triggers the catch chain and after that finally
|
|
@@ -308,6 +258,35 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
308
258
|
};
|
|
309
259
|
}
|
|
310
260
|
|
|
261
|
+
private registerUploadCallbacks(xhrObject: XMLHttpRequest): void {
|
|
262
|
+
if (!xhrObject?.upload) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
// fire the pre-init hook so callers can inspect the upload object before any transfer starts
|
|
266
|
+
this.internalContext.getIf(CTX_PARAM_UPLOAD_PREINIT).value?.(xhrObject.upload);
|
|
267
|
+
xhrObject.upload.addEventListener("progress", (event: ProgressEvent) => {
|
|
268
|
+
this.internalContext.getIf(CTX_PARAM_UPLOAD_ON_PROGRESS).value?.(xhrObject.upload, event);
|
|
269
|
+
});
|
|
270
|
+
xhrObject.upload.addEventListener("load", (event: ProgressEvent) => {
|
|
271
|
+
this.internalContext.getIf(CTX_PARAM_UPLOAD_LOAD).value?.(xhrObject.upload, event);
|
|
272
|
+
});
|
|
273
|
+
xhrObject.upload.addEventListener("loadstart", (event: ProgressEvent) => {
|
|
274
|
+
this.internalContext.getIf(CTX_PARAM_UPLOAD_LOADSTART).value?.(xhrObject.upload, event);
|
|
275
|
+
});
|
|
276
|
+
xhrObject.upload.addEventListener("loadend", (event: ProgressEvent) => {
|
|
277
|
+
this.internalContext.getIf(CTX_PARAM_UPLOAD_LOADEND).value?.(xhrObject.upload, event);
|
|
278
|
+
});
|
|
279
|
+
xhrObject.upload.addEventListener("abort", (event: ProgressEvent) => {
|
|
280
|
+
this.internalContext.getIf(CTX_PARAM_UPLOAD_ABORT).value?.(xhrObject.upload, event);
|
|
281
|
+
});
|
|
282
|
+
xhrObject.upload.addEventListener("timeout", (event: ProgressEvent) => {
|
|
283
|
+
this.internalContext.getIf(CTX_PARAM_UPLOAD_TIMEOUT).value?.(xhrObject.upload, event);
|
|
284
|
+
});
|
|
285
|
+
xhrObject.upload.addEventListener("error", (event: ProgressEvent) => {
|
|
286
|
+
this.internalContext.getIf(CTX_PARAM_UPLOAD_ERROR).value?.(xhrObject.upload, event);
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
311
290
|
private isCancelledResponse(currentTarget: XMLHttpRequest): boolean {
|
|
312
291
|
return currentTarget?.status === 0 && // cancelled internally by browser
|
|
313
292
|
currentTarget?.readyState === 4 &&
|
|
@@ -321,30 +300,11 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
321
300
|
* Those methods are the callbacks called by
|
|
322
301
|
* the xhr object depending on its own state
|
|
323
302
|
*/
|
|
324
|
-
|
|
325
|
-
* client side abort... also here for now we clean the queue
|
|
326
|
-
*
|
|
327
|
-
* @param resolve
|
|
328
|
-
* @param reject
|
|
329
|
-
* @private
|
|
330
|
-
*/
|
|
331
|
-
private onAbort(resolve: Consumer<any>, reject: Consumer<any>) {
|
|
332
|
-
// reject means clear queue, in this case we abort entirely the processing
|
|
333
|
-
// does not happen yet, we have to probably rethink this strategy in the future
|
|
334
|
-
// when we introduce cancel functionality
|
|
303
|
+
private onAbort(_resolve: Consumer<any>, reject: Consumer<any>) {
|
|
335
304
|
this.handleHttpError(reject);
|
|
336
305
|
}
|
|
337
306
|
|
|
338
|
-
|
|
339
|
-
* request timeout, this must be handled like a generic server error per spec
|
|
340
|
-
* unfortunately, so we have to jump to the next item (we cancelled before)
|
|
341
|
-
* @param resolve
|
|
342
|
-
* @param reject
|
|
343
|
-
* @private
|
|
344
|
-
*/
|
|
345
|
-
private onTimeout(resolve: Consumer<any>, reject: Consumer<any>) {
|
|
346
|
-
// timeout also means we we probably should clear the queue,
|
|
347
|
-
// the state is unsafe for the next requests
|
|
307
|
+
private onTimeout(resolve: Consumer<any>, _reject: Consumer<any>) {
|
|
348
308
|
this.sendEvent(STATE_EVT_TIMEOUT);
|
|
349
309
|
this.handleHttpError(resolve);
|
|
350
310
|
}
|
|
@@ -368,29 +328,28 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
368
328
|
}
|
|
369
329
|
|
|
370
330
|
private processRequestErrors(resolve: Consumer<any>): boolean {
|
|
371
|
-
const responseXML = new XMLQuery(this.xhrObject?.responseXML);
|
|
331
|
+
const responseXML = new XMLQuery(this.xhrObject?.responseXML as any);
|
|
372
332
|
const responseText = this.xhrObject?.responseText ?? "";
|
|
373
333
|
const responseCode = this.xhrObject?.status ?? -1;
|
|
334
|
+
|
|
335
|
+
// HTTP status takes priority: a non-2xx response is always an HTTP error,
|
|
336
|
+
// regardless of what the body contains (e.g. an HTML error page from a 404
|
|
337
|
+
// must not be misreported as malformedXML).
|
|
338
|
+
if (responseCode >= 300 || responseCode < 200) {
|
|
339
|
+
this.handleHttpError(resolve);
|
|
340
|
+
return true;
|
|
341
|
+
}
|
|
374
342
|
if(responseXML.isXMLParserError()) {
|
|
375
343
|
// Firefox: malformed XML produces a Document with <parsererror>
|
|
376
|
-
|
|
377
|
-
const errorMessage = "The response xml is invalid";
|
|
378
|
-
this.handleGenericResponseError(errorName, errorMessage, MALFORMEDXML, resolve);
|
|
344
|
+
this.handleGenericResponseError(this.ERR_INVALID_RESPONSE, "The response xml is invalid", MALFORMEDXML, resolve);
|
|
379
345
|
return true;
|
|
380
346
|
} else if(responseXML.isAbsent() && responseText.trim().length > 0) {
|
|
381
347
|
// Chrome: responseXML is null for unparseable XML, but responseText has content
|
|
382
|
-
|
|
383
|
-
const errorMessage = "The response xml is invalid";
|
|
384
|
-
this.handleGenericResponseError(errorName, errorMessage, MALFORMEDXML, resolve);
|
|
348
|
+
this.handleGenericResponseError(this.ERR_INVALID_RESPONSE, "The response xml is invalid", MALFORMEDXML, resolve);
|
|
385
349
|
return true;
|
|
386
350
|
} else if(responseXML.isAbsent()) {
|
|
387
351
|
// Truly empty response
|
|
388
|
-
|
|
389
|
-
const errorMessage = "The response has provided no data";
|
|
390
|
-
this.handleGenericResponseError(errorName, errorMessage, EMPTY_RESPONSE, resolve);
|
|
391
|
-
return true;
|
|
392
|
-
} else if (responseCode >= 300 || responseCode < 200) {
|
|
393
|
-
this.handleHttpError(resolve);
|
|
352
|
+
this.handleGenericResponseError(this.ERR_EMPTY_RESPONSE, "The response has provided no data", EMPTY_RESPONSE, resolve);
|
|
394
353
|
return true;
|
|
395
354
|
}
|
|
396
355
|
return false;
|
|
@@ -398,7 +357,7 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
398
357
|
|
|
399
358
|
|
|
400
359
|
private handleGenericResponseError(errorName: string, errorMessage: string, responseStatus: string, resolve: (s?: any) => void) {
|
|
401
|
-
const errorData
|
|
360
|
+
const errorData = new ErrorData(
|
|
402
361
|
this.internalContext.getIf(CTX_PARAM_SRC_CTL_ID).value,
|
|
403
362
|
errorName, errorMessage,
|
|
404
363
|
this.xhrObject?.responseText ?? "",
|
|
@@ -409,7 +368,7 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
409
368
|
this.finalizeError(errorData, resolve);
|
|
410
369
|
}
|
|
411
370
|
|
|
412
|
-
private handleHttpError(resolveOrReject:
|
|
371
|
+
private handleHttpError(resolveOrReject: Consumer<any>, errorMessage: string = "Generic HTTP Error") {
|
|
413
372
|
this.stopProgress = true;
|
|
414
373
|
|
|
415
374
|
const errorData = new ErrorData(
|
|
@@ -423,7 +382,7 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
423
382
|
this.finalizeError(errorData, resolveOrReject);
|
|
424
383
|
}
|
|
425
384
|
|
|
426
|
-
private finalizeError(errorData: ErrorData, resolveOrReject:
|
|
385
|
+
private finalizeError(errorData: ErrorData, resolveOrReject: Consumer<any>) {
|
|
427
386
|
try {
|
|
428
387
|
this.handleError(errorData, true);
|
|
429
388
|
} finally {
|
|
@@ -435,33 +394,18 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
435
394
|
}
|
|
436
395
|
}
|
|
437
396
|
|
|
438
|
-
/**
|
|
439
|
-
* last minute cleanup, the request now either is fully done
|
|
440
|
-
* or not by having had a cancel or error event be
|
|
441
|
-
* @param data
|
|
442
|
-
* @param resolve
|
|
443
|
-
* @private
|
|
444
|
-
*/
|
|
445
397
|
private onResponseProcessed(data: any, resolve: Consumer<any>) {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
return;
|
|
398
|
+
if (!this.stopProgress) {
|
|
399
|
+
resolve(data);
|
|
449
400
|
}
|
|
450
|
-
/*
|
|
451
|
-
* normal case, cleanup == next item if possible
|
|
452
|
-
*/
|
|
453
|
-
resolve(data);
|
|
454
401
|
}
|
|
455
402
|
|
|
456
403
|
private sendRequest(formData: XhrFormData) {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
this.xhrObject.send((isPost) ? formData.toFormData() : null);
|
|
461
|
-
} else {
|
|
462
|
-
// in case of a normal request we send it normally
|
|
463
|
-
this.xhrObject.send((isPost) ? formData.toString() : null);
|
|
404
|
+
if (this.ajaxType === REQ_TYPE_GET) {
|
|
405
|
+
this.xhrObject.send(null);
|
|
406
|
+
return;
|
|
464
407
|
}
|
|
408
|
+
this.xhrObject.send(formData.isMultipartRequest ? formData.toFormData() : formData.toString());
|
|
465
409
|
}
|
|
466
410
|
|
|
467
411
|
/*
|
|
@@ -474,7 +418,7 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
474
418
|
// this in onError, but also we cannot swallow it.
|
|
475
419
|
// We need to resolve the local handlers lazily,
|
|
476
420
|
// because some frameworks might decorate them over the context in the response
|
|
477
|
-
|
|
421
|
+
const eventHandler = resolveHandlerFunc(this.requestContext, this.responseContext, ON_EVENT);
|
|
478
422
|
Implementation.sendEvent(eventData, eventHandler);
|
|
479
423
|
} catch (e) {
|
|
480
424
|
e.source = e?.source ?? this.requestContext.getIf(SOURCE).value;
|
|
@@ -485,25 +429,26 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
485
429
|
}
|
|
486
430
|
}
|
|
487
431
|
|
|
488
|
-
private handleErrorAndClearQueue(e, responseFormatError: boolean = false) {
|
|
432
|
+
private handleErrorAndClearQueue(e: any, responseFormatError: boolean = false) {
|
|
489
433
|
this.handleError(e, responseFormatError);
|
|
490
434
|
this.reject(e);
|
|
491
435
|
}
|
|
492
436
|
|
|
493
|
-
private handleError(exception, responseFormatError: boolean = false) {
|
|
494
|
-
const errorData =
|
|
437
|
+
private handleError(exception: any, responseFormatError: boolean = false) {
|
|
438
|
+
const errorData = responseFormatError
|
|
439
|
+
? ErrorData.fromHttpConnection(exception.source, exception.type, exception.message ?? EMPTY_STR, exception.responseText, exception.responseXML, exception.responseCode, exception.status)
|
|
440
|
+
: ErrorData.fromClient(exception);
|
|
495
441
|
const eventHandler = resolveHandlerFunc(this.requestContext, this.responseContext, ON_ERROR);
|
|
496
|
-
|
|
497
442
|
Implementation.sendError(errorData, eventHandler);
|
|
498
443
|
}
|
|
499
444
|
|
|
500
445
|
private appendIssuingItem(formData: XhrFormData) {
|
|
501
446
|
const issuingItemId = this.internalContext.getIf(CTX_PARAM_SRC_CTL_ID).value;
|
|
502
447
|
|
|
503
|
-
//to avoid
|
|
448
|
+
//to avoid side effects with buttons we only can append the issuing item if no behavior event is set
|
|
504
449
|
//MYFACES-4679!
|
|
505
450
|
const eventType = formData.getIf($nsp(P_BEHAVIOR_EVENT)).value?.[0] ?? null;
|
|
506
|
-
const isBehaviorEvent =
|
|
451
|
+
const isBehaviorEvent = !!eventType && eventType !== 'click';
|
|
507
452
|
|
|
508
453
|
//not encoded
|
|
509
454
|
if(issuingItemId && formData.getIf(issuingItemId).isAbsent() && !isBehaviorEvent) {
|
|
@@ -514,9 +459,10 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
514
459
|
|
|
515
460
|
//Checkbox and radio only value pass if checked is set, otherwise they should not show
|
|
516
461
|
//up at all, and if checked is set, they either can have a value or simply being boolean
|
|
517
|
-
|
|
462
|
+
const isCheckable = type === XhrRequest.TYPE_CHECKBOX || type === XhrRequest.TYPE_RADIO;
|
|
463
|
+
if (isCheckable && !issuingItem.checked) {
|
|
518
464
|
return;
|
|
519
|
-
} else if(
|
|
465
|
+
} else if (isCheckable) {
|
|
520
466
|
arr.assign(issuingItemId).value = itemValue.orElse(true).value;
|
|
521
467
|
} else if (itemValue.isPresent()) {
|
|
522
468
|
arr.assign(issuingItemId).value = itemValue.value;
|
|
@@ -525,4 +471,4 @@ export class XhrRequest extends AsyncRunnable<XMLHttpRequest> {
|
|
|
525
471
|
formData.shallowMerge(arr, true, true);
|
|
526
472
|
}
|
|
527
473
|
}
|
|
528
|
-
}
|
|
474
|
+
}
|
|
@@ -24,10 +24,14 @@
|
|
|
24
24
|
* Used via tsconfig paths (for tests/tsx). Webpack keeps its own alias to
|
|
25
25
|
* index_core.ts for the reduced-core production bundle.
|
|
26
26
|
*
|
|
27
|
+
* Points to dist/typescript/index_core so that TypeScript 6 with
|
|
28
|
+
* moduleResolution:bundler can find the .ts source (no .d.ts alongside the
|
|
29
|
+
* UMD bundles). Uses index_core to avoid the optional crypto-js dependency.
|
|
30
|
+
*
|
|
27
31
|
* Both import styles work:
|
|
28
32
|
* import { Lang } from 'mona-dish' // named import
|
|
29
33
|
* import pkg from 'mona-dish'; const { Lang } = pkg // default import
|
|
30
34
|
*/
|
|
31
|
-
export * from "mona-dish/src/main/typescript/
|
|
32
|
-
import * as _monaDish from "mona-dish/src/main/typescript/
|
|
35
|
+
export * from "../../../node_modules/mona-dish/src/main/typescript/index_core";
|
|
36
|
+
import * as _monaDish from "../../../node_modules/mona-dish/src/main/typescript/index_core";
|
|
33
37
|
export default _monaDish;
|
|
@@ -37,7 +37,8 @@ export namespace oam {
|
|
|
37
37
|
* @param value the value to be rendered
|
|
38
38
|
*/
|
|
39
39
|
export const setHiddenInput = function (formName: string, name: string, value: string): void {
|
|
40
|
-
|
|
40
|
+
const forms = document.forms as HTMLCollectionOf<HTMLFormElement> & {[key: string]: HTMLFormElement};
|
|
41
|
+
DQ.byId(forms[formName])
|
|
41
42
|
.each(form => {
|
|
42
43
|
const input = form.querySelectorAll(`input[type='hidden'][name='${name}']`);
|
|
43
44
|
if (input.isPresent()) {
|
|
@@ -57,7 +58,9 @@ export namespace oam {
|
|
|
57
58
|
* @param name the name of the input field
|
|
58
59
|
*/
|
|
59
60
|
export const clearHiddenInput = function (formName: string, name: string): void {
|
|
60
|
-
|
|
61
|
+
const forms = document.forms as HTMLCollectionOf<HTMLFormElement> & {[key: string]: HTMLFormElement};
|
|
62
|
+
const elements = forms?.[formName]?.elements as HTMLFormControlsCollection & {[key: string]: Element};
|
|
63
|
+
let element = elements?.[name];
|
|
61
64
|
if(!element) {
|
|
62
65
|
return;
|
|
63
66
|
}
|
|
@@ -75,7 +78,7 @@ export namespace oam {
|
|
|
75
78
|
* @param target
|
|
76
79
|
* @param params
|
|
77
80
|
*/
|
|
78
|
-
export const submitForm = function (formName: string, linkId: string | null = null, target: string |null = null, params:
|
|
81
|
+
export const submitForm = function (formName: string, linkId: string | null = null, target: string |null = null, params: Record<string, any> | [string, any][] | null = {} ): boolean {
|
|
79
82
|
|
|
80
83
|
|
|
81
84
|
//handle a possible incoming null, not sure if this is used that way anywhere, but we allow it
|
|
@@ -95,7 +98,8 @@ export namespace oam {
|
|
|
95
98
|
myfaces.oam.setHiddenInput(formName, `${formName}:_idcl`, linkId ?? '');
|
|
96
99
|
|
|
97
100
|
|
|
98
|
-
|
|
101
|
+
const forms = document.forms as HTMLCollectionOf<HTMLFormElement> & {[key: string]: HTMLFormElement};
|
|
102
|
+
DQ.byId(forms?.[formName] ?? document.getElementById(formName)).each(form => {
|
|
99
103
|
const ATTR_TARGET = "target";
|
|
100
104
|
const formElement = form.getAsElem(0).value as HTMLFormElement;
|
|
101
105
|
const oldTarget = (form.getAsElem(0).value as HTMLFormElement).getAttribute("target");
|
|
@@ -104,7 +108,7 @@ export namespace oam {
|
|
|
104
108
|
(form.getAsElem(0).value as HTMLFormElement).setAttribute("target", target);
|
|
105
109
|
}
|
|
106
110
|
|
|
107
|
-
const result = formElement?.onsubmit?.(null);
|
|
111
|
+
const result = formElement?.onsubmit?.(null as any);
|
|
108
112
|
|
|
109
113
|
try {
|
|
110
114
|
if ((!!result) || 'undefined' == typeof result) {
|
|
@@ -129,4 +133,4 @@ export namespace oam {
|
|
|
129
133
|
});
|
|
130
134
|
return false;
|
|
131
135
|
};
|
|
132
|
-
}
|
|
136
|
+
}
|