@splitsoftware/splitio-commons 2.0.0-rc.5 → 2.0.0-rc.6

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.
@@ -4,11 +4,6 @@ exports.UniqueKeysCacheInMemoryCS = void 0;
4
4
  var constants_1 = require("../inRedis/constants");
5
5
  var sets_1 = require("../../utils/lang/sets");
6
6
  var UniqueKeysCacheInMemoryCS = /** @class */ (function () {
7
- /**
8
- *
9
- * @param impressionsQueueSize - number of queued impressions to call onFullQueueCb.
10
- * Default value is 0, that means no maximum value, in case we want to avoid this being triggered.
11
- */
12
7
  function UniqueKeysCacheInMemoryCS(uniqueKeysQueueSize) {
13
8
  if (uniqueKeysQueueSize === void 0) { uniqueKeysQueueSize = constants_1.DEFAULT_CACHE_SIZE; }
14
9
  this.uniqueTrackerSize = 0;
@@ -1,11 +1,6 @@
1
1
  import { DEFAULT_CACHE_SIZE } from '../inRedis/constants';
2
2
  import { setToArray } from '../../utils/lang/sets';
3
3
  var UniqueKeysCacheInMemoryCS = /** @class */ (function () {
4
- /**
5
- *
6
- * @param impressionsQueueSize - number of queued impressions to call onFullQueueCb.
7
- * Default value is 0, that means no maximum value, in case we want to avoid this being triggered.
8
- */
9
4
  function UniqueKeysCacheInMemoryCS(uniqueKeysQueueSize) {
10
5
  if (uniqueKeysQueueSize === void 0) { uniqueKeysQueueSize = DEFAULT_CACHE_SIZE; }
11
6
  this.uniqueTrackerSize = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splitsoftware/splitio-commons",
3
- "version": "2.0.0-rc.5",
3
+ "version": "2.0.0-rc.6",
4
4
  "description": "Split JavaScript SDK common components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -25,7 +25,7 @@ function treatmentsNotReady(featureFlagNames: string[]) {
25
25
  /**
26
26
  * Creator of base client with getTreatments and track methods.
27
27
  */
28
- export function clientFactory(params: ISdkFactoryContext): SplitIO.INodeClient | SplitIO.INodeAsyncClient {
28
+ export function clientFactory(params: ISdkFactoryContext): SplitIO.IClient | SplitIO.IAsyncClient {
29
29
  const { sdkReadinessManager: { readinessManager }, storage, settings, impressionsTracker, eventTracker, telemetryTracker } = params;
30
30
  const { log, mode } = settings;
31
31
  const isAsync = isConsumerMode(mode);
@@ -199,5 +199,5 @@ export function clientFactory(params: ISdkFactoryContext): SplitIO.INodeClient |
199
199
  getTreatmentsByFlagSet,
200
200
  getTreatmentsWithConfigByFlagSet,
201
201
  track,
202
- } as SplitIO.INodeClient | SplitIO.INodeAsyncClient;
202
+ } as SplitIO.IClient | SplitIO.IAsyncClient;
203
203
  }
@@ -7,7 +7,7 @@ import { objectAssign } from '../utils/lang/objectAssign';
7
7
  /**
8
8
  * Add in memory attributes storage methods and combine them with any attribute received from the getTreatment/s call
9
9
  */
10
- export function clientAttributesDecoration<TClient extends SplitIO.INodeClient | SplitIO.INodeAsyncClient>(log: ILogger, client: TClient) {
10
+ export function clientAttributesDecoration<TClient extends SplitIO.IClient | SplitIO.IAsyncClient>(log: ILogger, client: TClient) {
11
11
 
12
12
  const attributeStorage = new AttributesCacheInMemory();
13
13
 
@@ -10,7 +10,7 @@ import { clientAttributesDecoration } from './clientAttributesDecoration';
10
10
  * @param client - sync client instance
11
11
  * @param key - validated split key
12
12
  */
13
- export function clientCSDecorator(log: ILogger, client: SplitIO.INodeClient, key: SplitIO.SplitKey): SplitIO.IClient {
13
+ export function clientCSDecorator(log: ILogger, client: SplitIO.IClient, key: SplitIO.SplitKey): SplitIO.IBrowserClient {
14
14
 
15
15
  let clientCS = clientAttributesDecoration(log, client);
16
16
 
@@ -30,5 +30,5 @@ export function clientCSDecorator(log: ILogger, client: SplitIO.INodeClient, key
30
30
  // Not part of the public API. These properties are used to support other modules (e.g., Split Suite)
31
31
  isClientSide: true,
32
32
  key
33
- }) as SplitIO.IClient;
33
+ }) as SplitIO.IBrowserClient;
34
34
  }
@@ -24,7 +24,7 @@ import { validateFlagSets } from '../utils/settingsValidation/splitFilters';
24
24
  * Decorator that validates the input before actually executing the client methods.
25
25
  * We should "guard" the client here, while not polluting the "real" implementation of those methods.
26
26
  */
27
- export function clientInputValidationDecorator<TClient extends SplitIO.INodeClient | SplitIO.INodeAsyncClient>(settings: ISettings, client: TClient, readinessManager: IReadinessManager): TClient {
27
+ export function clientInputValidationDecorator<TClient extends SplitIO.IClient | SplitIO.IAsyncClient>(settings: ISettings, client: TClient, readinessManager: IReadinessManager): TClient {
28
28
 
29
29
  const { log, mode } = settings;
30
30
  const isAsync = isConsumerMode(mode);
@@ -10,7 +10,7 @@ const COOLDOWN_TIME_IN_MILLIS = 1000;
10
10
  /**
11
11
  * Creates an Sdk client, i.e., a base client with status and destroy interface
12
12
  */
13
- export function sdkClientFactory(params: ISdkFactoryContext, isSharedClient?: boolean): SplitIO.INodeClient | SplitIO.INodeAsyncClient {
13
+ export function sdkClientFactory(params: ISdkFactoryContext, isSharedClient?: boolean): SplitIO.IClient | SplitIO.IAsyncClient {
14
14
  const { sdkReadinessManager, syncManager, storage, signalListener, settings, telemetryTracker, uniqueKeysTracker } = params;
15
15
 
16
16
  let lastActionTime = 0;
@@ -6,7 +6,7 @@ import { ISdkFactoryContext } from '../sdkFactory/types';
6
6
  /**
7
7
  * Factory of client method for server-side SDKs
8
8
  */
9
- export function sdkClientMethodFactory(params: ISdkFactoryContext): () => SplitIO.INodeClient | SplitIO.INodeAsyncClient {
9
+ export function sdkClientMethodFactory(params: ISdkFactoryContext): () => SplitIO.IClient | SplitIO.IAsyncClient {
10
10
  const log = params.settings.log;
11
11
  const clientInstance = sdkClientFactory(params);
12
12
 
@@ -14,12 +14,12 @@ import { buildInstanceId } from './identity';
14
14
  * Factory of client method for the client-side API variant where TT is ignored.
15
15
  * Therefore, clients don't have a bound TT for the track method.
16
16
  */
17
- export function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: SplitIO.SplitKey) => SplitIO.IClient {
17
+ export function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: SplitIO.SplitKey) => SplitIO.IBrowserClient {
18
18
  const { clients, storage, syncManager, sdkReadinessManager, settings: { core: { key }, log } } = params;
19
19
 
20
20
  const mainClientInstance = clientCSDecorator(
21
21
  log,
22
- sdkClientFactory(params) as SplitIO.INodeClient,
22
+ sdkClientFactory(params) as SplitIO.IClient,
23
23
  key
24
24
  );
25
25
 
@@ -71,7 +71,7 @@ export function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: Spl
71
71
  sdkReadinessManager: sharedSdkReadiness,
72
72
  storage: sharedStorage || storage,
73
73
  syncManager: sharedSyncManager,
74
- }), true) as SplitIO.INodeClient,
74
+ }), true) as SplitIO.IClient,
75
75
  validKey
76
76
  );
77
77
 
@@ -80,6 +80,6 @@ export function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: Spl
80
80
  log.debug(RETRIEVE_CLIENT_EXISTING);
81
81
  }
82
82
 
83
- return clients[instanceId] as SplitIO.IClient;
83
+ return clients[instanceId] as SplitIO.IBrowserClient;
84
84
  };
85
85
  }
@@ -18,7 +18,7 @@ import { NONE, OPTIMIZED } from '../utils/constants';
18
18
  /**
19
19
  * Modular SDK factory
20
20
  */
21
- export function sdkFactory(params: ISdkFactoryParams): SplitIO.INodeSDK | SplitIO.INodeAsyncSDK | SplitIO.ISDK | SplitIO.IAsyncSDK {
21
+ export function sdkFactory(params: ISdkFactoryParams): SplitIO.ISDK | SplitIO.IAsyncSDK | SplitIO.IBrowserSDK | SplitIO.IBrowserAsyncSDK {
22
22
 
23
23
  const { settings, platform, storageFactory, splitApiFactory, extraProps,
24
24
  syncManagerFactory, SignalListener, impressionsObserverFactory,
@@ -79,7 +79,7 @@ export interface ISdkFactoryParams {
79
79
  platform: IPlatform,
80
80
 
81
81
  // Storage factory. The result storage type implies the type of the SDK:
82
- // sync SDK (`ISDK` and `INodeSDK`) with `IStorageSync`, and async SDK (`IAsyncSDK` and `INodeAsyncSDK`) with `IStorageAsync`
82
+ // sync SDK (`IBrowserSDK` and `ISDK`) with `IStorageSync`, and async SDK (`IBrowserAsyncSDK` and `IAsyncSDK`) with `IStorageAsync`
83
83
  storageFactory: (params: IStorageFactoryParams) => IStorageSync | IStorageAsync,
84
84
 
85
85
  // Factory of Split Api (HTTP Client Service).
@@ -94,9 +94,9 @@ export interface ISdkFactoryParams {
94
94
  // Sdk manager factory
95
95
  sdkManagerFactory: typeof sdkManagerFactory,
96
96
 
97
- // Sdk client method factory (ISDK::client method).
98
- // It Allows to distinguish SDK clients with the client-side API (`ISDK` and `IAsyncSDK`) or server-side API (`INodeSDK` and `INodeAsyncSDK`).
99
- sdkClientMethodFactory: (params: ISdkFactoryContext) => ({ (): SplitIO.IClient; (key: SplitIO.SplitKey): SplitIO.IClient; } | (() => SplitIO.INodeClient) | (() => SplitIO.INodeAsyncClient))
97
+ // Sdk client method factory.
98
+ // It Allows to distinguish SDK clients with the client-side API (`IBrowserSDK` and `IBrowserAsyncSDK`) or server-side API (`ISDK` and `IAsyncSDK`).
99
+ sdkClientMethodFactory: (params: ISdkFactoryContext) => ({ (): SplitIO.IBrowserClient; (key: SplitIO.SplitKey): SplitIO.IBrowserClient; } | (() => SplitIO.IClient) | (() => SplitIO.IAsyncClient))
100
100
 
101
101
  // Impression observer factory.
102
102
  impressionsObserverFactory: () => IImpressionObserver
@@ -10,11 +10,6 @@ export class UniqueKeysCacheInMemoryCS implements IUniqueKeysCacheBase {
10
10
  private uniqueTrackerSize = 0;
11
11
  private uniqueKeysTracker: { [userKey: string]: Set<string> } = {};
12
12
 
13
- /**
14
- *
15
- * @param impressionsQueueSize - number of queued impressions to call onFullQueueCb.
16
- * Default value is 0, that means no maximum value, in case we want to avoid this being triggered.
17
- */
18
13
  constructor(uniqueKeysQueueSize = DEFAULT_CACHE_SIZE) {
19
14
  this.maxStorage = uniqueKeysQueueSize;
20
15
  }
@@ -7,6 +7,442 @@ import { RequestOptions } from 'http';
7
7
  export as namespace SplitIO;
8
8
  export = SplitIO;
9
9
 
10
+ /**
11
+ * Common settings properties.
12
+ */
13
+ interface ISharedSettings {
14
+ /**
15
+ * The impression listener, which is optional. Whatever you provide here needs to comply with the SplitIO.IImpressionListener interface,
16
+ * which will check for the logImpression method.
17
+ *
18
+ * @defaultValue `undefined`
19
+ */
20
+ impressionListener?: SplitIO.IImpressionListener;
21
+ /**
22
+ * SDK synchronization settings.
23
+ */
24
+ sync?: {
25
+ /**
26
+ * List of feature flag filters. These filters are used to fetch a subset of the feature flag definitions in your environment, in order to reduce the delay of the SDK to be ready.
27
+ * This configuration is only meaningful when the SDK is working in "standalone" mode.
28
+ *
29
+ * Example:
30
+ * ```
31
+ * splitFilter: [
32
+ * { type: 'byName', values: ['my_feature_flag_1', 'my_feature_flag_2'] }, // will fetch feature flags named 'my_feature_flag_1' and 'my_feature_flag_2'
33
+ * ]
34
+ * ```
35
+ */
36
+ splitFilters?: SplitIO.SplitFilter[];
37
+ /**
38
+ * Impressions Collection Mode. Option to determine how impressions are going to be sent to Split servers.
39
+ * Possible values are 'DEBUG', 'OPTIMIZED', and 'NONE'.
40
+ * - DEBUG: will send all the impressions generated (recommended only for debugging purposes).
41
+ * - OPTIMIZED: will send unique impressions to Split servers, avoiding a considerable amount of traffic that duplicated impressions could generate.
42
+ * - NONE: will send unique keys evaluated per feature to Split servers instead of full blown impressions, avoiding a considerable amount of traffic that impressions could generate.
43
+ *
44
+ * @defaultValue `'OPTIMIZED'`
45
+ */
46
+ impressionsMode?: SplitIO.ImpressionsMode;
47
+ /**
48
+ * Custom options object for HTTP(S) requests.
49
+ * If provided, this object is merged with the options object passed by the SDK for EventSource and Fetch calls.
50
+ * This configuration has no effect in "consumer" mode, as no HTTP(S) requests are made by the SDK.
51
+ */
52
+ requestOptions?: {
53
+ /**
54
+ * Custom function called before each request, allowing you to add or update headers in SDK HTTP requests.
55
+ * Some headers, such as `SplitSDKVersion`, are required by the SDK and cannot be overridden.
56
+ * To pass multiple headers with the same name, combine their values into a single line, separated by commas. Example: `{ 'Authorization': 'value1, value2' }`
57
+ * Or provide keys with different cases since headers are case-insensitive. Example: `{ 'authorization': 'value1', 'Authorization': 'value2' }`
58
+ *
59
+ * NOTE: to pass custom headers to the streaming connection in Browser, you should polyfill the `window.EventSource` object with a library that supports headers,
60
+ * like https://www.npmjs.com/package/event-source-polyfill, since native EventSource does not support them and they will be ignored.
61
+ *
62
+ * @defaultValue `undefined`
63
+ *
64
+ * @param context - The context for the request, which contains the `headers` property object representing the current headers in the request.
65
+ * @returns An object representing a set of headers to be merged with the current headers.
66
+ *
67
+ * @example
68
+ * ```
69
+ * const getHeaderOverrides = (context) => {
70
+ * return {
71
+ * 'Authorization': context.headers['Authorization'] + ', other-value',
72
+ * 'custom-header': 'custom-value'
73
+ * };
74
+ * };
75
+ * ```
76
+ */
77
+ getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>;
78
+ };
79
+ };
80
+ /**
81
+ * List of URLs that the SDK will use as base for it's synchronization functionalities, applicable only when running as standalone and partial consumer modes.
82
+ * Do not change these settings unless you're working an advanced use case, like connecting to the Split proxy.
83
+ */
84
+ urls?: SplitIO.UrlSettings;
85
+ }
86
+ /**
87
+ * Common settings properties for SDKs with synchronous API (standalone and localhost modes).
88
+ */
89
+ interface ISyncSharedSettings extends ISharedSettings {
90
+ /**
91
+ * The SDK mode. When using the default in-memory storage or `InLocalStorage` as storage, the only possible value is "standalone", which is the default.
92
+ * For "localhost" mode, use "localhost" as authorizationKey.
93
+ *
94
+ * @defaultValue `'standalone'`
95
+ */
96
+ mode?: 'standalone';
97
+ /**
98
+ * Boolean flag to enable the streaming service as default synchronization mechanism. In the event of any issue with streaming,
99
+ * the SDK would fallback to the polling mechanism. If false, the SDK would poll for changes as usual without attempting to use streaming.
100
+ *
101
+ * @defaultValue `true`
102
+ */
103
+ streamingEnabled?: boolean;
104
+ /**
105
+ * SDK synchronization settings.
106
+ */
107
+ sync?: ISharedSettings['sync'] & {
108
+ /**
109
+ * Controls the SDK continuous synchronization flags.
110
+ *
111
+ * When `true` a running SDK will process rollout plan updates performed on the UI (default).
112
+ * When false it'll just fetch all data upon init.
113
+ *
114
+ * @defaultValue `true`
115
+ */
116
+ enabled?: boolean;
117
+ };
118
+ }
119
+ /**
120
+ * Common settings properties for SDKs with pluggable configuration.
121
+ */
122
+ interface IPluggableSettings {
123
+ /**
124
+ * Boolean value to indicate whether the logger should be enabled or disabled by default, or a log level string or a Logger object.
125
+ * Passing a logger object is required to get descriptive log messages. Otherwise most logs will print with message codes.
126
+ * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#logging}.
127
+ *
128
+ * Examples:
129
+ * ```
130
+ * config.debug = true
131
+ * config.debug = 'WARN'
132
+ * config.debug = ErrorLogger()
133
+ * ```
134
+ *
135
+ * @defaultValue `false`
136
+ */
137
+ debug?: boolean | SplitIO.LogLevel | SplitIO.ILogger;
138
+ /**
139
+ * Defines an optional list of factory functions used to instantiate SDK integrations.
140
+ *
141
+ * NOTE: at the moment there are not integrations to plug in.
142
+ */
143
+ integrations?: SplitIO.IntegrationFactory[];
144
+ }
145
+ /**
146
+ * Common settings properties for SDKs without pluggable configuration.
147
+ */
148
+ interface INonPluggableSettings {
149
+ /**
150
+ * Boolean value to indicate whether the logger should be enabled or disabled, or a log level string.
151
+ *
152
+ * Examples:
153
+ * ```
154
+ * config.debug = true
155
+ * config.debug = 'WARN'
156
+ * ```
157
+ *
158
+ * @defaultValue `false`
159
+ */
160
+ debug?: boolean | SplitIO.LogLevel;
161
+ }
162
+ /**
163
+ * Common settings properties for server-side SDKs.
164
+ */
165
+ interface IServerSideSharedSettings {
166
+ /**
167
+ * SDK Core settings for NodeJS.
168
+ */
169
+ core: {
170
+ /**
171
+ * Your SDK key.
172
+ *
173
+ * @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
174
+ */
175
+ authorizationKey: string;
176
+ /**
177
+ * Disable labels from being sent to Split backend. Labels may contain sensitive information.
178
+ *
179
+ * @defaultValue `true`
180
+ */
181
+ labelsEnabled?: boolean;
182
+ /**
183
+ * Disable machine IP and Name from being sent to Split backend.
184
+ *
185
+ * @defaultValue `true`
186
+ */
187
+ IPAddressesEnabled?: boolean;
188
+ };
189
+ /**
190
+ * SDK Startup settings for NodeJS.
191
+ */
192
+ startup?: {
193
+ /**
194
+ * Maximum amount of time used before notify a timeout.
195
+ *
196
+ * @defaultValue `15`
197
+ */
198
+ readyTimeout?: number;
199
+ /**
200
+ * Time to wait for a request before the SDK is ready. If this time expires, JS SDK will retry 'retriesOnFailureBeforeReady' times before notifying its failure to be 'ready'.
201
+ *
202
+ * @defaultValue `15`
203
+ */
204
+ requestTimeoutBeforeReady?: number;
205
+ /**
206
+ * How many quick retries we will do while starting up the SDK.
207
+ *
208
+ * @defaultValue `1`
209
+ */
210
+ retriesOnFailureBeforeReady?: number;
211
+ /**
212
+ * For SDK posts the queued events data in bulks with a given rate, but the first push window is defined separately,
213
+ * to better control on browsers. This number defines that window before the first events push.
214
+ *
215
+ * @defaultValue `0`
216
+ */
217
+ eventsFirstPushWindow?: number;
218
+ };
219
+ /**
220
+ * SDK scheduler settings.
221
+ */
222
+ scheduler?: {
223
+ /**
224
+ * The SDK polls Split servers for changes to feature flag definitions. This parameter controls this polling period in seconds.
225
+ *
226
+ * @defaultValue `60`
227
+ */
228
+ featuresRefreshRate?: number;
229
+ /**
230
+ * The SDK sends information on who got what treatment at what time back to Split servers to power analytics. This parameter controls how often this data is sent to Split servers. The parameter should be in seconds.
231
+ *
232
+ * @defaultValue `300`
233
+ */
234
+ impressionsRefreshRate?: number;
235
+ /**
236
+ * The maximum number of impression items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
237
+ * If you use a 0 here, the queue will have no maximum size.
238
+ *
239
+ * @defaultValue `30000`
240
+ */
241
+ impressionsQueueSize?: number;
242
+ /**
243
+ * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
244
+ *
245
+ * @defaultValue `120`
246
+ * @deprecated This parameter is ignored now. Use `telemetryRefreshRate` instead.
247
+ */
248
+ metricsRefreshRate?: number;
249
+ /**
250
+ * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
251
+ *
252
+ * @defaultValue `3600`
253
+ */
254
+ telemetryRefreshRate?: number;
255
+ /**
256
+ * The SDK polls Split servers for changes to segment definitions. This parameter controls this polling period in seconds.
257
+ *
258
+ * @defaultValue `60`
259
+ */
260
+ segmentsRefreshRate?: number;
261
+ /**
262
+ * The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
263
+ *
264
+ * @defaultValue `60`
265
+ */
266
+ eventsPushRate?: number;
267
+ /**
268
+ * The maximum number of event items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
269
+ * If you use a 0 here, the queue will have no maximum size.
270
+ *
271
+ * @defaultValue `500`
272
+ */
273
+ eventsQueueSize?: number;
274
+ /**
275
+ * For mocking/testing only. The SDK will refresh the features mocked data when mode is set to "localhost" by defining the key.
276
+ * For more information see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
277
+ *
278
+ * @defaultValue `15`
279
+ */
280
+ offlineRefreshRate?: number;
281
+ /**
282
+ * When using streaming mode, seconds to wait before re attempting to connect for push notifications.
283
+ * Next attempts follow intervals in power of two: base seconds, base x 2 seconds, base x 4 seconds, ...
284
+ *
285
+ * @defaultValue `1`
286
+ */
287
+ pushRetryBackoffBase?: number;
288
+ };
289
+ /**
290
+ * Mocked features file path. For testing purposes only. For using this you should specify "localhost" as authorizationKey on core settings.
291
+ * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
292
+ *
293
+ * @defaultValue `'$HOME/.split'`
294
+ */
295
+ features?: SplitIO.MockedFeaturesFilePath;
296
+ }
297
+ /**
298
+ * Common settings properties for client-side SDKs.
299
+ */
300
+ interface IClientSideSharedSettings {
301
+ /**
302
+ * SDK Core settings for client-side.
303
+ */
304
+ core: {
305
+ /**
306
+ * Your SDK key.
307
+ *
308
+ * @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
309
+ */
310
+ authorizationKey: string;
311
+ /**
312
+ * Customer identifier. Whatever this means to you.
313
+ *
314
+ * @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
315
+ */
316
+ key: SplitIO.SplitKey;
317
+ /**
318
+ * Disable labels from being sent to Split backend. Labels may contain sensitive information.
319
+ *
320
+ * @defaultValue `true`
321
+ */
322
+ labelsEnabled?: boolean;
323
+ };
324
+ /**
325
+ * User consent status. Possible values are `'GRANTED'`, which is the default, `'DECLINED'` or `'UNKNOWN'`.
326
+ * - `'GRANTED'`: the user grants consent for tracking events and impressions. The SDK sends them to Split cloud.
327
+ * - `'DECLINED'`: the user declines consent for tracking events and impressions. The SDK does not send them to Split cloud.
328
+ * - `'UNKNOWN'`: the user neither grants nor declines consent for tracking events and impressions. The SDK tracks them in its internal storage, and eventually either sends
329
+ * them or not if the consent status is updated to 'GRANTED' or 'DECLINED' respectively. The status can be updated at any time with the `UserConsent.setStatus` factory method.
330
+ *
331
+ * @defaultValue `'GRANTED'`
332
+ */
333
+ userConsent?: SplitIO.ConsentStatus;
334
+ }
335
+ /**
336
+ * Common settings properties for client-side standalone SDKs.
337
+ */
338
+ interface IClientSideSyncSharedSettings extends IClientSideSharedSettings, ISyncSharedSettings {
339
+ /**
340
+ * Mocked features map. For testing purposes only. For using this you should specify "localhost" as authorizationKey on core settings.
341
+ * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#localhost-mode}
342
+ */
343
+ features?: SplitIO.MockedFeaturesMap;
344
+ /**
345
+ * SDK Startup settings.
346
+ */
347
+ startup?: {
348
+ /**
349
+ * Maximum amount of time used before notify a timeout.
350
+ *
351
+ * @defaultValue `10`
352
+ */
353
+ readyTimeout?: number;
354
+ /**
355
+ * Time to wait for a request before the SDK is ready. If this time expires, JS SDK will retry 'retriesOnFailureBeforeReady' times before notifying its failure to be 'ready'.
356
+ *
357
+ * @defaultValue `5`
358
+ */
359
+ requestTimeoutBeforeReady?: number;
360
+ /**
361
+ * How many quick retries we will do while starting up the SDK.
362
+ *
363
+ * @defaultValue `1`
364
+ */
365
+ retriesOnFailureBeforeReady?: number;
366
+ /**
367
+ * For SDK posts the queued events data in bulks with a given rate, but the first push window is defined separately,
368
+ * to better control on browsers or mobile. This number defines that window before the first events push.
369
+ *
370
+ * @defaultValue `10`
371
+ */
372
+ eventsFirstPushWindow?: number;
373
+ };
374
+ /**
375
+ * SDK scheduler settings.
376
+ */
377
+ scheduler?: {
378
+ /**
379
+ * The SDK polls Split servers for changes to feature flag definitions. This parameter controls this polling period in seconds.
380
+ *
381
+ * @defaultValue `60`
382
+ */
383
+ featuresRefreshRate?: number;
384
+ /**
385
+ * The SDK sends information on who got what treatment at what time back to Split servers to power analytics. This parameter controls how often this data is sent to Split servers. The parameter should be in seconds.
386
+ *
387
+ * @defaultValue `60`
388
+ */
389
+ impressionsRefreshRate?: number;
390
+ /**
391
+ * The maximum number of impression items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
392
+ * If you use a 0 here, the queue will have no maximum size.
393
+ *
394
+ * @defaultValue `30000`
395
+ */
396
+ impressionsQueueSize?: number;
397
+ /**
398
+ * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
399
+ *
400
+ * @defaultValue `120`
401
+ * @deprecated This parameter is ignored now. Use `telemetryRefreshRate` instead.
402
+ */
403
+ metricsRefreshRate?: number;
404
+ /**
405
+ * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
406
+ *
407
+ * @defaultValue `3600`
408
+ */
409
+ telemetryRefreshRate?: number;
410
+ /**
411
+ * The SDK polls Split servers for changes to segment definitions. This parameter controls this polling period in seconds.
412
+ *
413
+ * @defaultValue `60`
414
+ */
415
+ segmentsRefreshRate?: number;
416
+ /**
417
+ * The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
418
+ *
419
+ * @defaultValue `60`
420
+ */
421
+ eventsPushRate?: number;
422
+ /**
423
+ * The maximum number of event items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
424
+ * If you use a 0 here, the queue will have no maximum size.
425
+ *
426
+ * @defaultValue `500`
427
+ */
428
+ eventsQueueSize?: number;
429
+ /**
430
+ * For mocking/testing only. The SDK will refresh the features mocked data when mode is set to "localhost" by defining the key.
431
+ * For more information see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#localhost-mode}
432
+ *
433
+ * @defaultValue `15`
434
+ */
435
+ offlineRefreshRate?: number;
436
+ /**
437
+ * When using streaming mode, seconds to wait before re attempting to connect for push notifications.
438
+ * Next attempts follow intervals in power of two: base seconds, base x 2 seconds, base x 4 seconds, ...
439
+ *
440
+ * @defaultValue `1`
441
+ */
442
+ pushRetryBackoffBase?: number;
443
+ };
444
+ }
445
+
10
446
  /****** Exposed namespace ******/
11
447
  /**
12
448
  * Shared types and interfaces for `@splitsoftware` packages, to support integrating JavaScript SDKs with TypeScript.
@@ -83,7 +519,7 @@ declare namespace SplitIO {
83
519
  interface ISettings {
84
520
  readonly core: {
85
521
  authorizationKey: string;
86
- key: SplitIO.SplitKey;
522
+ key: SplitKey;
87
523
  labelsEnabled: boolean;
88
524
  IPAddressesEnabled: boolean;
89
525
  };
@@ -109,7 +545,7 @@ declare namespace SplitIO {
109
545
  retriesOnFailureBeforeReady: number;
110
546
  eventsFirstPushWindow: number;
111
547
  };
112
- readonly storage: SplitIO.StorageSyncFactory | SplitIO.StorageAsyncFactory | SplitIO.StorageOptions;
548
+ readonly storage: StorageSyncFactory | StorageAsyncFactory | StorageOptions;
113
549
  readonly urls: {
114
550
  events: string;
115
551
  sdk: string;
@@ -117,17 +553,17 @@ declare namespace SplitIO {
117
553
  streaming: string;
118
554
  telemetry: string;
119
555
  };
120
- readonly integrations?: SplitIO.IntegrationFactory[];
121
- readonly debug: boolean | LogLevel | SplitIO.ILogger;
556
+ readonly integrations?: IntegrationFactory[];
557
+ readonly debug: boolean | LogLevel | ILogger;
122
558
  readonly version: string;
123
559
  /**
124
560
  * Mocked features map if using in client-side, or mocked features file path string if using in server-side (NodeJS).
125
561
  */
126
- features: SplitIO.MockedFeaturesMap | SplitIO.MockedFeaturesFilePath;
562
+ features: MockedFeaturesMap | MockedFeaturesFilePath;
127
563
  readonly streamingEnabled: boolean;
128
564
  readonly sync: {
129
- splitFilters: SplitIO.SplitFilter[];
130
- impressionsMode: SplitIO.ImpressionsMode;
565
+ splitFilters: SplitFilter[];
566
+ impressionsMode: ImpressionsMode;
131
567
  enabled: boolean;
132
568
  flagSpecVersion: string;
133
569
  requestOptions?: {
@@ -138,11 +574,11 @@ declare namespace SplitIO {
138
574
  ip: string | false;
139
575
  hostname: string | false;
140
576
  };
141
- readonly impressionListener?: SplitIO.IImpressionListener;
577
+ readonly impressionListener?: IImpressionListener;
142
578
  /**
143
579
  * User consent status if using in client-side. Undefined if using in server-side (NodeJS).
144
580
  */
145
- readonly userConsent?: SplitIO.ConsentStatus;
581
+ readonly userConsent?: ConsentStatus;
146
582
  }
147
583
  /**
148
584
  * Log levels.
@@ -191,12 +627,12 @@ declare namespace SplitIO {
191
627
  *
192
628
  * @returns The user consent status.
193
629
  */
194
- getStatus(): SplitIO.ConsentStatus;
630
+ getStatus(): ConsentStatus;
195
631
  /**
196
632
  * Consent status constants. Use this to compare with the getStatus function result.
197
633
  */
198
634
  Status: {
199
- [status in SplitIO.ConsentStatus]: SplitIO.ConsentStatus;
635
+ [status in ConsentStatus]: ConsentStatus;
200
636
  };
201
637
  }
202
638
  /**
@@ -382,7 +818,7 @@ declare namespace SplitIO {
382
818
  */
383
819
  type ImpressionData = {
384
820
  impression: ImpressionDTO;
385
- attributes?: SplitIO.Attributes;
821
+ attributes?: Attributes;
386
822
  ip: string | false;
387
823
  hostname: string | false;
388
824
  sdkLanguageVersion: string;
@@ -526,7 +962,7 @@ declare namespace SplitIO {
526
962
  * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#listener}
527
963
  */
528
964
  interface IImpressionListener {
529
- logImpression(data: SplitIO.ImpressionData): void;
965
+ logImpression(data: ImpressionData): void;
530
966
  }
531
967
  /**
532
968
  * SDK integration instance.
@@ -573,20 +1009,20 @@ declare namespace SplitIO {
573
1009
  /**
574
1010
  * The type of Split data.
575
1011
  */
576
- type: 'IMPRESSION',
1012
+ type: 'IMPRESSION';
577
1013
  /**
578
1014
  * The impression data.
579
1015
  */
580
- payload: SplitIO.ImpressionData
1016
+ payload: ImpressionData;
581
1017
  } | {
582
1018
  /**
583
1019
  * The type of Split data.
584
1020
  */
585
- type: 'EVENT',
1021
+ type: 'EVENT';
586
1022
  /**
587
1023
  * The event data.
588
1024
  */
589
- payload: SplitIO.EventData
1025
+ payload: EventData;
590
1026
  };
591
1027
  /**
592
1028
  * Available URL settings for the SDKs.
@@ -655,334 +1091,6 @@ declare namespace SplitIO {
655
1091
  interface ILogger {
656
1092
  setLogLevel(logLevel: LogLevel): void;
657
1093
  }
658
- /**
659
- * Common settings properties.
660
- */
661
- interface ISharedSettings {
662
- /**
663
- * The impression listener, which is optional. Whatever you provide here needs to comply with the SplitIO.IImpressionListener interface,
664
- * which will check for the logImpression method.
665
- *
666
- * @defaultValue `undefined`
667
- */
668
- impressionListener?: SplitIO.IImpressionListener;
669
- /**
670
- * SDK synchronization settings.
671
- */
672
- sync?: {
673
- /**
674
- * List of feature flag filters. These filters are used to fetch a subset of the feature flag definitions in your environment, in order to reduce the delay of the SDK to be ready.
675
- * This configuration is only meaningful when the SDK is working in "standalone" mode.
676
- *
677
- * Example:
678
- * ```
679
- * splitFilter: [
680
- * { type: 'byName', values: ['my_feature_flag_1', 'my_feature_flag_2'] }, // will fetch feature flags named 'my_feature_flag_1' and 'my_feature_flag_2'
681
- * ]
682
- * ```
683
- */
684
- splitFilters?: SplitIO.SplitFilter[];
685
- /**
686
- * Impressions Collection Mode. Option to determine how impressions are going to be sent to Split servers.
687
- * Possible values are 'DEBUG', 'OPTIMIZED', and 'NONE'.
688
- * - DEBUG: will send all the impressions generated (recommended only for debugging purposes).
689
- * - OPTIMIZED: will send unique impressions to Split servers, avoiding a considerable amount of traffic that duplicated impressions could generate.
690
- * - NONE: will send unique keys evaluated per feature to Split servers instead of full blown impressions, avoiding a considerable amount of traffic that impressions could generate.
691
- *
692
- * @defaultValue `'OPTIMIZED'`
693
- */
694
- impressionsMode?: SplitIO.ImpressionsMode;
695
- /**
696
- * Custom options object for HTTP(S) requests.
697
- * If provided, this object is merged with the options object passed by the SDK for EventSource and Fetch calls.
698
- * This configuration has no effect in "consumer" mode, as no HTTP(S) requests are made by the SDK.
699
- */
700
- requestOptions?: {
701
- /**
702
- * Custom function called before each request, allowing you to add or update headers in SDK HTTP requests.
703
- * Some headers, such as `SplitSDKVersion`, are required by the SDK and cannot be overridden.
704
- * To pass multiple headers with the same name, combine their values into a single line, separated by commas. Example: `{ 'Authorization': 'value1, value2' }`
705
- * Or provide keys with different cases since headers are case-insensitive. Example: `{ 'authorization': 'value1', 'Authorization': 'value2' }`
706
- *
707
- * NOTE: to pass custom headers to the streaming connection in Browser, you should polyfill the `window.EventSource` object with a library that supports headers,
708
- * like https://www.npmjs.com/package/event-source-polyfill, since native EventSource does not support them and they will be ignored.
709
- *
710
- * @defaultValue `undefined`
711
- *
712
- * @param context - The context for the request, which contains the `headers` property object representing the current headers in the request.
713
- * @returns An object representing a set of headers to be merged with the current headers.
714
- *
715
- * @example
716
- * ```
717
- * const getHeaderOverrides = (context) => {
718
- * return {
719
- * 'Authorization': context.headers['Authorization'] + ', other-value',
720
- * 'custom-header': 'custom-value'
721
- * };
722
- * };
723
- * ```
724
- */
725
- getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>;
726
- };
727
- };
728
- /**
729
- * List of URLs that the SDK will use as base for it's synchronization functionalities, applicable only when running as standalone and partial consumer modes.
730
- * Do not change these settings unless you're working an advanced use case, like connecting to the Split proxy.
731
- */
732
- urls?: UrlSettings;
733
- }
734
- /**
735
- * Common settings properties for SDKs with synchronous API (standalone and localhost modes).
736
- */
737
- interface ISyncSharedSettings extends ISharedSettings {
738
- /**
739
- * The SDK mode. When using the default in-memory storage or `InLocalStorage` as storage, the only possible value is "standalone", which is the default.
740
- * For "localhost" mode, use "localhost" as authorizationKey.
741
- *
742
- * @defaultValue `'standalone'`
743
- */
744
- mode?: 'standalone';
745
- /**
746
- * Boolean flag to enable the streaming service as default synchronization mechanism. In the event of any issue with streaming,
747
- * the SDK would fallback to the polling mechanism. If false, the SDK would poll for changes as usual without attempting to use streaming.
748
- *
749
- * @defaultValue `true`
750
- */
751
- streamingEnabled?: boolean;
752
- /**
753
- * SDK synchronization settings.
754
- */
755
- sync?: ISharedSettings['sync'] & {
756
- /**
757
- * Controls the SDK continuous synchronization flags.
758
- *
759
- * When `true` a running SDK will process rollout plan updates performed on the UI (default).
760
- * When false it'll just fetch all data upon init.
761
- *
762
- * @defaultValue `true`
763
- */
764
- enabled?: boolean;
765
- };
766
- }
767
- /**
768
- * Common settings properties for SDKs with pluggable configuration.
769
- */
770
- interface IPluggableSettings {
771
- /**
772
- * Boolean value to indicate whether the logger should be enabled or disabled by default, or a log level string or a Logger object.
773
- * Passing a logger object is required to get descriptive log messages. Otherwise most logs will print with message codes.
774
- * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#logging}.
775
- *
776
- * Examples:
777
- * ```
778
- * config.debug = true
779
- * config.debug = 'WARN'
780
- * config.debug = ErrorLogger()
781
- * ```
782
- *
783
- * @defaultValue `false`
784
- */
785
- debug?: boolean | LogLevel | SplitIO.ILogger;
786
- /**
787
- * Defines an optional list of factory functions used to instantiate SDK integrations.
788
- *
789
- * NOTE: at the moment there are not integrations to plug in.
790
- */
791
- integrations?: IntegrationFactory[];
792
- }
793
- /**
794
- * Common settings properties for SDKs without pluggable configuration.
795
- */
796
- interface INonPluggableSettings {
797
- /**
798
- * Boolean value to indicate whether the logger should be enabled or disabled, or a log level string.
799
- *
800
- * Examples:
801
- * ```
802
- * config.debug = true
803
- * config.debug = 'WARN'
804
- * ```
805
- *
806
- * @defaultValue `false`
807
- */
808
- debug?: boolean | LogLevel;
809
- }
810
- /**
811
- * Common settings properties for server-side SDKs.
812
- */
813
- interface IServerSideSharedSettings {
814
- /**
815
- * SDK Core settings for NodeJS.
816
- */
817
- core: {
818
- /**
819
- * Your SDK key.
820
- *
821
- * @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
822
- */
823
- authorizationKey: string;
824
- /**
825
- * Disable labels from being sent to Split backend. Labels may contain sensitive information.
826
- *
827
- * @defaultValue `true`
828
- */
829
- labelsEnabled?: boolean;
830
- /**
831
- * Disable machine IP and Name from being sent to Split backend.
832
- *
833
- * @defaultValue `true`
834
- */
835
- IPAddressesEnabled?: boolean;
836
- };
837
- }
838
- /**
839
- * Common settings properties for client-side SDKs.
840
- */
841
- interface IClientSideSharedSettings {
842
- /**
843
- * SDK Core settings for client-side.
844
- */
845
- core: {
846
- /**
847
- * Your SDK key.
848
- *
849
- * @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
850
- */
851
- authorizationKey: string;
852
- /**
853
- * Customer identifier. Whatever this means to you.
854
- *
855
- * @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
856
- */
857
- key: SplitKey;
858
- /**
859
- * Disable labels from being sent to Split backend. Labels may contain sensitive information.
860
- *
861
- * @defaultValue `true`
862
- */
863
- labelsEnabled?: boolean;
864
- };
865
- /**
866
- * User consent status. Possible values are `'GRANTED'`, which is the default, `'DECLINED'` or `'UNKNOWN'`.
867
- * - `'GRANTED'`: the user grants consent for tracking events and impressions. The SDK sends them to Split cloud.
868
- * - `'DECLINED'`: the user declines consent for tracking events and impressions. The SDK does not send them to Split cloud.
869
- * - `'UNKNOWN'`: the user neither grants nor declines consent for tracking events and impressions. The SDK tracks them in its internal storage, and eventually either sends
870
- * them or not if the consent status is updated to 'GRANTED' or 'DECLINED' respectively. The status can be updated at any time with the `UserConsent.setStatus` factory method.
871
- *
872
- * @defaultValue `'GRANTED'`
873
- */
874
- userConsent?: ConsentStatus;
875
- }
876
- /**
877
- * Common settings properties for client-side standalone SDKs.
878
- */
879
- interface IClientSideSyncSharedSettings extends IClientSideSharedSettings, ISyncSharedSettings {
880
- /**
881
- * Mocked features map. For testing purposes only. For using this you should specify "localhost" as authorizationKey on core settings.
882
- * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#localhost-mode}
883
- */
884
- features?: MockedFeaturesMap;
885
- /**
886
- * SDK Startup settings.
887
- */
888
- startup?: {
889
- /**
890
- * Maximum amount of time used before notify a timeout.
891
- *
892
- * @defaultValue `10`
893
- */
894
- readyTimeout?: number;
895
- /**
896
- * Time to wait for a request before the SDK is ready. If this time expires, JS SDK will retry 'retriesOnFailureBeforeReady' times before notifying its failure to be 'ready'.
897
- *
898
- * @defaultValue `5`
899
- */
900
- requestTimeoutBeforeReady?: number;
901
- /**
902
- * How many quick retries we will do while starting up the SDK.
903
- *
904
- * @defaultValue `1`
905
- */
906
- retriesOnFailureBeforeReady?: number;
907
- /**
908
- * For SDK posts the queued events data in bulks with a given rate, but the first push window is defined separately,
909
- * to better control on browsers or mobile. This number defines that window before the first events push.
910
- *
911
- * @defaultValue `10`
912
- */
913
- eventsFirstPushWindow?: number;
914
- };
915
- /**
916
- * SDK scheduler settings.
917
- */
918
- scheduler?: {
919
- /**
920
- * The SDK polls Split servers for changes to feature flag definitions. This parameter controls this polling period in seconds.
921
- *
922
- * @defaultValue `60`
923
- */
924
- featuresRefreshRate?: number;
925
- /**
926
- * The SDK sends information on who got what treatment at what time back to Split servers to power analytics. This parameter controls how often this data is sent to Split servers. The parameter should be in seconds.
927
- *
928
- * @defaultValue `60`
929
- */
930
- impressionsRefreshRate?: number;
931
- /**
932
- * The maximum number of impression items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
933
- * If you use a 0 here, the queue will have no maximum size.
934
- *
935
- * @defaultValue `30000`
936
- */
937
- impressionsQueueSize?: number;
938
- /**
939
- * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
940
- *
941
- * @defaultValue `120`
942
- * @deprecated This parameter is ignored now. Use `telemetryRefreshRate` instead.
943
- */
944
- metricsRefreshRate?: number;
945
- /**
946
- * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
947
- *
948
- * @defaultValue `3600`
949
- */
950
- telemetryRefreshRate?: number;
951
- /**
952
- * The SDK polls Split servers for changes to segment definitions. This parameter controls this polling period in seconds.
953
- *
954
- * @defaultValue `60`
955
- */
956
- segmentsRefreshRate?: number;
957
- /**
958
- * The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
959
- *
960
- * @defaultValue `60`
961
- */
962
- eventsPushRate?: number;
963
- /**
964
- * The maximum number of event items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
965
- * If you use a 0 here, the queue will have no maximum size.
966
- *
967
- * @defaultValue `500`
968
- */
969
- eventsQueueSize?: number;
970
- /**
971
- * For mocking/testing only. The SDK will refresh the features mocked data when mode is set to "localhost" by defining the key.
972
- * For more information see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#localhost-mode}
973
- *
974
- * @defaultValue `15`
975
- */
976
- offlineRefreshRate?: number;
977
- /**
978
- * When using streaming mode, seconds to wait before re attempting to connect for push notifications.
979
- * Next attempts follow intervals in power of two: base seconds, base x 2 seconds, base x 4 seconds, ...
980
- *
981
- * @defaultValue `1`
982
- */
983
- pushRetryBackoffBase?: number;
984
- };
985
- }
986
1094
  /**
987
1095
  * Settings interface for Browser SDK instances created with client-side API and synchronous storage (e.g., in-memory or local storage).
988
1096
  *
@@ -1135,113 +1243,6 @@ declare namespace SplitIO {
1135
1243
  * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}
1136
1244
  */
1137
1245
  interface INodeSettings extends IServerSideSharedSettings, ISyncSharedSettings, INonPluggableSettings {
1138
- /**
1139
- * SDK Startup settings for NodeJS.
1140
- */
1141
- startup?: {
1142
- /**
1143
- * Maximum amount of time used before notify a timeout.
1144
- *
1145
- * @defaultValue `15`
1146
- */
1147
- readyTimeout?: number;
1148
- /**
1149
- * Time to wait for a request before the SDK is ready. If this time expires, JS SDK will retry 'retriesOnFailureBeforeReady' times before notifying its failure to be 'ready'.
1150
- *
1151
- * @defaultValue `15`
1152
- */
1153
- requestTimeoutBeforeReady?: number;
1154
- /**
1155
- * How many quick retries we will do while starting up the SDK.
1156
- *
1157
- * @defaultValue `1`
1158
- */
1159
- retriesOnFailureBeforeReady?: number;
1160
- /**
1161
- * For SDK posts the queued events data in bulks with a given rate, but the first push window is defined separately,
1162
- * to better control on browsers. This number defines that window before the first events push.
1163
- *
1164
- * @defaultValue `0`
1165
- */
1166
- eventsFirstPushWindow?: number;
1167
- };
1168
- /**
1169
- * SDK scheduler settings.
1170
- */
1171
- scheduler?: {
1172
- /**
1173
- * The SDK polls Split servers for changes to feature flag definitions. This parameter controls this polling period in seconds.
1174
- *
1175
- * @defaultValue `60`
1176
- */
1177
- featuresRefreshRate?: number;
1178
- /**
1179
- * The SDK sends information on who got what treatment at what time back to Split servers to power analytics. This parameter controls how often this data is sent to Split servers. The parameter should be in seconds.
1180
- *
1181
- * @defaultValue `300`
1182
- */
1183
- impressionsRefreshRate?: number;
1184
- /**
1185
- * The maximum number of impression items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
1186
- * If you use a 0 here, the queue will have no maximum size.
1187
- *
1188
- * @defaultValue `30000`
1189
- */
1190
- impressionsQueueSize?: number;
1191
- /**
1192
- * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
1193
- *
1194
- * @defaultValue `120`
1195
- * @deprecated This parameter is ignored now. Use `telemetryRefreshRate` instead.
1196
- */
1197
- metricsRefreshRate?: number;
1198
- /**
1199
- * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
1200
- *
1201
- * @defaultValue `3600`
1202
- */
1203
- telemetryRefreshRate?: number;
1204
- /**
1205
- * The SDK polls Split servers for changes to segment definitions. This parameter controls this polling period in seconds.
1206
- *
1207
- * @defaultValue `60`
1208
- */
1209
- segmentsRefreshRate?: number;
1210
- /**
1211
- * The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
1212
- *
1213
- * @defaultValue `60`
1214
- */
1215
- eventsPushRate?: number;
1216
- /**
1217
- * The maximum number of event items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
1218
- * If you use a 0 here, the queue will have no maximum size.
1219
- *
1220
- * @defaultValue `500`
1221
- */
1222
- eventsQueueSize?: number;
1223
- /**
1224
- * For mocking/testing only. The SDK will refresh the features mocked data when mode is set to "localhost" by defining the key.
1225
- * For more information see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
1226
- *
1227
- * @defaultValue `15`
1228
- */
1229
- offlineRefreshRate?: number;
1230
- /**
1231
- * When using streaming mode, seconds to wait before re attempting to connect for push notifications.
1232
- * Next attempts follow intervals in power of two: base seconds, base x 2 seconds, base x 4 seconds, ...
1233
- *
1234
- * @defaultValue `1`
1235
- */
1236
- pushRetryBackoffBase?: number;
1237
- };
1238
- /**
1239
- * Mocked features file path. For testing purposes only. For using this you should specify "localhost" as authorizationKey on core settings.
1240
- * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
1241
- *
1242
- * @defaultValue `'$HOME/.split'`
1243
- */
1244
- features?: SplitIO.MockedFeaturesFilePath;
1245
1246
  /**
1246
1247
  * Defines which kind of storage we can instantiate on NodeJS for 'standalone' mode.
1247
1248
  * The only possible storage type is 'MEMORY', which is the default.
@@ -1330,17 +1331,6 @@ declare namespace SplitIO {
1330
1331
  * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#state-sharing-redis-integration}
1331
1332
  */
1332
1333
  mode: 'consumer';
1333
- /**
1334
- * SDK Startup settings for NodeJS.
1335
- */
1336
- startup?: {
1337
- /**
1338
- * Maximum amount of time used before notify a timeout.
1339
- *
1340
- * @defaultValue `15`
1341
- */
1342
- readyTimeout?: number;
1343
- };
1344
1334
  /**
1345
1335
  * Defines which kind of async storage we can instantiate on NodeJS for 'consumer' mode.
1346
1336
  * The only possible storage type is 'REDIS'.
@@ -1422,19 +1412,19 @@ declare namespace SplitIO {
1422
1412
  * This represents the interface for the SDK instance with synchronous storage and client-side API,
1423
1413
  * i.e., where client instances have a bound user key.
1424
1414
  */
1425
- interface ISDK extends IBasicSDK {
1415
+ interface IBrowserSDK extends IBasicSDK {
1426
1416
  /**
1427
1417
  * Returns the default client instance of the SDK, associated with the key provided on settings.
1428
1418
  *
1429
1419
  * @returns The client instance.
1430
1420
  */
1431
- client(): IClient;
1421
+ client(): IBrowserClient;
1432
1422
  /**
1433
1423
  * Returns a shared client of the SDK, associated with the given key.
1434
1424
  * @param key - The key for the new client instance.
1435
1425
  * @returns The client instance.
1436
1426
  */
1437
- client(key: SplitKey): IClient;
1427
+ client(key: SplitKey): IBrowserClient;
1438
1428
  /**
1439
1429
  * Returns a manager instance of the SDK to explore available information.
1440
1430
  *
@@ -1450,20 +1440,20 @@ declare namespace SplitIO {
1450
1440
  * This represents the interface for the SDK instance with asynchronous storage and client-side API,
1451
1441
  * i.e., where client instances have a bound user key.
1452
1442
  */
1453
- interface IAsyncSDK extends IBasicSDK {
1443
+ interface IBrowserAsyncSDK extends IBasicSDK {
1454
1444
  /**
1455
1445
  * Returns the default client instance of the SDK, associated with the key provided on settings.
1456
1446
  *
1457
1447
  * @returns The asynchronous client instance.
1458
1448
  */
1459
- client(): IAsyncClient;
1449
+ client(): IBrowserAsyncClient;
1460
1450
  /**
1461
1451
  * Returns a shared client of the SDK, associated with the given key.
1462
1452
  *
1463
1453
  * @param key - The key for the new client instance.
1464
1454
  * @returns The asynchronous client instance.
1465
1455
  */
1466
- client(key: SplitKey): IAsyncClient;
1456
+ client(key: SplitKey): IBrowserAsyncClient;
1467
1457
  /**
1468
1458
  * Returns a manager instance of the SDK to explore available information.
1469
1459
  *
@@ -1478,13 +1468,13 @@ declare namespace SplitIO {
1478
1468
  /**
1479
1469
  * This represents the interface for the SDK instance for server-side with synchronous storage.
1480
1470
  */
1481
- interface INodeSDK extends IBasicSDK {
1471
+ interface ISDK extends IBasicSDK {
1482
1472
  /**
1483
1473
  * Returns the default client instance of the SDK.
1484
1474
  *
1485
1475
  * @returns The client instance.
1486
1476
  */
1487
- client(): INodeClient;
1477
+ client(): IClient;
1488
1478
  /**
1489
1479
  * Returns a manager instance of the SDK to explore available information.
1490
1480
  *
@@ -1495,13 +1485,13 @@ declare namespace SplitIO {
1495
1485
  /**
1496
1486
  * This represents the interface for the SDK instance for server-side with asynchronous storage.
1497
1487
  */
1498
- interface INodeAsyncSDK extends IBasicSDK {
1488
+ interface IAsyncSDK extends IBasicSDK {
1499
1489
  /**
1500
1490
  * Returns the default client instance of the SDK.
1501
1491
  *
1502
1492
  * @returns The asynchronous client instance.
1503
1493
  */
1504
- client(): INodeAsyncClient;
1494
+ client(): IAsyncClient;
1505
1495
  /**
1506
1496
  * Returns a manager instance of the SDK to explore available information.
1507
1497
  *
@@ -1513,7 +1503,7 @@ declare namespace SplitIO {
1513
1503
  * This represents the interface for the Client instance on server-side, where the user key is not bound to the instance and must be provided on each method call.
1514
1504
  * This interface is available in NodeJS, or when importing the 'server' sub-package of JS SDK (e.g., `import { SplitFactory } from '@splitsoftware/splitio/server'`).
1515
1505
  */
1516
- interface INodeClient extends IBasicClient {
1506
+ interface IClient extends IBasicClient {
1517
1507
  /**
1518
1508
  * Returns a Treatment value, which is the treatment string for the given feature.
1519
1509
  *
@@ -1597,14 +1587,14 @@ declare namespace SplitIO {
1597
1587
  * @param properties - The properties of this event. Values can be string, number, boolean or null.
1598
1588
  * @returns Whether the event was added to the queue successfully or not.
1599
1589
  */
1600
- track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): boolean;
1590
+ track(key: SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): boolean;
1601
1591
  }
1602
1592
  /**
1603
1593
  * This represents the interface for the Client instance on server-side with asynchronous storage, like REDIS.
1604
1594
  * User key is not bound to the instance and must be provided on each method call, which returns a promise.
1605
1595
  * This interface is available in NodeJS, or when importing the 'server' sub-package in JS SDK (e.g., `import { SplitFactory } from '@splitsoftware/splitio/server'`).
1606
1596
  */
1607
- interface INodeAsyncClient extends IBasicClient {
1597
+ interface IAsyncClient extends IBasicClient {
1608
1598
  /**
1609
1599
  * Returns a Treatment value, which will be (or eventually be) the treatment string for the given feature.
1610
1600
  *
@@ -1687,7 +1677,7 @@ declare namespace SplitIO {
1687
1677
  * @param properties - The properties of this event. Values can be string, number, boolean or null.
1688
1678
  * @returns A promise that resolves to a boolean indicating if the event was added to the queue successfully or not.
1689
1679
  */
1690
- track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): Promise<boolean>;
1680
+ track(key: SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): Promise<boolean>;
1691
1681
  }
1692
1682
  interface IClientWithAttributes extends IBasicClient {
1693
1683
  /**
@@ -1735,7 +1725,7 @@ declare namespace SplitIO {
1735
1725
  /**
1736
1726
  * This represents the interface for the Client instance on client-side, where the user key is bound to the instance on creation and does not need to be provided on each method call.
1737
1727
  */
1738
- interface IClient extends IClientWithAttributes {
1728
+ interface IBrowserClient extends IClientWithAttributes {
1739
1729
  /**
1740
1730
  * Returns a Treatment value, which is the treatment string for the given feature.
1741
1731
  *
@@ -1814,7 +1804,7 @@ declare namespace SplitIO {
1814
1804
  /**
1815
1805
  * This represents the interface for the Client instance with asynchronous storage for client-side SDK, where each client has associated a key.
1816
1806
  */
1817
- interface IAsyncClient extends IClientWithAttributes {
1807
+ interface IBrowserAsyncClient extends IClientWithAttributes {
1818
1808
  /**
1819
1809
  * Returns a Treatment value, which will be (or eventually be) the treatment string for the given feature.
1820
1810
  *