@splitsoftware/splitio-commons 1.6.2-rc.0 → 1.6.2-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/listeners/browser.js +2 -1
- package/cjs/logger/constants.js +2 -1
- package/cjs/sdkFactory/index.js +13 -5
- package/cjs/services/splitApi.js +20 -0
- package/cjs/sync/submitters/submitterManager.js +3 -0
- package/cjs/sync/submitters/uniqueKeysSubmitter.js +70 -0
- package/cjs/trackers/impressionsTracker.js +7 -28
- package/cjs/trackers/strategy/strategyDebug.js +25 -0
- package/cjs/trackers/strategy/strategyNone.js +29 -0
- package/cjs/trackers/strategy/strategyOptimized.js +34 -0
- package/cjs/trackers/uniqueKeysTracker.js +69 -0
- package/cjs/utils/constants/index.js +3 -2
- package/cjs/utils/settingsValidation/impressionsMode.js +2 -2
- package/cjs/utils/settingsValidation/index.js +3 -0
- package/esm/listeners/browser.js +3 -2
- package/esm/logger/constants.js +1 -0
- package/esm/sdkFactory/index.js +13 -5
- package/esm/services/splitApi.js +20 -0
- package/esm/sync/submitters/submitterManager.js +3 -0
- package/esm/sync/submitters/uniqueKeysSubmitter.js +64 -0
- package/esm/trackers/impressionsTracker.js +7 -28
- package/esm/trackers/strategy/strategyDebug.js +21 -0
- package/esm/trackers/strategy/strategyNone.js +25 -0
- package/esm/trackers/strategy/strategyOptimized.js +30 -0
- package/esm/trackers/uniqueKeysTracker.js +65 -0
- package/esm/utils/constants/index.js +1 -0
- package/esm/utils/settingsValidation/impressionsMode.js +3 -3
- package/esm/utils/settingsValidation/index.js +3 -0
- package/package.json +1 -1
- package/src/listeners/browser.ts +3 -2
- package/src/logger/constants.ts +1 -0
- package/src/sdkFactory/index.ts +15 -5
- package/src/sdkFactory/types.ts +7 -4
- package/src/services/splitApi.ts +22 -0
- package/src/services/types.ts +6 -0
- package/src/storages/types.ts +17 -4
- package/src/sync/submitters/submitterManager.ts +2 -0
- package/src/sync/submitters/types.ts +20 -1
- package/src/sync/submitters/uniqueKeysSubmitter.ts +79 -0
- package/src/trackers/impressionsTracker.ts +12 -34
- package/src/trackers/strategy/strategyDebug.ts +28 -0
- package/src/trackers/strategy/strategyNone.ts +34 -0
- package/src/trackers/strategy/strategyOptimized.ts +42 -0
- package/src/trackers/types.ts +30 -0
- package/src/trackers/uniqueKeysTracker.ts +80 -0
- package/src/types.ts +2 -1
- package/src/utils/constants/index.ts +1 -0
- package/src/utils/settingsValidation/impressionsMode.ts +3 -3
- package/src/utils/settingsValidation/index.ts +4 -0
- 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/constants.d.ts +1 -0
- package/types/sdkFactory/types.d.ts +4 -2
- package/types/services/types.d.ts +4 -0
- package/types/storages/types.d.ts +16 -3
- package/types/sync/submitters/types.d.ts +18 -1
- package/types/sync/submitters/uniqueKeysSubmitter.d.ts +10 -4
- package/types/trackers/filter/bloomFilter.d.ts +10 -0
- package/types/trackers/filter/dictionaryFilter.d.ts +8 -0
- package/types/trackers/filter/types.d.ts +5 -0
- package/types/trackers/impressionsTracker.d.ts +4 -6
- package/types/trackers/types.d.ts +29 -0
- package/types/types.d.ts +2 -1
- package/types/utils/constants/index.d.ts +1 -0
- package/types/utils/settingsValidation/index.d.ts +1 -0
- package/types/utils/timeTracker/index.d.ts +70 -1
- package/src/logger/.DS_Store +0 -0
- package/src/splitio.d.ts +0 -1602
- 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/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/index.d.ts +0 -10
- package/types/storages/parseSegments.d.ts +0 -6
- 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/telemetrySyncTask.d.ts +0 -0
- 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/trackers/telemetryRecorder.d.ts +0 -0
- 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
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IImpressionsHandler, IImpressionsTracker } from './types';
|
|
1
|
+
import { IImpressionsCacheBase, ITelemetryCacheSync, ITelemetryCacheAsync } from '../storages/types';
|
|
2
|
+
import { IImpressionsHandler, IImpressionsTracker, IStrategy } from './types';
|
|
3
3
|
import { ISettings } from '../types';
|
|
4
|
-
import { IImpressionObserver } from './impressionObserver/types';
|
|
5
4
|
/**
|
|
6
5
|
* Impressions tracker stores impressions in cache and pass them to the listener and integrations manager if provided.
|
|
7
6
|
*
|
|
@@ -9,7 +8,6 @@ import { IImpressionObserver } from './impressionObserver/types';
|
|
|
9
8
|
* @param metadata runtime metadata (ip, hostname and version)
|
|
10
9
|
* @param impressionListener optional impression listener
|
|
11
10
|
* @param integrationsManager optional integrations manager
|
|
12
|
-
* @param
|
|
13
|
-
* @param countsCache optional cache to save impressions count. If provided, impressions will be deduped (OPTIMIZED mode)
|
|
11
|
+
* @param strategy strategy for impressions tracking.
|
|
14
12
|
*/
|
|
15
|
-
export declare function impressionsTrackerFactory(settings: ISettings, impressionsCache: IImpressionsCacheBase,
|
|
13
|
+
export declare function impressionsTrackerFactory(settings: ISettings, impressionsCache: IImpressionsCacheBase, strategy: IStrategy, integrationsManager?: IImpressionsHandler, telemetryCache?: ITelemetryCacheSync | ITelemetryCacheAsync): IImpressionsTracker;
|
|
@@ -2,6 +2,7 @@ import { SplitIO, ImpressionDTO } from '../types';
|
|
|
2
2
|
import { StreamingEventType, Method, OperationType } from '../sync/submitters/types';
|
|
3
3
|
import { IEventsCacheBase } from '../storages/types';
|
|
4
4
|
import { NetworkError } from '../services/types';
|
|
5
|
+
import { ISet } from '../utils/lang/sets';
|
|
5
6
|
/** Events tracker */
|
|
6
7
|
export interface IEventsHandler {
|
|
7
8
|
handleEvent(eventData: SplitIO.EventData): any;
|
|
@@ -34,3 +35,31 @@ export interface ITelemetryTracker {
|
|
|
34
35
|
*/
|
|
35
36
|
streamingEvent(e: StreamingEventType | AUTH_REJECTION, d?: number): void;
|
|
36
37
|
}
|
|
38
|
+
export interface IFilterAdapter {
|
|
39
|
+
add(featureName: string, key: string): boolean;
|
|
40
|
+
contains(featureName: string, key: string): boolean;
|
|
41
|
+
clear(): void;
|
|
42
|
+
}
|
|
43
|
+
export interface IImpressionSenderAdapter {
|
|
44
|
+
recordUniqueKeys(data: Object): void;
|
|
45
|
+
recordImpressionCounts(data: Object): void;
|
|
46
|
+
}
|
|
47
|
+
/** Unique keys tracker */
|
|
48
|
+
export interface IUniqueKeysTracker {
|
|
49
|
+
track(featureName: string, key: string): void;
|
|
50
|
+
pop(toMerge?: {
|
|
51
|
+
[featureName: string]: ISet<string>;
|
|
52
|
+
}): {
|
|
53
|
+
[featureName: string]: ISet<string>;
|
|
54
|
+
};
|
|
55
|
+
clear(): void;
|
|
56
|
+
isEmpty(): boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface IStrategyResult {
|
|
59
|
+
impressionsToStore: ImpressionDTO[];
|
|
60
|
+
impressionsToListener: ImpressionDTO[];
|
|
61
|
+
deduped: number;
|
|
62
|
+
}
|
|
63
|
+
export interface IStrategy {
|
|
64
|
+
process(impressions: ImpressionDTO[]): IStrategyResult;
|
|
65
|
+
}
|
package/types/types.d.ts
CHANGED
|
@@ -74,6 +74,7 @@ export interface ISettings {
|
|
|
74
74
|
featuresRefreshRate: number;
|
|
75
75
|
impressionsRefreshRate: number;
|
|
76
76
|
impressionsQueueSize: number;
|
|
77
|
+
uniqueKeysRefreshRate: number;
|
|
77
78
|
/**
|
|
78
79
|
* @deprecated
|
|
79
80
|
*/
|
|
@@ -715,7 +716,7 @@ export declare namespace SplitIO {
|
|
|
715
716
|
* ImpressionsMode type
|
|
716
717
|
* @typedef {string} ImpressionsMode
|
|
717
718
|
*/
|
|
718
|
-
type ImpressionsMode = 'OPTIMIZED' | 'DEBUG';
|
|
719
|
+
type ImpressionsMode = 'OPTIMIZED' | 'DEBUG' | 'NONE';
|
|
719
720
|
/**
|
|
720
721
|
* Defines the format of Split data to preload on the factory storage (cache).
|
|
721
722
|
*/
|
|
@@ -11,6 +11,7 @@ export declare const SPLIT_IMPRESSION = "IMPRESSION";
|
|
|
11
11
|
export declare const SPLIT_EVENT = "EVENT";
|
|
12
12
|
export declare const DEBUG = "DEBUG";
|
|
13
13
|
export declare const OPTIMIZED = "OPTIMIZED";
|
|
14
|
+
export declare const NONE = "NONE";
|
|
14
15
|
export declare const LOCALHOST_MODE: SDKMode;
|
|
15
16
|
export declare const STANDALONE_MODE: SDKMode;
|
|
16
17
|
export declare const PRODUCER_MODE = "producer";
|
|
@@ -1 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
import { ILogger } from '../../logger/types';
|
|
2
|
+
import { IResponse } from '../../services/types';
|
|
3
|
+
interface MetricsCollector {
|
|
4
|
+
countException(): void;
|
|
5
|
+
count(status: number): void;
|
|
6
|
+
latency(ms: number): void;
|
|
7
|
+
ready(ms: number): void;
|
|
8
|
+
getTreatment(ms: number): void;
|
|
9
|
+
getTreatments(ms: number): void;
|
|
10
|
+
getTreatmentWithConfig(ms: number): void;
|
|
11
|
+
getTreatmentsWithConfig(ms: number): void;
|
|
12
|
+
[method: string]: (ms: number) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const TrackerAPI: {
|
|
15
|
+
/**
|
|
16
|
+
* "Private" method, used to attach count/countException and stop callbacks to a promise.
|
|
17
|
+
*
|
|
18
|
+
* @param {ILogger} log - Logger.
|
|
19
|
+
* @param {Promise} promise - The promise we want to attach the callbacks.
|
|
20
|
+
* @param {string} task - The name of the task.
|
|
21
|
+
* @param {number | string} modifier - (optional) The modifier for the task, if any.
|
|
22
|
+
*/
|
|
23
|
+
__attachToPromise(log: ILogger, promise: Promise<IResponse>, task: string, collector: false | MetricsCollector, modifier?: string | number | undefined): Promise<IResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Starts tracking the time for a given task. All tasks tracked are considered "unique" because
|
|
26
|
+
* there may be multiple SDK instances tracking a "generic" task, making any task non-generic.
|
|
27
|
+
*
|
|
28
|
+
* @param {ILogger} log - Logger.
|
|
29
|
+
* @param {string} task - The task we are starting.
|
|
30
|
+
* @param {Object} collectors - The collectors map.
|
|
31
|
+
* @param {Promise} promise - (optional) The promise we are tracking.
|
|
32
|
+
* @return {Function | Promise} The stop function for this specific task or the promise received with the callbacks registered.
|
|
33
|
+
*/
|
|
34
|
+
start(log: ILogger, task: string, collectors?: Record<string, MetricsCollector> | undefined, promise?: Promise<IResponse> | undefined, now?: (() => number) | undefined): Promise<IResponse> | (() => number);
|
|
35
|
+
/**
|
|
36
|
+
* Setup the collector for a task that reports metrics.
|
|
37
|
+
*
|
|
38
|
+
* @param {string} task - The task name
|
|
39
|
+
* @param {number | string} taskUniqueId - The unique identifier for this task
|
|
40
|
+
* @param {Object} collectors - The collectors map.
|
|
41
|
+
*/
|
|
42
|
+
setCollectorForTask(task: string, taskUniqueId: number | string, collectors: Record<string, MetricsCollector>): void;
|
|
43
|
+
/**
|
|
44
|
+
* Stops the tracking of a given task.
|
|
45
|
+
*
|
|
46
|
+
* @param {ILogger} log - Logger.
|
|
47
|
+
* @param {string} task - The task we are starting.
|
|
48
|
+
* @param {number | string} modifier - (optional) The modifier for that specific task.
|
|
49
|
+
*/
|
|
50
|
+
stop(log: ILogger, task: string, modifier?: string | number | undefined): number | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* The constants shortcut for the task names.
|
|
53
|
+
*/
|
|
54
|
+
TaskNames: {
|
|
55
|
+
SDK_READY: string;
|
|
56
|
+
SDK_GET_TREATMENT: string;
|
|
57
|
+
SDK_GET_TREATMENTS: string;
|
|
58
|
+
SDK_GET_TREATMENT_WITH_CONFIG: string;
|
|
59
|
+
SDK_GET_TREATMENTS_WITH_CONFIG: string;
|
|
60
|
+
SPLITS_READY: string;
|
|
61
|
+
SEGMENTS_READY: string;
|
|
62
|
+
METRICS_PUSH: string;
|
|
63
|
+
IMPRESSIONS_PUSH: string;
|
|
64
|
+
EVENTS_PUSH: string;
|
|
65
|
+
MY_SEGMENTS_FETCH: string;
|
|
66
|
+
SEGMENTS_FETCH: string;
|
|
67
|
+
SPLITS_FETCH: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export {};
|
package/src/logger/.DS_Store
DELETED
|
Binary file
|