@cratis/arc 19.12.0 → 20.1.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.
- package/Globals.ts +20 -1
- package/dist/cjs/Globals.d.ts +4 -0
- package/dist/cjs/Globals.d.ts.map +1 -1
- package/dist/cjs/Globals.js +6 -1
- package/dist/cjs/Globals.js.map +1 -1
- package/dist/cjs/queries/HubConnectionKeepAlive.d.ts +11 -0
- package/dist/cjs/queries/HubConnectionKeepAlive.d.ts.map +1 -0
- package/dist/cjs/queries/HubConnectionKeepAlive.js +33 -0
- package/dist/cjs/queries/HubConnectionKeepAlive.js.map +1 -0
- package/dist/cjs/queries/IObservableQueryHubConnection.d.ts +11 -0
- package/dist/cjs/queries/IObservableQueryHubConnection.d.ts.map +1 -0
- package/dist/cjs/queries/IReconnectPolicy.d.ts +8 -0
- package/dist/cjs/queries/IReconnectPolicy.d.ts.map +1 -0
- package/dist/cjs/queries/ObservableQueryConnection.d.ts +3 -1
- package/dist/cjs/queries/ObservableQueryConnection.d.ts.map +1 -1
- package/dist/cjs/queries/ObservableQueryConnection.js +8 -21
- package/dist/cjs/queries/ObservableQueryConnection.js.map +1 -1
- package/dist/cjs/queries/ObservableQueryConnectionFactory.d.ts +13 -0
- package/dist/cjs/queries/ObservableQueryConnectionFactory.d.ts.map +1 -0
- package/dist/cjs/queries/ObservableQueryConnectionFactory.js +62 -0
- package/dist/cjs/queries/ObservableQueryConnectionFactory.js.map +1 -0
- package/dist/cjs/queries/ObservableQueryConnectionPool.d.ts +9 -0
- package/dist/cjs/queries/ObservableQueryConnectionPool.d.ts.map +1 -0
- package/dist/cjs/queries/ObservableQueryConnectionPool.js +23 -0
- package/dist/cjs/queries/ObservableQueryConnectionPool.js.map +1 -0
- package/dist/cjs/queries/ObservableQueryFor.d.ts +1 -0
- package/dist/cjs/queries/ObservableQueryFor.d.ts.map +1 -1
- package/dist/cjs/queries/ObservableQueryFor.js +10 -5
- package/dist/cjs/queries/ObservableQueryFor.js.map +1 -1
- package/dist/cjs/queries/ObservableQueryMultiplexer.d.ts +30 -0
- package/dist/cjs/queries/ObservableQueryMultiplexer.d.ts.map +1 -0
- package/dist/cjs/queries/ObservableQueryMultiplexer.js +120 -0
- package/dist/cjs/queries/ObservableQueryMultiplexer.js.map +1 -0
- package/dist/cjs/queries/QueryInstanceCache.d.ts +29 -0
- package/dist/cjs/queries/QueryInstanceCache.d.ts.map +1 -0
- package/dist/cjs/queries/QueryInstanceCache.js +95 -0
- package/dist/cjs/queries/QueryInstanceCache.js.map +1 -0
- package/dist/cjs/queries/QueryTransportMethod.d.ts +5 -0
- package/dist/cjs/queries/QueryTransportMethod.d.ts.map +1 -0
- package/dist/cjs/queries/QueryTransportMethod.js +8 -0
- package/dist/cjs/queries/QueryTransportMethod.js.map +1 -0
- package/dist/cjs/queries/ReconnectPolicy.d.ts +15 -0
- package/dist/cjs/queries/ReconnectPolicy.d.ts.map +1 -0
- package/dist/cjs/queries/ReconnectPolicy.js +43 -0
- package/dist/cjs/queries/ReconnectPolicy.js.map +1 -0
- package/dist/cjs/queries/ServerSentEventHubConnection.d.ts +39 -0
- package/dist/cjs/queries/ServerSentEventHubConnection.d.ts.map +1 -0
- package/dist/cjs/queries/ServerSentEventHubConnection.js +233 -0
- package/dist/cjs/queries/ServerSentEventHubConnection.js.map +1 -0
- package/dist/cjs/queries/ServerSentEventQueryConnection.d.ts +14 -0
- package/dist/cjs/queries/ServerSentEventQueryConnection.d.ts.map +1 -0
- package/dist/cjs/queries/ServerSentEventQueryConnection.js +59 -0
- package/dist/cjs/queries/ServerSentEventQueryConnection.js.map +1 -0
- package/dist/cjs/queries/WebSocketHubConnection.d.ts +55 -0
- package/dist/cjs/queries/WebSocketHubConnection.d.ts.map +1 -0
- package/dist/cjs/queries/WebSocketHubConnection.js +193 -0
- package/dist/cjs/queries/WebSocketHubConnection.js.map +1 -0
- package/dist/cjs/queries/for_HubConnectionKeepAlive/behavior.d.ts +2 -0
- package/dist/cjs/queries/for_HubConnectionKeepAlive/behavior.d.ts.map +1 -0
- package/dist/cjs/queries/for_ObservableQueryConnection/given/an_observable_query_connection.d.ts +1 -2
- package/dist/cjs/queries/for_ObservableQueryConnection/given/an_observable_query_connection.d.ts.map +1 -1
- package/dist/cjs/queries/for_ObservableQueryConnectionFactory/given/a_descriptor.d.ts +9 -0
- package/dist/cjs/queries/for_ObservableQueryConnectionFactory/given/a_descriptor.d.ts.map +1 -0
- package/dist/cjs/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_sse_transport.d.ts +2 -0
- package/dist/cjs/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_sse_transport.d.ts.map +1 -0
- package/dist/cjs/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_websocket_transport.d.ts +2 -0
- package/dist/cjs/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_websocket_transport.d.ts.map +1 -0
- package/dist/cjs/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_sse_transport.d.ts +2 -0
- package/dist/cjs/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_sse_transport.d.ts.map +1 -0
- package/dist/cjs/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_websocket_transport.d.ts +2 -0
- package/dist/cjs/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_websocket_transport.d.ts.map +1 -0
- package/dist/cjs/queries/for_ObservableQueryConnectionPool/when_acquiring/with_multiple_slots/and_least_loaded_slot_is_chosen.d.ts +2 -0
- package/dist/cjs/queries/for_ObservableQueryConnectionPool/when_acquiring/with_multiple_slots/and_least_loaded_slot_is_chosen.d.ts.map +1 -0
- package/dist/cjs/queries/for_ObservableQueryConnectionPool/when_acquiring/with_multiple_slots/and_size_is_zero.d.ts +2 -0
- package/dist/cjs/queries/for_ObservableQueryConnectionPool/when_acquiring/with_multiple_slots/and_size_is_zero.d.ts.map +1 -0
- package/dist/cjs/queries/for_ObservableQueryConnectionPool/when_acquiring/with_single_slot/and_one_subscriber.d.ts +2 -0
- package/dist/cjs/queries/for_ObservableQueryConnectionPool/when_acquiring/with_single_slot/and_one_subscriber.d.ts.map +1 -0
- package/dist/cjs/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_and_sse_transport.d.ts +2 -0
- package/dist/cjs/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_and_sse_transport.d.ts.map +1 -0
- package/dist/cjs/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_disabled_and_sse_transport.d.ts +2 -0
- package/dist/cjs/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_disabled_and_sse_transport.d.ts.map +1 -0
- package/dist/cjs/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_enabled.d.ts +2 -0
- package/dist/cjs/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_enabled.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_building_key/with_arguments.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_building_key/with_arguments.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_building_key/with_empty_arguments_object.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_building_key/with_empty_arguments_object.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_building_key/with_same_arguments_different_order.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_building_key/with_same_arguments_different_order.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_building_key/without_arguments.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_building_key/without_arguments.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_getting_last_result/with_no_result_stored.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_getting_last_result/with_no_result_stored.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_getting_last_result/with_stored_result.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_getting_last_result/with_stored_result.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_getting_or_creating/with_existing_entry.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_getting_or_creating/with_existing_entry.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_getting_or_creating/with_new_entry.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_getting_or_creating/with_new_entry.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_releasing/a_key_that_does_not_exist.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_releasing/a_key_that_does_not_exist.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_releasing/one_of_two_subscribers.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_releasing/one_of_two_subscribers.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_setting_last_result/with_a_result.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_setting_last_result/with_a_result.d.ts.map +1 -0
- package/dist/cjs/queries/for_ReconnectPolicy/when_canceling/with_pending_timer.d.ts +2 -0
- package/dist/cjs/queries/for_ReconnectPolicy/when_canceling/with_pending_timer.d.ts.map +1 -0
- package/dist/cjs/queries/for_ReconnectPolicy/when_cancelling/with_pending_timer.d.ts +2 -0
- package/dist/cjs/queries/for_ReconnectPolicy/when_cancelling/with_pending_timer.d.ts.map +1 -0
- package/dist/cjs/queries/for_ReconnectPolicy/when_resetting/after_scheduling.d.ts +2 -0
- package/dist/cjs/queries/for_ReconnectPolicy/when_resetting/after_scheduling.d.ts.map +1 -0
- package/dist/cjs/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_not_reached/delay_is_capped_at_max.d.ts +2 -0
- package/dist/cjs/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_not_reached/delay_is_capped_at_max.d.ts.map +1 -0
- package/dist/cjs/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_not_reached/first_attempt.d.ts +2 -0
- package/dist/cjs/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_not_reached/first_attempt.d.ts.map +1 -0
- package/dist/cjs/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_reached/abandons_reconnect.d.ts +2 -0
- package/dist/cjs/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_reached/abandons_reconnect.d.ts.map +1 -0
- package/dist/cjs/queries/for_ServerSentEventHubConnection/given/a_server_sent_event_hub_connection.d.ts +21 -0
- package/dist/cjs/queries/for_ServerSentEventHubConnection/given/a_server_sent_event_hub_connection.d.ts.map +1 -0
- package/dist/cjs/queries/for_ServerSentEventHubConnection/when_connect_timeout_fires/triggers_reconnect.d.ts +2 -0
- package/dist/cjs/queries/for_ServerSentEventHubConnection/when_connect_timeout_fires/triggers_reconnect.d.ts.map +1 -0
- package/dist/cjs/queries/for_ServerSentEventHubConnection/when_disposing/cleans_up_resources.d.ts +2 -0
- package/dist/cjs/queries/for_ServerSentEventHubConnection/when_disposing/cleans_up_resources.d.ts.map +1 -0
- package/dist/cjs/queries/for_ServerSentEventHubConnection/when_keep_alive_is_idle/triggers_reconnect.d.ts +2 -0
- package/dist/cjs/queries/for_ServerSentEventHubConnection/when_keep_alive_is_idle/triggers_reconnect.d.ts.map +1 -0
- package/dist/cjs/queries/for_ServerSentEventHubConnection/when_reconnecting/after_error.d.ts +2 -0
- package/dist/cjs/queries/for_ServerSentEventHubConnection/when_reconnecting/after_error.d.ts.map +1 -0
- package/dist/cjs/queries/for_ServerSentEventHubConnection/when_subscribing/queues_until_connected.d.ts +2 -0
- package/dist/cjs/queries/for_ServerSentEventHubConnection/when_subscribing/queues_until_connected.d.ts.map +1 -0
- package/dist/cjs/queries/for_ServerSentEventHubConnection/when_subscribing/sends_subscribe_post.d.ts +2 -0
- package/dist/cjs/queries/for_ServerSentEventHubConnection/when_subscribing/sends_subscribe_post.d.ts.map +1 -0
- package/dist/cjs/queries/for_ServerSentEventHubConnection/when_unsubscribing/the_only_query.d.ts +2 -0
- package/dist/cjs/queries/for_ServerSentEventHubConnection/when_unsubscribing/the_only_query.d.ts.map +1 -0
- package/dist/cjs/queries/for_ServerSentEventQueryConnection/when_connecting/with_query_arguments.d.ts +2 -0
- package/dist/cjs/queries/for_ServerSentEventQueryConnection/when_connecting/with_query_arguments.d.ts.map +1 -0
- package/dist/cjs/queries/for_ServerSentEventQueryConnection/when_connecting/without_event_source_available.d.ts +2 -0
- package/dist/cjs/queries/for_ServerSentEventQueryConnection/when_connecting/without_event_source_available.d.ts.map +1 -0
- package/dist/cjs/queries/for_ServerSentEventQueryConnection/when_disconnecting/after_connecting.d.ts +2 -0
- package/dist/cjs/queries/for_ServerSentEventQueryConnection/when_disconnecting/after_connecting.d.ts.map +1 -0
- package/dist/cjs/queries/for_ServerSentEventQueryConnection/when_disconnecting/before_message_arrives.d.ts +2 -0
- package/dist/cjs/queries/for_ServerSentEventQueryConnection/when_disconnecting/before_message_arrives.d.ts.map +1 -0
- package/dist/cjs/queries/for_WebSocketHubConnection/given/a_web_socket_hub_connection.d.ts +23 -0
- package/dist/cjs/queries/for_WebSocketHubConnection/given/a_web_socket_hub_connection.d.ts.map +1 -0
- package/dist/cjs/queries/for_WebSocketHubConnection/when_disposing/cleans_up_resources.d.ts +2 -0
- package/dist/cjs/queries/for_WebSocketHubConnection/when_disposing/cleans_up_resources.d.ts.map +1 -0
- package/dist/cjs/queries/for_WebSocketHubConnection/when_keep_alive_is_idle/sends_a_ping.d.ts +2 -0
- package/dist/cjs/queries/for_WebSocketHubConnection/when_keep_alive_is_idle/sends_a_ping.d.ts.map +1 -0
- package/dist/cjs/queries/for_WebSocketHubConnection/when_receiving_a_message/resets_keep_alive_timer.d.ts +2 -0
- package/dist/cjs/queries/for_WebSocketHubConnection/when_receiving_a_message/resets_keep_alive_timer.d.ts.map +1 -0
- package/dist/cjs/queries/for_WebSocketHubConnection/when_reconnecting/after_unexpected_close.d.ts +2 -0
- package/dist/cjs/queries/for_WebSocketHubConnection/when_reconnecting/after_unexpected_close.d.ts.map +1 -0
- package/dist/cjs/queries/for_WebSocketHubConnection/when_reconnecting/resubscribes_all_queries.d.ts +2 -0
- package/dist/cjs/queries/for_WebSocketHubConnection/when_reconnecting/resubscribes_all_queries.d.ts.map +1 -0
- package/dist/cjs/queries/for_WebSocketHubConnection/when_subscribing/to_a_query.d.ts +2 -0
- package/dist/cjs/queries/for_WebSocketHubConnection/when_subscribing/to_a_query.d.ts.map +1 -0
- package/dist/cjs/queries/for_WebSocketHubConnection/when_unsubscribing/the_only_query.d.ts +2 -0
- package/dist/cjs/queries/for_WebSocketHubConnection/when_unsubscribing/the_only_query.d.ts.map +1 -0
- package/dist/cjs/queries/index.d.ts +12 -0
- package/dist/cjs/queries/index.d.ts.map +1 -1
- package/dist/cjs/queries/index.js +34 -0
- package/dist/cjs/queries/index.js.map +1 -1
- package/dist/esm/Globals.d.ts +4 -0
- package/dist/esm/Globals.d.ts.map +1 -1
- package/dist/esm/Globals.js +6 -1
- package/dist/esm/Globals.js.map +1 -1
- package/dist/esm/queries/HubConnectionKeepAlive.d.ts +11 -0
- package/dist/esm/queries/HubConnectionKeepAlive.d.ts.map +1 -0
- package/dist/esm/queries/HubConnectionKeepAlive.js +31 -0
- package/dist/esm/queries/HubConnectionKeepAlive.js.map +1 -0
- package/dist/esm/queries/IObservableQueryHubConnection.d.ts +11 -0
- package/dist/esm/queries/IObservableQueryHubConnection.d.ts.map +1 -0
- package/dist/esm/queries/IObservableQueryHubConnection.js +2 -0
- package/dist/esm/queries/IObservableQueryHubConnection.js.map +1 -0
- package/dist/esm/queries/IReconnectPolicy.d.ts +8 -0
- package/dist/esm/queries/IReconnectPolicy.d.ts.map +1 -0
- package/dist/esm/queries/IReconnectPolicy.js +2 -0
- package/dist/esm/queries/IReconnectPolicy.js.map +1 -0
- package/dist/esm/queries/ObservableQueryConnection.d.ts +3 -1
- package/dist/esm/queries/ObservableQueryConnection.d.ts.map +1 -1
- package/dist/esm/queries/ObservableQueryConnection.js +8 -21
- package/dist/esm/queries/ObservableQueryConnection.js.map +1 -1
- package/dist/esm/queries/ObservableQueryConnectionFactory.d.ts +13 -0
- package/dist/esm/queries/ObservableQueryConnectionFactory.d.ts.map +1 -0
- package/dist/esm/queries/ObservableQueryConnectionFactory.js +58 -0
- package/dist/esm/queries/ObservableQueryConnectionFactory.js.map +1 -0
- package/dist/esm/queries/ObservableQueryConnectionPool.d.ts +9 -0
- package/dist/esm/queries/ObservableQueryConnectionPool.d.ts.map +1 -0
- package/dist/esm/queries/ObservableQueryConnectionPool.js +21 -0
- package/dist/esm/queries/ObservableQueryConnectionPool.js.map +1 -0
- package/dist/esm/queries/ObservableQueryFor.d.ts +1 -0
- package/dist/esm/queries/ObservableQueryFor.d.ts.map +1 -1
- package/dist/esm/queries/ObservableQueryFor.js +10 -5
- package/dist/esm/queries/ObservableQueryFor.js.map +1 -1
- package/dist/esm/queries/ObservableQueryMultiplexer.d.ts +30 -0
- package/dist/esm/queries/ObservableQueryMultiplexer.d.ts.map +1 -0
- package/dist/esm/queries/ObservableQueryMultiplexer.js +114 -0
- package/dist/esm/queries/ObservableQueryMultiplexer.js.map +1 -0
- package/dist/esm/queries/QueryInstanceCache.d.ts +29 -0
- package/dist/esm/queries/QueryInstanceCache.d.ts.map +1 -0
- package/dist/esm/queries/QueryInstanceCache.js +93 -0
- package/dist/esm/queries/QueryInstanceCache.js.map +1 -0
- package/dist/esm/queries/QueryTransportMethod.d.ts +5 -0
- package/dist/esm/queries/QueryTransportMethod.d.ts.map +1 -0
- package/dist/esm/queries/QueryTransportMethod.js +8 -0
- package/dist/esm/queries/QueryTransportMethod.js.map +1 -0
- package/dist/esm/queries/ReconnectPolicy.d.ts +15 -0
- package/dist/esm/queries/ReconnectPolicy.d.ts.map +1 -0
- package/dist/esm/queries/ReconnectPolicy.js +41 -0
- package/dist/esm/queries/ReconnectPolicy.js.map +1 -0
- package/dist/esm/queries/ServerSentEventHubConnection.d.ts +39 -0
- package/dist/esm/queries/ServerSentEventHubConnection.d.ts.map +1 -0
- package/dist/esm/queries/ServerSentEventHubConnection.js +231 -0
- package/dist/esm/queries/ServerSentEventHubConnection.js.map +1 -0
- package/dist/esm/queries/ServerSentEventQueryConnection.d.ts +14 -0
- package/dist/esm/queries/ServerSentEventQueryConnection.d.ts.map +1 -0
- package/dist/esm/queries/ServerSentEventQueryConnection.js +56 -0
- package/dist/esm/queries/ServerSentEventQueryConnection.js.map +1 -0
- package/dist/esm/queries/WebSocketHubConnection.d.ts +55 -0
- package/dist/esm/queries/WebSocketHubConnection.d.ts.map +1 -0
- package/dist/esm/queries/WebSocketHubConnection.js +191 -0
- package/dist/esm/queries/WebSocketHubConnection.js.map +1 -0
- package/dist/esm/queries/for_HubConnectionKeepAlive/behavior.d.ts +2 -0
- package/dist/esm/queries/for_HubConnectionKeepAlive/behavior.d.ts.map +1 -0
- package/dist/esm/queries/for_HubConnectionKeepAlive/behavior.js +57 -0
- package/dist/esm/queries/for_HubConnectionKeepAlive/behavior.js.map +1 -0
- package/dist/esm/queries/for_ObservableQueryConnection/given/an_observable_query_connection.d.ts +1 -2
- package/dist/esm/queries/for_ObservableQueryConnection/given/an_observable_query_connection.d.ts.map +1 -1
- package/dist/esm/queries/for_ObservableQueryConnection/given/an_observable_query_connection.js +9 -5
- package/dist/esm/queries/for_ObservableQueryConnection/given/an_observable_query_connection.js.map +1 -1
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/given/a_descriptor.d.ts +9 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/given/a_descriptor.d.ts.map +1 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/given/a_descriptor.js +19 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/given/a_descriptor.js.map +1 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_sse_transport.d.ts +2 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_sse_transport.d.ts.map +1 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_sse_transport.js +49 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_sse_transport.js.map +1 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_websocket_transport.d.ts +2 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_websocket_transport.d.ts.map +1 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_websocket_transport.js +47 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_websocket_transport.js.map +1 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_sse_transport.d.ts +2 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_sse_transport.d.ts.map +1 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_sse_transport.js +54 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_sse_transport.js.map +1 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_websocket_transport.d.ts +2 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_websocket_transport.d.ts.map +1 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_websocket_transport.js +49 -0
- package/dist/esm/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_websocket_transport.js.map +1 -0
- package/dist/esm/queries/for_ObservableQueryConnectionPool/when_acquiring/with_multiple_slots/and_least_loaded_slot_is_chosen.d.ts +2 -0
- package/dist/esm/queries/for_ObservableQueryConnectionPool/when_acquiring/with_multiple_slots/and_least_loaded_slot_is_chosen.d.ts.map +1 -0
- package/dist/esm/queries/for_ObservableQueryConnectionPool/when_acquiring/with_multiple_slots/and_least_loaded_slot_is_chosen.js +34 -0
- package/dist/esm/queries/for_ObservableQueryConnectionPool/when_acquiring/with_multiple_slots/and_least_loaded_slot_is_chosen.js.map +1 -0
- package/dist/esm/queries/for_ObservableQueryConnectionPool/when_acquiring/with_multiple_slots/and_size_is_zero.d.ts +2 -0
- package/dist/esm/queries/for_ObservableQueryConnectionPool/when_acquiring/with_multiple_slots/and_size_is_zero.d.ts.map +1 -0
- package/dist/esm/queries/for_ObservableQueryConnectionPool/when_acquiring/with_multiple_slots/and_size_is_zero.js +18 -0
- package/dist/esm/queries/for_ObservableQueryConnectionPool/when_acquiring/with_multiple_slots/and_size_is_zero.js.map +1 -0
- package/dist/esm/queries/for_ObservableQueryConnectionPool/when_acquiring/with_single_slot/and_one_subscriber.d.ts +2 -0
- package/dist/esm/queries/for_ObservableQueryConnectionPool/when_acquiring/with_single_slot/and_one_subscriber.d.ts.map +1 -0
- package/dist/esm/queries/for_ObservableQueryConnectionPool/when_acquiring/with_single_slot/and_one_subscriber.js +32 -0
- package/dist/esm/queries/for_ObservableQueryConnectionPool/when_acquiring/with_single_slot/and_one_subscriber.js.map +1 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_and_sse_transport.d.ts +2 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_and_sse_transport.d.ts.map +1 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_and_sse_transport.js +54 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_and_sse_transport.js.map +1 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_disabled_and_sse_transport.d.ts +2 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_disabled_and_sse_transport.d.ts.map +1 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_disabled_and_sse_transport.js +55 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_disabled_and_sse_transport.js.map +1 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_enabled.d.ts +2 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_enabled.d.ts.map +1 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_enabled.js +45 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_enabled.js.map +1 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_partially_missing_required_arguments.js +18 -11
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_partially_missing_required_arguments.js.map +1 -1
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_route_and_query_args.js +12 -5
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_route_and_query_args.js.map +1 -1
- package/dist/esm/queries/for_QueryInstanceCache/when_building_key/with_arguments.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_building_key/with_arguments.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_building_key/with_arguments.js +12 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_building_key/with_arguments.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_building_key/with_empty_arguments_object.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_building_key/with_empty_arguments_object.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_building_key/with_empty_arguments_object.js +11 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_building_key/with_empty_arguments_object.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_building_key/with_same_arguments_different_order.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_building_key/with_same_arguments_different_order.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_building_key/with_same_arguments_different_order.js +13 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_building_key/with_same_arguments_different_order.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_building_key/without_arguments.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_building_key/without_arguments.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_building_key/without_arguments.js +11 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_building_key/without_arguments.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_getting_last_result/with_no_result_stored.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_getting_last_result/with_no_result_stored.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_getting_last_result/with_no_result_stored.js +12 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_getting_last_result/with_no_result_stored.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_getting_last_result/with_stored_result.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_getting_last_result/with_stored_result.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_getting_last_result/with_stored_result.js +16 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_getting_last_result/with_stored_result.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_getting_or_creating/with_existing_entry.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_getting_or_creating/with_existing_entry.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_getting_or_creating/with_existing_entry.js +23 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_getting_or_creating/with_existing_entry.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_getting_or_creating/with_new_entry.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_getting_or_creating/with_new_entry.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_getting_or_creating/with_new_entry.js +16 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_getting_or_creating/with_new_entry.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/a_key_that_does_not_exist.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/a_key_that_does_not_exist.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/a_key_that_does_not_exist.js +17 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/a_key_that_does_not_exist.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/one_of_two_subscribers.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/one_of_two_subscribers.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/one_of_two_subscribers.js +13 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/one_of_two_subscribers.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber.js +17 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_setting_last_result/with_a_result.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_setting_last_result/with_a_result.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_setting_last_result/with_a_result.js +15 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_setting_last_result/with_a_result.js.map +1 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_canceling/with_pending_timer.d.ts +2 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_canceling/with_pending_timer.d.ts.map +1 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_canceling/with_pending_timer.js +24 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_canceling/with_pending_timer.js.map +1 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_cancelling/with_pending_timer.d.ts +2 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_cancelling/with_pending_timer.d.ts.map +1 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_cancelling/with_pending_timer.js +24 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_cancelling/with_pending_timer.js.map +1 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_resetting/after_scheduling.d.ts +2 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_resetting/after_scheduling.d.ts.map +1 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_resetting/after_scheduling.js +29 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_resetting/after_scheduling.js.map +1 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_not_reached/delay_is_capped_at_max.d.ts +2 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_not_reached/delay_is_capped_at_max.d.ts.map +1 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_not_reached/delay_is_capped_at_max.js +33 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_not_reached/delay_is_capped_at_max.js.map +1 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_not_reached/first_attempt.d.ts +2 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_not_reached/first_attempt.d.ts.map +1 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_not_reached/first_attempt.js +28 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_not_reached/first_attempt.js.map +1 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_reached/abandons_reconnect.d.ts +2 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_reached/abandons_reconnect.d.ts.map +1 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_reached/abandons_reconnect.js +29 -0
- package/dist/esm/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_reached/abandons_reconnect.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/given/a_server_sent_event_hub_connection.d.ts +21 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/given/a_server_sent_event_hub_connection.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/given/a_server_sent_event_hub_connection.js +50 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/given/a_server_sent_event_hub_connection.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connect_timeout_fires/triggers_reconnect.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connect_timeout_fires/triggers_reconnect.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connect_timeout_fires/triggers_reconnect.js +24 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connect_timeout_fires/triggers_reconnect.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_disposing/cleans_up_resources.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_disposing/cleans_up_resources.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_disposing/cleans_up_resources.js +27 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_disposing/cleans_up_resources.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_keep_alive_is_idle/triggers_reconnect.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_keep_alive_is_idle/triggers_reconnect.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_keep_alive_is_idle/triggers_reconnect.js +26 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_keep_alive_is_idle/triggers_reconnect.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_reconnecting/after_error.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_reconnecting/after_error.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_reconnecting/after_error.js +46 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_reconnecting/after_error.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_subscribing/queues_until_connected.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_subscribing/queues_until_connected.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_subscribing/queues_until_connected.js +21 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_subscribing/queues_until_connected.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_subscribing/sends_subscribe_post.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_subscribing/sends_subscribe_post.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_subscribing/sends_subscribe_post.js +32 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_subscribing/sends_subscribe_post.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_unsubscribing/the_only_query.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_unsubscribing/the_only_query.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_unsubscribing/the_only_query.js +21 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_unsubscribing/the_only_query.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventQueryConnection/when_connecting/with_query_arguments.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventQueryConnection/when_connecting/with_query_arguments.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventQueryConnection/when_connecting/with_query_arguments.js +38 -0
- package/dist/esm/queries/for_ServerSentEventQueryConnection/when_connecting/with_query_arguments.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventQueryConnection/when_connecting/without_event_source_available.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventQueryConnection/when_connecting/without_event_source_available.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventQueryConnection/when_connecting/without_event_source_available.js +23 -0
- package/dist/esm/queries/for_ServerSentEventQueryConnection/when_connecting/without_event_source_available.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventQueryConnection/when_disconnecting/after_connecting.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventQueryConnection/when_disconnecting/after_connecting.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventQueryConnection/when_disconnecting/after_connecting.js +24 -0
- package/dist/esm/queries/for_ServerSentEventQueryConnection/when_disconnecting/after_connecting.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventQueryConnection/when_disconnecting/before_message_arrives.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventQueryConnection/when_disconnecting/before_message_arrives.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventQueryConnection/when_disconnecting/before_message_arrives.js +24 -0
- package/dist/esm/queries/for_ServerSentEventQueryConnection/when_disconnecting/before_message_arrives.js.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/given/a_web_socket_hub_connection.d.ts +23 -0
- package/dist/esm/queries/for_WebSocketHubConnection/given/a_web_socket_hub_connection.d.ts.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/given/a_web_socket_hub_connection.js +47 -0
- package/dist/esm/queries/for_WebSocketHubConnection/given/a_web_socket_hub_connection.js.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_disposing/cleans_up_resources.d.ts +2 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_disposing/cleans_up_resources.d.ts.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_disposing/cleans_up_resources.js +24 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_disposing/cleans_up_resources.js.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_keep_alive_is_idle/sends_a_ping.d.ts +2 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_keep_alive_is_idle/sends_a_ping.d.ts.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_keep_alive_is_idle/sends_a_ping.js +29 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_keep_alive_is_idle/sends_a_ping.js.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_receiving_a_message/resets_keep_alive_timer.d.ts +2 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_receiving_a_message/resets_keep_alive_timer.d.ts.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_receiving_a_message/resets_keep_alive_timer.js +31 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_receiving_a_message/resets_keep_alive_timer.js.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_reconnecting/after_unexpected_close.d.ts +2 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_reconnecting/after_unexpected_close.d.ts.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_reconnecting/after_unexpected_close.js +30 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_reconnecting/after_unexpected_close.js.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_reconnecting/resubscribes_all_queries.d.ts +2 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_reconnecting/resubscribes_all_queries.d.ts.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_reconnecting/resubscribes_all_queries.js +31 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_reconnecting/resubscribes_all_queries.js.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_subscribing/to_a_query.d.ts +2 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_subscribing/to_a_query.d.ts.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_subscribing/to_a_query.js +32 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_subscribing/to_a_query.js.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_unsubscribing/the_only_query.d.ts +2 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_unsubscribing/the_only_query.d.ts.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_unsubscribing/the_only_query.js +23 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_unsubscribing/the_only_query.js.map +1 -0
- package/dist/esm/queries/index.d.ts +12 -0
- package/dist/esm/queries/index.d.ts.map +1 -1
- package/dist/esm/queries/index.js +10 -0
- package/dist/esm/queries/index.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/queries/HubConnectionKeepAlive.ts +61 -0
- package/queries/IObservableQueryHubConnection.ts +50 -0
- package/queries/IReconnectPolicy.ts +39 -0
- package/queries/ObservableQueryConnection.ts +8 -24
- package/queries/ObservableQueryConnectionFactory.ts +118 -0
- package/queries/ObservableQueryConnectionPool.ts +64 -0
- package/queries/ObservableQueryFor.ts +11 -5
- package/queries/ObservableQueryMultiplexer.ts +214 -0
- package/queries/QueryInstanceCache.ts +243 -0
- package/queries/QueryTransportMethod.ts +17 -0
- package/queries/ReconnectPolicy.ts +68 -0
- package/queries/ServerSentEventHubConnection.ts +309 -0
- package/queries/ServerSentEventQueryConnection.ts +84 -0
- package/queries/WebSocketHubConnection.ts +291 -0
- package/queries/for_HubConnectionKeepAlive/behavior.ts +73 -0
- package/queries/for_ObservableQueryConnection/given/an_observable_query_connection.ts +13 -9
- package/queries/for_ObservableQueryConnectionFactory/given/a_descriptor.ts +26 -0
- package/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_sse_transport.ts +62 -0
- package/queries/for_ObservableQueryConnectionFactory/when_creating/with_direct_mode_and_websocket_transport.ts +59 -0
- package/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_sse_transport.ts +69 -0
- package/queries/for_ObservableQueryConnectionFactory/when_creating/with_hub_mode_and_websocket_transport.ts +61 -0
- package/queries/for_ObservableQueryConnectionPool/when_acquiring/with_multiple_slots/and_least_loaded_slot_is_chosen.ts +47 -0
- package/queries/for_ObservableQueryConnectionPool/when_acquiring/with_multiple_slots/and_size_is_zero.ts +26 -0
- package/queries/for_ObservableQueryConnectionPool/when_acquiring/with_single_slot/and_one_subscriber.ts +44 -0
- package/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_and_sse_transport.ts +69 -0
- package/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_disabled_and_sse_transport.ts +70 -0
- package/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_enabled.ts +57 -0
- package/queries/for_ObservableQueryFor/when_subscribing/with_partially_missing_required_arguments.ts +19 -11
- package/queries/for_ObservableQueryFor/when_subscribing/with_route_and_query_args.ts +14 -7
- package/queries/for_QueryInstanceCache/when_building_key/with_arguments.ts +17 -0
- package/queries/for_QueryInstanceCache/when_building_key/with_empty_arguments_object.ts +16 -0
- package/queries/for_QueryInstanceCache/when_building_key/with_same_arguments_different_order.ts +18 -0
- package/queries/for_QueryInstanceCache/when_building_key/without_arguments.ts +16 -0
- package/queries/for_QueryInstanceCache/when_getting_last_result/with_no_result_stored.ts +17 -0
- package/queries/for_QueryInstanceCache/when_getting_last_result/with_stored_result.ts +23 -0
- package/queries/for_QueryInstanceCache/when_getting_or_creating/with_existing_entry.ts +29 -0
- package/queries/for_QueryInstanceCache/when_getting_or_creating/with_new_entry.ts +21 -0
- package/queries/for_QueryInstanceCache/when_releasing/a_key_that_does_not_exist.ts +21 -0
- package/queries/for_QueryInstanceCache/when_releasing/one_of_two_subscribers.ts +18 -0
- package/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber.ts +23 -0
- package/queries/for_QueryInstanceCache/when_setting_last_result/with_a_result.ts +20 -0
- package/queries/for_ReconnectPolicy/when_canceling/with_pending_timer.ts +33 -0
- package/queries/for_ReconnectPolicy/when_cancelling/with_pending_timer.ts +33 -0
- package/queries/for_ReconnectPolicy/when_resetting/after_scheduling.ts +39 -0
- package/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_not_reached/delay_is_capped_at_max.ts +44 -0
- package/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_not_reached/first_attempt.ts +38 -0
- package/queries/for_ReconnectPolicy/when_scheduling/and_max_attempts_reached/abandons_reconnect.ts +39 -0
- package/queries/for_ServerSentEventHubConnection/given/a_server_sent_event_hub_connection.ts +85 -0
- package/queries/for_ServerSentEventHubConnection/when_connect_timeout_fires/triggers_reconnect.ts +46 -0
- package/queries/for_ServerSentEventHubConnection/when_disposing/cleans_up_resources.ts +34 -0
- package/queries/for_ServerSentEventHubConnection/when_keep_alive_is_idle/triggers_reconnect.ts +48 -0
- package/queries/for_ServerSentEventHubConnection/when_reconnecting/after_error.ts +62 -0
- package/queries/for_ServerSentEventHubConnection/when_subscribing/queues_until_connected.ts +31 -0
- package/queries/for_ServerSentEventHubConnection/when_subscribing/sends_subscribe_post.ts +42 -0
- package/queries/for_ServerSentEventHubConnection/when_unsubscribing/the_only_query.ts +32 -0
- package/queries/for_ServerSentEventQueryConnection/when_connecting/with_query_arguments.ts +63 -0
- package/queries/for_ServerSentEventQueryConnection/when_connecting/without_event_source_available.ts +31 -0
- package/queries/for_ServerSentEventQueryConnection/when_disconnecting/after_connecting.ts +36 -0
- package/queries/for_ServerSentEventQueryConnection/when_disconnecting/before_message_arrives.ts +38 -0
- package/queries/for_WebSocketHubConnection/given/a_web_socket_hub_connection.ts +81 -0
- package/queries/for_WebSocketHubConnection/when_disposing/cleans_up_resources.ts +31 -0
- package/queries/for_WebSocketHubConnection/when_keep_alive_is_idle/sends_a_ping.ts +47 -0
- package/queries/for_WebSocketHubConnection/when_receiving_a_message/resets_keep_alive_timer.ts +53 -0
- package/queries/for_WebSocketHubConnection/when_reconnecting/after_unexpected_close.ts +41 -0
- package/queries/for_WebSocketHubConnection/when_reconnecting/resubscribes_all_queries.ts +43 -0
- package/queries/for_WebSocketHubConnection/when_subscribing/to_a_query.ts +42 -0
- package/queries/for_WebSocketHubConnection/when_unsubscribing/the_only_query.ts +30 -0
- package/queries/index.ts +12 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Globals = require('../Globals.js');
|
|
4
|
+
var HubConnectionKeepAlive = require('./HubConnectionKeepAlive.js');
|
|
5
|
+
var ReconnectPolicy = require('./ReconnectPolicy.js');
|
|
6
|
+
var WebSocketHubConnection = require('./WebSocketHubConnection.js');
|
|
7
|
+
|
|
8
|
+
class ServerSentEventHubConnection {
|
|
9
|
+
_sseUrl;
|
|
10
|
+
_subscribeUrl;
|
|
11
|
+
_unsubscribeUrl;
|
|
12
|
+
_microservice;
|
|
13
|
+
_connectTimeoutMs;
|
|
14
|
+
_policy;
|
|
15
|
+
_eventSource;
|
|
16
|
+
_connectionId;
|
|
17
|
+
_disconnected = false;
|
|
18
|
+
_subscriptions = new Map();
|
|
19
|
+
_pendingSubscriptions = new Map();
|
|
20
|
+
_lastPongLatency = 0;
|
|
21
|
+
_latencySamples = [];
|
|
22
|
+
_connectTimeoutTimer;
|
|
23
|
+
_keepAlive;
|
|
24
|
+
constructor(_sseUrl, _subscribeUrl, _unsubscribeUrl, _microservice, keepAliveIntervalMs = 30000, _connectTimeoutMs = 15000, _policy = new ReconnectPolicy.ReconnectPolicy()) {
|
|
25
|
+
this._sseUrl = _sseUrl;
|
|
26
|
+
this._subscribeUrl = _subscribeUrl;
|
|
27
|
+
this._unsubscribeUrl = _unsubscribeUrl;
|
|
28
|
+
this._microservice = _microservice;
|
|
29
|
+
this._connectTimeoutMs = _connectTimeoutMs;
|
|
30
|
+
this._policy = _policy;
|
|
31
|
+
this._keepAlive = new HubConnectionKeepAlive.HubConnectionKeepAlive(keepAliveIntervalMs, () => {
|
|
32
|
+
if (!this._disconnected && this._subscriptions.size > 0) {
|
|
33
|
+
console.warn(`SSE hub: no messages received for ${keepAliveIntervalMs}ms, reconnecting '${this._sseUrl}'`);
|
|
34
|
+
this.reconnect();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
get queryCount() {
|
|
39
|
+
return this._subscriptions.size;
|
|
40
|
+
}
|
|
41
|
+
get lastPingLatency() {
|
|
42
|
+
return this._lastPongLatency;
|
|
43
|
+
}
|
|
44
|
+
get averageLatency() {
|
|
45
|
+
if (this._latencySamples.length === 0)
|
|
46
|
+
return 0;
|
|
47
|
+
return this._latencySamples.reduce((a, b) => a + b, 0) / this._latencySamples.length;
|
|
48
|
+
}
|
|
49
|
+
subscribe(queryId, request, callback) {
|
|
50
|
+
const sub = { request, callback };
|
|
51
|
+
this._subscriptions.set(queryId, sub);
|
|
52
|
+
this.ensureConnected();
|
|
53
|
+
if (this._connectionId) {
|
|
54
|
+
this.sendSubscribe(queryId, request);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this._pendingSubscriptions.set(queryId, sub);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
unsubscribe(queryId) {
|
|
61
|
+
this._subscriptions.delete(queryId);
|
|
62
|
+
this._pendingSubscriptions.delete(queryId);
|
|
63
|
+
if (this._connectionId) {
|
|
64
|
+
this.sendUnsubscribe(queryId);
|
|
65
|
+
}
|
|
66
|
+
if (this._subscriptions.size === 0) {
|
|
67
|
+
this.close();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
dispose() {
|
|
71
|
+
this._disconnected = true;
|
|
72
|
+
this._subscriptions.clear();
|
|
73
|
+
this._pendingSubscriptions.clear();
|
|
74
|
+
this._policy.cancel();
|
|
75
|
+
this._keepAlive.stop();
|
|
76
|
+
this.clearConnectTimeout();
|
|
77
|
+
this._eventSource?.close();
|
|
78
|
+
this._eventSource = undefined;
|
|
79
|
+
this._connectionId = undefined;
|
|
80
|
+
}
|
|
81
|
+
ensureConnected() {
|
|
82
|
+
if (this._disconnected) {
|
|
83
|
+
this._disconnected = false;
|
|
84
|
+
}
|
|
85
|
+
if (this._eventSource && this._eventSource.readyState !== EventSource.CLOSED) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
this.openEventSource();
|
|
89
|
+
}
|
|
90
|
+
close() {
|
|
91
|
+
this._disconnected = true;
|
|
92
|
+
this._policy.cancel();
|
|
93
|
+
this._keepAlive.stop();
|
|
94
|
+
this.clearConnectTimeout();
|
|
95
|
+
this._eventSource?.close();
|
|
96
|
+
this._eventSource = undefined;
|
|
97
|
+
this._connectionId = undefined;
|
|
98
|
+
}
|
|
99
|
+
openEventSource() {
|
|
100
|
+
let url = this._sseUrl;
|
|
101
|
+
if (this._microservice?.length > 0) {
|
|
102
|
+
const param = `${Globals.Globals.microserviceWSQueryArgument}=${encodeURIComponent(this._microservice)}`;
|
|
103
|
+
url += (url.includes('?') ? '&' : '?') + param;
|
|
104
|
+
}
|
|
105
|
+
this._connectionId = undefined;
|
|
106
|
+
this._eventSource = new EventSource(url);
|
|
107
|
+
this._eventSource.onopen = () => {
|
|
108
|
+
if (this._disconnected)
|
|
109
|
+
return;
|
|
110
|
+
console.log(`SSE hub connection established: '${url}'`);
|
|
111
|
+
this._policy.reset();
|
|
112
|
+
this._keepAlive.start();
|
|
113
|
+
this.clearConnectTimeout();
|
|
114
|
+
this._connectTimeoutTimer = setTimeout(() => {
|
|
115
|
+
if (!this._disconnected && !this._connectionId) {
|
|
116
|
+
console.warn(`SSE hub: no Connected message within ${this._connectTimeoutMs}ms, retrying '${url}'`);
|
|
117
|
+
this.reconnect();
|
|
118
|
+
}
|
|
119
|
+
}, this._connectTimeoutMs);
|
|
120
|
+
};
|
|
121
|
+
this._eventSource.onmessage = (event) => {
|
|
122
|
+
if (this._disconnected)
|
|
123
|
+
return;
|
|
124
|
+
this._keepAlive.recordActivity();
|
|
125
|
+
this.handleMessage(event.data);
|
|
126
|
+
};
|
|
127
|
+
this._eventSource.onerror = () => {
|
|
128
|
+
if (this._disconnected)
|
|
129
|
+
return;
|
|
130
|
+
console.warn(`SSE hub connection error: '${url}'`);
|
|
131
|
+
this.reconnect();
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
reconnect() {
|
|
135
|
+
this._keepAlive.stop();
|
|
136
|
+
this.clearConnectTimeout();
|
|
137
|
+
this._eventSource?.close();
|
|
138
|
+
this._eventSource = undefined;
|
|
139
|
+
this._connectionId = undefined;
|
|
140
|
+
for (const [queryId, sub] of this._subscriptions) {
|
|
141
|
+
this._pendingSubscriptions.set(queryId, sub);
|
|
142
|
+
}
|
|
143
|
+
if (this._subscriptions.size === 0)
|
|
144
|
+
return;
|
|
145
|
+
this._policy.schedule(() => {
|
|
146
|
+
if (!this._disconnected && this._subscriptions.size > 0) {
|
|
147
|
+
this.openEventSource();
|
|
148
|
+
}
|
|
149
|
+
}, this._sseUrl);
|
|
150
|
+
}
|
|
151
|
+
clearConnectTimeout() {
|
|
152
|
+
if (this._connectTimeoutTimer !== undefined) {
|
|
153
|
+
clearTimeout(this._connectTimeoutTimer);
|
|
154
|
+
this._connectTimeoutTimer = undefined;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
handleMessage(rawData) {
|
|
158
|
+
try {
|
|
159
|
+
const message = JSON.parse(rawData);
|
|
160
|
+
switch (message.type) {
|
|
161
|
+
case WebSocketHubConnection.HubMessageType.Connected:
|
|
162
|
+
this.handleConnected(message);
|
|
163
|
+
break;
|
|
164
|
+
case WebSocketHubConnection.HubMessageType.QueryResult:
|
|
165
|
+
this.handleQueryResult(message);
|
|
166
|
+
break;
|
|
167
|
+
case WebSocketHubConnection.HubMessageType.Ping:
|
|
168
|
+
break;
|
|
169
|
+
case WebSocketHubConnection.HubMessageType.Unauthorized:
|
|
170
|
+
console.warn(`SSE hub: query '${message.queryId}' unauthorized`);
|
|
171
|
+
break;
|
|
172
|
+
case WebSocketHubConnection.HubMessageType.Error:
|
|
173
|
+
console.error(`SSE hub: query '${message.queryId}' error:`, message.payload);
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
console.error('SSE hub: error parsing message', error);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
handleConnected(message) {
|
|
182
|
+
this._connectionId = message.payload;
|
|
183
|
+
console.log(`SSE hub: connected with id '${this._connectionId}'`);
|
|
184
|
+
this.clearConnectTimeout();
|
|
185
|
+
for (const [queryId, sub] of this._pendingSubscriptions) {
|
|
186
|
+
this.sendSubscribe(queryId, sub.request);
|
|
187
|
+
}
|
|
188
|
+
this._pendingSubscriptions.clear();
|
|
189
|
+
}
|
|
190
|
+
handleQueryResult(message) {
|
|
191
|
+
if (!message.queryId)
|
|
192
|
+
return;
|
|
193
|
+
const sub = this._subscriptions.get(message.queryId);
|
|
194
|
+
if (!sub)
|
|
195
|
+
return;
|
|
196
|
+
const result = message.payload;
|
|
197
|
+
sub.callback(result);
|
|
198
|
+
}
|
|
199
|
+
sendSubscribe(queryId, request) {
|
|
200
|
+
if (!this._connectionId)
|
|
201
|
+
return;
|
|
202
|
+
const body = {
|
|
203
|
+
connectionId: this._connectionId,
|
|
204
|
+
queryId,
|
|
205
|
+
request,
|
|
206
|
+
};
|
|
207
|
+
fetch(this._subscribeUrl, {
|
|
208
|
+
method: 'POST',
|
|
209
|
+
headers: { 'Content-Type': 'application/json' },
|
|
210
|
+
body: JSON.stringify(body),
|
|
211
|
+
}).catch(error => {
|
|
212
|
+
console.error(`SSE hub: subscribe POST failed for '${queryId}'`, error);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
sendUnsubscribe(queryId) {
|
|
216
|
+
if (!this._connectionId)
|
|
217
|
+
return;
|
|
218
|
+
const body = {
|
|
219
|
+
connectionId: this._connectionId,
|
|
220
|
+
queryId,
|
|
221
|
+
};
|
|
222
|
+
fetch(this._unsubscribeUrl, {
|
|
223
|
+
method: 'POST',
|
|
224
|
+
headers: { 'Content-Type': 'application/json' },
|
|
225
|
+
body: JSON.stringify(body),
|
|
226
|
+
}).catch(error => {
|
|
227
|
+
console.error(`SSE hub: unsubscribe POST failed for '${queryId}'`, error);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
exports.ServerSentEventHubConnection = ServerSentEventHubConnection;
|
|
233
|
+
//# sourceMappingURL=ServerSentEventHubConnection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServerSentEventHubConnection.js","sources":["../../../queries/ServerSentEventHubConnection.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Globals } from '../Globals';\nimport { IObservableQueryHubConnection } from './IObservableQueryHubConnection';\nimport { DataReceived } from './ObservableQueryConnection';\nimport { HubConnectionKeepAlive } from './HubConnectionKeepAlive';\nimport { IReconnectPolicy } from './IReconnectPolicy';\nimport { ReconnectPolicy } from './ReconnectPolicy';\nimport { QueryResult } from './QueryResult';\nimport { HubMessage, HubMessageType, SubscriptionRequest } from './WebSocketHubConnection';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\ninterface ActiveSubscription {\n request: SubscriptionRequest;\n callback: DataReceived<any>;\n}\n\n/**\n * A multiplexed SSE hub connection that uses EventSource for server→client streaming\n * and fetch POST requests for client→server subscribe/unsubscribe commands.\n *\n * Protocol:\n * 1. Open EventSource to the SSE hub endpoint.\n * 2. Server sends a {@link HubMessageType.Connected} message with the connection identifier.\n * 3. Client sends POST to subscribe/unsubscribe endpoints using the connection identifier.\n * 4. Server streams {@link HubMessageType.QueryResult} messages tagged with queryId.\n * 5. When EventSource closes, server cleans up all subscriptions for this connection.\n */\nexport class ServerSentEventHubConnection implements IObservableQueryHubConnection {\n private _eventSource?: EventSource;\n private _connectionId?: string;\n private _disconnected = false;\n private _subscriptions: Map<string, ActiveSubscription> = new Map();\n private _pendingSubscriptions: Map<string, ActiveSubscription> = new Map();\n private _lastPongLatency: number = 0;\n private _latencySamples: number[] = [];\n private _connectTimeoutTimer?: ReturnType<typeof setTimeout>;\n private readonly _keepAlive: HubConnectionKeepAlive;\n\n /**\n * Initializes a new instance of {@link ServerSentEventHubConnection}.\n * @param {string} _sseUrl The SSE hub endpoint URL (e.g. `http://localhost:5000/.cratis/queries/sse`).\n * @param {string} _subscribeUrl The subscribe POST endpoint URL.\n * @param {string} _unsubscribeUrl The unsubscribe POST endpoint URL.\n * @param {string} _microservice The microservice name to pass as a query argument.\n * @param {number} keepAliveIntervalMs How long without any server message before the connection\n * is considered stale and a reconnect is forced (default: 30 000 ms).\n * @param {number} connectTimeoutMs How long to wait for the {@link HubMessageType.Connected}\n * message after the HTTP connection opens before giving up and retrying (default: 15 000 ms).\n * @param {IReconnectPolicy} _policy The reconnect policy to use (default: {@link ReconnectPolicy}).\n */\n constructor(\n private readonly _sseUrl: string,\n private readonly _subscribeUrl: string,\n private readonly _unsubscribeUrl: string,\n private readonly _microservice: string,\n keepAliveIntervalMs: number = 30000,\n private readonly _connectTimeoutMs: number = 15000,\n private readonly _policy: IReconnectPolicy = new ReconnectPolicy()\n ) {\n // SSE is server→client only: the client cannot send pings. Instead we watch for\n // inactivity — if the server stops sending messages (including its own keep-alive\n // pings) for the entire interval, the connection is stale and we reconnect.\n this._keepAlive = new HubConnectionKeepAlive(keepAliveIntervalMs, () => {\n if (!this._disconnected && this._subscriptions.size > 0) {\n console.warn(`SSE hub: no messages received for ${keepAliveIntervalMs}ms, reconnecting '${this._sseUrl}'`);\n this.reconnect();\n }\n });\n }\n\n /** @inheritdoc */\n get queryCount(): number {\n return this._subscriptions.size;\n }\n\n /** @inheritdoc */\n get lastPingLatency(): number {\n return this._lastPongLatency;\n }\n\n /** @inheritdoc */\n get averageLatency(): number {\n if (this._latencySamples.length === 0) return 0;\n return this._latencySamples.reduce((a, b) => a + b, 0) / this._latencySamples.length;\n }\n\n /** @inheritdoc */\n subscribe(queryId: string, request: SubscriptionRequest, callback: DataReceived<any>): void {\n const sub: ActiveSubscription = { request, callback };\n this._subscriptions.set(queryId, sub);\n\n this.ensureConnected();\n\n if (this._connectionId) {\n this.sendSubscribe(queryId, request);\n } else {\n // Not yet connected, queue for when Connected message arrives.\n this._pendingSubscriptions.set(queryId, sub);\n }\n }\n\n /** @inheritdoc */\n unsubscribe(queryId: string): void {\n this._subscriptions.delete(queryId);\n this._pendingSubscriptions.delete(queryId);\n\n if (this._connectionId) {\n this.sendUnsubscribe(queryId);\n }\n\n if (this._subscriptions.size === 0) {\n this.close();\n }\n }\n\n /** @inheritdoc */\n dispose(): void {\n this._disconnected = true;\n this._subscriptions.clear();\n this._pendingSubscriptions.clear();\n this._policy.cancel();\n this._keepAlive.stop();\n this.clearConnectTimeout();\n this._eventSource?.close();\n this._eventSource = undefined;\n this._connectionId = undefined;\n }\n\n private ensureConnected(): void {\n if (this._disconnected) {\n this._disconnected = false;\n }\n\n if (this._eventSource && this._eventSource.readyState !== EventSource.CLOSED) {\n return;\n }\n\n this.openEventSource();\n }\n\n private close(): void {\n this._disconnected = true;\n this._policy.cancel();\n this._keepAlive.stop();\n this.clearConnectTimeout();\n this._eventSource?.close();\n this._eventSource = undefined;\n this._connectionId = undefined;\n }\n\n private openEventSource(): void {\n let url = this._sseUrl;\n if (this._microservice?.length > 0) {\n const param = `${Globals.microserviceWSQueryArgument}=${encodeURIComponent(this._microservice)}`;\n url += (url.includes('?') ? '&' : '?') + param;\n }\n\n this._connectionId = undefined;\n this._eventSource = new EventSource(url);\n\n this._eventSource.onopen = () => {\n if (this._disconnected) return;\n console.log(`SSE hub connection established: '${url}'`);\n this._policy.reset();\n this._keepAlive.start();\n\n // If the server does not send a Connected message within the timeout, the\n // connection is broken. Close and retry via the reconnect policy.\n this.clearConnectTimeout();\n this._connectTimeoutTimer = setTimeout(() => {\n if (!this._disconnected && !this._connectionId) {\n console.warn(`SSE hub: no Connected message within ${this._connectTimeoutMs}ms, retrying '${url}'`);\n this.reconnect();\n }\n }, this._connectTimeoutMs);\n };\n\n this._eventSource.onmessage = (event: MessageEvent) => {\n if (this._disconnected) return;\n this._keepAlive.recordActivity();\n this.handleMessage(event.data as string);\n };\n\n this._eventSource.onerror = () => {\n if (this._disconnected) return;\n console.warn(`SSE hub connection error: '${url}'`);\n this.reconnect();\n };\n }\n\n private reconnect(): void {\n this._keepAlive.stop();\n this.clearConnectTimeout();\n\n // Close the EventSource so the reconnect policy manages the schedule.\n this._eventSource?.close();\n this._eventSource = undefined;\n this._connectionId = undefined;\n\n // Move all active subscriptions to pending so they re-subscribe when\n // the next Connected message arrives after the managed reconnect.\n for (const [queryId, sub] of this._subscriptions) {\n this._pendingSubscriptions.set(queryId, sub);\n }\n\n if (this._subscriptions.size === 0) return;\n\n this._policy.schedule(() => {\n if (!this._disconnected && this._subscriptions.size > 0) {\n this.openEventSource();\n }\n }, this._sseUrl);\n }\n\n private clearConnectTimeout(): void {\n if (this._connectTimeoutTimer !== undefined) {\n clearTimeout(this._connectTimeoutTimer);\n this._connectTimeoutTimer = undefined;\n }\n }\n\n private handleMessage(rawData: string): void {\n try {\n const message = JSON.parse(rawData) as HubMessage;\n\n switch (message.type) {\n case HubMessageType.Connected:\n this.handleConnected(message);\n break;\n case HubMessageType.QueryResult:\n this.handleQueryResult(message);\n break;\n case HubMessageType.Ping:\n // Server-sent keep-alive ping — activity already recorded in onmessage.\n break;\n case HubMessageType.Unauthorized:\n console.warn(`SSE hub: query '${message.queryId}' unauthorized`);\n break;\n case HubMessageType.Error:\n console.error(`SSE hub: query '${message.queryId}' error:`, message.payload);\n break;\n }\n } catch (error) {\n console.error('SSE hub: error parsing message', error);\n }\n }\n\n private handleConnected(message: HubMessage): void {\n this._connectionId = message.payload as string;\n console.log(`SSE hub: connected with id '${this._connectionId}'`);\n\n // Connected message arrived — cancel the connect timeout.\n this.clearConnectTimeout();\n\n // Send all pending subscriptions now that we have a connection ID.\n for (const [queryId, sub] of this._pendingSubscriptions) {\n this.sendSubscribe(queryId, sub.request);\n }\n this._pendingSubscriptions.clear();\n }\n\n private handleQueryResult(message: HubMessage): void {\n if (!message.queryId) return;\n\n const sub = this._subscriptions.get(message.queryId);\n if (!sub) return;\n\n const result = message.payload as QueryResult<any>;\n sub.callback(result);\n }\n\n private sendSubscribe(queryId: string, request: SubscriptionRequest): void {\n if (!this._connectionId) return;\n\n const body = {\n connectionId: this._connectionId,\n queryId,\n request,\n };\n\n fetch(this._subscribeUrl, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(body),\n }).catch(error => {\n console.error(`SSE hub: subscribe POST failed for '${queryId}'`, error);\n });\n }\n\n private sendUnsubscribe(queryId: string): void {\n if (!this._connectionId) return;\n\n const body = {\n connectionId: this._connectionId,\n queryId,\n };\n\n fetch(this._unsubscribeUrl, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(body),\n }).catch(error => {\n console.error(`SSE hub: unsubscribe POST failed for '${queryId}'`, error);\n });\n }\n}\n"],"names":["ReconnectPolicy","HubConnectionKeepAlive","Globals","HubMessageType"],"mappings":";;;;;;;MA8Ba,4BAA4B,CAAA;AAwBhB,IAAA,OAAA;AACA,IAAA,aAAA;AACA,IAAA,eAAA;AACA,IAAA,aAAA;AAEA,IAAA,iBAAA;AACA,IAAA,OAAA;AA7Bb,IAAA,YAAY;AACZ,IAAA,aAAa;IACb,aAAa,GAAG,KAAK;AACrB,IAAA,cAAc,GAAoC,IAAI,GAAG,EAAE;AAC3D,IAAA,qBAAqB,GAAoC,IAAI,GAAG,EAAE;IAClE,gBAAgB,GAAW,CAAC;IAC5B,eAAe,GAAa,EAAE;AAC9B,IAAA,oBAAoB;AACX,IAAA,UAAU;AAc3B,IAAA,WAAA,CACqB,OAAe,EACf,aAAqB,EACrB,eAAuB,EACvB,aAAqB,EACtC,mBAAA,GAA8B,KAAK,EAClB,iBAAA,GAA4B,KAAK,EACjC,OAAA,GAA4B,IAAIA,+BAAe,E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ACnC,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE;AAEzB,QAAA,MAAM,IAAI,GAAG;YACT,YAAY,EAAE,IAAI,CAAC,aAAa;YAChC,OAAO;SACV;AAED,QAAA,KAAK,CAAC,IAAI,CAAC,eAAe,EAAE;AACxB,YAAA,MAAM,EAAE,MAAM;AACd,YAAA,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;AAC/C,YAAA,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;AAC7B,SAAA,CAAC,CAAC,KAAK,CAAC,KAAK,IAAG;YACb,OAAO,CAAC,KAAK,CAAC,CAAA,sCAAA,EAAyC,OAAO,CAAA,CAAA,CAAG,EAAE,KAAK,CAAC;AAC7E,QAAA,CAAC,CAAC;IACN;AACH;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IObservableQueryConnection } from './IObservableQueryConnection';
|
|
2
|
+
import { DataReceived } from './ObservableQueryConnection';
|
|
3
|
+
export declare const SSE_HUB_ROUTE = "/.cratis/queries/sse";
|
|
4
|
+
export declare class ServerSentEventQueryConnection<TDataType> implements IObservableQueryConnection<TDataType> {
|
|
5
|
+
private readonly _url;
|
|
6
|
+
private _eventSource?;
|
|
7
|
+
private _disconnected;
|
|
8
|
+
readonly lastPingLatency: number;
|
|
9
|
+
readonly averageLatency: number;
|
|
10
|
+
constructor(_url: URL);
|
|
11
|
+
connect(dataReceived: DataReceived<TDataType>, queryArguments?: object): void;
|
|
12
|
+
disconnect(): void;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ServerSentEventQueryConnection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServerSentEventQueryConnection.d.ts","sourceRoot":"","sources":["../../../queries/ServerSentEventQueryConnection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAM3D,eAAO,MAAM,aAAa,yBAAyB,CAAC;AAWpD,qBAAa,8BAA8B,CAAC,SAAS,CAAE,YAAW,0BAA0B,CAAC,SAAS,CAAC;IAcvF,OAAO,CAAC,QAAQ,CAAC,IAAI;IAbjC,OAAO,CAAC,YAAY,CAAC,CAAc;IACnC,OAAO,CAAC,aAAa,CAAS;IAG9B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAK;IAGrC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAK;gBAMP,IAAI,EAAE,GAAG;IAGtC,OAAO,CAAC,YAAY,EAAE,YAAY,CAAC,SAAS,CAAC,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAuC7E,UAAU,IAAI,IAAI;CAMrB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const SSE_HUB_ROUTE = '/.cratis/queries/sse';
|
|
4
|
+
class ServerSentEventQueryConnection {
|
|
5
|
+
_url;
|
|
6
|
+
_eventSource;
|
|
7
|
+
_disconnected = false;
|
|
8
|
+
lastPingLatency = 0;
|
|
9
|
+
averageLatency = 0;
|
|
10
|
+
constructor(_url) {
|
|
11
|
+
this._url = _url;
|
|
12
|
+
}
|
|
13
|
+
connect(dataReceived, queryArguments) {
|
|
14
|
+
if (this._disconnected)
|
|
15
|
+
return;
|
|
16
|
+
if (typeof EventSource === 'undefined') {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
let url = this._url.toString();
|
|
20
|
+
if (queryArguments) {
|
|
21
|
+
const separator = url.includes('?') ? '&' : '?';
|
|
22
|
+
const query = Object.entries(queryArguments)
|
|
23
|
+
.filter(([, value]) => value !== undefined && value !== null)
|
|
24
|
+
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`)
|
|
25
|
+
.join('&');
|
|
26
|
+
if (query) {
|
|
27
|
+
url = `${url}${separator}${query}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
this._eventSource = new EventSource(url);
|
|
31
|
+
this._eventSource.onmessage = (event) => {
|
|
32
|
+
if (this._disconnected)
|
|
33
|
+
return;
|
|
34
|
+
try {
|
|
35
|
+
const result = JSON.parse(event.data);
|
|
36
|
+
dataReceived(result);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
console.error('SSE: error parsing message', error);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
this._eventSource.onerror = () => {
|
|
43
|
+
if (this._disconnected)
|
|
44
|
+
return;
|
|
45
|
+
console.warn(`SSE: connection error for '${url}', EventSource will retry automatically.`);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
disconnect() {
|
|
49
|
+
if (this._disconnected)
|
|
50
|
+
return;
|
|
51
|
+
this._disconnected = true;
|
|
52
|
+
this._eventSource?.close();
|
|
53
|
+
this._eventSource = undefined;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
exports.SSE_HUB_ROUTE = SSE_HUB_ROUTE;
|
|
58
|
+
exports.ServerSentEventQueryConnection = ServerSentEventQueryConnection;
|
|
59
|
+
//# sourceMappingURL=ServerSentEventQueryConnection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServerSentEventQueryConnection.js","sources":["../../../queries/ServerSentEventQueryConnection.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { IObservableQueryConnection } from './IObservableQueryConnection';\nimport { DataReceived } from './ObservableQueryConnection';\nimport { QueryResult } from './QueryResult';\n\n/**\n * The SSE demultiplexer route used when connecting through the multiplexed observable query endpoint.\n */\nexport const SSE_HUB_ROUTE = '/.cratis/queries/sse';\n\n/**\n * Represents a direct Server-Sent Events (SSE) connection for a single observable query.\n *\n * In direct mode the URL points to the per-query endpoint (e.g. `/api/queries/latest`).\n * The backend detects the `Accept: text/event-stream` header and streams results directly.\n *\n * The caller (typically {@link createObservableQueryConnection}) decides which URL to use;\n * this class is transport-agnostic beyond being SSE.\n */\nexport class ServerSentEventQueryConnection<TDataType> implements IObservableQueryConnection<TDataType> {\n private _eventSource?: EventSource;\n private _disconnected = false;\n\n /** @inheritdoc */\n readonly lastPingLatency: number = 0;\n\n /** @inheritdoc */\n readonly averageLatency: number = 0;\n\n /**\n * Initializes a new instance of {@link ServerSentEventQueryConnection}.\n * @param {URL} url The fully qualified URL of the SSE endpoint (including query parameters).\n */\n constructor(private readonly _url: URL) {}\n\n /** @inheritdoc */\n connect(dataReceived: DataReceived<TDataType>, queryArguments?: object): void {\n if (this._disconnected) return;\n\n // Guard against environments where EventSource is not available (e.g. Node.js, SSR).\n if (typeof EventSource === 'undefined') {\n return;\n }\n\n let url = this._url.toString();\n if (queryArguments) {\n const separator = url.includes('?') ? '&' : '?';\n const query = Object.entries(queryArguments)\n .filter(([, value]) => value !== undefined && value !== null)\n .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`)\n .join('&');\n if (query) {\n url = `${url}${separator}${query}`;\n }\n }\n\n this._eventSource = new EventSource(url);\n\n this._eventSource.onmessage = (event: MessageEvent) => {\n if (this._disconnected) return;\n try {\n const result = JSON.parse(event.data as string) as QueryResult<TDataType>;\n dataReceived(result);\n } catch (error) {\n console.error('SSE: error parsing message', error);\n }\n };\n\n this._eventSource.onerror = () => {\n if (this._disconnected) return;\n console.warn(`SSE: connection error for '${url}', EventSource will retry automatically.`);\n };\n }\n\n /** @inheritdoc */\n disconnect(): void {\n if (this._disconnected) return;\n this._disconnected = true;\n this._eventSource?.close();\n this._eventSource = undefined;\n }\n}\n"],"names":[],"mappings":";;AAUO,MAAM,aAAa,GAAG;MAWhB,8BAA8B,CAAA;AAcV,IAAA,IAAA;AAbrB,IAAA,YAAY;IACZ,aAAa,GAAG,KAAK;IAGpB,eAAe,GAAW,CAAC;IAG3B,cAAc,GAAW,CAAC;AAMnC,IAAA,WAAA,CAA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tD;AACJ,QAAA,CAAC;AAED,QAAA,IAAI,CAAC,YAAY,CAAC,OAAO,GAAG,MAAK;YAC7B,IAAI,IAAI,CAAC,aAAa;gBAAE;AACxB,YAAA,OAAO,CAAC,IAAI,CAAC,8BAA8B,GAAG,CAAA,wCAAA,CAA0C,CAAC;AAC7F,QAAA,CAAC;IACL;IAGA,UAAU,GAAA;QACN,IAAI,IAAI,CAAC,aAAa;YAAE;AACxB,QAAA,IAAI,CAAC,aAAa,GAAG,IAAI;AACzB,QAAA,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE;AAC1B,QAAA,IAAI,CAAC,YAAY,GAAG,SAAS;IACjC;AACH;;;;;"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { DataReceived } from './ObservableQueryConnection';
|
|
2
|
+
import { IReconnectPolicy } from './IReconnectPolicy';
|
|
3
|
+
export declare enum HubMessageType {
|
|
4
|
+
Subscribe = 0,
|
|
5
|
+
Unsubscribe = 1,
|
|
6
|
+
QueryResult = 2,
|
|
7
|
+
Unauthorized = 3,
|
|
8
|
+
Error = 4,
|
|
9
|
+
Ping = 5,
|
|
10
|
+
Pong = 6,
|
|
11
|
+
Connected = 7
|
|
12
|
+
}
|
|
13
|
+
export interface HubMessage {
|
|
14
|
+
type: HubMessageType;
|
|
15
|
+
queryId?: string;
|
|
16
|
+
payload?: any;
|
|
17
|
+
timestamp?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface SubscriptionRequest {
|
|
20
|
+
queryName: string;
|
|
21
|
+
arguments?: Record<string, string | null>;
|
|
22
|
+
page?: number;
|
|
23
|
+
pageSize?: number;
|
|
24
|
+
sortBy?: string;
|
|
25
|
+
sortDirection?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare class WebSocketHubConnection {
|
|
28
|
+
private readonly _url;
|
|
29
|
+
private readonly _microservice;
|
|
30
|
+
private readonly _policy;
|
|
31
|
+
private _socket?;
|
|
32
|
+
private _disconnected;
|
|
33
|
+
private _subscriptions;
|
|
34
|
+
private readonly _keepAlive;
|
|
35
|
+
private _lastPingSentTime?;
|
|
36
|
+
private _lastPongLatency;
|
|
37
|
+
private _latencySamples;
|
|
38
|
+
constructor(_url: string, _microservice: string, pingIntervalMs?: number, _policy?: IReconnectPolicy);
|
|
39
|
+
get queryCount(): number;
|
|
40
|
+
get lastPingLatency(): number;
|
|
41
|
+
get averageLatency(): number;
|
|
42
|
+
subscribe(queryId: string, request: SubscriptionRequest, callback: DataReceived<any>): void;
|
|
43
|
+
unsubscribe(queryId: string): void;
|
|
44
|
+
dispose(): void;
|
|
45
|
+
private ensureConnected;
|
|
46
|
+
private close;
|
|
47
|
+
private openSocket;
|
|
48
|
+
private sendAllSubscriptions;
|
|
49
|
+
private sendSubscribeMessage;
|
|
50
|
+
private sendMessage;
|
|
51
|
+
private handleMessage;
|
|
52
|
+
private handleQueryResult;
|
|
53
|
+
private handlePong;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=WebSocketHubConnection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebSocketHubConnection.d.ts","sourceRoot":"","sources":["../../../queries/WebSocketHubConnection.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAUtD,oBAAY,cAAc;IACtB,SAAS,IAAI;IACb,WAAW,IAAI;IACf,WAAW,IAAI;IACf,YAAY,IAAI;IAChB,KAAK,IAAI;IACT,IAAI,IAAI;IACR,IAAI,IAAI;IACR,SAAS,IAAI;CAChB;AAKD,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAKD,MAAM,WAAW,mBAAmB;IAChC,SAAS,EAAE,MAAM,CAAC;I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zB,OAAO,CAAC,UAAU;CAWrB"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Globals = require('../Globals.js');
|
|
4
|
+
var HubConnectionKeepAlive = require('./HubConnectionKeepAlive.js');
|
|
5
|
+
var ReconnectPolicy = require('./ReconnectPolicy.js');
|
|
6
|
+
|
|
7
|
+
exports.HubMessageType = void 0;
|
|
8
|
+
(function (HubMessageType) {
|
|
9
|
+
HubMessageType[HubMessageType["Subscribe"] = 0] = "Subscribe";
|
|
10
|
+
HubMessageType[HubMessageType["Unsubscribe"] = 1] = "Unsubscribe";
|
|
11
|
+
HubMessageType[HubMessageType["QueryResult"] = 2] = "QueryResult";
|
|
12
|
+
HubMessageType[HubMessageType["Unauthorized"] = 3] = "Unauthorized";
|
|
13
|
+
HubMessageType[HubMessageType["Error"] = 4] = "Error";
|
|
14
|
+
HubMessageType[HubMessageType["Ping"] = 5] = "Ping";
|
|
15
|
+
HubMessageType[HubMessageType["Pong"] = 6] = "Pong";
|
|
16
|
+
HubMessageType[HubMessageType["Connected"] = 7] = "Connected";
|
|
17
|
+
})(exports.HubMessageType || (exports.HubMessageType = {}));
|
|
18
|
+
class WebSocketHubConnection {
|
|
19
|
+
_url;
|
|
20
|
+
_microservice;
|
|
21
|
+
_policy;
|
|
22
|
+
_socket;
|
|
23
|
+
_disconnected = false;
|
|
24
|
+
_subscriptions = new Map();
|
|
25
|
+
_keepAlive;
|
|
26
|
+
_lastPingSentTime;
|
|
27
|
+
_lastPongLatency = 0;
|
|
28
|
+
_latencySamples = [];
|
|
29
|
+
constructor(_url, _microservice, pingIntervalMs = 10000, _policy = new ReconnectPolicy.ReconnectPolicy()) {
|
|
30
|
+
this._url = _url;
|
|
31
|
+
this._microservice = _microservice;
|
|
32
|
+
this._policy = _policy;
|
|
33
|
+
this._keepAlive = new HubConnectionKeepAlive.HubConnectionKeepAlive(pingIntervalMs, () => {
|
|
34
|
+
if (this._socket?.readyState === WebSocket.OPEN) {
|
|
35
|
+
this._lastPingSentTime = Date.now();
|
|
36
|
+
this.sendMessage({ type: exports.HubMessageType.Ping, timestamp: this._lastPingSentTime });
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
get queryCount() {
|
|
41
|
+
return this._subscriptions.size;
|
|
42
|
+
}
|
|
43
|
+
get lastPingLatency() {
|
|
44
|
+
return this._lastPongLatency;
|
|
45
|
+
}
|
|
46
|
+
get averageLatency() {
|
|
47
|
+
if (this._latencySamples.length === 0)
|
|
48
|
+
return 0;
|
|
49
|
+
return this._latencySamples.reduce((a, b) => a + b, 0) / this._latencySamples.length;
|
|
50
|
+
}
|
|
51
|
+
subscribe(queryId, request, callback) {
|
|
52
|
+
this._subscriptions.set(queryId, { request, callback });
|
|
53
|
+
this.ensureConnected();
|
|
54
|
+
if (this._socket?.readyState === WebSocket.OPEN) {
|
|
55
|
+
this.sendSubscribeMessage(queryId, request);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
unsubscribe(queryId) {
|
|
59
|
+
this._subscriptions.delete(queryId);
|
|
60
|
+
if (this._socket?.readyState === WebSocket.OPEN) {
|
|
61
|
+
this.sendMessage({ type: exports.HubMessageType.Unsubscribe, queryId });
|
|
62
|
+
}
|
|
63
|
+
if (this._subscriptions.size === 0) {
|
|
64
|
+
this.close();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
dispose() {
|
|
68
|
+
this._disconnected = true;
|
|
69
|
+
this._subscriptions.clear();
|
|
70
|
+
this._keepAlive.stop();
|
|
71
|
+
this._policy.cancel();
|
|
72
|
+
this._socket?.close();
|
|
73
|
+
this._socket = undefined;
|
|
74
|
+
}
|
|
75
|
+
ensureConnected() {
|
|
76
|
+
if (this._disconnected) {
|
|
77
|
+
this._disconnected = false;
|
|
78
|
+
}
|
|
79
|
+
if (this._socket && (this._socket.readyState === WebSocket.OPEN || this._socket.readyState === WebSocket.CONNECTING)) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.openSocket();
|
|
83
|
+
}
|
|
84
|
+
close() {
|
|
85
|
+
this._disconnected = true;
|
|
86
|
+
this._keepAlive.stop();
|
|
87
|
+
this._policy.cancel();
|
|
88
|
+
this._socket?.close();
|
|
89
|
+
this._socket = undefined;
|
|
90
|
+
}
|
|
91
|
+
openSocket() {
|
|
92
|
+
let url = this._url;
|
|
93
|
+
if (this._microservice?.length > 0) {
|
|
94
|
+
const param = `${Globals.Globals.microserviceWSQueryArgument}=${encodeURIComponent(this._microservice)}`;
|
|
95
|
+
url += (url.includes('?') ? '&' : '?') + param;
|
|
96
|
+
}
|
|
97
|
+
this._socket = new WebSocket(url);
|
|
98
|
+
this._socket.onopen = () => {
|
|
99
|
+
if (this._disconnected)
|
|
100
|
+
return;
|
|
101
|
+
console.log(`Hub connection established: '${url}'`);
|
|
102
|
+
this._policy.reset();
|
|
103
|
+
this._keepAlive.start();
|
|
104
|
+
this.sendAllSubscriptions();
|
|
105
|
+
};
|
|
106
|
+
this._socket.onclose = () => {
|
|
107
|
+
if (this._disconnected)
|
|
108
|
+
return;
|
|
109
|
+
console.log(`Hub connection closed: '${url}'`);
|
|
110
|
+
this._keepAlive.stop();
|
|
111
|
+
if (this._subscriptions.size === 0)
|
|
112
|
+
return;
|
|
113
|
+
this._policy.schedule(() => {
|
|
114
|
+
if (!this._disconnected && this._subscriptions.size > 0) {
|
|
115
|
+
this.openSocket();
|
|
116
|
+
}
|
|
117
|
+
}, this._url);
|
|
118
|
+
};
|
|
119
|
+
this._socket.onerror = (error) => {
|
|
120
|
+
if (this._disconnected)
|
|
121
|
+
return;
|
|
122
|
+
console.error(`Hub connection error: '${url}'`, error);
|
|
123
|
+
this._keepAlive.stop();
|
|
124
|
+
};
|
|
125
|
+
this._socket.onmessage = (ev) => {
|
|
126
|
+
if (this._disconnected)
|
|
127
|
+
return;
|
|
128
|
+
this.handleMessage(ev.data);
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
sendAllSubscriptions() {
|
|
132
|
+
for (const [queryId, sub] of this._subscriptions) {
|
|
133
|
+
this.sendSubscribeMessage(queryId, sub.request);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
sendSubscribeMessage(queryId, request) {
|
|
137
|
+
this.sendMessage({
|
|
138
|
+
type: exports.HubMessageType.Subscribe,
|
|
139
|
+
queryId,
|
|
140
|
+
payload: request,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
sendMessage(message) {
|
|
144
|
+
if (this._socket?.readyState === WebSocket.OPEN) {
|
|
145
|
+
this._socket.send(JSON.stringify(message));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
handleMessage(rawData) {
|
|
149
|
+
try {
|
|
150
|
+
const message = JSON.parse(rawData);
|
|
151
|
+
this._keepAlive.recordActivity();
|
|
152
|
+
switch (message.type) {
|
|
153
|
+
case exports.HubMessageType.QueryResult:
|
|
154
|
+
this.handleQueryResult(message);
|
|
155
|
+
break;
|
|
156
|
+
case exports.HubMessageType.Pong:
|
|
157
|
+
this.handlePong(message);
|
|
158
|
+
break;
|
|
159
|
+
case exports.HubMessageType.Unauthorized:
|
|
160
|
+
console.warn(`Hub: query '${message.queryId}' unauthorized`);
|
|
161
|
+
break;
|
|
162
|
+
case exports.HubMessageType.Error:
|
|
163
|
+
console.error(`Hub: query '${message.queryId}' error:`, message.payload);
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
console.error('Hub: error parsing message', error);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
handleQueryResult(message) {
|
|
172
|
+
if (!message.queryId)
|
|
173
|
+
return;
|
|
174
|
+
const sub = this._subscriptions.get(message.queryId);
|
|
175
|
+
if (!sub)
|
|
176
|
+
return;
|
|
177
|
+
const result = message.payload;
|
|
178
|
+
sub.callback(result);
|
|
179
|
+
}
|
|
180
|
+
handlePong(message) {
|
|
181
|
+
if (message.timestamp && this._lastPingSentTime) {
|
|
182
|
+
const latency = Date.now() - message.timestamp;
|
|
183
|
+
this._lastPongLatency = latency;
|
|
184
|
+
this._latencySamples.push(latency);
|
|
185
|
+
if (this._latencySamples.length > 100) {
|
|
186
|
+
this._latencySamples.shift();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
exports.WebSocketHubConnection = WebSocketHubConnection;
|
|
193
|
+
//# sourceMappingURL=WebSocketHubConnection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebSocketHubConnection.js","sources":["../../../queries/WebSocketHubConnection.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Globals } from '../Globals';\nimport { DataReceived } from './ObservableQueryConnection';\nimport { HubConnectionKeepAlive } from './HubConnectionKeepAlive';\nimport { IReconnectPolicy } from './IReconnectPolicy';\nimport { ReconnectPolicy } from './ReconnectPolicy';\nimport { QueryResult } from './QueryResult';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Message types matching the backend {@link ObservableQueryHubMessageType} enum.\n * Serialized as integers by the Cratis JSON configuration.\n */\nexport enum HubMessageType {\n Subscribe = 0,\n Unsubscribe = 1,\n QueryResult = 2,\n Unauthorized = 3,\n Error = 4,\n Ping = 5,\n Pong = 6,\n Connected = 7,\n}\n\n/**\n * Wire format for messages exchanged over the {@link WebSocketHubConnection}.\n */\nexport interface HubMessage {\n type: HubMessageType;\n queryId?: string;\n payload?: any;\n timestamp?: number;\n}\n\n/**\n * Matches the backend {@link ObservableQuerySubscriptionRequest} record.\n */\nexport interface SubscriptionRequest {\n queryName: string;\n arguments?: Record<string, string | null>;\n page?: number;\n pageSize?: number;\n sortBy?: string;\n sortDirection?: string;\n}\n\ninterface ActiveSubscription {\n request: SubscriptionRequest;\n callback: DataReceived<any>;\n}\n\n/**\n * Represents a single multiplexed WebSocket connection to the observable query hub\n * at {@code /.cratis/queries/ws}.\n *\n * Multiple query subscriptions are carried over the same physical WebSocket. Each subscription\n * is identified by a client-generated {@code queryId}; the server tags every result message with\n * the same id so responses can be routed to the correct callback.\n */\nexport class WebSocketHubConnection {\n private _socket?: WebSocket;\n private _disconnected = false;\n private _subscriptions: Map<string, ActiveSubscription> = new Map();\n private readonly _keepAlive: HubConnectionKeepAlive;\n private _lastPingSentTime?: number;\n private _lastPongLatency: number = 0;\n private _latencySamples: number[] = [];\n\n /**\n * Initializes a new instance of {@link WebSocketHubConnection}.\n * @param {string} url The WebSocket URL of the hub endpoint (e.g. {@code ws://localhost:5000/.cratis/queries/ws}).\n * @param {string} microservice The microservice name to pass as a query argument.\n * @param {number} pingIntervalMs How often to send keep-alive pings when the connection is idle (default: 10 000 ms).\n * @param {IReconnectPolicy} reconnectPolicy The reconnect policy to use (default: {@link ReconnectPolicy}).\n */\n constructor(\n private readonly _url: string,\n private readonly _microservice: string,\n pingIntervalMs: number = 10000,\n private readonly _policy: IReconnectPolicy = new ReconnectPolicy()\n ) {\n this._keepAlive = new HubConnectionKeepAlive(pingIntervalMs, () => {\n if (this._socket?.readyState === WebSocket.OPEN) {\n this._lastPingSentTime = Date.now();\n this.sendMessage({ type: HubMessageType.Ping, timestamp: this._lastPingSentTime });\n }\n });\n }\n\n /**\n * Gets the number of active query subscriptions on this connection.\n */\n get queryCount(): number {\n return this._subscriptions.size;\n }\n\n /**\n * Gets the latency of the last ping/pong sequence in milliseconds.\n */\n get lastPingLatency(): number {\n return this._lastPongLatency;\n }\n\n /**\n * Gets the rolling average latency in milliseconds.\n */\n get averageLatency(): number {\n if (this._latencySamples.length === 0) return 0;\n return this._latencySamples.reduce((a, b) => a + b, 0) / this._latencySamples.length;\n }\n\n /**\n * Subscribe to a query on this hub connection.\n * If the WebSocket is not yet open, the subscribe message will be sent once the connection is established.\n * @param {string} queryId Client-generated unique identifier for this subscription.\n * @param {SubscriptionRequest} request The subscription request payload.\n * @param {DataReceived<any>} callback Callback invoked whenever the server pushes a result for this query.\n */\n subscribe(queryId: string, request: SubscriptionRequest, callback: DataReceived<any>): void {\n this._subscriptions.set(queryId, { request, callback });\n this.ensureConnected();\n\n if (this._socket?.readyState === WebSocket.OPEN) {\n this.sendSubscribeMessage(queryId, request);\n }\n // If not yet open, sendAllSubscriptions will fire in onopen.\n }\n\n /**\n * Unsubscribe from a query on this hub connection.\n * @param {string} queryId The identifier of the subscription to cancel.\n */\n unsubscribe(queryId: string): void {\n this._subscriptions.delete(queryId);\n\n if (this._socket?.readyState === WebSocket.OPEN) {\n this.sendMessage({ type: HubMessageType.Unsubscribe, queryId });\n }\n\n // If no subscriptions remain, close the connection to free resources.\n if (this._subscriptions.size === 0) {\n this.close();\n }\n }\n\n /**\n * Permanently close this hub connection and clean up all subscriptions.\n */\n dispose(): void {\n this._disconnected = true;\n this._subscriptions.clear();\n this._keepAlive.stop();\n this._policy.cancel();\n this._socket?.close();\n this._socket = undefined;\n }\n\n private ensureConnected(): void {\n if (this._disconnected) {\n // Reset disconnected flag when a new subscription comes in\n this._disconnected = false;\n }\n\n if (this._socket && (this._socket.readyState === WebSocket.OPEN || this._socket.readyState === WebSocket.CONNECTING)) {\n return;\n }\n\n this.openSocket();\n }\n\n private close(): void {\n this._disconnected = true;\n this._keepAlive.stop();\n this._policy.cancel();\n this._socket?.close();\n this._socket = undefined;\n }\n\n private openSocket(): void {\n let url = this._url;\n if (this._microservice?.length > 0) {\n const param = `${Globals.microserviceWSQueryArgument}=${encodeURIComponent(this._microservice)}`;\n url += (url.includes('?') ? '&' : '?') + param;\n }\n\n this._socket = new WebSocket(url);\n\n this._socket.onopen = () => {\n if (this._disconnected) return;\n console.log(`Hub connection established: '${url}'`);\n this._policy.reset();\n this._keepAlive.start();\n this.sendAllSubscriptions();\n };\n\n this._socket.onclose = () => {\n if (this._disconnected) return;\n console.log(`Hub connection closed: '${url}'`);\n this._keepAlive.stop();\n if (this._subscriptions.size === 0) return;\n this._policy.schedule(() => {\n if (!this._disconnected && this._subscriptions.size > 0) {\n this.openSocket();\n }\n }, this._url);\n };\n\n this._socket.onerror = (error) => {\n if (this._disconnected) return;\n console.error(`Hub connection error: '${url}'`, error);\n this._keepAlive.stop();\n // onclose will fire after onerror, triggering reconnect\n };\n\n this._socket.onmessage = (ev) => {\n if (this._disconnected) return;\n this.handleMessage(ev.data as string);\n };\n }\n\n private sendAllSubscriptions(): void {\n for (const [queryId, sub] of this._subscriptions) {\n this.sendSubscribeMessage(queryId, sub.request);\n }\n }\n\n private sendSubscribeMessage(queryId: string, request: SubscriptionRequest): void {\n this.sendMessage({\n type: HubMessageType.Subscribe,\n queryId,\n payload: request,\n });\n }\n\n private sendMessage(message: HubMessage): void {\n if (this._socket?.readyState === WebSocket.OPEN) {\n this._socket.send(JSON.stringify(message));\n }\n }\n\n private handleMessage(rawData: string): void {\n try {\n const message = JSON.parse(rawData) as HubMessage;\n\n // Every received message is activity — skip keep-alive ping if data is flowing.\n this._keepAlive.recordActivity();\n\n switch (message.type) {\n case HubMessageType.QueryResult:\n this.handleQueryResult(message);\n break;\n case HubMessageType.Pong:\n this.handlePong(message);\n break;\n case HubMessageType.Unauthorized:\n console.warn(`Hub: query '${message.queryId}' unauthorized`);\n break;\n case HubMessageType.Error:\n console.error(`Hub: query '${message.queryId}' error:`, message.payload);\n break;\n }\n } catch (error) {\n console.error('Hub: error parsing message', error);\n }\n }\n\n private handleQueryResult(message: HubMessage): void {\n if (!message.queryId) return;\n\n const sub = this._subscriptions.get(message.queryId);\n if (!sub) return;\n\n const result = message.payload as QueryResult<any>;\n sub.callback(result);\n }\n\n private handlePong(message: HubMessage): void {\n if (message.timestamp && this._lastPingSentTime) {\n const latency = Date.now() - message.timestamp;\n this._lastPongLatency = latency;\n this._latencySamples.push(latency);\n\n if (this._latencySamples.length > 100) {\n this._latencySamples.shift();\n }\n }\n }\n}\n"],"names":["HubMessageType","ReconnectPolicy","HubConnectionKeepAlive","Globals"],"mappings":";;;;;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