angular-toolbox 0.0.7 → 0.9.0

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 (230) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +14 -10
  3. package/{esm2020 → esm2022}/angular-toolbox.mjs +4 -4
  4. package/esm2022/lib/angular-toolbox.module.mjs +21 -0
  5. package/esm2022/lib/core/bridge/app-bridge.mjs +76 -0
  6. package/esm2022/lib/core/error/app-bridge-error.mjs +24 -0
  7. package/esm2022/lib/core/error/http-mock-service-error.mjs +26 -0
  8. package/esm2022/lib/core/error/index.mjs +5 -0
  9. package/esm2022/lib/core/error/integrity-error.mjs +26 -0
  10. package/esm2022/lib/core/error/subscription-error.mjs +26 -0
  11. package/esm2022/lib/core/impl/index.mjs +2 -0
  12. package/esm2022/lib/core/impl/lang/identifiable-component.mjs +31 -0
  13. package/esm2022/lib/core/impl/lang/index.mjs +2 -0
  14. package/esm2022/lib/core/impl/version/version.impl.mjs +34 -0
  15. package/esm2022/lib/core/index.mjs +3 -0
  16. package/esm2022/lib/directive/anchor-link.directive.mjs +62 -0
  17. package/esm2022/lib/directive/button-role.directive.mjs +102 -0
  18. package/esm2022/lib/directive/content-renderer.directive.mjs +61 -0
  19. package/esm2022/lib/directive/index.mjs +5 -0
  20. package/esm2022/lib/directive/navigate-to-url.directive.mjs +51 -0
  21. package/esm2022/lib/directive/navigation-directive-base.mjs +23 -0
  22. package/esm2022/lib/framework/index.mjs +2 -0
  23. package/esm2022/lib/framework/mock/http/config/http-mock-parameters.mjs +9 -0
  24. package/esm2022/lib/framework/mock/http/config/http-mock.decorator.mjs +48 -0
  25. package/esm2022/lib/framework/mock/http/config/index.mjs +3 -0
  26. package/esm2022/lib/framework/mock/http/config/route-mock-config.mjs +9 -0
  27. package/esm2022/lib/framework/mock/http/core/data-storage.mjs +9 -0
  28. package/esm2022/lib/framework/mock/http/event/event-target.impl.mjs +122 -0
  29. package/esm2022/lib/framework/mock/http/event/progress-event-mock.mjs +48 -0
  30. package/esm2022/lib/framework/mock/http/index.mjs +4 -0
  31. package/esm2022/lib/framework/mock/http/path-to-regexp/constants.mjs +111 -0
  32. package/esm2022/lib/framework/mock/http/path-to-regexp/escape-to-regexp-string.mjs +34 -0
  33. package/esm2022/lib/framework/mock/http/path-to-regexp/get-flags.mjs +28 -0
  34. package/esm2022/lib/framework/mock/http/path-to-regexp/iter.mjs +76 -0
  35. package/esm2022/lib/framework/mock/http/path-to-regexp/lexer.mjs +96 -0
  36. package/esm2022/lib/framework/mock/http/path-to-regexp/loose-replacer.mjs +28 -0
  37. package/esm2022/lib/framework/mock/http/path-to-regexp/model/decode-key-to-string.mjs +17 -0
  38. package/esm2022/lib/framework/mock/http/path-to-regexp/model/encode.mjs +17 -0
  39. package/esm2022/lib/framework/mock/http/path-to-regexp/model/key.mjs +17 -0
  40. package/esm2022/lib/framework/mock/http/path-to-regexp/model/lex-token.mjs +17 -0
  41. package/esm2022/lib/framework/mock/http/path-to-regexp/model/lexer-type.mjs +17 -0
  42. package/esm2022/lib/framework/mock/http/path-to-regexp/model/loose-replacer-provider.mjs +17 -0
  43. package/esm2022/lib/framework/mock/http/path-to-regexp/model/non-delimiter-encoder-provider.mjs +17 -0
  44. package/esm2022/lib/framework/mock/http/path-to-regexp/model/parse-options.mjs +17 -0
  45. package/esm2022/lib/framework/mock/http/path-to-regexp/model/path-to-regexp-options.mjs +17 -0
  46. package/esm2022/lib/framework/mock/http/path-to-regexp/model/route-string-tokenizer.mjs +17 -0
  47. package/esm2022/lib/framework/mock/http/path-to-regexp/model/simple-tokens.mjs +30 -0
  48. package/esm2022/lib/framework/mock/http/path-to-regexp/model/token-data-regexp-factory.mjs +17 -0
  49. package/esm2022/lib/framework/mock/http/path-to-regexp/model/token-type.mjs +17 -0
  50. package/esm2022/lib/framework/mock/http/path-to-regexp/model/token.mjs +17 -0
  51. package/esm2022/lib/framework/mock/http/path-to-regexp/string-to-token-data.mjs +87 -0
  52. package/esm2022/lib/framework/mock/http/path-to-regexp/to-key-regexp.mjs +41 -0
  53. package/esm2022/lib/framework/mock/http/path-to-regexp/to-stringify.mjs +29 -0
  54. package/esm2022/lib/framework/mock/http/path-to-regexp/token-data-to-regexp.mjs +49 -0
  55. package/esm2022/lib/framework/mock/http/path-to-regexp/token-data.mjs +33 -0
  56. package/esm2022/lib/framework/mock/http/util/data-storage.builder.mjs +35 -0
  57. package/esm2022/lib/framework/mock/http/util/http-headers-mock.builder.mjs +138 -0
  58. package/esm2022/lib/framework/mock/http/util/http-headers.util.mjs +56 -0
  59. package/esm2022/lib/framework/mock/http/util/http-method-ref.enum.mjs +60 -0
  60. package/esm2022/lib/framework/mock/http/util/http-mock-response.builder.mjs +117 -0
  61. package/esm2022/lib/framework/mock/http/util/index.mjs +3 -0
  62. package/esm2022/lib/framework/mock/http/xhr/delegate-xhr.mjs +316 -0
  63. package/esm2022/lib/framework/mock/http/xhr/http-mock-factory.impl.mjs +29 -0
  64. package/esm2022/lib/framework/mock/http/xhr/http-mock-factory.mjs +19 -0
  65. package/esm2022/lib/framework/mock/http/xhr/index.mjs +2 -0
  66. package/esm2022/lib/framework/mock/http/xhr/xhr-base.mjs +123 -0
  67. package/esm2022/lib/framework/mock/http/xhr/xhr-proxy-impl.mjs +177 -0
  68. package/esm2022/lib/model/business/index.mjs +5 -0
  69. package/esm2022/lib/model/business/lang/app-bridge-command.mjs +9 -0
  70. package/esm2022/lib/model/business/lang/destroyable.mjs +9 -0
  71. package/esm2022/lib/model/business/lang/identifiable.mjs +9 -0
  72. package/esm2022/lib/model/business/lang/index.mjs +5 -0
  73. package/esm2022/lib/model/business/lang/instantiable.mjs +9 -0
  74. package/esm2022/lib/model/business/mock/http/http-method-mock.mjs +9 -0
  75. package/esm2022/lib/model/business/mock/http/http-mock-config.mjs +9 -0
  76. package/esm2022/lib/model/business/mock/http/http-mock-endpoint.mjs +9 -0
  77. package/esm2022/lib/model/business/mock/http/http-mock-error.mjs +9 -0
  78. package/esm2022/lib/model/business/mock/http/http-mock-interceptor.mjs +9 -0
  79. package/esm2022/lib/model/business/mock/http/http-response-mock.mjs +9 -0
  80. package/esm2022/lib/model/business/mock/http/index.mjs +8 -0
  81. package/esm2022/lib/model/business/mock/http/xhr-proxy.mjs +9 -0
  82. package/esm2022/lib/model/business/ui/dark-mode-config.mjs +9 -0
  83. package/esm2022/lib/model/business/ui/dark-mode-config.provider.mjs +43 -0
  84. package/esm2022/lib/model/business/ui/dark-mode.constant.mjs +16 -0
  85. package/esm2022/lib/model/business/ui/index.mjs +5 -0
  86. package/esm2022/lib/model/business/ui/scroll-behavior.type.mjs +9 -0
  87. package/esm2022/lib/model/business/version/index.mjs +4 -0
  88. package/esm2022/lib/model/business/version/version-config.mjs +9 -0
  89. package/esm2022/lib/model/business/version/version-config.provider.mjs +40 -0
  90. package/esm2022/lib/model/business/version/version.mjs +10 -0
  91. package/esm2022/lib/model/index.mjs +3 -0
  92. package/esm2022/lib/model/service/index.mjs +5 -0
  93. package/esm2022/lib/model/service/mock/http/http-mock.service.mjs +239 -0
  94. package/esm2022/lib/model/service/subscription/subscription.service.mjs +122 -0
  95. package/esm2022/lib/model/service/ui/app-bridge.service.mjs +142 -0
  96. package/esm2022/lib/model/service/ui/dark-mode.service.mjs +183 -0
  97. package/esm2022/lib/model/service/ui/index.mjs +4 -0
  98. package/esm2022/lib/model/service/ui/scroll.service.mjs +93 -0
  99. package/esm2022/lib/model/service/version/version.service.mjs +51 -0
  100. package/{esm2020 → esm2022}/lib/pipe/index.mjs +1 -1
  101. package/esm2022/lib/pipe/safe/safe-html.pipe.mjs +34 -0
  102. package/esm2022/lib/util/aria-role.constant.mjs +16 -0
  103. package/esm2022/lib/util/default-scroll-behavior.mjs +13 -0
  104. package/esm2022/lib/util/empty-string.const.mjs +12 -0
  105. package/esm2022/lib/util/index.mjs +5 -0
  106. package/esm2022/lib/util/js-type.mjs +40 -0
  107. package/esm2022/lib/util/uuid.mjs +126 -0
  108. package/esm2022/public-api.mjs +18 -0
  109. package/fesm2022/angular-toolbox.mjs +3710 -0
  110. package/fesm2022/angular-toolbox.mjs.map +1 -0
  111. package/index.d.ts +5 -5
  112. package/lib/angular-toolbox.module.d.ts +9 -7
  113. package/lib/core/bridge/app-bridge.d.ts +59 -0
  114. package/lib/core/error/app-bridge-error.d.ts +16 -0
  115. package/lib/core/error/http-mock-service-error.d.ts +18 -0
  116. package/lib/core/error/index.d.ts +4 -0
  117. package/lib/core/error/integrity-error.d.ts +18 -0
  118. package/lib/core/error/subscription-error.d.ts +18 -0
  119. package/lib/core/impl/index.d.ts +1 -0
  120. package/lib/core/impl/lang/identifiable-component.d.ts +26 -0
  121. package/lib/core/impl/lang/index.d.ts +1 -0
  122. package/lib/core/impl/version/version.impl.d.ts +42 -0
  123. package/lib/core/index.d.ts +2 -0
  124. package/lib/directive/anchor-link.directive.d.ts +29 -0
  125. package/lib/directive/button-role.directive.d.ts +52 -0
  126. package/lib/directive/content-renderer.directive.d.ts +39 -0
  127. package/lib/directive/index.d.ts +4 -0
  128. package/lib/directive/navigate-to-url.directive.d.ts +23 -0
  129. package/lib/directive/navigation-directive-base.d.ts +19 -0
  130. package/lib/framework/index.d.ts +1 -0
  131. package/lib/framework/mock/http/config/http-mock-parameters.d.ts +13 -0
  132. package/lib/framework/mock/http/config/http-mock.decorator.d.ts +13 -0
  133. package/lib/framework/mock/http/config/index.d.ts +2 -0
  134. package/lib/framework/mock/http/config/route-mock-config.d.ts +30 -0
  135. package/lib/framework/mock/http/core/data-storage.d.ts +38 -0
  136. package/lib/framework/mock/http/event/event-target.impl.d.ts +70 -0
  137. package/lib/framework/mock/http/event/progress-event-mock.d.ts +36 -0
  138. package/lib/framework/mock/http/index.d.ts +3 -0
  139. package/lib/framework/mock/http/path-to-regexp/constants.d.ts +111 -0
  140. package/lib/framework/mock/http/path-to-regexp/escape-to-regexp-string.d.ts +24 -0
  141. package/lib/framework/mock/http/path-to-regexp/get-flags.d.ts +25 -0
  142. package/lib/framework/mock/http/path-to-regexp/iter.d.ts +50 -0
  143. package/lib/framework/mock/http/path-to-regexp/lexer.d.ts +24 -0
  144. package/lib/framework/mock/http/path-to-regexp/loose-replacer.d.ts +25 -0
  145. package/lib/framework/mock/http/path-to-regexp/model/decode-key-to-string.d.ts +21 -0
  146. package/lib/framework/mock/http/path-to-regexp/model/encode.d.ts +20 -0
  147. package/lib/framework/mock/http/path-to-regexp/model/key.d.ts +45 -0
  148. package/lib/framework/mock/http/path-to-regexp/model/lex-token.d.ts +34 -0
  149. package/lib/framework/mock/http/path-to-regexp/model/lexer-type.d.ts +21 -0
  150. package/lib/framework/mock/http/path-to-regexp/model/loose-replacer-provider.d.ts +20 -0
  151. package/lib/framework/mock/http/path-to-regexp/model/non-delimiter-encoder-provider.d.ts +21 -0
  152. package/lib/framework/mock/http/path-to-regexp/model/parse-options.d.ts +33 -0
  153. package/lib/framework/mock/http/path-to-regexp/model/path-to-regexp-options.d.ts +52 -0
  154. package/lib/framework/mock/http/path-to-regexp/model/route-string-tokenizer.d.ts +22 -0
  155. package/lib/framework/mock/http/path-to-regexp/model/simple-tokens.d.ts +21 -0
  156. package/lib/framework/mock/http/path-to-regexp/model/token-data-regexp-factory.d.ts +23 -0
  157. package/lib/framework/mock/http/path-to-regexp/model/token-type.d.ts +20 -0
  158. package/lib/framework/mock/http/path-to-regexp/model/token.d.ts +21 -0
  159. package/lib/framework/mock/http/path-to-regexp/string-to-token-data.d.ts +21 -0
  160. package/lib/framework/mock/http/path-to-regexp/to-key-regexp.d.ts +22 -0
  161. package/lib/framework/mock/http/path-to-regexp/to-stringify.d.ts +21 -0
  162. package/lib/framework/mock/http/path-to-regexp/token-data-to-regexp.d.ts +21 -0
  163. package/lib/framework/mock/http/path-to-regexp/token-data.d.ts +32 -0
  164. package/lib/framework/mock/http/util/data-storage.builder.d.ts +25 -0
  165. package/lib/framework/mock/http/util/http-headers-mock.builder.d.ts +106 -0
  166. package/lib/framework/mock/http/util/http-headers.util.d.ts +31 -0
  167. package/lib/framework/mock/http/util/http-method-ref.enum.d.ts +58 -0
  168. package/lib/framework/mock/http/util/http-mock-response.builder.d.ts +83 -0
  169. package/lib/framework/mock/http/util/index.d.ts +2 -0
  170. package/lib/framework/mock/http/xhr/delegate-xhr.d.ts +199 -0
  171. package/lib/framework/mock/http/xhr/http-mock-factory.d.ts +14 -0
  172. package/lib/framework/mock/http/xhr/http-mock-factory.impl.d.ts +24 -0
  173. package/lib/framework/mock/http/xhr/index.d.ts +1 -0
  174. package/lib/framework/mock/http/xhr/xhr-base.d.ts +123 -0
  175. package/lib/framework/mock/http/xhr/xhr-proxy-impl.d.ts +125 -0
  176. package/lib/model/business/index.d.ts +4 -0
  177. package/lib/model/business/lang/app-bridge-command.d.ts +11 -0
  178. package/lib/model/business/lang/destroyable.d.ts +16 -0
  179. package/lib/model/business/lang/identifiable.d.ts +19 -0
  180. package/lib/model/business/lang/index.d.ts +4 -0
  181. package/lib/model/business/lang/instantiable.d.ts +15 -0
  182. package/lib/model/business/mock/http/http-method-mock.d.ts +35 -0
  183. package/lib/model/business/mock/http/http-mock-config.d.ts +28 -0
  184. package/lib/model/business/mock/http/http-mock-endpoint.d.ts +41 -0
  185. package/lib/model/business/mock/http/http-mock-error.d.ts +21 -0
  186. package/lib/model/business/mock/http/http-mock-interceptor.d.ts +27 -0
  187. package/lib/model/business/mock/http/http-response-mock.d.ts +44 -0
  188. package/lib/model/business/mock/http/index.d.ts +7 -0
  189. package/lib/model/business/mock/http/xhr-proxy.d.ts +15 -0
  190. package/lib/model/business/ui/dark-mode-config.d.ts +29 -0
  191. package/lib/model/business/ui/dark-mode-config.provider.d.ts +21 -0
  192. package/lib/model/business/ui/dark-mode.constant.d.ts +15 -0
  193. package/lib/model/business/ui/index.d.ts +4 -0
  194. package/lib/model/business/ui/scroll-behavior.type.d.ts +11 -0
  195. package/lib/model/business/version/index.d.ts +3 -0
  196. package/lib/model/business/version/version-config.d.ts +28 -0
  197. package/lib/model/business/version/version-config.provider.d.ts +22 -0
  198. package/lib/model/business/version/version.d.ts +34 -0
  199. package/lib/model/index.d.ts +2 -0
  200. package/lib/model/service/index.d.ts +4 -0
  201. package/lib/model/service/mock/http/http-mock.service.d.ts +101 -0
  202. package/lib/model/service/subscription/subscription.service.d.ts +66 -0
  203. package/lib/model/service/ui/app-bridge.service.d.ts +80 -0
  204. package/lib/model/service/ui/dark-mode.service.d.ts +99 -0
  205. package/lib/model/service/ui/index.d.ts +3 -0
  206. package/lib/model/service/ui/scroll.service.d.ts +55 -0
  207. package/lib/model/service/version/version.service.d.ts +30 -0
  208. package/lib/pipe/index.d.ts +1 -1
  209. package/lib/pipe/safe/safe-html.pipe.d.ts +30 -10
  210. package/lib/util/aria-role.constant.d.ts +15 -0
  211. package/lib/util/default-scroll-behavior.d.ts +12 -0
  212. package/lib/util/empty-string.const.d.ts +11 -0
  213. package/lib/util/index.d.ts +4 -0
  214. package/lib/util/js-type.d.ts +39 -0
  215. package/lib/util/uuid.d.ts +89 -0
  216. package/package.json +10 -13
  217. package/public-api.d.ts +14 -3
  218. package/esm2020/lib/angular-toolbox.module.mjs +0 -26
  219. package/esm2020/lib/pipe/safe/safe-html.pipe.mjs +0 -18
  220. package/esm2020/lib/service/index.mjs +0 -3
  221. package/esm2020/lib/service/subscription/subscription.service.mjs +0 -60
  222. package/esm2020/lib/service/ui/dark-mode.service.mjs +0 -167
  223. package/esm2020/public-api.mjs +0 -7
  224. package/fesm2015/angular-toolbox.mjs +0 -278
  225. package/fesm2015/angular-toolbox.mjs.map +0 -1
  226. package/fesm2020/angular-toolbox.mjs +0 -274
  227. package/fesm2020/angular-toolbox.mjs.map +0 -1
  228. package/lib/service/index.d.ts +0 -2
  229. package/lib/service/subscription/subscription.service.d.ts +0 -33
  230. package/lib/service/ui/dark-mode.service.d.ts +0 -92
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ *
8
+ * This source code is derived from the following original source code:
9
+ * - https://github.com/pillarjs/path-to-regexp
10
+ * - Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
11
+ *
12
+ * Use of the original source code is governed by an MIT-style license
13
+ * that can be found in the LICENSE file at
14
+ * https://github.com/pillarjs/path-to-regexp/blob/master/LICENSE
15
+ */
16
+ import { DecodeKeyToString } from "./model/decode-key-to-string";
17
+ import { Encode } from "./model/encode";
18
+ /**
19
+ * @private
20
+ * Returns a function that converts a token into a regexp string.
21
+ */
22
+ export declare const toKeyRegexp: (stringify: Encode, delimiter: string) => DecodeKeyToString;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ *
8
+ * This source code is derived from the following original source code:
9
+ * - https://github.com/pillarjs/path-to-regexp
10
+ * - Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
11
+ *
12
+ * Use of the original source code is governed by an MIT-style license
13
+ * that can be found in the LICENSE file at
14
+ * https://github.com/pillarjs/path-to-regexp/blob/master/LICENSE
15
+ */
16
+ import { NonDelimiterEncoderProvider } from "./model/non-delimiter-encoder-provider";
17
+ /**
18
+ * @private
19
+ * Encode all non-delimiter characters using the encode function.
20
+ */
21
+ export declare const toStringify: NonDelimiterEncoderProvider;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ *
8
+ * This source code is derived from the following original source code:
9
+ * - https://github.com/pillarjs/path-to-regexp
10
+ * - Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
11
+ *
12
+ * Use of the original source code is governed by an MIT-style license
13
+ * that can be found in the LICENSE file at
14
+ * https://github.com/pillarjs/path-to-regexp/blob/master/LICENSE
15
+ */
16
+ import { TokenDataRegExpFactory } from "./model/token-data-regexp-factory";
17
+ /**
18
+ * @Private
19
+ * Expose a function for taking tokens and returning a RegExp.
20
+ */
21
+ export declare const tokenDataToRegexp: TokenDataRegExpFactory;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ *
8
+ * This source code is derived from the following original source code:
9
+ * - https://github.com/pillarjs/path-to-regexp
10
+ * - Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
11
+ *
12
+ * Use of the original source code is governed by an MIT-style license
13
+ * that can be found in the LICENSE file at
14
+ * https://github.com/pillarjs/path-to-regexp/blob/master/LICENSE
15
+ */
16
+ import { Token } from "./model/token";
17
+ /**
18
+ * @private
19
+ * Tokenized path instance.
20
+ */
21
+ export declare class TokenData {
22
+ readonly tokens: Token[];
23
+ readonly delimiter: string;
24
+ /**
25
+ * @private
26
+ * Creates a new `TokenData` instance.
27
+ *
28
+ * @param tokens A list of `Token` objects.
29
+ * @param delimiter the string delimiter for this `TokenData` instance.
30
+ */
31
+ constructor(tokens: Token[], delimiter: string);
32
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ */
8
+ import { HttpResponseMock } from "../../../../model";
9
+ import { DataStorage } from "../core/data-storage";
10
+ /**
11
+ * @private
12
+ * A static utility class for building `DataStorage` objects.
13
+ */
14
+ export declare class DataStorageBuilder {
15
+ /**
16
+ * @private
17
+ * Builds and returns a new `DataStorage` objects.
18
+ *
19
+ * @param httpResponse The `HttpResponseMock` to be stored by the framework.
20
+ * @param data The data of the HTTP response to be stored by the framework.
21
+ *
22
+ * @returns A new `DataStorage` objects.
23
+ */
24
+ static buildDataStorage(httpResponse: HttpResponseMock, data: any): DataStorage;
25
+ }
@@ -0,0 +1,106 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ */
8
+ import { HttpHeaders } from "@angular/common/http";
9
+ /**
10
+ * A statefull builder for creating new `HttpHeaders` instances.
11
+ */
12
+ export declare class HttpHeadersMockBuilder {
13
+ /**
14
+ * @private
15
+ */
16
+ private _headers;
17
+ /**
18
+ * Sets the `"Cache-Control"` property of the new `HttpHeaders` instance with the specified value.
19
+ *
20
+ * @param value The value used to set the `"Cache-Control"` property of the new `HttpHeaders` instance.
21
+ * Default value is `"no-cache"`.
22
+ *
23
+ * @returns A reference to this `HttpResponseMockBuilder` instance.
24
+ */
25
+ cacheControl(value?: string): HttpHeadersMockBuilder;
26
+ /**
27
+ * Sets the `"CContent-Type"` property of the new `HttpHeaders` instance with the specified value.
28
+ *
29
+ * @param value The value used to set the `"Content-Type"` property of the new `HttpHeaders` instance.
30
+ * Default value is `"application/json; charset=utf-8"`.
31
+ *
32
+ * @returns A reference to this `HttpResponseMockBuilder` instance.
33
+ */
34
+ contentType(value?: string): HttpHeadersMockBuilder;
35
+ /**
36
+ * Sets the `"Priority"` property of the new `HttpHeaders` instance with the specified value.
37
+ *
38
+ * @param value The value used to set the `"Priority"` property of the new `HttpHeaders` instance.
39
+ * Default value is `"u=0, i"`.
40
+ *
41
+ * @returns A reference to this `HttpResponseMockBuilder` instance.
42
+ */
43
+ priority(value?: string): HttpHeadersMockBuilder;
44
+ /**
45
+ * Sets the `"User-Agent"` property of the new `HttpHeaders` instance with the specified value.
46
+ *
47
+ * @param value The value used to set the `"User-Agent"` property of the new `HttpHeaders` instance.
48
+ * Default value is the navigator user agent.
49
+ *
50
+ * @returns A reference to this `HttpResponseMockBuilder` instance.
51
+ */
52
+ userAgent(value?: string | null): HttpHeadersMockBuilder;
53
+ /**
54
+ * Sets the `"Accept-Language"` property of the new `HttpHeaders` instance with the specified value.
55
+ *
56
+ * @param value The value used to set the `"Accept-Language"` property of the new `HttpHeaders` instance.
57
+ * Default value is the navigator language.
58
+ *
59
+ * @returns A reference to this `HttpResponseMockBuilder` instance.
60
+ */
61
+ acceptLanguage(value?: string | null): HttpHeadersMockBuilder;
62
+ /**
63
+ * Sets the `"Accept"` property of the new `HttpHeaders` instance with the specified value.
64
+ *
65
+ * @param value The value used to set the `"Accept"` property of the new `HttpHeaders` instance.
66
+ * Default value is `'*\/*'`.
67
+ *
68
+ * @returns A reference to this `HttpResponseMockBuilder` instance.
69
+ */
70
+ accept(value?: string): HttpHeadersMockBuilder;
71
+ /**
72
+ * Sets the `"Accept-Encoding"` property of the new `HttpHeaders` instance with the specified value.
73
+ *
74
+ * @param value The value used to set the `"Accept-Encoding"` property of the new `HttpHeaders` instance.
75
+ * Default value is `"ngzip, deflate, br, zstd"`.
76
+ *
77
+ * @returns A reference to this `HttpResponseMockBuilder` instance.
78
+ */
79
+ acceptEncoding(value?: string): HttpHeadersMockBuilder;
80
+ /**
81
+ * Sets or modifies a value of the new `HttpHeaders` instance.
82
+ *
83
+ * @param name The header name.
84
+ * @param value The value or values to set or override for the given header.
85
+ *
86
+ * @returns A reference to this `HttpResponseMockBuilder` instance.
87
+ */
88
+ set(name: string, value: string | string[]): HttpHeadersMockBuilder;
89
+ /**
90
+ * Return a new `HttpHeaders` instance, built from the properties specified with the
91
+ * `HttpHeadersMockBuilder` methods.
92
+ *
93
+ * @returns A new `HttpHeaders` instance.
94
+ */
95
+ headers(): HttpHeaders;
96
+ /**
97
+ * @private
98
+ */
99
+ private setHeader;
100
+ }
101
+ /**
102
+ * A utility function used to create new "chainable" `HttpHeadersMockBuilder` instances.
103
+ *
104
+ * @returns A new `HttpHeadersMockBuilder` instance;
105
+ */
106
+ export declare const httpHeadersMock: () => HttpHeadersMockBuilder;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ */
8
+ import { HttpHeaders } from "@angular/common/http";
9
+ /**
10
+ * @private
11
+ * A set of static utilities for manipulating `HttpHeaders` objects.
12
+ */
13
+ export declare class HttpHeadersUtil {
14
+ /**
15
+ * @private
16
+ * Returns a string representation the the specified `HttpHeaders `object, compatible with the format
17
+ * expected by the `XMLHttpRequest.getAllResponseHeaders()` method.
18
+ *
19
+ * @param headers The `HttpHeaders` object to format.
20
+ *
21
+ * @returns A string compatible with the format expected by the `XMLHttpRequest.getAllResponseHeaders()` method.
22
+ */
23
+ static stringify(headers: HttpHeaders | undefined): string;
24
+ /**
25
+ * @private
26
+ * Creates the default `HttpHeaders` object for a mocked HTTP request.
27
+ *
28
+ * @returns The default `HttpHeaders` object for a mocked HTTP request.
29
+ */
30
+ static createDefaultRequestHeaders(): HttpHeaders;
31
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ */
8
+ /**
9
+ * @private
10
+ * Provides the list of HTTP verbs.
11
+ */
12
+ export declare enum HTTPMethodRef {
13
+ /**
14
+ * @private
15
+ * A reference to the `connect` route associated with the `CONNECT` HTTP verb.
16
+ */
17
+ CONNECT = "connect",
18
+ /**
19
+ * @private
20
+ * A reference to the `delete` route associated with the `DELETE` HTTP verb.
21
+ */
22
+ DELETE = "delete",
23
+ /**
24
+ * @private
25
+ * A reference to the `get` route associated with the `GET` HTTP verb.
26
+ */
27
+ GET = "get",
28
+ /**
29
+ * @private
30
+ * A reference to the `head` route associated with the `HEAD` HTTP verb.
31
+ */
32
+ HEAD = "head",
33
+ /**
34
+ * @private
35
+ * A reference to the `options` route associated with the `OPTIONS` HTTP verb.
36
+ */
37
+ OPTIONS = "options",
38
+ /**
39
+ * @private
40
+ * A reference to the `patch` route associated with the `PATCH` HTTP verb.
41
+ */
42
+ PATCH = "patch",
43
+ /**
44
+ * @private
45
+ * A reference to the `post` route associated with the `POST` HTTP verb.
46
+ */
47
+ POST = "post",
48
+ /**
49
+ * @private
50
+ * A reference to the `put` route associated with the `PUT` HTTP verb.
51
+ */
52
+ PUT = "put",
53
+ /**
54
+ * @private
55
+ * A reference to the `trace` route associated with the `TRACE` HTTP verb.
56
+ */
57
+ TRACE = "trace"
58
+ }
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ */
8
+ import { HttpHeaders } from "@angular/common/http";
9
+ import { HttpMockError, HttpResponseMock } from "../../../../model";
10
+ /**
11
+ * A statefull builder for creating new `HttpResponseMock` instances.
12
+ */
13
+ export declare class HttpResponseMockBuilder {
14
+ /**
15
+ * @private
16
+ */
17
+ private _response;
18
+ /**
19
+ * Sets the body property of the new `HttpResponseMock` instance with the specified `body` value.
20
+ *
21
+ * @param body The value used to set the body property of the new `HttpResponseMock` instance.
22
+ *
23
+ * @returns A reference to this `HttpResponseMockBuilder` instance.
24
+ */
25
+ body(body: any): HttpResponseMockBuilder;
26
+ /**
27
+ * Sets the headers property of the new `HttpResponseMock` instance with the specified `headers` value.
28
+ *
29
+ * @param headers The value used to set the `headers` property of the new `HttpResponseMock` instance.
30
+ *
31
+ * @returns A reference to this `HttpResponseMockBuilder` instance.
32
+ */
33
+ headers(headers: HttpHeaders): HttpResponseMockBuilder;
34
+ /**
35
+ * Sets the `status` property of the new `HttpResponseMock` instance with the specified `status` value.
36
+ *
37
+ * @param status The value used to set the `status` property of the new `HttpResponseMock` instance.
38
+ *
39
+ * @returns A reference to this `HttpResponseMockBuilder` instance.
40
+ */
41
+ status(status: number): HttpResponseMockBuilder;
42
+ /**
43
+ * Sets the `statusText` property of the new `HttpResponseMock` instance with the specified `statusText` value.
44
+ *
45
+ * @param statusText The value used to set the `statusText` property of the new `HttpResponseMock` instance.
46
+ *
47
+ * @returns A reference to this `HttpResponseMockBuilder` instance.
48
+ */
49
+ statusText(statusText: string): HttpResponseMockBuilder;
50
+ /**
51
+ * Sets the `url` property of the new `HttpResponseMock` instance with the specified `url` value.
52
+ *
53
+ * @param url The value used to set the `url` property of the new `HttpResponseMock` instance.
54
+ *
55
+ * @returns A reference to this `HttpResponseMockBuilder` instance.
56
+ */
57
+ url(url: string | null): HttpResponseMockBuilder;
58
+ /**
59
+ * Sets the `delay` property of the new `HttpResponseMock` instance with the specified `timer` duration.
60
+ * Maximum value is `10000` miliseconds (10 seconds).
61
+ *
62
+ * @param timer The value used to set the `delay` property of the new `HttpResponseMock` instance.
63
+ *
64
+ * @returns A reference to this `HttpResponseMockBuilder` instance.
65
+ */
66
+ delay(timer?: number): HttpResponseMockBuilder;
67
+ /**
68
+ * Returns a new `HttpResponseMock` instance, built from the properties specified with the
69
+ * `HttpResponseMockBuilder` methods.
70
+ *
71
+ * @param error An optional value used to set the `error` property of the new `HttpResponseMock` instance.
72
+ * The `error` parameter values take precedence over all other properties of the `HttpResponseMock`
73
+ * instance.
74
+ * @returns A new `HttpResponseMock` instance.
75
+ */
76
+ response(error?: HttpMockError | null): HttpResponseMock;
77
+ }
78
+ /**
79
+ * A utility function used to create new "chainable" `HttpResponseMockBuilder` instances.
80
+ *
81
+ * @returns A new `HttpResponseMockBuilder` instance.
82
+ */
83
+ export declare const httpResponseMock: () => HttpResponseMockBuilder;
@@ -0,0 +1,2 @@
1
+ export * from './http-mock-response.builder';
2
+ export * from './http-headers-mock.builder';
@@ -0,0 +1,199 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ */
8
+ import { XhrProxy } from "../../../../model";
9
+ import { XhrBase } from "./xhr-base";
10
+ import { RouteMockConfig } from "../config/route-mock-config";
11
+ /**
12
+ * @private
13
+ * A utility class used as delegate of `XMLHttpRequest` functionalities when
14
+ * a HTTP request is intercepted by the Mocking Framework .
15
+ */
16
+ export declare class DelegateXhr extends XhrBase implements XhrProxy {
17
+ /**
18
+ * @private
19
+ * Indicates whether the progressive download is activated, or not.
20
+ */
21
+ private _progressiveDownload;
22
+ /**
23
+ * @private
24
+ * The config for the intercepted route.
25
+ */
26
+ private _routeConfig;
27
+ /**
28
+ * @private
29
+ *
30
+ * Internal storage for HTTP response `data`.
31
+ */
32
+ private _dataStorage;
33
+ /**
34
+ * @private
35
+ *
36
+ * Internal storage for the HTTP request `method`.
37
+ */
38
+ private _method;
39
+ /**
40
+ * @private
41
+ *
42
+ * Internal storage for the HTTP request URL.
43
+ */
44
+ private _url;
45
+ /**
46
+ * @private
47
+ *
48
+ * Internal storage for the HTTP request `readyState`.
49
+ */
50
+ private _readyState;
51
+ /**
52
+ * @private
53
+ *
54
+ * Internal storage for the HTTP request `headers`.
55
+ */
56
+ private _headers;
57
+ /**
58
+ * @private
59
+ *
60
+ * Internal storage for the HTTP request `status`.
61
+ */
62
+ private _status;
63
+ /**
64
+ * @private
65
+ *
66
+ * Internal storage for the HTTP request `statusText`.
67
+ */
68
+ private _statusText;
69
+ /**
70
+ * @private
71
+ */
72
+ private _loadSubscription;
73
+ /**
74
+ * Returns the response body content.
75
+ *
76
+ * @see https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/response
77
+ */
78
+ get response(): any;
79
+ /**
80
+ * Returns the numerical HTTP status code of the `XMLHttpRequest` response.
81
+ *
82
+ * @see https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/status
83
+ */
84
+ get status(): number;
85
+ /**
86
+ * Returns a string containing the response status message as returned by the HTTP server.
87
+ *
88
+ * @see https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/statusText
89
+ */
90
+ get statusText(): string;
91
+ /**
92
+ * Returns the state the `XMLHttpRequest` client is in.
93
+ *
94
+ * @see https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/readyState
95
+ */
96
+ get readyState(): number;
97
+ /**
98
+ * Returns the serialized URL of the response or the empty string if the URL is `null`.
99
+ *
100
+ * @see https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/responseURL
101
+ */
102
+ get responseURL(): string;
103
+ /**
104
+ * Returns the text received from a server following a request being sent.
105
+ *
106
+ * Throws an `InvalidStateError` DOMException if responseType is not the empty string or "text".
107
+ *
108
+ * @see https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/responseText
109
+ */
110
+ get responseText(): string;
111
+ /**
112
+ * Returns an `XMLHttpRequestUpload` object that can be observed to monitor an upload progress.
113
+ *
114
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/upload
115
+ */
116
+ get upload(): XMLHttpRequestUpload;
117
+ /**
118
+ * Returns an an enumerated string value specifying the type of data contained in the response.
119
+ *
120
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType
121
+ */
122
+ responseType: XMLHttpRequestResponseType;
123
+ /**
124
+ * Initializes a newly-created request, or re-initializes an existing one.
125
+ *
126
+ * @param method The HTTP request method to use, such as `"GET"`, `"POST"`, `"PUT"`, `"DELETE"`,
127
+ * etc. Ignored for non-HTTP(S) URLs.
128
+ * @param url A string or any other object with a stringifier — including a URL object —
129
+ * that provides the URL of the resource to send the request to.
130
+ */
131
+ open(method: string, url: string | URL): void;
132
+ /**
133
+ * @private
134
+ */
135
+ open(method: string, url: string | URL, async: boolean, username?: string | null | undefined, password?: string | null | undefined): void;
136
+ /**
137
+ * Aborts the request if it has already been sent. When a request is aborted, its `readyState`
138
+ * is changed to `XMLHttpRequest.UNSENT` and the request status code is set to `0`.
139
+ */
140
+ abort(): void;
141
+ /**
142
+ * Returns all the response headers, separated by CRLF, as a string, or returns `null`
143
+ * if no response has been received.
144
+ *
145
+ * @returns All the response headers, separated by CRLF, as a string, or returns `null`
146
+ * if no response has been received.
147
+ */
148
+ getAllResponseHeaders(): string;
149
+ /**
150
+ * Sends the request to the server.
151
+ *
152
+ * @param body A body of data to be sent in the XHR request.
153
+ */
154
+ send(body?: Document | XMLHttpRequestBodyInit | null | undefined): void;
155
+ /**
156
+ * Sets the value of an HTTP request header.
157
+ *
158
+ * @param name The name of the header whose value is to be set.
159
+ * @param value The value to set as the body of the header.
160
+ */
161
+ setRequestHeader(name: string, value: string): void;
162
+ /**
163
+ * @private
164
+ */
165
+ constructor(routeConfig: RouteMockConfig);
166
+ /**
167
+ * @private
168
+ * Internally used by the framework to delete a `DelegateXhr` instance.
169
+ */
170
+ destroy(): void;
171
+ /**
172
+ * @private
173
+ */
174
+ private doProgressiveDownload;
175
+ /**
176
+ * @private
177
+ */
178
+ private onLoadComplete;
179
+ /**
180
+ * @private
181
+ */
182
+ private onError;
183
+ /**
184
+ * @private
185
+ */
186
+ private eventDispatch;
187
+ /**
188
+ * @private
189
+ */
190
+ private dispatchProgressEvent;
191
+ /**
192
+ * @private
193
+ */
194
+ private setReadyState;
195
+ /**
196
+ * @private
197
+ */
198
+ private loadData;
199
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ */
8
+ import { XhrProxyFactoryImpl } from "./http-mock-factory.impl";
9
+ /**
10
+ * A factory function that creates and returns a new `XhrFactory` object.
11
+ *
12
+ * @returns A new `XhrFactory` object.
13
+ */
14
+ export declare const httpMockFactory: () => XhrProxyFactoryImpl;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license
3
+ * Copyright Pascal ECHEMANN. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be found in
6
+ * the LICENSE file at https://pascalechemann.com/angular-toolbox/resources/license
7
+ */
8
+ import { XhrFactory } from "@angular/common";
9
+ import { HttpMockService } from "../../../../model/service/mock/http/http-mock.service";
10
+ /**
11
+ * @private
12
+ * The concrete implementation of the `XhrFactory` interface.
13
+ */
14
+ export declare class XhrProxyFactoryImpl extends XhrFactory {
15
+ private _httpMockService;
16
+ /**
17
+ * @private
18
+ */
19
+ constructor(_httpMockService: HttpMockService);
20
+ /**
21
+ * @private
22
+ */
23
+ build(): XMLHttpRequest;
24
+ }
@@ -0,0 +1 @@
1
+ export * from './http-mock-factory';