@splitsoftware/splitio-commons 1.6.2-rc.5 → 1.6.2-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/consent/sdkUserConsent.js +2 -2
- package/cjs/evaluator/index.js +10 -11
- package/cjs/integrations/ga/GaToSplit.js +8 -5
- package/cjs/listeners/browser.js +1 -2
- package/cjs/logger/constants.js +1 -2
- package/cjs/sdkFactory/index.js +7 -25
- package/cjs/sdkManager/index.js +3 -11
- package/cjs/services/splitApi.js +0 -20
- package/cjs/storages/AbstractSplitsCacheAsync.js +7 -9
- package/cjs/storages/AbstractSplitsCacheSync.js +7 -9
- package/cjs/storages/KeyBuilderSS.js +0 -6
- package/cjs/storages/dataLoader.js +1 -1
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +5 -6
- package/cjs/storages/inLocalStorage/index.js +0 -4
- package/cjs/storages/inMemory/ImpressionCountsCacheInMemory.js +1 -12
- package/cjs/storages/inMemory/InMemoryStorage.js +1 -5
- package/cjs/storages/inMemory/InMemoryStorageCS.js +1 -5
- package/cjs/storages/inMemory/SplitsCacheInMemory.js +7 -10
- package/cjs/storages/inRedis/SplitsCacheInRedis.js +15 -9
- package/cjs/storages/inRedis/constants.js +1 -4
- package/cjs/storages/inRedis/index.js +1 -15
- package/cjs/storages/pluggable/SplitsCachePluggable.js +14 -9
- package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +2 -3
- package/cjs/sync/polling/updaters/splitChangesUpdater.js +1 -1
- package/cjs/sync/submitters/submitterManager.js +0 -3
- package/cjs/sync/submitters/telemetrySubmitter.js +0 -1
- package/cjs/trackers/impressionsTracker.js +41 -22
- package/cjs/trackers/telemetryTracker.js +6 -0
- package/cjs/utils/constants/index.js +2 -4
- package/cjs/utils/settingsValidation/impressionsMode.js +2 -2
- package/cjs/utils/settingsValidation/index.js +0 -3
- package/esm/consent/sdkUserConsent.js +2 -2
- package/esm/evaluator/index.js +10 -11
- package/esm/integrations/ga/GaToSplit.js +8 -5
- package/esm/listeners/browser.js +2 -3
- package/esm/logger/constants.js +0 -1
- package/esm/sdkFactory/index.js +7 -25
- package/esm/sdkManager/index.js +3 -11
- package/esm/services/splitApi.js +0 -20
- package/esm/storages/AbstractSplitsCacheAsync.js +7 -9
- package/esm/storages/AbstractSplitsCacheSync.js +7 -9
- package/esm/storages/KeyBuilderSS.js +0 -6
- package/esm/storages/dataLoader.js +1 -1
- package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +5 -6
- package/esm/storages/inLocalStorage/index.js +1 -5
- package/esm/storages/inMemory/ImpressionCountsCacheInMemory.js +1 -12
- package/esm/storages/inMemory/InMemoryStorage.js +2 -6
- package/esm/storages/inMemory/InMemoryStorageCS.js +2 -6
- package/esm/storages/inMemory/SplitsCacheInMemory.js +7 -10
- package/esm/storages/inRedis/SplitsCacheInRedis.js +15 -9
- package/esm/storages/inRedis/constants.js +0 -3
- package/esm/storages/inRedis/index.js +2 -16
- package/esm/storages/pluggable/SplitsCachePluggable.js +14 -9
- package/esm/sync/offline/syncTasks/fromObjectSyncTask.js +2 -3
- package/esm/sync/polling/updaters/splitChangesUpdater.js +1 -1
- package/esm/sync/submitters/submitterManager.js +0 -3
- package/esm/sync/submitters/telemetrySubmitter.js +1 -2
- package/esm/trackers/impressionsTracker.js +41 -22
- package/esm/trackers/telemetryTracker.js +6 -0
- package/esm/utils/constants/index.js +0 -2
- package/esm/utils/settingsValidation/impressionsMode.js +3 -3
- package/esm/utils/settingsValidation/index.js +0 -3
- package/package.json +1 -1
- package/src/consent/sdkUserConsent.ts +2 -2
- package/src/evaluator/index.ts +8 -9
- package/src/integrations/ga/GaToSplit.ts +9 -5
- package/src/integrations/types.ts +2 -1
- package/src/listeners/browser.ts +2 -3
- package/src/logger/.DS_Store +0 -0
- package/src/logger/constants.ts +0 -1
- package/src/sdkFactory/index.ts +7 -28
- package/src/sdkFactory/types.ts +4 -7
- package/src/sdkManager/index.ts +3 -12
- package/src/services/splitApi.ts +0 -22
- package/src/services/types.ts +0 -6
- package/src/storages/AbstractSplitsCacheAsync.ts +13 -14
- package/src/storages/AbstractSplitsCacheSync.ts +14 -16
- package/src/storages/KeyBuilderSS.ts +0 -8
- package/src/storages/dataLoader.ts +1 -1
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +8 -10
- package/src/storages/inLocalStorage/index.ts +1 -4
- package/src/storages/inMemory/ImpressionCountsCacheInMemory.ts +1 -16
- package/src/storages/inMemory/InMemoryStorage.ts +2 -5
- package/src/storages/inMemory/InMemoryStorageCS.ts +2 -6
- package/src/storages/inMemory/SplitsCacheInMemory.ts +10 -14
- package/src/storages/inRedis/SplitsCacheInRedis.ts +21 -17
- package/src/storages/inRedis/constants.ts +0 -3
- package/src/storages/inRedis/index.ts +3 -12
- package/src/storages/pluggable/SplitsCachePluggable.ts +20 -17
- package/src/storages/types.ts +21 -40
- package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +5 -6
- package/src/sync/polling/updaters/splitChangesUpdater.ts +2 -2
- package/src/sync/submitters/submitterManager.ts +0 -2
- package/src/sync/submitters/telemetrySubmitter.ts +3 -4
- package/src/sync/submitters/types.ts +1 -20
- package/src/trackers/impressionsTracker.ts +48 -27
- package/src/trackers/telemetryTracker.ts +7 -2
- package/src/trackers/types.ts +4 -26
- package/src/types.ts +1 -3
- package/src/utils/constants/index.ts +0 -2
- package/src/utils/settingsValidation/impressionsMode.ts +3 -3
- package/src/utils/settingsValidation/index.ts +0 -4
- package/types/integrations/types.d.ts +2 -1
- package/types/logger/constants.d.ts +0 -1
- package/types/sdkFactory/types.d.ts +2 -4
- package/types/services/types.d.ts +0 -4
- package/types/storages/AbstractSplitsCacheAsync.d.ts +6 -5
- package/types/storages/AbstractSplitsCacheSync.d.ts +5 -5
- package/types/storages/KeyBuilderSS.d.ts +0 -2
- package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +3 -3
- package/types/storages/inMemory/ImpressionCountsCacheInMemory.d.ts +1 -5
- package/types/storages/inMemory/SplitsCacheInMemory.d.ts +3 -2
- package/types/storages/inRedis/SplitsCacheInRedis.d.ts +6 -5
- package/types/storages/inRedis/constants.d.ts +0 -3
- package/types/storages/pluggable/SplitsCachePluggable.d.ts +6 -5
- package/types/storages/types.d.ts +18 -28
- package/types/sync/polling/updaters/splitChangesUpdater.d.ts +1 -1
- package/types/sync/submitters/types.d.ts +1 -18
- package/types/trackers/impressionsTracker.d.ts +6 -4
- package/types/trackers/types.d.ts +4 -21
- package/types/types.d.ts +1 -3
- package/types/utils/constants/index.d.ts +0 -2
- package/types/utils/settingsValidation/index.d.ts +0 -1
- package/cjs/storages/inMemory/uniqueKeysCacheInMemory.js +0 -73
- package/cjs/storages/inMemory/uniqueKeysCacheInMemoryCS.js +0 -78
- package/cjs/storages/inRedis/ImpressionCountsCacheInRedis.js +0 -46
- package/cjs/storages/inRedis/uniqueKeysCacheInRedis.js +0 -55
- package/cjs/sync/submitters/uniqueKeysSubmitter.js +0 -26
- package/cjs/trackers/strategy/strategyDebug.js +0 -25
- package/cjs/trackers/strategy/strategyNone.js +0 -29
- package/cjs/trackers/strategy/strategyOptimized.js +0 -34
- package/cjs/trackers/uniqueKeysTracker.js +0 -31
- package/esm/storages/inMemory/uniqueKeysCacheInMemory.js +0 -70
- package/esm/storages/inMemory/uniqueKeysCacheInMemoryCS.js +0 -75
- package/esm/storages/inRedis/ImpressionCountsCacheInRedis.js +0 -43
- package/esm/storages/inRedis/uniqueKeysCacheInRedis.js +0 -52
- package/esm/sync/submitters/uniqueKeysSubmitter.js +0 -22
- package/esm/trackers/strategy/strategyDebug.js +0 -21
- package/esm/trackers/strategy/strategyNone.js +0 -25
- package/esm/trackers/strategy/strategyOptimized.js +0 -30
- package/esm/trackers/uniqueKeysTracker.js +0 -27
- package/src/storages/inMemory/uniqueKeysCacheInMemory.ts +0 -82
- package/src/storages/inMemory/uniqueKeysCacheInMemoryCS.ts +0 -88
- package/src/storages/inRedis/ImpressionCountsCacheInRedis.ts +0 -48
- package/src/storages/inRedis/uniqueKeysCacheInRedis.ts +0 -61
- package/src/sync/submitters/uniqueKeysSubmitter.ts +0 -35
- package/src/trackers/strategy/strategyDebug.ts +0 -28
- package/src/trackers/strategy/strategyNone.ts +0 -34
- package/src/trackers/strategy/strategyOptimized.ts +0 -42
- package/src/trackers/uniqueKeysTracker.ts +0 -37
- package/types/sdkClient/types.d.ts +0 -18
- package/types/storages/inMemory/CountsCacheInMemory.d.ts +0 -20
- package/types/storages/inMemory/LatenciesCacheInMemory.d.ts +0 -20
- package/types/storages/inMemory/uniqueKeysCacheInMemory.d.ts +0 -35
- package/types/storages/inMemory/uniqueKeysCacheInMemoryCS.d.ts +0 -37
- package/types/storages/inRedis/CountsCacheInRedis.d.ts +0 -9
- package/types/storages/inRedis/ImpressionCountsCacheInRedis.d.ts +0 -13
- package/types/storages/inRedis/LatenciesCacheInRedis.d.ts +0 -9
- package/types/storages/inRedis/uniqueKeysCacheInRedis.d.ts +0 -14
- package/types/sync/offline/LocalhostFromFile.d.ts +0 -2
- package/types/sync/offline/splitsParser/splitsParserFromFile.d.ts +0 -2
- package/types/sync/submitters/eventsSyncTask.d.ts +0 -8
- package/types/sync/submitters/impressionCountsSubmitterInRedis.d.ts +0 -5
- 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/uniqueKeysSubmitter.d.ts +0 -5
- package/types/sync/submitters/uniqueKeysSubmitterInRedis.d.ts +0 -5
- package/types/sync/syncTaskComposite.d.ts +0 -5
- package/types/trackers/filter/bloomFilter.d.ts +0 -10
- package/types/trackers/filter/dictionaryFilter.d.ts +0 -8
- package/types/trackers/filter/types.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/uniqueKeysTracker.d.ts +0 -13
- package/types/utils/timeTracker/index.d.ts +0 -70
|
@@ -4,7 +4,6 @@ import { impressionCountsSubmitterFactory } from './impressionCountsSubmitter';
|
|
|
4
4
|
import { telemetrySubmitterFactory } from './telemetrySubmitter';
|
|
5
5
|
import { ISdkFactoryContextSync } from '../../sdkFactory/types';
|
|
6
6
|
import { ISubmitterManager } from './types';
|
|
7
|
-
import { uniqueKeysSubmitterFactory } from './uniqueKeysSubmitter';
|
|
8
7
|
|
|
9
8
|
export function submitterManagerFactory(params: ISdkFactoryContextSync): ISubmitterManager {
|
|
10
9
|
|
|
@@ -16,7 +15,6 @@ export function submitterManagerFactory(params: ISdkFactoryContextSync): ISubmit
|
|
|
16
15
|
const impressionCountsSubmitter = impressionCountsSubmitterFactory(params);
|
|
17
16
|
if (impressionCountsSubmitter) submitters.push(impressionCountsSubmitter);
|
|
18
17
|
const telemetrySubmitter = telemetrySubmitterFactory(params);
|
|
19
|
-
if (params.uniqueKeysTracker) submitters.push(uniqueKeysSubmitterFactory(params));
|
|
20
18
|
|
|
21
19
|
return {
|
|
22
20
|
// `onlyTelemetry` true if SDK is created with userConsent not GRANTED
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ISegmentsCacheSync, ISplitsCacheSync, ITelemetryCacheSync } from '../../storages/types';
|
|
2
2
|
import { submitterFactory, firstPushWindowDecorator } from './submitter';
|
|
3
3
|
import { TelemetryUsageStatsPayload, TelemetryConfigStatsPayload, TelemetryConfigStats } from './types';
|
|
4
|
-
import { QUEUED, DEDUPED, DROPPED, CONSUMER_MODE, CONSUMER_ENUM, STANDALONE_MODE, CONSUMER_PARTIAL_MODE, STANDALONE_ENUM, CONSUMER_PARTIAL_ENUM, OPTIMIZED, DEBUG,
|
|
4
|
+
import { QUEUED, DEDUPED, DROPPED, CONSUMER_MODE, CONSUMER_ENUM, STANDALONE_MODE, CONSUMER_PARTIAL_MODE, STANDALONE_ENUM, CONSUMER_PARTIAL_ENUM, OPTIMIZED, DEBUG, DEBUG_ENUM, OPTIMIZED_ENUM, CONSENT_GRANTED, CONSENT_DECLINED, CONSENT_UNKNOWN } from '../../utils/constants';
|
|
5
5
|
import { SDK_READY, SDK_READY_FROM_CACHE } from '../../readiness/constants';
|
|
6
6
|
import { ConsentStatus, ISettings, SDKMode } from '../../types';
|
|
7
7
|
import { base } from '../../utils/settingsValidation';
|
|
@@ -52,9 +52,8 @@ const OPERATION_MODE_MAP = {
|
|
|
52
52
|
|
|
53
53
|
const IMPRESSIONS_MODE_MAP = {
|
|
54
54
|
[OPTIMIZED]: OPTIMIZED_ENUM,
|
|
55
|
-
[DEBUG]: DEBUG_ENUM
|
|
56
|
-
|
|
57
|
-
} as Record<ISettings['sync']['impressionsMode'], (0 | 1 | 2)>;
|
|
55
|
+
[DEBUG]: DEBUG_ENUM
|
|
56
|
+
} as Record<ISettings['sync']['impressionsMode'], (0 | 1)>;
|
|
58
57
|
|
|
59
58
|
const USER_CONSENT_MAP = {
|
|
60
59
|
[CONSENT_UNKNOWN]: 1,
|
|
@@ -35,24 +35,6 @@ export type ImpressionCountsPayload = {
|
|
|
35
35
|
}[]
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export type UniqueKeysPayloadSs = {
|
|
39
|
-
keys: {
|
|
40
|
-
/** Split name */
|
|
41
|
-
f: string
|
|
42
|
-
/** keyNames */
|
|
43
|
-
ks: string[]
|
|
44
|
-
}[]
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export type UniqueKeysPayloadCs = {
|
|
48
|
-
keys: {
|
|
49
|
-
/** keyNames */
|
|
50
|
-
k: string
|
|
51
|
-
/** Split name */
|
|
52
|
-
fs: string[]
|
|
53
|
-
}[]
|
|
54
|
-
}
|
|
55
|
-
|
|
56
38
|
export type StoredImpressionWithMetadata = {
|
|
57
39
|
/** Metadata */
|
|
58
40
|
m: IMetadata,
|
|
@@ -166,8 +148,7 @@ export type OperationMode = STANDALONE_ENUM | CONSUMER_ENUM | CONSUMER_PARTIAL_E
|
|
|
166
148
|
|
|
167
149
|
export type OPTIMIZED_ENUM = 0;
|
|
168
150
|
export type DEBUG_ENUM = 1;
|
|
169
|
-
export type
|
|
170
|
-
export type ImpressionsMode = OPTIMIZED_ENUM | DEBUG_ENUM | NONE_ENUM;
|
|
151
|
+
export type ImpressionsMode = OPTIMIZED_ENUM | DEBUG_ENUM;
|
|
171
152
|
|
|
172
153
|
export type RefreshRates = {
|
|
173
154
|
sp: number, // splits
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { objectAssign } from '../utils/lang/objectAssign';
|
|
2
2
|
import { thenable } from '../utils/promise/thenable';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { truncateTimeFrame } from '../utils/time';
|
|
4
|
+
import { IImpressionCountsCacheSync, IImpressionsCacheBase, ITelemetryCacheSync, ITelemetryCacheAsync } from '../storages/types';
|
|
5
|
+
import { IImpressionsHandler, IImpressionsTracker } from './types';
|
|
5
6
|
import { SplitIO, ImpressionDTO, ISettings } from '../types';
|
|
7
|
+
import { IImpressionObserver } from './impressionObserver/types';
|
|
6
8
|
import { IMPRESSIONS_TRACKER_SUCCESS, ERROR_IMPRESSIONS_TRACKER, ERROR_IMPRESSIONS_LISTENER } from '../logger/constants';
|
|
7
9
|
import { CONSENT_DECLINED, DEDUPED, QUEUED } from '../utils/constants';
|
|
8
10
|
|
|
@@ -13,14 +15,18 @@ import { CONSENT_DECLINED, DEDUPED, QUEUED } from '../utils/constants';
|
|
|
13
15
|
* @param metadata runtime metadata (ip, hostname and version)
|
|
14
16
|
* @param impressionListener optional impression listener
|
|
15
17
|
* @param integrationsManager optional integrations manager
|
|
16
|
-
* @param
|
|
18
|
+
* @param observer optional impression observer. If provided, previous time (pt property) is included in impression instances
|
|
19
|
+
* @param countsCache optional cache to save impressions count. If provided, impressions will be deduped (OPTIMIZED mode)
|
|
17
20
|
*/
|
|
18
21
|
export function impressionsTrackerFactory(
|
|
19
22
|
settings: ISettings,
|
|
20
23
|
impressionsCache: IImpressionsCacheBase,
|
|
21
|
-
strategy: IStrategy,
|
|
22
24
|
integrationsManager?: IImpressionsHandler,
|
|
23
|
-
|
|
25
|
+
// if observer is provided, it implies `shouldAddPreviousTime` flag (i.e., if impressions previous time should be added or not)
|
|
26
|
+
observer?: IImpressionObserver,
|
|
27
|
+
// if countsCache is provided, it implies `isOptimized` flag (i.e., if impressions should be deduped or not)
|
|
28
|
+
countsCache?: IImpressionCountsCacheSync,
|
|
29
|
+
telemetryCache?: ITelemetryCacheSync | ITelemetryCacheAsync
|
|
24
30
|
): IImpressionsTracker {
|
|
25
31
|
|
|
26
32
|
const { log, impressionListener, runtime: { ip, hostname }, version } = settings;
|
|
@@ -30,36 +36,51 @@ export function impressionsTrackerFactory(
|
|
|
30
36
|
if (settings.userConsent === CONSENT_DECLINED) return;
|
|
31
37
|
|
|
32
38
|
const impressionsCount = impressions.length;
|
|
33
|
-
const { impressionsToStore, impressionsToListener, deduped } = strategy.process(impressions);
|
|
34
|
-
|
|
35
|
-
const impressionsToListenerCount = impressionsToListener.length;
|
|
36
|
-
|
|
37
|
-
if ( impressionsToStore.length>0 ){
|
|
38
|
-
const res = impressionsCache.track(impressionsToStore);
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
40
|
+
const impressionsToStore: ImpressionDTO[] = []; // Track only the impressions that are going to be stored
|
|
41
|
+
// Wraps impressions to store and adds previousTime if it corresponds
|
|
42
|
+
impressions.forEach((impression) => {
|
|
43
|
+
if (observer) {
|
|
44
|
+
// Adds previous time if it is enabled
|
|
45
|
+
impression.pt = observer.testAndSet(impression);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const now = Date.now();
|
|
49
|
+
if (countsCache) {
|
|
50
|
+
// Increments impression counter per featureName
|
|
51
|
+
countsCache.track(impression.feature, now, 1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Checks if the impression should be added in queue to be sent
|
|
55
|
+
if (!countsCache || !impression.pt || impression.pt < truncateTimeFrame(now)) {
|
|
56
|
+
impressionsToStore.push(impression);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const res = impressionsCache.track(impressionsToStore);
|
|
61
|
+
|
|
62
|
+
// If we're on an async storage, handle error and log it.
|
|
63
|
+
if (thenable(res)) {
|
|
64
|
+
res.then(() => {
|
|
65
|
+
log.info(IMPRESSIONS_TRACKER_SUCCESS, [impressionsCount]);
|
|
66
|
+
}).catch(err => {
|
|
67
|
+
log.error(ERROR_IMPRESSIONS_TRACKER, [impressionsCount, err]);
|
|
68
|
+
});
|
|
69
|
+
} else {
|
|
70
|
+
// Record when impressionsCache is sync only (standalone mode)
|
|
71
|
+
// @TODO we are not dropping impressions on full queue yet, so DROPPED stats are not recorded
|
|
72
|
+
if (telemetryCache) {
|
|
73
|
+
(telemetryCache as ITelemetryCacheSync).recordImpressionStats(QUEUED, impressionsToStore.length);
|
|
74
|
+
(telemetryCache as ITelemetryCacheSync).recordImpressionStats(DEDUPED, impressions.length - impressionsToStore.length);
|
|
54
75
|
}
|
|
55
76
|
}
|
|
56
77
|
|
|
57
78
|
// @TODO next block might be handled by the integration manager. In that case, the metadata object doesn't need to be passed in the constructor
|
|
58
79
|
if (impressionListener || integrationsManager) {
|
|
59
|
-
for (let i = 0; i <
|
|
80
|
+
for (let i = 0; i < impressionsCount; i++) {
|
|
60
81
|
const impressionData: SplitIO.ImpressionData = {
|
|
61
82
|
// copy of impression, to avoid unexpected behaviour if modified by integrations or impressionListener
|
|
62
|
-
impression: objectAssign({},
|
|
83
|
+
impression: objectAssign({}, impressions[i]),
|
|
63
84
|
attributes,
|
|
64
85
|
ip,
|
|
65
86
|
hostname,
|
|
@@ -48,6 +48,10 @@ export function telemetryTrackerFactory(
|
|
|
48
48
|
});
|
|
49
49
|
if (e === TOKEN_REFRESH) (telemetryCache as ITelemetryCacheSync).recordTokenRefreshes();
|
|
50
50
|
}
|
|
51
|
+
},
|
|
52
|
+
addTag(tag: string) {
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
if (telemetryCache.addTag) telemetryCache.addTag(tag);
|
|
51
55
|
}
|
|
52
56
|
};
|
|
53
57
|
|
|
@@ -56,8 +60,9 @@ export function telemetryTrackerFactory(
|
|
|
56
60
|
return {
|
|
57
61
|
trackEval: noopTrack,
|
|
58
62
|
trackHttp: noopTrack,
|
|
59
|
-
sessionLength
|
|
60
|
-
streamingEvent
|
|
63
|
+
sessionLength() { },
|
|
64
|
+
streamingEvent() { },
|
|
65
|
+
addTag() { }
|
|
61
66
|
};
|
|
62
67
|
}
|
|
63
68
|
}
|
package/src/trackers/types.ts
CHANGED
|
@@ -41,30 +41,8 @@ export interface ITelemetryTracker {
|
|
|
41
41
|
* Records streaming event
|
|
42
42
|
*/
|
|
43
43
|
streamingEvent(e: StreamingEventType | AUTH_REJECTION, d?: number): void
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
contains(key: string, featureName: string): boolean;
|
|
49
|
-
clear(): void;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface IImpressionSenderAdapter {
|
|
53
|
-
recordUniqueKeys(data: Object): void;
|
|
54
|
-
recordImpressionCounts(data: Object): void
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/** Unique keys tracker */
|
|
58
|
-
export interface IUniqueKeysTracker {
|
|
59
|
-
track(key: string, featureName: string): void;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface IStrategyResult {
|
|
63
|
-
impressionsToStore: ImpressionDTO[],
|
|
64
|
-
impressionsToListener: ImpressionDTO[],
|
|
65
|
-
deduped: number
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface IStrategy {
|
|
69
|
-
process(impressions: ImpressionDTO[]): IStrategyResult
|
|
44
|
+
/**
|
|
45
|
+
* Records tag
|
|
46
|
+
*/
|
|
47
|
+
addTag(tag: string): void
|
|
70
48
|
}
|
package/src/types.ts
CHANGED
|
@@ -80,8 +80,6 @@ export interface ISettings {
|
|
|
80
80
|
featuresRefreshRate: number,
|
|
81
81
|
impressionsRefreshRate: number,
|
|
82
82
|
impressionsQueueSize: number,
|
|
83
|
-
uniqueKeysRefreshRate: number,
|
|
84
|
-
uniqueKeysCacheSize: number,
|
|
85
83
|
/**
|
|
86
84
|
* @deprecated
|
|
87
85
|
*/
|
|
@@ -720,7 +718,7 @@ export namespace SplitIO {
|
|
|
720
718
|
* ImpressionsMode type
|
|
721
719
|
* @typedef {string} ImpressionsMode
|
|
722
720
|
*/
|
|
723
|
-
export type ImpressionsMode = 'OPTIMIZED' | 'DEBUG'
|
|
721
|
+
export type ImpressionsMode = 'OPTIMIZED' | 'DEBUG'
|
|
724
722
|
/**
|
|
725
723
|
* Defines the format of Split data to preload on the factory storage (cache).
|
|
726
724
|
*/
|
|
@@ -19,7 +19,6 @@ export const SPLIT_EVENT = 'EVENT';
|
|
|
19
19
|
// Impression collection modes
|
|
20
20
|
export const DEBUG = 'DEBUG';
|
|
21
21
|
export const OPTIMIZED = 'OPTIMIZED';
|
|
22
|
-
export const NONE = 'NONE';
|
|
23
22
|
|
|
24
23
|
// SDK Modes
|
|
25
24
|
export const LOCALHOST_MODE: SDKMode = 'localhost';
|
|
@@ -50,7 +49,6 @@ export const CONSUMER_PARTIAL_ENUM = 2;
|
|
|
50
49
|
|
|
51
50
|
export const OPTIMIZED_ENUM = 0;
|
|
52
51
|
export const DEBUG_ENUM = 1;
|
|
53
|
-
export const NONE_ENUM = 2;
|
|
54
52
|
|
|
55
53
|
export const SPLITS = 'sp';
|
|
56
54
|
export const IMPRESSIONS = 'im';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ERROR_INVALID_CONFIG_PARAM } from '../../logger/constants';
|
|
2
2
|
import { ILogger } from '../../logger/types';
|
|
3
3
|
import { SplitIO } from '../../types';
|
|
4
|
-
import { DEBUG, OPTIMIZED
|
|
4
|
+
import { DEBUG, OPTIMIZED } from '../constants';
|
|
5
5
|
import { stringToUpperCase } from '../lang';
|
|
6
6
|
|
|
7
7
|
export function validImpressionsMode(log: ILogger, impressionsMode: any): SplitIO.ImpressionsMode {
|
|
8
8
|
impressionsMode = stringToUpperCase(impressionsMode);
|
|
9
9
|
|
|
10
|
-
if ([DEBUG, OPTIMIZED
|
|
10
|
+
if ([DEBUG, OPTIMIZED].indexOf(impressionsMode) > -1) return impressionsMode;
|
|
11
11
|
|
|
12
|
-
log.error(ERROR_INVALID_CONFIG_PARAM, ['impressionsMode', [DEBUG, OPTIMIZED
|
|
12
|
+
log.error(ERROR_INVALID_CONFIG_PARAM, ['impressionsMode', [DEBUG, OPTIMIZED], OPTIMIZED]);
|
|
13
13
|
return OPTIMIZED;
|
|
14
14
|
}
|
|
@@ -36,8 +36,6 @@ export const base = {
|
|
|
36
36
|
telemetryRefreshRate: 3600,
|
|
37
37
|
// publish evaluations each 300 sec (default value for OPTIMIZED impressions mode)
|
|
38
38
|
impressionsRefreshRate: 300,
|
|
39
|
-
// publish unique Keys each 900 sec (15 min)
|
|
40
|
-
uniqueKeysRefreshRate: 900,
|
|
41
39
|
// fetch offline changes each 15 sec
|
|
42
40
|
offlineRefreshRate: 15,
|
|
43
41
|
// publish events every 60 seconds after the first flush
|
|
@@ -132,13 +130,11 @@ export function settingsValidation(config: unknown, validationParams: ISettingsV
|
|
|
132
130
|
scheduler.segmentsRefreshRate = fromSecondsToMillis(scheduler.segmentsRefreshRate);
|
|
133
131
|
scheduler.offlineRefreshRate = fromSecondsToMillis(scheduler.offlineRefreshRate);
|
|
134
132
|
scheduler.eventsPushRate = fromSecondsToMillis(scheduler.eventsPushRate);
|
|
135
|
-
scheduler.uniqueKeysRefreshRate = fromSecondsToMillis(scheduler.uniqueKeysRefreshRate);
|
|
136
133
|
scheduler.telemetryRefreshRate = fromSecondsToMillis(validateMinValue('telemetryRefreshRate', scheduler.telemetryRefreshRate, 60));
|
|
137
134
|
|
|
138
135
|
// Default impressionsRefreshRate for DEBUG mode is 60 secs
|
|
139
136
|
if (get(config, 'scheduler.impressionsRefreshRate') === undefined && withDefaults.sync.impressionsMode === DEBUG) scheduler.impressionsRefreshRate = 60;
|
|
140
137
|
scheduler.impressionsRefreshRate = fromSecondsToMillis(scheduler.impressionsRefreshRate);
|
|
141
|
-
|
|
142
138
|
|
|
143
139
|
// Log deprecation for old telemetry param
|
|
144
140
|
if (scheduler.metricsRefreshRate) log.warn('`metricsRefreshRate` will be deprecated soon. For configuring telemetry rates, update `telemetryRefreshRate` value in configs');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IEventsCacheBase } from '../storages/types';
|
|
2
|
-
import { IEventsHandler, IImpressionsHandler } from '../trackers/types';
|
|
2
|
+
import { IEventsHandler, IImpressionsHandler, ITelemetryTracker } from '../trackers/types';
|
|
3
3
|
import { ISettings, SplitIO } from '../types';
|
|
4
4
|
export interface IIntegration {
|
|
5
5
|
queue(data: SplitIO.IntegrationData): void;
|
|
@@ -10,6 +10,7 @@ export interface IIntegrationFactoryParams {
|
|
|
10
10
|
events: IEventsCacheBase;
|
|
11
11
|
};
|
|
12
12
|
settings: ISettings;
|
|
13
|
+
telemetryTracker: ITelemetryTracker;
|
|
13
14
|
}
|
|
14
15
|
export declare type IntegrationFactory = {
|
|
15
16
|
readonly type: string;
|
|
@@ -138,5 +138,4 @@ export declare const LOG_PREFIX_SYNC_POLLING: string;
|
|
|
138
138
|
export declare const LOG_PREFIX_SYNC_SUBMITTERS: string;
|
|
139
139
|
export declare const LOG_PREFIX_IMPRESSIONS_TRACKER = "impressions-tracker: ";
|
|
140
140
|
export declare const LOG_PREFIX_EVENTS_TRACKER = "events-tracker: ";
|
|
141
|
-
export declare const LOG_PREFIX_UNIQUE_KEYS_TRACKER = "unique-keys-tracker: ";
|
|
142
141
|
export declare const LOG_PREFIX_CLEANUP = "cleanup: ";
|
|
@@ -6,7 +6,7 @@ import { IFetch, ISplitApi, IEventSourceConstructor } from '../services/types';
|
|
|
6
6
|
import { IStorageAsync, IStorageSync, ISplitsCacheSync, ISplitsCacheAsync, IStorageFactoryParams } from '../storages/types';
|
|
7
7
|
import { ISyncManager } from '../sync/types';
|
|
8
8
|
import { IImpressionObserver } from '../trackers/impressionObserver/types';
|
|
9
|
-
import { IImpressionsTracker, IEventTracker, ITelemetryTracker
|
|
9
|
+
import { IImpressionsTracker, IEventTracker, ITelemetryTracker } from '../trackers/types';
|
|
10
10
|
import { SplitIO, ISettings, IEventEmitter } from '../types';
|
|
11
11
|
/**
|
|
12
12
|
* Environment related dependencies.
|
|
@@ -42,7 +42,6 @@ export interface ISdkFactoryContext {
|
|
|
42
42
|
eventTracker: IEventTracker;
|
|
43
43
|
telemetryTracker: ITelemetryTracker;
|
|
44
44
|
storage: IStorageSync | IStorageAsync;
|
|
45
|
-
uniqueKeysTracker?: IUniqueKeysTracker;
|
|
46
45
|
signalListener?: ISignalListener;
|
|
47
46
|
splitApi?: ISplitApi;
|
|
48
47
|
syncManager?: ISyncManager;
|
|
@@ -71,12 +70,11 @@ export interface ISdkFactoryParams {
|
|
|
71
70
|
(): SplitIO.ICsClient;
|
|
72
71
|
(key: SplitIO.SplitKey, trafficType?: string | undefined): SplitIO.ICsClient;
|
|
73
72
|
} | (() => SplitIO.IClient) | (() => SplitIO.IAsyncClient));
|
|
74
|
-
impressionsObserverFactory: () => IImpressionObserver;
|
|
75
|
-
filterAdapterFactory?: () => IFilterAdapter;
|
|
76
73
|
SignalListener?: new (syncManager: ISyncManager | undefined, // Used by NodeSignalListener to flush data, and by BrowserSignalListener to close streaming connection.
|
|
77
74
|
settings: ISettings, // Used by BrowserSignalListener
|
|
78
75
|
storage: IStorageSync | IStorageAsync, // Used by BrowserSignalListener
|
|
79
76
|
serviceApi: ISplitApi | undefined) => ISignalListener;
|
|
80
77
|
integrationsManagerFactory?: (params: IIntegrationFactoryParams) => IIntegrationManager | undefined;
|
|
78
|
+
impressionsObserverFactory?: () => IImpressionObserver;
|
|
81
79
|
extraProps?: (params: ISdkFactoryContext) => object;
|
|
82
80
|
}
|
|
@@ -20,8 +20,6 @@ export declare type IFetchSplitChanges = (since: number, noCache?: boolean, till
|
|
|
20
20
|
export declare type IFetchSegmentChanges = (since: number, segmentName: string, noCache?: boolean, till?: number) => Promise<IResponse>;
|
|
21
21
|
export declare type IFetchMySegments = (userMatchingKey: string, noCache?: boolean) => Promise<IResponse>;
|
|
22
22
|
export declare type IPostEventsBulk = (body: string, headers?: Record<string, string>) => Promise<IResponse>;
|
|
23
|
-
export declare type IPostUniqueKeysBulkCs = (body: string, headers?: Record<string, string>) => Promise<IResponse>;
|
|
24
|
-
export declare type IPostUniqueKeysBulkSs = (body: string, headers?: Record<string, string>) => Promise<IResponse>;
|
|
25
23
|
export declare type IPostTestImpressionsBulk = (body: string, headers?: Record<string, string>) => Promise<IResponse>;
|
|
26
24
|
export declare type IPostTestImpressionsCount = (body: string, headers?: Record<string, string>) => Promise<IResponse>;
|
|
27
25
|
export declare type IPostMetricsConfig = (body: string) => Promise<IResponse>;
|
|
@@ -34,8 +32,6 @@ export interface ISplitApi {
|
|
|
34
32
|
fetchSegmentChanges: IFetchSegmentChanges;
|
|
35
33
|
fetchMySegments: IFetchMySegments;
|
|
36
34
|
postEventsBulk: IPostEventsBulk;
|
|
37
|
-
postUniqueKeysBulkCs: IPostUniqueKeysBulkCs;
|
|
38
|
-
postUniqueKeysBulkSs: IPostUniqueKeysBulkSs;
|
|
39
35
|
postTestImpressionsBulk: IPostTestImpressionsBulk;
|
|
40
36
|
postTestImpressionsCount: IPostTestImpressionsCount;
|
|
41
37
|
postMetricsConfig: IPostMetricsConfig;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { ISplitsCacheAsync } from './types';
|
|
2
|
+
import { ISplit } from '../dtos/types';
|
|
2
3
|
/**
|
|
3
4
|
* This class provides a skeletal implementation of the ISplitsCacheAsync interface
|
|
4
5
|
* to minimize the effort required to implement this interface.
|
|
5
6
|
*/
|
|
6
7
|
export declare abstract class AbstractSplitsCacheAsync implements ISplitsCacheAsync {
|
|
7
|
-
abstract addSplit(name: string, split:
|
|
8
|
-
abstract addSplits(entries: [string,
|
|
8
|
+
abstract addSplit(name: string, split: ISplit): Promise<boolean>;
|
|
9
|
+
abstract addSplits(entries: [string, ISplit][]): Promise<boolean[] | void>;
|
|
9
10
|
abstract removeSplits(names: string[]): Promise<boolean[] | void>;
|
|
10
|
-
abstract getSplit(name: string): Promise<
|
|
11
|
-
abstract getSplits(names: string[]): Promise<Record<string,
|
|
11
|
+
abstract getSplit(name: string): Promise<ISplit | null>;
|
|
12
|
+
abstract getSplits(names: string[]): Promise<Record<string, ISplit | null>>;
|
|
12
13
|
abstract setChangeNumber(changeNumber: number): Promise<boolean | void>;
|
|
13
14
|
abstract getChangeNumber(): Promise<number>;
|
|
14
|
-
abstract getAll(): Promise<
|
|
15
|
+
abstract getAll(): Promise<ISplit[]>;
|
|
15
16
|
abstract getSplitNames(): Promise<string[]>;
|
|
16
17
|
abstract trafficTypeExists(trafficType: string): Promise<boolean>;
|
|
17
18
|
abstract clear(): Promise<boolean | void>;
|
|
@@ -5,15 +5,15 @@ import { ISplit } from '../dtos/types';
|
|
|
5
5
|
* to minimize the effort required to implement this interface.
|
|
6
6
|
*/
|
|
7
7
|
export declare abstract class AbstractSplitsCacheSync implements ISplitsCacheSync {
|
|
8
|
-
abstract addSplit(name: string, split:
|
|
9
|
-
addSplits(entries: [string,
|
|
8
|
+
abstract addSplit(name: string, split: ISplit): boolean;
|
|
9
|
+
addSplits(entries: [string, ISplit][]): boolean[];
|
|
10
10
|
abstract removeSplit(name: string): boolean;
|
|
11
11
|
removeSplits(names: string[]): boolean[];
|
|
12
|
-
abstract getSplit(name: string):
|
|
13
|
-
getSplits(names: string[]): Record<string,
|
|
12
|
+
abstract getSplit(name: string): ISplit | null;
|
|
13
|
+
getSplits(names: string[]): Record<string, ISplit | null>;
|
|
14
14
|
abstract setChangeNumber(changeNumber: number): boolean;
|
|
15
15
|
abstract getChangeNumber(): number;
|
|
16
|
-
getAll():
|
|
16
|
+
getAll(): ISplit[];
|
|
17
17
|
abstract getSplitNames(): string[];
|
|
18
18
|
abstract trafficTypeExists(trafficType: string): boolean;
|
|
19
19
|
abstract usesSegments(): boolean;
|
|
@@ -6,8 +6,6 @@ export declare class KeyBuilderSS extends KeyBuilder {
|
|
|
6
6
|
constructor(prefix: string, metadata: IMetadata);
|
|
7
7
|
buildRegisteredSegmentsKey(): string;
|
|
8
8
|
buildImpressionsKey(): string;
|
|
9
|
-
buildImpressionsCountKey(): string;
|
|
10
|
-
buildUniqueKeysKey(): string;
|
|
11
9
|
buildEventsKey(): string;
|
|
12
10
|
searchPatternForSplitKeys(): string;
|
|
13
11
|
buildLatencyKey(method: Method, bucket: number): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ISplitFiltersValidation } from '../../dtos/types';
|
|
1
|
+
import { ISplit, ISplitFiltersValidation } from '../../dtos/types';
|
|
2
2
|
import { AbstractSplitsCacheSync } from '../AbstractSplitsCacheSync';
|
|
3
3
|
import { KeyBuilderCS } from '../KeyBuilderCS';
|
|
4
4
|
import { ILogger } from '../../logger/types';
|
|
@@ -26,9 +26,9 @@ export declare class SplitsCacheInLocal extends AbstractSplitsCacheSync {
|
|
|
26
26
|
* We cannot simply call `localStorage.clear()` since that implies removing user items from the storage.
|
|
27
27
|
*/
|
|
28
28
|
clear(): void;
|
|
29
|
-
addSplit(name: string, split:
|
|
29
|
+
addSplit(name: string, split: ISplit): boolean;
|
|
30
30
|
removeSplit(name: string): boolean;
|
|
31
|
-
getSplit(name: string):
|
|
31
|
+
getSplit(name: string): any;
|
|
32
32
|
setChangeNumber(changeNumber: number): boolean;
|
|
33
33
|
getChangeNumber(): number;
|
|
34
34
|
getSplitNames(): string[];
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { IImpressionCountsCacheSync } from '../types';
|
|
2
2
|
export declare class ImpressionCountsCacheInMemory implements IImpressionCountsCacheSync {
|
|
3
|
-
|
|
4
|
-
private readonly maxStorage;
|
|
5
|
-
protected onFullQueue?: () => void;
|
|
6
|
-
private cacheSize;
|
|
7
|
-
constructor(impressionCountsCacheSize?: number);
|
|
3
|
+
private cache;
|
|
8
4
|
/**
|
|
9
5
|
* Builds key to be stored in the cache with the featureName and the timeFrame truncated.
|
|
10
6
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ISplit } from '../../dtos/types';
|
|
1
2
|
import { AbstractSplitsCacheSync } from '../AbstractSplitsCacheSync';
|
|
2
3
|
/**
|
|
3
4
|
* Default ISplitsCacheSync implementation that stores split definitions in memory.
|
|
@@ -9,9 +10,9 @@ export declare class SplitsCacheInMemory extends AbstractSplitsCacheSync {
|
|
|
9
10
|
private changeNumber;
|
|
10
11
|
private splitsWithSegmentsCount;
|
|
11
12
|
clear(): void;
|
|
12
|
-
addSplit(name: string, split:
|
|
13
|
+
addSplit(name: string, split: ISplit): boolean;
|
|
13
14
|
removeSplit(name: string): boolean;
|
|
14
|
-
getSplit(name: string):
|
|
15
|
+
getSplit(name: string): ISplit | null;
|
|
15
16
|
setChangeNumber(changeNumber: number): boolean;
|
|
16
17
|
getChangeNumber(): number;
|
|
17
18
|
getSplitNames(): string[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KeyBuilderSS } from '../KeyBuilderSS';
|
|
2
2
|
import { Redis } from 'ioredis';
|
|
3
3
|
import { ILogger } from '../../logger/types';
|
|
4
|
+
import { ISplit } from '../../dtos/types';
|
|
4
5
|
import { AbstractSplitsCacheAsync } from '../AbstractSplitsCacheAsync';
|
|
5
6
|
/**
|
|
6
7
|
* ISplitsCacheAsync implementation that stores split definitions in Redis.
|
|
@@ -19,13 +20,13 @@ export declare class SplitsCacheInRedis extends AbstractSplitsCacheAsync {
|
|
|
19
20
|
* The returned promise is resolved when the operation success
|
|
20
21
|
* or rejected if it fails (e.g., redis operation fails)
|
|
21
22
|
*/
|
|
22
|
-
addSplit(name: string, split:
|
|
23
|
+
addSplit(name: string, split: ISplit): Promise<boolean>;
|
|
23
24
|
/**
|
|
24
25
|
* Add a list of splits.
|
|
25
26
|
* The returned promise is resolved when the operation success
|
|
26
27
|
* or rejected if it fails (e.g., redis operation fails)
|
|
27
28
|
*/
|
|
28
|
-
addSplits(entries: [string,
|
|
29
|
+
addSplits(entries: [string, ISplit][]): Promise<boolean[]>;
|
|
29
30
|
/**
|
|
30
31
|
* Remove a given split.
|
|
31
32
|
* The returned promise is resolved when the operation success, with 1 or 0 indicating if the split existed or not.
|
|
@@ -42,7 +43,7 @@ export declare class SplitsCacheInRedis extends AbstractSplitsCacheAsync {
|
|
|
42
43
|
* Get split definition or null if it's not defined.
|
|
43
44
|
* Returned promise is rejected if redis operation fails.
|
|
44
45
|
*/
|
|
45
|
-
getSplit(name: string): Promise<
|
|
46
|
+
getSplit(name: string): Promise<ISplit | null>;
|
|
46
47
|
/**
|
|
47
48
|
* Set till number.
|
|
48
49
|
* The returned promise is resolved when the operation success,
|
|
@@ -63,7 +64,7 @@ export declare class SplitsCacheInRedis extends AbstractSplitsCacheAsync {
|
|
|
63
64
|
* @TODO we need to benchmark which is the maximun number of commands we could
|
|
64
65
|
* pipeline without kill redis performance.
|
|
65
66
|
*/
|
|
66
|
-
getAll(): Promise<
|
|
67
|
+
getAll(): Promise<ISplit[]>;
|
|
67
68
|
/**
|
|
68
69
|
* Get list of split names.
|
|
69
70
|
* The returned promise is resolved with the list of split names,
|
|
@@ -87,5 +88,5 @@ export declare class SplitsCacheInRedis extends AbstractSplitsCacheAsync {
|
|
|
87
88
|
* Fetches multiple splits definitions.
|
|
88
89
|
* Returned promise is rejected if redis operation fails.
|
|
89
90
|
*/
|
|
90
|
-
getSplits(names: string[]): Promise<Record<string,
|
|
91
|
+
getSplits(names: string[]): Promise<Record<string, ISplit | null>>;
|
|
91
92
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KeyBuilder } from '../KeyBuilder';
|
|
2
2
|
import { IPluggableStorageWrapper } from '../types';
|
|
3
3
|
import { ILogger } from '../../logger/types';
|
|
4
|
+
import { ISplit } from '../../dtos/types';
|
|
4
5
|
import { AbstractSplitsCacheAsync } from '../AbstractSplitsCacheAsync';
|
|
5
6
|
/**
|
|
6
7
|
* ISplitsCacheAsync implementation for pluggable storages.
|
|
@@ -23,13 +24,13 @@ export declare class SplitsCachePluggable extends AbstractSplitsCacheAsync {
|
|
|
23
24
|
* The returned promise is resolved when the operation success
|
|
24
25
|
* or rejected if it fails (e.g., wrapper operation fails)
|
|
25
26
|
*/
|
|
26
|
-
addSplit(name: string, split:
|
|
27
|
+
addSplit(name: string, split: ISplit): Promise<boolean>;
|
|
27
28
|
/**
|
|
28
29
|
* Add a list of splits.
|
|
29
30
|
* The returned promise is resolved when the operation success
|
|
30
31
|
* or rejected if it fails (e.g., wrapper operation fails)
|
|
31
32
|
*/
|
|
32
|
-
addSplits(entries: [string,
|
|
33
|
+
addSplits(entries: [string, ISplit][]): Promise<boolean[]>;
|
|
33
34
|
/**
|
|
34
35
|
* Remove a given split.
|
|
35
36
|
* The returned promise is resolved when the operation success, with a boolean indicating if the split existed or not.
|
|
@@ -47,19 +48,19 @@ export declare class SplitsCachePluggable extends AbstractSplitsCacheAsync {
|
|
|
47
48
|
* The returned promise is resolved with the split definition or null if it's not defined,
|
|
48
49
|
* or rejected if wrapper operation fails.
|
|
49
50
|
*/
|
|
50
|
-
getSplit(name: string): Promise<
|
|
51
|
+
getSplit(name: string): Promise<ISplit | null>;
|
|
51
52
|
/**
|
|
52
53
|
* Get list of splits.
|
|
53
54
|
* The returned promise is resolved with a map of split names to their split definition or null if it's not defined,
|
|
54
55
|
* or rejected if wrapper operation fails.
|
|
55
56
|
*/
|
|
56
|
-
getSplits(names: string[]): Promise<Record<string,
|
|
57
|
+
getSplits(names: string[]): Promise<Record<string, ISplit | null>>;
|
|
57
58
|
/**
|
|
58
59
|
* Get list of all split definitions.
|
|
59
60
|
* The returned promise is resolved with the list of split definitions,
|
|
60
61
|
* or rejected if wrapper operation fails.
|
|
61
62
|
*/
|
|
62
|
-
getAll(): Promise<
|
|
63
|
+
getAll(): Promise<ISplit[]>;
|
|
63
64
|
/**
|
|
64
65
|
* Get list of split names.
|
|
65
66
|
* The returned promise is resolved with the list of split names,
|