@cratis/arc 20.1.1 → 20.1.4
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 +7 -0
- package/dist/cjs/Globals.d.ts +2 -0
- package/dist/cjs/Globals.d.ts.map +1 -1
- package/dist/cjs/Globals.js +1 -0
- package/dist/cjs/Globals.js.map +1 -1
- package/dist/cjs/identity/IdentityProvider.d.ts +2 -1
- package/dist/cjs/identity/IdentityProvider.d.ts.map +1 -1
- package/dist/cjs/identity/IdentityProvider.js +16 -2
- package/dist/cjs/identity/IdentityProvider.js.map +1 -1
- package/dist/cjs/identity/for_IdentityProvider/when_refreshing/with_unauthorized_response.d.ts +2 -0
- package/dist/cjs/identity/for_IdentityProvider/when_refreshing/with_unauthorized_response.d.ts.map +1 -0
- package/dist/cjs/queries/QueryInstanceCache.d.ts +8 -0
- package/dist/cjs/queries/QueryInstanceCache.d.ts.map +1 -1
- package/dist/cjs/queries/QueryInstanceCache.js +70 -9
- package/dist/cjs/queries/QueryInstanceCache.js.map +1 -1
- package/dist/cjs/queries/QueryResult.d.ts +1 -0
- package/dist/cjs/queries/QueryResult.d.ts.map +1 -1
- package/dist/cjs/queries/QueryResult.js +18 -0
- package/dist/cjs/queries/QueryResult.js.map +1 -1
- package/dist/cjs/queries/ServerSentEventHubConnection.d.ts +1 -0
- package/dist/cjs/queries/ServerSentEventHubConnection.d.ts.map +1 -1
- package/dist/cjs/queries/ServerSentEventHubConnection.js +16 -2
- package/dist/cjs/queries/ServerSentEventHubConnection.js.map +1 -1
- package/dist/cjs/queries/WebSocketHubConnection.d.ts +1 -0
- package/dist/cjs/queries/WebSocketHubConnection.d.ts.map +1 -1
- package/dist/cjs/queries/WebSocketHubConnection.js +11 -0
- package/dist/cjs/queries/WebSocketHubConnection.js.map +1 -1
- package/dist/cjs/queries/for_QueryInstanceCache/when_acquiring/after_release_in_development_mode.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_acquiring/after_release_in_development_mode.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_deferring_dispose/with_cancellation_before_timeout.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_deferring_dispose/with_cancellation_before_timeout.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_deferring_dispose/without_cancellation.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_deferring_dispose/without_cancellation.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_disposing/an_empty_cache.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_disposing/an_empty_cache.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_disposing/with_active_subscriptions.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_disposing/with_active_subscriptions.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_disposing/with_pending_deferred_cleanup.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_disposing/with_pending_deferred_cleanup.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber_in_development_mode.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber_in_development_mode.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber_outside_development_mode.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber_outside_development_mode.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_active_subscriptions.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_active_subscriptions.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_no_subscriptions.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_no_subscriptions.d.ts.map +1 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_pending_deferred_cleanup.d.ts +2 -0
- package/dist/cjs/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_pending_deferred_cleanup.d.ts.map +1 -0
- package/dist/cjs/queries/for_ServerSentEventHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.d.ts +2 -0
- package/dist/cjs/queries/for_ServerSentEventHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.d.ts.map +1 -0
- package/dist/cjs/queries/for_WebSocketHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.d.ts +2 -0
- package/dist/cjs/queries/for_WebSocketHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.d.ts.map +1 -0
- package/dist/esm/Globals.d.ts +2 -0
- package/dist/esm/Globals.d.ts.map +1 -1
- package/dist/esm/Globals.js +1 -0
- package/dist/esm/Globals.js.map +1 -1
- package/dist/esm/identity/IdentityProvider.d.ts +2 -1
- package/dist/esm/identity/IdentityProvider.d.ts.map +1 -1
- package/dist/esm/identity/IdentityProvider.js +16 -2
- package/dist/esm/identity/IdentityProvider.js.map +1 -1
- package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_unauthorized_response.d.ts +2 -0
- package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_unauthorized_response.d.ts.map +1 -0
- package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_unauthorized_response.js +19 -0
- package/dist/esm/identity/for_IdentityProvider/when_refreshing/with_unauthorized_response.js.map +1 -0
- package/dist/esm/queries/QueryInstanceCache.d.ts +8 -0
- package/dist/esm/queries/QueryInstanceCache.d.ts.map +1 -1
- package/dist/esm/queries/QueryInstanceCache.js +70 -9
- package/dist/esm/queries/QueryInstanceCache.js.map +1 -1
- package/dist/esm/queries/QueryResult.d.ts +1 -0
- package/dist/esm/queries/QueryResult.d.ts.map +1 -1
- package/dist/esm/queries/QueryResult.js +18 -0
- package/dist/esm/queries/QueryResult.js.map +1 -1
- package/dist/esm/queries/ServerSentEventHubConnection.d.ts +1 -0
- package/dist/esm/queries/ServerSentEventHubConnection.d.ts.map +1 -1
- package/dist/esm/queries/ServerSentEventHubConnection.js +16 -2
- package/dist/esm/queries/ServerSentEventHubConnection.js.map +1 -1
- package/dist/esm/queries/WebSocketHubConnection.d.ts +1 -0
- package/dist/esm/queries/WebSocketHubConnection.d.ts.map +1 -1
- package/dist/esm/queries/WebSocketHubConnection.js +11 -0
- package/dist/esm/queries/WebSocketHubConnection.js.map +1 -1
- package/dist/esm/queries/for_QueryInstanceCache/when_acquiring/after_release_in_development_mode.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_acquiring/after_release_in_development_mode.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_acquiring/after_release_in_development_mode.js +23 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_acquiring/after_release_in_development_mode.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_deferring_dispose/with_cancellation_before_timeout.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_deferring_dispose/with_cancellation_before_timeout.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_deferring_dispose/with_cancellation_before_timeout.js +23 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_deferring_dispose/with_cancellation_before_timeout.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_deferring_dispose/without_cancellation.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_deferring_dispose/without_cancellation.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_deferring_dispose/without_cancellation.js +21 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_deferring_dispose/without_cancellation.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_disposing/an_empty_cache.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_disposing/an_empty_cache.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_disposing/an_empty_cache.js +17 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_disposing/an_empty_cache.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_disposing/with_active_subscriptions.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_disposing/with_active_subscriptions.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_disposing/with_active_subscriptions.js +23 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_disposing/with_active_subscriptions.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_disposing/with_pending_deferred_cleanup.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_disposing/with_pending_deferred_cleanup.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_disposing/with_pending_deferred_cleanup.js +22 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_disposing/with_pending_deferred_cleanup.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber_in_development_mode.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber_in_development_mode.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber_in_development_mode.js +28 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber_in_development_mode.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber_outside_development_mode.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber_outside_development_mode.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber_outside_development_mode.js +25 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber_outside_development_mode.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_active_subscriptions.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_active_subscriptions.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_active_subscriptions.js +25 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_active_subscriptions.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_no_subscriptions.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_no_subscriptions.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_no_subscriptions.js +12 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_no_subscriptions.js.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_pending_deferred_cleanup.d.ts +2 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_pending_deferred_cleanup.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_pending_deferred_cleanup.js +23 -0
- package/dist/esm/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_pending_deferred_cleanup.js.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.d.ts +2 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.d.ts.map +1 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.js +35 -0
- package/dist/esm/queries/for_ServerSentEventHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.js.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.d.ts +2 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.d.ts.map +1 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.js +33 -0
- package/dist/esm/queries/for_WebSocketHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/identity/IdentityProvider.ts +23 -2
- package/identity/for_IdentityProvider/when_refreshing/with_unauthorized_response.ts +26 -0
- package/package.json +1 -1
- package/queries/QueryInstanceCache.ts +133 -12
- package/queries/QueryResult.ts +19 -0
- package/queries/ServerSentEventHubConnection.ts +18 -2
- package/queries/WebSocketHubConnection.ts +11 -0
- package/queries/for_QueryInstanceCache/when_acquiring/after_release_in_development_mode.ts +31 -0
- package/queries/for_QueryInstanceCache/when_deferring_dispose/with_cancellation_before_timeout.ts +31 -0
- package/queries/for_QueryInstanceCache/when_deferring_dispose/without_cancellation.ts +28 -0
- package/queries/for_QueryInstanceCache/when_disposing/an_empty_cache.ts +21 -0
- package/queries/for_QueryInstanceCache/when_disposing/with_active_subscriptions.ts +30 -0
- package/queries/for_QueryInstanceCache/when_disposing/with_pending_deferred_cleanup.ts +31 -0
- package/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber_in_development_mode.ts +36 -0
- package/queries/for_QueryInstanceCache/when_releasing/the_only_subscriber_outside_development_mode.ts +33 -0
- package/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_active_subscriptions.ts +32 -0
- package/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_no_subscriptions.ts +18 -0
- package/queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_pending_deferred_cleanup.ts +33 -0
- package/queries/for_ServerSentEventHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.ts +51 -0
- package/queries/for_WebSocketHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.ts +47 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_cancellation_before_timeout.d.ts","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_deferring_dispose/with_cancellation_before_timeout.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { QueryInstanceCache } from '../../QueryInstanceCache';
|
|
2
|
+
describe('when canceling deferred dispose before timeout fires', () => {
|
|
3
|
+
let cache;
|
|
4
|
+
let teardownCalled;
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
vi.useFakeTimers();
|
|
7
|
+
teardownCalled = false;
|
|
8
|
+
cache = new QueryInstanceCache(true);
|
|
9
|
+
cache.getOrCreate('MyQuery::', () => ({}));
|
|
10
|
+
cache.acquire('MyQuery::');
|
|
11
|
+
cache.setTeardown('MyQuery::', () => { teardownCalled = true; });
|
|
12
|
+
cache.deferDispose();
|
|
13
|
+
cache.cancelPendingDispose();
|
|
14
|
+
vi.advanceTimersByTime(0);
|
|
15
|
+
});
|
|
16
|
+
afterEach(() => {
|
|
17
|
+
vi.useRealTimers();
|
|
18
|
+
});
|
|
19
|
+
it('should not call teardown', () => teardownCalled.should.be.false);
|
|
20
|
+
it('should keep the entry', () => cache.has('MyQuery::').should.be.true);
|
|
21
|
+
it('should still report as subscribed', () => cache.isSubscribed('MyQuery::').should.be.true);
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=with_cancellation_before_timeout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_cancellation_before_timeout.js","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_deferring_dispose/with_cancellation_before_timeout.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,QAAQ,CAAC,sDAAsD,EAAE,GAAG,EAAE;IAClE,IAAI,KAAyB,CAAC;IAC9B,IAAI,cAAuB,CAAC;IAE5B,UAAU,CAAC,GAAG,EAAE;QACZ,EAAE,CAAC,aAAa,EAAE,CAAC;QACnB,cAAc,GAAG,KAAK,CAAC;QACvB,KAAK,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACrC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3C,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC3B,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,GAAG,EAAE,GAAG,cAAc,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAGjE,KAAK,CAAC,YAAY,EAAE,CAAC;QACrB,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC7B,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACX,EAAE,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACrE,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACzE,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AAClG,CAAC,CAAC,CAAC"}
|
package/dist/esm/queries/for_QueryInstanceCache/when_deferring_dispose/without_cancellation.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"without_cancellation.d.ts","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_deferring_dispose/without_cancellation.ts"],"names":[],"mappings":""}
|
package/dist/esm/queries/for_QueryInstanceCache/when_deferring_dispose/without_cancellation.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { QueryInstanceCache } from '../../QueryInstanceCache';
|
|
2
|
+
describe('when deferring dispose without cancellation', () => {
|
|
3
|
+
let cache;
|
|
4
|
+
let teardownCalled;
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
vi.useFakeTimers();
|
|
7
|
+
teardownCalled = false;
|
|
8
|
+
cache = new QueryInstanceCache(true);
|
|
9
|
+
cache.getOrCreate('MyQuery::', () => ({}));
|
|
10
|
+
cache.acquire('MyQuery::');
|
|
11
|
+
cache.setTeardown('MyQuery::', () => { teardownCalled = true; });
|
|
12
|
+
cache.deferDispose();
|
|
13
|
+
vi.advanceTimersByTime(0);
|
|
14
|
+
});
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
vi.useRealTimers();
|
|
17
|
+
});
|
|
18
|
+
it('should call teardown', () => teardownCalled.should.be.true);
|
|
19
|
+
it('should evict the entry', () => cache.has('MyQuery::').should.be.false);
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=without_cancellation.js.map
|
package/dist/esm/queries/for_QueryInstanceCache/when_deferring_dispose/without_cancellation.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"without_cancellation.js","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_deferring_dispose/without_cancellation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,QAAQ,CAAC,6CAA6C,EAAE,GAAG,EAAE;IACzD,IAAI,KAAyB,CAAC;IAC9B,IAAI,cAAuB,CAAC;IAE5B,UAAU,CAAC,GAAG,EAAE;QACZ,EAAE,CAAC,aAAa,EAAE,CAAC;QACnB,cAAc,GAAG,KAAK,CAAC;QACvB,KAAK,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACrC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3C,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC3B,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,GAAG,EAAE,GAAG,cAAc,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAEjE,KAAK,CAAC,YAAY,EAAE,CAAC;QACrB,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACX,EAAE,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAChE,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AAC/E,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"an_empty_cache.d.ts","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_disposing/an_empty_cache.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { QueryInstanceCache } from '../../QueryInstanceCache';
|
|
2
|
+
describe('when disposing an empty cache', () => {
|
|
3
|
+
let cache;
|
|
4
|
+
let threwError;
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
threwError = false;
|
|
7
|
+
cache = new QueryInstanceCache();
|
|
8
|
+
try {
|
|
9
|
+
cache.dispose();
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
threwError = true;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
it('should not throw', () => threwError.should.be.false);
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=an_empty_cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"an_empty_cache.js","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_disposing/an_empty_cache.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC3C,IAAI,KAAyB,CAAC;IAC9B,IAAI,UAAmB,CAAC;IAExB,UAAU,CAAC,GAAG,EAAE;QACZ,UAAU,GAAG,KAAK,CAAC;QACnB,KAAK,GAAG,IAAI,kBAAkB,EAAE,CAAC;QACjC,IAAI,CAAC;YACD,KAAK,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC;QAAC,MAAM,CAAC;YACL,UAAU,GAAG,IAAI,CAAC;QACtB,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AAC7D,CAAC,CAAC,CAAC"}
|
package/dist/esm/queries/for_QueryInstanceCache/when_disposing/with_active_subscriptions.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_active_subscriptions.d.ts","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_disposing/with_active_subscriptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { QueryInstanceCache } from '../../QueryInstanceCache';
|
|
2
|
+
describe('when disposing with active subscriptions', () => {
|
|
3
|
+
let cache;
|
|
4
|
+
let firstTeardownCalled;
|
|
5
|
+
let secondTeardownCalled;
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
firstTeardownCalled = false;
|
|
8
|
+
secondTeardownCalled = false;
|
|
9
|
+
cache = new QueryInstanceCache();
|
|
10
|
+
cache.getOrCreate('QueryA::', () => ({}));
|
|
11
|
+
cache.acquire('QueryA::');
|
|
12
|
+
cache.setTeardown('QueryA::', () => { firstTeardownCalled = true; });
|
|
13
|
+
cache.getOrCreate('QueryB::', () => ({}));
|
|
14
|
+
cache.acquire('QueryB::');
|
|
15
|
+
cache.setTeardown('QueryB::', () => { secondTeardownCalled = true; });
|
|
16
|
+
cache.dispose();
|
|
17
|
+
});
|
|
18
|
+
it('should call teardown for the first entry', () => firstTeardownCalled.should.be.true);
|
|
19
|
+
it('should call teardown for the second entry', () => secondTeardownCalled.should.be.true);
|
|
20
|
+
it('should evict the first entry', () => cache.has('QueryA::').should.be.false);
|
|
21
|
+
it('should evict the second entry', () => cache.has('QueryB::').should.be.false);
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=with_active_subscriptions.js.map
|
package/dist/esm/queries/for_QueryInstanceCache/when_disposing/with_active_subscriptions.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_active_subscriptions.js","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_disposing/with_active_subscriptions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,QAAQ,CAAC,0CAA0C,EAAE,GAAG,EAAE;IACtD,IAAI,KAAyB,CAAC;IAC9B,IAAI,mBAA4B,CAAC;IACjC,IAAI,oBAA6B,CAAC;IAElC,UAAU,CAAC,GAAG,EAAE;QACZ,mBAAmB,GAAG,KAAK,CAAC;QAC5B,oBAAoB,GAAG,KAAK,CAAC;QAC7B,KAAK,GAAG,IAAI,kBAAkB,EAAE,CAAC;QACjC,KAAK,CAAC,WAAW,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1C,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC1B,KAAK,CAAC,WAAW,CAAC,UAAU,EAAE,GAAG,EAAE,GAAG,mBAAmB,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAErE,KAAK,CAAC,WAAW,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1C,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC1B,KAAK,CAAC,WAAW,CAAC,UAAU,EAAE,GAAG,EAAE,GAAG,oBAAoB,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAEtE,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACzF,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAC3F,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAChF,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AACrF,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_pending_deferred_cleanup.d.ts","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_disposing/with_pending_deferred_cleanup.ts"],"names":[],"mappings":""}
|
package/dist/esm/queries/for_QueryInstanceCache/when_disposing/with_pending_deferred_cleanup.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { QueryInstanceCache } from '../../QueryInstanceCache';
|
|
2
|
+
describe('when disposing with pending deferred cleanup', () => {
|
|
3
|
+
let cache;
|
|
4
|
+
let teardownCalled;
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
vi.useFakeTimers();
|
|
7
|
+
teardownCalled = 0;
|
|
8
|
+
cache = new QueryInstanceCache(true);
|
|
9
|
+
cache.getOrCreate('MyQuery::', () => ({}));
|
|
10
|
+
cache.acquire('MyQuery::');
|
|
11
|
+
cache.setTeardown('MyQuery::', () => { teardownCalled++; });
|
|
12
|
+
cache.release('MyQuery::');
|
|
13
|
+
cache.dispose();
|
|
14
|
+
vi.advanceTimersByTime(0);
|
|
15
|
+
});
|
|
16
|
+
afterEach(() => {
|
|
17
|
+
vi.useRealTimers();
|
|
18
|
+
});
|
|
19
|
+
it('should call teardown exactly once', () => teardownCalled.should.equal(1));
|
|
20
|
+
it('should evict the entry', () => cache.has('MyQuery::').should.be.false);
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=with_pending_deferred_cleanup.js.map
|
package/dist/esm/queries/for_QueryInstanceCache/when_disposing/with_pending_deferred_cleanup.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_pending_deferred_cleanup.js","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_disposing/with_pending_deferred_cleanup.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,QAAQ,CAAC,8CAA8C,EAAE,GAAG,EAAE;IAC1D,IAAI,KAAyB,CAAC;IAC9B,IAAI,cAAsB,CAAC;IAE3B,UAAU,CAAC,GAAG,EAAE;QACZ,EAAE,CAAC,aAAa,EAAE,CAAC;QACnB,cAAc,GAAG,CAAC,CAAC;QACnB,KAAK,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACrC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3C,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC3B,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5D,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAI3B,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACX,EAAE,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9E,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AAC/E,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"the_only_subscriber_in_development_mode.d.ts","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_releasing/the_only_subscriber_in_development_mode.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { QueryInstanceCache } from '../../QueryInstanceCache';
|
|
2
|
+
describe('when releasing the only subscriber in development mode', () => {
|
|
3
|
+
let cache;
|
|
4
|
+
let teardownCalled;
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
vi.useFakeTimers();
|
|
7
|
+
teardownCalled = false;
|
|
8
|
+
cache = new QueryInstanceCache(true);
|
|
9
|
+
cache.getOrCreate('MyQuery::', () => ({}));
|
|
10
|
+
cache.acquire('MyQuery::');
|
|
11
|
+
cache.setTeardown('MyQuery::', () => { teardownCalled = true; });
|
|
12
|
+
cache.release('MyQuery::');
|
|
13
|
+
});
|
|
14
|
+
afterEach(() => {
|
|
15
|
+
vi.useRealTimers();
|
|
16
|
+
});
|
|
17
|
+
it('should not call teardown synchronously', () => teardownCalled.should.be.false);
|
|
18
|
+
it('should keep the entry before the timer fires', () => cache.has('MyQuery::').should.be.true);
|
|
19
|
+
it('should still report as subscribed before the timer fires', () => cache.isSubscribed('MyQuery::').should.be.true);
|
|
20
|
+
describe('and the deferred timer fires', () => {
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
vi.advanceTimersByTime(0);
|
|
23
|
+
});
|
|
24
|
+
it('should call teardown', () => teardownCalled.should.be.true);
|
|
25
|
+
it('should evict the entry', () => cache.has('MyQuery::').should.be.false);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=the_only_subscriber_in_development_mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"the_only_subscriber_in_development_mode.js","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_releasing/the_only_subscriber_in_development_mode.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,QAAQ,CAAC,wDAAwD,EAAE,GAAG,EAAE;IACpE,IAAI,KAAyB,CAAC;IAC9B,IAAI,cAAuB,CAAC;IAE5B,UAAU,CAAC,GAAG,EAAE;QACZ,EAAE,CAAC,aAAa,EAAE,CAAC;QACnB,cAAc,GAAG,KAAK,CAAC;QACvB,KAAK,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACrC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3C,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC3B,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,GAAG,EAAE,GAAG,cAAc,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACjE,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACX,EAAE,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACnF,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAChG,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAErH,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;QAC1C,UAAU,CAAC,GAAG,EAAE;YACZ,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QAChE,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"the_only_subscriber_outside_development_mode.d.ts","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_releasing/the_only_subscriber_outside_development_mode.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { QueryInstanceCache } from '../../QueryInstanceCache';
|
|
2
|
+
describe('when releasing the only subscriber outside development mode', () => {
|
|
3
|
+
let cache;
|
|
4
|
+
let teardownCalled;
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
vi.useFakeTimers();
|
|
7
|
+
teardownCalled = false;
|
|
8
|
+
cache = new QueryInstanceCache(false);
|
|
9
|
+
cache.getOrCreate('MyQuery::', () => ({}));
|
|
10
|
+
cache.acquire('MyQuery::');
|
|
11
|
+
cache.setTeardown('MyQuery::', () => { teardownCalled = true; });
|
|
12
|
+
cache.release('MyQuery::');
|
|
13
|
+
});
|
|
14
|
+
afterEach(() => {
|
|
15
|
+
vi.useRealTimers();
|
|
16
|
+
});
|
|
17
|
+
it('should call teardown synchronously', () => teardownCalled.should.be.true);
|
|
18
|
+
describe('and the deferred timer fires', () => {
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
vi.advanceTimersByTime(0);
|
|
21
|
+
});
|
|
22
|
+
it('should evict the entry', () => cache.has('MyQuery::').should.be.false);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=the_only_subscriber_outside_development_mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"the_only_subscriber_outside_development_mode.js","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_releasing/the_only_subscriber_outside_development_mode.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,QAAQ,CAAC,6DAA6D,EAAE,GAAG,EAAE;IACzE,IAAI,KAAyB,CAAC;IAC9B,IAAI,cAAuB,CAAC;IAE5B,UAAU,CAAC,GAAG,EAAE;QACZ,EAAE,CAAC,aAAa,EAAE,CAAC;QACnB,cAAc,GAAG,KAAK,CAAC;QACvB,KAAK,GAAG,IAAI,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACtC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3C,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC3B,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,GAAG,EAAE,GAAG,cAAc,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACjE,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACX,EAAE,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAE9E,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;QAC1C,UAAU,CAAC,GAAG,EAAE;YACZ,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_active_subscriptions.d.ts","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_active_subscriptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { QueryInstanceCache } from '../../QueryInstanceCache';
|
|
2
|
+
describe('when tearing down all subscriptions with active subscriptions', () => {
|
|
3
|
+
let cache;
|
|
4
|
+
let firstTeardownCalled;
|
|
5
|
+
let secondTeardownCalled;
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
firstTeardownCalled = false;
|
|
8
|
+
secondTeardownCalled = false;
|
|
9
|
+
cache = new QueryInstanceCache();
|
|
10
|
+
cache.getOrCreate('QueryA::', () => ({}));
|
|
11
|
+
cache.acquire('QueryA::');
|
|
12
|
+
cache.setTeardown('QueryA::', () => { firstTeardownCalled = true; });
|
|
13
|
+
cache.getOrCreate('QueryB::', () => ({}));
|
|
14
|
+
cache.acquire('QueryB::');
|
|
15
|
+
cache.setTeardown('QueryB::', () => { secondTeardownCalled = true; });
|
|
16
|
+
cache.teardownAllSubscriptions();
|
|
17
|
+
});
|
|
18
|
+
it('should call teardown for the first entry', () => firstTeardownCalled.should.be.true);
|
|
19
|
+
it('should call teardown for the second entry', () => secondTeardownCalled.should.be.true);
|
|
20
|
+
it('should keep the first entry', () => cache.has('QueryA::').should.be.true);
|
|
21
|
+
it('should keep the second entry', () => cache.has('QueryB::').should.be.true);
|
|
22
|
+
it('should mark the first entry as not subscribed', () => cache.isSubscribed('QueryA::').should.be.false);
|
|
23
|
+
it('should mark the second entry as not subscribed', () => cache.isSubscribed('QueryB::').should.be.false);
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=with_active_subscriptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_active_subscriptions.js","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_active_subscriptions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,QAAQ,CAAC,+DAA+D,EAAE,GAAG,EAAE;IAC3E,IAAI,KAAyB,CAAC;IAC9B,IAAI,mBAA4B,CAAC;IACjC,IAAI,oBAA6B,CAAC;IAElC,UAAU,CAAC,GAAG,EAAE;QACZ,mBAAmB,GAAG,KAAK,CAAC;QAC5B,oBAAoB,GAAG,KAAK,CAAC;QAC7B,KAAK,GAAG,IAAI,kBAAkB,EAAE,CAAC;QACjC,KAAK,CAAC,WAAW,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1C,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC1B,KAAK,CAAC,WAAW,CAAC,UAAU,EAAE,GAAG,EAAE,GAAG,mBAAmB,GAAG,IAAI,CAAC,CAAC,CAAC,CAA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ions/with_no_subscriptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QueryInstanceCache } from '../../QueryInstanceCache';
|
|
2
|
+
describe('when tearing down all subscriptions with no subscriptions', () => {
|
|
3
|
+
let cache;
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
cache = new QueryInstanceCache();
|
|
6
|
+
cache.getOrCreate('MyQuery::', () => ({}));
|
|
7
|
+
cache.teardownAllSubscriptions();
|
|
8
|
+
});
|
|
9
|
+
it('should keep the entry', () => cache.has('MyQuery::').should.be.true);
|
|
10
|
+
it('should still report as not subscribed', () => cache.isSubscribed('MyQuery::').should.be.false);
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=with_no_subscriptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_no_subscriptions.js","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_no_subscriptions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,QAAQ,CAAC,2DAA2D,EAAE,GAAG,EAAE;IACvE,IAAI,KAAyB,CAAC;IAE9B,UAAU,CAAC,GAAG,EAAE;QACZ,KAAK,GAAG,IAAI,kBAAkB,EAAE,CAAC;QACjC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAE3C,KAAK,CAAC,wBAAwB,EAAE,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACzE,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AACvG,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_pending_deferred_cleanup.d.ts","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_pending_deferred_cleanup.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { QueryInstanceCache } from '../../QueryInstanceCache';
|
|
2
|
+
describe('when tearing down all subscriptions with pending deferred cleanup', () => {
|
|
3
|
+
let cache;
|
|
4
|
+
let teardownCalled;
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
vi.useFakeTimers();
|
|
7
|
+
teardownCalled = false;
|
|
8
|
+
cache = new QueryInstanceCache(true);
|
|
9
|
+
cache.getOrCreate('MyQuery::', () => ({}));
|
|
10
|
+
cache.acquire('MyQuery::');
|
|
11
|
+
cache.setTeardown('MyQuery::', () => { teardownCalled = true; });
|
|
12
|
+
cache.release('MyQuery::');
|
|
13
|
+
cache.teardownAllSubscriptions();
|
|
14
|
+
vi.advanceTimersByTime(0);
|
|
15
|
+
});
|
|
16
|
+
afterEach(() => {
|
|
17
|
+
vi.useRealTimers();
|
|
18
|
+
});
|
|
19
|
+
it('should call teardown', () => teardownCalled.should.be.true);
|
|
20
|
+
it('should keep the entry', () => cache.has('MyQuery::').should.be.true);
|
|
21
|
+
it('should mark the entry as not subscribed', () => cache.isSubscribed('MyQuery::').should.be.false);
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=with_pending_deferred_cleanup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_pending_deferred_cleanup.js","sourceRoot":"","sources":["../../../../../queries/for_QueryInstanceCache/when_tearing_down_all_subscriptions/with_pending_deferred_cleanup.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,QAAQ,CAAC,mEAAmE,EAAE,GAAG,EAAE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_receiving_unauthorized/notifies_subscriber_and_removes_subscription.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import sinon from 'sinon';
|
|
2
|
+
import { a_server_sent_event_hub_connection } from '../given/a_server_sent_event_hub_connection';
|
|
3
|
+
import { given } from '../../../given';
|
|
4
|
+
import { HubMessageType } from '../../WebSocketHubConnection';
|
|
5
|
+
describe('when receiving unauthorized for a subscribed query', given(a_server_sent_event_hub_connection, context => {
|
|
6
|
+
let callback;
|
|
7
|
+
let receivedResult;
|
|
8
|
+
const queryId = 'q-auth-1';
|
|
9
|
+
const connectionId = 'conn-123';
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
context.setup();
|
|
12
|
+
callback = sinon.stub();
|
|
13
|
+
context.connection.subscribe(queryId, { queryName: 'SecureQuery' }, callback);
|
|
14
|
+
context.simulateOpen();
|
|
15
|
+
context.simulateMessage({ type: HubMessageType.Connected, payload: connectionId });
|
|
16
|
+
context.simulateMessage({ type: HubMessageType.Unauthorized, queryId });
|
|
17
|
+
receivedResult = callback.firstCall?.args[0];
|
|
18
|
+
});
|
|
19
|
+
afterEach(() => {
|
|
20
|
+
sinon.restore();
|
|
21
|
+
});
|
|
22
|
+
it('should invoke the subscriber callback', () => {
|
|
23
|
+
callback.calledOnce.should.be.true;
|
|
24
|
+
});
|
|
25
|
+
it('should report isAuthorized as false', () => {
|
|
26
|
+
receivedResult.isAuthorized.should.be.false;
|
|
27
|
+
});
|
|
28
|
+
it('should report isSuccess as false', () => {
|
|
29
|
+
receivedResult.isSuccess.should.be.false;
|
|
30
|
+
});
|
|
31
|
+
it('should remove the subscription', () => {
|
|
32
|
+
context.connection.queryCount.should.equal(0);
|
|
33
|
+
});
|
|
34
|
+
}));
|
|
35
|
+
//# sourceMappingURL=notifies_subscriber_and_removes_subscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifies_subscriber_and_removes_subscription.js","sourceRoot":"","sources":["../../../../../que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AAI,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC3C,cAAe,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QACxC,cAAe,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACtC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifies_subscriber_and_removes_subscription.d.ts","sourceRoot":"","sources":["../../../../../queries/for_WebSocketHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
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 receiving unauthorized for a subscribed query', given(a_web_socket_hub_connection, context => {
|
|
6
|
+
let callback;
|
|
7
|
+
let receivedResult;
|
|
8
|
+
const queryId = 'q-auth-1';
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
context.setup();
|
|
11
|
+
callback = sinon.stub();
|
|
12
|
+
context.connection.subscribe(queryId, { queryName: 'SecureQuery' }, callback);
|
|
13
|
+
context.simulateOpen();
|
|
14
|
+
context.simulateMessage({ type: HubMessageType.Unauthorized, queryId });
|
|
15
|
+
receivedResult = callback.firstCall?.args[0];
|
|
16
|
+
});
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
sinon.restore();
|
|
19
|
+
});
|
|
20
|
+
it('should invoke the subscriber callback', () => {
|
|
21
|
+
callback.calledOnce.should.be.true;
|
|
22
|
+
});
|
|
23
|
+
it('should report isAuthorized as false', () => {
|
|
24
|
+
receivedResult.isAuthorized.should.be.false;
|
|
25
|
+
});
|
|
26
|
+
it('should report isSuccess as false', () => {
|
|
27
|
+
receivedResult.isSuccess.should.be.false;
|
|
28
|
+
});
|
|
29
|
+
it('should remove the subscription', () => {
|
|
30
|
+
context.connection.queryCount.should.equal(0);
|
|
31
|
+
});
|
|
32
|
+
}));
|
|
33
|
+
//# sourceMappingURL=notifies_subscriber_and_removes_subscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifies_subscriber_and_removes_subscription.js","sourceRoot":"","sources":["../../../../../queries/for_WebSocketHubConnection/when_receiving_unauthorized/notifies_subscriber_and_removes_subscription.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;AAG9D,QAAQ,CAAC,oDAAoD,EAAE,KAAK,CAAC,2BAA2B,EAAE,OAAO,CAAC,EAAE;IACxG,IAAI,QAAyB,CAAC;IAC9B,IAAI,cAAgD,CAAC;IACrD,MAAM,OAAO,GAAG,UAAU,CAAC;IAE3B,UAAU,CAAC,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,QAAQ,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAExB,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,EAAE,QAAQ,CAAC,CAAC;QAC9E,OAAO,CAAC,YAAY,EAAE,CAAC;QAGvB,OAAO,CA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