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.
Files changed (413) hide show
  1. package/AI_CONTRIBUTIONS.md +71 -0
  2. package/README.md +254 -78
  3. package/api-extractor.faces.json +38 -0
  4. package/dist/docs/assets/hierarchy.js +1 -1
  5. package/dist/docs/assets/navigation.js +1 -1
  6. package/dist/docs/assets/search.js +1 -1
  7. package/dist/docs/functions/faces.ajax.addOnError.html +2 -2
  8. package/dist/docs/functions/faces.ajax.addOnEvent.html +2 -2
  9. package/dist/docs/functions/faces.ajax.request.html +2 -2
  10. package/dist/docs/functions/faces.ajax.response.html +2 -2
  11. package/dist/docs/functions/faces.getClientWindow.html +2 -2
  12. package/dist/docs/functions/faces.getProjectStage.html +2 -2
  13. package/dist/docs/functions/faces.getViewState.html +1 -1
  14. package/dist/docs/functions/faces.push.close.html +1 -1
  15. package/dist/docs/functions/faces.push.init.html +6 -6
  16. package/dist/docs/functions/faces.push.open.html +1 -1
  17. package/dist/docs/functions/faces.util.chain.html +2 -2
  18. package/dist/docs/functions/myfaces.ab.html +3 -3
  19. package/dist/docs/functions/myfaces.onDomReady.html +1 -1
  20. package/dist/docs/functions/myfaces.reserveNamespace.html +1 -1
  21. package/dist/docs/hierarchy.html +1 -1
  22. package/dist/docs/index.html +292 -71
  23. package/dist/docs/interfaces/faces.AjaxData.html +6 -0
  24. package/dist/docs/interfaces/faces.AjaxError.html +18 -0
  25. package/dist/docs/interfaces/faces.AjaxEvent.html +8 -0
  26. package/dist/docs/interfaces/faces.ajax.RequestContext.html +6 -0
  27. package/dist/docs/interfaces/faces.ajax.RequestOptions.html +10 -0
  28. package/dist/docs/modules/faces.ajax.html +1 -1
  29. package/dist/docs/modules/faces.html +1 -1
  30. package/dist/docs/modules/faces.push.html +1 -1
  31. package/dist/docs/modules/faces.util.html +1 -1
  32. package/dist/docs/modules/myfaces.html +1 -1
  33. package/dist/docs/modules.html +1 -1
  34. package/dist/docs/types/faces.AjaxErrorStatus.html +2 -0
  35. package/dist/docs/types/faces.AjaxEventStatus.html +2 -0
  36. package/dist/docs/types/faces.ProjectStage.html +2 -0
  37. package/dist/docs/types/faces.ajax.OnErrorCallback.html +2 -0
  38. package/dist/docs/types/faces.ajax.OnEventCallback.html +2 -0
  39. package/dist/docs/types/faces.push.OnCloseHandler.html +2 -0
  40. package/dist/docs/types/faces.push.OnErrorHandler.html +2 -0
  41. package/dist/docs/types/faces.push.OnMessageHandler.html +2 -0
  42. package/dist/docs/types/faces.push.OnOpenHandler.html +2 -0
  43. package/dist/docs/variables/faces.contextpath.html +1 -1
  44. package/dist/docs/variables/faces.implversion.html +1 -1
  45. package/dist/docs/variables/faces.separatorchar.html +1 -1
  46. package/dist/docs/variables/faces.specversion.html +1 -1
  47. package/dist/docs/variables/myfaces.oam.html +1 -1
  48. package/dist/window/faces-development.js +1801 -499
  49. package/dist/window/faces-development.js.map +1 -1
  50. package/{target/api/_api.js → dist/window/faces.d.ts} +124 -151
  51. package/dist/window/faces.js +1 -1
  52. package/dist/window/faces.js.LICENSE.txt +0 -17
  53. package/dist/window/faces.js.map +1 -1
  54. package/dist/window/jsf-development.js +1806 -513
  55. package/dist/window/jsf-development.js.map +1 -1
  56. package/{target/src/main/typescript/api/_api.js → dist/window/jsf.d.ts} +125 -153
  57. package/dist/window/jsf.js +1 -1
  58. package/dist/window/jsf.js.LICENSE.txt +0 -17
  59. package/dist/window/jsf.js.map +1 -1
  60. package/package.json +22 -18
  61. package/scripts/build-dts.mjs +239 -0
  62. package/src/main/typescript/@types/definitions/index.d.ts +22 -122
  63. package/{target/test/frameworkBase/_ext/monadish/fixtures/test2.js → src/main/typescript/@types/definitions/modules.d.ts} +18 -2
  64. package/src/main/typescript/api/_api.ts +132 -29
  65. package/{target/test/frameworkBase/_ext/monadish/fixtures/test.js → src/main/typescript/api/_api_ae_stub.d.ts} +6 -2
  66. package/src/main/typescript/api/faces.ts +2 -2
  67. package/src/main/typescript/api/jsf.ts +15 -23
  68. package/src/main/typescript/impl/AjaxImpl.ts +15 -15
  69. package/src/main/typescript/impl/PushImpl.ts +139 -69
  70. package/src/main/typescript/impl/core/Const.ts +2 -2
  71. package/src/main/typescript/impl/i18n/Messages.ts +1 -1
  72. package/src/main/typescript/impl/util/Assertions.ts +1 -2
  73. package/src/main/typescript/impl/util/AsyncRunnable.ts +3 -4
  74. package/src/main/typescript/impl/util/ExtDomQuery.ts +19 -19
  75. package/src/main/typescript/impl/util/FileUtils.ts +30 -14
  76. package/src/main/typescript/impl/util/HiddenInputBuilder.ts +34 -34
  77. package/src/main/typescript/impl/util/Lang.ts +19 -22
  78. package/src/main/typescript/impl/util/XhrQueueController.ts +25 -3
  79. package/src/main/typescript/impl/xhrCore/ErrorData.ts +17 -12
  80. package/src/main/typescript/impl/xhrCore/EventData.ts +8 -7
  81. package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +3 -3
  82. package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +7 -6
  83. package/src/main/typescript/impl/xhrCore/Response.ts +3 -3
  84. package/src/main/typescript/impl/xhrCore/ResponseDataResolver.ts +0 -38
  85. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +17 -15
  86. package/src/main/typescript/impl/xhrCore/XhrFormData.ts +72 -63
  87. package/src/main/typescript/impl/xhrCore/XhrRequest.ts +80 -134
  88. package/src/main/typescript/mona_dish_shim.ts +6 -2
  89. package/src/main/typescript/myfaces/OamSubmit.ts +10 -6
  90. package/src/main/typescript/test/api/JsfPushShimTest.spec.ts +126 -0
  91. package/src/main/typescript/test/api/MyFacesABTest.spec.ts +16 -0
  92. package/src/main/typescript/test/api/PushTypeCompatibility.ts +65 -0
  93. package/src/main/typescript/test/frameworkBase/LangTest.spec.ts +16 -0
  94. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +1 -0
  95. package/src/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.ts +16 -0
  96. package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.ts +16 -0
  97. package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.ts +16 -0
  98. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +55 -9
  99. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +16 -0
  100. package/src/main/typescript/test/impl/AssertionsTest.spec.ts +168 -0
  101. package/src/main/typescript/test/impl/FileUtilsTest.spec.ts +126 -0
  102. package/src/main/typescript/test/impl/ImplTest.spec.ts +75 -1
  103. package/src/main/typescript/test/impl/ResponseDataResolverTest.spec.ts +62 -0
  104. package/src/main/typescript/test/impl/util/ExtDomQueryTest.spec.ts +91 -1
  105. package/src/main/typescript/test/impl/util/ExtLangTest.spec.ts +110 -0
  106. package/src/main/typescript/test/impl/util/HiddenInputBuilderTest.spec.ts +74 -0
  107. package/src/main/typescript/test/myfaces/OamSubmit.spec.ts +61 -1
  108. package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +191 -2
  109. package/src/main/typescript/test/xhrCore/ClientWindow.spec.ts +16 -0
  110. package/src/main/typescript/test/xhrCore/ErrorChainTest.spec.ts +14 -0
  111. package/src/main/typescript/test/xhrCore/FakeWebsocket.ts +21 -5
  112. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +363 -4
  113. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +218 -4
  114. package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +1 -1
  115. package/src/main/typescript/test/xhrCore/WebsocketTest.spec.ts +764 -0
  116. package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +265 -62
  117. package/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.ts +16 -0
  118. package/{target/src/main/typescript/test/xhrCore/FakeWebsocket.js → src/main/typescript/tsconfig.ae.json} +16 -23
  119. package/src/main/typescript/{tsconfig.json → tsconfig.dts.json} +11 -27
  120. package/src/main/typescript/tsconfig.test.json +17 -0
  121. package/tsconfig.api-extractor.json +17 -0
  122. package/.claude/settings.local.json +0 -16
  123. package/.github/workflows/codeql-analysis.yml +0 -83
  124. package/.github/workflows/nodejs.yml +0 -26
  125. package/.mocharc.json +0 -10
  126. package/.nyc_output/384344d4-4f46-455f-84c3-010f829098cb.json +0 -1
  127. package/.nyc_output/a0f90016-f4f9-4039-bb51-57f4f7050541.json +0 -1
  128. package/.nyc_output/db388b5d-0b79-4bce-afd2-001aaf6f0245.json +0 -1
  129. package/.nyc_output/processinfo/384344d4-4f46-455f-84c3-010f829098cb.json +0 -1
  130. package/.nyc_output/processinfo/a0f90016-f4f9-4039-bb51-57f4f7050541.json +0 -1
  131. package/.nyc_output/processinfo/db388b5d-0b79-4bce-afd2-001aaf6f0245.json +0 -1
  132. package/.nyc_output/processinfo/index.json +0 -1
  133. package/.nycrc +0 -6
  134. package/build.cmd +0 -1
  135. package/build.sh +0 -3
  136. package/mvnw +0 -286
  137. package/mvnw.cmd +0 -161
  138. package/plans for 4.0.1.txt +0 -8
  139. package/remap.ts +0 -51
  140. package/src/main/typescript/test/xhrCore/WebsocketTest.ts +0 -221
  141. package/target/api/_api.js.map +0 -1
  142. package/target/api/faces.js +0 -45
  143. package/target/api/faces.js.map +0 -1
  144. package/target/api/jsf.js +0 -56
  145. package/target/api/jsf.js.map +0 -1
  146. package/target/impl/AjaxImpl.js +0 -748
  147. package/target/impl/AjaxImpl.js.map +0 -1
  148. package/target/impl/PushImpl.js +0 -265
  149. package/target/impl/PushImpl.js.map +0 -1
  150. package/target/impl/core/Const.js +0 -177
  151. package/target/impl/core/Const.js.map +0 -1
  152. package/target/impl/core/ImplTypes.js +0 -38
  153. package/target/impl/core/ImplTypes.js.map +0 -1
  154. package/target/impl/i18n/Messages.js +0 -113
  155. package/target/impl/i18n/Messages.js.map +0 -1
  156. package/target/impl/util/Assertions.js +0 -101
  157. package/target/impl/util/Assertions.js.map +0 -1
  158. package/target/impl/util/AsyncRunnable.js +0 -78
  159. package/target/impl/util/AsyncRunnable.js.map +0 -1
  160. package/target/impl/util/ExtDomQuery.js +0 -306
  161. package/target/impl/util/ExtDomQuery.js.map +0 -1
  162. package/target/impl/util/FileUtils.js +0 -98
  163. package/target/impl/util/FileUtils.js.map +0 -1
  164. package/target/impl/util/HiddenInputBuilder.js +0 -83
  165. package/target/impl/util/HiddenInputBuilder.js.map +0 -1
  166. package/target/impl/util/IListener.js +0 -3
  167. package/target/impl/util/IListener.js.map +0 -1
  168. package/target/impl/util/Lang.js +0 -263
  169. package/target/impl/util/Lang.js.map +0 -1
  170. package/target/impl/util/XhrQueueController.js +0 -92
  171. package/target/impl/util/XhrQueueController.js.map +0 -1
  172. package/target/impl/xhrCore/ErrorData.js +0 -87
  173. package/target/impl/xhrCore/ErrorData.js.map +0 -1
  174. package/target/impl/xhrCore/EventData.js +0 -52
  175. package/target/impl/xhrCore/EventData.js.map +0 -1
  176. package/target/impl/xhrCore/IResponseProcessor.js +0 -3
  177. package/target/impl/xhrCore/IResponseProcessor.js.map +0 -1
  178. package/target/impl/xhrCore/RequestDataResolver.js +0 -186
  179. package/target/impl/xhrCore/RequestDataResolver.js.map +0 -1
  180. package/target/impl/xhrCore/ResonseDataResolver.js +0 -104
  181. package/target/impl/xhrCore/ResonseDataResolver.js.map +0 -1
  182. package/target/impl/xhrCore/Response.js +0 -186
  183. package/target/impl/xhrCore/Response.js.map +0 -1
  184. package/target/impl/xhrCore/ResponseDataResolver.js +0 -104
  185. package/target/impl/xhrCore/ResponseDataResolver.js.map +0 -1
  186. package/target/impl/xhrCore/ResponseProcessor.js +0 -468
  187. package/target/impl/xhrCore/ResponseProcessor.js.map +0 -1
  188. package/target/impl/xhrCore/XhrFormData.js +0 -163
  189. package/target/impl/xhrCore/XhrFormData.js.map +0 -1
  190. package/target/impl/xhrCore/XhrRequest.js +0 -433
  191. package/target/impl/xhrCore/XhrRequest.js.map +0 -1
  192. package/target/mona_dish_shim.js +0 -70
  193. package/target/mona_dish_shim.js.map +0 -1
  194. package/target/myfaces/OamSubmit.js +0 -128
  195. package/target/myfaces/OamSubmit.js.map +0 -1
  196. package/target/src/main/typescript/api/_api.js.map +0 -1
  197. package/target/src/main/typescript/api/faces.js +0 -45
  198. package/target/src/main/typescript/api/faces.js.map +0 -1
  199. package/target/src/main/typescript/api/jsf.js +0 -56
  200. package/target/src/main/typescript/api/jsf.js.map +0 -1
  201. package/target/src/main/typescript/impl/AjaxImpl.js +0 -748
  202. package/target/src/main/typescript/impl/AjaxImpl.js.map +0 -1
  203. package/target/src/main/typescript/impl/PushImpl.js +0 -265
  204. package/target/src/main/typescript/impl/PushImpl.js.map +0 -1
  205. package/target/src/main/typescript/impl/core/Const.js +0 -177
  206. package/target/src/main/typescript/impl/core/Const.js.map +0 -1
  207. package/target/src/main/typescript/impl/core/ImplTypes.js +0 -38
  208. package/target/src/main/typescript/impl/core/ImplTypes.js.map +0 -1
  209. package/target/src/main/typescript/impl/i18n/Messages.js +0 -113
  210. package/target/src/main/typescript/impl/i18n/Messages.js.map +0 -1
  211. package/target/src/main/typescript/impl/util/Assertions.js +0 -101
  212. package/target/src/main/typescript/impl/util/Assertions.js.map +0 -1
  213. package/target/src/main/typescript/impl/util/AsyncRunnable.js +0 -78
  214. package/target/src/main/typescript/impl/util/AsyncRunnable.js.map +0 -1
  215. package/target/src/main/typescript/impl/util/ExtDomQuery.js +0 -306
  216. package/target/src/main/typescript/impl/util/ExtDomQuery.js.map +0 -1
  217. package/target/src/main/typescript/impl/util/FileUtils.js +0 -98
  218. package/target/src/main/typescript/impl/util/FileUtils.js.map +0 -1
  219. package/target/src/main/typescript/impl/util/HiddenInputBuilder.js +0 -83
  220. package/target/src/main/typescript/impl/util/HiddenInputBuilder.js.map +0 -1
  221. package/target/src/main/typescript/impl/util/IListener.js +0 -3
  222. package/target/src/main/typescript/impl/util/IListener.js.map +0 -1
  223. package/target/src/main/typescript/impl/util/Lang.js +0 -263
  224. package/target/src/main/typescript/impl/util/Lang.js.map +0 -1
  225. package/target/src/main/typescript/impl/util/XhrQueueController.js +0 -92
  226. package/target/src/main/typescript/impl/util/XhrQueueController.js.map +0 -1
  227. package/target/src/main/typescript/impl/xhrCore/ErrorData.js +0 -87
  228. package/target/src/main/typescript/impl/xhrCore/ErrorData.js.map +0 -1
  229. package/target/src/main/typescript/impl/xhrCore/EventData.js +0 -52
  230. package/target/src/main/typescript/impl/xhrCore/EventData.js.map +0 -1
  231. package/target/src/main/typescript/impl/xhrCore/IResponseProcessor.js +0 -3
  232. package/target/src/main/typescript/impl/xhrCore/IResponseProcessor.js.map +0 -1
  233. package/target/src/main/typescript/impl/xhrCore/RequestDataResolver.js +0 -186
  234. package/target/src/main/typescript/impl/xhrCore/RequestDataResolver.js.map +0 -1
  235. package/target/src/main/typescript/impl/xhrCore/Response.js +0 -186
  236. package/target/src/main/typescript/impl/xhrCore/Response.js.map +0 -1
  237. package/target/src/main/typescript/impl/xhrCore/ResponseDataResolver.js +0 -104
  238. package/target/src/main/typescript/impl/xhrCore/ResponseDataResolver.js.map +0 -1
  239. package/target/src/main/typescript/impl/xhrCore/ResponseProcessor.js +0 -468
  240. package/target/src/main/typescript/impl/xhrCore/ResponseProcessor.js.map +0 -1
  241. package/target/src/main/typescript/impl/xhrCore/XhrFormData.js +0 -163
  242. package/target/src/main/typescript/impl/xhrCore/XhrFormData.js.map +0 -1
  243. package/target/src/main/typescript/impl/xhrCore/XhrRequest.js +0 -433
  244. package/target/src/main/typescript/impl/xhrCore/XhrRequest.js.map +0 -1
  245. package/target/src/main/typescript/mona_dish_shim.js +0 -70
  246. package/target/src/main/typescript/mona_dish_shim.js.map +0 -1
  247. package/target/src/main/typescript/myfaces/OamSubmit.js +0 -128
  248. package/target/src/main/typescript/myfaces/OamSubmit.js.map +0 -1
  249. package/target/src/main/typescript/test/api/MyFacesABTest.spec.js +0 -117
  250. package/target/src/main/typescript/test/api/MyFacesABTest.spec.js.map +0 -1
  251. package/target/src/main/typescript/test/frameworkBase/LangTest.spec.js +0 -123
  252. package/target/src/main/typescript/test/frameworkBase/LangTest.spec.js.map +0 -1
  253. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +0 -657
  254. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +0 -1
  255. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/LangTest.spec.js +0 -107
  256. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/LangTest.spec.js.map +0 -1
  257. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingProbes.js +0 -106
  258. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingProbes.js.map +0 -1
  259. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingTest.spec.js +0 -39
  260. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingTest.spec.js.map +0 -1
  261. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.js +0 -153
  262. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +0 -1
  263. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js +0 -2
  264. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js.map +0 -1
  265. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +0 -925
  266. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +0 -1
  267. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +0 -112
  268. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +0 -1
  269. package/target/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.js +0 -728
  270. package/target/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.js.map +0 -1
  271. package/target/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.js +0 -296
  272. package/target/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.js.map +0 -1
  273. package/target/src/main/typescript/test/impl/ImplTest.spec.js +0 -225
  274. package/target/src/main/typescript/test/impl/ImplTest.spec.js.map +0 -1
  275. package/target/src/main/typescript/test/impl/ImplTest_23.spec.js +0 -143
  276. package/target/src/main/typescript/test/impl/ImplTest_23.spec.js.map +0 -1
  277. package/target/src/main/typescript/test/impl/SeparatorCharsTest.spec.js +0 -106
  278. package/target/src/main/typescript/test/impl/SeparatorCharsTest.spec.js.map +0 -1
  279. package/target/src/main/typescript/test/impl/util/ExtDomQueryTest.spec.js +0 -77
  280. package/target/src/main/typescript/test/impl/util/ExtDomQueryTest.spec.js.map +0 -1
  281. package/target/src/main/typescript/test/myfaces/OamSubmit.spec.js +0 -118
  282. package/target/src/main/typescript/test/myfaces/OamSubmit.spec.js.map +0 -1
  283. package/target/src/main/typescript/test/myfaces/OnLoad.spec.js +0 -57
  284. package/target/src/main/typescript/test/myfaces/OnLoad.spec.js.map +0 -1
  285. package/target/src/main/typescript/test/myfaces/ReserveNamespace.spec.js +0 -60
  286. package/target/src/main/typescript/test/myfaces/ReserveNamespace.spec.js.map +0 -1
  287. package/target/src/main/typescript/test/queue/AsynchronousProbe.js +0 -93
  288. package/target/src/main/typescript/test/queue/AsynchronousProbe.js.map +0 -1
  289. package/target/src/main/typescript/test/queue/AsynchronousQueueTest.spec.js +0 -133
  290. package/target/src/main/typescript/test/queue/AsynchronousQueueTest.spec.js.map +0 -1
  291. package/target/src/main/typescript/test/xhrCore/ClientWindow.spec.js +0 -101
  292. package/target/src/main/typescript/test/xhrCore/ClientWindow.spec.js.map +0 -1
  293. package/target/src/main/typescript/test/xhrCore/ErrorChainTest.spec.js +0 -175
  294. package/target/src/main/typescript/test/xhrCore/ErrorChainTest.spec.js.map +0 -1
  295. package/target/src/main/typescript/test/xhrCore/EventTests.spec.js +0 -184
  296. package/target/src/main/typescript/test/xhrCore/EventTests.spec.js.map +0 -1
  297. package/target/src/main/typescript/test/xhrCore/FakeWebsocket.js.map +0 -1
  298. package/target/src/main/typescript/test/xhrCore/FileUploadTest.spec.js +0 -181
  299. package/target/src/main/typescript/test/xhrCore/FileUploadTest.spec.js.map +0 -1
  300. package/target/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.js +0 -226
  301. package/target/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.js.map +0 -1
  302. package/target/src/main/typescript/test/xhrCore/OamSubmitTest.spec.js +0 -199
  303. package/target/src/main/typescript/test/xhrCore/OamSubmitTest.spec.js.map +0 -1
  304. package/target/src/main/typescript/test/xhrCore/RequestParamsTest.spec.js +0 -567
  305. package/target/src/main/typescript/test/xhrCore/RequestParamsTest.spec.js.map +0 -1
  306. package/target/src/main/typescript/test/xhrCore/RequestTest.spec.js +0 -845
  307. package/target/src/main/typescript/test/xhrCore/RequestTest.spec.js.map +0 -1
  308. package/target/src/main/typescript/test/xhrCore/RequestTest_23.spec.js +0 -382
  309. package/target/src/main/typescript/test/xhrCore/RequestTest_23.spec.js.map +0 -1
  310. package/target/src/main/typescript/test/xhrCore/ResponseTest.spec.js +0 -667
  311. package/target/src/main/typescript/test/xhrCore/ResponseTest.spec.js.map +0 -1
  312. package/target/src/main/typescript/test/xhrCore/ResponseTest23.spec.js +0 -367
  313. package/target/src/main/typescript/test/xhrCore/ResponseTest23.spec.js.map +0 -1
  314. package/target/src/main/typescript/test/xhrCore/ShadowDomTest.spec.js +0 -123
  315. package/target/src/main/typescript/test/xhrCore/ShadowDomTest.spec.js.map +0 -1
  316. package/target/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.js +0 -147
  317. package/target/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.js.map +0 -1
  318. package/target/src/main/typescript/test/xhrCore/WebsocketTest.js +0 -207
  319. package/target/src/main/typescript/test/xhrCore/WebsocketTest.js.map +0 -1
  320. package/target/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.js +0 -149
  321. package/target/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.js.map +0 -1
  322. package/target/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.js +0 -130
  323. package/target/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.js.map +0 -1
  324. package/target/test/api/MyFacesABTest.spec.js +0 -117
  325. package/target/test/api/MyFacesABTest.spec.js.map +0 -1
  326. package/target/test/frameworkBase/LangTest.spec.js +0 -123
  327. package/target/test/frameworkBase/LangTest.spec.js.map +0 -1
  328. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +0 -657
  329. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +0 -1
  330. package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js +0 -107
  331. package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js.map +0 -1
  332. package/target/test/frameworkBase/_ext/monadish/MappingProbes.js +0 -106
  333. package/target/test/frameworkBase/_ext/monadish/MappingProbes.js.map +0 -1
  334. package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js +0 -39
  335. package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js.map +0 -1
  336. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +0 -153
  337. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +0 -1
  338. package/target/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js +0 -1
  339. package/target/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js.map +0 -1
  340. package/target/test/frameworkBase/_ext/monadish/fixtures/test.js.map +0 -1
  341. package/target/test/frameworkBase/_ext/monadish/fixtures/test2.js.map +0 -1
  342. package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +0 -925
  343. package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +0 -1
  344. package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +0 -112
  345. package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +0 -1
  346. package/target/test/frameworkBase/_ext/shared/StandardInits.js +0 -728
  347. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +0 -1
  348. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +0 -296
  349. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +0 -1
  350. package/target/test/frameworkBase/_ext/shared/fixtures/js/tobago.js +0 -16
  351. package/target/test/frameworkBase/_ext/shared/fixtures/js/tobago.js.map +0 -1
  352. package/target/test/impl/ImplTest.spec.js +0 -225
  353. package/target/test/impl/ImplTest.spec.js.map +0 -1
  354. package/target/test/impl/ImplTest_23.spec.js +0 -143
  355. package/target/test/impl/ImplTest_23.spec.js.map +0 -1
  356. package/target/test/impl/SeparatorCharsTest.spec.js +0 -106
  357. package/target/test/impl/SeparatorCharsTest.spec.js.map +0 -1
  358. package/target/test/impl/util/ExtDomQueryTest.spec.js +0 -77
  359. package/target/test/impl/util/ExtDomQueryTest.spec.js.map +0 -1
  360. package/target/test/myfaces/OamSubmit.spec.js +0 -118
  361. package/target/test/myfaces/OamSubmit.spec.js.map +0 -1
  362. package/target/test/myfaces/OnLoad.spec.js +0 -57
  363. package/target/test/myfaces/OnLoad.spec.js.map +0 -1
  364. package/target/test/myfaces/ReserveNamespace.spec.js +0 -60
  365. package/target/test/myfaces/ReserveNamespace.spec.js.map +0 -1
  366. package/target/test/queue/AsynchronousProbe.js +0 -93
  367. package/target/test/queue/AsynchronousProbe.js.map +0 -1
  368. package/target/test/queue/AsynchronousQueueTest.spec.js +0 -133
  369. package/target/test/queue/AsynchronousQueueTest.spec.js.map +0 -1
  370. package/target/test/xhrCore/ClientWindow.spec.js +0 -101
  371. package/target/test/xhrCore/ClientWindow.spec.js.map +0 -1
  372. package/target/test/xhrCore/ErrorChainTest.spec.js +0 -175
  373. package/target/test/xhrCore/ErrorChainTest.spec.js.map +0 -1
  374. package/target/test/xhrCore/EventTests.spec.js +0 -184
  375. package/target/test/xhrCore/EventTests.spec.js.map +0 -1
  376. package/target/test/xhrCore/FakeWebsocket.js +0 -38
  377. package/target/test/xhrCore/FakeWebsocket.js.map +0 -1
  378. package/target/test/xhrCore/FileUploadTest.spec.js +0 -181
  379. package/target/test/xhrCore/FileUploadTest.spec.js.map +0 -1
  380. package/target/test/xhrCore/NamespacesRequestTest.spec.js +0 -226
  381. package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +0 -1
  382. package/target/test/xhrCore/OamSubmitTest.spec.js +0 -199
  383. package/target/test/xhrCore/OamSubmitTest.spec.js.map +0 -1
  384. package/target/test/xhrCore/RequestParamsTest.spec.js +0 -567
  385. package/target/test/xhrCore/RequestParamsTest.spec.js.map +0 -1
  386. package/target/test/xhrCore/RequestTest.spec.js +0 -845
  387. package/target/test/xhrCore/RequestTest.spec.js.map +0 -1
  388. package/target/test/xhrCore/RequestTest_23.spec.js +0 -382
  389. package/target/test/xhrCore/RequestTest_23.spec.js.map +0 -1
  390. package/target/test/xhrCore/ResponseTest.spec.js +0 -667
  391. package/target/test/xhrCore/ResponseTest.spec.js.map +0 -1
  392. package/target/test/xhrCore/ResponseTest23.spec.js +0 -367
  393. package/target/test/xhrCore/ResponseTest23.spec.js.map +0 -1
  394. package/target/test/xhrCore/ShadowDomTest.spec.js +0 -123
  395. package/target/test/xhrCore/ShadowDomTest.spec.js.map +0 -1
  396. package/target/test/xhrCore/TobagoFileUploadTest.spec.js +0 -147
  397. package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +0 -1
  398. package/target/test/xhrCore/WebsocketTest.js +0 -207
  399. package/target/test/xhrCore/WebsocketTest.js.map +0 -1
  400. package/target/test/xhrCore/XhrFormDataTest.spec.js +0 -149
  401. package/target/test/xhrCore/XhrFormDataTest.spec.js.map +0 -1
  402. package/target/test/xhrCore/XhrRequestProgress.spec.js +0 -130
  403. package/target/test/xhrCore/XhrRequestProgress.spec.js.map +0 -1
  404. package/target/test/xhrCore/fixtures/addedViewHead1.js +0 -17
  405. package/target/test/xhrCore/fixtures/addedViewHead1.js.map +0 -1
  406. package/target/test/xhrCore/fixtures/addedViewHead2.js +0 -17
  407. package/target/test/xhrCore/fixtures/addedViewHead2.js.map +0 -1
  408. package/target/test/xhrCore/fixtures/addedViewHead3.js +0 -17
  409. package/target/test/xhrCore/fixtures/addedViewHead3.js.map +0 -1
  410. package/target/test/xhrCore/fixtures/nonce_script.js +0 -17
  411. package/target/test/xhrCore/fixtures/nonce_script.js.map +0 -1
  412. package/tsconfig.json +0 -9
  413. 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<V, K> = (key: V, item: K) => [V, K];
29
- const defaultParamsMapper: ParamsMapper<string, any> = (key, item) => [key, item];
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(private dataSource: DQ, private paramsMapper: ParamsMapper<string, any> = defaultParamsMapper, executes?: string[], private partialIds?: string[]) {
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
- * Collect and encode input elements.
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.resolveRequestType(this.dataSource, executes);
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
- * generic post init code, for now, this performs some post assign data post-processing
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 resolveRequestType(rootElement: DQ, executes?: Array<string>) {
130
- if (!executes || executes.indexOf(IDENT_NONE) != -1) {
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
- let viewStateElement = form.querySelectorAllDeep(`[name*='${$nsp(P_VIEWSTATE)}'`);
146
- let viewState = viewStateElement.inputValue;
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 mergeIntoThis = ([key, value]) => this.append(key).value = value;
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(partialId => this.remapKeyForNamingContainer(partialId));
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
- let inputs = getFormInputsAsArr(parentItem);
165
- inputs
131
+ getFormInputsAsArr(parentItem)
166
132
  .map(fixEmptyParameters)
167
133
  .map(namingContainerRemap)
168
- .filter(partialIdsFilter)
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
- return this.paramsMapper(key, "")[0];
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 responseContext: Config;
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
- let ignoreErr = failSaveExecute;
128
- let xhrObject = this.xhrObject;
129
- let sourceForm = DQ.byId(this.internalContext.getIf(CTX_PARAM_SRC_FRM_ID).value)
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 = executesArr();
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
- // adding timeout
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 (this.contentType != "undefined") {
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
- if(xhrObject?.upload) {
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 in rare cases triggers an error when cancelling a request internally, or when
286
- // in this case we simply ignore the request and clear up the queue, because
287
- // it is not safe anymore to proceed with the current queue
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
- const errorName = "Invalid Response";
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
- const errorName = "Invalid Response";
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
- const errorName = "Empty Response";
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: ErrorData = new 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: Function, errorMessage: string = "Generic HTTP Serror") {
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: Function) {
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
- // if stop progress true, the cleanup already has been performed
447
- if (this.stopProgress) {
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
- const isPost = this.ajaxType != REQ_TYPE_GET;
458
- if (formData.isMultipartRequest) {
459
- // in case of a multipart request we send in a formData object as body
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
- let eventHandler = resolveHandlerFunc(this.requestContext, this.responseContext, ON_EVENT);
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 = (responseFormatError) ? ErrorData.fromHttpConnection(exception.source, exception.type, exception.message ?? EMPTY_STR, exception.responseText, exception.responseXML, exception.responseCode, exception.status) : ErrorData.fromClient(exception);
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 sideffects with buttons we only can append the issuing item if no behavior event is set
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 = (!!eventType) && eventType != 'click';
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
- if((type == XhrRequest.TYPE_CHECKBOX || type == XhrRequest.TYPE_RADIO) && !issuingItem.checked) {
462
+ const isCheckable = type === XhrRequest.TYPE_CHECKBOX || type === XhrRequest.TYPE_RADIO;
463
+ if (isCheckable && !issuingItem.checked) {
518
464
  return;
519
- } else if((type == XhrRequest.TYPE_CHECKBOX || type == XhrRequest.TYPE_RADIO)) {
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/index";
32
- import * as _monaDish from "mona-dish/src/main/typescript/index";
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
- DQ.byId(document.forms[formName])
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
- let element = document.forms?.[formName]?.elements?.[name];
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: AssocArr<any> | Tuples<string, any> | null = {} ): boolean {
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
- DQ.byId(document.forms?.[formName] ?? document.getElementById(formName)).each(form => {
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
+ }