@splitsoftware/splitio-commons 1.1.0 → 1.2.1-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/CHANGES.txt +3 -0
- package/cjs/evaluator/matchers/ew.js +3 -3
- package/cjs/logger/messages/info.js +3 -3
- package/cjs/sdkClient/client.js +2 -1
- package/cjs/sdkClient/clientAttributesDecoration.js +108 -0
- package/cjs/sdkClient/clientCS.js +10 -7
- package/cjs/sdkClient/sdkClientMethodCS.js +2 -2
- package/cjs/sdkClient/sdkClientMethodCSWithTT.js +2 -2
- package/cjs/services/splitHttpClient.js +1 -1
- package/cjs/storages/inMemory/AttributesCacheInMemory.js +70 -0
- package/cjs/sync/polling/fetchers/mySegmentsFetcher.js +2 -2
- package/cjs/sync/polling/pollingManagerCS.js +2 -1
- package/cjs/sync/polling/pollingManagerSS.js +2 -1
- package/cjs/sync/polling/syncTasks/mySegmentsSyncTask.js +1 -1
- package/cjs/sync/polling/updaters/mySegmentsUpdater.js +2 -2
- package/cjs/sync/streaming/AuthClient/index.js +1 -2
- package/cjs/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +1 -1
- package/cjs/sync/streaming/pushManager.js +27 -23
- package/cjs/sync/submitters/submitterManager.js +2 -1
- package/cjs/sync/syncManagerOnline.js +12 -12
- package/cjs/utils/inputValidation/attribute.js +20 -0
- package/cjs/utils/inputValidation/attributes.js +13 -1
- package/cjs/utils/inputValidation/eventProperties.js +3 -1
- package/cjs/utils/lang/index.js +1 -13
- package/cjs/utils/murmur3/legacy.js +44 -0
- package/cjs/utils/promise/timeout.js +1 -1
- package/esm/evaluator/matchers/ew.js +4 -4
- package/esm/logger/messages/info.js +3 -3
- package/esm/sdkClient/client.js +2 -1
- package/esm/sdkClient/clientAttributesDecoration.js +104 -0
- package/esm/sdkClient/clientCS.js +10 -7
- package/esm/sdkClient/sdkClientMethodCS.js +2 -2
- package/esm/sdkClient/sdkClientMethodCSWithTT.js +2 -2
- package/esm/services/splitHttpClient.js +1 -1
- package/esm/storages/inMemory/AttributesCacheInMemory.js +67 -0
- package/esm/sync/polling/fetchers/mySegmentsFetcher.js +2 -2
- package/esm/sync/polling/pollingManagerCS.js +2 -1
- package/esm/sync/polling/pollingManagerSS.js +2 -1
- package/esm/sync/polling/syncTasks/mySegmentsSyncTask.js +1 -1
- package/esm/sync/polling/updaters/mySegmentsUpdater.js +2 -2
- package/esm/sync/streaming/AuthClient/index.js +1 -2
- package/esm/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +1 -1
- package/esm/sync/streaming/pushManager.js +27 -23
- package/esm/sync/submitters/submitterManager.js +2 -1
- package/esm/sync/syncManagerOnline.js +12 -12
- package/esm/utils/inputValidation/attribute.js +16 -0
- package/esm/utils/inputValidation/attributes.js +11 -0
- package/esm/utils/inputValidation/eventProperties.js +4 -2
- package/esm/utils/lang/index.js +0 -11
- package/esm/utils/murmur3/legacy.js +39 -0
- package/esm/utils/promise/timeout.js +1 -1
- package/package.json +4 -4
- package/src/evaluator/matchers/ew.ts +4 -4
- package/src/logger/messages/info.ts +3 -3
- package/src/sdkClient/client.ts +2 -1
- package/src/sdkClient/clientAttributesDecoration.ts +122 -0
- package/src/sdkClient/clientCS.ts +14 -7
- package/src/sdkClient/sdkClientMethodCS.ts +2 -0
- package/src/sdkClient/sdkClientMethodCSWithTT.ts +2 -0
- package/src/services/splitHttpClient.ts +1 -1
- package/src/storages/inMemory/AttributesCacheInMemory.ts +73 -0
- package/src/sync/polling/fetchers/mySegmentsFetcher.ts +2 -1
- package/src/sync/polling/fetchers/types.ts +1 -0
- package/src/sync/polling/pollingManagerCS.ts +3 -6
- package/src/sync/polling/pollingManagerSS.ts +3 -8
- package/src/sync/polling/syncTasks/mySegmentsSyncTask.ts +2 -1
- package/src/sync/polling/types.ts +0 -12
- package/src/sync/polling/updaters/mySegmentsUpdater.ts +2 -1
- package/src/sync/streaming/AuthClient/index.ts +1 -2
- package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +1 -1
- package/src/sync/streaming/pushManager.ts +31 -38
- package/src/sync/streaming/types.ts +5 -25
- package/src/sync/submitters/submitterManager.ts +4 -8
- package/src/sync/syncManagerOnline.ts +16 -22
- package/src/types.ts +43 -0
- package/src/utils/inputValidation/attribute.ts +21 -0
- package/src/utils/inputValidation/attributes.ts +14 -0
- package/src/utils/inputValidation/eventProperties.ts +4 -2
- package/src/utils/lang/index.ts +0 -14
- package/src/utils/murmur3/legacy.ts +48 -0
- package/src/utils/promise/timeout.ts +1 -1
- package/types/sdkClient/clientAttributesDecoration.d.ts +51 -0
- package/types/sdkClient/clientCS.d.ts +2 -1
- package/types/storages/inMemory/AttributesCacheInMemory.d.ts +43 -0
- package/types/storages/inMemory/TelemetryCacheInMemory.d.ts +51 -0
- package/types/storages/inMemory/index.d.ts +10 -0
- package/types/storages/inRedis/TelemetryCacheInRedis.d.ts +0 -0
- package/types/storages/parseSegments.d.ts +6 -0
- package/types/storages/pluggable/TelemetryCachePluggable.d.ts +2 -0
- package/types/sync/polling/fetchers/mySegmentsFetcher.d.ts +1 -1
- package/types/sync/polling/fetchers/types.d.ts +1 -1
- package/types/sync/polling/pollingManagerCS.d.ts +2 -5
- package/types/sync/polling/pollingManagerSS.d.ts +2 -5
- package/types/sync/polling/types.d.ts +0 -11
- package/types/sync/polling/updaters/mySegmentsUpdater.d.ts +1 -1
- package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +1 -1
- package/types/sync/streaming/pushManager.d.ts +3 -7
- package/types/sync/streaming/pushManagerCS.d.ts +1 -12
- package/types/sync/streaming/pushManagerSS.d.ts +1 -11
- package/types/sync/streaming/types.d.ts +3 -23
- package/types/sync/submitters/submitterManager.d.ts +2 -4
- package/types/sync/submitters/telemetrySyncTask.d.ts +17 -0
- package/types/sync/syncManagerOnline.d.ts +3 -3
- package/types/trackers/telemetryRecorder.d.ts +0 -0
- package/types/types.d.ts +40 -0
- package/types/utils/EventEmitter.d.ts +4 -0
- package/types/utils/inputValidation/attribute.d.ts +2 -0
- package/types/utils/inputValidation/attributes.d.ts +1 -0
- package/types/utils/lang/index.d.ts +0 -4
- package/types/utils/murmur3/legacy.d.ts +2 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ImpressionDataType, EventDataType, StreamingEvent, Method, OperationType } from '../../sync/submitters/types';
|
|
2
|
+
import { TelemetryCacheSync } from '../types';
|
|
3
|
+
export declare class TelemetryCacheInMemory implements TelemetryCacheSync {
|
|
4
|
+
private timeUntilReady?;
|
|
5
|
+
getTimeUntilReady(): number | undefined;
|
|
6
|
+
recordTimeUntilReady(ms: number): void;
|
|
7
|
+
private timeUntilReadyFromCache?;
|
|
8
|
+
getTimeUntilReadyFromCache(): number | undefined;
|
|
9
|
+
recordTimeUntilReadyFromCache(ms: number): void;
|
|
10
|
+
private notReadyUsage;
|
|
11
|
+
getNonReadyUsage(): number;
|
|
12
|
+
recordNonReadyUsage(): void;
|
|
13
|
+
private impressionStats;
|
|
14
|
+
getImpressionStats(type: ImpressionDataType): number;
|
|
15
|
+
recordImpressionStats(type: ImpressionDataType, count: number): void;
|
|
16
|
+
private eventStats;
|
|
17
|
+
getEventStats(type: EventDataType): number;
|
|
18
|
+
recordEventStats(type: EventDataType, count: number): void;
|
|
19
|
+
private lastSync;
|
|
20
|
+
getLastSynchronization(): Record<OperationType, number | undefined>;
|
|
21
|
+
recordSuccessfulSync(resource: OperationType, timeMs: number): void;
|
|
22
|
+
private httpErrors;
|
|
23
|
+
popHttpErrors(): Record<OperationType, {
|
|
24
|
+
[statusCode: string]: number;
|
|
25
|
+
}>;
|
|
26
|
+
recordSyncError(resource: OperationType, status: number): void;
|
|
27
|
+
private httpLatencies;
|
|
28
|
+
popHttpLatencies(): Record<OperationType, number[]>;
|
|
29
|
+
recordSyncLatency(resource: OperationType, latencyMs: number): void;
|
|
30
|
+
private authRejections;
|
|
31
|
+
popAuthRejections(): number;
|
|
32
|
+
recordAuthRejections(): void;
|
|
33
|
+
private tokenRefreshes;
|
|
34
|
+
popTokenRefreshes(): number;
|
|
35
|
+
recordTokenRefreshes(): void;
|
|
36
|
+
private streamingEvents;
|
|
37
|
+
popStreamingEvents(): StreamingEvent[];
|
|
38
|
+
recordStreamingEvents(streamingEvent: StreamingEvent): void;
|
|
39
|
+
private tags;
|
|
40
|
+
popTags(): string[];
|
|
41
|
+
addTag(tag: string): void;
|
|
42
|
+
private sessionLength?;
|
|
43
|
+
getSessionLength(): number | undefined;
|
|
44
|
+
recordSessionLength(ms: number): void;
|
|
45
|
+
private exceptions;
|
|
46
|
+
popExceptions(): Record<Method, number>;
|
|
47
|
+
recordException(method: Method): void;
|
|
48
|
+
private latencies;
|
|
49
|
+
popLatencies(): Record<Method, number[]>;
|
|
50
|
+
recordLatency(method: Method, latencyMs: number): void;
|
|
51
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IStorageFactoryParams, IStorageSync } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* InMemory storage factory for standalone server-side SplitFactory
|
|
4
|
+
*
|
|
5
|
+
* @param params parameters required by EventsCacheSync
|
|
6
|
+
*/
|
|
7
|
+
export declare function InMemoryStorageFactory(params: IStorageFactoryParams): IStorageSync;
|
|
8
|
+
export declare namespace InMemoryStorageFactory {
|
|
9
|
+
var type: import("../types").StorageType;
|
|
10
|
+
}
|
|
File without changes
|
|
@@ -4,4 +4,4 @@ import { IMySegmentsFetcher } from './types';
|
|
|
4
4
|
* Factory of MySegments fetcher.
|
|
5
5
|
* MySegments fetcher is a wrapper around `mySegments` API service that parses the response and handle errors.
|
|
6
6
|
*/
|
|
7
|
-
export declare function mySegmentsFetcherFactory(fetchMySegments: IFetchMySegments
|
|
7
|
+
export declare function mySegmentsFetcherFactory(fetchMySegments: IFetchMySegments): IMySegmentsFetcher;
|
|
@@ -2,4 +2,4 @@ import { ISplitChangesResponse, ISegmentChangesResponse } from '../../../dtos/ty
|
|
|
2
2
|
import { IResponse } from '../../../services/types';
|
|
3
3
|
export declare type ISplitChangesFetcher = (since: number, noCache?: boolean, decorator?: (promise: Promise<IResponse>) => Promise<IResponse>) => Promise<ISplitChangesResponse>;
|
|
4
4
|
export declare type ISegmentChangesFetcher = (since: number, segmentName: string, noCache?: boolean, decorator?: (promise: Promise<ISegmentChangesResponse[]>) => Promise<ISegmentChangesResponse[]>) => Promise<ISegmentChangesResponse[]>;
|
|
5
|
-
export declare type IMySegmentsFetcher = (noCache?: boolean, decorator?: (promise: Promise<IResponse>) => Promise<IResponse>) => Promise<string[]>;
|
|
5
|
+
export declare type IMySegmentsFetcher = (userMatchingKey: string, noCache?: boolean, decorator?: (promise: Promise<IResponse>) => Promise<IResponse>) => Promise<string[]>;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { IPollingManagerCS } from './types';
|
|
2
|
-
import {
|
|
3
|
-
import { ISplitApi } from '../../services/types';
|
|
4
|
-
import { IStorageSync } from '../../storages/types';
|
|
5
|
-
import { ISettings } from '../../types';
|
|
2
|
+
import { ISyncManagerFactoryParams } from '../types';
|
|
6
3
|
/**
|
|
7
4
|
* Expose start / stop mechanism for polling data from services.
|
|
8
5
|
* For client-side API with multiple clients.
|
|
9
6
|
*/
|
|
10
|
-
export declare function pollingManagerCSFactory(
|
|
7
|
+
export declare function pollingManagerCSFactory(params: ISyncManagerFactoryParams): IPollingManagerCS;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { IStorageSync } from '../../storages/types';
|
|
2
|
-
import { IReadinessManager } from '../../readiness/types';
|
|
3
|
-
import { ISplitApi } from '../../services/types';
|
|
4
|
-
import { ISettings } from '../../types';
|
|
5
1
|
import { IPollingManager } from './types';
|
|
2
|
+
import { ISyncManagerFactoryParams } from '../types';
|
|
6
3
|
/**
|
|
7
4
|
* Expose start / stop mechanism for pulling data from services.
|
|
8
5
|
*/
|
|
9
|
-
export declare function pollingManagerSSFactory(
|
|
6
|
+
export declare function pollingManagerSSFactory(params: ISyncManagerFactoryParams): IPollingManager;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { IReadinessManager } from '../../readiness/types';
|
|
2
|
-
import { ISplitApi } from '../../services/types';
|
|
3
2
|
import { IStorageSync } from '../../storages/types';
|
|
4
|
-
import { ISettings } from '../../types';
|
|
5
3
|
import { SegmentsData } from '../streaming/SSEHandler/types';
|
|
6
4
|
import { ITask, ISyncTask } from '../types';
|
|
7
5
|
export interface ISplitsSyncTask extends ISyncTask<[noCache?: boolean], boolean> {
|
|
@@ -21,12 +19,3 @@ export interface IPollingManagerCS extends IPollingManager {
|
|
|
21
19
|
remove(matchingKey: string): void;
|
|
22
20
|
get(matchingKey: string): ISegmentsSyncTask | undefined;
|
|
23
21
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Signature of polling manager factory/constructor
|
|
26
|
-
*/
|
|
27
|
-
export declare type IPollingManagerFactoryParams = [
|
|
28
|
-
splitApi: ISplitApi,
|
|
29
|
-
storage: IStorageSync,
|
|
30
|
-
readiness: IReadinessManager,
|
|
31
|
-
settings: ISettings
|
|
32
|
-
];
|
|
@@ -9,5 +9,5 @@ declare type IMySegmentsUpdater = (segmentList?: string[], noCache?: boolean) =>
|
|
|
9
9
|
* - updates `mySegmentsCache`
|
|
10
10
|
* - uses `segmentsEventEmitter` to emit events related to segments data updates
|
|
11
11
|
*/
|
|
12
|
-
export declare function mySegmentsUpdaterFactory(log: ILogger, mySegmentsFetcher: IMySegmentsFetcher, splitsCache: ISplitsCacheSync, mySegmentsCache: ISegmentsCacheSync, segmentsEventEmitter: ISegmentsEventEmitter, requestTimeoutBeforeReady: number, retriesOnFailureBeforeReady: number): IMySegmentsUpdater;
|
|
12
|
+
export declare function mySegmentsUpdaterFactory(log: ILogger, mySegmentsFetcher: IMySegmentsFetcher, splitsCache: ISplitsCacheSync, mySegmentsCache: ISegmentsCacheSync, segmentsEventEmitter: ISegmentsEventEmitter, requestTimeoutBeforeReady: number, retriesOnFailureBeforeReady: number, matchingKey: string): IMySegmentsUpdater;
|
|
13
13
|
export {};
|
|
@@ -16,7 +16,7 @@ export declare class SegmentsUpdateWorker implements IUpdateWorker {
|
|
|
16
16
|
* @param {Object} segmentsCache segments data cache
|
|
17
17
|
* @param {Object} segmentsSyncTask task for syncing segments data
|
|
18
18
|
*/
|
|
19
|
-
constructor(
|
|
19
|
+
constructor(segmentsSyncTask: ISegmentsSyncTask, segmentsCache: ISegmentsCacheSync);
|
|
20
20
|
__handleSegmentUpdateCall(): void;
|
|
21
21
|
/**
|
|
22
22
|
* Invoked by NotificationProcessor on SEGMENT_UPDATE event
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IStorageSync } from '../../storages/types';
|
|
3
|
-
import { IReadinessManager } from '../../readiness/types';
|
|
1
|
+
import { IPushManager } from './types';
|
|
4
2
|
import { IPollingManager } from '../polling/types';
|
|
5
|
-
import {
|
|
6
|
-
import { ISettings } from '../../types';
|
|
7
|
-
import { IPlatform } from '../../sdkFactory/types';
|
|
3
|
+
import { ISyncManagerFactoryParams } from '../types';
|
|
8
4
|
/**
|
|
9
5
|
* PushManager factory:
|
|
10
6
|
* - for server-side if key is not provided in settings.
|
|
11
7
|
* - for client-side, with support for multiple clients, if key is provided in settings
|
|
12
8
|
*/
|
|
13
|
-
export declare function pushManagerFactory(
|
|
9
|
+
export declare function pushManagerFactory(params: ISyncManagerFactoryParams, pollingManager: IPollingManager): IPushManager | undefined;
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IStorageSync } from '../../storages/types';
|
|
3
|
-
import { IReadinessManager } from '../../readiness/types';
|
|
4
|
-
import { IPollingManager } from '../polling/types';
|
|
5
|
-
import { IFetchAuth } from '../../services/types';
|
|
6
|
-
import { ISettings } from '../../types';
|
|
7
|
-
import { IPlatform } from '../../sdkFactory/types';
|
|
8
|
-
/**
|
|
9
|
-
* PushManager factory for client-side, with support for multiple clients.
|
|
10
|
-
* It assumes settings contains a key.
|
|
11
|
-
*/
|
|
12
|
-
export default function pushManagerCSFactory(pollingManager: IPollingManager, storage: IStorageSync, readiness: IReadinessManager, fetchAuth: IFetchAuth, platform: IPlatform, settings: ISettings): IPushManagerCS | undefined;
|
|
1
|
+
export declare const pushManagerCSFactory: (params: import("../types").ISyncManagerFactoryParams, pollingManager: import("../polling/types").IPollingManager) => import("./types").IPushManager | undefined;
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IStorageSync } from '../../storages/types';
|
|
3
|
-
import { IPollingManager } from '../polling/types';
|
|
4
|
-
import { IReadinessManager } from '../../readiness/types';
|
|
5
|
-
import { IFetchAuth } from '../../services/types';
|
|
6
|
-
import { ISettings } from '../../types';
|
|
7
|
-
import { IPlatform } from '../../sdkFactory/types';
|
|
8
|
-
/**
|
|
9
|
-
* PushManager factory for server-side
|
|
10
|
-
*/
|
|
11
|
-
export default function pushManagerSSFactory(pollingManager: IPollingManager, storage: IStorageSync, readiness: IReadinessManager, fetchAuth: IFetchAuth, platform: IPlatform, settings: ISettings): IPushManager | undefined;
|
|
1
|
+
export declare const pushManagerSSFactory: (params: import("../types").ISyncManagerFactoryParams, pollingManager: import("../polling/types").IPollingManager) => import("./types").IPushManager | undefined;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { IMySegmentsUpdateData, IMySegmentsUpdateV2Data, ISegmentUpdateData, ISplitUpdateData, ISplitKillData } from './SSEHandler/types';
|
|
2
2
|
import { ITask } from '../types';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { IFetchAuth } from '../../services/types';
|
|
6
|
-
import { IStorageSync } from '../../storages/types';
|
|
7
|
-
import { IEventEmitter, ISettings } from '../../types';
|
|
8
|
-
import { IPlatform } from '../../sdkFactory/types';
|
|
3
|
+
import { ISegmentsSyncTask } from '../polling/types';
|
|
4
|
+
import { IEventEmitter } from '../../types';
|
|
9
5
|
import { ControlType } from './constants';
|
|
10
6
|
export declare type PUSH_SUBSYSTEM_UP = 'PUSH_SUBSYSTEM_UP';
|
|
11
7
|
export declare type PUSH_SUBSYSTEM_DOWN = 'PUSH_SUBSYSTEM_DOWN';
|
|
@@ -30,26 +26,10 @@ export interface IPushEventEmitter extends IEventEmitter {
|
|
|
30
26
|
emit<T extends IPushEvent>(event: T, parsedData?: IParsedData<T>, channel?: T extends MY_SEGMENTS_UPDATE ? string : undefined): boolean;
|
|
31
27
|
}
|
|
32
28
|
/**
|
|
33
|
-
* PushManager
|
|
29
|
+
* PushManager
|
|
34
30
|
*/
|
|
35
31
|
export interface IPushManager extends ITask, IPushEventEmitter {
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* PushManager for client-side with support for multiple clients
|
|
39
|
-
*/
|
|
40
|
-
export interface IPushManagerCS extends IPushManager {
|
|
41
32
|
add(userKey: string, mySegmentsSyncTask: ISegmentsSyncTask): void;
|
|
42
33
|
remove(userKey: string): void;
|
|
43
34
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Signature of push manager factory/constructor
|
|
46
|
-
*/
|
|
47
|
-
export declare type IPushManagerFactoryParams = [
|
|
48
|
-
pollingManager: IPollingManager,
|
|
49
|
-
storage: IStorageSync,
|
|
50
|
-
readiness: IReadinessManager,
|
|
51
|
-
fetchAuth: IFetchAuth,
|
|
52
|
-
platform: IPlatform,
|
|
53
|
-
settings: ISettings
|
|
54
|
-
];
|
|
55
35
|
export {};
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { ISettings } from '../../types';
|
|
4
|
-
export declare function submitterManagerFactory(settings: ISettings, storage: IStorageSync, splitApi: ISplitApi): import("../types").ISyncTask<[], any>;
|
|
1
|
+
import { ISyncManagerFactoryParams } from '../types';
|
|
2
|
+
export declare function submitterManagerFactory(params: ISyncManagerFactoryParams): import("../types").ISyncTask<[], any>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ISyncTask, ITimeTracker } from '../types';
|
|
2
|
+
import { IPostMetricsUsage } from '../../services/types';
|
|
3
|
+
import { IStorageSync, TelemetryCacheSync } from '../../storages/types';
|
|
4
|
+
import { TelemetryStatsPayload } from './types';
|
|
5
|
+
import { ILogger } from '../../logger/types';
|
|
6
|
+
/**
|
|
7
|
+
* Converts `impressions` data from cache into request payload.
|
|
8
|
+
*/
|
|
9
|
+
export declare function telemetryCacheAdapter(telemetryCache: TelemetryCacheSync, storage: IStorageSync): {
|
|
10
|
+
isEmpty(): boolean;
|
|
11
|
+
clear(): void;
|
|
12
|
+
state(): TelemetryStatsPayload;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Sync task that periodically posts impressions data
|
|
16
|
+
*/
|
|
17
|
+
export declare function telemetrySyncTaskFactory(log: ILogger, postMetricsUsage: IPostMetricsUsage, telemetryCache: TelemetryCacheSync, telemetryRefreshRate: number, latencyTracker: ITimeTracker, storage: IStorageSync): ISyncTask;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ISyncManagerCS, ISyncManagerFactoryParams } from './types';
|
|
2
|
-
import {
|
|
3
|
-
import { IPollingManager
|
|
2
|
+
import { IPushManager } from './streaming/types';
|
|
3
|
+
import { IPollingManager } from './polling/types';
|
|
4
4
|
/**
|
|
5
5
|
* Online SyncManager factory.
|
|
6
6
|
* Can be used for server-side API, and client-side API with or without multiple clients.
|
|
@@ -9,4 +9,4 @@ import { IPollingManager, IPollingManagerFactoryParams } from './polling/types';
|
|
|
9
9
|
* `pollingManagerSSFactory` or `pollingManagerCSFactory` respectively.
|
|
10
10
|
* @param pushManagerFactory optional to build a SyncManager with or without streaming support
|
|
11
11
|
*/
|
|
12
|
-
export declare function syncManagerOnlineFactory(pollingManagerFactory?: (
|
|
12
|
+
export declare function syncManagerOnlineFactory(pollingManagerFactory?: (params: ISyncManagerFactoryParams) => IPollingManager, pushManagerFactory?: (params: ISyncManagerFactoryParams, pollingManager: IPollingManager) => IPushManager | undefined): (params: ISyncManagerFactoryParams) => ISyncManagerCS;
|
|
File without changes
|
package/types/types.d.ts
CHANGED
|
@@ -375,6 +375,7 @@ interface IBasicClient extends IStatusInterface {
|
|
|
375
375
|
* @returns {Promise<void>}
|
|
376
376
|
*/
|
|
377
377
|
destroy(): Promise<void>;
|
|
378
|
+
isBrowserClient: boolean;
|
|
378
379
|
}
|
|
379
380
|
/**
|
|
380
381
|
* Common definitions between SDK instances for different environments interface.
|
|
@@ -1108,6 +1109,45 @@ export declare namespace SplitIO {
|
|
|
1108
1109
|
* @returns {boolean} Whether the event was added to the queue succesfully or not.
|
|
1109
1110
|
*/
|
|
1110
1111
|
track(...args: [trafficType: string, eventType: string, value?: number, properties?: Properties] | [eventType: string, value?: number, properties?: Properties]): boolean;
|
|
1112
|
+
/**
|
|
1113
|
+
* Add an attribute to client's in memory attributes storage
|
|
1114
|
+
* @function setAttribute
|
|
1115
|
+
* @param {string} attributeName Attrinute name
|
|
1116
|
+
* @param {string, number, boolean, list} attributeValue Attribute value
|
|
1117
|
+
* @returns {boolean} true if the attribute was stored and false otherways
|
|
1118
|
+
*/
|
|
1119
|
+
setAttribute(attributeName: string, attributeValue: Object): boolean;
|
|
1120
|
+
/**
|
|
1121
|
+
* Returns the attribute with the given key
|
|
1122
|
+
* @function getAttribute
|
|
1123
|
+
* @param {string} attributeName Attribute name
|
|
1124
|
+
* @returns {Object} Attribute with the given key
|
|
1125
|
+
*/
|
|
1126
|
+
getAttribute(attributeName: string): Object;
|
|
1127
|
+
/**
|
|
1128
|
+
* Add to client's in memory attributes storage the attributes in 'attributes'
|
|
1129
|
+
* @function setAttributes
|
|
1130
|
+
* @param {Object} attributes Object with attributes to store
|
|
1131
|
+
* @returns true if attributes were stored an false otherways
|
|
1132
|
+
*/
|
|
1133
|
+
setAttributes(attributes: Record<string, Object>): boolean;
|
|
1134
|
+
/**
|
|
1135
|
+
* Return all the attributes stored in client's in memory attributes storage
|
|
1136
|
+
* @function getAttributes
|
|
1137
|
+
* @returns {Object} returns all the stored attributes
|
|
1138
|
+
*/
|
|
1139
|
+
getAttributes(): Record<string, Object>;
|
|
1140
|
+
/**
|
|
1141
|
+
* Removes from client's in memory attributes storage the attribute with the given key
|
|
1142
|
+
* @function removeAttribute
|
|
1143
|
+
* @param {string} attributeName
|
|
1144
|
+
* @returns {boolean} true if attribute was removed and false otherways
|
|
1145
|
+
*/
|
|
1146
|
+
removeAttribute(attributeName: string): boolean;
|
|
1147
|
+
/**
|
|
1148
|
+
* Remove all the stored attributes in the client's in memory attribute storage
|
|
1149
|
+
*/
|
|
1150
|
+
clearAttributes(): boolean;
|
|
1111
1151
|
}
|
|
1112
1152
|
/**
|
|
1113
1153
|
* Representation of a manager instance with synchronous storage of the SDK.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { SplitIO } from '../../types';
|
|
2
2
|
import { ILogger } from '../../logger/types';
|
|
3
3
|
export declare function validateAttributes(log: ILogger, maybeAttrs: any, method: string): SplitIO.Attributes | undefined | false;
|
|
4
|
+
export declare function validateAttributesDeep(log: ILogger, maybeAttributes: Record<string, Object>, method: string): boolean;
|
|
@@ -72,10 +72,6 @@ export declare function merge(target: {
|
|
|
72
72
|
}, source: {
|
|
73
73
|
[key: string]: any;
|
|
74
74
|
}, ...rest: any[]): object;
|
|
75
|
-
/**
|
|
76
|
-
* Shallow clone an object
|
|
77
|
-
*/
|
|
78
|
-
export declare function shallowClone(obj: any): any;
|
|
79
75
|
/**
|
|
80
76
|
* Checks if the target string starts with the sub string.
|
|
81
77
|
*/
|