@splitsoftware/splitio-commons 1.13.0 → 1.13.1

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/CHANGES.txt CHANGED
@@ -1,3 +1,6 @@
1
+ 1.13.1 (January 10, 2024)
2
+ - Updated client `destroy` method to release SDK key immediately and avoid unexpected warning logs when a factory is created with the same SDK key after the previous one was destroyed.
3
+
1
4
  1.13.0 (January 4, 2024)
2
5
  - Removed the `getOptions` method from the `IPlatform` interface to simplify implementation. Request options can be handled within the `getFetch` method.
3
6
 
@@ -45,17 +45,16 @@ function sdkClientFactory(params, isSharedClient) {
45
45
  destroy: function () {
46
46
  // Mark the SDK as destroyed immediately
47
47
  sdkReadinessManager.readinessManager.destroy();
48
- // record stat before flushing data
49
- if (!isSharedClient)
48
+ // For main client, release the SDK Key and record stat before flushing data
49
+ if (!isSharedClient) {
50
+ (0, apiKey_1.releaseApiKey)(settings.core.authorizationKey);
50
51
  telemetryTracker.sessionLength();
52
+ }
51
53
  // Stop background jobs
52
54
  syncManager && syncManager.stop();
53
55
  return __flush().then(function () {
54
56
  // Cleanup event listeners
55
57
  signalListener && signalListener.stop();
56
- // Release the SDK Key if it is the main client
57
- if (!isSharedClient)
58
- (0, apiKey_1.releaseApiKey)(settings.core.authorizationKey);
59
58
  // @TODO stop only if last client is destroyed
60
59
  if (uniqueKeysTracker)
61
60
  uniqueKeysTracker.stop();
@@ -42,17 +42,16 @@ export function sdkClientFactory(params, isSharedClient) {
42
42
  destroy: function () {
43
43
  // Mark the SDK as destroyed immediately
44
44
  sdkReadinessManager.readinessManager.destroy();
45
- // record stat before flushing data
46
- if (!isSharedClient)
45
+ // For main client, release the SDK Key and record stat before flushing data
46
+ if (!isSharedClient) {
47
+ releaseApiKey(settings.core.authorizationKey);
47
48
  telemetryTracker.sessionLength();
49
+ }
48
50
  // Stop background jobs
49
51
  syncManager && syncManager.stop();
50
52
  return __flush().then(function () {
51
53
  // Cleanup event listeners
52
54
  signalListener && signalListener.stop();
53
- // Release the SDK Key if it is the main client
54
- if (!isSharedClient)
55
- releaseApiKey(settings.core.authorizationKey);
56
55
  // @TODO stop only if last client is destroyed
57
56
  if (uniqueKeysTracker)
58
57
  uniqueKeysTracker.stop();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splitsoftware/splitio-commons",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "Split Javascript SDK common components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -56,8 +56,11 @@ export function sdkClientFactory(params: ISdkFactoryContext, isSharedClient?: bo
56
56
  // Mark the SDK as destroyed immediately
57
57
  sdkReadinessManager.readinessManager.destroy();
58
58
 
59
- // record stat before flushing data
60
- if (!isSharedClient) telemetryTracker.sessionLength();
59
+ // For main client, release the SDK Key and record stat before flushing data
60
+ if (!isSharedClient) {
61
+ releaseApiKey(settings.core.authorizationKey);
62
+ telemetryTracker.sessionLength();
63
+ }
61
64
 
62
65
  // Stop background jobs
63
66
  syncManager && syncManager.stop();
@@ -66,9 +69,6 @@ export function sdkClientFactory(params: ISdkFactoryContext, isSharedClient?: bo
66
69
  // Cleanup event listeners
67
70
  signalListener && signalListener.stop();
68
71
 
69
- // Release the SDK Key if it is the main client
70
- if (!isSharedClient) releaseApiKey(settings.core.authorizationKey);
71
-
72
72
  // @TODO stop only if last client is destroyed
73
73
  if (uniqueKeysTracker) uniqueKeysTracker.stop();
74
74