@splitsoftware/splitio-commons 3.0.0 → 3.0.1-rc.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.
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sdkLifecycleFactory = void 0;
4
4
  var apiKey_1 = require("../utils/inputValidation/apiKey");
5
+ var constants_1 = require("../utils/constants");
5
6
  var COOLDOWN_TIME_IN_MILLIS = 1000;
6
7
  /**
7
8
  * Creates an Sdk client, i.e., a base client with status, init, flush and destroy interface
@@ -10,7 +11,7 @@ function sdkLifecycleFactory(params, isSharedClient) {
10
11
  var sdkReadinessManager = params.sdkReadinessManager, syncManager = params.syncManager, storage = params.storage, settings = params.settings, telemetryTracker = params.telemetryTracker, impressionsTracker = params.impressionsTracker, platform = params.platform, serviceApi = params.serviceApi;
11
12
  var hasInit = false;
12
13
  var lastActionTime = 0;
13
- var signalListener = platform.SignalListener && new platform.SignalListener(params);
14
+ var signalListener = platform.SignalListener && settings.mode !== constants_1.LOCALHOST_MODE ? new platform.SignalListener(params) : undefined;
14
15
  function __cooldown(func, time) {
15
16
  var now = Date.now();
16
17
  //get the actual time elapsed in ms
@@ -7,9 +7,8 @@ var AbstractMySegmentsCacheSync_1 = require("../AbstractMySegmentsCacheSync");
7
7
  var constants_1 = require("./constants");
8
8
  var MySegmentsCacheInLocal = /** @class */ (function (_super) {
9
9
  tslib_1.__extends(MySegmentsCacheInLocal, _super);
10
- function MySegmentsCacheInLocal(log, keys, storage) {
10
+ function MySegmentsCacheInLocal(_log, keys, storage) {
11
11
  var _this = _super.call(this) || this;
12
- _this.log = log;
13
12
  _this.keys = keys;
14
13
  _this.storage = storage;
15
14
  return _this;
@@ -1,4 +1,5 @@
1
1
  import { releaseApiKey, validateAndTrackApiKey } from '../utils/inputValidation/apiKey';
2
+ import { LOCALHOST_MODE } from '../utils/constants';
2
3
  var COOLDOWN_TIME_IN_MILLIS = 1000;
3
4
  /**
4
5
  * Creates an Sdk client, i.e., a base client with status, init, flush and destroy interface
@@ -7,7 +8,7 @@ export function sdkLifecycleFactory(params, isSharedClient) {
7
8
  var sdkReadinessManager = params.sdkReadinessManager, syncManager = params.syncManager, storage = params.storage, settings = params.settings, telemetryTracker = params.telemetryTracker, impressionsTracker = params.impressionsTracker, platform = params.platform, serviceApi = params.serviceApi;
8
9
  var hasInit = false;
9
10
  var lastActionTime = 0;
10
- var signalListener = platform.SignalListener && new platform.SignalListener(params);
11
+ var signalListener = platform.SignalListener && settings.mode !== LOCALHOST_MODE ? new platform.SignalListener(params) : undefined;
11
12
  function __cooldown(func, time) {
12
13
  var now = Date.now();
13
14
  //get the actual time elapsed in ms
@@ -4,9 +4,8 @@ import { AbstractMySegmentsCacheSync } from '../AbstractMySegmentsCacheSync';
4
4
  import { DEFINED } from './constants';
5
5
  var MySegmentsCacheInLocal = /** @class */ (function (_super) {
6
6
  __extends(MySegmentsCacheInLocal, _super);
7
- function MySegmentsCacheInLocal(log, keys, storage) {
7
+ function MySegmentsCacheInLocal(_log, keys, storage) {
8
8
  var _this = _super.call(this) || this;
9
- _this.log = log;
10
9
  _this.keys = keys;
11
10
  _this.storage = storage;
12
11
  return _this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splitsoftware/splitio-commons",
3
- "version": "3.0.0",
3
+ "version": "3.0.1-rc.0",
4
4
  "description": "Split JavaScript SDK common components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -1,5 +1,6 @@
1
1
  import { releaseApiKey, validateAndTrackApiKey } from '../utils/inputValidation/apiKey';
2
2
  import { ISdkFactoryContext } from '../sdkFactory/types';
3
+ import { LOCALHOST_MODE } from '../utils/constants';
3
4
 
4
5
  const COOLDOWN_TIME_IN_MILLIS = 1000;
5
6
 
@@ -12,7 +13,7 @@ export function sdkLifecycleFactory(params: ISdkFactoryContext, isSharedClient?:
12
13
  let hasInit = false;
13
14
  let lastActionTime = 0;
14
15
 
15
- const signalListener = platform.SignalListener && new platform.SignalListener(params);
16
+ const signalListener = platform.SignalListener && settings.mode !== LOCALHOST_MODE ? new platform.SignalListener(params) : undefined;
16
17
 
17
18
  function __cooldown(func: Function, time: number) {
18
19
  const now = Date.now();
@@ -105,11 +105,7 @@ export interface ISdkFactoryParams {
105
105
 
106
106
  // Sdk client method factory.
107
107
  // It Allows to distinguish SDK clients with the client-side API (`IBrowserSDK` and `IBrowserAsyncSDK`) or server-side API (`ISDK` and `IAsyncSDK`).
108
- sdkClientMethodFactory: (params: ISdkFactoryContext) => (
109
- { (): SplitIO.IBrowserClient & { init(): void }; (key: SplitIO.SplitKey): SplitIO.IBrowserClient & { init(): void }; } |
110
- (() => SplitIO.IClient & { init(): void }) |
111
- (() => SplitIO.IAsyncClient & { init(): void })
112
- )
108
+ sdkClientMethodFactory: (params: ISdkFactoryContext) => ({ (): SplitIO.IBrowserClient; (key: SplitIO.SplitKey): SplitIO.IBrowserClient; } | (() => SplitIO.IClient) | (() => SplitIO.IAsyncClient))
113
109
 
114
110
  // Impression observer factory.
115
111
  impressionsObserverFactory: () => IImpressionObserver
@@ -8,12 +8,10 @@ import { StorageAdapter } from '../types';
8
8
  export class MySegmentsCacheInLocal extends AbstractMySegmentsCacheSync {
9
9
 
10
10
  private readonly keys: MySegmentsKeyBuilder;
11
- private readonly log: ILogger;
12
11
  private readonly storage: StorageAdapter;
13
12
 
14
- constructor(log: ILogger, keys: MySegmentsKeyBuilder, storage: StorageAdapter) {
13
+ constructor(_log: ILogger, keys: MySegmentsKeyBuilder, storage: StorageAdapter) {
15
14
  super();
16
- this.log = log;
17
15
  this.keys = keys;
18
16
  this.storage = storage;
19
17
  }