jsf.js_next_gen 4.1.0-beta.10 → 4.1.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,54 +1,53 @@
1
- # 🚀 Scratchpad for the typescript based reimplementation of jsf js
1
+ # 🚀 Scratchpad for the TypeScript-based reimplementation of jsf.js
2
2
 
3
3
  ## What is this?
4
4
 
5
- This project is a work in progress for a next gen typescript based
6
- reimplementation of jsf.js/faces.js
5
+ This project is a work in progress for a next-generation TypeScript-based
6
+ reimplementation of jsf.js/faces.js.
7
7
 
8
- The main goal is maintainability. It omits legacy browsers
9
- with Edge 14 and Ecmascript 2015 being the browser and ES baseline for the moment.
8
+ The main goal is maintainability. It omits legacy browsers,
9
+ with Edge 14 and ECMAScript 2015 as the browser and ES baseline for now.
10
10
 
11
- It uses functional constructs on micro scale
12
- to keep the maintainability and uses
13
- my own [mona-dish](https://github.com/werpu/mona-dish/) project as core framework base, to avoid
14
- unnecessary colliding dependencies.
11
+ It uses functional constructs on a small scale for maintainability and uses
12
+ my own [mona-dish](https://github.com/werpu/mona-dish/) project as its core framework base to avoid
13
+ unnecessary dependency collisions.
15
14
 
16
- But it still uses classes modules and inheritance
15
+ But it still uses classes, modules, and inheritance
17
16
  for code structuring.
18
- The reason for this is, I do not like the one function for all
19
- approach, especially given we have Typescript now as implementation language
20
- which allows a proper code structuring and modularization.
17
+ The reason for this is that I do not like the one-function-for-all
18
+ approach, especially since TypeScript is now the implementation language
19
+ and allows proper code structure and modularization.
21
20
 
22
21
  Webpack can take care of the packaging.
23
22
 
24
- Having smaller code parts, makes it easier to test certain
23
+ Having smaller code parts makes it easier to test certain
25
24
  aspects of the implementation.
26
25
 
27
- Also one additional aspect of the new implementation: it has a proper
28
- test coverage via Mocha based unit tests.
26
+ One additional aspect of the new implementation: it has proper
27
+ test coverage via Mocha-based unit tests.
29
28
 
30
29
  This was also severely lacking in my old implementation
31
- where I just ran a set of 20 integration tests on macro scale.
30
+ where I just ran a set of 20 integration tests on a macro scale.
32
31
 
33
32
  ## Status
34
33
 
35
34
  We now have a stable version!
36
- The current stable version (and first stable version is 4.0)
35
+ The current stable version, and first stable version, is 4.0.
37
36
  Why 4.0 and not 1.0?
38
- The reason for this is, it is faces 4.0 compliant (but also faces 2.3 compliant)
39
- and also used in MyFaces 4.0.
40
- In order to avoid version confusion the projects stable version always will be in
41
- sync with the Faces implementation level it provides now and in the future.
37
+ The reason is that it is Faces 4.0 compliant, but also Faces 2.3 compliant,
38
+ and is used in MyFaces 4.0.
39
+ To avoid version confusion, the project's stable version will always stay
40
+ in sync with the Faces implementation level it provides now and in the future.
42
41
 
43
- ### Special info
44
- Due to a small api change, if you want to embed the 4.0 version (faces.js)
42
+ ### Special Info
43
+ Due to a small API change, if you want to embed the 4.0 version (faces.js)
45
44
  in your code, a new attribute specified by the Faces 4.0 spec is not set
46
- at its proper value, *contextpath*. This attribute atm is a value expression
45
+ to its proper value: *contextpath*. This attribute is currently a value expression
47
46
  which needs to be set by the loading implementation.
48
47
 
49
- Now if you want to provide your own embedded solution and you will have
48
+ If you want to provide your own embedded solution, you will have
50
49
  to set this value yourself. While my code does not use the attribute in the faces
51
- namespace, other libraries or the users might.
50
+ namespace, other libraries or users might.
52
51
 
53
52
  If you serve the code from MyFaces 4 instead of embedding it, the value will be preset
54
53
  by the internal resource loader.
@@ -59,90 +58,91 @@ All other attributes behave the same in both versions as in the original legacy
59
58
 
60
59
 
61
60
 
62
- ### General build
61
+ ### General Build
63
62
 
64
- run
65
-
66
- * npm install
63
+ Run:
64
+ * npm install ;to install the build time dependencies
65
+ * npm run build
67
66
 
68
67
  #### On Windows
69
68
 
70
- if not done yet
69
+ If not done yet:
71
70
 
72
71
  * npm install --global --production windows-build-tools
73
72
 
74
- run
73
+
74
+ Run:
75
75
 
76
- * npm install
76
+ * npm run build
77
77
 
78
78
 
79
79
  ### Tests
80
80
 
81
- run
81
+ Run:
82
82
 
83
- * npm test
83
+ * npm run test
84
84
 
85
85
  ### Test Coverage
86
86
 
87
- * npm coverage
87
+ * npm run coverage
88
88
 
89
89
 
90
90
 
91
91
  ### Changelist compared to the original implementation
92
92
 
93
93
  * *no_portlet_env* is no more
94
- the configuration parameter 'no_portlet_env' has become obsolete with
95
- jsf 2.3 which introduced a proper namespaced viewstate handling
96
- so it is gone now
94
+ The configuration parameter `no_portlet_env` became obsolete with
95
+ JSF 2.3, which introduced proper namespaced view state handling,
96
+ so it is gone now.
97
97
 
98
98
  * pps disabled for the moment
99
99
 
100
- We had a special pps handling introduced in myfaces, a feature
100
+ We had special PPS handling introduced in MyFaces, a feature
101
101
  probably never used (you basically could reduce the parameters
102
- sent down by sending a list of pps ids). I have disabled it for the time being.
103
- The code still is in there for the moment, but will be dropped
102
+ sent down by sending a list of PPS IDs). I have disabled it for the time being.
103
+ The code is still there for now, but it will be dropped
104
104
  if no demand arises to enable it again.
105
105
 
106
106
  * legacy browsers
107
107
 
108
- In order to improve the maintainability I have dropped a lot
108
+ In order to improve maintainability, I have dropped a lot
109
109
  of shim and legacy code which was needed to support old browsers.
110
- Since our main aim is long term maintainability there is a clear cut.
110
+ Since our main aim is long-term maintainability, there is a clear cut.
111
111
  The lowest supported browser for the moment is Edge 14.
112
- Older browsers are now cut off. This should suffice for most, if
113
- not all important environments. If you still use an older browser than
114
- Edge 14 you still can revert to the old codebase for the time being
115
- (final cutoff point probably will come within the next few years)
112
+ Older browsers are now cut off. This should suffice for most, if
113
+ not all, important environments. If you still use a browser older than
114
+ Edge 14, you can still revert to the old codebase for the time being.
115
+ The final cutoff point will probably come within the next few years.
116
116
 
117
117
 
118
118
  * performance
119
119
 
120
- Given that we now have faster browsers and end user devices in the mobile
121
- area than 10 years ago and the spec conformity has improved a lot, my main focus was maintainability.
122
- Maintainability and readability now comes before performance. So I sacrificed some
123
- of the performance to achieve it.
124
- Given that the most critical performance hits do not happen in the ajax area
120
+ Given that we now have faster browsers and end-user devices in the mobile
121
+ area than 10 years ago, and spec conformity has improved a lot, my main focus was maintainability.
122
+ Maintainability and readability now come before performance, so I sacrificed some
123
+ performance to achieve it.
124
+ Given that the most critical performance hits do not happen in the AJAX area,
125
125
  this is a sacrifice I can live with, for the time being.
126
126
 
127
- * Client side i18n
127
+ * Client-side i18n
128
128
 
129
- The client side i18n error message translations have become more
129
+ The client-side i18n error message translations have become more
130
130
  of a liability than a feature.
131
- For the time being all client side errors are reported in english.
132
- I can reintroduce them, if there is real demand.
131
+ For the time being, all client-side errors are reported in English.
132
+ I can reintroduce them if there is real demand.
133
133
  But the size and maintainability tradeoff, compared to what they
134
- bring was not worth it to keep them anymore.
134
+ bring, was not worth keeping them anymore.
135
135
 
136
136
 
137
137
  * Mapping file support
138
138
 
139
139
  The original implementation had various builds to support easier debugging (split, combined, compressed)
140
140
 
141
- We now have only two builds prod and development.
142
- However I have introduced a mapping file support.
141
+ We now have only two builds: production and development.
142
+ However, I have introduced mapping file support.
143
143
  To enable this support you have to reference the FacesJSMappingDecorator unless the mapping file
144
144
  is reachable via the normal request (mapping files are bundled).
145
- This works for normal includes, but if you include the jsf.js in a resource library you have to use
145
+ This works for normal includes, but if you include jsf.js in a resource library, you have to use
146
146
  the decorator provided.
147
147
 
148
148
  Usage *faces-config.xml*
@@ -153,12 +153,12 @@ Usage *faces-config.xml*
153
153
  </application>
154
154
  ```
155
155
 
156
- This resource decorator detects automatically a faces*.js file coming from a resource library
157
- and adjusts the references in the resource accordingly to the request patterns
156
+ This resource decorator automatically detects a faces*.js file coming from a resource library
157
+ and adjusts the references in the resource according to the request patterns.
158
158
 
159
159
  ## Upload Support
160
160
 
161
- As non standard extension XMLHttpRequestUpload support is added
161
+ As a non-standard extension, XMLHttpRequestUpload support is added.
162
162
 
163
163
  ```json
164
164
  faces.ajax.request(document.getElementById("cmd_eval"), null,
@@ -172,11 +172,11 @@ faces.ajax.request(document.getElementById("cmd_eval"), null,
172
172
  },
173
173
  preinit: (upload: XMLHttpRequestUpload) => preinitTriggered = true,
174
174
  loadstart: (upload: XMLHttpRequestUpload, event: ProgressEvent) => loadstartTriggered = true,
175
- load: (upload: XMLHttpRequestUpload, event: ProgressEvent) => loadTriggered = true,
176
- loadend: (upload: XMLHttpRequestUpload, event: ProgressEvent) => loadendTriggered = true,
177
- error: (upload: XMLHttpRequestUpload, event: ProgressEvent) => errorTriggered = true,
178
- abort: (upload: XMLHttpRequestUpload, event: ProgressEvent) => abortTriggered = true,
179
- timeout: (upload: XMLHttpRequestUpload, event: ProgressEvent) => timeoutTriggered = true,
175
+ load: (upload: XMLHttpRequestUpload, event: ProgressEvent) => loadTriggered = true,
176
+ loadend: (upload: XMLHttpRequestUpload, event: ProgressEvent) => loadendTriggered = true,
177
+ error: (upload: XMLHttpRequestUpload, event: ProgressEvent) => errorTriggered = true,
178
+ abort: (upload: XMLHttpRequestUpload, event: ProgressEvent) => abortTriggered = true,
179
+ timeout: (upload: XMLHttpRequestUpload, event: ProgressEvent) => timeoutTriggered = true,
180
180
  }
181
181
  }
182
182
  });
@@ -185,15 +185,14 @@ faces.ajax.request(document.getElementById("cmd_eval"), null,
185
185
  ## Changes since 4.0
186
186
 
187
187
  * Core fixes
188
- * Codebase build to Typescript 6,
189
- * Typescript 6 stronger type enforcement rules code fixes
188
+ * Updated the codebase build to TypeScript 6.
189
+ * Fixed code for TypeScript 6's stronger type enforcement rules.
190
190
  * Fixes cases like `404`/`500` with empty, HTML, invalid XML, or otherwise non-partial-response bodies being incorrectly reported as `malformedXML` or
191
191
  `emptyResponse`.
192
192
  * Malformed XML is now only reported as `malformedXML` for successful HTTP responses.
193
193
  * XHR timeout now emits the timeout event and reports `httpError`.
194
194
  * XHR abort now reports `httpError`.
195
- * Fixed handling of browser-cancelled XHRs: cancellation-style responses (`status=0`, `readyState=4`, empty response text, and null XML), observed in older Safari/
196
- WebKit and Chrome/Chromium versions during navigation or download handoff, are treated as queue cleanup and do not fire user `onerror`.
195
+ * Fixed handling of browser-cancelled XHRs: cancellation-style responses (`status=0`, `readyState=4`, empty response text, and null XML), observed in older Safari/WebKit and Chrome/Chromium versions during navigation or download handoff, are treated as queue cleanup and do not fire user `onerror`.
197
196
  * Multipart requests no longer get an explicit URL-encoded `Content-Type`; the browser can set the proper multipart boundary.
198
197
  * WebSocket Faces `onerror` now matches the spec: reconnectable abnormal closes call `onerror` before reconnecting.
199
198
  * WebSocket reconnect scheduling now keeps the correct `this` binding.
@@ -203,14 +202,14 @@ faces.ajax.request(document.getElementById("cmd_eval"), null,
203
202
  * Preserved stale WebSocket component pruning when moving Faces `onerror` handling from native `WebSocket.onerror` to reconnectable close handling.
204
203
  * The JSF 2.3 compatibility shim now adapts the old `jsf.push.init` signature without mutating the shared Faces 4 `faces.push` object.
205
204
  * Push typings now include both the Faces 4 signature with `onerror` and the legacy JSF-compatible signature without it.
206
- * Renamed the reference to the shared api to myFacesApi for code clarity
207
- * Cleanup of myfaces.ab init code in jsf.ts to match the faces.ts init code
205
+ * Renamed the reference to the shared API to `myfacesApi` for code clarity.
206
+ * Cleaned up `myfaces.ab` init code in `jsf.ts` to match the `faces.ts` init code.
208
207
 
209
208
  * Core improvements
210
209
  * Refactored upload callback registration in `XhrRequest` into `registerUploadCallbacks()`.
211
210
  * Simplified timeout/header setup.
212
- * Code Cleanup and simplification of XHRFormData
213
- * Clarified view state ordering so it is applied after field encoding and not double-counted. .
211
+ * Cleaned up and simplified `XhrFormData`.
212
+ * Clarified view state ordering so it is applied after field encoding and not double-counted.
214
213
 
215
214
  * Tests added or expanded
216
215
  * Added tests for `4xx` non-XML responses returning `httpError`.
@@ -230,4 +229,25 @@ faces.ajax.request(document.getElementById("cmd_eval"), null,
230
229
  * Expanded WebSocket tests for idempotent init.
231
230
  * Expanded WebSocket tests for behavior dispatch.
232
231
  * Expanded WebSocket tests for shared socket fan-out.
233
- * Renamed websocket test file from `WebsocketTest.ts` to `WebsocketTest.spec.ts`. This has prevented the tests to be run!
232
+ * Renamed the websocket test file from `WebsocketTest.ts` to `WebsocketTest.spec.ts`; the old name prevented the tests from running.
233
+
234
+
235
+ ## Changes since 4.1.0-beta-10
236
+
237
+ * Core fixes
238
+
239
+ * Push/Websocket onOpen onClose callback lifecycle fixes according to spec behavior
240
+ * WebSocket `onopen` now fires only for the first connection attempt, not for automatic reconnects.
241
+ * Failed first WebSocket connection attempts are now treated as terminal: `onclose` is called, no reconnect is scheduled, and `onerror` is not called.
242
+ * WebSocket close code `1000` is now treated as terminal for any reason, not only `REASON_EXPIRED`.
243
+ * WebSocket close code `1008` (`Policy Violation`) is now treated as terminal and does not reconnect.
244
+ * WebSocket reconnect exhaustion now calls `onclose` and stops reconnecting after `MAX_RECONNECT_ATTEMPTS`.
245
+ * Terminal WebSocket closes now reset reconnect state so a later explicit `open()` starts as a fresh connection.
246
+
247
+ * Tests added or expanded
248
+ * Added tests to verify the `onopen`/`onclose` callback lifecycle.
249
+ * Added tests that `onopen` is not fired again after a successful automatic reconnect.
250
+ * Added tests that reconnect attempts reset after a successful reconnect.
251
+ * Added tests that max reconnect exhaustion calls `onclose`.
252
+ * Added tests that close code `1008` is terminal and does not reconnect.
253
+ * Added tests that explicit `open()` after a terminal close fires `onopen` again as a fresh connection.