@splitsoftware/splitio-commons 1.6.2-rc.0 → 1.6.2-rc.3
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/cjs/sdkFactory/index.js +1 -0
- package/cjs/services/splitApi.js +1 -0
- package/cjs/utils/key/index.js +1 -1
- package/cjs/utils/settingsValidation/index.js +1 -0
- package/esm/sdkFactory/index.js +1 -0
- package/esm/services/splitApi.js +1 -0
- package/esm/utils/key/index.js +1 -1
- package/esm/utils/settingsValidation/index.js +1 -0
- package/package.json +2 -2
- package/src/consent/sdkUserConsent.ts +4 -3
- package/src/dtos/types.ts +0 -8
- package/src/evaluator/Engine.ts +3 -3
- package/src/evaluator/combiners/and.ts +1 -1
- package/src/evaluator/combiners/ifelseif.ts +3 -3
- package/src/evaluator/condition/engineUtils.ts +1 -1
- package/src/evaluator/condition/index.ts +6 -6
- package/src/evaluator/index.ts +10 -10
- package/src/evaluator/matchers/all.ts +1 -1
- package/src/evaluator/matchers/between.ts +1 -1
- package/src/evaluator/matchers/boolean.ts +1 -1
- package/src/evaluator/matchers/cont_all.ts +1 -1
- package/src/evaluator/matchers/cont_any.ts +1 -1
- package/src/evaluator/matchers/cont_str.ts +1 -1
- package/src/evaluator/matchers/dependency.ts +1 -1
- package/src/evaluator/matchers/eq.ts +1 -1
- package/src/evaluator/matchers/eq_set.ts +1 -1
- package/src/evaluator/matchers/ew.ts +1 -1
- package/src/evaluator/matchers/gte.ts +1 -1
- package/src/evaluator/matchers/index.ts +1 -1
- package/src/evaluator/matchers/lte.ts +1 -1
- package/src/evaluator/matchers/part_of.ts +1 -1
- package/src/evaluator/matchers/segment.ts +1 -1
- package/src/evaluator/matchers/string.ts +1 -1
- package/src/evaluator/matchers/sw.ts +1 -1
- package/src/evaluator/matchers/whitelist.ts +1 -1
- package/src/evaluator/parser/index.ts +3 -3
- package/src/evaluator/types.ts +6 -6
- package/src/evaluator/value/index.ts +4 -4
- package/src/evaluator/value/sanitize.ts +4 -4
- package/src/integrations/ga/GaToSplit.ts +6 -6
- package/src/integrations/ga/SplitToGa.ts +10 -10
- package/src/integrations/ga/types.ts +4 -4
- package/src/integrations/pluggable.ts +3 -3
- package/src/integrations/types.ts +2 -2
- package/src/logger/index.ts +3 -3
- package/src/logger/sdkLogger.ts +1 -2
- package/src/logger/types.ts +0 -16
- package/src/readiness/sdkReadinessManager.ts +1 -1
- package/src/readiness/types.ts +2 -9
- package/src/sdkClient/client.ts +13 -13
- package/src/sdkClient/clientAttributesDecoration.ts +9 -9
- package/src/sdkClient/clientCS.ts +3 -4
- package/src/sdkClient/clientInputValidation.ts +15 -15
- package/src/sdkClient/sdkClient.ts +2 -2
- package/src/sdkClient/sdkClientMethod.ts +2 -2
- package/src/sdkClient/sdkClientMethodCS.ts +9 -9
- package/src/sdkClient/sdkClientMethodCSWithTT.ts +9 -9
- package/src/sdkFactory/index.ts +3 -2
- package/src/sdkFactory/types.ts +4 -4
- package/src/sdkManager/index.ts +5 -5
- package/src/services/splitApi.ts +1 -0
- package/src/storages/dataLoader.ts +2 -2
- package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +1 -1
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +2 -2
- package/src/storages/inLocalStorage/index.ts +3 -2
- package/src/storages/inMemory/EventsCacheInMemory.ts +4 -4
- package/src/storages/inRedis/EventsCacheInRedis.ts +4 -4
- package/src/storages/inRedis/ImpressionsCacheInRedis.ts +1 -1
- package/src/storages/inRedis/RedisAdapter.ts +1 -1
- package/src/storages/inRedis/SegmentsCacheInRedis.ts +1 -1
- package/src/storages/inRedis/SplitsCacheInRedis.ts +1 -1
- package/src/storages/inRedis/TelemetryCacheInRedis.ts +1 -1
- package/src/storages/inRedis/index.ts +3 -2
- package/src/storages/pluggable/EventsCachePluggable.ts +4 -4
- package/src/storages/pluggable/ImpressionsCachePluggable.ts +1 -1
- package/src/storages/pluggable/SegmentsCachePluggable.ts +1 -1
- package/src/storages/pluggable/SplitsCachePluggable.ts +1 -1
- package/src/storages/pluggable/TelemetryCachePluggable.ts +1 -1
- package/src/storages/pluggable/index.ts +3 -3
- package/src/storages/pluggable/wrapperAdapter.ts +1 -1
- package/src/storages/types.ts +42 -18
- package/src/sync/offline/LocalhostFromObject.ts +4 -4
- package/src/sync/offline/splitsParser/splitsParserFromSettings.ts +8 -8
- package/src/sync/polling/updaters/mySegmentsUpdater.ts +1 -1
- package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
- package/src/sync/polling/updaters/splitChangesUpdater.ts +1 -1
- package/src/sync/streaming/SSEHandler/index.ts +1 -1
- package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +1 -1
- package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +1 -1
- package/src/sync/submitters/submitter.ts +1 -1
- package/src/sync/submitters/types.ts +2 -2
- package/src/sync/syncTask.ts +1 -1
- package/src/trackers/eventTracker.ts +3 -3
- package/src/trackers/impressionsTracker.ts +3 -3
- package/src/trackers/types.ts +4 -4
- package/src/{splitio.d.ts → types.d.ts} +826 -782
- package/src/utils/constants/index.ts +1 -1
- package/src/utils/inputValidation/apiKey.ts +1 -1
- package/src/utils/inputValidation/attribute.ts +1 -1
- package/src/utils/inputValidation/attributes.ts +3 -3
- package/src/utils/inputValidation/event.ts +1 -1
- package/src/utils/inputValidation/eventProperties.ts +3 -3
- package/src/utils/inputValidation/eventValue.ts +1 -1
- package/src/utils/inputValidation/isOperational.ts +1 -1
- package/src/utils/inputValidation/key.ts +3 -3
- package/src/utils/inputValidation/preloadedData.ts +3 -3
- package/src/utils/inputValidation/split.ts +1 -1
- package/src/utils/inputValidation/splitExistance.ts +1 -1
- package/src/utils/inputValidation/splits.ts +1 -1
- package/src/utils/inputValidation/trafficType.ts +1 -1
- package/src/utils/inputValidation/trafficTypeExistance.ts +1 -1
- package/src/utils/key/index.ts +9 -9
- package/src/utils/settingsValidation/consent.ts +1 -2
- package/src/utils/settingsValidation/impressionsMode.ts +3 -3
- package/src/utils/settingsValidation/index.ts +1 -0
- package/src/utils/settingsValidation/integrations/common.ts +1 -1
- package/src/utils/settingsValidation/integrations/configurable.ts +1 -1
- package/src/utils/settingsValidation/integrations/pluggable.ts +1 -2
- package/src/utils/settingsValidation/localhost/builtin.ts +1 -2
- package/src/utils/settingsValidation/localhost/pluggable.ts +1 -2
- package/src/utils/settingsValidation/logger/builtinLogger.ts +1 -2
- package/src/utils/settingsValidation/logger/pluggableLogger.ts +1 -2
- package/src/utils/settingsValidation/splitFilters.ts +7 -9
- package/src/utils/settingsValidation/storage/storageCS.ts +1 -2
- package/types/consent/sdkUserConsent.d.ts +2 -9
- package/types/dtos/types.d.ts +0 -6
- package/types/evaluator/Engine.d.ts +3 -3
- package/types/evaluator/combiners/and.d.ts +1 -1
- package/types/evaluator/combiners/ifelseif.d.ts +1 -1
- package/types/evaluator/condition/engineUtils.d.ts +1 -1
- package/types/evaluator/condition/index.d.ts +1 -1
- package/types/evaluator/index.d.ts +4 -4
- package/types/evaluator/matchers/all.d.ts +1 -1
- package/types/evaluator/matchers/between.d.ts +1 -1
- package/types/evaluator/matchers/boolean.d.ts +1 -1
- package/types/evaluator/matchers/cont_all.d.ts +1 -1
- package/types/evaluator/matchers/cont_any.d.ts +1 -1
- package/types/evaluator/matchers/cont_str.d.ts +1 -1
- package/types/evaluator/matchers/dependency.d.ts +1 -1
- package/types/evaluator/matchers/eq.d.ts +1 -1
- package/types/evaluator/matchers/eq_set.d.ts +1 -1
- package/types/evaluator/matchers/ew.d.ts +1 -1
- package/types/evaluator/matchers/gte.d.ts +1 -1
- package/types/evaluator/matchers/index.d.ts +1 -1
- package/types/evaluator/matchers/lte.d.ts +1 -1
- package/types/evaluator/matchers/part_of.d.ts +1 -1
- package/types/evaluator/matchers/segment.d.ts +1 -1
- package/types/evaluator/matchers/string.d.ts +1 -1
- package/types/evaluator/matchers/sw.d.ts +1 -1
- package/types/evaluator/matchers/whitelist.d.ts +1 -1
- package/types/evaluator/parser/index.d.ts +1 -1
- package/types/evaluator/types.d.ts +6 -6
- package/types/evaluator/value/index.d.ts +3 -3
- package/types/evaluator/value/sanitize.d.ts +3 -3
- package/types/integrations/ga/GaToSplit.d.ts +4 -4
- package/types/integrations/ga/SplitToGa.d.ts +4 -4
- package/types/integrations/ga/types.d.ts +4 -4
- package/types/integrations/types.d.ts +2 -2
- package/types/logger/browser/{debugLogger.d.ts → DebugLogger.d.ts} +0 -0
- package/types/logger/browser/{errorLogger.d.ts → ErrorLogger.d.ts} +0 -0
- package/types/logger/browser/{infoLogger.d.ts → InfoLogger.d.ts} +0 -0
- package/types/logger/browser/{warnLogger.d.ts → WarnLogger.d.ts} +0 -0
- package/types/logger/index.d.ts +3 -5
- package/types/logger/sdkLogger.d.ts +1 -2
- package/types/logger/types.d.ts +0 -11
- package/types/readiness/sdkReadinessManager.d.ts +1 -1
- package/types/readiness/types.d.ts +2 -8
- package/types/sdkClient/client.d.ts +2 -2
- package/types/sdkClient/clientAttributesDecoration.d.ts +8 -8
- package/types/sdkClient/clientCS.d.ts +2 -3
- package/types/sdkClient/clientInputValidation.d.ts +2 -2
- package/types/sdkClient/sdkClient.d.ts +2 -2
- package/types/sdkClient/sdkClientMethod.d.ts +2 -2
- package/types/sdkClient/sdkClientMethodCS.d.ts +2 -2
- package/types/sdkClient/sdkClientMethodCSWithTT.d.ts +2 -2
- package/types/sdkFactory/index.d.ts +2 -2
- package/types/sdkFactory/types.d.ts +6 -6
- package/types/sdkManager/index.d.ts +3 -3
- package/types/storages/dataLoader.d.ts +2 -2
- package/types/storages/inLocalStorage/MySegmentsCacheInLocal.d.ts +1 -1
- package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +1 -2
- package/types/storages/inLocalStorage/index.d.ts +2 -2
- package/types/storages/inMemory/EventsCacheInMemory.d.ts +3 -3
- package/types/storages/inMemory/InMemoryStorage.d.ts +1 -1
- package/types/storages/inMemory/InMemoryStorageCS.d.ts +1 -1
- package/types/storages/inRedis/EventsCacheInRedis.d.ts +3 -3
- package/types/storages/inRedis/ImpressionsCacheInRedis.d.ts +1 -1
- package/types/storages/inRedis/RedisAdapter.d.ts +1 -1
- package/types/storages/inRedis/SegmentsCacheInRedis.d.ts +1 -1
- package/types/storages/inRedis/SplitsCacheInRedis.d.ts +1 -1
- package/types/storages/inRedis/TelemetryCacheInRedis.d.ts +1 -1
- package/types/storages/inRedis/index.d.ts +2 -2
- package/types/storages/pluggable/EventsCachePluggable.d.ts +3 -3
- package/types/storages/pluggable/ImpressionsCachePluggable.d.ts +1 -1
- package/types/storages/pluggable/SegmentsCachePluggable.d.ts +1 -1
- package/types/storages/pluggable/SplitsCachePluggable.d.ts +1 -1
- package/types/storages/pluggable/TelemetryCachePluggable.d.ts +1 -1
- package/types/storages/pluggable/index.d.ts +3 -2
- package/types/storages/pluggable/wrapperAdapter.d.ts +1 -1
- package/types/storages/types.d.ts +42 -16
- package/types/sync/offline/LocalhostFromObject.d.ts +2 -2
- package/types/sync/polling/updaters/mySegmentsUpdater.d.ts +1 -1
- package/types/sync/polling/updaters/segmentChangesUpdater.d.ts +1 -1
- package/types/sync/polling/updaters/splitChangesUpdater.d.ts +1 -1
- package/types/sync/streaming/SSEHandler/index.d.ts +1 -1
- package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +1 -1
- package/types/sync/streaming/UpdateWorkers/SplitsUpdateWorker.d.ts +1 -1
- package/types/sync/submitters/submitter.d.ts +1 -1
- package/types/sync/submitters/types.d.ts +2 -2
- package/types/sync/syncTask.d.ts +1 -1
- package/types/trackers/types.d.ts +4 -4
- package/types/utils/constants/index.d.ts +1 -1
- package/types/utils/inputValidation/apiKey.d.ts +1 -1
- package/types/utils/inputValidation/attribute.d.ts +1 -1
- package/types/utils/inputValidation/attributes.d.ts +3 -3
- package/types/utils/inputValidation/event.d.ts +1 -1
- package/types/utils/inputValidation/eventProperties.d.ts +3 -3
- package/types/utils/inputValidation/eventValue.d.ts +1 -1
- package/types/utils/inputValidation/isOperational.d.ts +1 -1
- package/types/utils/inputValidation/key.d.ts +3 -3
- package/types/utils/inputValidation/preloadedData.d.ts +3 -3
- package/types/utils/inputValidation/split.d.ts +1 -1
- package/types/utils/inputValidation/splitExistance.d.ts +1 -1
- package/types/utils/inputValidation/splits.d.ts +1 -1
- package/types/utils/inputValidation/trafficType.d.ts +1 -1
- package/types/utils/inputValidation/trafficTypeExistance.d.ts +1 -1
- package/types/utils/key/index.d.ts +4 -4
- package/types/utils/settingsValidation/consent.d.ts +1 -2
- package/types/utils/settingsValidation/impressionsMode.d.ts +3 -3
- package/types/utils/settingsValidation/integrations/common.d.ts +1 -1
- package/types/utils/settingsValidation/integrations/configurable.d.ts +1 -1
- package/types/utils/settingsValidation/integrations/pluggable.d.ts +1 -2
- package/types/utils/settingsValidation/localhost/builtin.d.ts +1 -2
- package/types/utils/settingsValidation/localhost/pluggable.d.ts +1 -2
- package/types/utils/settingsValidation/logger/builtinLogger.d.ts +1 -1
- package/types/utils/settingsValidation/logger/pluggableLogger.d.ts +1 -1
- package/types/utils/settingsValidation/splitFilters.d.ts +1 -2
- package/types/utils/settingsValidation/storage/storageCS.d.ts +2 -3
- package/cjs/types.js +0 -2
- package/esm/types.js +0 -1
- package/src/types.ts +0 -1263
- package/types/integrations/ga/GaToSplitPlugin.d.ts +0 -3
- package/types/integrations/ga/SplitToGaPlugin.d.ts +0 -4
- package/types/integrations/ga/autoRequire.d.ts +0 -4
- package/types/logger/codes.d.ts +0 -2
- package/types/logger/codesConstants.d.ts +0 -117
- package/types/logger/codesConstantsBrowser.d.ts +0 -2
- package/types/logger/codesConstantsNode.d.ts +0 -14
- package/types/logger/codesDebug.d.ts +0 -1
- package/types/logger/codesDebugBrowser.d.ts +0 -1
- package/types/logger/codesDebugNode.d.ts +0 -1
- package/types/logger/codesError.d.ts +0 -1
- package/types/logger/codesErrorNode.d.ts +0 -1
- package/types/logger/codesInfo.d.ts +0 -1
- package/types/logger/codesWarn.d.ts +0 -1
- package/types/logger/codesWarnNode.d.ts +0 -1
- package/types/logger/debugLogger.d.ts +0 -2
- package/types/logger/errorLogger.d.ts +0 -2
- package/types/logger/infoLogger.d.ts +0 -2
- package/types/logger/messages/debugBrowser.d.ts +0 -1
- package/types/logger/messages/debugNode.d.ts +0 -1
- package/types/logger/messages/errorNode.d.ts +0 -1
- package/types/logger/messages/warnNode.d.ts +0 -1
- package/types/logger/noopLogger.d.ts +0 -2
- package/types/logger/warnLogger.d.ts +0 -2
- package/types/sdkClient/types.d.ts +0 -18
- package/types/sdkFactory/userConsentProps.d.ts +0 -6
- package/types/sdkManager/sdkManagerMethod.d.ts +0 -6
- package/types/storages/getRegisteredSegments.d.ts +0 -10
- package/types/storages/inMemory/CountsCacheInMemory.d.ts +0 -20
- package/types/storages/inMemory/LatenciesCacheInMemory.d.ts +0 -20
- package/types/storages/inMemory/index.d.ts +0 -10
- package/types/storages/inRedis/CountsCacheInRedis.d.ts +0 -9
- package/types/storages/inRedis/LatenciesCacheInRedis.d.ts +0 -9
- package/types/storages/parseSegments.d.ts +0 -6
- package/types/sync/offline/LocalhostFromFile.d.ts +0 -2
- package/types/sync/offline/splitsParser/splitsParserFromFile.d.ts +0 -2
- package/types/sync/polling/syncTasks/splitsSyncTask.copy.d.ts +0 -35
- package/types/sync/polling/syncTasks/splitsSyncTask.morelikeoriginal.d.ts +0 -35
- package/types/sync/streaming/AuthClient/indexV1.d.ts +0 -12
- package/types/sync/streaming/AuthClient/indexV2.d.ts +0 -8
- package/types/sync/streaming/pushManagerCS.d.ts +0 -1
- package/types/sync/streaming/pushManagerNoUsers.d.ts +0 -13
- package/types/sync/streaming/pushManagerSS.d.ts +0 -1
- package/types/sync/submitters/eventsSyncTask.d.ts +0 -8
- package/types/sync/submitters/impressionCountsSyncTask.d.ts +0 -13
- package/types/sync/submitters/impressionsSyncTask.d.ts +0 -14
- package/types/sync/submitters/metricsSyncTask.d.ts +0 -12
- package/types/sync/submitters/submitterSyncTask.d.ts +0 -10
- package/types/sync/submitters/telemetrySyncTask.d.ts +0 -0
- package/types/sync/submitters/uniqueKeysSubmitter.d.ts +0 -13
- package/types/sync/syncManagerFromFile.d.ts +0 -2
- package/types/sync/syncManagerFromObject.d.ts +0 -2
- package/types/sync/syncManagerOffline.d.ts +0 -9
- package/types/sync/syncTaskComposite.d.ts +0 -5
- package/types/trackers/strategy/strategyDebug.d.ts +0 -9
- package/types/trackers/strategy/strategyNone.d.ts +0 -10
- package/types/trackers/strategy/strategyOptimized.d.ts +0 -11
- package/types/trackers/telemetryRecorder.d.ts +0 -0
- package/types/trackers/uniqueKeysTracker.d.ts +0 -13
- package/types/types.d.ts +0 -1261
- package/types/utils/EventEmitter.d.ts +0 -4
- package/types/utils/consent.d.ts +0 -2
- package/types/utils/lang/errors.d.ts +0 -10
- package/types/utils/murmur3/commons.d.ts +0 -12
- package/types/utils/settingsValidation/buildMetadata.d.ts +0 -3
- package/types/utils/settingsValidation/localhost/index.d.ts +0 -9
- package/types/utils/settingsValidation/logger.d.ts +0 -11
- package/types/utils/settingsValidation/runtime/browser.d.ts +0 -2
- package/types/utils/settingsValidation/runtime/node.d.ts +0 -2
- package/types/utils/settingsValidation/userConsent.d.ts +0 -5
- package/types/utils/timeTracker/index.d.ts +0 -1
|
@@ -4,489 +4,368 @@
|
|
|
4
4
|
// Definitions by: Nico Zelaya <https://github.com/NicoZelaya/>
|
|
5
5
|
|
|
6
6
|
/// <reference types="google.analytics" />
|
|
7
|
-
import { RedisOptions } from 'ioredis';
|
|
8
7
|
|
|
9
8
|
export as namespace SplitIO;
|
|
10
9
|
export = SplitIO;
|
|
11
10
|
|
|
11
|
+
/****** Exposed namespace ******/
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
interface EventEmitter {
|
|
17
|
-
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
18
|
-
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
19
|
-
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
20
|
-
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
21
|
-
off(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
22
|
-
removeAllListeners(event?: string | symbol): this;
|
|
23
|
-
setMaxListeners(n: number): this;
|
|
24
|
-
getMaxListeners(): number;
|
|
25
|
-
listeners(event: string | symbol): Function[];
|
|
26
|
-
rawListeners(event: string | symbol): Function[];
|
|
27
|
-
emit(event: string | symbol, ...args: any[]): boolean;
|
|
28
|
-
listenerCount(type: string | symbol): number;
|
|
29
|
-
// Added in Node 6...
|
|
30
|
-
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
31
|
-
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
32
|
-
eventNames(): Array<string | symbol>;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* @typedef {Object} EventConsts
|
|
36
|
-
* @property {string} SDK_READY The ready event.
|
|
37
|
-
* @property {string} SDK_READY_FROM_CACHE The ready event when fired with cached data.
|
|
38
|
-
* @property {string} SDK_READY_TIMED_OUT The timeout event.
|
|
39
|
-
* @property {string} SDK_UPDATE The update event.
|
|
40
|
-
*/
|
|
41
|
-
type EventConsts = {
|
|
42
|
-
SDK_READY: 'init::ready',
|
|
43
|
-
SDK_READY_FROM_CACHE: 'init::cache-ready',
|
|
44
|
-
SDK_READY_TIMED_OUT: 'init::timeout',
|
|
45
|
-
SDK_UPDATE: 'state::update'
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* SDK Modes.
|
|
49
|
-
* @typedef {string} SDKMode
|
|
50
|
-
*/
|
|
51
|
-
type SDKMode = 'standalone' | 'consumer';
|
|
52
|
-
/**
|
|
53
|
-
* Storage types.
|
|
54
|
-
* @typedef {string} StorageType
|
|
55
|
-
*/
|
|
56
|
-
type StorageType = 'MEMORY' | 'LOCALSTORAGE' | 'REDIS';
|
|
57
|
-
/**
|
|
58
|
-
* Settings interface. This is a representation of the settings the SDK expose, that's why
|
|
59
|
-
* most of it's props are readonly. Only features should be rewritten when localhost mode is active.
|
|
60
|
-
* @interface ISettings
|
|
61
|
-
*/
|
|
62
|
-
interface ISettings {
|
|
63
|
-
readonly core: {
|
|
64
|
-
authorizationKey: string,
|
|
65
|
-
key: SplitIO.SplitKey,
|
|
66
|
-
trafficType: string,
|
|
67
|
-
labelsEnabled: boolean,
|
|
68
|
-
IPAddressesEnabled: boolean
|
|
69
|
-
},
|
|
70
|
-
readonly mode: SDKMode,
|
|
71
|
-
readonly scheduler: {
|
|
72
|
-
featuresRefreshRate: number,
|
|
73
|
-
impressionsRefreshRate: number,
|
|
74
|
-
impressionsQueueSize: number,
|
|
75
|
-
/**
|
|
76
|
-
* @deprecated
|
|
77
|
-
*/
|
|
78
|
-
metricsRefreshRate?: number,
|
|
79
|
-
telemetryRefreshRate: number,
|
|
80
|
-
segmentsRefreshRate: number,
|
|
81
|
-
offlineRefreshRate: number,
|
|
82
|
-
eventsPushRate: number,
|
|
83
|
-
eventsQueueSize: number,
|
|
84
|
-
pushRetryBackoffBase: number
|
|
85
|
-
},
|
|
86
|
-
readonly startup: {
|
|
87
|
-
readyTimeout: number,
|
|
88
|
-
requestTimeoutBeforeReady: number,
|
|
89
|
-
retriesOnFailureBeforeReady: number,
|
|
90
|
-
eventsFirstPushWindow: number
|
|
91
|
-
},
|
|
92
|
-
readonly storage: {
|
|
93
|
-
prefix: string,
|
|
94
|
-
options: Object,
|
|
95
|
-
type: StorageType
|
|
96
|
-
},
|
|
97
|
-
readonly urls: {
|
|
98
|
-
events: string,
|
|
99
|
-
sdk: string,
|
|
100
|
-
auth: string,
|
|
101
|
-
streaming: string,
|
|
102
|
-
telemetry: string
|
|
103
|
-
},
|
|
104
|
-
readonly debug: boolean | LogLevel,
|
|
105
|
-
readonly version: string,
|
|
106
|
-
/**
|
|
107
|
-
* Mocked features map if using in browser, or mocked features file path string if using in NodeJS.
|
|
108
|
-
*/
|
|
109
|
-
features: SplitIO.MockedFeaturesMap | SplitIO.MockedFeaturesFilePath,
|
|
110
|
-
readonly streamingEnabled: boolean,
|
|
111
|
-
readonly sync: {
|
|
112
|
-
splitFilters: SplitIO.SplitFilter[],
|
|
113
|
-
impressionsMode: SplitIO.ImpressionsMode,
|
|
114
|
-
enabled: boolean
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* User consent status if using in browser. Undefined if using in NodeJS.
|
|
118
|
-
*/
|
|
119
|
-
readonly userConsent?: SplitIO.ConsentStatus
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Log levels.
|
|
123
|
-
* @typedef {string} LogLevel
|
|
124
|
-
*/
|
|
125
|
-
type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'NONE';
|
|
126
|
-
/**
|
|
127
|
-
* Logger API
|
|
128
|
-
* @interface ILoggerAPI
|
|
13
|
+
* Types and interfaces for @splitsoftware/splitio package for usage when integrating javascript sdk on typescript apps.
|
|
14
|
+
* For the SDK package information
|
|
15
|
+
* @see {@link https://www.npmjs.com/package/@splitsoftware/splitio}
|
|
129
16
|
*/
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Enables SDK logging to the console.
|
|
133
|
-
* @function enable
|
|
134
|
-
* @returns {void}
|
|
135
|
-
*/
|
|
136
|
-
enable(): void,
|
|
137
|
-
/**
|
|
138
|
-
* Disables SDK logging.
|
|
139
|
-
* @function disable
|
|
140
|
-
* @returns {void}
|
|
141
|
-
*/
|
|
142
|
-
disable(): void,
|
|
143
|
-
/**
|
|
144
|
-
* Sets a log level for the SDK logs.
|
|
145
|
-
* @function setLogLevel
|
|
146
|
-
* @returns {void}
|
|
147
|
-
*/
|
|
148
|
-
setLogLevel(logLevel: LogLevel): void,
|
|
17
|
+
declare namespace SplitIO {
|
|
149
18
|
/**
|
|
150
|
-
*
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
19
|
+
* Reduced version of NodeJS.EventEmitter interface with the minimal methods used by the SDK
|
|
20
|
+
* @see {@link https://nodejs.org/api/events.html}
|
|
21
|
+
*/
|
|
22
|
+
interface IEventEmitter {
|
|
23
|
+
addListener(event: string, listener: (...args: any[]) => void): this
|
|
24
|
+
on(event: string, listener: (...args: any[]) => void): this
|
|
25
|
+
once(event: string, listener: (...args: any[]) => void): this
|
|
26
|
+
removeListener(event: string, listener: (...args: any[]) => void): this
|
|
27
|
+
off(event: string, listener: (...args: any[]) => void): this
|
|
28
|
+
removeAllListeners(event?: string): this
|
|
29
|
+
emit(event: string, ...args: any[]): boolean
|
|
154
30
|
}
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* User consent API
|
|
158
|
-
* @interface IUserConsentAPI
|
|
159
|
-
*/
|
|
160
|
-
interface IUserConsentAPI {
|
|
161
|
-
/**
|
|
162
|
-
* Set or update the user consent status. Possible values are `true` and `false`, which represent user consent `'GRANTED'` and `'DECLINED'` respectively.
|
|
163
|
-
* - `true ('GRANTED')`: the user has granted consent for tracking events and impressions. The SDK will send them to Split cloud.
|
|
164
|
-
* - `false ('DECLINED')`: the user has declined consent for tracking events and impressions. The SDK will not send them to Split cloud.
|
|
165
|
-
*
|
|
166
|
-
* NOTE: calling this method updates the user consent at a factory level, affecting all clients of the same factory.
|
|
167
|
-
*
|
|
168
|
-
* @function setStatus
|
|
169
|
-
* @param {boolean} userConsent The user consent status, true for 'GRANTED' and false for 'DECLINED'.
|
|
170
|
-
* @returns {boolean} Whether the provided param is a valid value (i.e., a boolean value) or not.
|
|
171
|
-
*/
|
|
172
|
-
setStatus(userConsent: boolean): boolean;
|
|
173
31
|
/**
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
32
|
+
* NodeJS.EventEmitter interface
|
|
33
|
+
* @see {@link https://nodejs.org/api/events.html}
|
|
34
|
+
*/
|
|
35
|
+
interface EventEmitter extends IEventEmitter {
|
|
36
|
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
37
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
|
38
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
|
39
|
+
removeListener(event: string, listener: (...args: any[]) => void): this;
|
|
40
|
+
off(event: string, listener: (...args: any[]) => void): this;
|
|
41
|
+
removeAllListeners(event?: string): this;
|
|
42
|
+
setMaxListeners(n: number): this;
|
|
43
|
+
getMaxListeners(): number;
|
|
44
|
+
listeners(event: string): Function[];
|
|
45
|
+
rawListeners(event: string): Function[];
|
|
46
|
+
emit(event: string, ...args: any[]): boolean;
|
|
47
|
+
listenerCount(type: string): number;
|
|
48
|
+
// Added in Node 6...
|
|
49
|
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
50
|
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
51
|
+
eventNames(): Array<string | symbol>;
|
|
52
|
+
}
|
|
53
|
+
|
|
180
54
|
/**
|
|
181
|
-
*
|
|
55
|
+
* impression DTO generated by the Sdk client when processing evaluations
|
|
182
56
|
*/
|
|
183
|
-
|
|
184
|
-
|
|
57
|
+
type ImpressionDTO = {
|
|
58
|
+
feature: string,
|
|
59
|
+
keyName: string,
|
|
60
|
+
treatment: string,
|
|
61
|
+
time: number,
|
|
62
|
+
bucketingKey?: string,
|
|
63
|
+
label: string,
|
|
64
|
+
changeNumber: number,
|
|
65
|
+
pt?: number,
|
|
185
66
|
}
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Common settings between Browser and NodeJS settings interface.
|
|
189
|
-
* @interface ISharedSettings
|
|
190
|
-
*/
|
|
191
|
-
interface ISharedSettings {
|
|
192
67
|
/**
|
|
193
|
-
*
|
|
194
|
-
* @property {
|
|
195
|
-
* @
|
|
196
|
-
|
|
197
|
-
|
|
68
|
+
* @typedef {Object} EventConsts
|
|
69
|
+
* @property {string} SDK_READY The ready event.
|
|
70
|
+
* @property {string} SDK_READY_FROM_CACHE The ready event when fired with cached data.
|
|
71
|
+
* @property {string} SDK_READY_TIMED_OUT The timeout event.
|
|
72
|
+
* @property {string} SDK_UPDATE The update event.
|
|
73
|
+
*/
|
|
74
|
+
type EventConsts = {
|
|
75
|
+
SDK_READY: 'init::ready',
|
|
76
|
+
SDK_READY_FROM_CACHE: 'init::cache-ready',
|
|
77
|
+
SDK_READY_TIMED_OUT: 'init::timeout',
|
|
78
|
+
SDK_UPDATE: 'state::update'
|
|
79
|
+
};
|
|
198
80
|
/**
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
* @property {IImpressionListener} impressionListener
|
|
202
|
-
* @default undefined
|
|
81
|
+
* SDK Modes.
|
|
82
|
+
* @typedef {string} SDKMode
|
|
203
83
|
*/
|
|
204
|
-
|
|
84
|
+
type SDKMode = 'standalone' | 'localhost' | 'consumer' | 'consumer_partial';
|
|
205
85
|
/**
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* @property {boolean} streamingEnabled
|
|
209
|
-
* @default true
|
|
86
|
+
* Storage types.
|
|
87
|
+
* @typedef {string} StorageType
|
|
210
88
|
*/
|
|
211
|
-
|
|
89
|
+
type StorageType = 'MEMORY' | 'LOCALSTORAGE' | 'REDIS' | 'PLUGGABLE';
|
|
212
90
|
/**
|
|
213
|
-
* SDK
|
|
214
|
-
*
|
|
91
|
+
* Settings interface. This is a representation of the settings the SDK expose, that's why
|
|
92
|
+
* most of it's props are readonly. Only features should be rewritten when localhost mode is active.
|
|
93
|
+
* @interface ISettings
|
|
215
94
|
*/
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
95
|
+
interface ISettings {
|
|
96
|
+
readonly core: {
|
|
97
|
+
authorizationKey: string,
|
|
98
|
+
key?: SplitKey,
|
|
99
|
+
trafficType?: string,
|
|
100
|
+
labelsEnabled: boolean,
|
|
101
|
+
IPAddressesEnabled?: boolean
|
|
102
|
+
},
|
|
103
|
+
readonly mode: SDKMode,
|
|
104
|
+
readonly scheduler: {
|
|
105
|
+
featuresRefreshRate: number,
|
|
106
|
+
impressionsRefreshRate: number,
|
|
107
|
+
impressionsQueueSize: number,
|
|
108
|
+
/**
|
|
109
|
+
* @deprecated
|
|
110
|
+
*/
|
|
111
|
+
metricsRefreshRate?: number,
|
|
112
|
+
telemetryRefreshRate: number,
|
|
113
|
+
segmentsRefreshRate: number,
|
|
114
|
+
offlineRefreshRate: number,
|
|
115
|
+
eventsPushRate: number,
|
|
116
|
+
eventsQueueSize: number,
|
|
117
|
+
pushRetryBackoffBase: number
|
|
118
|
+
},
|
|
119
|
+
readonly startup: {
|
|
120
|
+
readyTimeout: number,
|
|
121
|
+
requestTimeoutBeforeReady: number,
|
|
122
|
+
retriesOnFailureBeforeReady: number,
|
|
123
|
+
eventsFirstPushWindow: number
|
|
124
|
+
},
|
|
125
|
+
readonly storage: {
|
|
126
|
+
prefix: string,
|
|
127
|
+
options: Object,
|
|
128
|
+
type: StorageType
|
|
129
|
+
} | StorageSyncFactory | StorageAsyncFactory,
|
|
130
|
+
readonly urls: {
|
|
131
|
+
events: string,
|
|
132
|
+
sdk: string,
|
|
133
|
+
auth: string,
|
|
134
|
+
streaming: string,
|
|
135
|
+
telemetry: string
|
|
136
|
+
},
|
|
137
|
+
readonly integrations?: BrowserIntegration[] | IntegrationFactory[],
|
|
138
|
+
readonly debug: boolean | LogLevel | ILogger,
|
|
139
|
+
readonly version: string,
|
|
140
|
+
/**
|
|
141
|
+
* Mocked features map.
|
|
142
|
+
*/
|
|
143
|
+
features?: MockedFeaturesMap | MockedFeaturesFilePath,
|
|
144
|
+
readonly streamingEnabled: boolean,
|
|
145
|
+
readonly sync: {
|
|
146
|
+
splitFilters: SplitFilter[],
|
|
147
|
+
impressionsMode: ImpressionsMode,
|
|
148
|
+
enabled: boolean,
|
|
149
|
+
localhostMode?: LocalhostFactory,
|
|
150
|
+
__splitFiltersValidation: ISplitFiltersValidation,
|
|
151
|
+
},
|
|
152
|
+
readonly runtime: {
|
|
153
|
+
ip: string | false
|
|
154
|
+
hostname: string | false
|
|
155
|
+
},
|
|
156
|
+
readonly log: ILogger
|
|
157
|
+
readonly impressionListener?: unknown
|
|
240
158
|
/**
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* When `true` a running SDK will process rollout plan updates performed on the UI (default).
|
|
244
|
-
* When false it'll just fetch all data upon init.
|
|
245
|
-
*
|
|
246
|
-
* @property {boolean} enabled
|
|
247
|
-
* @default true
|
|
159
|
+
* User consent status if using in browser. Undefined if using in NodeJS.
|
|
248
160
|
*/
|
|
249
|
-
|
|
161
|
+
readonly userConsent?: ConsentStatus
|
|
250
162
|
}
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Common settings interface for SDK instances on NodeJS.
|
|
254
|
-
* @interface INodeBasicSettings
|
|
255
|
-
* @extends ISharedSettings
|
|
256
|
-
*/
|
|
257
|
-
interface INodeBasicSettings extends ISharedSettings {
|
|
258
163
|
/**
|
|
259
|
-
*
|
|
260
|
-
* @
|
|
164
|
+
* Log levels.
|
|
165
|
+
* @typedef {string} LogLevel
|
|
261
166
|
*/
|
|
262
|
-
|
|
167
|
+
type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'NONE';
|
|
168
|
+
/**
|
|
169
|
+
* Logger API
|
|
170
|
+
* @interface ILoggerAPI
|
|
171
|
+
*/
|
|
172
|
+
interface ILoggerAPI {
|
|
263
173
|
/**
|
|
264
|
-
*
|
|
265
|
-
* @
|
|
266
|
-
* @
|
|
174
|
+
* Enables SDK logging to the console.
|
|
175
|
+
* @function enable
|
|
176
|
+
* @returns {void}
|
|
267
177
|
*/
|
|
268
|
-
|
|
178
|
+
enable(): void,
|
|
269
179
|
/**
|
|
270
|
-
*
|
|
271
|
-
* @
|
|
272
|
-
* @
|
|
180
|
+
* Disables SDK logging.
|
|
181
|
+
* @function disable
|
|
182
|
+
* @returns {void}
|
|
273
183
|
*/
|
|
274
|
-
|
|
184
|
+
disable(): void,
|
|
275
185
|
/**
|
|
276
|
-
*
|
|
277
|
-
* @
|
|
278
|
-
* @
|
|
186
|
+
* Sets a log level for the SDK logs.
|
|
187
|
+
* @function setLogLevel
|
|
188
|
+
* @returns {void}
|
|
279
189
|
*/
|
|
280
|
-
|
|
190
|
+
setLogLevel(logLevel: LogLevel): void,
|
|
281
191
|
/**
|
|
282
|
-
*
|
|
283
|
-
* to better control on browsers. This number defines that window before the first events push.
|
|
284
|
-
*
|
|
285
|
-
* @property {number} eventsFirstPushWindow
|
|
286
|
-
* @default 0
|
|
192
|
+
* Log level constants. Use this to pass them to setLogLevel function.
|
|
287
193
|
*/
|
|
288
|
-
|
|
289
|
-
|
|
194
|
+
LogLevel: {
|
|
195
|
+
[level in LogLevel]: LogLevel
|
|
196
|
+
}
|
|
197
|
+
}
|
|
290
198
|
/**
|
|
291
|
-
*
|
|
292
|
-
* @
|
|
199
|
+
* User consent API
|
|
200
|
+
* @interface IUserConsentAPI
|
|
293
201
|
*/
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* The SDK polls Split servers for changes to feature roll-out plans. This parameter controls this polling period in seconds.
|
|
297
|
-
* @property {number} featuresRefreshRate
|
|
298
|
-
* @default 5
|
|
299
|
-
*/
|
|
300
|
-
featuresRefreshRate?: number,
|
|
202
|
+
interface IUserConsentAPI {
|
|
301
203
|
/**
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
204
|
+
* Set or update the user consent status. Possible values are `true` and `false`, which represent user consent `'GRANTED'` and `'DECLINED'` respectively.
|
|
205
|
+
* - `true ('GRANTED')`: the user has granted consent for tracking events and impressions. The SDK will send them to Split cloud.
|
|
206
|
+
* - `false ('DECLINED')`: the user has declined consent for tracking events and impressions. The SDK will not send them to Split cloud.
|
|
207
|
+
*
|
|
208
|
+
* NOTE: calling this method updates the user consent at a factory level, affecting all clients of the same factory.
|
|
209
|
+
*
|
|
210
|
+
* @function setStatus
|
|
211
|
+
* @param {boolean} userConsent The user consent status, true for 'GRANTED' and false for 'DECLINED'.
|
|
212
|
+
* @returns {boolean} Whether the provided param is a valid value (i.e., a boolean value) or not.
|
|
305
213
|
*/
|
|
306
|
-
|
|
214
|
+
setStatus(userConsent: boolean): boolean;
|
|
307
215
|
/**
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
* @
|
|
311
|
-
* @
|
|
216
|
+
* Get the user consent status.
|
|
217
|
+
*
|
|
218
|
+
* @function getStatus
|
|
219
|
+
* @returns {ConsentStatus} The user consent status.
|
|
312
220
|
*/
|
|
313
|
-
|
|
221
|
+
getStatus(): ConsentStatus;
|
|
314
222
|
/**
|
|
315
|
-
*
|
|
316
|
-
* @property {number} metricsRefreshRate
|
|
317
|
-
* @default 120
|
|
318
|
-
* @deprecated This parameter is ignored now. Use `telemetryRefreshRate` instead.
|
|
223
|
+
* Consent status constants. Use this to compare with the getStatus function result.
|
|
319
224
|
*/
|
|
320
|
-
|
|
225
|
+
Status: {
|
|
226
|
+
[status in ConsentStatus]: ConsentStatus
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Common settings between Browser and NodeJS settings interface.
|
|
231
|
+
* @interface ISharedSettings
|
|
232
|
+
*/
|
|
233
|
+
interface ISharedSettings {
|
|
321
234
|
/**
|
|
322
|
-
*
|
|
323
|
-
* @property {
|
|
324
|
-
* @default 3600
|
|
235
|
+
* SDK Core settings.
|
|
236
|
+
* @property {Object} core
|
|
325
237
|
*/
|
|
326
|
-
|
|
238
|
+
core: {
|
|
239
|
+
/**
|
|
240
|
+
* Your API key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
|
|
241
|
+
* @property {string} authorizationKey
|
|
242
|
+
*/
|
|
243
|
+
authorizationKey: string,
|
|
244
|
+
/**
|
|
245
|
+
* Disable labels from being sent to Split backend. Labels may contain sensitive information.
|
|
246
|
+
* This configuration is applicable if the SDK is running in "standalone" or "partial consumer" mode.
|
|
247
|
+
* @property {boolean} labelsEnabled
|
|
248
|
+
* @default true
|
|
249
|
+
*/
|
|
250
|
+
labelsEnabled?: boolean
|
|
251
|
+
},
|
|
327
252
|
/**
|
|
328
|
-
* The SDK
|
|
329
|
-
*
|
|
330
|
-
* @
|
|
253
|
+
* The SDK mode. Possible values are "standalone", which is the default when using a synchronous storage, like 'MEMORY' and 'LOCALSTORAGE',
|
|
254
|
+
* and "consumer", which must be set when using an asynchronous storage, like 'REDIS'. For "localhost" mode, use "localhost" as authorizationKey.
|
|
255
|
+
* @property {SDKMode} mode
|
|
256
|
+
* @default standalone
|
|
331
257
|
*/
|
|
332
|
-
|
|
258
|
+
mode?: SDKMode,
|
|
333
259
|
/**
|
|
334
|
-
* The
|
|
335
|
-
*
|
|
336
|
-
* @
|
|
260
|
+
* The impression listener, which is optional. Whatever you provide here needs to comply with the IImpressionListener interface,
|
|
261
|
+
* which will check for the logImpression method.
|
|
262
|
+
* @property {IImpressionListener} impressionListener
|
|
263
|
+
* @default undefined
|
|
337
264
|
*/
|
|
338
|
-
|
|
265
|
+
impressionListener?: IImpressionListener,
|
|
339
266
|
/**
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
* @
|
|
267
|
+
* Boolean flag to enable the streaming service as default synchronization mechanism. In the event of any issue with streaming,
|
|
268
|
+
* the SDK would fallback to the polling mechanism. If false, the SDK would poll for changes as usual without attempting to use streaming.
|
|
269
|
+
* This configuration is applicable if the SDK is running in "standalone" mode.
|
|
270
|
+
* @property {boolean} streamingEnabled
|
|
271
|
+
* @default true
|
|
344
272
|
*/
|
|
345
|
-
|
|
273
|
+
streamingEnabled?: boolean,
|
|
346
274
|
/**
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
* @property {number} offlineRefreshRate
|
|
350
|
-
* @default 15
|
|
275
|
+
* SDK synchronization settings.
|
|
276
|
+
* @property {Object} sync
|
|
351
277
|
*/
|
|
352
|
-
|
|
278
|
+
sync?: {
|
|
279
|
+
/**
|
|
280
|
+
* List of Split filters. These filters are used to fetch a subset of the Splits definitions in your environment, in order to reduce the delay of the SDK to be ready.
|
|
281
|
+
* This configuration is applicable if the SDK is running in "standalone" mode.
|
|
282
|
+
*
|
|
283
|
+
* At the moment, two types of split filters are supported: by name and by prefix.
|
|
284
|
+
*
|
|
285
|
+
* Example:
|
|
286
|
+
* `splitFilter: [
|
|
287
|
+
* { type: 'byName', values: ['my_split_1', 'my_split_2'] }, // will fetch splits named 'my_split_1' and 'my_split_2'
|
|
288
|
+
* { type: 'byPrefix', values: ['testing'] } // will fetch splits whose names start with 'testing__' prefix
|
|
289
|
+
* ]`
|
|
290
|
+
* @property {SplitFilter[]} splitFilters
|
|
291
|
+
*/
|
|
292
|
+
splitFilters?: SplitFilter[]
|
|
293
|
+
/**
|
|
294
|
+
* Impressions Collection Mode. Option to determine how impressions are going to be sent to Split Servers.
|
|
295
|
+
* Possible values are 'DEBUG' and 'OPTIMIZED'.
|
|
296
|
+
* - DEBUG: will send all the impressions generated (recommended only for debugging purposes).
|
|
297
|
+
* - OPTIMIZED: will send unique impressions to Split Servers avoiding a considerable amount of traffic that duplicated impressions could generate.
|
|
298
|
+
* @property {string} impressionsMode
|
|
299
|
+
* @default 'OPTIMIZED'
|
|
300
|
+
*/
|
|
301
|
+
impressionsMode?: ImpressionsMode,
|
|
302
|
+
/**
|
|
303
|
+
* Controls the SDK continuous synchronization flags.
|
|
304
|
+
*
|
|
305
|
+
* When `true` a running SDK will process rollout plan updates performed on the UI (default).
|
|
306
|
+
* When false it'll just fetch all data upon init.
|
|
307
|
+
* This configuration is applicable if the SDK is running in "standalone" mode.
|
|
308
|
+
*
|
|
309
|
+
* @property {boolean} enabled
|
|
310
|
+
* @default true
|
|
311
|
+
*/
|
|
312
|
+
enabled?: boolean
|
|
313
|
+
},
|
|
353
314
|
/**
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
* @
|
|
315
|
+
* List of URLs that the SDK will use as base for it's synchronization functionalities.
|
|
316
|
+
* This configuration is applicable if the SDK is running in "standalone" or "partial consumer" mode.
|
|
317
|
+
* Do not change these settings unless you're working an advanced use case, like connecting to the Split proxy.
|
|
318
|
+
* @property {Object} urls
|
|
358
319
|
*/
|
|
359
|
-
|
|
360
|
-
}
|
|
320
|
+
urls?: UrlSettings,
|
|
321
|
+
}
|
|
322
|
+
// @TODO Should extends IEventEmitter for React Native and JS Browser SDK
|
|
361
323
|
/**
|
|
362
|
-
*
|
|
363
|
-
* @
|
|
324
|
+
* Common API for entities that expose status handlers.
|
|
325
|
+
* @interface IStatusInterface
|
|
326
|
+
* @extends IEventEmitter
|
|
364
327
|
*/
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* Your API key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
|
|
368
|
-
* @property {string} authorizationKey
|
|
369
|
-
*/
|
|
370
|
-
authorizationKey: string,
|
|
328
|
+
interface IStatusInterface extends IEventEmitter {
|
|
371
329
|
/**
|
|
372
|
-
*
|
|
373
|
-
* @property {
|
|
374
|
-
* @default true
|
|
330
|
+
* Constant object containing the SDK events for you to use.
|
|
331
|
+
* @property {EventConsts} Event
|
|
375
332
|
*/
|
|
376
|
-
|
|
333
|
+
Event: EventConsts,
|
|
377
334
|
/**
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
*
|
|
335
|
+
* Returns a promise that will be resolved once the SDK has finished loading (SDK_READY event emitted) or rejected if the SDK has timedout (SDK_READY_TIMED_OUT event emitted).
|
|
336
|
+
* As it's meant to provide similar flexibility to the event approach, given that the SDK might be eventually ready after a timeout event, calling the `ready` method after the
|
|
337
|
+
* SDK had timed out will return a new promise that should eventually resolve if the SDK gets ready.
|
|
338
|
+
*
|
|
339
|
+
* Caveats: the method was designed to avoid an unhandled Promise rejection if the rejection case is not handled, so that `onRejected` handler is optional when using promises.
|
|
340
|
+
* However, when using async/await syntax, the rejection should be explicitly propagated like in the following example:
|
|
341
|
+
* ```
|
|
342
|
+
* try {
|
|
343
|
+
* await client.ready().catch((e) => { throw e; });
|
|
344
|
+
* // SDK is ready
|
|
345
|
+
* } catch(e) {
|
|
346
|
+
* // SDK has timedout
|
|
347
|
+
* }
|
|
348
|
+
* ```
|
|
349
|
+
*
|
|
350
|
+
* @function ready
|
|
351
|
+
* @returns {Promise<void>}
|
|
381
352
|
*/
|
|
382
|
-
|
|
383
|
-
}
|
|
353
|
+
ready(): Promise<void>
|
|
354
|
+
}
|
|
384
355
|
/**
|
|
385
|
-
*
|
|
386
|
-
* @
|
|
356
|
+
* Common definitions between clients for different environments interface.
|
|
357
|
+
* @interface IBasicClient
|
|
358
|
+
* @extends IStatusInterface
|
|
387
359
|
*/
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* Storage type to be instantiated by the SDK.
|
|
391
|
-
* @property {StorageType} type
|
|
392
|
-
* @default MEMORY
|
|
393
|
-
*/
|
|
394
|
-
type?: StorageType,
|
|
360
|
+
interface IBasicClient extends IStatusInterface {
|
|
395
361
|
/**
|
|
396
|
-
*
|
|
397
|
-
* @
|
|
362
|
+
* Destroy the client instance.
|
|
363
|
+
* @function destroy
|
|
364
|
+
* @returns {Promise<void>}
|
|
398
365
|
*/
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
* @property {string} prefix
|
|
403
|
-
* @default SPLITIO
|
|
404
|
-
*/
|
|
405
|
-
prefix?: string
|
|
406
|
-
},
|
|
407
|
-
/**
|
|
408
|
-
* The SDK mode. Possible values are "standalone", which is the default when using a synchronous storage, like 'MEMORY' and 'LOCALSTORAGE',
|
|
409
|
-
* and "consumer", which must be set when using an asynchronous storage, like 'REDIS'. For "localhost" mode, use "localhost" as authorizationKey.
|
|
410
|
-
* @property {SDKMode} mode
|
|
411
|
-
* @default standalone
|
|
412
|
-
*/
|
|
413
|
-
mode?: SDKMode,
|
|
414
|
-
/**
|
|
415
|
-
* Mocked features file path. For testing purposses only. For using this you should specify "localhost" as authorizationKey on core settings.
|
|
416
|
-
* @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
|
|
417
|
-
* @property {MockedFeaturesFilePath} features
|
|
418
|
-
* @default $HOME/.split
|
|
419
|
-
*/
|
|
420
|
-
features?: SplitIO.MockedFeaturesFilePath,
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
* Common API for entities that expose status handlers.
|
|
424
|
-
* @interface IStatusInterface
|
|
425
|
-
* @extends EventEmitter
|
|
426
|
-
*/
|
|
427
|
-
interface IStatusInterface extends EventEmitter {
|
|
428
|
-
/**
|
|
429
|
-
* Constant object containing the SDK events for you to use.
|
|
430
|
-
* @property {EventConsts} Event
|
|
431
|
-
*/
|
|
432
|
-
Event: EventConsts,
|
|
433
|
-
/**
|
|
434
|
-
* Returns a promise that will be resolved once the SDK has finished loading (SDK_READY event emitted) or rejected if the SDK has timedout (SDK_READY_TIMED_OUT event emitted).
|
|
435
|
-
* As it's meant to provide similar flexibility to the event approach, given that the SDK might be eventually ready after a timeout event, calling the `ready` method after the
|
|
436
|
-
* SDK had timed out will return a new promise that should eventually resolve if the SDK gets ready.
|
|
437
|
-
*
|
|
438
|
-
* Caveats: the method was designed to avoid an unhandled Promise rejection if the rejection case is not handled, so that `onRejected` handler is optional when using promises.
|
|
439
|
-
* However, when using async/await syntax, the rejection should be explicitly propagated like in the following example:
|
|
440
|
-
* ```
|
|
441
|
-
* try {
|
|
442
|
-
* await client.ready().catch((e) => { throw e; });
|
|
443
|
-
* // SDK is ready
|
|
444
|
-
* } catch(e) {
|
|
445
|
-
* // SDK has timedout
|
|
446
|
-
* }
|
|
447
|
-
* ```
|
|
448
|
-
*
|
|
449
|
-
* @function ready
|
|
450
|
-
* @returns {Promise<void>}
|
|
451
|
-
*/
|
|
452
|
-
ready(): Promise<void>
|
|
453
|
-
}
|
|
454
|
-
/**
|
|
455
|
-
* Common definitions between clients for different environments interface.
|
|
456
|
-
* @interface IBasicClient
|
|
457
|
-
* @extends IStatusInterface
|
|
458
|
-
*/
|
|
459
|
-
interface IBasicClient extends IStatusInterface {
|
|
460
|
-
/**
|
|
461
|
-
* Destroy the client instance.
|
|
462
|
-
* @function destroy
|
|
463
|
-
* @returns {Promise<void>}
|
|
464
|
-
*/
|
|
465
|
-
destroy(): Promise<void>
|
|
466
|
-
}
|
|
467
|
-
/**
|
|
468
|
-
* Common definitions between SDK instances for different environments interface.
|
|
469
|
-
* @interface IBasicSDK
|
|
470
|
-
*/
|
|
471
|
-
interface IBasicSDK {
|
|
472
|
-
/**
|
|
473
|
-
* Current settings of the SDK instance.
|
|
474
|
-
* @property settings
|
|
475
|
-
*/
|
|
476
|
-
settings: ISettings,
|
|
477
|
-
/**
|
|
478
|
-
* Logger API.
|
|
479
|
-
* @property Logger
|
|
480
|
-
*/
|
|
481
|
-
Logger: ILoggerAPI
|
|
482
|
-
}
|
|
483
|
-
/****** Exposed namespace ******/
|
|
484
|
-
/**
|
|
485
|
-
* Types and interfaces for @splitsoftware/splitio package for usage when integrating javascript sdk on typescript apps.
|
|
486
|
-
* For the SDK package information
|
|
487
|
-
* @see {@link https://www.npmjs.com/package/@splitsoftware/splitio}
|
|
488
|
-
*/
|
|
489
|
-
declare namespace SplitIO {
|
|
366
|
+
destroy(): Promise<void>
|
|
367
|
+
}
|
|
368
|
+
|
|
490
369
|
/**
|
|
491
370
|
* Split treatment value, returned by getTreatment.
|
|
492
371
|
* @typedef {string} Treatment
|
|
@@ -509,7 +388,7 @@ declare namespace SplitIO {
|
|
|
509
388
|
[featureName: string]: Treatment
|
|
510
389
|
};
|
|
511
390
|
/**
|
|
512
|
-
* Split treatments promise that will resolve to the actual
|
|
391
|
+
* Split treatments promise that will resolve to the actual Treatments object.
|
|
513
392
|
* @typedef {Promise<Treatments>} AsyncTreatments
|
|
514
393
|
*/
|
|
515
394
|
type AsyncTreatments = Promise<Treatments>;
|
|
@@ -541,7 +420,7 @@ declare namespace SplitIO {
|
|
|
541
420
|
[featureName: string]: TreatmentWithConfig
|
|
542
421
|
};
|
|
543
422
|
/**
|
|
544
|
-
* Split treatments promise that will resolve to the actual
|
|
423
|
+
* Split treatments promise that will resolve to the actual TreatmentsWithConfig object.
|
|
545
424
|
* @typedef {Promise<TreatmentsWithConfig>} AsyncTreatmentsWithConfig
|
|
546
425
|
*/
|
|
547
426
|
type AsyncTreatmentsWithConfig = Promise<TreatmentsWithConfig>;
|
|
@@ -596,25 +475,21 @@ declare namespace SplitIO {
|
|
|
596
475
|
type MockedFeaturesMap = {
|
|
597
476
|
[featureName: string]: string | TreatmentWithConfig
|
|
598
477
|
};
|
|
478
|
+
/**
|
|
479
|
+
* Localhost types.
|
|
480
|
+
* @typedef {string} LocalhostType
|
|
481
|
+
*/
|
|
482
|
+
type LocalhostType = 'LocalhostFromObject'
|
|
599
483
|
/**
|
|
600
484
|
* Object with information about an impression. It contains the generated impression DTO as well as
|
|
601
485
|
* complementary information around where and how it was generated in that way.
|
|
602
486
|
* @typedef {Object} ImpressionData
|
|
603
487
|
*/
|
|
604
488
|
type ImpressionData = {
|
|
605
|
-
impression:
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
time: number,
|
|
610
|
-
bucketingKey?: string,
|
|
611
|
-
label: string,
|
|
612
|
-
changeNumber: number,
|
|
613
|
-
pt?: number,
|
|
614
|
-
},
|
|
615
|
-
attributes?: SplitIO.Attributes,
|
|
616
|
-
ip: string,
|
|
617
|
-
hostname: string,
|
|
489
|
+
impression: ImpressionDTO,
|
|
490
|
+
attributes?: Attributes,
|
|
491
|
+
ip: string | false,
|
|
492
|
+
hostname: string | false,
|
|
618
493
|
sdkLanguageVersion: string
|
|
619
494
|
};
|
|
620
495
|
/**
|
|
@@ -662,11 +537,11 @@ declare namespace SplitIO {
|
|
|
662
537
|
*/
|
|
663
538
|
type SplitViewAsync = Promise<SplitView | null>;
|
|
664
539
|
/**
|
|
665
|
-
* An array containing the
|
|
540
|
+
* An array containing the SplitView elements.
|
|
666
541
|
*/
|
|
667
542
|
type SplitViews = Array<SplitView>;
|
|
668
543
|
/**
|
|
669
|
-
* A promise that will be resolved with an
|
|
544
|
+
* A promise that will be resolved with an SplitViews array.
|
|
670
545
|
* @typedef {Promise<SplitViews>} SplitViewsAsync
|
|
671
546
|
*/
|
|
672
547
|
type SplitViewsAsync = Promise<SplitViews>;
|
|
@@ -695,6 +570,68 @@ declare namespace SplitIO {
|
|
|
695
570
|
* @typedef {string} BrowserStorage
|
|
696
571
|
*/
|
|
697
572
|
type BrowserStorage = 'MEMORY' | 'LOCALSTORAGE';
|
|
573
|
+
/**
|
|
574
|
+
* Storage for synchronous (standalone) SDK.
|
|
575
|
+
* Its interface details are not part of the public API.
|
|
576
|
+
*/
|
|
577
|
+
type StorageSync = any;
|
|
578
|
+
/**
|
|
579
|
+
* Storage builder for synchronous (standalone) SDK.
|
|
580
|
+
* By returning undefined, the SDK will use the default IN MEMORY storage.
|
|
581
|
+
* Input parameter details are not part of the public API.
|
|
582
|
+
*/
|
|
583
|
+
type StorageSyncFactory = {
|
|
584
|
+
readonly type: StorageType
|
|
585
|
+
(params: any): (StorageSync | undefined)
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Configuration params for `InLocalStorage`
|
|
589
|
+
*/
|
|
590
|
+
type InLocalStorageOptions = {
|
|
591
|
+
/**
|
|
592
|
+
* Optional prefix to prevent any kind of data collision when having multiple factories using the same storage type.
|
|
593
|
+
* @property {string} prefix
|
|
594
|
+
* @default SPLITIO
|
|
595
|
+
*/
|
|
596
|
+
prefix?: string
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Storage for asynchronous (consumer) SDK.
|
|
600
|
+
* Its interface details are not part of the public API.
|
|
601
|
+
*/
|
|
602
|
+
type StorageAsync = any
|
|
603
|
+
/**
|
|
604
|
+
* Storage builder for asynchronous (consumer) SDK.
|
|
605
|
+
* Input parameter details are not part of the public API.
|
|
606
|
+
*/
|
|
607
|
+
type StorageAsyncFactory = {
|
|
608
|
+
readonly type: StorageType
|
|
609
|
+
(params: any): StorageAsync
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Configuration params for `PluggableStorage`
|
|
613
|
+
*/
|
|
614
|
+
type PluggableStorageOptions = {
|
|
615
|
+
/**
|
|
616
|
+
* Optional prefix to prevent any kind of data collision when having multiple factories using the same storage wrapper.
|
|
617
|
+
* @property {string} prefix
|
|
618
|
+
* @default SPLITIO
|
|
619
|
+
*/
|
|
620
|
+
prefix?: string,
|
|
621
|
+
/**
|
|
622
|
+
* Storage wrapper.
|
|
623
|
+
* @property {Object} wrapper
|
|
624
|
+
*/
|
|
625
|
+
wrapper: Object
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Localhost mode factory.
|
|
629
|
+
* Its interface details are not part of the public API.
|
|
630
|
+
*/
|
|
631
|
+
type LocalhostFactory = {
|
|
632
|
+
readonly type: LocalhostType
|
|
633
|
+
(params: any): any
|
|
634
|
+
}
|
|
698
635
|
/**
|
|
699
636
|
* Impression listener interface. This is the interface that needs to be implemented
|
|
700
637
|
* by the element you provide to the SDK as impression listener.
|
|
@@ -702,7 +639,21 @@ declare namespace SplitIO {
|
|
|
702
639
|
* @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#listener}
|
|
703
640
|
*/
|
|
704
641
|
interface IImpressionListener {
|
|
705
|
-
logImpression(data:
|
|
642
|
+
logImpression(data: ImpressionData): void
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* SDK integration instance.
|
|
646
|
+
* Its interface details are not part of the public API.
|
|
647
|
+
*/
|
|
648
|
+
type Integration = any;
|
|
649
|
+
/**
|
|
650
|
+
* SDK integration factory.
|
|
651
|
+
* By returning an integration, the SDK will queue events and impressions into it.
|
|
652
|
+
* Input parameter details are not part of the public API.
|
|
653
|
+
*/
|
|
654
|
+
type IntegrationFactory = {
|
|
655
|
+
readonly type: string
|
|
656
|
+
(params: any): (Integration | void)
|
|
706
657
|
}
|
|
707
658
|
/**
|
|
708
659
|
* A pair of user key and it's trafficType, required for tracking valid Split events.
|
|
@@ -731,8 +682,15 @@ declare namespace SplitIO {
|
|
|
731
682
|
*
|
|
732
683
|
* @see {@link https://help.split.io/hc/en-us/articles/360040838752#google-analytics-to-split}
|
|
733
684
|
*/
|
|
734
|
-
interface IGoogleAnalyticsToSplitConfig {
|
|
685
|
+
interface IGoogleAnalyticsToSplitConfig extends GoogleAnalyticsToSplitOptions {
|
|
735
686
|
type: 'GOOGLE_ANALYTICS_TO_SPLIT',
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Configuration params for 'Google Analytics to Split' integration plugin, to track Google Analytics hits as Split events.
|
|
690
|
+
*
|
|
691
|
+
* @see {@link https://help.split.io/hc/en-us/articles/360040838752#google-analytics-to-split}
|
|
692
|
+
*/
|
|
693
|
+
interface GoogleAnalyticsToSplitOptions {
|
|
736
694
|
/**
|
|
737
695
|
* Optional flag to filter GA hits from being tracked as Split events.
|
|
738
696
|
* @property {boolean} hits
|
|
@@ -759,7 +717,7 @@ declare namespace SplitIO {
|
|
|
759
717
|
* return defaultMapping;
|
|
760
718
|
* }`
|
|
761
719
|
*/
|
|
762
|
-
mapper?: (model: UniversalAnalytics.Model, defaultMapping:
|
|
720
|
+
mapper?: (model: UniversalAnalytics.Model, defaultMapping: EventData) => EventData,
|
|
763
721
|
/**
|
|
764
722
|
* Optional prefix for EventTypeId, to prevent any kind of data collision between events.
|
|
765
723
|
* @property {string} prefix
|
|
@@ -768,7 +726,7 @@ declare namespace SplitIO {
|
|
|
768
726
|
prefix?: string,
|
|
769
727
|
/**
|
|
770
728
|
* List of Split identities (key & traffic type pairs) used to track events.
|
|
771
|
-
* If not provided, events are sent using the key and traffic type provided at SDK config
|
|
729
|
+
* If not provided, events are sent using the key and traffic type provided at SDK config.
|
|
772
730
|
*/
|
|
773
731
|
identities?: Identity[],
|
|
774
732
|
/**
|
|
@@ -789,14 +747,21 @@ declare namespace SplitIO {
|
|
|
789
747
|
* @property {string} type The type of Split data, either 'IMPRESSION' or 'EVENT'.
|
|
790
748
|
* @property {ImpressionData | EventData} payload The data instance itself.
|
|
791
749
|
*/
|
|
792
|
-
type IntegrationData = { type: 'IMPRESSION', payload:
|
|
750
|
+
type IntegrationData = { type: 'IMPRESSION', payload: ImpressionData } | { type: 'EVENT', payload: EventData };
|
|
793
751
|
/**
|
|
794
752
|
* Enable 'Split to Google Analytics' integration, to track Split impressions and events as Google Analytics hits.
|
|
795
753
|
*
|
|
796
754
|
* @see {@link https://help.split.io/hc/en-us/articles/360040838752#split-to-google-analytics}
|
|
797
755
|
*/
|
|
798
|
-
interface ISplitToGoogleAnalyticsConfig {
|
|
756
|
+
interface ISplitToGoogleAnalyticsConfig extends SplitToGoogleAnalyticsOptions {
|
|
799
757
|
type: 'SPLIT_TO_GOOGLE_ANALYTICS',
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Configuration params for 'Split to Google Analytics' integration plugin, to track Split impressions and events as Google Analytics hits.
|
|
761
|
+
*
|
|
762
|
+
* @see {@link https://help.split.io/hc/en-us/articles/360040838752#split-to-google-analytics}
|
|
763
|
+
*/
|
|
764
|
+
interface SplitToGoogleAnalyticsOptions {
|
|
800
765
|
/**
|
|
801
766
|
* Optional flag to filter Split impressions from being tracked as GA hits.
|
|
802
767
|
* @property {boolean} impressions
|
|
@@ -814,7 +779,7 @@ declare namespace SplitIO {
|
|
|
814
779
|
* For example, the following filter allows to track only impressions, equivalent to setting events to false:
|
|
815
780
|
* `(data) => data.type === 'IMPRESSION'`
|
|
816
781
|
*/
|
|
817
|
-
filter?: (data:
|
|
782
|
+
filter?: (data: IntegrationData) => boolean,
|
|
818
783
|
/**
|
|
819
784
|
* Optional function useful when you need to modify the GA hit before sending it.
|
|
820
785
|
* This function is invoked with two arguments:
|
|
@@ -845,7 +810,7 @@ declare namespace SplitIO {
|
|
|
845
810
|
* nonInteraction: true,
|
|
846
811
|
* }`
|
|
847
812
|
*/
|
|
848
|
-
mapper?: (data:
|
|
813
|
+
mapper?: (data: IntegrationData, defaultMapping: UniversalAnalytics.FieldsObject) => UniversalAnalytics.FieldsObject,
|
|
849
814
|
/**
|
|
850
815
|
* List of tracker names to send the hit. An empty string represents the default tracker.
|
|
851
816
|
* If not provided, hits are only sent to default tracker.
|
|
@@ -912,6 +877,11 @@ declare namespace SplitIO {
|
|
|
912
877
|
*/
|
|
913
878
|
values: string[],
|
|
914
879
|
}
|
|
880
|
+
type ISplitFiltersValidation = {
|
|
881
|
+
queryString: string | null,
|
|
882
|
+
groupedFilters: Record<SplitFilterType, string[]>,
|
|
883
|
+
validFilters: SplitFilter[]
|
|
884
|
+
};
|
|
915
885
|
/**
|
|
916
886
|
* ImpressionsMode type
|
|
917
887
|
* @typedef {string} ImpressionsMode
|
|
@@ -923,31 +893,117 @@ declare namespace SplitIO {
|
|
|
923
893
|
*/
|
|
924
894
|
type ConsentStatus = 'GRANTED' | 'DECLINED' | 'UNKNOWN';
|
|
925
895
|
/**
|
|
926
|
-
*
|
|
927
|
-
*
|
|
896
|
+
* Logger
|
|
897
|
+
* Its interface details are not part of the public API. It shouldn't be used directly.
|
|
898
|
+
* @interface ILogger
|
|
899
|
+
*/
|
|
900
|
+
interface ILogger {
|
|
901
|
+
setLogLevel(logLevel: LogLevel): void
|
|
902
|
+
debug(msg: any): void
|
|
903
|
+
debug(msg: string | number, args?: any[]): void
|
|
904
|
+
info(msg: any): void
|
|
905
|
+
info(msg: string | number, args?: any[]): void
|
|
906
|
+
warn(msg: any): void
|
|
907
|
+
warn(msg: string | number, args?: any[]): void
|
|
908
|
+
error(msg: any): void
|
|
909
|
+
error(msg: string | number, args?: any[]): void
|
|
910
|
+
}
|
|
911
|
+
/**
|
|
912
|
+
* Common settings interface with non-pluggable API (JS SDK).
|
|
913
|
+
* @interface IStaticSettings
|
|
914
|
+
* @extends ISharedSettings
|
|
915
|
+
*/
|
|
916
|
+
interface IStaticSettings {
|
|
917
|
+
/**
|
|
918
|
+
* Whether the logger should be enabled or disabled by default.
|
|
919
|
+
* @property {Boolean} debug
|
|
920
|
+
* @default false
|
|
921
|
+
*/
|
|
922
|
+
debug?: boolean | LogLevel,
|
|
923
|
+
}
|
|
924
|
+
/**
|
|
925
|
+
* Common settings interface with pluggable API (JS Browser and React Native SDKs).
|
|
926
|
+
* @interface IPluggableSettings
|
|
927
|
+
* @extends ISharedSettings
|
|
928
|
+
*/
|
|
929
|
+
interface IPluggableSettings {
|
|
930
|
+
/**
|
|
931
|
+
* Boolean value to indicate whether the logger should be enabled or disabled by default, or a log level string or a Logger object.
|
|
932
|
+
* Passing a logger object is required to get descriptive log messages. Otherwise most logs will print with message codes.
|
|
933
|
+
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#logging}
|
|
934
|
+
*
|
|
935
|
+
* Examples:
|
|
936
|
+
* ```typescript
|
|
937
|
+
* config.debug = true
|
|
938
|
+
* config.debug = 'WARN'
|
|
939
|
+
* config.debug = ErrorLogger()
|
|
940
|
+
* ```
|
|
941
|
+
* @property {boolean | LogLevel | ILogger} debug
|
|
942
|
+
* @default false
|
|
943
|
+
*/
|
|
944
|
+
debug?: boolean | LogLevel | ILogger,
|
|
945
|
+
/**
|
|
946
|
+
* Defines an optional list of factory functions used to instantiate SDK integrations.
|
|
947
|
+
*
|
|
948
|
+
* Example:
|
|
949
|
+
* ```typescript
|
|
950
|
+
* SplitFactory({
|
|
951
|
+
* ...
|
|
952
|
+
* integrations: [SplitToGoogleAnalytics(), GoogleAnalyticsToSplit()]
|
|
953
|
+
* })
|
|
954
|
+
* ```
|
|
955
|
+
* @property {Object} integrations
|
|
956
|
+
*/
|
|
957
|
+
integrations?: IntegrationFactory[],
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* Common settings interface for SDK instances on NodeJS.
|
|
961
|
+
* @interface IServerSideSharedSettings
|
|
928
962
|
* @extends ISharedSettings
|
|
929
|
-
* @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#configuration}
|
|
930
963
|
*/
|
|
931
|
-
interface
|
|
964
|
+
interface IServerSideSharedSettings extends ISharedSettings {
|
|
932
965
|
/**
|
|
933
|
-
* SDK
|
|
966
|
+
* SDK Core settings for NodeJS.
|
|
967
|
+
* @property {Object} core
|
|
968
|
+
*/
|
|
969
|
+
core: ISharedSettings['core'] & {
|
|
970
|
+
/**
|
|
971
|
+
* Disable machine IP and Name from being sent to Split backend.
|
|
972
|
+
* @property {boolean} IPAddressesEnabled
|
|
973
|
+
* @default true
|
|
974
|
+
*/
|
|
975
|
+
IPAddressesEnabled?: boolean
|
|
976
|
+
},
|
|
977
|
+
/**
|
|
978
|
+
* Mocked features file path. For testing purposses only. For using this you should specify "localhost" as authorizationKey on core settings.
|
|
979
|
+
* @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
|
|
980
|
+
* @property {MockedFeaturesFilePath} features
|
|
981
|
+
* @default $HOME/.split
|
|
982
|
+
*/
|
|
983
|
+
features?: MockedFeaturesFilePath,
|
|
984
|
+
/**
|
|
985
|
+
* SDK Startup settings for NodeJS.
|
|
934
986
|
* @property {Object} startup
|
|
935
987
|
*/
|
|
936
988
|
startup?: {
|
|
937
989
|
/**
|
|
938
990
|
* Maximum amount of time used before notify a timeout.
|
|
939
991
|
* @property {number} readyTimeout
|
|
940
|
-
* @default
|
|
992
|
+
* @default 15
|
|
941
993
|
*/
|
|
942
994
|
readyTimeout?: number,
|
|
943
995
|
/**
|
|
944
996
|
* 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'.
|
|
997
|
+
*
|
|
998
|
+
* NOTE: this param is applicable in "standalone" mode.
|
|
945
999
|
* @property {number} requestTimeoutBeforeReady
|
|
946
|
-
* @default
|
|
1000
|
+
* @default 15
|
|
947
1001
|
*/
|
|
948
1002
|
requestTimeoutBeforeReady?: number,
|
|
949
1003
|
/**
|
|
950
1004
|
* How many quick retries we will do while starting up the SDK.
|
|
1005
|
+
*
|
|
1006
|
+
* NOTE: this param is applicable in "standalone" mode.
|
|
951
1007
|
* @property {number} retriesOnFailureBeforeReady
|
|
952
1008
|
* @default 1
|
|
953
1009
|
*/
|
|
@@ -956,8 +1012,9 @@ declare namespace SplitIO {
|
|
|
956
1012
|
* For SDK posts the queued events data in bulks with a given rate, but the first push window is defined separately,
|
|
957
1013
|
* to better control on browsers. This number defines that window before the first events push.
|
|
958
1014
|
*
|
|
1015
|
+
* NOTE: this param is ignored in "consumer" mode.
|
|
959
1016
|
* @property {number} eventsFirstPushWindow
|
|
960
|
-
* @default
|
|
1017
|
+
* @default 0
|
|
961
1018
|
*/
|
|
962
1019
|
eventsFirstPushWindow?: number,
|
|
963
1020
|
},
|
|
@@ -968,19 +1025,33 @@ declare namespace SplitIO {
|
|
|
968
1025
|
scheduler?: {
|
|
969
1026
|
/**
|
|
970
1027
|
* The SDK polls Split servers for changes to feature roll-out plans. This parameter controls this polling period in seconds.
|
|
1028
|
+
*
|
|
1029
|
+
* NOTE: this param is applicable in "standalone" mode.
|
|
971
1030
|
* @property {number} featuresRefreshRate
|
|
972
|
-
* @default
|
|
1031
|
+
* @default 5
|
|
973
1032
|
*/
|
|
974
1033
|
featuresRefreshRate?: number,
|
|
1034
|
+
/**
|
|
1035
|
+
* The SDK polls Split servers for changes to segment definitions. This parameter controls this polling period in seconds.
|
|
1036
|
+
*
|
|
1037
|
+
* NOTE: this param is applicable in "standalone" mode.
|
|
1038
|
+
* @property {number} segmentsRefreshRate
|
|
1039
|
+
* @default 60
|
|
1040
|
+
*/
|
|
1041
|
+
segmentsRefreshRate?: number,
|
|
975
1042
|
/**
|
|
976
1043
|
* 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.
|
|
1044
|
+
*
|
|
1045
|
+
* NOTE: this param is ignored in "consumer" mode.
|
|
977
1046
|
* @property {number} impressionsRefreshRate
|
|
978
|
-
* @default
|
|
1047
|
+
* @default 300
|
|
979
1048
|
*/
|
|
980
1049
|
impressionsRefreshRate?: number,
|
|
981
1050
|
/**
|
|
982
1051
|
* The maximum number of impression items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
|
|
983
1052
|
* If you use a 0 here, the queue will have no maximum size.
|
|
1053
|
+
*
|
|
1054
|
+
* NOTE: this param is ignored in "consumer" mode.
|
|
984
1055
|
* @property {number} impressionsQueueSize
|
|
985
1056
|
* @default 30000
|
|
986
1057
|
*/
|
|
@@ -994,18 +1065,16 @@ declare namespace SplitIO {
|
|
|
994
1065
|
metricsRefreshRate?: number,
|
|
995
1066
|
/**
|
|
996
1067
|
* The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
|
|
1068
|
+
*
|
|
1069
|
+
* NOTE: this param is ignored in "consumer" mode.
|
|
997
1070
|
* @property {number} telemetryRefreshRate
|
|
998
1071
|
* @default 3600
|
|
999
1072
|
*/
|
|
1000
1073
|
telemetryRefreshRate?: number,
|
|
1001
|
-
/**
|
|
1002
|
-
* The SDK polls Split servers for changes to segment definitions. This parameter controls this polling period in seconds.
|
|
1003
|
-
* @property {number} segmentsRefreshRate
|
|
1004
|
-
* @default 60
|
|
1005
|
-
*/
|
|
1006
|
-
segmentsRefreshRate?: number,
|
|
1007
1074
|
/**
|
|
1008
1075
|
* The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
|
|
1076
|
+
*
|
|
1077
|
+
* NOTE: this param is ignored in "consumer" mode.
|
|
1009
1078
|
* @property {number} eventsPushRate
|
|
1010
1079
|
* @default 60
|
|
1011
1080
|
*/
|
|
@@ -1013,52 +1082,46 @@ declare namespace SplitIO {
|
|
|
1013
1082
|
/**
|
|
1014
1083
|
* The maximum number of event items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
|
|
1015
1084
|
* If you use a 0 here, the queue will have no maximum size.
|
|
1085
|
+
*
|
|
1086
|
+
* NOTE: this param is ignored in "consumer" mode.
|
|
1016
1087
|
* @property {number} eventsQueueSize
|
|
1017
1088
|
* @default 500
|
|
1018
1089
|
*/
|
|
1019
1090
|
eventsQueueSize?: number,
|
|
1020
1091
|
/**
|
|
1021
1092
|
* For mocking/testing only. The SDK will refresh the features mocked data when mode is set to "localhost" by defining the key.
|
|
1022
|
-
* For more information @see {@link https://help.split.io/hc/en-us/articles/
|
|
1093
|
+
* For more information @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
|
|
1023
1094
|
* @property {number} offlineRefreshRate
|
|
1024
1095
|
* @default 15
|
|
1025
1096
|
*/
|
|
1026
|
-
offlineRefreshRate?: number
|
|
1097
|
+
offlineRefreshRate?: number
|
|
1027
1098
|
/**
|
|
1028
1099
|
* When using streaming mode, seconds to wait before re attempting to connect for push notifications.
|
|
1029
1100
|
* Next attempts follow intervals in power of two: base seconds, base x 2 seconds, base x 4 seconds, ...
|
|
1101
|
+
*
|
|
1102
|
+
* NOTE: this param is applicable in "standalone" mode.
|
|
1030
1103
|
* @property {number} pushRetryBackoffBase
|
|
1031
1104
|
* @default 1
|
|
1032
1105
|
*/
|
|
1033
1106
|
pushRetryBackoffBase?: number,
|
|
1034
1107
|
},
|
|
1108
|
+
}
|
|
1109
|
+
/**
|
|
1110
|
+
* Common settings interface for SDK instances created on client-side (Browser & React Native).
|
|
1111
|
+
* @interface IClientSideSharedSettings
|
|
1112
|
+
* @extends ISharedSettings
|
|
1113
|
+
*/
|
|
1114
|
+
interface IClientSideSharedSettings extends ISharedSettings {
|
|
1035
1115
|
/**
|
|
1036
|
-
* SDK Core settings for
|
|
1116
|
+
* SDK Core settings for client-side.
|
|
1037
1117
|
* @property {Object} core
|
|
1038
1118
|
*/
|
|
1039
|
-
core: {
|
|
1040
|
-
/**
|
|
1041
|
-
* Your API key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
|
|
1042
|
-
* @property {string} authorizationKey
|
|
1043
|
-
*/
|
|
1044
|
-
authorizationKey: string,
|
|
1119
|
+
core: ISharedSettings['core'] & {
|
|
1045
1120
|
/**
|
|
1046
1121
|
* Customer identifier. Whatever this means to you. @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
|
|
1047
1122
|
* @property {SplitKey} key
|
|
1048
1123
|
*/
|
|
1049
1124
|
key: SplitKey,
|
|
1050
|
-
/**
|
|
1051
|
-
* Traffic type associated with the customer identifier. @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
|
|
1052
|
-
* If no provided as a setting it will be required on the client.track() calls.
|
|
1053
|
-
* @property {string} trafficType
|
|
1054
|
-
*/
|
|
1055
|
-
trafficType?: string,
|
|
1056
|
-
/**
|
|
1057
|
-
* Disable labels from being sent to Split backend. Labels may contain sensitive information.
|
|
1058
|
-
* @property {boolean} labelsEnabled
|
|
1059
|
-
* @default true
|
|
1060
|
-
*/
|
|
1061
|
-
labelsEnabled?: boolean
|
|
1062
1125
|
},
|
|
1063
1126
|
/**
|
|
1064
1127
|
* Mocked features map. For testing purposses only. For using this you should specify "localhost" as authorizationKey on core settings.
|
|
@@ -1066,268 +1129,188 @@ declare namespace SplitIO {
|
|
|
1066
1129
|
*/
|
|
1067
1130
|
features?: MockedFeaturesMap,
|
|
1068
1131
|
/**
|
|
1069
|
-
*
|
|
1070
|
-
*
|
|
1071
|
-
* @property {Object} storage
|
|
1132
|
+
* SDK Startup settings for client-side.
|
|
1133
|
+
* @property {Object} startup
|
|
1072
1134
|
*/
|
|
1073
|
-
|
|
1135
|
+
startup?: {
|
|
1074
1136
|
/**
|
|
1075
|
-
*
|
|
1076
|
-
* @property {
|
|
1077
|
-
* @default
|
|
1137
|
+
* Maximum amount of time used before notify a timeout.
|
|
1138
|
+
* @property {number} readyTimeout
|
|
1139
|
+
* @default 1.5
|
|
1078
1140
|
*/
|
|
1079
|
-
|
|
1141
|
+
readyTimeout?: number,
|
|
1080
1142
|
/**
|
|
1081
|
-
*
|
|
1082
|
-
*
|
|
1083
|
-
*
|
|
1143
|
+
* 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'.
|
|
1144
|
+
*
|
|
1145
|
+
* NOTE: this param is applicable in "standalone" mode.
|
|
1146
|
+
* @property {number} requestTimeoutBeforeReady
|
|
1147
|
+
* @default 1.5
|
|
1084
1148
|
*/
|
|
1085
|
-
|
|
1086
|
-
},
|
|
1087
|
-
/**
|
|
1088
|
-
* List of URLs that the SDK will use as base for it's synchronization functionalities, applicable only when running as standalone.
|
|
1089
|
-
* Do not change these settings unless you're working an advanced use case, like connecting to the Split proxy.
|
|
1090
|
-
* @property {Object} urls
|
|
1091
|
-
*/
|
|
1092
|
-
urls?: UrlSettings,
|
|
1093
|
-
/**
|
|
1094
|
-
* SDK integration settings for the Browser.
|
|
1095
|
-
* @property {Object} integrations
|
|
1096
|
-
*/
|
|
1097
|
-
integrations?: BrowserIntegration[],
|
|
1098
|
-
/**
|
|
1099
|
-
* User consent status. Possible values are `'GRANTED'`, which is the default, `'DECLINED'` or `'UNKNOWN'`.
|
|
1100
|
-
* - `'GRANTED'`: the user grants consent for tracking events and impressions. The SDK sends them to Split cloud.
|
|
1101
|
-
* - `'DECLINED'`: the user declines consent for tracking events and impressions. The SDK does not send them to Split cloud.
|
|
1102
|
-
* - `'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
|
|
1103
|
-
* 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.
|
|
1104
|
-
*
|
|
1105
|
-
* @typedef {string} userConsent
|
|
1106
|
-
* @default 'GRANTED'
|
|
1107
|
-
*/
|
|
1108
|
-
userConsent?: ConsentStatus
|
|
1109
|
-
}
|
|
1110
|
-
/**
|
|
1111
|
-
* Settings interface for SDK instances created on NodeJS.
|
|
1112
|
-
* If your storage is asynchronous (Redis for example) use SplitIO.INodeAsyncSettings instead.
|
|
1113
|
-
* @interface INodeSettings
|
|
1114
|
-
* @extends INodeBasicSettings
|
|
1115
|
-
* @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}
|
|
1116
|
-
*/
|
|
1117
|
-
interface INodeSettings extends INodeBasicSettings {
|
|
1118
|
-
/**
|
|
1119
|
-
* List of URLs that the SDK will use as base for it's synchronization functionalities, applicable only when running as standalone.
|
|
1120
|
-
* Do not change these settings unless you're working an advanced use case, like connecting to the Split proxy.
|
|
1121
|
-
* @property {Object} urls
|
|
1122
|
-
*/
|
|
1123
|
-
urls?: UrlSettings,
|
|
1124
|
-
/**
|
|
1125
|
-
* Defines which kind of storage we can instantiate on NodeJS for 'standalone' mode.
|
|
1126
|
-
* The only possible storage type is 'MEMORY', which is the default.
|
|
1127
|
-
* @property {Object} storage
|
|
1128
|
-
*/
|
|
1129
|
-
storage?: {
|
|
1149
|
+
requestTimeoutBeforeReady?: number,
|
|
1130
1150
|
/**
|
|
1131
|
-
*
|
|
1132
|
-
*
|
|
1133
|
-
*
|
|
1151
|
+
* How many quick retries we will do while starting up the SDK.
|
|
1152
|
+
*
|
|
1153
|
+
* NOTE: this param is applicable in "standalone" mode.
|
|
1154
|
+
* @property {number} retriesOnFailureBeforeReady
|
|
1155
|
+
* @default 1
|
|
1134
1156
|
*/
|
|
1135
|
-
|
|
1157
|
+
retriesOnFailureBeforeReady?: number,
|
|
1136
1158
|
/**
|
|
1137
|
-
*
|
|
1138
|
-
*
|
|
1139
|
-
*
|
|
1159
|
+
* For SDK posts the queued events data in bulks with a given rate, but the first push window is defined separately,
|
|
1160
|
+
* to better control on browsers. This number defines that window before the first events push.
|
|
1161
|
+
*
|
|
1162
|
+
* NOTE: this param is ignored in "consumer" mode.
|
|
1163
|
+
* @property {number} eventsFirstPushWindow
|
|
1164
|
+
* @default 10
|
|
1140
1165
|
*/
|
|
1141
|
-
|
|
1166
|
+
eventsFirstPushWindow?: number,
|
|
1142
1167
|
},
|
|
1143
1168
|
/**
|
|
1144
|
-
*
|
|
1145
|
-
*
|
|
1146
|
-
*
|
|
1147
|
-
* @property {'standalone'} mode
|
|
1148
|
-
* @default standalone
|
|
1149
|
-
*/
|
|
1150
|
-
mode?: 'standalone'
|
|
1151
|
-
}
|
|
1152
|
-
/**
|
|
1153
|
-
* Settings interface with async storage for SDK instances created on NodeJS.
|
|
1154
|
-
* If your storage is synchronous (by defaut we use memory, which is sync) use SplitIO.INodeSettings instead.
|
|
1155
|
-
* @interface INodeAsyncSettings
|
|
1156
|
-
* @extends INodeBasicSettings
|
|
1157
|
-
* @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}
|
|
1158
|
-
*/
|
|
1159
|
-
interface INodeAsyncSettings extends INodeBasicSettings {
|
|
1160
|
-
/**
|
|
1161
|
-
* Defines which kind of async storage we can instantiate on NodeJS for 'consumer' mode.
|
|
1162
|
-
* The only possible storage type is 'REDIS'.
|
|
1163
|
-
* @property {Object} storage
|
|
1169
|
+
* SDK scheduler settings.
|
|
1170
|
+
* @property {Object} scheduler
|
|
1164
1171
|
*/
|
|
1165
|
-
|
|
1172
|
+
scheduler?: {
|
|
1166
1173
|
/**
|
|
1167
|
-
*
|
|
1168
|
-
*
|
|
1174
|
+
* The SDK polls Split servers for changes to feature roll-out plans. This parameter controls this polling period in seconds.
|
|
1175
|
+
*
|
|
1176
|
+
* NOTE: this param is applicable in "standalone" mode.
|
|
1177
|
+
* @property {number} featuresRefreshRate
|
|
1178
|
+
* @default 30
|
|
1169
1179
|
*/
|
|
1170
|
-
|
|
1180
|
+
featuresRefreshRate?: number,
|
|
1171
1181
|
/**
|
|
1172
|
-
*
|
|
1173
|
-
*
|
|
1182
|
+
* The SDK polls Split servers for changes to segment definitions. This parameter controls this polling period in seconds.
|
|
1183
|
+
*
|
|
1184
|
+
* NOTE: this param is applicable in "standalone" mode.
|
|
1185
|
+
* @property {number} segmentsRefreshRate
|
|
1186
|
+
* @default 60
|
|
1174
1187
|
*/
|
|
1175
|
-
|
|
1176
|
-
/**
|
|
1177
|
-
* Redis URL. If set, `host`, `port`, `db` and `pass` params will be ignored.
|
|
1178
|
-
*
|
|
1179
|
-
* Examples:
|
|
1180
|
-
* ```
|
|
1181
|
-
* url: 'localhost'
|
|
1182
|
-
* url: '127.0.0.1:6379'
|
|
1183
|
-
* url: 'redis://:authpassword@127.0.0.1:6379/0'
|
|
1184
|
-
* ```
|
|
1185
|
-
* @property {string=} url
|
|
1186
|
-
*/
|
|
1187
|
-
url?: string,
|
|
1188
|
-
/**
|
|
1189
|
-
* Redis host.
|
|
1190
|
-
* @property {string=} host
|
|
1191
|
-
* @default 'localhost'
|
|
1192
|
-
*/
|
|
1193
|
-
host?: string,
|
|
1194
|
-
/**
|
|
1195
|
-
* Redis port.
|
|
1196
|
-
* @property {number=} port
|
|
1197
|
-
* @default 6379
|
|
1198
|
-
*/
|
|
1199
|
-
port?: number,
|
|
1200
|
-
/**
|
|
1201
|
-
* Redis database to be used.
|
|
1202
|
-
* @property {number=} db
|
|
1203
|
-
* @default 0
|
|
1204
|
-
*/
|
|
1205
|
-
db?: number,
|
|
1206
|
-
/**
|
|
1207
|
-
* Redis password. Don't define if no password is used.
|
|
1208
|
-
* @property {string=} pass
|
|
1209
|
-
* @default undefined
|
|
1210
|
-
*/
|
|
1211
|
-
pass?: string,
|
|
1212
|
-
/**
|
|
1213
|
-
* The milliseconds before a timeout occurs during the initial connection to the Redis server.
|
|
1214
|
-
* @property {number=} connectionTimeout
|
|
1215
|
-
* @default 10000
|
|
1216
|
-
*/
|
|
1217
|
-
connectionTimeout?: number,
|
|
1218
|
-
/**
|
|
1219
|
-
* The milliseconds before Redis commands are timeout by the SDK.
|
|
1220
|
-
* Method calls that involve Redis commands, like `client.getTreatment` or `client.track` calls, are resolved when the commands success or timeout.
|
|
1221
|
-
* @property {number=} operationTimeout
|
|
1222
|
-
* @default 5000
|
|
1223
|
-
*/
|
|
1224
|
-
operationTimeout?: number,
|
|
1225
|
-
/**
|
|
1226
|
-
* TLS configuration for Redis connection.
|
|
1227
|
-
* @see {@link https://www.npmjs.com/package/ioredis#tls-options }
|
|
1228
|
-
*
|
|
1229
|
-
* @property {Object=} tls
|
|
1230
|
-
* @default undefined
|
|
1231
|
-
*/
|
|
1232
|
-
tls?: RedisOptions['tls'],
|
|
1233
|
-
},
|
|
1188
|
+
segmentsRefreshRate?: number,
|
|
1234
1189
|
/**
|
|
1235
|
-
*
|
|
1236
|
-
*
|
|
1237
|
-
*
|
|
1190
|
+
* 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.
|
|
1191
|
+
*
|
|
1192
|
+
* NOTE: this param is ignored in "consumer" mode.
|
|
1193
|
+
* @property {number} impressionsRefreshRate
|
|
1194
|
+
* @default 60
|
|
1238
1195
|
*/
|
|
1239
|
-
|
|
1240
|
-
|
|
1196
|
+
impressionsRefreshRate?: number,
|
|
1197
|
+
/**
|
|
1198
|
+
* The maximum number of impression items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
|
|
1199
|
+
* If you use a 0 here, the queue will have no maximum size.
|
|
1200
|
+
*
|
|
1201
|
+
* NOTE: this param is ignored in "consumer" mode.
|
|
1202
|
+
* @property {number} impressionsQueueSize
|
|
1203
|
+
* @default 30000
|
|
1204
|
+
*/
|
|
1205
|
+
impressionsQueueSize?: number,
|
|
1206
|
+
/**
|
|
1207
|
+
* The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
|
|
1208
|
+
* @property {number} metricsRefreshRate
|
|
1209
|
+
* @default 120
|
|
1210
|
+
* @deprecated This parameter is ignored now. Use `telemetryRefreshRate` instead.
|
|
1211
|
+
*/
|
|
1212
|
+
metricsRefreshRate?: number,
|
|
1213
|
+
/**
|
|
1214
|
+
* The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
|
|
1215
|
+
*
|
|
1216
|
+
* NOTE: this param is ignored in "consumer" mode.
|
|
1217
|
+
* @property {number} telemetryRefreshRate
|
|
1218
|
+
* @default 3600
|
|
1219
|
+
*/
|
|
1220
|
+
telemetryRefreshRate?: number,
|
|
1221
|
+
/**
|
|
1222
|
+
* The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
|
|
1223
|
+
*
|
|
1224
|
+
* NOTE: this param is ignored in "consumer" mode.
|
|
1225
|
+
* @property {number} eventsPushRate
|
|
1226
|
+
* @default 60
|
|
1227
|
+
*/
|
|
1228
|
+
eventsPushRate?: number,
|
|
1229
|
+
/**
|
|
1230
|
+
* The maximum number of event items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
|
|
1231
|
+
* If you use a 0 here, the queue will have no maximum size.
|
|
1232
|
+
*
|
|
1233
|
+
* NOTE: this param is ignored in "consumer" mode.
|
|
1234
|
+
* @property {number} eventsQueueSize
|
|
1235
|
+
* @default 500
|
|
1236
|
+
*/
|
|
1237
|
+
eventsQueueSize?: number,
|
|
1238
|
+
/**
|
|
1239
|
+
* For mocking/testing only. The SDK will refresh the features mocked data when mode is set to "localhost" by defining the key.
|
|
1240
|
+
* For more information @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#localhost-mode}
|
|
1241
|
+
* @property {number} offlineRefreshRate
|
|
1242
|
+
* @default 15
|
|
1243
|
+
*/
|
|
1244
|
+
offlineRefreshRate?: number,
|
|
1245
|
+
/**
|
|
1246
|
+
* When using streaming, seconds to wait before re attempting to connect for push notifications.
|
|
1247
|
+
* Next attempts follow intervals in power of two: base seconds, base x 2 seconds, base x 4 seconds, ...
|
|
1248
|
+
*
|
|
1249
|
+
* NOTE: this param is applicable in "standalone" mode.
|
|
1250
|
+
* @property {number} pushRetryBackoffBase
|
|
1251
|
+
* @default 1
|
|
1252
|
+
*/
|
|
1253
|
+
pushRetryBackoffBase?: number,
|
|
1254
|
+
}
|
|
1241
1255
|
/**
|
|
1242
|
-
*
|
|
1243
|
-
*
|
|
1244
|
-
*
|
|
1256
|
+
* User consent status. Possible values are `'GRANTED'`, which is the default, `'DECLINED'` or `'UNKNOWN'`.
|
|
1257
|
+
* - `'GRANTED'`: the user grants consent for tracking events and impressions. The SDK sends them to Split cloud.
|
|
1258
|
+
* - `'DECLINED'`: the user declines consent for tracking events and impressions. The SDK does not send them to Split cloud.
|
|
1259
|
+
* - `'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
|
|
1260
|
+
* 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.
|
|
1245
1261
|
*
|
|
1246
|
-
* @
|
|
1262
|
+
* @typedef {string} userConsent
|
|
1263
|
+
* @default 'GRANTED'
|
|
1247
1264
|
*/
|
|
1248
|
-
|
|
1265
|
+
userConsent?: ConsentStatus
|
|
1249
1266
|
}
|
|
1250
1267
|
/**
|
|
1251
|
-
*
|
|
1252
|
-
* @interface
|
|
1253
|
-
* @extends IBasicSDK
|
|
1268
|
+
* Common definitions between SDK instances for different environments interface.
|
|
1269
|
+
* @interface IBasicSDK
|
|
1254
1270
|
*/
|
|
1255
|
-
interface
|
|
1271
|
+
interface IBasicSDK<TClient, TManager> {
|
|
1256
1272
|
/**
|
|
1257
1273
|
* Returns the default client instance of the SDK.
|
|
1258
1274
|
* @function client
|
|
1259
1275
|
* @returns {IClient} The client instance.
|
|
1260
1276
|
*/
|
|
1261
|
-
client():
|
|
1262
|
-
/**
|
|
1263
|
-
* Returns a shared client of the SDK. For usage on the browser.
|
|
1264
|
-
* @function client
|
|
1265
|
-
* @param {SplitKey} key The key for the new client instance.
|
|
1266
|
-
* @param {string=} trafficType The traffic type of the provided key.
|
|
1267
|
-
* @returns {IClient} The client instance.
|
|
1268
|
-
*/
|
|
1269
|
-
client(key: SplitKey, trafficType?: string): IClient,
|
|
1277
|
+
client(): TClient,
|
|
1270
1278
|
/**
|
|
1271
1279
|
* Returns a manager instance of the SDK to explore available information.
|
|
1272
1280
|
* @function manager
|
|
1273
1281
|
* @returns {IManager} The manager instance.
|
|
1274
1282
|
*/
|
|
1275
|
-
manager():
|
|
1276
|
-
}
|
|
1277
|
-
/**
|
|
1278
|
-
* This represents the interface for the SDK instance with synchronous storage.
|
|
1279
|
-
* @interface ISDK
|
|
1280
|
-
* @extends IBasicSDK
|
|
1281
|
-
*/
|
|
1282
|
-
interface IBrowserSDK extends ISDK {
|
|
1283
|
-
/**
|
|
1284
|
-
* Returns the default client instance of the SDK.
|
|
1285
|
-
* @function client
|
|
1286
|
-
* @returns {IBrowserClient} The client instance.
|
|
1287
|
-
*/
|
|
1288
|
-
client(): IBrowserClient,
|
|
1283
|
+
manager(): TManager
|
|
1289
1284
|
/**
|
|
1290
|
-
*
|
|
1291
|
-
* @
|
|
1292
|
-
* @param {SplitKey} key The key for the new client instance.
|
|
1293
|
-
* @param {string=} trafficType The traffic type of the provided key.
|
|
1294
|
-
* @returns {IBrowserClient} The client instance.
|
|
1285
|
+
* Current settings of the SDK instance.
|
|
1286
|
+
* @property settings
|
|
1295
1287
|
*/
|
|
1296
|
-
|
|
1288
|
+
settings: ISettings,
|
|
1297
1289
|
/**
|
|
1298
|
-
*
|
|
1299
|
-
* @property
|
|
1290
|
+
* Logger API.
|
|
1291
|
+
* @property Logger
|
|
1300
1292
|
*/
|
|
1301
|
-
|
|
1293
|
+
Logger: ILoggerAPI
|
|
1302
1294
|
}
|
|
1303
1295
|
/**
|
|
1304
|
-
*
|
|
1305
|
-
* @interface
|
|
1306
|
-
* @extends IBasicSDK
|
|
1296
|
+
* Common interface between client-side SDK instances.
|
|
1297
|
+
* @interface ISDKCs
|
|
1307
1298
|
*/
|
|
1308
|
-
interface
|
|
1299
|
+
interface ISDKWithUserConsent<TClient, TManager> extends IBasicSDK<TClient, TManager> {
|
|
1309
1300
|
/**
|
|
1310
|
-
*
|
|
1311
|
-
* @
|
|
1312
|
-
* @returns {IAsyncClient} The asynchronous client instance.
|
|
1313
|
-
*/
|
|
1314
|
-
client(): IAsyncClient,
|
|
1315
|
-
/**
|
|
1316
|
-
* Returns a manager instance of the SDK to explore available information.
|
|
1317
|
-
* @function manager
|
|
1318
|
-
* @returns {IManager} The manager instance.
|
|
1301
|
+
* User consent API.
|
|
1302
|
+
* @property UserConsent
|
|
1319
1303
|
*/
|
|
1320
|
-
|
|
1304
|
+
UserConsent: IUserConsentAPI
|
|
1321
1305
|
}
|
|
1322
1306
|
/**
|
|
1323
|
-
* This represents the interface for the Client instance with synchronous
|
|
1307
|
+
* This represents the interface for the Client instance with synchronous method calls and server-side API, where we don't have only one key.
|
|
1324
1308
|
* @interface IClient
|
|
1325
1309
|
* @extends IBasicClient
|
|
1326
1310
|
*/
|
|
1327
|
-
interface
|
|
1311
|
+
interface IClientSS extends IBasicClient {
|
|
1328
1312
|
/**
|
|
1329
1313
|
* Returns a Treatment value, which is the treatment string for the given feature.
|
|
1330
|
-
* For usage on NodeJS as we don't have only one key.
|
|
1331
1314
|
* @function getTreatment
|
|
1332
1315
|
* @param {string} key - The string key representing the consumer.
|
|
1333
1316
|
* @param {string} splitName - The string that represents the split we wan't to get the treatment.
|
|
@@ -1335,18 +1318,8 @@ declare namespace SplitIO {
|
|
|
1335
1318
|
* @returns {Treatment} The treatment string.
|
|
1336
1319
|
*/
|
|
1337
1320
|
getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): Treatment,
|
|
1338
|
-
/**
|
|
1339
|
-
* Returns a Treatment value, which is the treatment string for the given feature.
|
|
1340
|
-
* For usage on the Browser as we defined the key on the settings.
|
|
1341
|
-
* @function getTreatment
|
|
1342
|
-
* @param {string} splitName - The string that represents the split we wan't to get the treatment.
|
|
1343
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1344
|
-
* @returns {Treatment} The treatment string.
|
|
1345
|
-
*/
|
|
1346
|
-
getTreatment(splitName: string, attributes?: Attributes): Treatment,
|
|
1347
1321
|
/**
|
|
1348
1322
|
* Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature.
|
|
1349
|
-
* For usage on NodeJS as we don't have only one key.
|
|
1350
1323
|
* @function getTreatmentWithConfig
|
|
1351
1324
|
* @param {string} key - The string key representing the consumer.
|
|
1352
1325
|
* @param {string} splitName - The string that represents the split we wan't to get the treatment.
|
|
@@ -1355,20 +1328,8 @@ declare namespace SplitIO {
|
|
|
1355
1328
|
* configuration stringified JSON (or null if there was no config for that treatment).
|
|
1356
1329
|
*/
|
|
1357
1330
|
getTreatmentWithConfig(key: SplitKey, splitName: string, attributes?: Attributes): TreatmentWithConfig,
|
|
1358
|
-
/**
|
|
1359
|
-
* Returns a TreatmentWithConfig value, which an object with both treatment and config string for the given feature.
|
|
1360
|
-
* For usage on the Browser as we defined the key on the settings.
|
|
1361
|
-
* @function getTreatment
|
|
1362
|
-
* @param {string} splitName - The string that represents the split we wan't to get the treatment.
|
|
1363
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1364
|
-
* @returns {TreatmentWithConfig} The TreatmentWithConfig, the object containing the treatment string and the
|
|
1365
|
-
* configuration stringified JSON (or null if there was no config for that treatment).
|
|
1366
|
-
*/
|
|
1367
|
-
getTreatmentWithConfig(splitName: string, attributes?: Attributes): TreatmentWithConfig,
|
|
1368
1331
|
/**
|
|
1369
1332
|
* Returns a Treatments value, which is an object map with the treatments for the given features.
|
|
1370
|
-
* For usage on NodeJS as we don't have only one key.
|
|
1371
|
-
* NOTE: Treatment will be a promise only in async storages, like REDIS.
|
|
1372
1333
|
* @function getTreatments
|
|
1373
1334
|
* @param {string} key - The string key representing the consumer.
|
|
1374
1335
|
* @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
|
|
@@ -1376,19 +1337,8 @@ declare namespace SplitIO {
|
|
|
1376
1337
|
* @returns {Treatments} The treatments object map.
|
|
1377
1338
|
*/
|
|
1378
1339
|
getTreatments(key: SplitKey, splitNames: string[], attributes?: Attributes): Treatments,
|
|
1379
|
-
/**
|
|
1380
|
-
* Returns a Treatments value, which is an object map with the treatments for the given features.
|
|
1381
|
-
* For usage on the Browser as we defined the key on the settings.
|
|
1382
|
-
* NOTE: Treatment will be a promise only in async storages, like REDIS.
|
|
1383
|
-
* @function getTreatments
|
|
1384
|
-
* @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
|
|
1385
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1386
|
-
* @returns {Treatments} The treatments object map.
|
|
1387
|
-
*/
|
|
1388
|
-
getTreatments(splitNames: string[], attributes?: Attributes): Treatments,
|
|
1389
1340
|
/**
|
|
1390
1341
|
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
|
|
1391
|
-
* For usage on NodeJS as we don't have only one key.
|
|
1392
1342
|
* @function getTreatmentsWithConfig
|
|
1393
1343
|
* @param {string} key - The string key representing the consumer.
|
|
1394
1344
|
* @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
|
|
@@ -1396,18 +1346,8 @@ declare namespace SplitIO {
|
|
|
1396
1346
|
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1397
1347
|
*/
|
|
1398
1348
|
getTreatmentsWithConfig(key: SplitKey, splitNames: string[], attributes?: Attributes): TreatmentsWithConfig,
|
|
1399
|
-
/**
|
|
1400
|
-
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
|
|
1401
|
-
* For usage on the Browser as we defined the key on the settings.
|
|
1402
|
-
* @function getTreatmentsWithConfig
|
|
1403
|
-
* @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
|
|
1404
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1405
|
-
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1406
|
-
*/
|
|
1407
|
-
getTreatmentsWithConfig(splitNames: string[], attributes?: Attributes): TreatmentsWithConfig,
|
|
1408
1349
|
/**
|
|
1409
1350
|
* Tracks an event to be fed to the results product on Split Webconsole.
|
|
1410
|
-
* For usage on NodeJS as we don't have only one key.
|
|
1411
1351
|
* @function track
|
|
1412
1352
|
* @param {SplitKey} key - The key that identifies the entity related to this event.
|
|
1413
1353
|
* @param {string} trafficType - The traffic type of the entity related to this event.
|
|
@@ -1416,35 +1356,74 @@ declare namespace SplitIO {
|
|
|
1416
1356
|
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
1417
1357
|
* @returns {boolean} Whether the event was added to the queue successfully or not.
|
|
1418
1358
|
*/
|
|
1419
|
-
track(key:
|
|
1359
|
+
track(key: SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
|
|
1360
|
+
}
|
|
1361
|
+
/**
|
|
1362
|
+
* This represents the interface for the Client instance with asynchronous method calls and server-side SDK, where we don't have only one key.
|
|
1363
|
+
* @interface IAsyncClient
|
|
1364
|
+
* @extends IBasicClient
|
|
1365
|
+
*/
|
|
1366
|
+
interface IAsyncClientSS extends IBasicClient {
|
|
1420
1367
|
/**
|
|
1421
|
-
*
|
|
1422
|
-
* For usage on
|
|
1423
|
-
*
|
|
1424
|
-
* @
|
|
1425
|
-
* @param {string}
|
|
1426
|
-
* @param {
|
|
1427
|
-
* @param {
|
|
1428
|
-
* @returns {
|
|
1368
|
+
* Returns a Treatment value, which will be (or eventually be) the treatment string for the given feature.
|
|
1369
|
+
* For usage on NodeJS as we don't have only one key.
|
|
1370
|
+
* NOTE: Treatment will be a promise only in async storages, like REDIS.
|
|
1371
|
+
* @function getTreatment
|
|
1372
|
+
* @param {string} key - The string key representing the consumer.
|
|
1373
|
+
* @param {string} splitName - The string that represents the split we wan't to get the treatment.
|
|
1374
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1375
|
+
* @returns {AsyncTreatment} Treatment promise which will resolve to the treatment string.
|
|
1429
1376
|
*/
|
|
1430
|
-
|
|
1377
|
+
getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): AsyncTreatment,
|
|
1431
1378
|
/**
|
|
1432
|
-
*
|
|
1433
|
-
* For usage on
|
|
1379
|
+
* Returns a TreatmentWithConfig value, which will be (or eventually be) an object with both treatment and config string for the given feature.
|
|
1380
|
+
* For usage on NodeJS as we don't have only one key.
|
|
1381
|
+
* NOTE: Treatment will be a promise only in async storages, like REDIS.
|
|
1382
|
+
* @function getTreatmentWithConfig
|
|
1383
|
+
* @param {string} key - The string key representing the consumer.
|
|
1384
|
+
* @param {string} splitName - The string that represents the split we wan't to get the treatment.
|
|
1385
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1386
|
+
* @returns {AsyncTreatmentWithConfig} TreatmentWithConfig promise which will resolve to the TreatmentWithConfig object.
|
|
1387
|
+
*/
|
|
1388
|
+
getTreatmentWithConfig(key: SplitKey, splitName: string, attributes?: Attributes): AsyncTreatmentWithConfig,
|
|
1389
|
+
/**
|
|
1390
|
+
* Returns a Treatments value, which will be (or eventually be) an object map with the treatments for the given features.
|
|
1391
|
+
* For usage on NodeJS as we don't have only one key.
|
|
1392
|
+
* @function getTreatments
|
|
1393
|
+
* @param {string} key - The string key representing the consumer.
|
|
1394
|
+
* @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
|
|
1395
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1396
|
+
* @returns {AsyncTreatments} Treatments promise which will resolve to the treatments object map.
|
|
1397
|
+
*/
|
|
1398
|
+
getTreatments(key: SplitKey, splitNames: string[], attributes?: Attributes): AsyncTreatments,
|
|
1399
|
+
/**
|
|
1400
|
+
* Returns a TreatmentsWithConfig value, which will be (or eventually be) an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
|
|
1401
|
+
* For usage on NodeJS as we don't have only one key.
|
|
1402
|
+
* @function getTreatmentsWithConfig
|
|
1403
|
+
* @param {string} key - The string key representing the consumer.
|
|
1404
|
+
* @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
|
|
1405
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1406
|
+
* @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise which will resolve to the map of TreatmentsWithConfig objects.
|
|
1407
|
+
*/
|
|
1408
|
+
getTreatmentsWithConfig(key: SplitKey, splitNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig,
|
|
1409
|
+
/**
|
|
1410
|
+
* Tracks an event to be fed to the results product on Split Webconsole and returns a promise to signal when the event was successfully queued (or not).
|
|
1434
1411
|
* @function track
|
|
1412
|
+
* @param {SplitKey} key - The key that identifies the entity related to this event.
|
|
1413
|
+
* @param {string} trafficType - The traffic type of the entity related to this event.
|
|
1435
1414
|
* @param {string} eventType - The event type corresponding to this event.
|
|
1436
1415
|
* @param {number=} value - The value of this event.
|
|
1437
1416
|
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
1438
|
-
* @returns {boolean}
|
|
1417
|
+
* @returns {Promise<boolean>} A promise that resolves to a boolean indicating if the event was added to the queue successfully or not.
|
|
1439
1418
|
*/
|
|
1440
|
-
track(eventType: string, value?: number, properties?: Properties): boolean
|
|
1419
|
+
track(key: SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): Promise<boolean>
|
|
1441
1420
|
}
|
|
1442
1421
|
/**
|
|
1443
|
-
* This represents the interface for the Client instance with attributes binding
|
|
1444
|
-
* @interface
|
|
1445
|
-
* @
|
|
1422
|
+
* This represents the interface for the Client instance with attributes binding
|
|
1423
|
+
* @interface IClientWithAttributeBinding
|
|
1424
|
+
* @extends IBasicClient
|
|
1446
1425
|
*/
|
|
1447
|
-
interface
|
|
1426
|
+
interface IClientWithAttributeBinding extends IBasicClient {
|
|
1448
1427
|
/**
|
|
1449
1428
|
* Add an attribute to client's in memory attributes storage.
|
|
1450
1429
|
*
|
|
@@ -1488,64 +1467,129 @@ declare namespace SplitIO {
|
|
|
1488
1467
|
clearAttributes(): boolean
|
|
1489
1468
|
}
|
|
1490
1469
|
/**
|
|
1491
|
-
* This represents the interface for the Client instance with
|
|
1492
|
-
* @interface
|
|
1493
|
-
* @extends
|
|
1470
|
+
* This represents the interface for the Client instance with attributes binding, synchronous method calls, and client-side API, where each client has a key associated.
|
|
1471
|
+
* @interface IClientWithKey
|
|
1472
|
+
* @extends IClientWithAttributeBinding
|
|
1473
|
+
*/
|
|
1474
|
+
interface IClientWithKey extends IClientWithAttributeBinding {
|
|
1475
|
+
/**
|
|
1476
|
+
* Returns a Treatment value, which is the treatment string for the given feature.
|
|
1477
|
+
* @function getTreatment
|
|
1478
|
+
* @param {string} splitName - The string that represents the split we wan't to get the treatment.
|
|
1479
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1480
|
+
* @returns {Treatment} The treatment string.
|
|
1481
|
+
*/
|
|
1482
|
+
getTreatment(splitName: string, attributes?: Attributes): Treatment,
|
|
1483
|
+
/**
|
|
1484
|
+
* Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature.
|
|
1485
|
+
* @function getTreatmentWithConfig
|
|
1486
|
+
* @param {string} splitName - The string that represents the split we wan't to get the treatment.
|
|
1487
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1488
|
+
* @returns {TreatmentWithConfig} The map containing the treatment and the configuration stringified JSON (or null if there was no config for that treatment).
|
|
1489
|
+
*/
|
|
1490
|
+
getTreatmentWithConfig(splitName: string, attributes?: Attributes): TreatmentWithConfig,
|
|
1491
|
+
/**
|
|
1492
|
+
* Returns a Treatments value, which is an object map with the treatments for the given features.
|
|
1493
|
+
* @function getTreatments
|
|
1494
|
+
* @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
|
|
1495
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1496
|
+
* @returns {Treatments} The treatments object map.
|
|
1497
|
+
*/
|
|
1498
|
+
getTreatments(splitNames: string[], attributes?: Attributes): Treatments,
|
|
1499
|
+
/**
|
|
1500
|
+
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
|
|
1501
|
+
* @function getTreatmentsWithConfig
|
|
1502
|
+
* @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
|
|
1503
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1504
|
+
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1505
|
+
*/
|
|
1506
|
+
getTreatmentsWithConfig(splitNames: string[], attributes?: Attributes): TreatmentsWithConfig,
|
|
1507
|
+
/**
|
|
1508
|
+
* Tracks an event to be fed to the results product on Split Webconsole.
|
|
1509
|
+
* @function track
|
|
1510
|
+
* @param {string} trafficType - The traffic type of the entity related to this event.
|
|
1511
|
+
* @param {string} eventType - The event type corresponding to this event.
|
|
1512
|
+
* @param {number=} value - The value of this event.
|
|
1513
|
+
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
1514
|
+
* @returns {boolean} Whether the event was added to the queue successfully or not.
|
|
1515
|
+
*/
|
|
1516
|
+
track(trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
|
|
1517
|
+
}
|
|
1518
|
+
/**
|
|
1519
|
+
* This represents the interface for the Client instance with attributes binding, synchronous method calls, and client-side API, where each client has a key associated and optionally a traffic type.
|
|
1520
|
+
* @interface IClientWithKeyLegacy
|
|
1521
|
+
* @extends IClientWithKey
|
|
1494
1522
|
*/
|
|
1495
|
-
interface
|
|
1523
|
+
interface IClientWithKeyLegacy extends IClientWithKey {
|
|
1524
|
+
/**
|
|
1525
|
+
* Tracks an event to be fed to the results product on Split Webconsole.
|
|
1526
|
+
* @function track
|
|
1527
|
+
* @param {string} trafficType - The traffic type of the entity related to this event.
|
|
1528
|
+
* @param {string} eventType - The event type corresponding to this event.
|
|
1529
|
+
* @param {number=} value - The value of this event.
|
|
1530
|
+
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
1531
|
+
* @returns {boolean} Whether the event was added to the queue successfully or not.
|
|
1532
|
+
*/
|
|
1533
|
+
track(trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
|
|
1534
|
+
/**
|
|
1535
|
+
* Tracks an event to be fed to the results product on Split Webconsole.
|
|
1536
|
+
* For usage on the Browser if we defined the key and also the trafficType on the settings.
|
|
1537
|
+
* @function track
|
|
1538
|
+
* @param {string} eventType - The event type corresponding to this event.
|
|
1539
|
+
* @param {number=} value - The value of this event.
|
|
1540
|
+
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
1541
|
+
* @returns {boolean} Whether the event was added to the queue successfully or not.
|
|
1542
|
+
*/
|
|
1543
|
+
track(eventType: string, value?: number, properties?: Properties): boolean
|
|
1544
|
+
}
|
|
1545
|
+
/**
|
|
1546
|
+
* This represents the interface for the Client instance with attributes binding, asynchronous method calls, and client-side API, where each client has a key associated.
|
|
1547
|
+
* @interface IAsyncClientWithKey
|
|
1548
|
+
* @extends IClientWithAttributeBinding
|
|
1549
|
+
*/
|
|
1550
|
+
interface IAsyncClientWithKey extends IClientWithAttributeBinding {
|
|
1496
1551
|
/**
|
|
1497
1552
|
* Returns a Treatment value, which will be (or eventually be) the treatment string for the given feature.
|
|
1498
|
-
* For usage on NodeJS as we don't have only one key.
|
|
1499
|
-
* NOTE: Treatment will be a promise only in async storages, like REDIS.
|
|
1500
1553
|
* @function getTreatment
|
|
1501
|
-
* @param {string} key - The string key representing the consumer.
|
|
1502
1554
|
* @param {string} splitName - The string that represents the split we wan't to get the treatment.
|
|
1503
1555
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1504
1556
|
* @returns {AsyncTreatment} Treatment promise which will resolve to the treatment string.
|
|
1505
1557
|
*/
|
|
1506
|
-
getTreatment(
|
|
1558
|
+
getTreatment(splitName: string, attributes?: Attributes): AsyncTreatment,
|
|
1507
1559
|
/**
|
|
1508
1560
|
* Returns a TreatmentWithConfig value, which will be (or eventually be) an object with both treatment and config string for the given feature.
|
|
1509
|
-
* For usage on NodeJS as we don't have only one key.
|
|
1510
|
-
* NOTE: Treatment will be a promise only in async storages, like REDIS.
|
|
1511
1561
|
* @function getTreatmentWithConfig
|
|
1512
|
-
* @param {string} key - The string key representing the consumer.
|
|
1513
1562
|
* @param {string} splitName - The string that represents the split we wan't to get the treatment.
|
|
1514
1563
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1515
1564
|
* @returns {AsyncTreatmentWithConfig} TreatmentWithConfig promise which will resolve to the TreatmentWithConfig object.
|
|
1516
1565
|
*/
|
|
1517
|
-
getTreatmentWithConfig(
|
|
1566
|
+
getTreatmentWithConfig(splitName: string, attributes?: Attributes): AsyncTreatmentWithConfig,
|
|
1518
1567
|
/**
|
|
1519
1568
|
* Returns a Treatments value, which will be (or eventually be) an object map with the treatments for the given features.
|
|
1520
|
-
* For usage on NodeJS as we don't have only one key.
|
|
1521
1569
|
* @function getTreatments
|
|
1522
|
-
* @param {string} key - The string key representing the consumer.
|
|
1523
1570
|
* @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
|
|
1524
1571
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1525
1572
|
* @returns {AsyncTreatments} Treatments promise which will resolve to the treatments object map.
|
|
1526
1573
|
*/
|
|
1527
|
-
getTreatments(
|
|
1574
|
+
getTreatments(splitNames: string[], attributes?: Attributes): AsyncTreatments,
|
|
1528
1575
|
/**
|
|
1529
1576
|
* Returns a TreatmentsWithConfig value, which will be (or eventually be) an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
|
|
1530
|
-
* For usage on NodeJS as we don't have only one key.
|
|
1531
1577
|
* @function getTreatmentsWithConfig
|
|
1532
|
-
* @param {string} key - The string key representing the consumer.
|
|
1533
1578
|
* @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
|
|
1534
1579
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1535
|
-
* @returns {
|
|
1580
|
+
* @returns {TreatmentsWithConfig} TreatmentsWithConfig promise which will resolve to the map of TreatmentsWithConfig objects.
|
|
1536
1581
|
*/
|
|
1537
|
-
getTreatmentsWithConfig(
|
|
1582
|
+
getTreatmentsWithConfig(splitNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig,
|
|
1538
1583
|
/**
|
|
1539
1584
|
* Tracks an event to be fed to the results product on Split Webconsole and returns a promise to signal when the event was successfully queued (or not).
|
|
1540
1585
|
* @function track
|
|
1541
|
-
* @param {SplitKey} key - The key that identifies the entity related to this event.
|
|
1542
1586
|
* @param {string} trafficType - The traffic type of the entity related to this event.
|
|
1543
1587
|
* @param {string} eventType - The event type corresponding to this event.
|
|
1544
1588
|
* @param {number=} value - The value of this event.
|
|
1545
1589
|
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
1546
|
-
* @returns {
|
|
1590
|
+
* @returns {boolean} A promise that resolves to a boolean indicating if the event was added to the queue successfully or not.
|
|
1547
1591
|
*/
|
|
1548
|
-
track(
|
|
1592
|
+
track(trafficType: string, eventType: string, value?: number, properties?: Properties): Promise<boolean>,
|
|
1549
1593
|
}
|
|
1550
1594
|
/**
|
|
1551
1595
|
* Representation of a manager instance with synchronous storage of the SDK.
|
|
@@ -1562,14 +1606,14 @@ declare namespace SplitIO {
|
|
|
1562
1606
|
/**
|
|
1563
1607
|
* Get the array of splits data in SplitView format.
|
|
1564
1608
|
* @function splits
|
|
1565
|
-
* @returns {SplitViews} The list of
|
|
1609
|
+
* @returns {SplitViews} The list of SplitView.
|
|
1566
1610
|
*/
|
|
1567
1611
|
splits(): SplitViews;
|
|
1568
1612
|
/**
|
|
1569
1613
|
* Get the data of a split in SplitView format.
|
|
1570
1614
|
* @function split
|
|
1571
1615
|
* @param {string} splitName The name of the split we wan't to get info of.
|
|
1572
|
-
* @returns {SplitView | null} The
|
|
1616
|
+
* @returns {SplitView | null} The SplitView of the given split or null if the split is not found.
|
|
1573
1617
|
*/
|
|
1574
1618
|
split(splitName: string): SplitView | null;
|
|
1575
1619
|
}
|
|
@@ -1588,14 +1632,14 @@ declare namespace SplitIO {
|
|
|
1588
1632
|
/**
|
|
1589
1633
|
* Get the array of splits data in SplitView format.
|
|
1590
1634
|
* @function splits
|
|
1591
|
-
* @returns {SplitViewsAsync} A promise that will resolve to the
|
|
1635
|
+
* @returns {SplitViewsAsync} A promise that will resolve to the SplitView list.
|
|
1592
1636
|
*/
|
|
1593
1637
|
splits(): SplitViewsAsync;
|
|
1594
1638
|
/**
|
|
1595
1639
|
* Get the data of a split in SplitView format.
|
|
1596
1640
|
* @function split
|
|
1597
1641
|
* @param {string} splitName The name of the split we wan't to get info of.
|
|
1598
|
-
* @returns {SplitViewAsync} A promise that will resolve to the
|
|
1642
|
+
* @returns {SplitViewAsync} A promise that will resolve to the SplitView value or null if the split is not found.
|
|
1599
1643
|
*/
|
|
1600
1644
|
split(splitName: string): SplitViewAsync;
|
|
1601
1645
|
}
|