@splitsoftware/splitio-commons 1.10.0 → 1.10.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 +9 -0
- package/cjs/evaluator/index.js +18 -1
- package/cjs/logger/constants.js +7 -3
- package/cjs/logger/messages/error.js +2 -0
- package/cjs/logger/messages/warn.js +4 -2
- 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 +1 -0
- 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 +39 -5
- 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/index.js +1 -1
- package/cjs/utils/settingsValidation/splitFilters.js +78 -15
- package/esm/evaluator/index.js +16 -0
- package/esm/logger/constants.js +5 -1
- package/esm/logger/messages/error.js +2 -0
- package/esm/logger/messages/warn.js +4 -2
- 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 +1 -0
- 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 +39 -5
- 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/index.js +1 -1
- package/esm/utils/settingsValidation/splitFilters.js +72 -10
- 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 -1
- package/src/logger/messages/error.ts +2 -0
- package/src/logger/messages/warn.ts +4 -2
- 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 -3
- package/src/sdkManager/index.ts +1 -0
- 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 +40 -6
- package/src/sync/submitters/telemetrySubmitter.ts +19 -2
- package/src/sync/submitters/types.ts +7 -1
- package/src/types.ts +115 -2
- package/src/utils/constants/index.ts +4 -0
- package/src/utils/lang/sets.ts +8 -0
- package/src/utils/settingsValidation/index.ts +1 -1
- package/src/utils/settingsValidation/splitFilters.ts +78 -10
- package/types/dtos/types.d.ts +1 -0
- package/types/evaluator/index.d.ts +1 -0
- package/types/logger/constants.d.ts +5 -1
- 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 +114 -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 +2 -2
- 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,6 +1,7 @@
|
|
|
1
1
|
import { MaybeThenable, ISplit } from '../dtos/types';
|
|
2
2
|
import { EventDataType, HttpErrors, HttpLatencies, ImpressionDataType, LastSync, Method, MethodExceptions, MethodLatencies, MultiMethodExceptions, MultiMethodLatencies, MultiConfigs, OperationType, StoredEventWithMetadata, StoredImpressionWithMetadata, StreamingEvent, UniqueKeysPayloadCs, UniqueKeysPayloadSs, TelemetryUsageStatsPayload, UpdatesFromSSEEnum } from '../sync/submitters/types';
|
|
3
3
|
import { SplitIO, ImpressionDTO, ISettings } from '../types';
|
|
4
|
+
import { ISet } from '../utils/lang/sets';
|
|
4
5
|
/**
|
|
5
6
|
* Interface of a pluggable storage wrapper.
|
|
6
7
|
*/
|
|
@@ -192,6 +193,7 @@ export interface ISplitsCacheBase {
|
|
|
192
193
|
clear(): MaybeThenable<boolean | void>;
|
|
193
194
|
checkCache(): MaybeThenable<boolean>;
|
|
194
195
|
killLocally(name: string, defaultTreatment: string, changeNumber: number): MaybeThenable<boolean>;
|
|
196
|
+
getNamesByFlagSets(flagSets: string[]): MaybeThenable<ISet<string>>;
|
|
195
197
|
}
|
|
196
198
|
export interface ISplitsCacheSync extends ISplitsCacheBase {
|
|
197
199
|
addSplits(entries: [string, ISplit][]): boolean[];
|
|
@@ -207,6 +209,7 @@ export interface ISplitsCacheSync extends ISplitsCacheBase {
|
|
|
207
209
|
clear(): void;
|
|
208
210
|
checkCache(): boolean;
|
|
209
211
|
killLocally(name: string, defaultTreatment: string, changeNumber: number): boolean;
|
|
212
|
+
getNamesByFlagSets(flagSets: string[]): ISet<string>;
|
|
210
213
|
}
|
|
211
214
|
export interface ISplitsCacheAsync extends ISplitsCacheBase {
|
|
212
215
|
addSplits(entries: [string, ISplit][]): Promise<boolean[] | void>;
|
|
@@ -222,6 +225,7 @@ export interface ISplitsCacheAsync extends ISplitsCacheBase {
|
|
|
222
225
|
clear(): Promise<boolean | void>;
|
|
223
226
|
checkCache(): Promise<boolean>;
|
|
224
227
|
killLocally(name: string, defaultTreatment: string, changeNumber: number): Promise<boolean>;
|
|
228
|
+
getNamesByFlagSets(flagSets: string[]): Promise<ISet<string>>;
|
|
225
229
|
}
|
|
226
230
|
/** Segments cache */
|
|
227
231
|
export interface ISegmentsCacheBase {
|
|
File without changes
|
|
@@ -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 of the feature flag.
|
|
606
|
+
* @property {string[]} sets
|
|
607
|
+
*/
|
|
608
|
+
sets: string[];
|
|
604
609
|
/**
|
|
605
610
|
* The default treatment of the feature flag.
|
|
606
611
|
* @property {string} defaultTreatment
|
|
@@ -711,7 +716,7 @@ export declare namespace SplitIO {
|
|
|
711
716
|
* SplitFilter type.
|
|
712
717
|
* @typedef {string} SplitFilterType
|
|
713
718
|
*/
|
|
714
|
-
type SplitFilterType = 'byName' | 'byPrefix';
|
|
719
|
+
type SplitFilterType = 'byName' | 'byPrefix' | 'bySet';
|
|
715
720
|
/**
|
|
716
721
|
* Defines a feature flag filter, described by a type and list of values.
|
|
717
722
|
*/
|
|
@@ -1061,6 +1066,42 @@ export declare namespace SplitIO {
|
|
|
1061
1066
|
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1062
1067
|
*/
|
|
1063
1068
|
getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig;
|
|
1069
|
+
/**
|
|
1070
|
+
* Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flagSet.
|
|
1071
|
+
* @function getTreatmentsByFlagSet
|
|
1072
|
+
* @param {string} key - The string key representing the consumer.
|
|
1073
|
+
* @param {string} flagSet - The flagSet name we want to get the treatments.
|
|
1074
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1075
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1076
|
+
*/
|
|
1077
|
+
getTreatmentsByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): Treatments;
|
|
1078
|
+
/**
|
|
1079
|
+
* 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.
|
|
1080
|
+
* @function getTreatmentsWithConfigByFlagSet
|
|
1081
|
+
* @param {string} key - The string key representing the consumer.
|
|
1082
|
+
* @param {string} flagSet - The flagSet name we want to get the treatments.
|
|
1083
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1084
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1085
|
+
*/
|
|
1086
|
+
getTreatmentsWithConfigByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): TreatmentsWithConfig;
|
|
1087
|
+
/**
|
|
1088
|
+
* 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.
|
|
1089
|
+
* @function getTreatmentsByFlagSets
|
|
1090
|
+
* @param {string} key - The string key representing the consumer.
|
|
1091
|
+
* @param {Array<string>} flagSets - An array of the flagSet names we want to get the treatments.
|
|
1092
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1093
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1094
|
+
*/
|
|
1095
|
+
getTreatmentsByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): Treatments;
|
|
1096
|
+
/**
|
|
1097
|
+
* 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.
|
|
1098
|
+
* @function getTreatmentsWithConfigByFlagSets
|
|
1099
|
+
* @param {string} key - The string key representing the consumer.
|
|
1100
|
+
* @param {Array<string>} flagSets - An array of the flagSet names we want to get the treatments.
|
|
1101
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1102
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1103
|
+
*/
|
|
1104
|
+
getTreatmentsWithConfigByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): TreatmentsWithConfig;
|
|
1064
1105
|
/**
|
|
1065
1106
|
* Tracks an event to be fed to the results product on Split user interface.
|
|
1066
1107
|
* @function track
|
|
@@ -1121,6 +1162,46 @@ export declare namespace SplitIO {
|
|
|
1121
1162
|
* @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects.
|
|
1122
1163
|
*/
|
|
1123
1164
|
getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig;
|
|
1165
|
+
/**
|
|
1166
|
+
* 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.
|
|
1167
|
+
* For usage on NodeJS as we don't have only one key.
|
|
1168
|
+
* @function getTreatmentsByFlagSet
|
|
1169
|
+
* @param {string} key - The string key representing the consumer.
|
|
1170
|
+
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
1171
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1172
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1173
|
+
*/
|
|
1174
|
+
getTreatmentsByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): AsyncTreatments;
|
|
1175
|
+
/**
|
|
1176
|
+
* 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.
|
|
1177
|
+
* For usage on NodeJS as we don't have only one key.
|
|
1178
|
+
* @function getTreatmentsWithConfigByFlagSet
|
|
1179
|
+
* @param {string} key - The string key representing the consumer.
|
|
1180
|
+
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
1181
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1182
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1183
|
+
*/
|
|
1184
|
+
getTreatmentsWithConfigByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): AsyncTreatmentsWithConfig;
|
|
1185
|
+
/**
|
|
1186
|
+
* 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.
|
|
1187
|
+
* For usage on NodeJS as we don't have only one key.
|
|
1188
|
+
* @function getTreatmentsByFlagSets
|
|
1189
|
+
* @param {string} key - The string key representing the consumer.
|
|
1190
|
+
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
1191
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1192
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1193
|
+
*/
|
|
1194
|
+
getTreatmentsByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): AsyncTreatments;
|
|
1195
|
+
/**
|
|
1196
|
+
* 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.
|
|
1197
|
+
* For usage on NodeJS as we don't have only one key.
|
|
1198
|
+
* @function getTreatmentsWithConfigByFlagSets
|
|
1199
|
+
* @param {string} key - The string key representing the consumer.
|
|
1200
|
+
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
1201
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1202
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1203
|
+
*/
|
|
1204
|
+
getTreatmentsWithConfigByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): AsyncTreatmentsWithConfig;
|
|
1124
1205
|
/**
|
|
1125
1206
|
* 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).
|
|
1126
1207
|
* @function track
|
|
@@ -1171,6 +1252,38 @@ export declare namespace SplitIO {
|
|
|
1171
1252
|
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1172
1253
|
*/
|
|
1173
1254
|
getTreatmentsWithConfig(featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig;
|
|
1255
|
+
/**
|
|
1256
|
+
* Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
|
|
1257
|
+
* @function getTreatmentsByFlagSet
|
|
1258
|
+
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
1259
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1260
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1261
|
+
*/
|
|
1262
|
+
getTreatmentsByFlagSet(flagSet: string, attributes?: Attributes): Treatments;
|
|
1263
|
+
/**
|
|
1264
|
+
* 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.
|
|
1265
|
+
* @function getTreatmentsWithConfigByFlagSet
|
|
1266
|
+
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
1267
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1268
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1269
|
+
*/
|
|
1270
|
+
getTreatmentsWithConfigByFlagSet(flagSet: string, attributes?: Attributes): TreatmentsWithConfig;
|
|
1271
|
+
/**
|
|
1272
|
+
* 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.
|
|
1273
|
+
* @function getTreatmentsByFlagSets
|
|
1274
|
+
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
1275
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1276
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1277
|
+
*/
|
|
1278
|
+
getTreatmentsByFlagSets(flagSets: string[], attributes?: Attributes): Treatments;
|
|
1279
|
+
/**
|
|
1280
|
+
* 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.
|
|
1281
|
+
* @function getTreatmentsWithConfigByFlagSets
|
|
1282
|
+
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
1283
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1284
|
+
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1285
|
+
*/
|
|
1286
|
+
getTreatmentsWithConfigByFlagSets(flagSets: string[], attributes?: Attributes): TreatmentsWithConfig;
|
|
1174
1287
|
/**
|
|
1175
1288
|
* Tracks an event to be fed to the results product on Split user interface.
|
|
1176
1289
|
* @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;
|
|
@@ -5,7 +5,6 @@ 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
|
|
9
8
|
* @returns it returns an object with the following properties:
|
|
10
9
|
* - `validFilters`: the validated `splitFilters` configuration object defined by the user.
|
|
11
10
|
* - `queryString`: the parsed split filter query. it is null if all filters are invalid or all values in filters are invalid.
|
|
@@ -13,4 +12,5 @@ import { ILogger } from '../../logger/types';
|
|
|
13
12
|
*
|
|
14
13
|
* @throws Error if the some of the grouped list of values per filter exceeds the max allowed length
|
|
15
14
|
*/
|
|
16
|
-
export declare function validateSplitFilters(log: ILogger, maybeSplitFilters: any
|
|
15
|
+
export declare function validateSplitFilters(log: ILogger, maybeSplitFilters: any): ISplitFiltersValidation;
|
|
16
|
+
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
|