@splitsoftware/splitio-commons 1.11.0 → 1.12.1-rc.0

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.
Files changed (79) hide show
  1. package/CHANGES.txt +4 -0
  2. package/cjs/evaluator/index.js +19 -3
  3. package/cjs/logger/constants.js +4 -2
  4. package/cjs/logger/messages/warn.js +3 -1
  5. package/cjs/sdkClient/client.js +1 -1
  6. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +2 -7
  7. package/cjs/storages/inMemory/SplitsCacheInMemory.js +2 -10
  8. package/cjs/storages/pluggable/SplitsCachePluggable.js +25 -8
  9. package/cjs/storages/pluggable/index.js +1 -1
  10. package/cjs/utils/lang/sets.js +11 -1
  11. package/cjs/utils/settingsValidation/index.js +1 -1
  12. package/cjs/utils/settingsValidation/splitFilters.js +17 -10
  13. package/esm/evaluator/index.js +20 -4
  14. package/esm/logger/constants.js +2 -0
  15. package/esm/logger/messages/warn.js +3 -1
  16. package/esm/sdkClient/client.js +1 -1
  17. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +3 -8
  18. package/esm/storages/inMemory/SplitsCacheInMemory.js +3 -11
  19. package/esm/storages/pluggable/SplitsCachePluggable.js +26 -9
  20. package/esm/storages/pluggable/index.js +1 -1
  21. package/esm/utils/lang/sets.js +9 -0
  22. package/esm/utils/settingsValidation/index.js +1 -1
  23. package/esm/utils/settingsValidation/splitFilters.js +9 -2
  24. package/package.json +2 -2
  25. package/src/evaluator/index.ts +24 -4
  26. package/src/logger/constants.ts +2 -0
  27. package/src/logger/messages/warn.ts +9 -7
  28. package/src/sdkClient/client.ts +1 -1
  29. package/src/storages/AbstractSplitsCacheAsync.ts +1 -1
  30. package/src/storages/AbstractSplitsCacheSync.ts +1 -1
  31. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +4 -10
  32. package/src/storages/inMemory/SplitsCacheInMemory.ts +6 -14
  33. package/src/storages/inRedis/SplitsCacheInRedis.ts +1 -1
  34. package/src/storages/pluggable/SplitsCachePluggable.ts +32 -10
  35. package/src/storages/pluggable/index.ts +1 -1
  36. package/src/storages/types.ts +5 -5
  37. package/src/types.ts +0 -2
  38. package/src/utils/lang/sets.ts +9 -1
  39. package/src/utils/settingsValidation/index.ts +1 -1
  40. package/src/utils/settingsValidation/splitFilters.ts +13 -6
  41. package/types/evaluator/index.d.ts +1 -1
  42. package/types/logger/constants.d.ts +2 -0
  43. package/types/sdkClient/identity.d.ts +6 -0
  44. package/types/storages/AbstractSplitsCacheAsync.d.ts +1 -1
  45. package/types/storages/AbstractSplitsCacheSync.d.ts +1 -1
  46. package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +1 -1
  47. package/types/storages/inMemory/SplitsCacheInMemory.d.ts +1 -1
  48. package/types/storages/inRedis/SplitsCacheInRedis.d.ts +1 -1
  49. package/types/storages/pluggable/SplitsCachePluggable.d.ts +7 -6
  50. package/types/storages/types.d.ts +5 -5
  51. package/types/types.d.ts +0 -2
  52. package/types/utils/inputValidation/sdkKey.d.ts +7 -0
  53. package/types/utils/lang/sets.d.ts +1 -0
  54. package/types/utils/settingsValidation/splitFilters.d.ts +2 -1
  55. package/types/myLogger.d.ts +0 -5
  56. package/types/sdkClient/types.d.ts +0 -18
  57. package/types/storages/inMemory/CountsCacheInMemory.d.ts +0 -20
  58. package/types/storages/inMemory/LatenciesCacheInMemory.d.ts +0 -20
  59. package/types/storages/inRedis/CountsCacheInRedis.d.ts +0 -9
  60. package/types/storages/inRedis/LatenciesCacheInRedis.d.ts +0 -9
  61. package/types/storages/metadataBuilder.d.ts +0 -3
  62. package/types/sync/offline/LocalhostFromFile.d.ts +0 -2
  63. package/types/sync/offline/splitsParser/splitsParserFromFile.d.ts +0 -2
  64. package/types/sync/offline/updaters/splitChangesUpdater.d.ts +0 -0
  65. package/types/sync/submitters/eventsSyncTask.d.ts +0 -8
  66. package/types/sync/submitters/impressionCountsSubmitterInRedis.d.ts +0 -5
  67. package/types/sync/submitters/impressionCountsSyncTask.d.ts +0 -13
  68. package/types/sync/submitters/impressionsSyncTask.d.ts +0 -14
  69. package/types/sync/submitters/metricsSyncTask.d.ts +0 -12
  70. package/types/sync/submitters/submitterSyncTask.d.ts +0 -10
  71. package/types/sync/submitters/uniqueKeysSubmitterInRedis.d.ts +0 -5
  72. package/types/sync/syncTaskComposite.d.ts +0 -5
  73. package/types/trackers/filter/bloomFilter.d.ts +0 -10
  74. package/types/trackers/filter/dictionaryFilter.d.ts +0 -8
  75. package/types/trackers/filter/types.d.ts +0 -5
  76. package/types/utils/timeTracker/index.d.ts +0 -70
  77. /package/types/storages/inMemory/{uniqueKeysCacheInMemory.d.ts → UniqueKeysCacheInMemory.d.ts} +0 -0
  78. /package/types/storages/inMemory/{uniqueKeysCacheInMemoryCS.d.ts → UniqueKeysCacheInMemoryCS.d.ts} +0 -0
  79. /package/types/storages/inRedis/{uniqueKeysCacheInRedis.d.ts → UniqueKeysCacheInRedis.d.ts} +0 -0
@@ -5,4 +5,4 @@ import { SplitIO } from '../types';
5
5
  import { ILogger } from '../logger/types';
6
6
  export declare function evaluateFeature(log: ILogger, key: SplitIO.SplitKey, splitName: string, attributes: SplitIO.Attributes | undefined, storage: IStorageSync | IStorageAsync): MaybeThenable<IEvaluationResult>;
7
7
  export declare function evaluateFeatures(log: ILogger, key: SplitIO.SplitKey, splitNames: string[], attributes: SplitIO.Attributes | undefined, storage: IStorageSync | IStorageAsync): MaybeThenable<Record<string, IEvaluationResult>>;
8
- export declare function evaluateFeaturesByFlagSets(log: ILogger, key: SplitIO.SplitKey, flagSets: string[], attributes: SplitIO.Attributes | undefined, storage: IStorageSync | IStorageAsync): MaybeThenable<Record<string, IEvaluationResult>>;
8
+ export declare function evaluateFeaturesByFlagSets(log: ILogger, key: SplitIO.SplitKey, flagSets: string[], attributes: SplitIO.Attributes | undefined, storage: IStorageSync | IStorageAsync, method: string): MaybeThenable<Record<string, IEvaluationResult>>;
@@ -89,6 +89,7 @@ export declare const WARN_NOT_EXISTENT_SPLIT = 215;
89
89
  export declare const WARN_LOWERCASE_TRAFFIC_TYPE = 216;
90
90
  export declare const WARN_NOT_EXISTENT_TT = 217;
91
91
  export declare const WARN_INTEGRATION_INVALID = 218;
92
+ export declare const WARN_SPLITS_FILTER_IGNORED = 219;
92
93
  export declare const WARN_SPLITS_FILTER_INVALID = 220;
93
94
  export declare const WARN_SPLITS_FILTER_EMPTY = 221;
94
95
  export declare const WARN_SDK_KEY = 222;
@@ -97,6 +98,7 @@ export declare const STREAMING_PARSING_SPLIT_UPDATE = 224;
97
98
  export declare const WARN_SPLITS_FILTER_INVALID_SET = 225;
98
99
  export declare const WARN_SPLITS_FILTER_LOWERCASE_SET = 226;
99
100
  export declare const WARN_FLAGSET_NOT_CONFIGURED = 227;
101
+ export declare const WARN_FLAGSET_WITHOUT_FLAGS = 228;
100
102
  export declare const ERROR_ENGINE_COMBINER_IFELSEIF = 300;
101
103
  export declare const ERROR_LOGLEVEL_INVALID = 301;
102
104
  export declare const ERROR_CLIENT_LISTENER = 302;
@@ -0,0 +1,6 @@
1
+ import { SplitIO } from '../types';
2
+ export declare function buildInstanceId(key: SplitIO.SplitKey, trafficType?: string): string;
3
+ export declare function parseInstanceId(instanceId: string): {
4
+ key: SplitIO.SplitKey;
5
+ trafficType?: string;
6
+ };
@@ -15,7 +15,7 @@ export declare abstract class AbstractSplitsCacheAsync implements ISplitsCacheAs
15
15
  abstract getChangeNumber(): Promise<number>;
16
16
  abstract getAll(): Promise<ISplit[]>;
17
17
  abstract getSplitNames(): Promise<string[]>;
18
- abstract getNamesByFlagSets(flagSets: string[]): Promise<ISet<string>>;
18
+ abstract getNamesByFlagSets(flagSets: string[]): Promise<ISet<string>[]>;
19
19
  abstract trafficTypeExists(trafficType: string): Promise<boolean>;
20
20
  abstract clear(): Promise<boolean | void>;
21
21
  usesSegments(): Promise<boolean>;
@@ -35,7 +35,7 @@ export declare abstract class AbstractSplitsCacheSync implements ISplitsCacheSyn
35
35
  * for instance, if the `changeNumber` is old, or if the split is not found (e.g., `/splitchanges` hasn't been fetched yet), or if the storage fails to apply the update.
36
36
  */
37
37
  killLocally(name: string, defaultTreatment: string, changeNumber: number): boolean;
38
- abstract getNamesByFlagSets(flagSets: string[]): ISet<string>;
38
+ abstract getNamesByFlagSets(flagSets: string[]): ISet<string>[];
39
39
  }
40
40
  /**
41
41
  * Given a parsed split, it returns a boolean flagging if its conditions use segments matchers (rules & whitelists).
@@ -48,7 +48,7 @@ export declare class SplitsCacheInLocal extends AbstractSplitsCacheSync {
48
48
  */
49
49
  private _checkExpiration;
50
50
  private _checkFilterQuery;
51
- getNamesByFlagSets(flagSets: string[]): ISet<string>;
51
+ getNamesByFlagSets(flagSets: string[]): ISet<string>[];
52
52
  private addToFlagSets;
53
53
  private removeFromFlagSets;
54
54
  private removeNames;
@@ -22,7 +22,7 @@ export declare class SplitsCacheInMemory extends AbstractSplitsCacheSync {
22
22
  getSplitNames(): string[];
23
23
  trafficTypeExists(trafficType: string): boolean;
24
24
  usesSegments(): boolean;
25
- getNamesByFlagSets(flagSets: string[]): ISet<string>;
25
+ getNamesByFlagSets(flagSets: string[]): ISet<string>[];
26
26
  private addToFlagSets;
27
27
  private removeFromFlagSets;
28
28
  private removeNames;
@@ -78,7 +78,7 @@ export declare class SplitsCacheInRedis extends AbstractSplitsCacheAsync {
78
78
  * or rejected if wrapper operation fails.
79
79
  * @todo this is a no-op method to be implemented
80
80
  */
81
- getNamesByFlagSets(): Promise<ISet<string>>;
81
+ getNamesByFlagSets(): Promise<ISet<string>[]>;
82
82
  /**
83
83
  * Check traffic type existence.
84
84
  * The returned promise is resolved with a boolean indicating whether the TT exist or not.
@@ -1,7 +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
+ import { ISplit, ISplitFiltersValidation } from '../../dtos/types';
5
5
  import { AbstractSplitsCacheAsync } from '../AbstractSplitsCacheAsync';
6
6
  import { ISet } from '../../utils/lang/sets';
7
7
  /**
@@ -11,15 +11,17 @@ export declare class SplitsCachePluggable extends AbstractSplitsCacheAsync {
11
11
  private readonly log;
12
12
  private readonly keys;
13
13
  private readonly wrapper;
14
+ private readonly flagSetsFilter;
14
15
  /**
15
16
  * Create a SplitsCache that uses a storage wrapper.
16
17
  * @param log Logger instance.
17
18
  * @param keys Key builder.
18
19
  * @param wrapper Adapted wrapper storage.
19
20
  */
20
- constructor(log: ILogger, keys: KeyBuilder, wrapper: IPluggableStorageWrapper);
21
+ constructor(log: ILogger, keys: KeyBuilder, wrapper: IPluggableStorageWrapper, splitFiltersValidation?: ISplitFiltersValidation);
21
22
  private _decrementCounts;
22
23
  private _incrementCounts;
24
+ private _updateFlagSets;
23
25
  /**
24
26
  * Add a given split.
25
27
  * The returned promise is resolved when the operation success
@@ -37,7 +39,7 @@ export declare class SplitsCachePluggable extends AbstractSplitsCacheAsync {
37
39
  * The returned promise is resolved when the operation success, with a boolean indicating if the split existed or not.
38
40
  * or rejected if it fails (e.g., wrapper operation fails).
39
41
  */
40
- removeSplit(name: string): Promise<boolean | void>;
42
+ removeSplit(name: string): Promise<boolean>;
41
43
  /**
42
44
  * Remove a list of splits.
43
45
  * The returned promise is resolved when the operation success, with a boolean array indicating if the splits existed or not.
@@ -71,10 +73,9 @@ export declare class SplitsCachePluggable extends AbstractSplitsCacheAsync {
71
73
  /**
72
74
  * Get list of split names related to a given flag set names list.
73
75
  * The returned promise is resolved with the list of split names,
74
- * or rejected if wrapper operation fails.
75
- * @todo this is a no-op method to be implemented
76
+ * or rejected if any wrapper operation fails.
76
77
  */
77
- getNamesByFlagSets(): Promise<ISet<string>>;
78
+ getNamesByFlagSets(flagSets: string[]): Promise<ISet<string>[]>;
78
79
  /**
79
80
  * Check traffic type existence.
80
81
  * The returned promise is resolved with a boolean indicating whether the TT exist or not.
@@ -41,10 +41,10 @@ export interface IPluggableStorageWrapper {
41
41
  *
42
42
  * @function del
43
43
  * @param {string} key Item to delete
44
- * @returns {Promise<void>} A promise that resolves if the operation success, whether the key existed and was removed or it didn't exist.
44
+ * @returns {Promise<boolean>} A promise that resolves if the operation success, whether the key existed and was removed (resolves with true) or it didn't exist (resolves with false).
45
45
  * The promise rejects if the operation fails, for example, if there is a connection error.
46
46
  */
47
- del: (key: string) => Promise<boolean | void>;
47
+ del: (key: string) => Promise<boolean>;
48
48
  /**
49
49
  * Returns all keys matching the given prefix.
50
50
  *
@@ -193,7 +193,7 @@ export interface ISplitsCacheBase {
193
193
  clear(): MaybeThenable<boolean | void>;
194
194
  checkCache(): MaybeThenable<boolean>;
195
195
  killLocally(name: string, defaultTreatment: string, changeNumber: number): MaybeThenable<boolean>;
196
- getNamesByFlagSets(flagSets: string[]): MaybeThenable<ISet<string>>;
196
+ getNamesByFlagSets(flagSets: string[]): MaybeThenable<ISet<string>[]>;
197
197
  }
198
198
  export interface ISplitsCacheSync extends ISplitsCacheBase {
199
199
  addSplits(entries: [string, ISplit][]): boolean[];
@@ -209,7 +209,7 @@ export interface ISplitsCacheSync extends ISplitsCacheBase {
209
209
  clear(): void;
210
210
  checkCache(): boolean;
211
211
  killLocally(name: string, defaultTreatment: string, changeNumber: number): boolean;
212
- getNamesByFlagSets(flagSets: string[]): ISet<string>;
212
+ getNamesByFlagSets(flagSets: string[]): ISet<string>[];
213
213
  }
214
214
  export interface ISplitsCacheAsync extends ISplitsCacheBase {
215
215
  addSplits(entries: [string, ISplit][]): Promise<boolean[] | void>;
@@ -225,7 +225,7 @@ export interface ISplitsCacheAsync extends ISplitsCacheBase {
225
225
  clear(): Promise<boolean | void>;
226
226
  checkCache(): Promise<boolean>;
227
227
  killLocally(name: string, defaultTreatment: string, changeNumber: number): Promise<boolean>;
228
- getNamesByFlagSets(flagSets: string[]): Promise<ISet<string>>;
228
+ getNamesByFlagSets(flagSets: string[]): Promise<ISet<string>[]>;
229
229
  }
230
230
  /** Segments cache */
231
231
  export interface ISegmentsCacheBase {
package/types/types.d.ts CHANGED
@@ -191,8 +191,6 @@ interface ISharedSettings {
191
191
  * List of feature flag filters. These filters are used to fetch a subset of the feature flag definitions in your environment, in order to reduce the delay of the SDK to be ready.
192
192
  * This configuration is only meaningful when the SDK is working in "standalone" mode.
193
193
  *
194
- * At the moment, only one type of feature flag filter is supported: by name.
195
- *
196
194
  * Example:
197
195
  * `splitFilter: [
198
196
  * { type: 'byName', values: ['my_feature_flag_1', 'my_feature_flag_2'] }, // will fetch feature flags named 'my_feature_flag_1' and 'my_feature_flag_2'
@@ -0,0 +1,7 @@
1
+ import { ILogger } from '../../logger/types';
2
+ /** validates the given SDK key */
3
+ export declare function validateApiKey(log: ILogger, maybeSdkKey: any): string | false;
4
+ export declare const usedKeysMap: Record<string, number>;
5
+ /** validates the given SDK key and also warns if it is in use */
6
+ export declare function validateAndTrackApiKey(log: ILogger, maybeSdkKey: any): string | false;
7
+ export declare function releaseApiKey(sdkKey: string): void;
@@ -58,4 +58,5 @@ interface ISetConstructor {
58
58
  export declare function __getSetConstructor(): ISetConstructor;
59
59
  export declare const _Set: ISetConstructor;
60
60
  export declare function returnSetsUnion<T>(set: ISet<T>, set2: ISet<T>): ISet<T>;
61
+ export declare function returnListDifference<T>(list?: T[], list2?: T[]): T[];
61
62
  export {};
@@ -5,6 +5,7 @@ import { ILogger } from '../../logger/types';
5
5
  *
6
6
  * @param {ILogger} log logger
7
7
  * @param {any} maybeSplitFilters split filters configuration param provided by the user
8
+ * @param {string} mode settings mode
8
9
  * @returns it returns an object with the following properties:
9
10
  * - `validFilters`: the validated `splitFilters` configuration object defined by the user.
10
11
  * - `queryString`: the parsed split filter query. it is null if all filters are invalid or all values in filters are invalid.
@@ -12,5 +13,5 @@ import { ILogger } from '../../logger/types';
12
13
  *
13
14
  * @throws Error if the some of the grouped list of values per filter exceeds the max allowed length
14
15
  */
15
- export declare function validateSplitFilters(log: ILogger, maybeSplitFilters: any): ISplitFiltersValidation;
16
+ export declare function validateSplitFilters(log: ILogger, maybeSplitFilters: any, mode: string): ISplitFiltersValidation;
16
17
  export declare function flagSetsAreValid(log: ILogger, method: string, flagSets: string[], flagSetsInConfig: string[]): string[];
@@ -1,5 +0,0 @@
1
- export declare const myLogger: {
2
- log: (msg: any) => void;
3
- logCsv: (msg: any) => void;
4
- logToFile: (file: any, msg: any) => void;
5
- };
@@ -1,18 +0,0 @@
1
- import { ISignalListener } from '../listeners/types';
2
- import { ISdkReadinessManager } from '../readiness/types';
3
- import { IStorageAsync, IStorageSync } from '../storages/types';
4
- import { ISyncManager } from '../sync/types';
5
- import { IEventTracker, IImpressionsTracker } from '../trackers/types';
6
- import { ISettings } from '../types';
7
- export interface IClientFactoryParams {
8
- storage: IStorageSync | IStorageAsync;
9
- sdkReadinessManager: ISdkReadinessManager;
10
- settings: ISettings;
11
- impressionsTracker: IImpressionsTracker;
12
- eventTracker: IEventTracker;
13
- }
14
- export interface ISdkClientFactoryParams extends IClientFactoryParams {
15
- signalListener?: ISignalListener;
16
- syncManager?: ISyncManager;
17
- sharedClient?: boolean;
18
- }
@@ -1,20 +0,0 @@
1
- import { ICountsCacheSync } from '../types';
2
- export declare class CountsCacheInMemory implements ICountsCacheSync {
3
- private counters;
4
- /**
5
- * Add counts.
6
- */
7
- track(metricName: string): boolean;
8
- /**
9
- * Clear the collector
10
- */
11
- clear(): void;
12
- /**
13
- * Get the collected data, used as payload for posting.
14
- */
15
- state(): Record<string, number>;
16
- /**
17
- * Check if the cache is empty.
18
- */
19
- isEmpty(): boolean;
20
- }
@@ -1,20 +0,0 @@
1
- import { ILatenciesCacheSync } from '../types';
2
- export declare class LatenciesCacheInMemory implements ILatenciesCacheSync {
3
- private counters;
4
- /**
5
- * Add latencies.
6
- */
7
- track(metricName: string, latency: number): boolean;
8
- /**
9
- * Clear the collector
10
- */
11
- clear(): void;
12
- /**
13
- * Get the collected data, used as payload for posting.
14
- */
15
- state(): Record<string, number[]>;
16
- /**
17
- * Check if the cache is empty.
18
- */
19
- isEmpty(): boolean;
20
- }
@@ -1,9 +0,0 @@
1
- import { ICountsCacheAsync } from '../types';
2
- import { KeyBuilderSS } from '../KeyBuilderSS';
3
- import { Redis } from 'ioredis';
4
- export declare class CountsCacheInRedis implements ICountsCacheAsync {
5
- private readonly redis;
6
- private readonly keys;
7
- constructor(keys: KeyBuilderSS, redis: Redis);
8
- track(metricName: string): Promise<boolean>;
9
- }
@@ -1,9 +0,0 @@
1
- import { ILatenciesCacheAsync } from '../types';
2
- import { KeyBuilderSS } from '../KeyBuilderSS';
3
- import { Redis } from 'ioredis';
4
- export declare class LatenciesCacheInRedis implements ILatenciesCacheAsync {
5
- private readonly redis;
6
- private readonly keys;
7
- constructor(keys: KeyBuilderSS, redis: Redis);
8
- track(metricName: string, latency: number): Promise<boolean>;
9
- }
@@ -1,3 +0,0 @@
1
- import { IMetadata } from '../dtos/types';
2
- import { ISettings } from '../types';
3
- export declare function metadataBuilder(settings: Pick<ISettings, 'version' | 'runtime'>): IMetadata;
@@ -1,2 +0,0 @@
1
- import { SplitIO } from '../../types';
2
- export declare function LocalhostFromFile(): SplitIO.LocalhostFactory;
@@ -1,2 +0,0 @@
1
- import { ISplitsParser } from './types';
2
- export declare function splitsParserFromFileFactory(): ISplitsParser;
@@ -1,8 +0,0 @@
1
- import { IEventsCacheSync } from '../../storages/types';
2
- import { IPostEventsBulk } from '../../services/types';
3
- import { ISyncTask, ITimeTracker } from '../types';
4
- import { ILogger } from '../../logger/types';
5
- /**
6
- * Sync task that periodically posts tracked events
7
- */
8
- export declare function eventsSyncTaskFactory(log: ILogger, postEventsBulk: IPostEventsBulk, eventsCache: IEventsCacheSync, eventsPushRate: number, eventsFirstPushWindow: number, latencyTracker?: ITimeTracker): ISyncTask;
@@ -1,5 +0,0 @@
1
- import { ISdkFactoryContextSync } from '../../sdkFactory/types';
2
- /**
3
- * Submitter that periodically posts impression counts
4
- */
5
- export declare function impressionCountsSubmitterInRedisFactory(params: ISdkFactoryContextSync): import("../types").ISyncTask<[], void>;
@@ -1,13 +0,0 @@
1
- import { ISyncTask, ITimeTracker } from '../types';
2
- import { IPostTestImpressionsCount } from '../../services/types';
3
- import { IImpressionCountsCacheSync } from '../../storages/types';
4
- import { ImpressionCountsPayload } from './types';
5
- import { ILogger } from '../../logger/types';
6
- /**
7
- * Converts `impressionCounts` data from cache into request payload.
8
- */
9
- export declare function fromImpressionCountsCollector(impressionsCount: Record<string, number>): ImpressionCountsPayload;
10
- /**
11
- * Sync task that periodically posts impression counts
12
- */
13
- export declare function impressionCountsSyncTaskFactory(log: ILogger, postTestImpressionsCount: IPostTestImpressionsCount, impressionCountsCache: IImpressionCountsCacheSync, latencyTracker?: ITimeTracker): ISyncTask;
@@ -1,14 +0,0 @@
1
- import { ISyncTask, ITimeTracker } from '../types';
2
- import { IPostTestImpressionsBulk } from '../../services/types';
3
- import { IImpressionsCacheSync } from '../../storages/types';
4
- import { ImpressionDTO } from '../../types';
5
- import { ImpressionsPayload } from './types';
6
- import { ILogger } from '../../logger/types';
7
- /**
8
- * Converts `impressions` data from cache into request payload.
9
- */
10
- export declare function fromImpressionsCollector(sendLabels: boolean, data: ImpressionDTO[]): ImpressionsPayload;
11
- /**
12
- * Sync task that periodically posts impressions data
13
- */
14
- export declare function impressionsSyncTaskFactory(log: ILogger, postTestImpressionsBulk: IPostTestImpressionsBulk, impressionsCache: IImpressionsCacheSync, impressionsRefreshRate: number, sendLabels?: boolean, latencyTracker?: ITimeTracker): ISyncTask;
@@ -1,12 +0,0 @@
1
- import { ICountsCacheSync, ILatenciesCacheSync } from '../../storages/types';
2
- import { IPostMetricsCounters, IPostMetricsTimes } from '../../services/types';
3
- import { ISyncTask, ITimeTracker } from '../types';
4
- import { ILogger } from '../../logger/types';
5
- /**
6
- * Sync task that periodically posts telemetry counts
7
- */
8
- export declare function countsSyncTaskFactory(log: ILogger, postMetricsCounters: IPostMetricsCounters, countsCache: ICountsCacheSync, metricsRefreshRate: number, latencyTracker?: ITimeTracker): ISyncTask;
9
- /**
10
- * Sync task that periodically posts telemetry latencies
11
- */
12
- export declare function latenciesSyncTaskFactory(log: ILogger, postMetricsLatencies: IPostMetricsTimes, latenciesCache: ILatenciesCacheSync, metricsRefreshRate: number, latencyTracker?: ITimeTracker): ISyncTask;
@@ -1,10 +0,0 @@
1
- import { ISyncTask, ITimeTracker } from '../types';
2
- import { IRecorderCacheProducerSync } from '../../storages/types';
3
- import { ILogger } from '../../logger/types';
4
- import { IResponse } from '../../services/types';
5
- /**
6
- * Base function to create submitter sync tasks, such as ImpressionsSyncTask and EventsSyncTask
7
- */
8
- export declare function submitterSyncTaskFactory<TState extends {
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, debugLogs?: boolean): ISyncTask<[], void>;
@@ -1,5 +0,0 @@
1
- import { ISdkFactoryContextSync } from '../../sdkFactory/types';
2
- /**
3
- * Submitter that periodically posts impression counts
4
- */
5
- export declare function uniqueKeysSubmitterInRedisFactory(params: ISdkFactoryContextSync): import("../types").ISyncTask<[], void>;
@@ -1,5 +0,0 @@
1
- import { ISyncTask } from './types';
2
- /**
3
- * Composite Sync Task: group of sync tasks that are treated as a single one.
4
- */
5
- export declare function syncTaskComposite(syncTasks: ISyncTask[]): ISyncTask;
@@ -1,10 +0,0 @@
1
- import { IFilter } from './types';
2
- export declare class BloomFilterImp implements IFilter {
3
- private spectedInsertions;
4
- private errorRate;
5
- private filter;
6
- constructor(spectedInsertions: number, errorRate: number);
7
- add(data: string): boolean;
8
- contains(data: string): boolean;
9
- clear(): void;
10
- }
@@ -1,8 +0,0 @@
1
- import { IFilter } from './types';
2
- export declare class DictionaryFilter implements IFilter {
3
- private filter;
4
- constructor();
5
- add(data: string): boolean;
6
- contains(data: string): boolean;
7
- clear(): void;
8
- }
@@ -1,5 +0,0 @@
1
- export interface IFilter {
2
- add(data: string): boolean;
3
- contains(data: string): boolean;
4
- clear(): void;
5
- }
@@ -1,70 +0,0 @@
1
- import { ILogger } from '../../logger/types';
2
- import { IResponse } from '../../services/types';
3
- interface MetricsCollector {
4
- countException(): void;
5
- count(status: number): void;
6
- latency(ms: number): void;
7
- ready(ms: number): void;
8
- getTreatment(ms: number): void;
9
- getTreatments(ms: number): void;
10
- getTreatmentWithConfig(ms: number): void;
11
- getTreatmentsWithConfig(ms: number): void;
12
- [method: string]: (ms: number) => void;
13
- }
14
- export declare const TrackerAPI: {
15
- /**
16
- * "Private" method, used to attach count/countException and stop callbacks to a promise.
17
- *
18
- * @param {ILogger} log - Logger.
19
- * @param {Promise} promise - The promise we want to attach the callbacks.
20
- * @param {string} task - The name of the task.
21
- * @param {number | string} modifier - (optional) The modifier for the task, if any.
22
- */
23
- __attachToPromise(log: ILogger, promise: Promise<IResponse>, task: string, collector: false | MetricsCollector, modifier?: string | number | undefined): Promise<IResponse>;
24
- /**
25
- * Starts tracking the time for a given task. All tasks tracked are considered "unique" because
26
- * there may be multiple SDK instances tracking a "generic" task, making any task non-generic.
27
- *
28
- * @param {ILogger} log - Logger.
29
- * @param {string} task - The task we are starting.
30
- * @param {Object} collectors - The collectors map.
31
- * @param {Promise} promise - (optional) The promise we are tracking.
32
- * @return {Function | Promise} The stop function for this specific task or the promise received with the callbacks registered.
33
- */
34
- start(log: ILogger, task: string, collectors?: Record<string, MetricsCollector> | undefined, promise?: Promise<IResponse> | undefined, now?: (() => number) | undefined): Promise<IResponse> | (() => number);
35
- /**
36
- * Setup the collector for a task that reports metrics.
37
- *
38
- * @param {string} task - The task name
39
- * @param {number | string} taskUniqueId - The unique identifier for this task
40
- * @param {Object} collectors - The collectors map.
41
- */
42
- setCollectorForTask(task: string, taskUniqueId: number | string, collectors: Record<string, MetricsCollector>): void;
43
- /**
44
- * Stops the tracking of a given task.
45
- *
46
- * @param {ILogger} log - Logger.
47
- * @param {string} task - The task we are starting.
48
- * @param {number | string} modifier - (optional) The modifier for that specific task.
49
- */
50
- stop(log: ILogger, task: string, modifier?: string | number | undefined): number | undefined;
51
- /**
52
- * The constants shortcut for the task names.
53
- */
54
- TaskNames: {
55
- SDK_READY: string;
56
- SDK_GET_TREATMENT: string;
57
- SDK_GET_TREATMENTS: string;
58
- SDK_GET_TREATMENT_WITH_CONFIG: string;
59
- SDK_GET_TREATMENTS_WITH_CONFIG: string;
60
- SPLITS_READY: string;
61
- SEGMENTS_READY: string;
62
- METRICS_PUSH: string;
63
- IMPRESSIONS_PUSH: string;
64
- EVENTS_PUSH: string;
65
- MY_SEGMENTS_FETCH: string;
66
- SEGMENTS_FETCH: string;
67
- SPLITS_FETCH: string;
68
- };
69
- };
70
- export {};