@cratis/arc 22.0.1 → 22.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/dist/cjs/queries/ObservableQueryFor.js +9 -4
- package/dist/cjs/queries/ObservableQueryFor.js.map +1 -1
- package/dist/cjs/queries/QueryInstanceCache.js +6 -6
- package/dist/cjs/queries/QueryInstanceCache.js.map +1 -1
- package/dist/cjs/queries/QueryResult.js +23 -4
- package/dist/cjs/queries/QueryResult.js.map +1 -1
- package/dist/cjs/queries/QueryResultWithState.js +20 -7
- package/dist/cjs/queries/QueryResultWithState.js.map +1 -1
- package/dist/cjs/queries/ServerSentEventHubConnection.js +120 -58
- package/dist/cjs/queries/ServerSentEventHubConnection.js.map +1 -1
- package/dist/cjs/queries/WebSocketHubConnection.js +121 -51
- package/dist/cjs/queries/WebSocketHubConnection.js.map +1 -1
- package/dist/esm/queries/IQueryResult.d.ts +1 -0
- package/dist/esm/queries/IQueryResult.d.ts.map +1 -1
- package/dist/esm/queries/ObservableQueryFor.d.ts +6 -6
- package/dist/esm/queries/ObservableQueryFor.d.ts.map +1 -1
- package/dist/esm/queries/ObservableQueryFor.js +9 -4
- package/dist/esm/queries/ObservableQueryFor.js.map +1 -1
- package/dist/esm/queries/QueryInstanceCache.d.ts +1 -1
- package/dist/esm/queries/QueryInstanceCache.d.ts.map +1 -1
- package/dist/esm/queries/QueryInstanceCache.js +6 -6
- package/dist/esm/queries/QueryInstanceCache.js.map +1 -1
- package/dist/esm/queries/QueryResult.d.ts +2 -0
- package/dist/esm/queries/QueryResult.d.ts.map +1 -1
- package/dist/esm/queries/QueryResult.js +23 -4
- package/dist/esm/queries/QueryResult.js.map +1 -1
- package/dist/esm/queries/QueryResultWithState.d.ts +3 -3
- package/dist/esm/queries/QueryResultWithState.d.ts.map +1 -1
- package/dist/esm/queries/QueryResultWithState.js +20 -7
- package/dist/esm/queries/QueryResultWithState.js.map +1 -1
- package/dist/esm/queries/ServerSentEventHubConnection.d.ts +11 -4
- package/dist/esm/queries/ServerSentEventHubConnection.d.ts.map +1 -1
- package/dist/esm/queries/ServerSentEventHubConnection.js +120 -58
- package/dist/esm/queries/ServerSentEventHubConnection.js.map +1 -1
- package/dist/esm/queries/WebSocketHubConnection.d.ts +13 -2
- package/dist/esm/queries/WebSocketHubConnection.d.ts.map +1 -1
- package/dist/esm/queries/WebSocketHubConnection.js +121 -51
- package/dist/esm/queries/WebSocketHubConnection.js.map +1 -1
- package/dist/esm/queries/for_ObservableQueryFor/given/TestQueries.d.ts +17 -0
- package/dist/esm/queries/for_ObservableQueryFor/given/TestQueries.d.ts.map +1 -1
- package/dist/esm/queries/for_ObservableQueryFor/given/TestQueries.js +34 -0
- package/dist/esm/queries/for_ObservableQueryFor/given/TestQueries.js.map +1 -1
- package/dist/esm/queries/for_ObservableQueryFor/given/an_observable_query_for.d.ts +2 -1
- package/dist/esm/queries/for_ObservableQueryFor/given/an_observable_query_for.d.ts.map +1 -1
- package/dist/esm/queries/for_ObservableQueryFor/given/an_observable_query_for.js +3 -1
- package/dist/esm/queries/for_ObservableQueryFor/given/an_observable_query_for.js.map +1 -1
- package/dist/esm/queries/for_ObservableQueryFor/when_performing/with_a_not_ready_result.d.ts +2 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_performing/with_a_not_ready_result.d.ts.map +1 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_performing/with_a_not_ready_result.js +34 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_performing/with_a_not_ready_result.js.map +1 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_receiving_a_result/and_the_model_has_a_calendar_collection.d.ts +2 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_receiving_a_result/and_the_model_has_a_calendar_collection.d.ts.map +1 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_receiving_a_result/and_the_model_has_a_calendar_collection.js +52 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_receiving_a_result/and_the_model_has_a_calendar_collection.js.map +1 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_and_sse_transport.js +26 -2
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_and_sse_transport.js.map +1 -1
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_disabled_and_sse_transport.js +60 -3
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_disabled_and_sse_transport.js.map +1 -1
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_web_socket_hub_payload_without_readiness.d.ts +2 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_web_socket_hub_payload_without_readiness.d.ts.map +1 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_web_socket_hub_payload_without_readiness.js +83 -0
- package/dist/esm/queries/for_ObservableQueryFor/when_subscribing/with_web_socket_hub_payload_without_readiness.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_setting_last_result/with_only_readiness_changed.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_setting_last_result/with_only_readiness_changed.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_setting_last_result/with_only_readiness_changed.js +22 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_setting_last_result/with_only_readiness_changed.js.map +1 -0
- package/dist/esm/queries/for_QueryResult/when_constructing_from_a_server_result/with_readiness_false.d.ts +2 -0
- package/dist/esm/queries/for_QueryResult/when_constructing_from_a_server_result/with_readiness_false.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryResult/when_constructing_from_a_server_result/with_readiness_false.js +17 -0
- package/dist/esm/queries/for_QueryResult/when_constructing_from_a_server_result/with_readiness_false.js.map +1 -0
- package/dist/esm/queries/for_QueryResult/when_constructing_from_a_server_result/without_readiness.d.ts +2 -0
- package/dist/esm/queries/for_QueryResult/when_constructing_from_a_server_result/without_readiness.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryResult/when_constructing_from_a_server_result/without_readiness.js +16 -0
- package/dist/esm/queries/for_QueryResult/when_constructing_from_a_server_result/without_readiness.js.map +1 -0
- package/dist/esm/queries/for_QueryResultWithState/when_creating_from_query_result/with_readiness_false.d.ts +2 -0
- package/dist/esm/queries/for_QueryResultWithState/when_creating_from_query_result/with_readiness_false.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryResultWithState/when_creating_from_query_result/with_readiness_false.js +19 -0
- package/dist/esm/queries/for_QueryResultWithState/when_creating_from_query_result/with_readiness_false.js.map +1 -0
- package/dist/esm/queries/for_QueryResultWithState/when_creating_from_query_result/without_readiness.d.ts +2 -0
- package/dist/esm/queries/for_QueryResultWithState/when_creating_from_query_result/without_readiness.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryResultWithState/when_creating_from_query_result/without_readiness.js +19 -0
- package/dist/esm/queries/for_QueryResultWithState/when_creating_from_query_result/without_readiness.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/given/a_deferred_promise.d.ts +7 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/given/a_deferred_promise.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/given/a_deferred_promise.js +12 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/given/a_deferred_promise.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/given/a_server_sent_event_hub_connection.d.ts +2 -1
- package/dist/esm/queries/for_ServerSentEventHubConnection/given/a_server_sent_event_hub_connection.d.ts.map +1 -1
- package/dist/esm/queries/for_ServerSentEventHubConnection/given/a_server_sent_event_hub_connection.js +15 -4
- package/dist/esm/queries/for_ServerSentEventHubConnection/given/a_server_sent_event_hub_connection.js.map +1 -1
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_a_retired_event_source_fires/ignores_connected_and_error_callbacks.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_a_retired_event_source_fires/ignores_connected_and_error_callbacks.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_a_retired_event_source_fires/ignores_connected_and_error_callbacks.js +44 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_a_retired_event_source_fires/ignores_connected_and_error_callbacks.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_query_is_replaced.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_query_is_replaced.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_query_is_replaced.js +74 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_query_is_replaced.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_query_is_unsubscribed.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_query_is_unsubscribed.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_query_is_unsubscribed.js +74 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_query_is_unsubscribed.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_stale_request_is_rejected.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_stale_request_is_rejected.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_stale_request_is_rejected.js +59 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_stale_request_is_rejected.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_stale_request_returns_non_ok.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_stale_request_returns_non_ok.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_stale_request_returns_non_ok.js +58 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_stale_request_returns_non_ok.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_disposing/cleans_up_resources.js +6 -3
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_disposing/cleans_up_resources.js.map +1 -1
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.js +23 -6
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.js.map +1 -1
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_reconnecting/after_error.js +20 -5
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_reconnecting/after_error.js.map +1 -1
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_reconnecting/and_an_immediate_open_wins_the_backoff_race.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_reconnecting/and_an_immediate_open_wins_the_backoff_race.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_reconnecting/and_an_immediate_open_wins_the_backoff_race.js +20 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_reconnecting/and_an_immediate_open_wins_the_backoff_race.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_replacing_a_subscription/ignores_messages_from_the_retired_generation.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_replacing_a_subscription/ignores_messages_from_the_retired_generation.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_replacing_a_subscription/ignores_messages_from_the_retired_generation.js +68 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_replacing_a_subscription/ignores_messages_from_the_retired_generation.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_subscribing/sends_subscribe_post.js +38 -13
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_subscribing/sends_subscribe_post.js.map +1 -1
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_subscription_revisions_are_not_advertised/uses_legacy_protocol.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_subscription_revisions_are_not_advertised/uses_legacy_protocol.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_subscription_revisions_are_not_advertised/uses_legacy_protocol.js +54 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_subscription_revisions_are_not_advertised/uses_legacy_protocol.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_unsubscribing/the_only_query.js +18 -4
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_unsubscribing/the_only_query.js.map +1 -1
- package/dist/esm/queries/for_WebSocketHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.js +22 -5
- package/dist/esm/queries/for_WebSocketHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.js.map +1 -1
- package/dist/esm/queries/for_WebSocketHubConnection/when_reconnecting/ignores_a_pending_reconnect_and_stale_socket_callbacks.d.ts +2 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_reconnecting/ignores_a_pending_reconnect_and_stale_socket_callbacks.d.ts.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_reconnecting/ignores_a_pending_reconnect_and_stale_socket_callbacks.js +108 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_reconnecting/ignores_a_pending_reconnect_and_stale_socket_callbacks.js.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_reconnecting/replaces_a_closing_socket_safely.d.ts +2 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_reconnecting/replaces_a_closing_socket_safely.d.ts.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_reconnecting/replaces_a_closing_socket_safely.js +33 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_reconnecting/replaces_a_closing_socket_safely.js.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_reconnecting/resubscribes_all_queries.js +26 -4
- package/dist/esm/queries/for_WebSocketHubConnection/when_reconnecting/resubscribes_all_queries.js.map +1 -1
- package/dist/esm/queries/for_WebSocketHubConnection/when_replacing_a_subscription/ignores_stale_result_unauthorized_and_error.d.ts +2 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_replacing_a_subscription/ignores_stale_result_unauthorized_and_error.d.ts.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_replacing_a_subscription/ignores_stale_result_unauthorized_and_error.js +62 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_replacing_a_subscription/ignores_stale_result_unauthorized_and_error.js.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_subscribing/to_a_query.js +18 -5
- package/dist/esm/queries/for_WebSocketHubConnection/when_subscribing/to_a_query.js.map +1 -1
- package/dist/esm/queries/for_WebSocketHubConnection/when_subscription_revisions_are_supported/upgrades_active_subscriptions_to_strict_mode.d.ts +2 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_subscription_revisions_are_supported/upgrades_active_subscriptions_to_strict_mode.d.ts.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_subscription_revisions_are_supported/upgrades_active_subscriptions_to_strict_mode.js +56 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_subscription_revisions_are_supported/upgrades_active_subscriptions_to_strict_mode.js.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_unsubscribing/the_only_query.js +16 -3
- package/dist/esm/queries/for_WebSocketHubConnection/when_unsubscribing/the_only_query.js.map +1 -1
- package/dist/esm/queries/for_WebSocketHubConnection/when_unsubscribing/with_revision_support_not_advertised.d.ts +2 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_unsubscribing/with_revision_support_not_advertised.d.ts.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_unsubscribing/with_revision_support_not_advertised.js +33 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_unsubscribing/with_revision_support_not_advertised.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/queries/IQueryResult.ts +10 -0
- package/queries/ObservableQueryFor.ts +54 -26
- package/queries/QueryInstanceCache.ts +42 -19
- package/queries/QueryResult.ts +145 -79
- package/queries/QueryResultWithState.ts +32 -9
- package/queries/ServerSentEventHubConnection.ts +270 -83
- package/queries/WebSocketHubConnection.ts +188 -56
- package/queries/for_ObservableQueryFor/given/TestQueries.ts +30 -1
- package/queries/for_ObservableQueryFor/given/an_observable_query_for.ts +3 -0
- package/queries/for_ObservableQueryFor/when_performing/with_a_not_ready_result.ts +46 -0
- package/queries/for_ObservableQueryFor/when_receiving_a_result/and_the_model_has_a_calendar_collection.ts +76 -0
- package/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_and_sse_transport.ts +91 -57
- package/queries/for_ObservableQueryFor/when_subscribing/with_direct_mode_disabled_and_sse_transport.ts +125 -53
- package/queries/for_ObservableQueryFor/when_subscribing/with_web_socket_hub_payload_without_readiness.ts +107 -0
- package/queries/for_QueryInstanceCache/when_setting_last_result/with_only_readiness_changed.ts +63 -0
- package/queries/for_QueryResult/when_constructing_from_a_server_result/with_readiness_false.ts +25 -0
- package/queries/for_QueryResult/when_constructing_from_a_server_result/without_readiness.ts +24 -0
- package/queries/for_QueryResultWithState/when_creating_from_query_result/with_readiness_false.ts +28 -0
- package/queries/for_QueryResultWithState/when_creating_from_query_result/without_readiness.ts +25 -0
- package/queries/for_ServerSentEventHubConnection/given/a_deferred_promise.ts +15 -0
- package/queries/for_ServerSentEventHubConnection/given/a_server_sent_event_hub_connection.ts +18 -7
- package/queries/for_ServerSentEventHubConnection/when_a_retired_event_source_fires/ignores_connected_and_error_callbacks.ts +59 -0
- package/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_query_is_replaced.ts +113 -0
- package/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_query_is_unsubscribed.ts +109 -0
- package/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_stale_request_is_rejected.ts +81 -0
- package/queries/for_ServerSentEventHubConnection/when_connection_changes_while_subscribe_is_in_flight/and_the_stale_request_returns_non_ok.ts +83 -0
- package/queries/for_ServerSentEventHubConnection/when_disposing/cleans_up_resources.ts +30 -21
- package/queries/for_ServerSentEventHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.ts +56 -32
- package/queries/for_ServerSentEventHubConnection/when_reconnecting/after_error.ts +23 -6
- package/queries/for_ServerSentEventHubConnection/when_reconnecting/and_an_immediate_open_wins_the_backoff_race.ts +41 -0
- package/queries/for_ServerSentEventHubConnection/when_replacing_a_subscription/ignores_messages_from_the_retired_generation.ts +92 -0
- package/queries/for_ServerSentEventHubConnection/when_subscribing/sends_subscribe_post.ts +69 -30
- package/queries/for_ServerSentEventHubConnection/when_subscription_revisions_are_not_advertised/uses_legacy_protocol.ts +69 -0
- package/queries/for_ServerSentEventHubConnection/when_unsubscribing/the_only_query.ts +43 -24
- package/queries/for_WebSocketHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.ts +53 -29
- package/queries/for_WebSocketHubConnection/when_reconnecting/ignores_a_pending_reconnect_and_stale_socket_callbacks.ts +131 -0
- package/queries/for_WebSocketHubConnection/when_reconnecting/replaces_a_closing_socket_safely.ts +39 -0
- package/queries/for_WebSocketHubConnection/when_reconnecting/resubscribes_all_queries.ts +72 -36
- package/queries/for_WebSocketHubConnection/when_replacing_a_subscription/ignores_stale_result_unauthorized_and_error.ts +88 -0
- package/queries/for_WebSocketHubConnection/when_subscribing/to_a_query.ts +54 -27
- package/queries/for_WebSocketHubConnection/when_subscription_revisions_are_supported/upgrades_active_subscriptions_to_strict_mode.ts +72 -0
- package/queries/for_WebSocketHubConnection/when_unsubscribing/the_only_query.ts +43 -18
- package/queries/for_WebSocketHubConnection/when_unsubscribing/with_revision_support_not_advertised.ts +44 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import sinon from 'sinon';
|
|
2
|
+
import { a_web_socket_hub_connection } from '../given/a_web_socket_hub_connection';
|
|
3
|
+
import { given } from '../../../given';
|
|
4
|
+
import { HubMessageType } from '../../WebSocketHubConnection';
|
|
5
|
+
describe('when stale frames arrive after a WebSocket subscription is replaced', given(a_web_socket_hub_connection, (context) => {
|
|
6
|
+
const queryId = 'query-a';
|
|
7
|
+
let originalCallback;
|
|
8
|
+
let replacementCallback;
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
context.setup();
|
|
11
|
+
sinon.stub(console, 'warn');
|
|
12
|
+
sinon.stub(console, 'error');
|
|
13
|
+
originalCallback = sinon.stub();
|
|
14
|
+
replacementCallback = sinon.stub();
|
|
15
|
+
context.connection.subscribe(queryId, { queryName: 'Original' }, originalCallback);
|
|
16
|
+
context.simulateOpen();
|
|
17
|
+
context.simulateMessage({
|
|
18
|
+
type: HubMessageType.Connected,
|
|
19
|
+
supportsSubscriptionRevisions: true,
|
|
20
|
+
});
|
|
21
|
+
const originalRevision = sentMessage(1).revision;
|
|
22
|
+
context.connection.subscribe(queryId, { queryName: 'Replacement' }, replacementCallback);
|
|
23
|
+
const replacementRevision = sentMessage(2).revision;
|
|
24
|
+
context.simulateMessage({
|
|
25
|
+
type: HubMessageType.QueryResult,
|
|
26
|
+
queryId,
|
|
27
|
+
revision: originalRevision,
|
|
28
|
+
payload: { data: ['stale'] },
|
|
29
|
+
});
|
|
30
|
+
context.simulateMessage({
|
|
31
|
+
type: HubMessageType.Unauthorized,
|
|
32
|
+
queryId,
|
|
33
|
+
revision: originalRevision,
|
|
34
|
+
});
|
|
35
|
+
context.simulateMessage({
|
|
36
|
+
type: HubMessageType.Error,
|
|
37
|
+
queryId,
|
|
38
|
+
revision: originalRevision,
|
|
39
|
+
payload: 'stale',
|
|
40
|
+
});
|
|
41
|
+
context.simulateMessage({
|
|
42
|
+
type: HubMessageType.QueryResult,
|
|
43
|
+
queryId,
|
|
44
|
+
revision: replacementRevision,
|
|
45
|
+
payload: { data: ['current'] },
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
afterEach(() => sinon.restore());
|
|
49
|
+
it('should not deliver the stale result', () => originalCallback.called.should.be.false);
|
|
50
|
+
it('should deliver the replacement result', () => replacementCallback.calledOnce.should.be.true);
|
|
51
|
+
it('should retain the replacement after stale unauthorized', () => context.connection.queryCount.should.equal(1));
|
|
52
|
+
it('should not log the stale error', () => console.error.called.should.be.false);
|
|
53
|
+
function sentMessage(index) {
|
|
54
|
+
try {
|
|
55
|
+
return JSON.parse(context.fakeSocket.send.getCall(index).args[0]);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
throw new Error('Expected a valid hub message', { cause: error });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}));
|
|
62
|
+
//# sourceMappingURL=ignores_stale_result_unauthorized_and_error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ignores_stale_result_unauthorized_and_error.js","sourceRoot":"","sources":["../../../../../queries/for_WebSocketHubConnection/when_replacing_a_subscription/ignores_stale_result_unauthorized_and_error.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAmB,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE/E,QAAQ,CACJ,qEAAqE,EACrE,KAAK,CAAC,2BAA2B,EAAE,CAAC,OAAO,E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;IACL,CAAC;AACL,CAAC,CAAC,CACL,CAAC"}
|
|
@@ -2,7 +2,7 @@ import sinon from 'sinon';
|
|
|
2
2
|
import { a_web_socket_hub_connection } from '../given/a_web_socket_hub_connection';
|
|
3
3
|
import { given } from '../../../given';
|
|
4
4
|
import { HubMessageType } from '../../WebSocketHubConnection';
|
|
5
|
-
describe('when subscribing to a query', given(a_web_socket_hub_connection, context => {
|
|
5
|
+
describe('when subscribing to a query', given(a_web_socket_hub_connection, (context) => {
|
|
6
6
|
const queryId = 'q1';
|
|
7
7
|
const request = { queryName: 'MyQuery', arguments: {} };
|
|
8
8
|
let callback;
|
|
@@ -14,16 +14,29 @@ describe('when subscribing to a query', given(a_web_socket_hub_connection, conte
|
|
|
14
14
|
});
|
|
15
15
|
afterEach(() => sinon.restore());
|
|
16
16
|
it('should open a WebSocket', () => context.WebSocketStub.calledOnce.should.be.true);
|
|
17
|
-
it('should send a subscribe message once the socket opens', () => {
|
|
18
|
-
context.fakeSocket.send.calledOnce.should.
|
|
19
|
-
const msg =
|
|
17
|
+
it('should send a legacy subscribe message once the socket opens', () => {
|
|
18
|
+
context.fakeSocket.send.calledOnce.should.equal(true);
|
|
19
|
+
const msg = getSentMessage();
|
|
20
20
|
msg.type.should.equal(HubMessageType.Subscribe);
|
|
21
21
|
msg.queryId.should.equal(queryId);
|
|
22
|
+
(msg.revision === undefined).should.equal(true);
|
|
22
23
|
});
|
|
24
|
+
function getSentMessage() {
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(context.fakeSocket.send.firstCall.args[0]);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
throw new Error('Expected a valid hub message', { cause: error });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
23
32
|
describe('when a query result message arrives', () => {
|
|
24
33
|
const result = { isSuccess: true, data: [1, 2, 3] };
|
|
25
34
|
beforeEach(() => {
|
|
26
|
-
context.simulateMessage({
|
|
35
|
+
context.simulateMessage({
|
|
36
|
+
type: HubMessageType.QueryResult,
|
|
37
|
+
queryId,
|
|
38
|
+
payload: result,
|
|
39
|
+
});
|
|
27
40
|
});
|
|
28
41
|
it('should invoke the callback with the result', () => callback.calledOnce.should.be.true);
|
|
29
42
|
it('should pass the result payload', () => callback.getCall(0).args[0].should.deep.equal(result));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to_a_query.js","sourceRoot":"","sources":["../../../../../queries/for_WebSocketHubConnection/when_subscribing/to_a_query.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,QAAQ,
|
|
1
|
+
{"version":3,"file":"to_a_query.js","sourceRoot":"","sources":["../../../../../queries/for_WebSocketHubConnection/when_subscribing/to_a_query.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,QAAQ,CACJ,6BAA6B,EAC7B,KAAK,CAAC,2BAA2B,EAAE,CAAC,OAAO,EAAE,EAAE;IAC3C,MAAM,OAAO,GAAG,IAAI,CAAC;IACrB,MAAM,OAAO,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IACxD,IAAI,QAAyB,CAAC;IAE9B,UAAU,CAAC,GAAG,EAAE;QACZ,QAAQ,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,EA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U,CAAC,GAAG,EAAE;YACZ,OAAO,CAAC,eAAe,CAAC;gBACpB,IAAI,EAAE,cAAc,CAAC,WAAW;gBAChC,OAAO;gBACP,OAAO,EAAE,MAAM;aAClB,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE,CAClD,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QACxC,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE,CACtC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrades_active_subscriptions_to_strict_mode.d.ts","sourceRoot":"","sources":["../../../../../queries/for_WebSocketHubConnection/when_subscription_revisions_are_supported/upgrades_active_subscriptions_to_strict_mode.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import sinon from 'sinon';
|
|
2
|
+
import { given } from '../../../given';
|
|
3
|
+
import { HubMessageType } from '../../WebSocketHubConnection';
|
|
4
|
+
import { a_web_socket_hub_connection } from '../given/a_web_socket_hub_connection';
|
|
5
|
+
describe('when the WebSocket server advertises subscription revision support', given(a_web_socket_hub_connection, (context) => {
|
|
6
|
+
const queryId = 'query-1';
|
|
7
|
+
let callback;
|
|
8
|
+
let revision;
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
context.setup();
|
|
11
|
+
callback = sinon.stub();
|
|
12
|
+
context.connection.subscribe(queryId, { queryName: 'MyQuery' }, callback);
|
|
13
|
+
context.simulateOpen();
|
|
14
|
+
context.simulateMessage({
|
|
15
|
+
type: HubMessageType.Connected,
|
|
16
|
+
supportsSubscriptionRevisions: true,
|
|
17
|
+
});
|
|
18
|
+
const upgradedRevision = sentMessage(1).revision;
|
|
19
|
+
if (upgradedRevision === undefined) {
|
|
20
|
+
throw new Error('Expected the upgraded subscription to carry a revision');
|
|
21
|
+
}
|
|
22
|
+
revision = upgradedRevision;
|
|
23
|
+
context.simulateMessage({
|
|
24
|
+
type: HubMessageType.QueryResult,
|
|
25
|
+
queryId,
|
|
26
|
+
payload: { data: ['legacy'] },
|
|
27
|
+
});
|
|
28
|
+
context.simulateMessage({
|
|
29
|
+
type: HubMessageType.QueryResult,
|
|
30
|
+
queryId,
|
|
31
|
+
revision,
|
|
32
|
+
payload: { data: ['current'] },
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
afterEach(() => sinon.restore());
|
|
36
|
+
it('should initially subscribe without a revision for older servers', () => (sentMessage(0).revision === undefined).should.equal(true));
|
|
37
|
+
it('should replace the legacy subscription with its current revision', () => {
|
|
38
|
+
const message = sentMessage(1);
|
|
39
|
+
message.type.should.equal(HubMessageType.Subscribe);
|
|
40
|
+
(message.queryId === queryId).should.equal(true);
|
|
41
|
+
revision.should.be.greaterThan(0);
|
|
42
|
+
});
|
|
43
|
+
it('should ignore the temporary legacy result and deliver the strict result once', () => {
|
|
44
|
+
callback.calledOnce.should.equal(true);
|
|
45
|
+
callback.firstCall.args[0].should.deep.equal({ data: ['current'] });
|
|
46
|
+
});
|
|
47
|
+
function sentMessage(index) {
|
|
48
|
+
try {
|
|
49
|
+
return JSON.parse(context.fakeSocket.send.getCall(index).args[0]);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
throw new Error('Expected a valid hub message', { cause: error });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}));
|
|
56
|
+
//# sourceMappingURL=upgrades_active_subscriptions_to_strict_mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrades_active_subscriptions_to_strict_mode.js","sourceRoot":"","sources":["../../../../../queries/for_WebSocketH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;QACpB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,8BAA8B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACtE,CAAC;IACL,CAAC;AACL,CAAC,CAAC,CACL,CAAC"}
|
|
@@ -2,22 +2,35 @@ import sinon from 'sinon';
|
|
|
2
2
|
import { a_web_socket_hub_connection } from '../given/a_web_socket_hub_connection';
|
|
3
3
|
import { given } from '../../../given';
|
|
4
4
|
import { HubMessageType } from '../../WebSocketHubConnection';
|
|
5
|
-
describe('when unsubscribing the only query', given(a_web_socket_hub_connection, context => {
|
|
5
|
+
describe('when unsubscribing the only query', given(a_web_socket_hub_connection, (context) => {
|
|
6
6
|
const queryId = 'q1';
|
|
7
7
|
beforeEach(() => {
|
|
8
8
|
context.setup();
|
|
9
9
|
context.connection.subscribe(queryId, { queryName: 'MyQuery' }, sinon.stub());
|
|
10
10
|
context.simulateOpen();
|
|
11
|
+
context.simulateMessage({
|
|
12
|
+
type: HubMessageType.Connected,
|
|
13
|
+
supportsSubscriptionRevisions: true,
|
|
14
|
+
});
|
|
11
15
|
context.fakeSocket.send.reset();
|
|
12
16
|
context.connection.unsubscribe(queryId);
|
|
13
17
|
});
|
|
14
18
|
afterEach(() => sinon.restore());
|
|
15
19
|
it('should send an unsubscribe message', () => {
|
|
16
|
-
context.fakeSocket.send.calledOnce.should.
|
|
17
|
-
const msg =
|
|
20
|
+
context.fakeSocket.send.calledOnce.should.equal(true);
|
|
21
|
+
const msg = getUnsubscribeMessage();
|
|
18
22
|
msg.type.should.equal(HubMessageType.Unsubscribe);
|
|
19
23
|
msg.queryId.should.equal(queryId);
|
|
24
|
+
msg.revision.should.equal(1);
|
|
20
25
|
});
|
|
21
26
|
it('should close the underlying socket', () => context.fakeSocket.close.calledOnce.should.be.true);
|
|
27
|
+
function getUnsubscribeMessage() {
|
|
28
|
+
try {
|
|
29
|
+
return JSON.parse(context.fakeSocket.send.firstCall.args[0]);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
throw new Error('Expected a valid unsubscribe message', { cause: error });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
22
35
|
}));
|
|
23
36
|
//# sourceMappingURL=the_only_query.js.map
|
package/dist/esm/queries/for_WebSocketHubConnection/when_unsubscribing/the_only_query.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"the_only_query.js","sourceRoot":"","sources":["../../../../../queries/for_WebSocketHubConnection/when_unsubscribing/the_only_query.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,QAAQ,
|
|
1
|
+
{"version":3,"file":"the_only_query.js","sourceRoot":"","sources":["../../../../../queries/for_WebSocketHubConnection/when_unsubscribing/the_only_query.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,QAAQ,CACJ,mCAAmC,EACnC,KAAK,CAAC,2BAA2B,EAAE,CAAC,OAAO,EAAE,EAAE;IAC3C,MAAM,OAAO,GAAG,IAAI,CAAC;IAErB,UAAU,CAAC,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9E,OAAO,CAAC,YAAY,EAAE,CAAC;QACvB,OAAO,C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AAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_revision_support_not_advertised.d.ts","sourceRoot":"","sources":["../../../../../queries/for_WebSocketHubConnection/when_unsubscribing/with_revision_support_not_advertised.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import sinon from 'sinon';
|
|
2
|
+
import { given } from '../../../given';
|
|
3
|
+
import { HubMessageType } from '../../WebSocketHubConnection';
|
|
4
|
+
import { a_web_socket_hub_connection } from '../given/a_web_socket_hub_connection';
|
|
5
|
+
describe('when unsubscribing before the WebSocket server advertises revision support', given(a_web_socket_hub_connection, (context) => {
|
|
6
|
+
const queryId = 'query-1';
|
|
7
|
+
let message;
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
context.setup();
|
|
10
|
+
context.connection.subscribe(queryId, { queryName: 'MyQuery' }, sinon.stub());
|
|
11
|
+
context.simulateOpen();
|
|
12
|
+
context.fakeSocket.send.resetHistory();
|
|
13
|
+
context.connection.unsubscribe(queryId);
|
|
14
|
+
message = sentMessage();
|
|
15
|
+
});
|
|
16
|
+
afterEach(() => sinon.restore());
|
|
17
|
+
it('should send a legacy unsubscribe', () => {
|
|
18
|
+
message.type.should.equal(HubMessageType.Unsubscribe);
|
|
19
|
+
(message.queryId === queryId).should.equal(true);
|
|
20
|
+
(message.revision === undefined).should.equal(true);
|
|
21
|
+
});
|
|
22
|
+
function sentMessage() {
|
|
23
|
+
try {
|
|
24
|
+
return JSON.parse(context.fakeSocket.send.firstCall.args[0]);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw new Error('Expected a valid unsubscribe message', {
|
|
28
|
+
cause: error,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}));
|
|
33
|
+
//# sourceMappingURL=with_revision_support_not_advertised.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_revision_support_not_advertised.js","sourceRoot":"","sources":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