@cratis/arc 22.150.0 → 22.152.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 (193) hide show
  1. package/Globals.ts +10 -0
  2. package/dist/cjs/Globals.d.ts +2 -0
  3. package/dist/cjs/Globals.d.ts.map +1 -1
  4. package/dist/cjs/Globals.js +7 -0
  5. package/dist/cjs/Globals.js.map +1 -1
  6. package/dist/cjs/queries/ObservableQueryConnectionFactory.d.ts +5 -0
  7. package/dist/cjs/queries/ObservableQueryConnectionFactory.d.ts.map +1 -1
  8. package/dist/cjs/queries/ObservableQueryConnectionFactory.js +16 -1
  9. package/dist/cjs/queries/ObservableQueryConnectionFactory.js.map +1 -1
  10. package/dist/cjs/queries/ObservableQueryFor.d.ts +3 -0
  11. package/dist/cjs/queries/ObservableQueryFor.d.ts.map +1 -1
  12. package/dist/cjs/queries/ObservableQueryFor.js +12 -3
  13. package/dist/cjs/queries/ObservableQueryFor.js.map +1 -1
  14. package/dist/cjs/queries/PollingOptions.d.ts +8 -0
  15. package/dist/cjs/queries/PollingOptions.d.ts.map +1 -0
  16. package/dist/cjs/queries/PollingQueryConnection.d.ts +33 -0
  17. package/dist/cjs/queries/PollingQueryConnection.d.ts.map +1 -0
  18. package/dist/cjs/queries/PollingQueryConnection.js +150 -0
  19. package/dist/cjs/queries/PollingQueryConnection.js.map +1 -0
  20. package/dist/cjs/queries/QueryTransportMethod.d.ts +2 -1
  21. package/dist/cjs/queries/QueryTransportMethod.d.ts.map +1 -1
  22. package/dist/cjs/queries/QueryTransportMethod.js +1 -0
  23. package/dist/cjs/queries/QueryTransportMethod.js.map +1 -1
  24. package/dist/cjs/queries/index.d.ts +2 -0
  25. package/dist/cjs/queries/index.d.ts.map +1 -1
  26. package/dist/cjs/queries/index.js +4 -0
  27. package/dist/cjs/queries/index.js.map +1 -1
  28. package/dist/esm/Globals.d.ts +2 -0
  29. package/dist/esm/Globals.d.ts.map +1 -1
  30. package/dist/esm/Globals.js +7 -0
  31. package/dist/esm/Globals.js.map +1 -1
  32. package/dist/esm/queries/ObservableQueryConnectionFactory.d.ts +5 -0
  33. package/dist/esm/queries/ObservableQueryConnectionFactory.d.ts.map +1 -1
  34. package/dist/esm/queries/ObservableQueryConnectionFactory.js +16 -2
  35. package/dist/esm/queries/ObservableQueryConnectionFactory.js.map +1 -1
  36. package/dist/esm/queries/ObservableQueryFor.d.ts +3 -0
  37. package/dist/esm/queries/ObservableQueryFor.d.ts.map +1 -1
  38. package/dist/esm/queries/ObservableQueryFor.js +13 -4
  39. package/dist/esm/queries/ObservableQueryFor.js.map +1 -1
  40. package/dist/esm/queries/PollingOptions.d.ts +8 -0
  41. package/dist/esm/queries/PollingOptions.d.ts.map +1 -0
  42. package/dist/esm/queries/PollingOptions.js +2 -0
  43. package/dist/esm/queries/PollingOptions.js.map +1 -0
  44. package/dist/esm/queries/PollingQueryConnection.d.ts +33 -0
  45. package/dist/esm/queries/PollingQueryConnection.d.ts.map +1 -0
  46. package/dist/esm/queries/PollingQueryConnection.js +147 -0
  47. package/dist/esm/queries/PollingQueryConnection.js.map +1 -0
  48. package/dist/esm/queries/QueryTransportMethod.d.ts +2 -1
  49. package/dist/esm/queries/QueryTransportMethod.d.ts.map +1 -1
  50. package/dist/esm/queries/QueryTransportMethod.js +1 -0
  51. package/dist/esm/queries/QueryTransportMethod.js.map +1 -1
  52. package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_polling_transport.d.ts +2 -0
  53. package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_polling_transport.d.ts.map +1 -0
  54. package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_polling_transport.js +46 -0
  55. package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_polling_transport.js.map +1 -0
  56. package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_polling_transport.d.ts +2 -0
  57. package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_polling_transport.d.ts.map +1 -0
  58. package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_polling_transport.js +46 -0
  59. package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_polling_transport.js.map +1 -0
  60. package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_polling_transport.d.ts +2 -0
  61. package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_polling_transport.d.ts.map +1 -0
  62. package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_polling_transport.js +108 -0
  63. package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_polling_transport.js.map +1 -0
  64. package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_polling_transport_and_unauthorized_response.d.ts +2 -0
  65. package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_polling_transport_and_unauthorized_response.d.ts.map +1 -0
  66. package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_polling_transport_and_unauthorized_response.js +39 -0
  67. package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_polling_transport_and_unauthorized_response.js.map +1 -0
  68. package/dist/esm/queries/for_PollingQueryConnection/given/a_polling_query_connection.d.ts +31 -0
  69. package/dist/esm/queries/for_PollingQueryConnection/given/a_polling_query_connection.d.ts.map +1 -0
  70. package/dist/esm/queries/for_PollingQueryConnection/given/a_polling_query_connection.js +52 -0
  71. package/dist/esm/queries/for_PollingQueryConnection/given/a_polling_query_connection.js.map +1 -0
  72. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_a_network_error.d.ts +2 -0
  73. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_a_network_error.d.ts.map +1 -0
  74. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_a_network_error.js +16 -0
  75. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_a_network_error.js.map +1 -0
  76. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_a_server_error_with_an_envelope.d.ts +2 -0
  77. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_a_server_error_with_an_envelope.d.ts.map +1 -0
  78. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_a_server_error_with_an_envelope.js +22 -0
  79. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_a_server_error_with_an_envelope.js.map +1 -0
  80. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_not_ready.d.ts +2 -0
  81. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_not_ready.d.ts.map +1 -0
  82. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_not_ready.js +19 -0
  83. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_not_ready.js.map +1 -0
  84. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_repeated_failures.d.ts +2 -0
  85. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_repeated_failures.d.ts.map +1 -0
  86. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_repeated_failures.js +16 -0
  87. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_repeated_failures.js.map +1 -0
  88. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_request_timeout.d.ts +2 -0
  89. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_request_timeout.d.ts.map +1 -0
  90. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_request_timeout.js +19 -0
  91. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/after_request_timeout.js.map +1 -0
  92. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/with_jitter.d.ts +2 -0
  93. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/with_jitter.d.ts.map +1 -0
  94. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/with_jitter.js +16 -0
  95. package/dist/esm/queries/for_PollingQueryConnection/when_backing_off/with_jitter.js.map +1 -0
  96. package/dist/esm/queries/for_PollingQueryConnection/when_disconnecting/and_fetch_rejects_on_abort.d.ts +2 -0
  97. package/dist/esm/queries/for_PollingQueryConnection/when_disconnecting/and_fetch_rejects_on_abort.d.ts.map +1 -0
  98. package/dist/esm/queries/for_PollingQueryConnection/when_disconnecting/and_fetch_rejects_on_abort.js +16 -0
  99. package/dist/esm/queries/for_PollingQueryConnection/when_disconnecting/and_fetch_rejects_on_abort.js.map +1 -0
  100. package/dist/esm/queries/for_PollingQueryConnection/when_disconnecting/while_a_request_is_in_flight.d.ts +2 -0
  101. package/dist/esm/queries/for_PollingQueryConnection/when_disconnecting/while_a_request_is_in_flight.d.ts.map +1 -0
  102. package/dist/esm/queries/for_PollingQueryConnection/when_disconnecting/while_a_request_is_in_flight.js +16 -0
  103. package/dist/esm/queries/for_PollingQueryConnection/when_disconnecting/while_a_request_is_in_flight.js.map +1 -0
  104. package/dist/esm/queries/for_PollingQueryConnection/when_disconnecting/while_waiting_for_the_next_poll.d.ts +2 -0
  105. package/dist/esm/queries/for_PollingQueryConnection/when_disconnecting/while_waiting_for_the_next_poll.d.ts.map +1 -0
  106. package/dist/esm/queries/for_PollingQueryConnection/when_disconnecting/while_waiting_for_the_next_poll.js +14 -0
  107. package/dist/esm/queries/for_PollingQueryConnection/when_disconnecting/while_waiting_for_the_next_poll.js.map +1 -0
  108. package/dist/esm/queries/for_PollingQueryConnection/when_polling/and_a_request_is_still_in_flight.d.ts +2 -0
  109. package/dist/esm/queries/for_PollingQueryConnection/when_polling/and_a_request_is_still_in_flight.d.ts.map +1 -0
  110. package/dist/esm/queries/for_PollingQueryConnection/when_polling/and_a_request_is_still_in_flight.js +12 -0
  111. package/dist/esm/queries/for_PollingQueryConnection/when_polling/and_a_request_is_still_in_flight.js.map +1 -0
  112. package/dist/esm/queries/for_PollingQueryConnection/when_polling/and_data_changes.d.ts +2 -0
  113. package/dist/esm/queries/for_PollingQueryConnection/when_polling/and_data_changes.d.ts.map +1 -0
  114. package/dist/esm/queries/for_PollingQueryConnection/when_polling/and_data_changes.js +47 -0
  115. package/dist/esm/queries/for_PollingQueryConnection/when_polling/and_data_changes.js.map +1 -0
  116. package/dist/esm/queries/for_PollingQueryConnection/when_polling/and_data_is_unchanged.d.ts +2 -0
  117. package/dist/esm/queries/for_PollingQueryConnection/when_polling/and_data_is_unchanged.d.ts.map +1 -0
  118. package/dist/esm/queries/for_PollingQueryConnection/when_polling/and_data_is_unchanged.js +21 -0
  119. package/dist/esm/queries/for_PollingQueryConnection/when_polling/and_data_is_unchanged.js.map +1 -0
  120. package/dist/esm/queries/for_PollingQueryConnection/when_polling/with_global_and_instance_headers.d.ts +2 -0
  121. package/dist/esm/queries/for_PollingQueryConnection/when_polling/with_global_and_instance_headers.d.ts.map +1 -0
  122. package/dist/esm/queries/for_PollingQueryConnection/when_polling/with_global_and_instance_headers.js +25 -0
  123. package/dist/esm/queries/for_PollingQueryConnection/when_polling/with_global_and_instance_headers.js.map +1 -0
  124. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/above_the_maximum.d.ts +2 -0
  125. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/above_the_maximum.d.ts.map +1 -0
  126. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/above_the_maximum.js +16 -0
  127. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/above_the_maximum.js.map +1 -0
  128. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/below_the_minimum.d.ts +2 -0
  129. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/below_the_minimum.d.ts.map +1 -0
  130. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/below_the_minimum.js +18 -0
  131. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/below_the_minimum.js.map +1 -0
  132. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/on_a_not_ready_response.d.ts +2 -0
  133. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/on_a_not_ready_response.d.ts.map +1 -0
  134. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/on_a_not_ready_response.js +16 -0
  135. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/on_a_not_ready_response.js.map +1 -0
  136. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/that_is_invalid.d.ts +2 -0
  137. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/that_is_invalid.d.ts.map +1 -0
  138. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/that_is_invalid.js +18 -0
  139. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/that_is_invalid.js.map +1 -0
  140. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/within_bounds.d.ts +2 -0
  141. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/within_bounds.d.ts.map +1 -0
  142. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/within_bounds.js +16 -0
  143. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/within_bounds.js.map +1 -0
  144. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_invalid_arguments/stops_polling.d.ts +2 -0
  145. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_invalid_arguments/stops_polling.d.ts.map +1 -0
  146. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_invalid_arguments/stops_polling.js +12 -0
  147. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_invalid_arguments/stops_polling.js.map +1 -0
  148. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_unauthorized/stops_polling.d.ts +2 -0
  149. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_unauthorized/stops_polling.d.ts.map +1 -0
  150. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_unauthorized/stops_polling.js +14 -0
  151. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_unauthorized/stops_polling.js.map +1 -0
  152. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_unauthorized/with_a_non_json_body.d.ts +2 -0
  153. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_unauthorized/with_a_non_json_body.d.ts.map +1 -0
  154. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_unauthorized/with_a_non_json_body.js +14 -0
  155. package/dist/esm/queries/for_PollingQueryConnection/when_receiving_unauthorized/with_a_non_json_body.js.map +1 -0
  156. package/dist/esm/queries/index.d.ts +2 -0
  157. package/dist/esm/queries/index.d.ts.map +1 -1
  158. package/dist/esm/queries/index.js +2 -1
  159. package/dist/esm/queries/index.js.map +1 -1
  160. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  161. package/package.json +1 -1
  162. package/queries/ObservableQueryConnectionFactory.ts +24 -1
  163. package/queries/ObservableQueryFor.ts +15 -3
  164. package/queries/PollingOptions.ts +16 -0
  165. package/queries/PollingQueryConnection.ts +149 -0
  166. package/queries/QueryTransportMethod.ts +3 -0
  167. package/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_polling_transport.ts +47 -0
  168. package/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_polling_transport.ts +47 -0
  169. package/queries/for_ObservableQueryFor/when_subscribing/with_polling_transport.ts +115 -0
  170. package/queries/for_ObservableQueryFor/when_subscribing/with_polling_transport_and_unauthorized_response.ts +44 -0
  171. package/queries/for_PollingQueryConnection/given/a_polling_query_connection.ts +60 -0
  172. package/queries/for_PollingQueryConnection/when_backing_off/after_a_network_error.ts +19 -0
  173. package/queries/for_PollingQueryConnection/when_backing_off/after_a_server_error_with_an_envelope.ts +25 -0
  174. package/queries/for_PollingQueryConnection/when_backing_off/after_not_ready.ts +22 -0
  175. package/queries/for_PollingQueryConnection/when_backing_off/after_repeated_failures.ts +19 -0
  176. package/queries/for_PollingQueryConnection/when_backing_off/after_request_timeout.ts +22 -0
  177. package/queries/for_PollingQueryConnection/when_backing_off/with_jitter.ts +19 -0
  178. package/queries/for_PollingQueryConnection/when_disconnecting/and_fetch_rejects_on_abort.ts +19 -0
  179. package/queries/for_PollingQueryConnection/when_disconnecting/while_a_request_is_in_flight.ts +19 -0
  180. package/queries/for_PollingQueryConnection/when_disconnecting/while_waiting_for_the_next_poll.ts +17 -0
  181. package/queries/for_PollingQueryConnection/when_polling/and_a_request_is_still_in_flight.ts +15 -0
  182. package/queries/for_PollingQueryConnection/when_polling/and_data_changes.ts +51 -0
  183. package/queries/for_PollingQueryConnection/when_polling/and_data_is_unchanged.ts +24 -0
  184. package/queries/for_PollingQueryConnection/when_polling/with_global_and_instance_headers.ts +28 -0
  185. package/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/above_the_maximum.ts +19 -0
  186. package/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/below_the_minimum.ts +21 -0
  187. package/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/on_a_not_ready_response.ts +19 -0
  188. package/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/that_is_invalid.ts +21 -0
  189. package/queries/for_PollingQueryConnection/when_receiving_a_poll_hint/within_bounds.ts +19 -0
  190. package/queries/for_PollingQueryConnection/when_receiving_invalid_arguments/stops_polling.ts +15 -0
  191. package/queries/for_PollingQueryConnection/when_receiving_unauthorized/stops_polling.ts +17 -0
  192. package/queries/for_PollingQueryConnection/when_receiving_unauthorized/with_a_non_json_body.ts +17 -0
  193. package/queries/index.ts +2 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"after_a_network_error.d.ts","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_backing_off/after_a_network_error.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { given } from '../../../given.js';
2
+ import { a_polling_query_connection } from '../given/a_polling_query_connection.js';
3
+ describe('when backing off after a network error', given(a_polling_query_connection, context => {
4
+ let beforeRetry;
5
+ beforeEach(async () => {
6
+ context.fetchStub.onFirstCall().rejects(new TypeError('offline'));
7
+ context.connection.connect(context.dataReceived);
8
+ await context.clock.tickAsync(1999);
9
+ beforeRetry = context.fetchStub.callCount;
10
+ await context.clock.tickAsync(1001);
11
+ });
12
+ it('should wait twice the interval before retrying', () => beforeRetry.should.equal(1));
13
+ it('should reset to the normal interval after recovery', () => context.fetchStub.callCount.should.equal(3));
14
+ it('should emit the recovered result', () => context.dataReceived.callCount.should.equal(1));
15
+ }));
16
+ //# sourceMappingURL=after_a_network_error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"after_a_network_error.js","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_backing_off/after_a_network_error.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,QAAQ,CAAC,wCAAwC,EAAE,KAAK,CAAC,0BAA0B,EAAE,OAAO,CAAC,EAAE;IAC3F,IAAI,WAAmB,CAAC;IACxB,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;QAClE,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpC,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC;QAC1C,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACxF,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5G,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACjG,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=after_a_server_error_with_an_envelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"after_a_server_error_with_an_envelope.d.ts","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_backing_off/after_a_server_error_with_an_envelope.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ import { given } from '../../../given.js';
2
+ import { a_polling_query_connection } from '../given/a_polling_query_connection.js';
3
+ describe('when backing off after a server error with an envelope', given(a_polling_query_connection, context => {
4
+ let beforeRetry;
5
+ beforeEach(async () => {
6
+ context.fetchStub.callsFake(async () => new Response(JSON.stringify(context.envelope(null, { hasExceptions: true })), { status: 500 }));
7
+ context.connection.connect(context.dataReceived);
8
+ await context.clock.tickAsync(0);
9
+ await context.clock.tickAsync(1999);
10
+ beforeRetry = context.fetchStub.callCount;
11
+ await context.clock.tickAsync(1);
12
+ });
13
+ it('should emit the error envelope once', () => {
14
+ context.dataReceived.callCount.should.equal(1);
15
+ context.dataReceived.firstCall.args[0].hasExceptions.should.be.true;
16
+ });
17
+ it('should back off before retrying', () => {
18
+ beforeRetry.should.equal(1);
19
+ context.fetchStub.callCount.should.equal(2);
20
+ });
21
+ }));
22
+ //# sourceMappingURL=after_a_server_error_with_an_envelope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"after_a_server_error_with_an_envelope.js","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_backing_off/after_a_server_error_with_an_envelope.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,K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AS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=after_not_ready.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"after_not_ready.d.ts","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_backing_off/after_not_ready.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import { given } from '../../../given.js';
2
+ import { a_polling_query_connection } from '../given/a_polling_query_connection.js';
3
+ describe('when backing off after not ready', given(a_polling_query_connection, context => {
4
+ let beforeRetry;
5
+ let emissionsBeforeRetry;
6
+ beforeEach(async () => {
7
+ context.respond(202);
8
+ context.connection.connect(context.dataReceived);
9
+ await context.clock.tickAsync(0);
10
+ await context.clock.tickAsync(1999);
11
+ beforeRetry = context.fetchStub.callCount;
12
+ emissionsBeforeRetry = context.dataReceived.callCount;
13
+ await context.clock.tickAsync(1001);
14
+ });
15
+ it('should wait twice the interval', () => beforeRetry.should.equal(1));
16
+ it('should not emit the not ready response', () => emissionsBeforeRetry.should.equal(0));
17
+ it('should return to the normal interval after recovery', () => context.fetchStub.callCount.should.equal(3));
18
+ }));
19
+ //# sourceMappingURL=after_not_ready.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"after_not_ready.js","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_backing_off/after_not_ready.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,QAAQ,CAAC,kCAAkC,EAAE,KAAK,CAAC,0BAA0B,EAAE,OAAO,CAAC,EAAE;IACrF,IAAI,WAAmB,CAAC;IACxB,IAAI,oBAA4B,CAAC;IACjC,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACrB,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpC,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC;QAC1C,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC;QACtD,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACzF,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACjH,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=after_repeated_failures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"after_repeated_failures.d.ts","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_backing_off/after_repeated_failures.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { given } from '../../../given.js';
2
+ import { a_polling_query_connection } from '../given/a_polling_query_connection.js';
3
+ describe('when backing off after repeated failures', given(a_polling_query_connection, context => {
4
+ const requestTimes = [];
5
+ beforeEach(async () => {
6
+ requestTimes.length = 0;
7
+ context.fetchStub.callsFake(async () => {
8
+ requestTimes.push(context.clock.now);
9
+ throw new TypeError('offline');
10
+ });
11
+ context.connection.connect(context.dataReceived);
12
+ await context.clock.tickAsync(22000);
13
+ });
14
+ it('should double the delay up to the maximum', () => requestTimes.should.deep.equal([0, 2000, 6000, 14000, 22000]));
15
+ }));
16
+ //# sourceMappingURL=after_repeated_failures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"after_repeated_failures.js","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_backing_off/after_repeated_failures.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,QAAQ,CAAC,0CAA0C,EAAE,KAAK,CAAC,0BAA0B,EAAE,OAAO,CAAC,EAAE;IAC7F,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;QACxB,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;YACnC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACrC,MAAM,IAAI,SAAS,CAAC,SAAS,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AACzH,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=after_request_timeout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"after_request_timeout.d.ts","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_backing_off/after_request_timeout.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import { given } from '../../../given.js';
2
+ import { a_polling_query_connection } from '../given/a_polling_query_connection.js';
3
+ describe('when backing off after request timeout', given(a_polling_query_connection, context => {
4
+ let beforeRetry;
5
+ let emissionsBeforeRetry;
6
+ beforeEach(async () => {
7
+ context.respond(408);
8
+ context.connection.connect(context.dataReceived);
9
+ await context.clock.tickAsync(0);
10
+ await context.clock.tickAsync(1999);
11
+ beforeRetry = context.fetchStub.callCount;
12
+ emissionsBeforeRetry = context.dataReceived.callCount;
13
+ await context.clock.tickAsync(1001);
14
+ });
15
+ it('should wait twice the interval', () => beforeRetry.should.equal(1));
16
+ it('should not emit the timeout response', () => emissionsBeforeRetry.should.equal(0));
17
+ it('should return to the normal interval after recovery', () => context.fetchStub.callCount.should.equal(3));
18
+ }));
19
+ //# sourceMappingURL=after_request_timeout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"after_request_timeout.js","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_backing_off/after_request_timeout.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,QAAQ,CAAC,wCAAwC,EAAE,KAAK,CAAC,0BAA0B,EAAE,OAAO,CAAC,EAAE;IAC3F,IAAI,WAAmB,CAAC;IACxB,IAAI,oBAA4B,CAAC;IACjC,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACrB,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpC,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC;QAC1C,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC;QACtD,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvF,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACjH,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=with_jitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with_jitter.d.ts","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_backing_off/with_jitter.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { given } from '../../../given.js';
2
+ import { a_polling_query_connection } from '../given/a_polling_query_connection.js';
3
+ describe('when backing off with jitter', given(a_polling_query_connection, context => {
4
+ let beforeRetry;
5
+ beforeEach(async () => {
6
+ context.random.returns(1);
7
+ context.fetchStub.onFirstCall().rejects(new TypeError('offline'));
8
+ context.connection.connect(context.dataReceived);
9
+ await context.clock.tickAsync(2399);
10
+ beforeRetry = context.fetchStub.callCount;
11
+ await context.clock.tickAsync(1);
12
+ });
13
+ it('should not retry before the jittered delay', () => beforeRetry.should.equal(1));
14
+ it('should retry at the jittered delay', () => context.fetchStub.callCount.should.equal(2));
15
+ }));
16
+ //# sourceMappingURL=with_jitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with_jitter.js","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_backing_off/with_jitter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,QAAQ,CAAC,8BAA8B,EAAE,KAAK,CAAC,0BAA0B,EAAE,OAAO,CAAC,EAAE;IACjF,IAAI,WAAmB,CAAC;IACxB,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC1B,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;QAClE,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpC,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC;QAC1C,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACpF,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAChG,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=and_fetch_rejects_on_abort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"and_fetch_rejects_on_abort.d.ts","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_disconnecting/and_fetch_rejects_on_abort.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { given } from '../../../given.js';
2
+ import { a_polling_query_connection } from '../given/a_polling_query_connection.js';
3
+ describe('when disconnecting and fetch rejects on abort', given(a_polling_query_connection, context => {
4
+ beforeEach(async () => {
5
+ context.fetchStub.callsFake((_url, init) => new Promise((_resolve, reject) => {
6
+ init.signal.addEventListener('abort', () => reject(new DOMException('The operation was aborted.', 'AbortError')), { once: true });
7
+ }));
8
+ context.connection.connect(context.dataReceived);
9
+ context.connection.disconnect();
10
+ await context.clock.tickAsync(60000);
11
+ });
12
+ it('should not deliver a result', () => context.dataReceived.called.should.be.false);
13
+ it('should not retry the aborted request', () => context.fetchStub.callCount.should.equal(1));
14
+ it('should leave no pending polling timer', () => context.clock.countTimers().should.equal(0));
15
+ }));
16
+ //# sourceMappingURL=and_fetch_rejects_on_abort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"and_fetch_rejects_on_abort.js","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_disconnecting/and_fetch_rejects_on_abort.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,QAAQ,CAAC,+CAA+C,EAAE,KAAK,CAAC,0BAA0B,EAAE,OAAO,CAAC,EAAE;IAClG,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,IAAY,EAAE,IAAiB,EAAE,EAAE,CAAC,IAAI,OAAO,CAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE;YACxG,IAAI,CAAC,MAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC,4BAA4B,EAAE,YAAY,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACvI,CAAC,CAAC,CAAC,CAAC;QACJ,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACjD,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;QAChC,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACrF,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9F,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACnG,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=while_a_request_is_in_flight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"while_a_request_is_in_flight.d.ts","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_disconnecting/while_a_request_is_in_flight.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { given } from '../../../given.js';
2
+ import { a_polling_query_connection } from '../given/a_polling_query_connection.js';
3
+ describe('when disconnecting while a request is in flight', given(a_polling_query_connection, context => {
4
+ beforeEach(async () => {
5
+ let resolveRequest;
6
+ context.fetchStub.returns(new Promise(resolve => { resolveRequest = resolve; }));
7
+ context.connection.connect(context.dataReceived);
8
+ context.connection.disconnect();
9
+ resolveRequest(new Response(JSON.stringify(context.envelope('late'))));
10
+ await context.clock.tickAsync(60000);
11
+ });
12
+ it('should abort the request', () => context.fetchStub.firstCall.args[1].signal.aborted.should.be.true);
13
+ it('should ignore a late result', () => context.dataReceived.called.should.be.false);
14
+ it('should not poll again', () => context.fetchStub.callCount.should.equal(1));
15
+ }));
16
+ //# sourceMappingURL=while_a_request_is_in_flight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"while_a_request_is_in_flight.js","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_disconnecting/while_a_request_is_in_flight.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,QAAQ,CAAC,iDAAiD,EAAE,KAAK,CAAC,0BAA0B,EAAE,OAAO,CAAC,EAAE;IACpG,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,IAAI,cAA6C,CAAC;QAClD,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,OAAO,CAAW,OAAO,CAAC,EAAE,GAAG,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3F,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACjD,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;QAChC,cAAc,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACvE,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACxG,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACrF,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACnF,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=while_waiting_for_the_next_poll.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"while_waiting_for_the_next_poll.d.ts","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_disconnecting/while_waiting_for_the_next_poll.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import { given } from '../../../given.js';
2
+ import { a_polling_query_connection } from '../given/a_polling_query_connection.js';
3
+ describe('when disconnecting while waiting for the next poll', given(a_polling_query_connection, context => {
4
+ beforeEach(async () => {
5
+ context.connection.connect(context.dataReceived);
6
+ await context.clock.tickAsync(0);
7
+ context.connection.disconnect();
8
+ context.connection.connect(context.dataReceived);
9
+ await context.clock.tickAsync(60000);
10
+ });
11
+ it('should not poll again even if connect is called', () => context.fetchStub.callCount.should.equal(1));
12
+ it('should clear the timer', () => context.clock.countTimers().should.equal(0));
13
+ }));
14
+ //# sourceMappingURL=while_waiting_for_the_next_poll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"while_waiting_for_the_next_poll.js","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_disconnecting/while_waiting_for_the_next_poll.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,QAAQ,CAAC,oDAAoD,EAAE,KAAK,CAAC,0BAA0B,EAAE,OAAO,CAAC,EAAE;IACvG,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACjC,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;QAChC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACzG,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACpF,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=and_a_request_is_still_in_flight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"and_a_request_is_still_in_flight.d.ts","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_polling/and_a_request_is_still_in_flight.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import { given } from '../../../given.js';
2
+ import { a_polling_query_connection } from '../given/a_polling_query_connection.js';
3
+ describe('when polling and a request is still in flight', given(a_polling_query_connection, context => {
4
+ beforeEach(async () => {
5
+ context.fetchStub.returns(new Promise(() => { }));
6
+ context.connection.connect(context.dataReceived);
7
+ context.connection.connect(context.dataReceived);
8
+ await context.clock.tickAsync(5000);
9
+ });
10
+ it('should have only one request in flight', () => context.fetchStub.callCount.should.equal(1));
11
+ }));
12
+ //# sourceMappingURL=and_a_request_is_still_in_flight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"and_a_request_is_still_in_flight.js","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_polling/and_a_request_is_still_in_flight.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,QAAQ,CAAC,+CAA+C,EAAE,KAAK,CAAC,0BAA0B,EAAE,OAAO,CAAC,EAAE;IAClG,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,OAAO,CAAW,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC;QAC3D,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACjD,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACpG,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=and_data_changes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"and_data_changes.d.ts","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_polling/and_data_changes.ts"],"names":[],"mappings":""}
@@ -0,0 +1,47 @@
1
+ import { given } from '../../../given.js';
2
+ import { a_polling_query_connection } from '../given/a_polling_query_connection.js';
3
+ describe('when polling and data changes', given(a_polling_query_connection, context => {
4
+ beforeEach(async () => {
5
+ context.fetchStub.onFirstCall().resolves(new Response(JSON.stringify(context.envelope('first'))));
6
+ context.connection.connect(context.dataReceived, { filter: 'a', page: 1, pageSize: 10 });
7
+ await context.clock.tickAsync(0);
8
+ await context.clock.tickAsync(1000);
9
+ });
10
+ it('should get the query route with the HTTP arguments immediately', () => {
11
+ String(context.fetchStub.firstCall.args[0]).should.equal('https://example.com/api/items/42?filter=a&page=1&pageSize=10&waitForFirstResult=true');
12
+ context.fetchStub.firstCall.args[1].method.should.equal('GET');
13
+ });
14
+ it('should include custom and query headers', () => {
15
+ Object.fromEntries(context.fetchStub.firstCall.args[1].headers).should.deep.equal({
16
+ authorization: 'Bearer x', accept: 'application/json', 'content-type': 'application/json', 'x-cratis-microservice': 'svc'
17
+ });
18
+ });
19
+ it('should deliver changed data and paging metadata', () => {
20
+ context.dataReceived.callCount.should.equal(2);
21
+ context.dataReceived.secondCall.args[0].data.should.equal('same');
22
+ context.dataReceived.secondCall.args[0].paging.totalItems.should.equal(25);
23
+ });
24
+ it('should measure request latency', () => {
25
+ context.connection.lastPingLatency.should.be.at.least(0);
26
+ context.connection.averageLatency.should.be.at.least(0);
27
+ });
28
+ }));
29
+ for (const changes of [
30
+ { paging: { page: 2, size: 10, totalItems: 30, totalPages: 3 } },
31
+ { isSuccess: false }, { isAuthorized: false }, { isValid: false }, { hasExceptions: true },
32
+ { validationResults: [{ message: 'invalid' }] }, { exceptionMessages: ['failed'] }, { exceptionStackTrace: 'trace' }
33
+ ]) {
34
+ describe(`when polling and envelope metadata changes: ${Object.keys(changes)[0]}`, given(a_polling_query_connection, context => {
35
+ beforeEach(async () => {
36
+ context.responses = [
37
+ new Response(JSON.stringify(context.envelope('same'))),
38
+ new Response(JSON.stringify(context.envelope('same', changes)))
39
+ ];
40
+ context.connection.connect(context.dataReceived);
41
+ await context.clock.tickAsync(0);
42
+ await context.clock.tickAsync(1000);
43
+ });
44
+ it('should emit changed metadata even when the data is unchanged', () => context.dataReceived.callCount.should.equal(2));
45
+ }));
46
+ }
47
+ //# sourceMappingURL=and_data_changes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"and_data_changes.js","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_polling/and_data_changes.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,QAAQ,CAAC,+BAA+B,EAAE,KAAK,CAAC,0BAA0B,EAAE,OAAO,CAAC,EAAE;IAClF,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QAClG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;QACzF,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,gEAAgE,EAAE,GAAG,EAAE;QACtE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,sFAAsF,CAAC,CAAC;QACjJ,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAA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R,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=and_data_is_unchanged.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"and_data_is_unchanged.d.ts","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_polling/and_data_is_unchanged.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ import { given } from '../../../given.js';
2
+ import { a_polling_query_connection } from '../given/a_polling_query_connection.js';
3
+ describe('when polling and only the correlation id changes', given(a_polling_query_connection, context => {
4
+ beforeEach(async () => {
5
+ const first = context.envelope({ name: 'same', value: 1 });
6
+ const second = { ...context.envelope({ value: 1, name: 'same' }) };
7
+ context.responses = [new Response(JSON.stringify(first)), new Response(JSON.stringify(second))];
8
+ context.dataReceived.callsFake(result => {
9
+ result.isReady = true;
10
+ result.paging.totalItems = 999;
11
+ });
12
+ context.connection.connect(context.dataReceived);
13
+ await context.clock.tickAsync(0);
14
+ await context.clock.tickAsync(1000);
15
+ });
16
+ it('should ignore property order, correlation id and consumer mutation when comparing', () => {
17
+ context.fetchStub.callCount.should.equal(2);
18
+ context.dataReceived.callCount.should.equal(1);
19
+ });
20
+ }));
21
+ //# sourceMappingURL=and_data_is_unchanged.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"and_data_is_unchanged.js","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_polling/and_data_is_unchanged.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,QAAQ,CAAC,kDAAkD,EAAE,KAAK,CAAC,0BAA0B,EAAE,OAAO,CAAC,EAAE;IACrG,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;QAC3D,MAAM,MAAM,GAAG,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QACnE,OAAO,CAAC,SAAS,GAAG,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAChG,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE;YACpC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;YACtB,MAAM,CAAC,MAAM,CAAC,UAAU,GAAG,GAAG,CAAC;QACnC,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,mFAAmF,EAAE,GAAG,EAAE;QACzF,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC5C,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=with_global_and_instance_headers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with_global_and_instance_headers.d.ts","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_polling/with_global_and_instance_headers.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ import { given } from '../../../given.js';
2
+ import { Globals } from '../../../Globals.js';
3
+ import { a_polling_query_connection } from '../given/a_polling_query_connection.js';
4
+ describe('when polling with global and instance headers', given(a_polling_query_connection, context => {
5
+ let originalHeadersCallback;
6
+ beforeEach(async () => {
7
+ originalHeadersCallback = Globals.httpHeadersCallback;
8
+ Globals.httpHeadersCallback = () => ({ 'X-Global': 'global', Authorization: 'Bearer global' });
9
+ context.connection.connect(context.dataReceived);
10
+ await context.clock.tickAsync(0);
11
+ await context.clock.tickAsync(1000);
12
+ });
13
+ afterEach(() => {
14
+ Globals.httpHeadersCallback = originalHeadersCallback;
15
+ });
16
+ it('should include global headers on every poll', () => {
17
+ context.fetchStub.firstCall.args[1].headers.get('X-Global').should.equal('global');
18
+ context.fetchStub.secondCall.args[1].headers.get('X-Global').should.equal('global');
19
+ });
20
+ it('should let instance headers override the same global header', () => {
21
+ context.fetchStub.firstCall.args[1].headers.get('Authorization').should.equal('Bearer x');
22
+ context.fetchStub.secondCall.args[1].headers.get('Authorization').should.equal('Bearer x');
23
+ });
24
+ }));
25
+ //# sourceMappingURL=with_global_and_instance_headers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with_global_and_instance_headers.js","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_polling/with_global_and_instance_headers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,QAAQ,CAAC,+CAA+C,EAAE,KAAK,CAAC,0BAA0B,EAAE,OAAO,CAAC,EAAE;IAClG,IAAI,uBAA2D,CAAC;IAChE,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,uBAAuB,GAAG,OAAO,CAAC,mBAAmB,CAAC;QACtD,OAAO,CAAC,mBAAmB,GAAG,GAAG,EAAE,CAAC,CAAC,EAAE,UAAU,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_maximum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"above_the_maximum.d.ts","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_receiving_a_poll_hint/above_the_maximum.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { given } from '../../../given.js';
2
+ import { a_polling_query_connection } from '../given/a_polling_query_connection.js';
3
+ describe('when receiving a poll hint above the maximum', given(a_polling_query_connection, context => {
4
+ let beforeNextPoll;
5
+ beforeEach(async () => {
6
+ context.respond(200, { 'Cratis-Query-Poll-After': '60' });
7
+ context.connection.connect(context.dataReceived);
8
+ await context.clock.tickAsync(0);
9
+ await context.clock.tickAsync(7999);
10
+ beforeNextPoll = context.fetchStub.callCount;
11
+ await context.clock.tickAsync(1);
12
+ });
13
+ it('should wait until the maximum', () => beforeNextPoll.should.equal(1));
14
+ it('should poll at the maximum', () => context.fetchStub.callCount.should.equal(2));
15
+ }));
16
+ //# sourceMappingURL=above_the_maximum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"above_the_maximum.js","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_receiving_a_poll_hint/above_the_maximum.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,QAAQ,CAAC,8CAA8C,EAAE,KAAK,CAAC,0BAA0B,EAAE,OAAO,CAAC,EAAE;IACjG,IAAI,cAAsB,CAAC;IAC3B,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,yBAAyB,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1D,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpC,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC;QAC7C,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACxF,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=below_the_minimum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"below_the_minimum.d.ts","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_receiving_a_poll_hint/below_the_minimum.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import { given } from '../../../given.js';
2
+ import { a_polling_query_connection } from '../given/a_polling_query_connection.js';
3
+ for (const hint of ['0', '0.1']) {
4
+ describe(`when receiving a poll hint below the minimum: ${hint}`, given(a_polling_query_connection, context => {
5
+ let beforeNextPoll;
6
+ beforeEach(async () => {
7
+ context.respond(200, { 'Cratis-Query-Poll-After': hint });
8
+ context.connection.connect(context.dataReceived);
9
+ await context.clock.tickAsync(0);
10
+ await context.clock.tickAsync(499);
11
+ beforeNextPoll = context.fetchStub.callCount;
12
+ await context.clock.tickAsync(1);
13
+ });
14
+ it('should not poll before the minimum', () => beforeNextPoll.should.equal(1));
15
+ it('should poll at the minimum', () => context.fetchStub.callCount.should.equal(2));
16
+ }));
17
+ }
18
+ //# sourceMappingURL=below_the_minimum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"below_the_minimum.js","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_receiving_a_poll_hint/below_the_minimum.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC;IAC9B,QAAQ,CAAC,iDAAiD,IAAI,EAAE,EAAE,KAAK,CAAC,0BAA0B,EAAE,OAAO,CAAC,EAAE;QAC1G,IAAI,cAAsB,CAAC;QAC3B,UAAU,CAAC,KAAK,IAAI,EAAE;YAClB,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,yBAAyB,EAAE,IAAI,EAAE,CAAC,CAAC;YAC1D,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YACjD,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YACjC,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YACnC,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC;YAC7C,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/E,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACxF,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=on_a_not_ready_response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"on_a_not_ready_response.d.ts","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_receiving_a_poll_hint/on_a_not_ready_response.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { given } from '../../../given.js';
2
+ import { a_polling_query_connection } from '../given/a_polling_query_connection.js';
3
+ describe('when receiving a poll hint on a not ready response', given(a_polling_query_connection, context => {
4
+ let beforeNextPoll;
5
+ beforeEach(async () => {
6
+ context.respond(202, { 'Cratis-Query-Poll-After': '3' });
7
+ context.connection.connect(context.dataReceived);
8
+ await context.clock.tickAsync(0);
9
+ await context.clock.tickAsync(2999);
10
+ beforeNextPoll = context.fetchStub.callCount;
11
+ await context.clock.tickAsync(1);
12
+ });
13
+ it('should prefer the hint over backoff', () => beforeNextPoll.should.equal(1));
14
+ it('should poll at the hinted interval', () => context.fetchStub.callCount.should.equal(2));
15
+ }));
16
+ //# sourceMappingURL=on_a_not_ready_response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"on_a_not_ready_response.js","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_receiving_a_poll_hint/on_a_not_ready_response.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,QAAQ,CAAC,oDAAoD,EAAE,KAAK,CAAC,0BAA0B,EAAE,OAAO,CAAC,EAAE;IACvG,IAAI,cAAsB,CAAC;IAC3B,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,yBAAyB,EAAE,GAAG,EAAE,CAAC,CAAC;QACzD,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpC,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC;QAC7C,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAChF,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAChG,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=that_is_invalid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"that_is_invalid.d.ts","sourceRoot":"","sources":["../../../../../queries/for_PollingQueryConnection/when_receiving_a_poll_hint/that_is_invalid.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import { given } from '../../../given.js';
2
+ import { a_polling_query_connection } from '../given/a_polling_query_connection.js';
3
+ for (const hint of ['abc', '-1', 'Infinity', '5abc', '', ' ']) {
4
+ describe(`when receiving a poll hint that is invalid: ${hint}`, given(a_polling_query_connection, context => {
5
+ let beforeNextPoll;
6
+ beforeEach(async () => {
7
+ context.respond(200, { 'Cratis-Query-Poll-After': hint });
8
+ context.connection.connect(context.dataReceived);
9
+ await context.clock.tickAsync(0);
10
+ await context.clock.tickAsync(999);
11
+ beforeNextPoll = context.fetchStub.callCount;
12
+ await context.clock.tickAsync(1);
13
+ });
14
+ it('should wait until the configured interval', () => beforeNextPoll.should.equal(1));
15
+ it('should poll at the configured interval', () => context.fetchStub.callCount.should.equal(2));
16
+ }));
17
+ }
18
+ //# sourceMappingURL=that_is_invalid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"that_is_invalid.js","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