@splitsoftware/splitio-commons 1.9.1 → 1.9.2-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/evaluator/index.js +18 -1
- package/cjs/logger/constants.js +7 -2
- package/cjs/logger/messages/error.js +2 -0
- package/cjs/logger/messages/warn.js +4 -1
- package/cjs/sdkClient/client.js +33 -0
- package/cjs/sdkClient/clientAttributesDecoration.js +20 -0
- package/cjs/sdkClient/clientCS.js +4 -0
- package/cjs/sdkClient/clientInputValidation.js +52 -3
- package/cjs/sdkManager/index.js +2 -1
- package/cjs/services/splitApi.js +7 -1
- package/cjs/storages/KeyBuilder.js +3 -0
- package/cjs/storages/KeyBuilderSS.js +4 -0
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +63 -27
- package/cjs/storages/inLocalStorage/index.js +2 -2
- package/cjs/storages/inMemory/InMemoryStorage.js +2 -2
- package/cjs/storages/inMemory/InMemoryStorageCS.js +3 -3
- package/cjs/storages/inMemory/SplitsCacheInMemory.js +47 -2
- package/cjs/storages/inRedis/SplitsCacheInRedis.js +11 -0
- package/cjs/storages/pluggable/SplitsCachePluggable.js +11 -0
- package/cjs/sync/polling/syncTasks/splitsSyncTask.js +1 -1
- package/cjs/sync/polling/updaters/splitChangesUpdater.js +24 -4
- package/cjs/sync/submitters/telemetrySubmitter.js +15 -1
- package/cjs/utils/constants/index.js +6 -2
- package/cjs/utils/lang/sets.js +9 -1
- package/cjs/utils/settingsValidation/splitFilters.js +72 -2
- package/esm/evaluator/index.js +16 -0
- package/esm/logger/constants.js +5 -0
- package/esm/logger/messages/error.js +2 -0
- package/esm/logger/messages/warn.js +4 -1
- package/esm/sdkClient/client.js +35 -2
- package/esm/sdkClient/clientAttributesDecoration.js +20 -0
- package/esm/sdkClient/clientCS.js +4 -0
- package/esm/sdkClient/clientInputValidation.js +52 -3
- package/esm/sdkManager/index.js +2 -1
- package/esm/services/splitApi.js +7 -1
- package/esm/storages/KeyBuilder.js +3 -0
- package/esm/storages/KeyBuilderSS.js +4 -0
- package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +63 -27
- package/esm/storages/inLocalStorage/index.js +2 -2
- package/esm/storages/inMemory/InMemoryStorage.js +2 -2
- package/esm/storages/inMemory/InMemoryStorageCS.js +3 -3
- package/esm/storages/inMemory/SplitsCacheInMemory.js +47 -2
- package/esm/storages/inRedis/SplitsCacheInRedis.js +11 -0
- package/esm/storages/pluggable/SplitsCachePluggable.js +11 -0
- package/esm/sync/polling/syncTasks/splitsSyncTask.js +1 -1
- package/esm/sync/polling/updaters/splitChangesUpdater.js +24 -4
- package/esm/sync/submitters/telemetrySubmitter.js +15 -1
- package/esm/utils/constants/index.js +4 -0
- package/esm/utils/lang/sets.js +7 -0
- package/esm/utils/settingsValidation/splitFilters.js +71 -2
- package/package.json +2 -2
- package/src/dtos/types.ts +3 -2
- package/src/evaluator/index.ts +24 -0
- package/src/logger/constants.ts +5 -0
- package/src/logger/messages/error.ts +2 -0
- package/src/logger/messages/warn.ts +4 -1
- package/src/sdkClient/client.ts +42 -2
- package/src/sdkClient/clientAttributesDecoration.ts +24 -0
- package/src/sdkClient/clientCS.ts +4 -0
- package/src/sdkClient/clientInputValidation.ts +56 -4
- package/src/sdkManager/index.ts +2 -1
- package/src/services/splitApi.ts +6 -1
- package/src/storages/AbstractSplitsCacheAsync.ts +2 -0
- package/src/storages/AbstractSplitsCacheSync.ts +3 -0
- package/src/storages/KeyBuilder.ts +4 -0
- package/src/storages/KeyBuilderSS.ts +4 -0
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +74 -28
- package/src/storages/inLocalStorage/index.ts +2 -2
- package/src/storages/inMemory/InMemoryStorage.ts +2 -2
- package/src/storages/inMemory/InMemoryStorageCS.ts +3 -3
- package/src/storages/inMemory/SplitsCacheInMemory.ts +50 -1
- package/src/storages/inRedis/SplitsCacheInRedis.ts +12 -0
- package/src/storages/pluggable/SplitsCachePluggable.ts +12 -0
- package/src/storages/types.ts +7 -3
- package/src/sync/polling/syncTasks/splitsSyncTask.ts +1 -0
- package/src/sync/polling/updaters/splitChangesUpdater.ts +27 -4
- package/src/sync/submitters/telemetrySubmitter.ts +19 -2
- package/src/sync/submitters/types.ts +7 -1
- package/src/types.ts +118 -1
- package/src/utils/constants/index.ts +4 -0
- package/src/utils/lang/sets.ts +8 -0
- package/src/utils/settingsValidation/splitFilters.ts +77 -2
- package/types/dtos/types.d.ts +1 -0
- package/types/evaluator/index.d.ts +1 -0
- package/types/logger/constants.d.ts +5 -0
- package/types/myLogger.d.ts +5 -0
- package/types/sdkClient/clientAttributesDecoration.d.ts +4 -0
- package/types/sdkClient/types.d.ts +18 -0
- package/types/storages/AbstractSplitsCacheAsync.d.ts +2 -0
- package/types/storages/AbstractSplitsCacheSync.d.ts +2 -0
- package/types/storages/KeyBuilder.d.ts +1 -0
- package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +6 -1
- package/types/storages/inMemory/CountsCacheInMemory.d.ts +20 -0
- package/types/storages/inMemory/LatenciesCacheInMemory.d.ts +20 -0
- package/types/storages/inMemory/SplitsCacheInMemory.d.ts +9 -1
- package/types/storages/inRedis/CountsCacheInRedis.d.ts +9 -0
- package/types/storages/inRedis/LatenciesCacheInRedis.d.ts +9 -0
- package/types/storages/inRedis/SplitsCacheInRedis.d.ts +8 -0
- package/types/storages/metadataBuilder.d.ts +3 -0
- package/types/storages/pluggable/SplitsCachePluggable.d.ts +8 -0
- package/types/storages/types.d.ts +4 -0
- package/types/sync/offline/LocalhostFromFile.d.ts +2 -0
- package/types/sync/offline/splitsParser/splitsParserFromFile.d.ts +2 -0
- package/types/sync/offline/updaters/splitChangesUpdater.d.ts +0 -0
- package/types/sync/polling/updaters/splitChangesUpdater.d.ts +3 -3
- package/types/sync/submitters/eventsSyncTask.d.ts +8 -0
- package/types/sync/submitters/impressionCountsSubmitterInRedis.d.ts +5 -0
- package/types/sync/submitters/impressionCountsSyncTask.d.ts +13 -0
- package/types/sync/submitters/impressionsSyncTask.d.ts +14 -0
- package/types/sync/submitters/metricsSyncTask.d.ts +12 -0
- package/types/sync/submitters/submitterSyncTask.d.ts +10 -0
- package/types/sync/submitters/types.d.ts +7 -1
- package/types/sync/submitters/uniqueKeysSubmitterInRedis.d.ts +5 -0
- package/types/sync/syncTaskComposite.d.ts +5 -0
- package/types/trackers/filter/bloomFilter.d.ts +10 -0
- package/types/trackers/filter/dictionaryFilter.d.ts +8 -0
- package/types/trackers/filter/types.d.ts +5 -0
- package/types/types.d.ts +118 -1
- package/types/utils/constants/index.d.ts +4 -0
- package/types/utils/lang/sets.d.ts +1 -0
- package/types/utils/settingsValidation/splitFilters.d.ts +1 -0
- package/types/utils/timeTracker/index.d.ts +70 -0
- package/types/sdkClient/identity.d.ts +0 -6
- package/types/utils/inputValidation/sdkKey.d.ts +0 -7
- /package/types/storages/inMemory/{UniqueKeysCacheInMemory.d.ts → uniqueKeysCacheInMemory.d.ts} +0 -0
- /package/types/storages/inMemory/{UniqueKeysCacheInMemoryCS.d.ts → uniqueKeysCacheInMemoryCS.d.ts} +0 -0
- /package/types/storages/inRedis/{UniqueKeysCacheInRedis.d.ts → uniqueKeysCacheInRedis.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ISet } from '../../../utils/lang/sets';
|
|
2
2
|
import { ISegmentsCacheBase, ISplitsCacheBase } from '../../../storages/types';
|
|
3
3
|
import { ISplitChangesFetcher } from '../fetchers/types';
|
|
4
|
-
import { ISplit } from '../../../dtos/types';
|
|
4
|
+
import { ISplit, ISplitFiltersValidation } from '../../../dtos/types';
|
|
5
5
|
import { ISplitsEventEmitter } from '../../../readiness/types';
|
|
6
6
|
import { ILogger } from '../../../logger/types';
|
|
7
7
|
declare type ISplitChangesUpdater = (noCache?: boolean, till?: number, splitUpdateNotification?: {
|
|
@@ -23,7 +23,7 @@ interface ISplitMutations {
|
|
|
23
23
|
* i.e., an object with added splits, removed splits and used segments.
|
|
24
24
|
* Exported for testing purposes.
|
|
25
25
|
*/
|
|
26
|
-
export declare function computeSplitsMutation(entries: ISplit[]): ISplitMutations;
|
|
26
|
+
export declare function computeSplitsMutation(entries: ISplit[], filters: ISplitFiltersValidation): ISplitMutations;
|
|
27
27
|
/**
|
|
28
28
|
* factory of SplitChanges updater, a task that:
|
|
29
29
|
* - fetches split changes using `splitChangesFetcher`
|
|
@@ -38,5 +38,5 @@ export declare function computeSplitsMutation(entries: ISplit[]): ISplitMutation
|
|
|
38
38
|
* @param requestTimeoutBeforeReady How long the updater will wait for the request to timeout. Default 0, i.e., never timeout.
|
|
39
39
|
* @param retriesOnFailureBeforeReady How many retries on `/splitChanges` we the updater do in case of failure or timeout. Default 0, i.e., no retries.
|
|
40
40
|
*/
|
|
41
|
-
export declare function splitChangesUpdaterFactory(log: ILogger, splitChangesFetcher: ISplitChangesFetcher, splits: ISplitsCacheBase, segments: ISegmentsCacheBase, splitsEventEmitter?: ISplitsEventEmitter, requestTimeoutBeforeReady?: number, retriesOnFailureBeforeReady?: number, isClientSide?: boolean): ISplitChangesUpdater;
|
|
41
|
+
export declare function splitChangesUpdaterFactory(log: ILogger, splitChangesFetcher: ISplitChangesFetcher, splits: ISplitsCacheBase, segments: ISegmentsCacheBase, splitFiltersValidation: ISplitFiltersValidation, splitsEventEmitter?: ISplitsEventEmitter, requestTimeoutBeforeReady?: number, retriesOnFailureBeforeReady?: number, isClientSide?: boolean): ISplitChangesUpdater;
|
|
42
42
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
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;
|
|
@@ -0,0 +1,13 @@
|
|
|
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;
|
|
@@ -0,0 +1,14 @@
|
|
|
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;
|
|
@@ -0,0 +1,12 @@
|
|
|
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;
|
|
@@ -0,0 +1,10 @@
|
|
|
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>;
|
|
@@ -110,7 +110,11 @@ export declare type TREATMENTS = 'ts';
|
|
|
110
110
|
export declare type TREATMENT_WITH_CONFIG = 'tc';
|
|
111
111
|
export declare type TREATMENTS_WITH_CONFIG = 'tcs';
|
|
112
112
|
export declare type TRACK = 'tr';
|
|
113
|
-
export declare type
|
|
113
|
+
export declare type TREATMENTS_BY_FLAGSET = 'tf';
|
|
114
|
+
export declare type TREATMENTS_BY_FLAGSETS = 'tfs';
|
|
115
|
+
export declare type TREATMENTS_WITH_CONFIG_BY_FLAGSET = 'tcf';
|
|
116
|
+
export declare type TREATMENTS_WITH_CONFIG_BY_FLAGSETS = 'tcfs';
|
|
117
|
+
export declare type Method = TREATMENT | TREATMENTS | TREATMENT_WITH_CONFIG | TREATMENTS_WITH_CONFIG | TRACK | TREATMENTS_BY_FLAGSET | TREATMENTS_BY_FLAGSETS | TREATMENTS_WITH_CONFIG_BY_FLAGSET | TREATMENTS_WITH_CONFIG_BY_FLAGSETS;
|
|
114
118
|
export declare type MethodLatencies = Partial<Record<Method, Array<number>>>;
|
|
115
119
|
export declare type MethodExceptions = Partial<Record<Method, number>>;
|
|
116
120
|
export declare type CONNECTION_ESTABLISHED = 0;
|
|
@@ -201,6 +205,8 @@ export declare type TelemetryConfigStatsPayload = TelemetryConfigStats & {
|
|
|
201
205
|
nR: number;
|
|
202
206
|
i?: Array<string>;
|
|
203
207
|
uC: number;
|
|
208
|
+
fsT: number;
|
|
209
|
+
fsI: number;
|
|
204
210
|
};
|
|
205
211
|
export interface ISubmitterManager extends ISyncTask {
|
|
206
212
|
start(onlyTelemetry?: boolean): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
}
|
package/types/types.d.ts
CHANGED
|
@@ -601,6 +601,11 @@ export declare namespace SplitIO {
|
|
|
601
601
|
configs: {
|
|
602
602
|
[treatmentName: string]: string;
|
|
603
603
|
};
|
|
604
|
+
/**
|
|
605
|
+
* list of sets per feature flag
|
|
606
|
+
* @property {string[]} sets
|
|
607
|
+
*/
|
|
608
|
+
sets?: string[];
|
|
604
609
|
};
|
|
605
610
|
/**
|
|
606
611
|
* A promise that resolves to a feature flag view.
|
|
@@ -706,7 +711,7 @@ export declare namespace SplitIO {
|
|
|
706
711
|
* SplitFilter type.
|
|
707
712
|
* @typedef {string} SplitFilterType
|
|
708
713
|
*/
|
|
709
|
-
type SplitFilterType = 'byName' | 'byPrefix';
|
|
714
|
+
type SplitFilterType = 'byName' | 'byPrefix' | 'bySet';
|
|
710
715
|
/**
|
|
711
716
|
* Defines a feature flag filter, described by a type and list of values.
|
|
712
717
|
*/
|
|
@@ -1056,6 +1061,42 @@ export declare namespace SplitIO {
|
|
|
1056
1061
|
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1057
1062
|
*/
|
|
1058
1063
|
getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig;
|
|
1064
|
+
/**
|
|
1065
|
+
* Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flagSet.
|
|
1066
|
+
* @function getTreatmentsByFlagSet
|
|
1067
|
+
* @param {string} key - The string key representing the consumer.
|
|
1068
|
+
* @param {string} flagSet - The flagSet name we want to get the treatments.
|
|
1069
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1070
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1071
|
+
*/
|
|
1072
|
+
getTreatmentsByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): Treatments;
|
|
1073
|
+
/**
|
|
1074
|
+
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flagSets.
|
|
1075
|
+
* @function getTreatmentsWithConfigByFlagSet
|
|
1076
|
+
* @param {string} key - The string key representing the consumer.
|
|
1077
|
+
* @param {string} flagSet - The flagSet name we want to get the treatments.
|
|
1078
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1079
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1080
|
+
*/
|
|
1081
|
+
getTreatmentsWithConfigByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): TreatmentsWithConfig;
|
|
1082
|
+
/**
|
|
1083
|
+
* Returns a Returns a Treatments value, which is an object with both treatment and config string for to the feature flags related to the given flagSets.
|
|
1084
|
+
* @function getTreatmentsByFlagSets
|
|
1085
|
+
* @param {string} key - The string key representing the consumer.
|
|
1086
|
+
* @param {Array<string>} flagSets - An array of the flagSet names we want to get the treatments.
|
|
1087
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1088
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1089
|
+
*/
|
|
1090
|
+
getTreatmentsByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): Treatments;
|
|
1091
|
+
/**
|
|
1092
|
+
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flagSets.
|
|
1093
|
+
* @function getTreatmentsWithConfigByFlagSets
|
|
1094
|
+
* @param {string} key - The string key representing the consumer.
|
|
1095
|
+
* @param {Array<string>} flagSets - An array of the flagSet names we want to get the treatments.
|
|
1096
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1097
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1098
|
+
*/
|
|
1099
|
+
getTreatmentsWithConfigByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): TreatmentsWithConfig;
|
|
1059
1100
|
/**
|
|
1060
1101
|
* Tracks an event to be fed to the results product on Split user interface.
|
|
1061
1102
|
* @function track
|
|
@@ -1116,6 +1157,46 @@ export declare namespace SplitIO {
|
|
|
1116
1157
|
* @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects.
|
|
1117
1158
|
*/
|
|
1118
1159
|
getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig;
|
|
1160
|
+
/**
|
|
1161
|
+
* Returns a Treatments value, which will be (or eventually be) an object map with the treatments for the features related to the given flag set.
|
|
1162
|
+
* For usage on NodeJS as we don't have only one key.
|
|
1163
|
+
* @function getTreatmentsByFlagSet
|
|
1164
|
+
* @param {string} key - The string key representing the consumer.
|
|
1165
|
+
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
1166
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1167
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1168
|
+
*/
|
|
1169
|
+
getTreatmentsByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): AsyncTreatments;
|
|
1170
|
+
/**
|
|
1171
|
+
* Returns a TreatmentWithConfig value, which will be (or eventually be) an object with both treatment and config string for features related to the given flag set.
|
|
1172
|
+
* For usage on NodeJS as we don't have only one key.
|
|
1173
|
+
* @function getTreatmentsWithConfigByFlagSet
|
|
1174
|
+
* @param {string} key - The string key representing the consumer.
|
|
1175
|
+
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
1176
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1177
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1178
|
+
*/
|
|
1179
|
+
getTreatmentsWithConfigByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): AsyncTreatmentsWithConfig;
|
|
1180
|
+
/**
|
|
1181
|
+
* Returns a Treatments value, which will be (or eventually be) an object map with the treatments for the feature flags related to the given flag sets.
|
|
1182
|
+
* For usage on NodeJS as we don't have only one key.
|
|
1183
|
+
* @function getTreatmentsByFlagSets
|
|
1184
|
+
* @param {string} key - The string key representing the consumer.
|
|
1185
|
+
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
1186
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1187
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1188
|
+
*/
|
|
1189
|
+
getTreatmentsByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): AsyncTreatments;
|
|
1190
|
+
/**
|
|
1191
|
+
* Returns a TreatmentWithConfig value, which will be (or eventually be) an object with both treatment and config string for the feature flags related to the given flag sets.
|
|
1192
|
+
* For usage on NodeJS as we don't have only one key.
|
|
1193
|
+
* @function getTreatmentsWithConfigByFlagSets
|
|
1194
|
+
* @param {string} key - The string key representing the consumer.
|
|
1195
|
+
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
1196
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1197
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1198
|
+
*/
|
|
1199
|
+
getTreatmentsWithConfigByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): AsyncTreatmentsWithConfig;
|
|
1119
1200
|
/**
|
|
1120
1201
|
* Tracks an event to be fed to the results product on Split user interface, and returns a promise to signal when the event was successfully queued (or not).
|
|
1121
1202
|
* @function track
|
|
@@ -1166,6 +1247,42 @@ export declare namespace SplitIO {
|
|
|
1166
1247
|
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1167
1248
|
*/
|
|
1168
1249
|
getTreatmentsWithConfig(featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig;
|
|
1250
|
+
/**
|
|
1251
|
+
* Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
|
|
1252
|
+
* @function getTreatmentsByFlagSet
|
|
1253
|
+
* @param {string} key - The string key representing the consumer.
|
|
1254
|
+
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
1255
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1256
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1257
|
+
*/
|
|
1258
|
+
getTreatmentsByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): Treatments;
|
|
1259
|
+
/**
|
|
1260
|
+
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag set.
|
|
1261
|
+
* @function getTreatmentsWithConfigByFlagSet
|
|
1262
|
+
* @param {string} key - The string key representing the consumer.
|
|
1263
|
+
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
1264
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1265
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1266
|
+
*/
|
|
1267
|
+
getTreatmentsWithConfigByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): TreatmentsWithConfig;
|
|
1268
|
+
/**
|
|
1269
|
+
* Returns a Returns a Treatments value, which is an object with both treatment and config string for to the feature flags related to the given flag sets.
|
|
1270
|
+
* @function getTreatmentsByFlagSets
|
|
1271
|
+
* @param {string} key - The string key representing the consumer.
|
|
1272
|
+
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
1273
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1274
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1275
|
+
*/
|
|
1276
|
+
getTreatmentsByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): Treatments;
|
|
1277
|
+
/**
|
|
1278
|
+
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag sets.
|
|
1279
|
+
* @function getTreatmentsWithConfigByFlagSets
|
|
1280
|
+
* @param {string} key - The string key representing the consumer.
|
|
1281
|
+
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
1282
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1283
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1284
|
+
*/
|
|
1285
|
+
getTreatmentsWithConfigByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): TreatmentsWithConfig;
|
|
1169
1286
|
/**
|
|
1170
1287
|
* Tracks an event to be fed to the results product on Split user interface.
|
|
1171
1288
|
* @function track
|
|
@@ -45,6 +45,10 @@ export declare const TREATMENT = "t";
|
|
|
45
45
|
export declare const TREATMENTS = "ts";
|
|
46
46
|
export declare const TREATMENT_WITH_CONFIG = "tc";
|
|
47
47
|
export declare const TREATMENTS_WITH_CONFIG = "tcs";
|
|
48
|
+
export declare const TREATMENTS_BY_FLAGSET = "tf";
|
|
49
|
+
export declare const TREATMENTS_BY_FLAGSETS = "tfs";
|
|
50
|
+
export declare const TREATMENTS_WITH_CONFIG_BY_FLAGSET = "tcf";
|
|
51
|
+
export declare const TREATMENTS_WITH_CONFIG_BY_FLAGSETS = "tcfs";
|
|
48
52
|
export declare const TRACK = "tr";
|
|
49
53
|
export declare const CONNECTION_ESTABLISHED = 0;
|
|
50
54
|
export declare const OCCUPANCY_PRI = 10;
|
|
@@ -14,3 +14,4 @@ import { ILogger } from '../../logger/types';
|
|
|
14
14
|
* @throws Error if the some of the grouped list of values per filter exceeds the max allowed length
|
|
15
15
|
*/
|
|
16
16
|
export declare function validateSplitFilters(log: ILogger, maybeSplitFilters: any, mode: string): ISplitFiltersValidation;
|
|
17
|
+
export declare function flagSetsAreValid(log: ILogger, method: string, flagSets: string[], flagSetsInConfig: string[]): string[];
|
|
@@ -0,0 +1,70 @@
|
|
|
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 {};
|
|
@@ -1,7 +0,0 @@
|
|
|
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;
|
/package/types/storages/inMemory/{UniqueKeysCacheInMemory.d.ts → uniqueKeysCacheInMemory.d.ts}
RENAMED
|
File without changes
|
/package/types/storages/inMemory/{UniqueKeysCacheInMemoryCS.d.ts → uniqueKeysCacheInMemoryCS.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|