@splitsoftware/splitio-commons 0.1.1-canary.9 → 0.1.1-rc.18
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/evaluator/matchers/matcherTypes.js +4 -4
- package/cjs/evaluator/matchersTransform/index.js +11 -11
- package/cjs/evaluator/value/sanitize.js +6 -6
- package/cjs/listeners/browser.js +1 -2
- package/cjs/listeners/node.js +0 -3
- package/cjs/logger/constants.js +3 -1
- package/cjs/logger/messages/error.js +3 -2
- package/cjs/logger/messages/info.js +2 -2
- package/cjs/logger/messages/warn.js +2 -1
- package/cjs/readiness/readinessManager.js +10 -7
- package/cjs/sdkFactory/index.js +1 -4
- package/cjs/services/splitApi.js +1 -1
- package/cjs/services/splitHttpClient.js +5 -4
- package/cjs/storages/AbstractSplitsCacheSync.js +1 -1
- package/cjs/storages/inLocalStorage/index.js +5 -2
- package/cjs/storages/inMemory/InMemoryStorage.js +2 -0
- package/cjs/storages/inMemory/InMemoryStorageCS.js +2 -0
- package/cjs/storages/inRedis/SplitsCacheInRedis.js +6 -2
- package/cjs/storages/inRedis/index.js +5 -2
- package/cjs/storages/pluggable/SplitsCachePluggable.js +6 -2
- package/cjs/storages/pluggable/inMemoryWrapper.js +6 -7
- package/cjs/storages/pluggable/index.js +5 -2
- package/cjs/storages/pluggable/wrapperAdapter.js +0 -1
- package/cjs/sync/offline/splitsParser/splitsParserFromFile.js +92 -89
- package/cjs/sync/offline/splitsParser/splitsParserFromSettings.js +45 -42
- package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +14 -4
- package/cjs/sync/polling/updaters/mySegmentsUpdater.js +30 -10
- package/cjs/sync/streaming/SSEClient/index.js +0 -11
- package/cjs/sync/streaming/SSEHandler/NotificationKeeper.js +7 -0
- package/cjs/sync/streaming/SSEHandler/NotificationParser.js +4 -1
- package/cjs/sync/streaming/SSEHandler/index.js +8 -9
- package/cjs/sync/streaming/SSEHandler/types.js +14 -0
- package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +5 -5
- package/cjs/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +2 -1
- package/cjs/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +5 -3
- package/cjs/sync/streaming/constants.js +3 -1
- package/cjs/sync/streaming/mySegmentsV2utils.js +75 -0
- package/cjs/sync/streaming/pushManager.js +141 -40
- package/cjs/sync/submitters/metricsSyncTask.js +1 -1
- package/cjs/sync/submitters/submitterSyncTask.js +2 -2
- package/cjs/sync/syncManagerFromFile.js +15 -0
- package/cjs/sync/syncManagerFromObject.js +14 -0
- package/cjs/sync/syncManagerOffline.js +3 -3
- package/cjs/sync/syncManagerOnline.js +5 -3
- package/cjs/trackers/impressionObserver/ImpressionObserver.js +0 -2
- package/cjs/trackers/impressionObserver/buildKey.js +3 -9
- package/cjs/trackers/impressionObserver/impressionObserverCS.js +2 -2
- package/cjs/trackers/impressionObserver/impressionObserverSS.js +3 -3
- package/cjs/utils/constants/index.js +4 -1
- package/cjs/utils/decompress/index.js +427 -0
- package/cjs/utils/murmur3/{commons.js → common.js} +2 -6
- package/cjs/utils/murmur3/murmur3.js +11 -12
- package/cjs/utils/murmur3/murmur3_128.js +7 -142
- package/cjs/utils/murmur3/murmur3_128_x86.js +154 -0
- package/cjs/utils/murmur3/murmur3_64.js +36 -0
- package/cjs/utils/murmur3/utfx.js +100 -106
- package/cjs/utils/promise/wrapper.js +14 -11
- package/cjs/utils/settingsValidation/index.js +5 -2
- package/cjs/utils/settingsValidation/localhost/index.js +20 -0
- package/cjs/utils/settingsValidation/splitFilters.js +0 -1
- package/cjs/utils/settingsValidation/storage/storageCS.js +18 -8
- package/cjs/utils/settingsValidation/url.js +1 -1
- package/esm/evaluator/matchers/matcherTypes.js +2 -2
- package/esm/evaluator/matchersTransform/index.js +12 -12
- package/esm/evaluator/value/sanitize.js +7 -7
- package/esm/listeners/browser.js +1 -2
- package/esm/listeners/node.js +0 -3
- package/esm/logger/constants.js +2 -0
- package/esm/logger/messages/error.js +3 -2
- package/esm/logger/messages/info.js +2 -2
- package/esm/logger/messages/warn.js +2 -1
- package/esm/readiness/readinessManager.js +10 -7
- package/esm/sdkFactory/index.js +1 -4
- package/esm/services/splitApi.js +1 -1
- package/esm/services/splitHttpClient.js +5 -4
- package/esm/storages/AbstractSplitsCacheSync.js +1 -1
- package/esm/storages/inLocalStorage/index.js +5 -2
- package/esm/storages/inMemory/InMemoryStorage.js +2 -0
- package/esm/storages/inMemory/InMemoryStorageCS.js +2 -0
- package/esm/storages/inRedis/SplitsCacheInRedis.js +6 -2
- package/esm/storages/inRedis/index.js +5 -2
- package/esm/storages/pluggable/SplitsCachePluggable.js +6 -2
- package/esm/storages/pluggable/inMemoryWrapper.js +6 -7
- package/esm/storages/pluggable/index.js +5 -2
- package/esm/storages/pluggable/wrapperAdapter.js +0 -1
- package/esm/sync/offline/splitsParser/splitsParserFromFile.js +90 -88
- package/esm/sync/offline/splitsParser/splitsParserFromSettings.js +43 -41
- package/esm/sync/offline/syncTasks/fromObjectSyncTask.js +15 -5
- package/esm/sync/polling/updaters/mySegmentsUpdater.js +30 -10
- package/esm/sync/streaming/SSEClient/index.js +0 -11
- package/esm/sync/streaming/SSEHandler/NotificationKeeper.js +7 -0
- package/esm/sync/streaming/SSEHandler/NotificationParser.js +4 -1
- package/esm/sync/streaming/SSEHandler/index.js +9 -10
- package/esm/sync/streaming/SSEHandler/types.js +13 -1
- package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +5 -5
- package/esm/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +2 -1
- package/esm/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +5 -3
- package/esm/sync/streaming/constants.js +2 -0
- package/esm/sync/streaming/mySegmentsV2utils.js +69 -0
- package/esm/sync/streaming/pushManager.js +143 -42
- package/esm/sync/submitters/metricsSyncTask.js +1 -1
- package/esm/sync/submitters/submitterSyncTask.js +2 -2
- package/esm/sync/syncManagerFromFile.js +11 -0
- package/esm/sync/syncManagerFromObject.js +10 -0
- package/esm/sync/syncManagerOffline.js +3 -3
- package/esm/sync/syncManagerOnline.js +5 -3
- package/esm/trackers/impressionObserver/ImpressionObserver.js +0 -2
- package/esm/trackers/impressionObserver/buildKey.js +2 -9
- package/esm/trackers/impressionObserver/impressionObserverCS.js +2 -2
- package/esm/trackers/impressionObserver/impressionObserverSS.js +3 -3
- package/esm/utils/constants/index.js +3 -0
- package/esm/utils/decompress/index.js +424 -0
- package/esm/utils/murmur3/{commons.js → common.js} +1 -4
- package/esm/utils/murmur3/murmur3.js +1 -2
- package/esm/utils/murmur3/murmur3_128.js +7 -142
- package/esm/utils/murmur3/murmur3_128_x86.js +150 -0
- package/esm/utils/murmur3/murmur3_64.js +32 -0
- package/esm/utils/murmur3/utfx.js +96 -106
- package/esm/utils/promise/wrapper.js +14 -11
- package/esm/utils/settingsValidation/index.js +5 -2
- package/esm/utils/settingsValidation/localhost/index.js +16 -0
- package/esm/utils/settingsValidation/splitFilters.js +0 -1
- package/esm/utils/settingsValidation/storage/storageCS.js +16 -7
- package/esm/utils/settingsValidation/url.js +1 -1
- package/package.json +5 -5
- package/src/evaluator/matchers/matcherTypes.ts +2 -2
- package/src/evaluator/matchersTransform/index.ts +12 -12
- package/src/evaluator/value/sanitize.ts +7 -7
- package/src/listeners/browser.ts +1 -1
- package/src/listeners/node.ts +1 -2
- package/src/logger/constants.ts +2 -0
- package/src/logger/messages/error.ts +3 -2
- package/src/logger/messages/info.ts +2 -2
- package/src/logger/messages/warn.ts +3 -1
- package/src/readiness/readinessManager.ts +9 -7
- package/src/sdkFactory/index.ts +1 -3
- package/src/sdkFactory/types.ts +3 -3
- package/src/services/splitApi.ts +2 -3
- package/src/services/splitHttpClient.ts +6 -5
- package/src/services/types.ts +5 -5
- package/src/storages/AbstractSplitsCacheSync.ts +1 -1
- package/src/storages/inLocalStorage/index.ts +8 -4
- package/src/storages/inMemory/InMemoryStorage.ts +3 -0
- package/src/storages/inMemory/InMemoryStorageCS.ts +3 -0
- package/src/storages/inRedis/SplitsCacheInRedis.ts +3 -1
- package/src/storages/inRedis/index.ts +8 -4
- package/src/storages/pluggable/SplitsCachePluggable.ts +3 -1
- package/src/storages/pluggable/inMemoryWrapper.ts +6 -7
- package/src/storages/pluggable/index.ts +8 -4
- package/src/storages/pluggable/wrapperAdapter.ts +0 -1
- package/src/storages/types.ts +18 -15
- package/src/sync/offline/splitsParser/splitsParserFromFile.ts +110 -105
- package/src/sync/offline/splitsParser/splitsParserFromSettings.ts +45 -41
- package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +15 -5
- package/src/sync/polling/types.ts +2 -1
- package/src/sync/polling/updaters/mySegmentsUpdater.ts +28 -10
- package/src/sync/streaming/AuthClient/types.ts +3 -0
- package/src/sync/streaming/SSEClient/index.ts +1 -15
- package/src/sync/streaming/SSEClient/types.ts +0 -1
- package/src/sync/streaming/SSEHandler/NotificationKeeper.ts +8 -0
- package/src/sync/streaming/SSEHandler/NotificationParser.ts +4 -2
- package/src/sync/streaming/SSEHandler/index.ts +11 -20
- package/src/sync/streaming/SSEHandler/types.ts +37 -3
- package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +7 -6
- package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +2 -1
- package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +4 -3
- package/src/sync/streaming/UpdateWorkers/types.ts +1 -1
- package/src/sync/streaming/constants.ts +2 -0
- package/src/sync/streaming/mySegmentsV2utils.ts +77 -0
- package/src/sync/streaming/pushManager.ts +139 -42
- package/src/sync/streaming/types.ts +14 -22
- package/src/sync/submitters/metricsSyncTask.ts +1 -1
- package/src/sync/submitters/submitterSyncTask.ts +2 -1
- package/src/sync/syncManagerFromFile.ts +13 -0
- package/src/sync/syncManagerFromObject.ts +12 -0
- package/src/sync/syncManagerOffline.ts +3 -3
- package/src/sync/syncManagerOnline.ts +6 -3
- package/src/trackers/impressionObserver/ImpressionObserver.ts +4 -6
- package/src/trackers/impressionObserver/buildKey.ts +2 -16
- package/src/trackers/impressionObserver/impressionObserverCS.ts +2 -2
- package/src/trackers/impressionObserver/impressionObserverSS.ts +3 -3
- package/src/types.ts +16 -2
- package/src/utils/constants/index.ts +6 -1
- package/src/utils/decompress/index.ts +429 -0
- package/src/utils/murmur3/{commons.ts → common.ts} +1 -5
- package/src/utils/murmur3/murmur3.ts +5 -5
- package/src/utils/murmur3/murmur3_128.ts +7 -180
- package/src/utils/murmur3/murmur3_128_x86.ts +188 -0
- package/src/utils/murmur3/murmur3_64.ts +36 -0
- package/src/utils/murmur3/utfx.ts +92 -110
- package/src/utils/promise/wrapper.ts +12 -9
- package/src/utils/settingsValidation/index.ts +8 -4
- package/src/utils/settingsValidation/localhost/index.ts +19 -0
- package/src/utils/settingsValidation/splitFilters.ts +0 -1
- package/src/utils/settingsValidation/storage/storageCS.ts +21 -8
- package/src/utils/settingsValidation/types.ts +2 -11
- package/src/utils/settingsValidation/url.ts +1 -1
- package/types/evaluator/matchers/matcherTypes.d.ts +2 -2
- package/types/listeners/browser.d.ts +1 -0
- package/types/listeners/node.d.ts +0 -1
- package/types/logger/constants.d.ts +2 -0
- package/types/sdkFactory/types.d.ts +3 -3
- package/types/services/types.d.ts +1 -0
- package/types/storages/inLocalStorage/index.d.ts +2 -2
- package/types/storages/inMemory/InMemoryStorage.d.ts +3 -0
- package/types/storages/inMemory/InMemoryStorageCS.d.ts +3 -0
- package/types/storages/inRedis/index.d.ts +2 -2
- package/types/storages/pluggable/index.d.ts +2 -2
- package/types/storages/types.d.ts +15 -15
- package/types/sync/offline/splitsParser/splitsParserFromFile.d.ts +2 -7
- package/types/sync/offline/splitsParser/splitsParserFromSettings.d.ts +1 -5
- package/types/sync/polling/types.d.ts +2 -1
- package/types/sync/streaming/AuthClient/indexV1.d.ts +12 -0
- package/types/sync/streaming/AuthClient/indexV2.d.ts +8 -0
- package/types/sync/streaming/AuthClient/types.d.ts +2 -0
- package/types/sync/streaming/SSEClient/index.d.ts +1 -9
- package/types/sync/streaming/SSEClient/types.d.ts +0 -1
- package/types/sync/streaming/SSEHandler/NotificationParser.d.ts +3 -2
- package/types/sync/streaming/SSEHandler/types.d.ts +30 -2
- package/types/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.d.ts +4 -3
- package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +2 -1
- package/types/sync/streaming/UpdateWorkers/SplitsUpdateWorker.d.ts +3 -2
- package/types/sync/streaming/UpdateWorkers/types.d.ts +1 -1
- package/types/sync/streaming/constants.d.ts +3 -1
- package/types/sync/streaming/mySegmentsV2utils.d.ts +27 -0
- package/types/sync/streaming/pushManagerNoUsers.d.ts +13 -0
- package/types/sync/streaming/types.d.ts +9 -5
- package/types/sync/submitters/submitterSyncTask.d.ts +1 -1
- package/types/sync/syncManagerFromFile.d.ts +2 -0
- package/types/sync/syncManagerFromObject.d.ts +2 -0
- package/types/sync/syncManagerOffline.d.ts +1 -1
- package/types/trackers/impressionObserver/ImpressionObserver.d.ts +2 -2
- package/types/trackers/impressionObserver/buildKey.d.ts +1 -1
- package/types/trackers/impressionObserver/impressionObserverCS.d.ts +2 -2
- package/types/trackers/impressionObserver/impressionObserverSS.d.ts +2 -2
- package/types/types.d.ts +16 -2
- package/types/utils/constants/index.d.ts +5 -1
- package/types/utils/decompress/index.d.ts +16 -0
- package/types/utils/murmur3/common.d.ts +12 -0
- package/types/utils/murmur3/murmur3.d.ts +2 -2
- package/types/utils/murmur3/murmur3_128.d.ts +5 -0
- package/types/utils/murmur3/murmur3_128_x86.d.ts +7 -0
- package/types/utils/murmur3/murmur3_64.d.ts +10 -0
- package/types/utils/murmur3/utfx.d.ts +24 -6
- package/types/utils/settingsValidation/index.d.ts +3 -2
- package/types/utils/settingsValidation/localhost/index.d.ts +9 -0
- package/types/utils/settingsValidation/storage/storageCS.d.ts +7 -1
- package/types/utils/settingsValidation/types.d.ts +2 -10
- package/cjs/sync/streaming/pushManagerCS.js +0 -179
- package/cjs/sync/streaming/pushManagerSS.js +0 -128
- package/esm/sync/streaming/pushManagerCS.js +0 -175
- package/esm/sync/streaming/pushManagerSS.js +0 -124
- package/src/sync/streaming/pushManagerCS.ts +0 -238
- package/src/sync/streaming/pushManagerSS.ts +0 -177
|
@@ -91,6 +91,7 @@ export declare const WARN_SPLITS_FILTER_INVALID = 220;
|
|
|
91
91
|
export declare const WARN_SPLITS_FILTER_EMPTY = 221;
|
|
92
92
|
export declare const WARN_STORAGE_INVALID = 222;
|
|
93
93
|
export declare const WARN_API_KEY = 223;
|
|
94
|
+
export declare const STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2 = 224;
|
|
94
95
|
export declare const ERROR_ENGINE_COMBINER_IFELSEIF = 300;
|
|
95
96
|
export declare const ERROR_LOGLEVEL_INVALID = 301;
|
|
96
97
|
export declare const ERROR_CLIENT_LISTENER = 302;
|
|
@@ -114,6 +115,7 @@ export declare const ERROR_EMPTY = 319;
|
|
|
114
115
|
export declare const ERROR_EMPTY_ARRAY = 320;
|
|
115
116
|
export declare const ERROR_INVALID_IMPRESSIONS_MODE = 321;
|
|
116
117
|
export declare const ERROR_HTTP = 322;
|
|
118
|
+
export declare const ERROR_LOCALHOST_MODULE_REQUIRED = 323;
|
|
117
119
|
export declare const LOG_PREFIX_SETTINGS = "settings";
|
|
118
120
|
export declare const LOG_PREFIX_INSTANTIATION = "Factory instantiation";
|
|
119
121
|
export declare const LOG_PREFIX_ENGINE = "engine";
|
|
@@ -8,9 +8,9 @@ import { IStorageAsync, IStorageSync, ISplitsCacheSync, ISplitsCacheAsync, IStor
|
|
|
8
8
|
import { ISyncManager, ISyncManagerFactoryParams } from '../sync/types';
|
|
9
9
|
import { IImpressionObserver } from '../trackers/impressionObserver/types';
|
|
10
10
|
import { SplitIO, ISettings, IEventEmitter } from '../types';
|
|
11
|
-
import { ISettingsInternal } from '../utils/settingsValidation/types';
|
|
12
11
|
/**
|
|
13
|
-
* Environment related dependencies
|
|
12
|
+
* Environment related dependencies.
|
|
13
|
+
* These getters are called a fixed number of times per factory instantiation.
|
|
14
14
|
*/
|
|
15
15
|
export interface IPlatform {
|
|
16
16
|
getOptions?: () => object;
|
|
@@ -22,7 +22,7 @@ export interface IPlatform {
|
|
|
22
22
|
* Object parameter with the modules required to create an SDK factory instance
|
|
23
23
|
*/
|
|
24
24
|
export interface ISdkFactoryParams {
|
|
25
|
-
settings:
|
|
25
|
+
settings: ISettings;
|
|
26
26
|
platform: IPlatform;
|
|
27
27
|
storageFactory: (params: IStorageFactoryParams) => IStorageSync | IStorageAsync;
|
|
28
28
|
splitApiFactory?: (settings: ISettings, platform: IPlatform) => ISplitApi;
|
|
@@ -7,6 +7,7 @@ export declare type IResponse = {
|
|
|
7
7
|
ok: boolean;
|
|
8
8
|
status: number;
|
|
9
9
|
json: () => Promise<any>;
|
|
10
|
+
text: () => Promise<string>;
|
|
10
11
|
};
|
|
11
12
|
export declare type IFetch = (url: string, options?: IRequestOptions) => Promise<IResponse>;
|
|
12
13
|
export declare type IHealthCheckAPI = () => Promise<boolean>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IStorageSyncFactory } from '../types';
|
|
2
2
|
export interface InLocalStorageOptions {
|
|
3
3
|
prefix?: string;
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
6
|
* InLocal storage factory for standalone client-side SplitFactory
|
|
7
7
|
*/
|
|
8
|
-
export declare function InLocalStorage(options?: InLocalStorageOptions):
|
|
8
|
+
export declare function InLocalStorage(options?: InLocalStorageOptions): IStorageSyncFactory;
|
|
@@ -5,3 +5,6 @@ import { IStorageFactoryParams, IStorageSync } from '../types';
|
|
|
5
5
|
* @param params parameters required by EventsCacheSync
|
|
6
6
|
*/
|
|
7
7
|
export declare function InMemoryStorageFactory(params: IStorageFactoryParams): IStorageSync;
|
|
8
|
+
export declare namespace InMemoryStorageFactory {
|
|
9
|
+
var type: import("../types").StorageType;
|
|
10
|
+
}
|
|
@@ -5,3 +5,6 @@ import { IStorageSyncCS, IStorageFactoryParams } from '../types';
|
|
|
5
5
|
* @param params parameters required by EventsCacheSync
|
|
6
6
|
*/
|
|
7
7
|
export declare function InMemoryStorageCSFactory(params: IStorageFactoryParams): IStorageSyncCS;
|
|
8
|
+
export declare namespace InMemoryStorageCSFactory {
|
|
9
|
+
var type: import("../types").StorageType;
|
|
10
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IStorageAsyncFactory } from '../types';
|
|
2
2
|
export interface InRedisStorageOptions {
|
|
3
3
|
prefix?: string;
|
|
4
4
|
options?: Record<string, any>;
|
|
@@ -7,4 +7,4 @@ export interface InRedisStorageOptions {
|
|
|
7
7
|
* InRedis storage factory for consumer server-side SplitFactory, that uses `Ioredis` Redis client for Node.
|
|
8
8
|
* @see {@link https://www.npmjs.com/package/ioredis}
|
|
9
9
|
*/
|
|
10
|
-
export declare function InRedisStorage(options?: InRedisStorageOptions):
|
|
10
|
+
export declare function InRedisStorage(options?: InRedisStorageOptions): IStorageAsyncFactory;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICustomStorageWrapper,
|
|
1
|
+
import { ICustomStorageWrapper, IStorageAsyncFactory } from '../types';
|
|
2
2
|
export interface PluggableStorageOptions {
|
|
3
3
|
prefix?: string;
|
|
4
4
|
wrapper: ICustomStorageWrapper;
|
|
@@ -6,4 +6,4 @@ export interface PluggableStorageOptions {
|
|
|
6
6
|
/**
|
|
7
7
|
* Pluggable storage factory for consumer server-side & client-side SplitFactory.
|
|
8
8
|
*/
|
|
9
|
-
export declare function PluggableStorage(options: PluggableStorageOptions):
|
|
9
|
+
export declare function PluggableStorage(options: PluggableStorageOptions): IStorageAsyncFactory;
|
|
@@ -54,15 +54,6 @@ export interface ICustomStorageWrapper {
|
|
|
54
54
|
* The promise rejects if the operation fails.
|
|
55
55
|
*/
|
|
56
56
|
getKeysByPrefix: (prefix: string) => Promise<string[]>;
|
|
57
|
-
/**
|
|
58
|
-
* Returns all values which keys match the given prefix.
|
|
59
|
-
*
|
|
60
|
-
* @function getByPrefix
|
|
61
|
-
* @param {string} prefix String prefix to match
|
|
62
|
-
* @returns {Promise<string[]>} A promise that resolves with the list of values which keys match the given `prefix`.
|
|
63
|
-
* The promise rejects if the operation fails.
|
|
64
|
-
*/
|
|
65
|
-
getByPrefix: (prefix: string) => Promise<string[]>;
|
|
66
57
|
/**
|
|
67
58
|
* Returns the values of all given `keys`.
|
|
68
59
|
*
|
|
@@ -78,19 +69,19 @@ export interface ICustomStorageWrapper {
|
|
|
78
69
|
*
|
|
79
70
|
* @function incr
|
|
80
71
|
* @param {string} key Key to increment
|
|
81
|
-
* @returns {Promise<
|
|
72
|
+
* @returns {Promise<number>} A promise that resolves with the value of key after the increment. The promise rejects if the operation fails,
|
|
82
73
|
* for example, if there is a connection error or the key contains a string that can not be represented as integer.
|
|
83
74
|
*/
|
|
84
|
-
incr: (key: string) => Promise<
|
|
75
|
+
incr: (key: string) => Promise<number>;
|
|
85
76
|
/**
|
|
86
77
|
* Decrements in 1 the given `key` value or set it in -1 if the value doesn't exist.
|
|
87
78
|
*
|
|
88
79
|
* @function decr
|
|
89
80
|
* @param {string} key Key to decrement
|
|
90
|
-
* @returns {Promise<
|
|
81
|
+
* @returns {Promise<number>} A promise that resolves with the value of key after the decrement. The promise rejects if the operation fails,
|
|
91
82
|
* for example, if there is a connection error or the key contains a string that can not be represented as integer.
|
|
92
83
|
*/
|
|
93
|
-
decr: (key: string) => Promise<
|
|
84
|
+
decr: (key: string) => Promise<number>;
|
|
94
85
|
/** Queue operations */
|
|
95
86
|
/**
|
|
96
87
|
* Inserts given items at the tail of `key` list. If `key` does not exist, an empty list is created before pushing the items.
|
|
@@ -243,8 +234,8 @@ export interface ISegmentsCacheBase {
|
|
|
243
234
|
clear(): MaybeThenable<boolean | void>;
|
|
244
235
|
}
|
|
245
236
|
export interface ISegmentsCacheSync extends ISegmentsCacheBase {
|
|
246
|
-
addToSegment(name: string, segmentKeys
|
|
247
|
-
removeFromSegment(name: string, segmentKeys
|
|
237
|
+
addToSegment(name: string, segmentKeys?: string[]): boolean;
|
|
238
|
+
removeFromSegment(name: string, segmentKeys?: string[]): boolean;
|
|
248
239
|
isInSegment(name: string, key?: string): boolean;
|
|
249
240
|
registerSegments(names: string[]): boolean;
|
|
250
241
|
getRegisteredSegments(): string[];
|
|
@@ -353,3 +344,12 @@ export interface IStorageFactoryParams {
|
|
|
353
344
|
onReadyCb?: (error?: any) => void;
|
|
354
345
|
metadata: IMetadata;
|
|
355
346
|
}
|
|
347
|
+
export declare type StorageType = 'MEMORY' | 'LOCALSTORAGE' | 'REDIS' | 'CUSTOM';
|
|
348
|
+
export declare type IStorageSyncFactory = {
|
|
349
|
+
type: StorageType;
|
|
350
|
+
(params: IStorageFactoryParams): IStorageSync;
|
|
351
|
+
};
|
|
352
|
+
export declare type IStorageAsyncFactory = {
|
|
353
|
+
type: StorageType;
|
|
354
|
+
(params: IStorageFactoryParams): IStorageAsync;
|
|
355
|
+
};
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { ILogger } from '../../../logger/types';
|
|
4
|
-
export default function splitsParserFromFile({ features, log }: {
|
|
5
|
-
features?: SplitIO.MockedFeaturesFilePath;
|
|
6
|
-
log: ILogger;
|
|
7
|
-
}): false | Record<string, ISplitPartial>;
|
|
1
|
+
import { ISplitsParser } from './types';
|
|
2
|
+
export declare function splitsParserFromFileFactory(): ISplitsParser;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import { ISplitPartial } from '../../../dtos/types';
|
|
2
2
|
import { ISettings } from '../../../types';
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* @param features validated object with mocked features mapping.
|
|
6
|
-
*/
|
|
7
|
-
export default function splitsParserFromSettings(settings: ISettings): false | Record<string, ISplitPartial>;
|
|
3
|
+
export declare function splitsParserFromSettingsFactory(): (settings: ISettings) => false | Record<string, ISplitPartial>;
|
|
@@ -2,10 +2,11 @@ import { IReadinessManager } from '../../readiness/types';
|
|
|
2
2
|
import { ISplitApi } from '../../services/types';
|
|
3
3
|
import { IStorageSync } from '../../storages/types';
|
|
4
4
|
import { ISettings } from '../../types';
|
|
5
|
+
import { SegmentsData } from '../streaming/SSEHandler/types';
|
|
5
6
|
import { ITask, ISyncTask } from '../types';
|
|
6
7
|
export interface ISplitsSyncTask extends ISyncTask<[noCache?: boolean], boolean> {
|
|
7
8
|
}
|
|
8
|
-
export interface ISegmentsSyncTask extends ISyncTask<[segmentNames?:
|
|
9
|
+
export interface ISegmentsSyncTask extends ISyncTask<[segmentNames?: SegmentsData, noCache?: boolean, fetchOnlyNew?: boolean], boolean> {
|
|
9
10
|
}
|
|
10
11
|
export interface IPollingManager extends ITask {
|
|
11
12
|
syncAll(): Promise<any>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IFetchAuth } from '../../../services/types';
|
|
2
|
+
import { IAuthenticate } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Factory of authentication function.
|
|
5
|
+
*
|
|
6
|
+
* @param fetchAuth `SplitAPI.fetchAuth` endpoint
|
|
7
|
+
*/
|
|
8
|
+
export declare function authenticateFactory(fetchAuth: IFetchAuth): IAuthenticate;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the hash of a given user key
|
|
11
|
+
*/
|
|
12
|
+
export declare function hashUserKey(userKey: string): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IFetchAuthV2 } from '../../../services/types';
|
|
2
|
+
import { IAuthenticateV2 } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Factory of authentication function.
|
|
5
|
+
*
|
|
6
|
+
* @param fetchAuth `SplitAPI.fetchAuth` endpoint
|
|
7
|
+
*/
|
|
8
|
+
export declare function authenticateFactory(fetchAuthV2: IFetchAuthV2): IAuthenticateV2;
|
|
@@ -6,6 +6,7 @@ export interface IAuthTokenPushEnabled {
|
|
|
6
6
|
channels: {
|
|
7
7
|
[channel: string]: string[];
|
|
8
8
|
};
|
|
9
|
+
connDelay?: number;
|
|
9
10
|
}
|
|
10
11
|
export interface IAuthTokenPushDisabled {
|
|
11
12
|
pushEnabled: false;
|
|
@@ -13,3 +14,4 @@ export interface IAuthTokenPushDisabled {
|
|
|
13
14
|
}
|
|
14
15
|
export declare type IAuthToken = IAuthTokenPushDisabled | IAuthTokenPushEnabled;
|
|
15
16
|
export declare type IAuthenticate = (userKeys?: string[]) => Promise<IAuthToken>;
|
|
17
|
+
export declare type IAuthenticateV2 = (isClientSide?: boolean) => Promise<IAuthToken>;
|
|
@@ -9,7 +9,6 @@ export default class SSEClient implements ISSEClient {
|
|
|
9
9
|
streamingUrl: string;
|
|
10
10
|
connection?: InstanceType<typeof EventSource>;
|
|
11
11
|
handler?: ISseEventHandler;
|
|
12
|
-
authToken?: IAuthTokenPushEnabled;
|
|
13
12
|
useHeaders?: boolean;
|
|
14
13
|
headers: Record<string, string>;
|
|
15
14
|
/**
|
|
@@ -20,7 +19,7 @@ export default class SSEClient implements ISSEClient {
|
|
|
20
19
|
* @param getEventSource Function to get the EventSource constructor.
|
|
21
20
|
* @throws 'EventSource API is not available. ' if EventSource is not available.
|
|
22
21
|
*/
|
|
23
|
-
constructor(settings: ISettings, useHeaders?: boolean, getEventSource?: () => typeof EventSource | undefined);
|
|
22
|
+
constructor(settings: ISettings, useHeaders?: boolean, getEventSource?: () => (typeof EventSource | undefined));
|
|
24
23
|
setEventHandler(handler: ISseEventHandler): void;
|
|
25
24
|
/**
|
|
26
25
|
* Open the connection with a given authToken
|
|
@@ -31,11 +30,4 @@ export default class SSEClient implements ISSEClient {
|
|
|
31
30
|
open(authToken: IAuthTokenPushEnabled): void;
|
|
32
31
|
/** Close connection */
|
|
33
32
|
close(): void;
|
|
34
|
-
/**
|
|
35
|
-
* Re-open the connection with the last given authToken.
|
|
36
|
-
*
|
|
37
|
-
* @throws {TypeError} if `open` has not been previously called with an authToken
|
|
38
|
-
* @TODO this method is not used currently and could be removed.
|
|
39
|
-
*/
|
|
40
|
-
reopen(): void;
|
|
41
33
|
}
|
|
@@ -13,7 +13,8 @@ export declare function errorParser(error: Event): INotificationError;
|
|
|
13
13
|
* Also assigns the type OCCUPANCY, if it corresponds, so that all supported messages (e.g., SPLIT_UPDATE, CONTROL) have a type.
|
|
14
14
|
*
|
|
15
15
|
* @param message
|
|
16
|
-
* @returns parsed notification message
|
|
16
|
+
* @returns parsed notification message or undefined if the given event data is falsy (e.g, '' or undefined).
|
|
17
|
+
* For example, the EventSource implementation of React-Native for iOS emits a message event with empty data for Ably keepalive comments.
|
|
17
18
|
* @throws {SyntaxError} if `message.data` or `JSON.parse(message.data).data` are invalid JSON strings
|
|
18
19
|
*/
|
|
19
|
-
export declare function messageParser(message: MessageEvent): INotificationMessage;
|
|
20
|
+
export declare function messageParser(message: MessageEvent): INotificationMessage | undefined;
|
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
import { ControlType } from '../constants';
|
|
2
|
-
import { MY_SEGMENTS_UPDATE, SEGMENT_UPDATE, SPLIT_UPDATE, SPLIT_KILL, CONTROL, OCCUPANCY } from '../types';
|
|
2
|
+
import { MY_SEGMENTS_UPDATE, MY_SEGMENTS_UPDATE_V2, SEGMENT_UPDATE, SPLIT_UPDATE, SPLIT_KILL, CONTROL, OCCUPANCY } from '../types';
|
|
3
3
|
export interface IMySegmentsUpdateData {
|
|
4
4
|
type: MY_SEGMENTS_UPDATE;
|
|
5
5
|
changeNumber: number;
|
|
6
6
|
includesPayload: boolean;
|
|
7
7
|
segmentList?: string[];
|
|
8
8
|
}
|
|
9
|
+
export declare enum Compression {
|
|
10
|
+
None = 0,
|
|
11
|
+
Gzip = 1,
|
|
12
|
+
Zlib = 2
|
|
13
|
+
}
|
|
14
|
+
export declare enum UpdateStrategy {
|
|
15
|
+
UnboundedFetchRequest = 0,
|
|
16
|
+
BoundedFetchRequest = 1,
|
|
17
|
+
KeyList = 2,
|
|
18
|
+
SegmentRemoval = 3
|
|
19
|
+
}
|
|
20
|
+
export interface KeyList {
|
|
21
|
+
a?: string[];
|
|
22
|
+
r?: string[];
|
|
23
|
+
}
|
|
24
|
+
export interface IMySegmentsUpdateV2Data {
|
|
25
|
+
type: MY_SEGMENTS_UPDATE_V2;
|
|
26
|
+
changeNumber: number;
|
|
27
|
+
segmentName: string;
|
|
28
|
+
c: Compression;
|
|
29
|
+
d: string;
|
|
30
|
+
u: UpdateStrategy;
|
|
31
|
+
}
|
|
9
32
|
export interface ISegmentUpdateData {
|
|
10
33
|
type: SEGMENT_UPDATE;
|
|
11
34
|
changeNumber: number;
|
|
@@ -31,7 +54,7 @@ export interface IOccupancyData {
|
|
|
31
54
|
publishers: number;
|
|
32
55
|
};
|
|
33
56
|
}
|
|
34
|
-
export declare type INotificationData = IMySegmentsUpdateData | ISegmentUpdateData | ISplitUpdateData | ISplitKillData | IControlData | IOccupancyData;
|
|
57
|
+
export declare type INotificationData = IMySegmentsUpdateData | IMySegmentsUpdateV2Data | ISegmentUpdateData | ISplitUpdateData | ISplitKillData | IControlData | IOccupancyData;
|
|
35
58
|
export declare type INotificationMessage = {
|
|
36
59
|
parsedData: INotificationData;
|
|
37
60
|
channel: string;
|
|
@@ -40,4 +63,9 @@ export declare type INotificationMessage = {
|
|
|
40
63
|
};
|
|
41
64
|
export declare type INotificationError = Event & {
|
|
42
65
|
parsedData?: any;
|
|
66
|
+
message?: string;
|
|
67
|
+
};
|
|
68
|
+
export declare type SegmentsData = string[] | {
|
|
69
|
+
name: string;
|
|
70
|
+
add: boolean;
|
|
43
71
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ISegmentsSyncTask } from '../../polling/types';
|
|
2
2
|
import Backoff from '../../../utils/Backoff';
|
|
3
3
|
import { IUpdateWorker } from './types';
|
|
4
|
+
import { SegmentsData } from '../SSEHandler/types';
|
|
4
5
|
/**
|
|
5
6
|
* MySegmentsUpdateWorker class
|
|
6
7
|
*/
|
|
@@ -8,7 +9,7 @@ export default class MySegmentsUpdateWorker implements IUpdateWorker {
|
|
|
8
9
|
private readonly mySegmentsSyncTask;
|
|
9
10
|
private maxChangeNumber;
|
|
10
11
|
private handleNewEvent;
|
|
11
|
-
private
|
|
12
|
+
private segmentsData?;
|
|
12
13
|
private currentChangeNumber;
|
|
13
14
|
readonly backoff: Backoff;
|
|
14
15
|
/**
|
|
@@ -20,7 +21,7 @@ export default class MySegmentsUpdateWorker implements IUpdateWorker {
|
|
|
20
21
|
* Invoked by NotificationProcessor on MY_SEGMENTS_UPDATE event
|
|
21
22
|
*
|
|
22
23
|
* @param {number} changeNumber change number of the MY_SEGMENTS_UPDATE notification
|
|
23
|
-
* @param {
|
|
24
|
+
* @param {SegmentsData | undefined} segmentsData might be undefined
|
|
24
25
|
*/
|
|
25
|
-
put(changeNumber: number,
|
|
26
|
+
put(changeNumber: number, segmentsData?: SegmentsData): void;
|
|
26
27
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ISegmentsCacheSync } from '../../../storages/types';
|
|
2
2
|
import Backoff from '../../../utils/Backoff';
|
|
3
3
|
import { ISegmentsSyncTask } from '../../polling/types';
|
|
4
|
+
import { ISegmentUpdateData } from '../SSEHandler/types';
|
|
4
5
|
import { IUpdateWorker } from './types';
|
|
5
6
|
/**
|
|
6
7
|
* SegmentUpdateWorker class
|
|
@@ -23,5 +24,5 @@ export default class SegmentsUpdateWorker implements IUpdateWorker {
|
|
|
23
24
|
* @param {number} changeNumber change number of the SEGMENT_UPDATE notification
|
|
24
25
|
* @param {string} segmentName segment name of the SEGMENT_UPDATE notification
|
|
25
26
|
*/
|
|
26
|
-
put(changeNumber
|
|
27
|
+
put({ changeNumber, segmentName }: ISegmentUpdateData): void;
|
|
27
28
|
}
|
|
@@ -2,6 +2,7 @@ import { ISplitsEventEmitter } from '../../../readiness/types';
|
|
|
2
2
|
import { ISplitsCacheSync } from '../../../storages/types';
|
|
3
3
|
import Backoff from '../../../utils/Backoff';
|
|
4
4
|
import { ISegmentsSyncTask, ISplitsSyncTask } from '../../polling/types';
|
|
5
|
+
import { ISplitKillData, ISplitUpdateData } from '../SSEHandler/types';
|
|
5
6
|
import { IUpdateWorker } from './types';
|
|
6
7
|
/**
|
|
7
8
|
* SplitsUpdateWorker class
|
|
@@ -26,7 +27,7 @@ export default class SplitsUpdateWorker implements IUpdateWorker {
|
|
|
26
27
|
*
|
|
27
28
|
* @param {number} changeNumber change number of the SPLIT_UPDATE notification
|
|
28
29
|
*/
|
|
29
|
-
put(changeNumber:
|
|
30
|
+
put({ changeNumber }: Pick<ISplitUpdateData, 'changeNumber'>): void;
|
|
30
31
|
/**
|
|
31
32
|
* Invoked by NotificationProcessor on SPLIT_KILL event
|
|
32
33
|
*
|
|
@@ -34,5 +35,5 @@ export default class SplitsUpdateWorker implements IUpdateWorker {
|
|
|
34
35
|
* @param {string} splitName name of split to kill
|
|
35
36
|
* @param {string} defaultTreatment default treatment value
|
|
36
37
|
*/
|
|
37
|
-
killSplit(changeNumber
|
|
38
|
+
killSplit({ changeNumber, splitName, defaultTreatment }: ISplitKillData): void;
|
|
38
39
|
}
|
|
@@ -20,6 +20,7 @@ export declare const PUSH_SUBSYSTEM_UP = "PUSH_SUBSYSTEM_UP";
|
|
|
20
20
|
*/
|
|
21
21
|
export declare const PUSH_SUBSYSTEM_DOWN = "PUSH_SUBSYSTEM_DOWN";
|
|
22
22
|
export declare const MY_SEGMENTS_UPDATE = "MY_SEGMENTS_UPDATE";
|
|
23
|
+
export declare const MY_SEGMENTS_UPDATE_V2 = "MY_SEGMENTS_UPDATE_V2";
|
|
23
24
|
export declare const SEGMENT_UPDATE = "SEGMENT_UPDATE";
|
|
24
25
|
export declare const SPLIT_KILL = "SPLIT_KILL";
|
|
25
26
|
export declare const SPLIT_UPDATE = "SPLIT_UPDATE";
|
|
@@ -28,5 +29,6 @@ export declare const OCCUPANCY = "OCCUPANCY";
|
|
|
28
29
|
export declare enum ControlType {
|
|
29
30
|
STREAMING_DISABLED = "STREAMING_DISABLED",
|
|
30
31
|
STREAMING_PAUSED = "STREAMING_PAUSED",
|
|
31
|
-
STREAMING_RESUMED = "STREAMING_RESUMED"
|
|
32
|
+
STREAMING_RESUMED = "STREAMING_RESUMED",
|
|
33
|
+
STREAMING_RESET = "STREAMING_RESET"
|
|
32
34
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Compression, KeyList } from './SSEHandler/types';
|
|
2
|
+
/**
|
|
3
|
+
* Decode, decompress and parse the provided 'data' into a KeyList object
|
|
4
|
+
*
|
|
5
|
+
* @param {string} data
|
|
6
|
+
* @param {number} compression
|
|
7
|
+
* @returns {{a?: string[], r?: string[] }}
|
|
8
|
+
* @throws if data string cannot be decoded, decompressed or parsed
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseKeyList(data: string, compression: Compression): KeyList;
|
|
11
|
+
/**
|
|
12
|
+
* Decode, decompress and parse the provided 'data' into a Bitmap object
|
|
13
|
+
*
|
|
14
|
+
* @param {string} data
|
|
15
|
+
* @param {number} compression
|
|
16
|
+
* @returns {Uint8Array}
|
|
17
|
+
* @throws if data string cannot be decoded or decompressed
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseBitmap(data: string, compression: Compression): Uint8Array;
|
|
20
|
+
/**
|
|
21
|
+
* Check if the 'bitmap' bit at 'hash64hex' position is 1
|
|
22
|
+
*
|
|
23
|
+
* @param {Uint8Array} bitmap
|
|
24
|
+
* @param {string} hash64hex 16-chars string, representing a number in hexa
|
|
25
|
+
* @returns {boolean}
|
|
26
|
+
*/
|
|
27
|
+
export declare function isInBitmap(bitmap: Uint8Array, hash64hex: string): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IPushManagerCS } from './types';
|
|
2
|
+
import { IStorageSync } from '../../storages/types';
|
|
3
|
+
import { IReadinessManager } from '../../readiness/types';
|
|
4
|
+
import { IPollingManager } from '../polling/types';
|
|
5
|
+
import { IFetchAuthV2 } from '../../services/types';
|
|
6
|
+
import { ISettings } from '../../types';
|
|
7
|
+
import { IPlatform } from '../../sdkFactory/types';
|
|
8
|
+
/**
|
|
9
|
+
* PushManager factory:
|
|
10
|
+
* - for server-side if key is not provided in settings.
|
|
11
|
+
* - for client-side, with support for multiple clients, if key is provided in settings
|
|
12
|
+
*/
|
|
13
|
+
export default function pushManagerFactory(pollingManager: IPollingManager, storage: IStorageSync, readiness: IReadinessManager, fetchAuthV2: IFetchAuthV2, platform: IPlatform, settings: ISettings): IPushManagerCS | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IMySegmentsUpdateData } from './SSEHandler/types';
|
|
1
|
+
import { IMySegmentsUpdateData, IMySegmentsUpdateV2Data, ISegmentUpdateData, ISplitUpdateData, ISplitKillData } from './SSEHandler/types';
|
|
2
2
|
import { ITask } from '../types';
|
|
3
3
|
import { IPollingManager, ISegmentsSyncTask } from '../polling/types';
|
|
4
4
|
import { IReadinessManager } from '../../readiness/types';
|
|
@@ -6,25 +6,28 @@ import { IFetchAuth } from '../../services/types';
|
|
|
6
6
|
import { IStorageSync } from '../../storages/types';
|
|
7
7
|
import { IEventEmitter, ISettings } from '../../types';
|
|
8
8
|
import { IPlatform } from '../../sdkFactory/types';
|
|
9
|
+
import { ControlType } from './constants';
|
|
9
10
|
export declare type PUSH_SUBSYSTEM_UP = 'PUSH_SUBSYSTEM_UP';
|
|
10
11
|
export declare type PUSH_SUBSYSTEM_DOWN = 'PUSH_SUBSYSTEM_DOWN';
|
|
11
12
|
export declare type PUSH_NONRETRYABLE_ERROR = 'PUSH_NONRETRYABLE_ERROR';
|
|
12
13
|
export declare type PUSH_RETRYABLE_ERROR = 'PUSH_RETRYABLE_ERROR';
|
|
13
14
|
export declare type MY_SEGMENTS_UPDATE = 'MY_SEGMENTS_UPDATE';
|
|
15
|
+
export declare type MY_SEGMENTS_UPDATE_V2 = 'MY_SEGMENTS_UPDATE_V2';
|
|
14
16
|
export declare type SEGMENT_UPDATE = 'SEGMENT_UPDATE';
|
|
15
17
|
export declare type SPLIT_KILL = 'SPLIT_KILL';
|
|
16
18
|
export declare type SPLIT_UPDATE = 'SPLIT_UPDATE';
|
|
17
19
|
export declare type CONTROL = 'CONTROL';
|
|
18
20
|
export declare type OCCUPANCY = 'OCCUPANCY';
|
|
19
|
-
export declare type IPushEvent = PUSH_SUBSYSTEM_UP | PUSH_SUBSYSTEM_DOWN | PUSH_NONRETRYABLE_ERROR | PUSH_RETRYABLE_ERROR | MY_SEGMENTS_UPDATE | SEGMENT_UPDATE | SPLIT_UPDATE | SPLIT_KILL;
|
|
21
|
+
export declare type IPushEvent = PUSH_SUBSYSTEM_UP | PUSH_SUBSYSTEM_DOWN | PUSH_NONRETRYABLE_ERROR | PUSH_RETRYABLE_ERROR | MY_SEGMENTS_UPDATE | MY_SEGMENTS_UPDATE_V2 | SEGMENT_UPDATE | SPLIT_UPDATE | SPLIT_KILL | ControlType.STREAMING_RESET;
|
|
22
|
+
declare type IParsedData<T extends IPushEvent> = T extends MY_SEGMENTS_UPDATE ? IMySegmentsUpdateData : T extends MY_SEGMENTS_UPDATE_V2 ? IMySegmentsUpdateV2Data : T extends SEGMENT_UPDATE ? ISegmentUpdateData : T extends SPLIT_UPDATE ? ISplitUpdateData : T extends SPLIT_KILL ? ISplitKillData : undefined;
|
|
20
23
|
/**
|
|
21
24
|
* EventEmitter used as Feedback Loop between the SyncManager and PushManager,
|
|
22
25
|
* where the latter pushes messages and the former consumes it
|
|
23
26
|
*/
|
|
24
27
|
export interface IPushEventEmitter extends IEventEmitter {
|
|
25
|
-
once<T extends IPushEvent>(event: T, listener: (
|
|
26
|
-
on<T extends IPushEvent>(event: T, listener: (
|
|
27
|
-
emit<T extends IPushEvent>(event: T,
|
|
28
|
+
once<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T>, channel: T extends MY_SEGMENTS_UPDATE ? string : undefined) => void): this;
|
|
29
|
+
on<T extends IPushEvent>(event: T, listener: (parsedData: IParsedData<T>, channel: T extends MY_SEGMENTS_UPDATE ? string : undefined) => void): this;
|
|
30
|
+
emit<T extends IPushEvent>(event: T, parsedData?: IParsedData<T>, channel?: T extends MY_SEGMENTS_UPDATE ? string : undefined): boolean;
|
|
28
31
|
}
|
|
29
32
|
/**
|
|
30
33
|
* PushManager for server-side
|
|
@@ -49,3 +52,4 @@ export declare type IPushManagerFactoryParams = [
|
|
|
49
52
|
platform: IPlatform,
|
|
50
53
|
settings: ISettings
|
|
51
54
|
];
|
|
55
|
+
export {};
|
|
@@ -7,4 +7,4 @@ import { IResponse } from '../../services/types';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare function submitterSyncTaskFactory<TState extends {
|
|
9
9
|
length?: number;
|
|
10
|
-
}>(log: ILogger, postClient: (body: string) => Promise<IResponse>, sourceCache: IRecorderCacheProducerSync<TState>, postRate: number, dataName: string, latencyTracker?: ITimeTracker, fromCacheToPayload?: (cacheData: TState) => any, maxRetries?: number): ISyncTask<[], void>;
|
|
10
|
+
}>(log: ILogger, postClient: (body: string) => Promise<IResponse>, sourceCache: IRecorderCacheProducerSync<TState>, postRate: number, dataName: string, latencyTracker?: ITimeTracker, fromCacheToPayload?: (cacheData: TState) => any, maxRetries?: number, debugLogs?: boolean): ISyncTask<[], void>;
|
|
@@ -6,4 +6,4 @@ import { ISplitsParser } from './offline/splitsParser/types';
|
|
|
6
6
|
*
|
|
7
7
|
* @param splitsParser e.g., `splitsParserFromFile`, `splitsParserFromSettings`.
|
|
8
8
|
*/
|
|
9
|
-
export declare function syncManagerOfflineFactory(
|
|
9
|
+
export declare function syncManagerOfflineFactory(splitsParserFactory: () => ISplitsParser): (params: ISyncManagerFactoryParams) => ISyncManagerCS;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ImpressionDTO } from '../../types';
|
|
2
2
|
import { IImpressionObserver } from './types';
|
|
3
|
-
export default class ImpressionObserver implements IImpressionObserver {
|
|
3
|
+
export default class ImpressionObserver<K extends string | number> implements IImpressionObserver {
|
|
4
4
|
private cache;
|
|
5
5
|
private hasher;
|
|
6
|
-
constructor(size: number, hasher: (impression: ImpressionDTO) =>
|
|
6
|
+
constructor(size: number, hasher: (impression: ImpressionDTO) => K);
|
|
7
7
|
testAndSet(impression: ImpressionDTO): number | undefined;
|
|
8
8
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ImpressionDTO } from '../../types';
|
|
2
|
-
export
|
|
2
|
+
export declare function buildKey(impression: ImpressionDTO): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import ImpressionObserver from './ImpressionObserver';
|
|
2
2
|
import { ImpressionDTO } from '../../types';
|
|
3
|
-
export declare function hashImpression32(impression: ImpressionDTO):
|
|
4
|
-
export declare function impressionObserverCSFactory(): ImpressionObserver
|
|
3
|
+
export declare function hashImpression32(impression: ImpressionDTO): number;
|
|
4
|
+
export declare function impressionObserverCSFactory(): ImpressionObserver<number>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import ImpressionObserver from './ImpressionObserver';
|
|
2
2
|
import { ImpressionDTO } from '../../types';
|
|
3
|
-
export declare function hashImpression128(impression: ImpressionDTO): string
|
|
4
|
-
export declare function impressionObserverSSFactory(): ImpressionObserver
|
|
3
|
+
export declare function hashImpression128(impression: ImpressionDTO): string;
|
|
4
|
+
export declare function impressionObserverSSFactory(): ImpressionObserver<string>;
|