jsf.js_next_gen 1.0.0-beta-1 → 1.0.0-beta-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/.github/workflows/codeql-analysis.yml +83 -0
  2. package/.github/workflows/nodejs.yml +1 -1
  3. package/dist/window/jsf-development.js +51 -39
  4. package/dist/window/jsf-development.js.map +1 -1
  5. package/dist/window/jsf.js +1 -1
  6. package/dist/window/jsf.js.br +0 -0
  7. package/dist/window/jsf.js.gz +0 -0
  8. package/dist/window/jsf.js.map +1 -1
  9. package/package.json +23 -24
  10. package/remap.js +44 -0
  11. package/remap.js.map +1 -0
  12. package/remap.ts +1 -1
  13. package/src/main/typescript/impl/util/AsyncQueue.ts +1 -1
  14. package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +1 -1
  15. package/src/test/typescript/frameworkBase/LangTest.ts +2 -10
  16. package/src/test/typescript/frameworkBase/_ext/monadish/DomQueryTest.ts +12 -11
  17. package/src/test/typescript/frameworkBase/_ext/monadish/LangTest.ts +1 -1
  18. package/src/test/typescript/frameworkBase/_ext/monadish/MappingProbes.ts +13 -19
  19. package/src/test/typescript/frameworkBase/_ext/monadish/StreamTest.ts +5 -9
  20. package/target/api/Jsf.js +258 -0
  21. package/target/api/Jsf.js.map +1 -0
  22. package/target/impl/AjaxImpl.js +569 -0
  23. package/target/impl/AjaxImpl.js.map +1 -0
  24. package/target/impl/PushImpl.js +215 -0
  25. package/target/impl/PushImpl.js.map +1 -0
  26. package/target/impl/core/Const.js +135 -0
  27. package/target/impl/core/Const.js.map +1 -0
  28. package/target/impl/core/ImplTypes.js +43 -0
  29. package/target/impl/core/ImplTypes.js.map +1 -0
  30. package/target/impl/i18n/Messages.js +114 -0
  31. package/target/impl/i18n/Messages.js.map +1 -0
  32. package/target/impl/util/Assertions.js +90 -0
  33. package/target/impl/util/Assertions.js.map +1 -0
  34. package/target/impl/util/AsyncQueue.js +104 -0
  35. package/target/impl/util/AsyncQueue.js.map +1 -0
  36. package/target/impl/util/AsyncRunnable.js +18 -0
  37. package/target/impl/util/AsyncRunnable.js.map +1 -0
  38. package/target/impl/util/ExtDomQuery.js +129 -0
  39. package/target/impl/util/ExtDomQuery.js.map +1 -0
  40. package/target/impl/util/Lang.js +215 -0
  41. package/target/impl/util/Lang.js.map +1 -0
  42. package/target/impl/util/ListenerQueue.js +3 -0
  43. package/target/impl/util/ListenerQueue.js.map +1 -0
  44. package/target/impl/xhrCore/ErrorData.js +89 -0
  45. package/target/impl/xhrCore/ErrorData.js.map +1 -0
  46. package/target/impl/xhrCore/EventData.js +30 -0
  47. package/target/impl/xhrCore/EventData.js.map +1 -0
  48. package/target/impl/xhrCore/IResponseProcessor.js +3 -0
  49. package/target/impl/xhrCore/IResponseProcessor.js.map +1 -0
  50. package/target/impl/xhrCore/RequestDataResolver.js +143 -0
  51. package/target/impl/xhrCore/RequestDataResolver.js.map +1 -0
  52. package/target/impl/xhrCore/ResonseDataResolver.js +103 -0
  53. package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -0
  54. package/target/impl/xhrCore/Response.js +167 -0
  55. package/target/impl/xhrCore/Response.js.map +1 -0
  56. package/target/impl/xhrCore/ResponseProcessor.js +368 -0
  57. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -0
  58. package/target/impl/xhrCore/XhrFormData.js +272 -0
  59. package/target/impl/xhrCore/XhrFormData.js.map +1 -0
  60. package/target/impl/xhrCore/XhrRequest.js +281 -0
  61. package/target/impl/xhrCore/XhrRequest.js.map +1 -0
  62. package/target/main/typescript/api/Jsf.js +258 -0
  63. package/target/main/typescript/api/Jsf.js.map +1 -0
  64. package/target/main/typescript/impl/AjaxImpl.js +569 -0
  65. package/target/main/typescript/impl/AjaxImpl.js.map +1 -0
  66. package/target/main/typescript/impl/PushImpl.js +215 -0
  67. package/target/main/typescript/impl/PushImpl.js.map +1 -0
  68. package/target/main/typescript/impl/core/Const.js +135 -0
  69. package/target/main/typescript/impl/core/Const.js.map +1 -0
  70. package/target/main/typescript/impl/core/ImplTypes.js +43 -0
  71. package/target/main/typescript/impl/core/ImplTypes.js.map +1 -0
  72. package/target/main/typescript/impl/i18n/Messages.js +114 -0
  73. package/target/main/typescript/impl/i18n/Messages.js.map +1 -0
  74. package/target/main/typescript/impl/util/Assertions.js +90 -0
  75. package/target/main/typescript/impl/util/Assertions.js.map +1 -0
  76. package/target/main/typescript/impl/util/AsyncQueue.js +104 -0
  77. package/target/main/typescript/impl/util/AsyncQueue.js.map +1 -0
  78. package/target/main/typescript/impl/util/AsyncRunnable.js +18 -0
  79. package/target/main/typescript/impl/util/AsyncRunnable.js.map +1 -0
  80. package/target/main/typescript/impl/util/ExtDomQuery.js +129 -0
  81. package/target/main/typescript/impl/util/ExtDomQuery.js.map +1 -0
  82. package/target/main/typescript/impl/util/Lang.js +215 -0
  83. package/target/main/typescript/impl/util/Lang.js.map +1 -0
  84. package/target/main/typescript/impl/util/ListenerQueue.js +3 -0
  85. package/target/main/typescript/impl/util/ListenerQueue.js.map +1 -0
  86. package/target/main/typescript/impl/xhrCore/ErrorData.js +89 -0
  87. package/target/main/typescript/impl/xhrCore/ErrorData.js.map +1 -0
  88. package/target/main/typescript/impl/xhrCore/EventData.js +30 -0
  89. package/target/main/typescript/impl/xhrCore/EventData.js.map +1 -0
  90. package/target/main/typescript/impl/xhrCore/IResponseProcessor.js +3 -0
  91. package/target/main/typescript/impl/xhrCore/IResponseProcessor.js.map +1 -0
  92. package/target/main/typescript/impl/xhrCore/RequestDataResolver.js +143 -0
  93. package/target/main/typescript/impl/xhrCore/RequestDataResolver.js.map +1 -0
  94. package/target/main/typescript/impl/xhrCore/ResonseDataResolver.js +103 -0
  95. package/target/main/typescript/impl/xhrCore/ResonseDataResolver.js.map +1 -0
  96. package/target/main/typescript/impl/xhrCore/Response.js +167 -0
  97. package/target/main/typescript/impl/xhrCore/Response.js.map +1 -0
  98. package/target/main/typescript/impl/xhrCore/ResponseProcessor.js +368 -0
  99. package/target/main/typescript/impl/xhrCore/ResponseProcessor.js.map +1 -0
  100. package/target/main/typescript/impl/xhrCore/XhrFormData.js +272 -0
  101. package/target/main/typescript/impl/xhrCore/XhrFormData.js.map +1 -0
  102. package/target/main/typescript/impl/xhrCore/XhrRequest.js +281 -0
  103. package/target/main/typescript/impl/xhrCore/XhrRequest.js.map +1 -0
  104. package/target/test/typescript/frameworkBase/LangTest.js +112 -0
  105. package/target/test/typescript/frameworkBase/LangTest.js.map +1 -0
  106. package/target/test/typescript/frameworkBase/_ext/monadish/DomQueryTest.js +293 -0
  107. package/target/test/typescript/frameworkBase/_ext/monadish/DomQueryTest.js.map +1 -0
  108. package/target/test/typescript/frameworkBase/_ext/monadish/LangTest.js +89 -0
  109. package/target/test/typescript/frameworkBase/_ext/monadish/LangTest.js.map +1 -0
  110. package/target/test/typescript/frameworkBase/_ext/monadish/MappingProbes.js +115 -0
  111. package/target/test/typescript/frameworkBase/_ext/monadish/MappingProbes.js.map +1 -0
  112. package/target/test/typescript/frameworkBase/_ext/monadish/MappingTest.js +39 -0
  113. package/target/test/typescript/frameworkBase/_ext/monadish/MappingTest.js.map +1 -0
  114. package/target/test/typescript/frameworkBase/_ext/monadish/MonadTest.js +155 -0
  115. package/target/test/typescript/frameworkBase/_ext/monadish/MonadTest.js.map +1 -0
  116. package/target/test/typescript/frameworkBase/_ext/monadish/StreamTest.js +176 -0
  117. package/target/test/typescript/frameworkBase/_ext/monadish/StreamTest.js.map +1 -0
  118. package/target/test/typescript/frameworkBase/_ext/monadish/XmlQueryTest.js +1 -0
  119. package/target/test/typescript/frameworkBase/_ext/monadish/XmlQueryTest.js.map +1 -0
  120. package/target/test/typescript/frameworkBase/_ext/shared/StandardInits.js +264 -0
  121. package/target/test/typescript/frameworkBase/_ext/shared/StandardInits.js.map +1 -0
  122. package/target/test/typescript/frameworkBase/_ext/shared/XmlResponses.js +23 -0
  123. package/target/test/typescript/frameworkBase/_ext/shared/XmlResponses.js.map +1 -0
  124. package/target/test/typescript/impl/ImplTest.js +98 -0
  125. package/target/test/typescript/impl/ImplTest.js.map +1 -0
  126. package/target/test/typescript/impl/SeparatorCharsTest.js +72 -0
  127. package/target/test/typescript/impl/SeparatorCharsTest.js.map +1 -0
  128. package/target/test/typescript/queue/AsynchronousProbe.js +99 -0
  129. package/target/test/typescript/queue/AsynchronousProbe.js.map +1 -0
  130. package/target/test/typescript/queue/AsynchronousQueueTest.js +130 -0
  131. package/target/test/typescript/queue/AsynchronousQueueTest.js.map +1 -0
  132. package/target/test/typescript/xhrCore/EventTests.js +155 -0
  133. package/target/test/typescript/xhrCore/EventTests.js.map +1 -0
  134. package/target/test/typescript/xhrCore/FakeWebsocket.js +25 -0
  135. package/target/test/typescript/xhrCore/FakeWebsocket.js.map +1 -0
  136. package/target/test/typescript/xhrCore/FileUploadTest.js +166 -0
  137. package/target/test/typescript/xhrCore/FileUploadTest.js.map +1 -0
  138. package/target/test/typescript/xhrCore/RequestParamsTest.js +151 -0
  139. package/target/test/typescript/xhrCore/RequestParamsTest.js.map +1 -0
  140. package/target/test/typescript/xhrCore/RequestTest.js +318 -0
  141. package/target/test/typescript/xhrCore/RequestTest.js.map +1 -0
  142. package/target/test/typescript/xhrCore/ResponseTest.js +257 -0
  143. package/target/test/typescript/xhrCore/ResponseTest.js.map +1 -0
  144. package/target/test/typescript/xhrCore/ShadowDomTest.js +122 -0
  145. package/target/test/typescript/xhrCore/ShadowDomTest.js.map +1 -0
  146. package/target/test/typescript/xhrCore/WebsocketTest.js +182 -0
  147. package/target/test/typescript/xhrCore/WebsocketTest.js.map +1 -0
  148. package/target/test/typescript/xhrCore/XhrFormDataTest.js +58 -0
  149. package/target/test/typescript/xhrCore/XhrFormDataTest.js.map +1 -0
  150. package/webpack.config.js +71 -0
  151. package/webpack.config.js.map +1 -0
  152. package/webpack.config.ts +4 -6
  153. package/dist/window/jsf-development.js.LICENSE.txt +0 -135
  154. package/dist/window/jsf-development.js.br +0 -0
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "jsf.js_next_gen",
3
- "version": "1.0.0-beta-1",
3
+ "version": "1.0.0-beta-2",
4
4
  "description": "A next generation typescript reimplementation of jsf.js",
5
5
  "main": "dist/window/jsf.js",
6
6
  "scripts": {
7
- "test": "mocha -r ts-node/register ./src/test/typescript/**/**/*Test*.ts",
7
+ "test": "env TS_NODE_PROJECT=./src/test/typescript/tsconfig.json mocha -r ts-node/register ./src/test/typescript/**/**/*Test*.ts",
8
8
  "coverage": "nyc --reporter=html --reporter=text mocha -r ts-node/register ./**/test/typescript/**/**/*Test*.ts",
9
9
  "build-production": "webpack --mode production --env FILE_NAME=jsf && ts-node ./remap.ts --production",
10
10
  "build-development": "webpack --mode development --env FILE_NAME=jsf-development && ts-node ./remap.ts --development",
@@ -18,32 +18,31 @@
18
18
  "author": "Werner Punz werpu@apache.org",
19
19
  "license": "Apache-2.0",
20
20
  "devDependencies": {
21
- "@istanbuljs/nyc-config-typescript": "^1.0.1",
22
- "@types/chai": "^4.2.16",
23
- "@types/mocha": "^8.2.2",
24
- "@types/sinon": "^10.0.0",
21
+ "@istanbuljs/nyc-config-typescript": "^1.0.2",
22
+ "@types/chai": "^4.3.3",
23
+ "@types/mocha": "^9.1.1",
24
+ "@types/sinon": "^10.0.13",
25
25
  "babel-plugin-syntax-dynamic-import": "^6.18.0",
26
- "brotli-webpack-plugin": "^1.1.0",
27
- "chai": "^4.3.4",
28
- "compression-webpack-plugin": "^7.1.2",
29
- "html-webpack-plugin": "^5.3.1",
30
- "jsdom": "^16.5.3",
26
+ "chai": "^4.3.6",
27
+ "compression-webpack-plugin": "^10.0.0",
28
+ "html-webpack-plugin": "^5.5.0",
29
+ "jsdom": "^20.0.0",
31
30
  "jsdom-global": "^3.0.2",
32
- "mocha": "^8.3.2",
33
- "npm-check-updates": "^11.5.0",
31
+ "mocha": "^10.0.0",
32
+ "npm-check-updates": "^16.1.0",
34
33
  "nyc": "^15.1.0",
35
- "replace-in-file": "^6.2.0",
36
- "rxjs": "^6.6.7",
37
- "sinon": "^10.0.0",
38
- "terser-webpack-plugin": "^5.1.1",
39
- "ts-loader": "^9.0.2",
40
- "ts-node": "^9.1.1",
41
- "typescript": "^4.2.4",
42
- "webpack": "^5.34.0",
43
- "webpack-cli": "^4.6.0",
44
- "webpack-dev-server": "^3.11.2"
34
+ "replace-in-file": "^6.3.5",
35
+ "rxjs": "^7.5.6",
36
+ "sinon": "^14.0.0",
37
+ "terser-webpack-plugin": "^5.3.6",
38
+ "ts-loader": "^9.3.1",
39
+ "ts-node": "^10.9.1",
40
+ "typescript": "^4.8.2",
41
+ "webpack": "^5.74.0",
42
+ "webpack-cli": "^4.10.0",
43
+ "webpack-dev-server": "^4.10.1"
45
44
  },
46
45
  "dependencies": {
47
- "mona-dish": "0.20.3"
46
+ "mona-dish": "0.21.0"
48
47
  }
49
48
  }
package/remap.js ADDED
@@ -0,0 +1,44 @@
1
+ /* Licensed to the Apache Software Foundation (ASF) under one or more
2
+ * contributor license agreements. See the NOTICE file distributed with
3
+ * this work for additional information regarding copyright ownership.
4
+ * The ASF licenses this file to you under the Apache License, Version 2.0
5
+ * (the "License"); you may not use this file except in compliance with
6
+ * the License. You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * we are remapping the mappings in our dist file, to meet the expected
18
+ * jsf loading criteria...
19
+ * luckily we can use more than one source map entry
20
+ * so either one is found and the other is not
21
+ */
22
+ //the replace in file plugin meets our system independent grep/awk criteria
23
+ //does pretty much what grep and awk do on unix systems
24
+ var replace = require('replace-in-file');
25
+ // we ned to fetch the proper argument
26
+ var args = process.argv.slice(2);
27
+ // and remap it into our proper option
28
+ var buildStage = (args[0] == "--development") ? "-development" : "";
29
+ console.log("fixing mapping file references for jsf");
30
+ var option = {
31
+ //development
32
+ files: 'dist/**/*.js',
33
+ from: (buildStage == "-development") ? /jsf-development.js\.map/g : /jsf.js\.map/g,
34
+ to: "jsf".concat(buildStage, ".js.map\n//# sourceMappingURL=jsf").concat(buildStage, ".js.map.jsf?ln=scripts")
35
+ };
36
+ try {
37
+ var result = replace.sync(option);
38
+ console.log("mapping file references fixed!");
39
+ console.log('Replacement results:', result);
40
+ }
41
+ catch (error) {
42
+ console.error('Error occurred:', error);
43
+ }
44
+ //# sourceMappingURL=remap.js.map
package/remap.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remap.js","sourceRoot":"","sources":["remap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;GAKG;AAEH,2EAA2E;AAC3E,uDAAuD;AACvD,IAAM,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE3C,sCAAsC;AACtC,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,sCAAsC;AACtC,IAAM,UAAU,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;AACtE,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;AAEtD,IAAI,MAAM,GAAG;IACT,aAAa;IACb,KAAK,EAAE,cAAc;IACrB,IAAI,EAAE,CAAC,UAAU,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,cAAc;IAClF,EAAE,EAAE,aAAM,UAAU,8CAAoC,UAAU,2BAAwB;CAC7F,CAAA;AAED,IAAI;IACA,IAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;CAC/C;AAAC,OAAO,KAAK,EAAE;IACZ,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;CAC3C"}
package/remap.ts CHANGED
@@ -21,7 +21,7 @@
21
21
  * so either one is found and the other is not
22
22
  */
23
23
 
24
- //the replace in file plugin meets our system independend grep/awk criteria
24
+ //the replace in file plugin meets our system independent grep/awk criteria
25
25
  //does pretty much what grep and awk do on unix systems
26
26
  const replace = require('replace-in-file');
27
27
 
@@ -14,7 +14,7 @@ import {AsyncRunnable} from "./AsyncRunnable";
14
14
  export class AsynchronouseQueue<T extends AsyncRunnable<any>> {
15
15
 
16
16
  private runnableQueue = [];
17
- private delayTimeout: number;
17
+ private delayTimeout: null | ReturnType<typeof setTimeout>;
18
18
 
19
19
  currentlyRunning: AsyncRunnable<any>;
20
20
 
@@ -57,7 +57,7 @@ export function resolveTargetUrl(srcFormElement: HTMLFormElement) {
57
57
  }
58
58
 
59
59
  export function resolveFinalUrl(sourceForm: DomQuery, formData: XhrFormData, ajaxType = REQ_TYPE_POST) {
60
- let targetUrl = this.resolveTargetUrl(<HTMLFormElement>sourceForm.getAsElem(0).value);
60
+ let targetUrl = resolveTargetUrl(<HTMLFormElement>sourceForm.getAsElem(0).value);
61
61
 
62
62
  return targetUrl + (ajaxType == REQ_TYPE_GET ? "?" + formData.toString() : EMPTY_STR);
63
63
  }
@@ -33,7 +33,7 @@ const dom = new JSDOM(`
33
33
  `)
34
34
 
35
35
  export const window = dom.window;
36
- ;
36
+
37
37
 
38
38
  function hello_world() {
39
39
  return "Hello World!"
@@ -71,8 +71,6 @@ describe('Lang tests', () => {
71
71
  });
72
72
 
73
73
  it('strToArray working', () => {
74
- const lang = Lang;
75
-
76
74
  let arr = strToArray("hello.world.from.me", /\./gi);
77
75
 
78
76
  expect(arr).to.exist;
@@ -82,7 +80,6 @@ describe('Lang tests', () => {
82
80
  });
83
81
 
84
82
  it('trim working', () => {
85
- const lang = Lang;
86
83
  let origStr = " hello world from me ";
87
84
  let trimmed = trim(origStr);
88
85
  expect(trimmed).to.exist;
@@ -91,7 +88,6 @@ describe('Lang tests', () => {
91
88
  });
92
89
 
93
90
  it('isString working', () => {
94
- const lang = Lang;
95
91
  expect(isString(" ")).to.be.true;
96
92
  expect(isString('')).to.be.true;
97
93
  expect(isString(null)).to.be.false;
@@ -103,7 +99,6 @@ describe('Lang tests', () => {
103
99
  });
104
100
 
105
101
  it('isFunc working', () => {
106
- const lang = Lang;
107
102
  expect(isFunc(() => {
108
103
  })).to.be.true;
109
104
  expect(isFunc(function () {
@@ -114,7 +109,6 @@ describe('Lang tests', () => {
114
109
  });
115
110
 
116
111
  it('objToArray working', () => {
117
- const lang = Lang;
118
112
  let obj_probe = new Probe();
119
113
  let resultArr = objToArray(obj_probe);
120
114
  expect(assertType(resultArr, Array)).to.be.true;
@@ -126,15 +120,13 @@ describe('Lang tests', () => {
126
120
  });
127
121
 
128
122
  it('keyval to string working', () => {
129
- const lang = Lang;
130
123
  let keyval = keyValToStr("key", "val", ":")
131
124
  expect(keyval).to.eq("key:val");
132
125
 
133
126
  });
134
127
 
135
128
  it('equals ignore case test', () => {
136
- const lang = Lang;
137
- expect(equalsIgnoreCase(null, null)).to.be.true;
129
+ expect(equalsIgnoreCase(<any>null, <any>null)).to.be.true;
138
130
  expect(equalsIgnoreCase("", "")).to.be.true;
139
131
  expect(equalsIgnoreCase("null", "NuLL")).to.be.true;
140
132
  expect(equalsIgnoreCase("null ", "NuLL")).to.be.false;
@@ -1,3 +1,5 @@
1
+ // noinspection HtmlUnknownAttribute
2
+
1
3
  /* Licensed to the Apache Software Foundation (ASF) under one or more
2
4
  * contributor license agreements. See the NOTICE file distributed with
3
5
  * this work for additional information regarding copyright ownership.
@@ -24,7 +26,6 @@ import trim = Lang.trim;
24
26
  const jsdom = require("jsdom");
25
27
  const {JSDOM} = jsdom;
26
28
 
27
-
28
29
  describe('DOMQuery tests', function () {
29
30
 
30
31
  beforeEach(function () {
@@ -60,7 +61,7 @@ describe('DOMQuery tests', function () {
60
61
 
61
62
  this.xhr = sinon.useFakeXMLHttpRequest();
62
63
  this.requests = [];
63
- this.xhr.onCreate = (xhr) => {
64
+ this.xhr.onCreate = (xhr: any) => {
64
65
  this.requests.push(xhr);
65
66
  };
66
67
  (<any>global).XMLHttpRequest = this.xhr;
@@ -118,7 +119,7 @@ describe('DOMQuery tests', function () {
118
119
  it('domquery ops test2 eachNode', function () {
119
120
  let probe2 = DomQuery.querySelectorAll("div");
120
121
  let noIter = 0;
121
- probe2 = probe2.each((item, cnt) => {
122
+ probe2.each((item, cnt) => {
122
123
  expect(item instanceof DomQuery).to.be.true;
123
124
  expect(noIter == cnt).to.be.true;
124
125
  noIter++;
@@ -229,19 +230,19 @@ describe('DOMQuery tests', function () {
229
230
  it("must have a working input handling", function () {
230
231
  DomQuery.querySelectorAll("body").innerHtml = `<form id="blarg">
231
232
  <div id="embed1">
232
- <input type="text" id="id_1" name="id_1" value="id_1_val"></input>
233
- <input type="text" id="id_2" name="id_2" value="id_2_val" disabled="disabled"> </input>
233
+ <input type="text" id="id_1" name="id_1" value="id_1_val"/>
234
+ <input type="text" id="id_2" name="id_2" value="id_2_val" disabled="disabled"/>
234
235
  <textarea type="text" id="id_3" name="id_3">textareaVal</textarea>
235
236
 
236
237
  <fieldset>
237
- <input type="radio" id="mc" name="cc_1" value="Mastercard" checked="checked"></input>
238
+ <input type="radio" id="mc" name="cc_1" value="Mastercard" checked="checked"/>
238
239
  <label for="mc"> Mastercard</label>
239
- <input type="radio" id="vi" name="cc_1" value="Visa"></input>
240
+ <input type="radio" id="vi" name="cc_1" value="Visa"/>
240
241
  <label for="vi"> Visa</label>
241
- <input type="radio" id="ae" name="cc_1" value="AmericanExpress"></input>
242
+ <input type="radio" id="ae" name="cc_1" value="AmericanExpress"/>
242
243
  <label for="ae"> American Express</label>
243
244
  </fieldset>
244
- <select id="val_5" name="val_5" name="top5" size="5">
245
+ <select id="val_5" name="val_5" size="5">
245
246
  <option>barg</option>
246
247
  <option>jjj</option>
247
248
  <option selected>akaka</option>
@@ -343,7 +344,7 @@ describe('DOMQuery tests', function () {
343
344
  //-->
344
345
  </script>
345
346
 
346
- <style type="text/css">
347
+ <style>
347
348
  #first {
348
349
  border: 1px solid black;
349
350
  }
@@ -380,7 +381,7 @@ describe('DOMQuery tests', function () {
380
381
 
381
382
  it("it must handle events properly", function () {
382
383
  let clicked = 0;
383
- let listener = (evt: any) => {
384
+ let listener = () => {
384
385
  clicked++;
385
386
  };
386
387
  let eventReceiver = DomQuery.byId("id_1");
@@ -117,7 +117,7 @@ describe('Lang tests', () => {
117
117
 
118
118
  it('equals ignore case test', () => {
119
119
  const lang = Lang;
120
- expect(lang.equalsIgnoreCase(null, null)).to.be.true;
120
+ expect(lang.equalsIgnoreCase(<any>null, <any>null)).to.be.true;
121
121
  expect(lang.equalsIgnoreCase("", "")).to.be.true;
122
122
  expect(lang.equalsIgnoreCase("null", "NuLL")).to.be.true;
123
123
  expect(lang.equalsIgnoreCase("null ", "NuLL")).to.be.false;
@@ -52,14 +52,10 @@ class DtoUils {
52
52
  (<any>target)[key] = {};
53
53
 
54
54
  for (let key2 in newVal) {
55
- let subTarget = new mappings[key].clazz(newVal[key2]);
56
- // subTarget = this.mapIt(subTarget, <any> newVal[key2]);
57
- (<any>target)[key][key2] = subTarget;
55
+ (<any>target)[key][key2] = new mappings[key].clazz(newVal[key2]);
58
56
  }
59
57
  } else if (mappings && mappings[key]) {
60
- let subTarget = new mappings[key](newVal);
61
-
62
- (<any>target)[key] = subTarget;
58
+ (<any>target)[key] = new mappings[key](newVal);
63
59
  } else {
64
60
  (<any>target)[key] = newVal
65
61
  }
@@ -71,13 +67,14 @@ class DtoUils {
71
67
 
72
68
  }
73
69
 
70
+ // noinspection JSUnusedLocalSymbols
74
71
  class BaseDto<T> {
75
72
 
76
73
  TYPES = "___mappable_types___";
77
74
 
78
75
  constructor(data?: T, dtoTypes: any = {}) {
79
76
 
80
- this[this.TYPES] = dtoTypes;
77
+ (<any>this)[this.TYPES] = dtoTypes;
81
78
 
82
79
  if (data) {
83
80
  this.mapIt(this, data);
@@ -99,14 +96,11 @@ class BaseDto<T> {
99
96
  (<any>target)[key] = {};
100
97
 
101
98
  for (let key2 in newVal) {
102
- let subTarget = new target[this.TYPES][key].clazz(newVal[key2]);
103
- // subTarget = this.mapIt(subTarget, <any> newVal[key2]);
104
- (<any>target)[key][key2] = subTarget;
99
+ // subTarget = this.mapIt(subTarget, <any> newVal[key2]);
100
+ (<any>target)[key][key2] = new target[this.TYPES][key].clazz(newVal[key2]);
105
101
  }
106
102
  } else if (target[this.TYPES] && target[this.TYPES][key]) {
107
- let subTarget = new target[this.TYPES][key](newVal);
108
-
109
- (<any>target)[key] = subTarget;
103
+ (<any>target)[key] = new target[this.TYPES][key](newVal);
110
104
  } else {
111
105
  (<any>target)[key] = newVal
112
106
  }
@@ -136,12 +130,12 @@ function mixMaps(target: any, src: any): any {
136
130
 
137
131
  export class Probe1Impl implements Probe1 {
138
132
 
139
- val1: string;
140
- val2: Date;
141
- val3: any;
142
- val4: Probe2[];
143
- val5: Probe2;
144
- val6: any;
133
+ val1!: string;
134
+ val2!: Date;
135
+ val3!: any;
136
+ val4!: Probe2[];
137
+ val5!: Probe2;
138
+ val6!: any;
145
139
 
146
140
  constructor(data: Probe1, mixin: any = {} /*put your own arguments in here*/) {
147
141
  DtoUils.mapIt(this, data, mixMaps({
@@ -75,11 +75,9 @@ describe('early stream tests', () => {
75
75
  })
76
76
 
77
77
  it("must have a correct first last", function () {
78
- let stream = Stream.of<number>(...this.probe);
79
-
80
- let first = Stream.of<number>(...this.probe).filter((data) => data != 5).onElem((data) => {
78
+ let first = Stream.of<number>(...this.probe).filter((data) => data != 5).onElem(() => {
81
79
  }).first().value;
82
- let last = Stream.of<number>(...this.probe).filter((data) => data != 5).onElem((data) => {
80
+ let last = Stream.of<number>(...this.probe).filter((data) => data != 5).onElem(() => {
83
81
  }).last().value;
84
82
  expect(first).to.eq(1);
85
83
  expect(last).to.eq(4);
@@ -87,8 +85,6 @@ describe('early stream tests', () => {
87
85
  });
88
86
 
89
87
  it("must have a correct first last lazy", function () {
90
- let stream = LazyStream.of<number>(...this.probe);
91
-
92
88
  let first = LazyStream.of<number>(...this.probe).filter((data) => data != 5).onElem((data) => {
93
89
  data;
94
90
  }).first().value;
@@ -102,7 +98,7 @@ describe('early stream tests', () => {
102
98
 
103
99
  it("must have a correct limits", function () {
104
100
  let cnt = 0;
105
- let last = Stream.of<number>(...this.probe).filter((data) => data != 5).limits(2).onElem((data) => {
101
+ let last = Stream.of<number>(...this.probe).filter((data) => data != 5).limits(2).onElem(() => {
106
102
  cnt++;
107
103
  }).last().value;
108
104
 
@@ -118,8 +114,8 @@ describe('early stream tests', () => {
118
114
  key3: "val3"
119
115
  }
120
116
 
121
- let arr1 = [];
122
- let arr2 = [];
117
+ let arr1: Array<string | number> = [];
118
+ let arr2: Array<string | number> = [];
123
119
 
124
120
  Stream.ofAssoc(probe).each(item => {
125
121
  expect(item.length).to.eq(2);
@@ -0,0 +1,258 @@
1
+ "use strict";
2
+ /* Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to you under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
18
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
19
+ if (ar || !(i in from)) {
20
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
21
+ ar[i] = from[i];
22
+ }
23
+ }
24
+ return to.concat(ar || Array.prototype.slice.call(from));
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.myfaces = exports.jsf = void 0;
28
+ ///<reference types='../../types/typedefs'/>
29
+ var AjaxImpl_1 = require("../impl/AjaxImpl");
30
+ var PushImpl_1 = require("../impl/PushImpl");
31
+ var jsf;
32
+ (function (jsf) {
33
+ "use strict";
34
+ /*
35
+ * Version of the implementation for the jsf.js.
36
+ * <p />
37
+ * as specified within the jsf specifications jsf.html:
38
+ * <ul>
39
+ * <li>left two digits major release number</li>
40
+ * <li>middle two digits minor spec release number</li>
41
+ * <li>right two digits bug release number</li>
42
+ * </ul>
43
+ * @constant
44
+ */
45
+ jsf.specversion = 220000;
46
+ /**
47
+ * Implementation version as specified within the jsf specification.
48
+ * <p />
49
+ * A number increased with every implementation version
50
+ * and reset by moving to a new spec release number
51
+ *
52
+ * @constant
53
+ */
54
+ jsf.implversion = 0;
55
+ /**
56
+ * SeparatorChar as defined by UINamingContainer.getNamingContainerSeparatorChar()
57
+ * @type {Char}
58
+ */
59
+ jsf.separatorchar = getSeparatorChar();
60
+ /**
61
+ * This method is responsible for the return of a given project stage as defined
62
+ * by the jsf specification.
63
+ * <p/>
64
+ * Valid return values are:
65
+ * <ul>
66
+ * <li>&quot;Production&quot;</li>
67
+ * <li>&quot;Development&quot;</li>
68
+ * <li>&quot;SystemTest&quot;</li>
69
+ * <li>&quot;UnitTest&quot;</li>
70
+ * </li>
71
+ *
72
+ * @return {String} the current project state emitted by the server side method:
73
+ * <i>javax.faces.application.Application.getProjectStage()</i>
74
+ */
75
+ function getProjectStage() {
76
+ return AjaxImpl_1.Implementation.getProjectStage();
77
+ }
78
+ jsf.getProjectStage = getProjectStage;
79
+ /**
80
+ * collect and encode data for a given form element (must be of type form)
81
+ * find the javax.faces.ViewState element and encode its value as well!
82
+ * return a concatenated string of the encoded values!
83
+ *
84
+ * @throws an exception in case of the given element not being of type form!
85
+ * https://issues.apache.org/jira/browse/MYFACES-2110
86
+ */
87
+ function getViewState(formElement) {
88
+ return AjaxImpl_1.Implementation.getViewState(formElement);
89
+ }
90
+ jsf.getViewState = getViewState;
91
+ /**
92
+ * returns the window identifier for the given node / window
93
+ * @return the window identifier or null if none is found
94
+ * @param rootNode
95
+ */
96
+ function getClientWindow(rootNode) {
97
+ return AjaxImpl_1.Implementation.getClientWindow(rootNode);
98
+ }
99
+ jsf.getClientWindow = getClientWindow;
100
+ //private helper functions
101
+ function getSeparatorChar() {
102
+ return AjaxImpl_1.Implementation.getSeparatorChar();
103
+ }
104
+ var ajax;
105
+ (function (ajax) {
106
+ "use strict";
107
+ /**
108
+ * this function has to send the ajax requests
109
+ *
110
+ * following requestInternal conditions must be met:
111
+ * <ul>
112
+ * <li> the requestInternal must be sent asynchronously! </li>
113
+ * <li> the requestInternal must be a POST!!! requestInternal </li>
114
+ * <li> the requestInternal url must be the form action attribute </li>
115
+ * <li> all requests must be queued with a client side requestInternal queue to ensure the requestInternal ordering!</li>
116
+ * </ul>
117
+ *
118
+ * @param {String|Node} element: any dom element no matter being it html or jsf, from which the event is emitted
119
+ * @param {EVENT} event: any javascript event supported by that object
120
+ * @param {Map} options : map of options being pushed into the ajax cycle
121
+ */
122
+ function request(element, event, options) {
123
+ AjaxImpl_1.Implementation.request(element, event, options);
124
+ //Implementation.getInstance().requestInternal(element, event, options);
125
+ }
126
+ ajax.request = request;
127
+ /**
128
+ * response handler
129
+ * @param request the request object having triggered this response
130
+ * @param context the request context
131
+ *
132
+ * TODO add info on what can be in the context
133
+ */
134
+ function response(request, context) {
135
+ AjaxImpl_1.Implementation.response(request, context);
136
+ }
137
+ ajax.response = response;
138
+ /**
139
+ * Adds an error handler to our global error queue.
140
+ * the error handler must be of the format <i>function errorListener(&lt;errorData&gt;)</i>
141
+ * with errorData being of following format:
142
+ * <ul>
143
+ * <li> errorData.type : &quot;error&quot;</li>
144
+ * <li> errorData.status : the error status message</li>
145
+ * <li> errorData.serverErrorName : the server error name in case of a server error</li>
146
+ * <li> errorData.serverErrorMessage : the server error message in case of a server error</li>
147
+ * <li> errorData.source : the issuing source element which triggered the requestInternal </li>
148
+ * <li> eventData.responseCode: the response code (aka http requestInternal response code, 401 etc...) </li>
149
+ * <li> eventData.responseText: the requestInternal response text </li>
150
+ * <li> eventData.responseXML: the requestInternal response xml </li>
151
+ * </ul>
152
+ *
153
+ * @param {function} errorListener error handler must be of the format <i>function errorListener(&lt;errorData&gt;)</i>
154
+ */
155
+ function addOnError(errorFunc) {
156
+ AjaxImpl_1.Implementation.addOnError(errorFunc);
157
+ }
158
+ ajax.addOnError = addOnError;
159
+ /**
160
+ * Adds a global event listener to the ajax event queue. The event listener must be a function
161
+ * of following format: <i>function eventListener(&lt;eventData&gt;)</i>
162
+ *
163
+ * @param {function} eventListener event must be of the format <i>function eventListener(&lt;eventData&gt;)</i>
164
+ */
165
+ function addOnEvent(eventFunc) {
166
+ AjaxImpl_1.Implementation.addOnEvent(eventFunc);
167
+ }
168
+ ajax.addOnEvent = addOnEvent;
169
+ })(ajax = jsf.ajax || (jsf.ajax = {}));
170
+ var util;
171
+ (function (util) {
172
+ /**
173
+ * varargs function which executes a chain of code (functions or any other code)
174
+ *
175
+ * if any of the code returns false, the execution
176
+ * is terminated prematurely skipping the rest of the code!
177
+ *
178
+ * @param {DomNode} source, the callee object
179
+ * @param {Event} event, the event object of the callee event triggering this function
180
+ * @param funcs ... arbitrary array of functions or strings
181
+ * @returns true if the chain has succeeded false otherwise
182
+ */
183
+ function chain(source, event) {
184
+ var funcs = [];
185
+ for (var _i = 2; _i < arguments.length; _i++) {
186
+ funcs[_i - 2] = arguments[_i];
187
+ }
188
+ return AjaxImpl_1.Implementation.chain.apply(AjaxImpl_1.Implementation, __spreadArray([source, event], funcs, false));
189
+ }
190
+ util.chain = chain;
191
+ })(util = jsf.util || (jsf.util = {}));
192
+ var push;
193
+ (function (push) {
194
+ /**
195
+ * @param {function} onopen The function to be invoked when the web socket is opened.
196
+ * @param {function} onmessage The function to be invoked when a message is received.
197
+ * @param {function} onclose The function to be invoked when the web socket is closed.
198
+ * @param {boolean} autoconnect Whether or not to immediately open the socket. Defaults to <code>false</code>.
199
+ */
200
+ function init(socketClientId, uri, channel, onopen, onmessage, onclose, behaviorScripts, autoconnect) {
201
+ PushImpl_1.PushImpl.init(socketClientId, uri, channel, onopen, onmessage, onclose, behaviorScripts, autoconnect);
202
+ }
203
+ push.init = init;
204
+ /**
205
+ * Open the web socket on the given channel.
206
+ * @param {string} channel The name of the web socket channel.
207
+ * @throws {Error} When channel is unknown.
208
+ */
209
+ function open(socketClientId) {
210
+ PushImpl_1.PushImpl.open(socketClientId);
211
+ }
212
+ push.open = open;
213
+ /**
214
+ * Close the web socket on the given channel.
215
+ * @param {string} channel The name of the web socket channel.
216
+ * @throws {Error} When channel is unknown.
217
+ */
218
+ function close(socketClientId) {
219
+ PushImpl_1.PushImpl.close(socketClientId);
220
+ }
221
+ push.close = close;
222
+ })(push = jsf.push || (jsf.push = {}));
223
+ //We hook the old namespace system into our npm system
224
+ //if ("undefined" == window.jsf) {
225
+ // window.jsf = jsf;
226
+ //}
227
+ })(jsf = exports.jsf || (exports.jsf = {}));
228
+ //fullfill the window contract
229
+ var myfaces;
230
+ (function (myfaces) {
231
+ /**
232
+ * AB function similar to mojarra and Primefaces
233
+ * not part of the spec but a convenience accessor method
234
+ * Code provided by Thomas Andraschko
235
+ *
236
+ * @param source the event source
237
+ * @param event the event
238
+ * @param eventName event name for java.javax.faces.behavior.evemnt
239
+ * @param execute execute list as passed down in jsf.ajax.request
240
+ * @param render
241
+ * @param options
242
+ */
243
+ function ab(source, event, eventName, execute, render, options) {
244
+ if (options === void 0) { options = {}; }
245
+ if (eventName) {
246
+ options["javax.faces.behavior.event"] = eventName;
247
+ }
248
+ if (execute) {
249
+ options["execute"] = execute;
250
+ }
251
+ if (render) {
252
+ options["render"] = render;
253
+ }
254
+ jsf.ajax.request(source, event, options);
255
+ }
256
+ myfaces.ab = ab;
257
+ })(myfaces = exports.myfaces || (exports.myfaces = {}));
258
+ //# sourceMappingURL=Jsf.js.map