@splitsoftware/splitio-commons 1.9.2-rc.1 → 1.9.2
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 +4 -0
- package/cjs/evaluator/index.js +1 -18
- package/cjs/logger/constants.js +2 -7
- package/cjs/logger/messages/error.js +0 -2
- package/cjs/logger/messages/info.js +1 -1
- package/cjs/logger/messages/warn.js +1 -4
- package/cjs/sdkClient/client.js +0 -33
- package/cjs/sdkClient/clientAttributesDecoration.js +0 -20
- package/cjs/sdkClient/clientCS.js +4 -5
- package/cjs/sdkClient/clientInputValidation.js +3 -52
- package/cjs/sdkClient/sdkClientMethodCS.js +2 -2
- package/cjs/sdkClient/sdkClientMethodCSWithTT.js +1 -1
- package/cjs/sdkManager/index.js +1 -2
- package/cjs/services/splitApi.js +1 -7
- package/cjs/storages/KeyBuilder.js +0 -3
- package/cjs/storages/KeyBuilderSS.js +0 -4
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +27 -63
- 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 +2 -47
- package/cjs/storages/inRedis/SplitsCacheInRedis.js +0 -11
- package/cjs/storages/pluggable/SplitsCachePluggable.js +0 -11
- package/cjs/sync/polling/syncTasks/splitsSyncTask.js +1 -1
- package/cjs/sync/polling/updaters/splitChangesUpdater.js +4 -24
- package/cjs/sync/submitters/telemetrySubmitter.js +1 -15
- package/cjs/utils/constants/index.js +2 -6
- package/cjs/utils/lang/sets.js +1 -9
- package/cjs/utils/settingsValidation/index.js +1 -1
- package/cjs/utils/settingsValidation/splitFilters.js +2 -72
- package/esm/evaluator/index.js +0 -16
- package/esm/logger/constants.js +0 -5
- package/esm/logger/messages/error.js +0 -2
- package/esm/logger/messages/info.js +1 -1
- package/esm/logger/messages/warn.js +1 -4
- package/esm/sdkClient/client.js +2 -35
- package/esm/sdkClient/clientAttributesDecoration.js +0 -20
- package/esm/sdkClient/clientCS.js +4 -5
- package/esm/sdkClient/clientInputValidation.js +3 -52
- package/esm/sdkClient/sdkClientMethodCS.js +2 -2
- package/esm/sdkClient/sdkClientMethodCSWithTT.js +1 -1
- package/esm/sdkManager/index.js +1 -2
- package/esm/services/splitApi.js +1 -7
- package/esm/storages/KeyBuilder.js +0 -3
- package/esm/storages/KeyBuilderSS.js +0 -4
- package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +27 -63
- 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 +2 -47
- package/esm/storages/inRedis/SplitsCacheInRedis.js +0 -11
- package/esm/storages/pluggable/SplitsCachePluggable.js +0 -11
- package/esm/sync/polling/syncTasks/splitsSyncTask.js +1 -1
- package/esm/sync/polling/updaters/splitChangesUpdater.js +4 -24
- package/esm/sync/submitters/telemetrySubmitter.js +1 -15
- package/esm/utils/constants/index.js +0 -4
- package/esm/utils/lang/sets.js +0 -7
- package/esm/utils/settingsValidation/index.js +1 -1
- package/esm/utils/settingsValidation/splitFilters.js +2 -71
- package/package.json +1 -1
- package/src/dtos/types.ts +2 -3
- package/src/evaluator/index.ts +0 -24
- package/src/logger/constants.ts +0 -5
- package/src/logger/messages/error.ts +0 -2
- package/src/logger/messages/info.ts +1 -1
- package/src/logger/messages/warn.ts +1 -4
- package/src/sdkClient/client.ts +2 -42
- package/src/sdkClient/clientAttributesDecoration.ts +0 -24
- package/src/sdkClient/clientCS.ts +4 -5
- package/src/sdkClient/clientInputValidation.ts +4 -56
- package/src/sdkClient/sdkClientMethodCS.ts +2 -2
- package/src/sdkClient/sdkClientMethodCSWithTT.ts +1 -1
- package/src/sdkManager/index.ts +1 -2
- package/src/services/splitApi.ts +1 -6
- package/src/storages/AbstractSegmentsCacheSync.ts +1 -0
- package/src/storages/AbstractSplitsCacheAsync.ts +0 -2
- package/src/storages/AbstractSplitsCacheSync.ts +0 -3
- package/src/storages/KeyBuilder.ts +0 -4
- package/src/storages/KeyBuilderSS.ts +0 -4
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +28 -74
- 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 +1 -50
- package/src/storages/inRedis/SplitsCacheInRedis.ts +0 -12
- package/src/storages/pluggable/SplitsCachePluggable.ts +0 -12
- package/src/storages/types.ts +3 -7
- package/src/sync/polling/syncTasks/splitsSyncTask.ts +0 -1
- package/src/sync/polling/updaters/splitChangesUpdater.ts +4 -27
- package/src/sync/submitters/telemetrySubmitter.ts +2 -19
- package/src/sync/submitters/types.ts +1 -7
- package/src/types.ts +1 -118
- package/src/utils/constants/index.ts +0 -4
- package/src/utils/lang/sets.ts +0 -8
- package/src/utils/settingsValidation/index.ts +1 -1
- package/src/utils/settingsValidation/splitFilters.ts +2 -77
- package/types/dtos/types.d.ts +0 -1
- package/types/evaluator/index.d.ts +0 -1
- package/types/logger/constants.d.ts +0 -5
- package/types/sdkClient/clientAttributesDecoration.d.ts +0 -4
- package/types/sdkClient/identity.d.ts +6 -0
- package/types/sdkClient/sdkClientMethodCS.d.ts +2 -2
- package/types/sdkClient/sdkClientMethodCSWithTT.d.ts +1 -1
- package/types/storages/AbstractSegmentsCacheSync.d.ts +1 -0
- package/types/storages/AbstractSplitsCacheAsync.d.ts +0 -2
- package/types/storages/AbstractSplitsCacheSync.d.ts +0 -2
- package/types/storages/KeyBuilder.d.ts +0 -1
- package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +1 -6
- package/types/storages/inMemory/SplitsCacheInMemory.d.ts +1 -9
- package/types/storages/inRedis/SplitsCacheInRedis.d.ts +0 -8
- package/types/storages/pluggable/SplitsCachePluggable.d.ts +0 -8
- package/types/storages/types.d.ts +0 -4
- package/types/sync/polling/updaters/splitChangesUpdater.d.ts +3 -3
- package/types/sync/submitters/types.d.ts +1 -7
- package/types/types.d.ts +1 -118
- package/types/utils/constants/index.d.ts +0 -4
- package/types/utils/inputValidation/sdkKey.d.ts +7 -0
- package/types/utils/lang/sets.d.ts +0 -1
- package/types/utils/settingsValidation/splitFilters.d.ts +0 -1
- package/types/myLogger.d.ts +0 -5
- package/types/sdkClient/types.d.ts +0 -18
- package/types/storages/inMemory/CountsCacheInMemory.d.ts +0 -20
- package/types/storages/inMemory/LatenciesCacheInMemory.d.ts +0 -20
- package/types/storages/inRedis/CountsCacheInRedis.d.ts +0 -9
- package/types/storages/inRedis/LatenciesCacheInRedis.d.ts +0 -9
- package/types/storages/metadataBuilder.d.ts +0 -3
- package/types/sync/offline/LocalhostFromFile.d.ts +0 -2
- package/types/sync/offline/splitsParser/splitsParserFromFile.d.ts +0 -2
- package/types/sync/offline/updaters/splitChangesUpdater.d.ts +0 -0
- package/types/sync/submitters/eventsSyncTask.d.ts +0 -8
- package/types/sync/submitters/impressionCountsSubmitterInRedis.d.ts +0 -5
- package/types/sync/submitters/impressionCountsSyncTask.d.ts +0 -13
- package/types/sync/submitters/impressionsSyncTask.d.ts +0 -14
- package/types/sync/submitters/metricsSyncTask.d.ts +0 -12
- package/types/sync/submitters/submitterSyncTask.d.ts +0 -10
- package/types/sync/submitters/uniqueKeysSubmitterInRedis.d.ts +0 -5
- package/types/sync/syncTaskComposite.d.ts +0 -5
- package/types/trackers/filter/bloomFilter.d.ts +0 -10
- package/types/trackers/filter/dictionaryFilter.d.ts +0 -8
- package/types/trackers/filter/types.d.ts +0 -5
- package/types/utils/timeTracker/index.d.ts +0 -70
- /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
package/src/types.ts
CHANGED
|
@@ -610,11 +610,6 @@ export namespace SplitIO {
|
|
|
610
610
|
configs: {
|
|
611
611
|
[treatmentName: string]: string
|
|
612
612
|
}
|
|
613
|
-
/**
|
|
614
|
-
* list of sets per feature flag
|
|
615
|
-
* @property {string[]} sets
|
|
616
|
-
*/
|
|
617
|
-
sets?: string[]
|
|
618
613
|
};
|
|
619
614
|
/**
|
|
620
615
|
* A promise that resolves to a feature flag view.
|
|
@@ -714,7 +709,7 @@ export namespace SplitIO {
|
|
|
714
709
|
* SplitFilter type.
|
|
715
710
|
* @typedef {string} SplitFilterType
|
|
716
711
|
*/
|
|
717
|
-
export type SplitFilterType = 'byName' | 'byPrefix'
|
|
712
|
+
export type SplitFilterType = 'byName' | 'byPrefix';
|
|
718
713
|
/**
|
|
719
714
|
* Defines a feature flag filter, described by a type and list of values.
|
|
720
715
|
*/
|
|
@@ -1064,42 +1059,6 @@ export namespace SplitIO {
|
|
|
1064
1059
|
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1065
1060
|
*/
|
|
1066
1061
|
getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig,
|
|
1067
|
-
/**
|
|
1068
|
-
* Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flagSet.
|
|
1069
|
-
* @function getTreatmentsByFlagSet
|
|
1070
|
-
* @param {string} key - The string key representing the consumer.
|
|
1071
|
-
* @param {string} flagSet - The flagSet name we want to get the treatments.
|
|
1072
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1073
|
-
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1074
|
-
*/
|
|
1075
|
-
getTreatmentsByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): Treatments,
|
|
1076
|
-
/**
|
|
1077
|
-
* 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.
|
|
1078
|
-
* @function getTreatmentsWithConfigByFlagSet
|
|
1079
|
-
* @param {string} key - The string key representing the consumer.
|
|
1080
|
-
* @param {string} flagSet - The flagSet name we want to get the treatments.
|
|
1081
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1082
|
-
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1083
|
-
*/
|
|
1084
|
-
getTreatmentsWithConfigByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): TreatmentsWithConfig,
|
|
1085
|
-
/**
|
|
1086
|
-
* 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.
|
|
1087
|
-
* @function getTreatmentsByFlagSets
|
|
1088
|
-
* @param {string} key - The string key representing the consumer.
|
|
1089
|
-
* @param {Array<string>} flagSets - An array of the flagSet names we want to get the treatments.
|
|
1090
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1091
|
-
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1092
|
-
*/
|
|
1093
|
-
getTreatmentsByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): Treatments,
|
|
1094
|
-
/**
|
|
1095
|
-
* 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.
|
|
1096
|
-
* @function getTreatmentsWithConfigByFlagSets
|
|
1097
|
-
* @param {string} key - The string key representing the consumer.
|
|
1098
|
-
* @param {Array<string>} flagSets - An array of the flagSet names we want to get the treatments.
|
|
1099
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1100
|
-
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1101
|
-
*/
|
|
1102
|
-
getTreatmentsWithConfigByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): TreatmentsWithConfig,
|
|
1103
1062
|
/**
|
|
1104
1063
|
* Tracks an event to be fed to the results product on Split user interface.
|
|
1105
1064
|
* @function track
|
|
@@ -1160,46 +1119,6 @@ export namespace SplitIO {
|
|
|
1160
1119
|
* @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects.
|
|
1161
1120
|
*/
|
|
1162
1121
|
getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig,
|
|
1163
|
-
/**
|
|
1164
|
-
* 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.
|
|
1165
|
-
* For usage on NodeJS as we don't have only one key.
|
|
1166
|
-
* @function getTreatmentsByFlagSet
|
|
1167
|
-
* @param {string} key - The string key representing the consumer.
|
|
1168
|
-
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
1169
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1170
|
-
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1171
|
-
*/
|
|
1172
|
-
getTreatmentsByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): AsyncTreatments,
|
|
1173
|
-
/**
|
|
1174
|
-
* 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.
|
|
1175
|
-
* For usage on NodeJS as we don't have only one key.
|
|
1176
|
-
* @function getTreatmentsWithConfigByFlagSet
|
|
1177
|
-
* @param {string} key - The string key representing the consumer.
|
|
1178
|
-
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
1179
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1180
|
-
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1181
|
-
*/
|
|
1182
|
-
getTreatmentsWithConfigByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): AsyncTreatmentsWithConfig,
|
|
1183
|
-
/**
|
|
1184
|
-
* 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.
|
|
1185
|
-
* For usage on NodeJS as we don't have only one key.
|
|
1186
|
-
* @function getTreatmentsByFlagSets
|
|
1187
|
-
* @param {string} key - The string key representing the consumer.
|
|
1188
|
-
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
1189
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1190
|
-
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1191
|
-
*/
|
|
1192
|
-
getTreatmentsByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): AsyncTreatments,
|
|
1193
|
-
/**
|
|
1194
|
-
* 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.
|
|
1195
|
-
* For usage on NodeJS as we don't have only one key.
|
|
1196
|
-
* @function getTreatmentsWithConfigByFlagSets
|
|
1197
|
-
* @param {string} key - The string key representing the consumer.
|
|
1198
|
-
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
1199
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1200
|
-
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1201
|
-
*/
|
|
1202
|
-
getTreatmentsWithConfigByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): AsyncTreatmentsWithConfig,
|
|
1203
1122
|
/**
|
|
1204
1123
|
* 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).
|
|
1205
1124
|
* @function track
|
|
@@ -1250,42 +1169,6 @@ export namespace SplitIO {
|
|
|
1250
1169
|
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1251
1170
|
*/
|
|
1252
1171
|
getTreatmentsWithConfig(featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig,
|
|
1253
|
-
/**
|
|
1254
|
-
* Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
|
|
1255
|
-
* @function getTreatmentsByFlagSet
|
|
1256
|
-
* @param {string} key - The string key representing the consumer.
|
|
1257
|
-
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
1258
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1259
|
-
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1260
|
-
*/
|
|
1261
|
-
getTreatmentsByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): Treatments,
|
|
1262
|
-
/**
|
|
1263
|
-
* 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.
|
|
1264
|
-
* @function getTreatmentsWithConfigByFlagSet
|
|
1265
|
-
* @param {string} key - The string key representing the consumer.
|
|
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(key: SplitKey, 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 {string} key - The string key representing the consumer.
|
|
1275
|
-
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
1276
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1277
|
-
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1278
|
-
*/
|
|
1279
|
-
getTreatmentsByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): Treatments,
|
|
1280
|
-
/**
|
|
1281
|
-
* 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.
|
|
1282
|
-
* @function getTreatmentsWithConfigByFlagSets
|
|
1283
|
-
* @param {string} key - The string key representing the consumer.
|
|
1284
|
-
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
1285
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1286
|
-
* @returns {Treatments} The map with all the TreatmentWithConfig objects
|
|
1287
|
-
*/
|
|
1288
|
-
getTreatmentsWithConfigByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): TreatmentsWithConfig,
|
|
1289
1172
|
/**
|
|
1290
1173
|
* Tracks an event to be fed to the results product on Split user interface.
|
|
1291
1174
|
* @function track
|
|
@@ -65,10 +65,6 @@ export const TREATMENT = 't';
|
|
|
65
65
|
export const TREATMENTS = 'ts';
|
|
66
66
|
export const TREATMENT_WITH_CONFIG = 'tc';
|
|
67
67
|
export const TREATMENTS_WITH_CONFIG = 'tcs';
|
|
68
|
-
export const TREATMENTS_BY_FLAGSET = 'tf';
|
|
69
|
-
export const TREATMENTS_BY_FLAGSETS = 'tfs';
|
|
70
|
-
export const TREATMENTS_WITH_CONFIG_BY_FLAGSET = 'tcf';
|
|
71
|
-
export const TREATMENTS_WITH_CONFIG_BY_FLAGSETS = 'tcfs';
|
|
72
68
|
export const TRACK = 'tr';
|
|
73
69
|
|
|
74
70
|
export const CONNECTION_ESTABLISHED = 0;
|
package/src/utils/lang/sets.ts
CHANGED
|
@@ -111,11 +111,3 @@ export function __getSetConstructor(): ISetConstructor {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
export const _Set = __getSetConstructor();
|
|
114
|
-
|
|
115
|
-
export function returnSetsUnion<T>(set: ISet<T>, set2: ISet<T>): ISet<T> {
|
|
116
|
-
const result = new _Set(setToArray(set));
|
|
117
|
-
set2.forEach( value => {
|
|
118
|
-
result.add(value);
|
|
119
|
-
});
|
|
120
|
-
return result;
|
|
121
|
-
}
|
|
@@ -160,7 +160,7 @@ export function settingsValidation(config: unknown, validationParams: ISettingsV
|
|
|
160
160
|
withDefaults.core.key = 'localhost_key';
|
|
161
161
|
} else {
|
|
162
162
|
// Keeping same behaviour than JS SDK: if settings key or TT are invalid,
|
|
163
|
-
// `false` value is used as
|
|
163
|
+
// `false` value is used as bound key/TT of the default client, which leads to some issues.
|
|
164
164
|
// @ts-ignore, @TODO handle invalid keys as a non-recoverable error?
|
|
165
165
|
withDefaults.core.key = validateKey(log, maybeKey, 'Client instantiation');
|
|
166
166
|
}
|
|
@@ -3,18 +3,11 @@ import { validateSplits } from '../inputValidation/splits';
|
|
|
3
3
|
import { ISplitFiltersValidation } from '../../dtos/types';
|
|
4
4
|
import { SplitIO } from '../../types';
|
|
5
5
|
import { ILogger } from '../../logger/types';
|
|
6
|
-
import { WARN_SPLITS_FILTER_IGNORED, WARN_SPLITS_FILTER_EMPTY, WARN_SPLITS_FILTER_INVALID, SETTINGS_SPLITS_FILTER, LOG_PREFIX_SETTINGS
|
|
7
|
-
import { objectAssign } from '../lang/objectAssign';
|
|
8
|
-
import { find, uniq } from '../lang';
|
|
6
|
+
import { WARN_SPLITS_FILTER_IGNORED, WARN_SPLITS_FILTER_EMPTY, WARN_SPLITS_FILTER_INVALID, SETTINGS_SPLITS_FILTER, LOG_PREFIX_SETTINGS } from '../../logger/constants';
|
|
9
7
|
|
|
10
8
|
// Split filters metadata.
|
|
11
9
|
// Ordered according to their precedency when forming the filter query string: `&names=<values>&prefixes=<values>`
|
|
12
10
|
const FILTERS_METADATA = [
|
|
13
|
-
{
|
|
14
|
-
type: 'bySet' as SplitIO.SplitFilterType,
|
|
15
|
-
maxLength: 50,
|
|
16
|
-
queryParam: 'sets='
|
|
17
|
-
},
|
|
18
11
|
{
|
|
19
12
|
type: 'byName' as SplitIO.SplitFilterType,
|
|
20
13
|
maxLength: 400,
|
|
@@ -27,9 +20,6 @@ const FILTERS_METADATA = [
|
|
|
27
20
|
}
|
|
28
21
|
];
|
|
29
22
|
|
|
30
|
-
const VALID_FLAGSET_REGEX = /^[a-z0-9][_a-z0-9]{0,49}$/;
|
|
31
|
-
const CAPITAL_LETTERS_REGEX = /[A-Z]/;
|
|
32
|
-
|
|
33
23
|
/**
|
|
34
24
|
* Validates that the given value is a valid filter type
|
|
35
25
|
*/
|
|
@@ -52,11 +42,6 @@ function validateSplitFilter(log: ILogger, type: SplitIO.SplitFilterType, values
|
|
|
52
42
|
let result = validateSplits(log, values, LOG_PREFIX_SETTINGS, `${type} filter`, `${type} filter value`);
|
|
53
43
|
|
|
54
44
|
if (result) {
|
|
55
|
-
|
|
56
|
-
if (type === 'bySet') {
|
|
57
|
-
result = sanitizeFlagSets(log, result);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
45
|
// check max length
|
|
61
46
|
if (result.length > maxLength) throw new Error(`${maxLength} unique values can be specified at most for '${type}' filter. You passed ${result.length}. Please consider reducing the amount or using other filter.`);
|
|
62
47
|
|
|
@@ -87,43 +72,6 @@ function queryStringBuilder(groupedFilters: Record<SplitIO.SplitFilterType, stri
|
|
|
87
72
|
return queryParams.length > 0 ? '&' + queryParams.join('&') : null;
|
|
88
73
|
}
|
|
89
74
|
|
|
90
|
-
/**
|
|
91
|
-
* Sanitizes set names list taking in account:
|
|
92
|
-
* - It should be lowercase
|
|
93
|
-
* - Must adhere the following regular expression /^[a-z0-9][_a-z0-9]{0,49}$/ that means
|
|
94
|
-
* - must start with a letter or number
|
|
95
|
-
* - Be in lowercase
|
|
96
|
-
* - Be alphanumeric
|
|
97
|
-
* - have a max length of 50 characters
|
|
98
|
-
*
|
|
99
|
-
* @param {ILogger} log
|
|
100
|
-
* @param {string[]} flagSets
|
|
101
|
-
* @returns sanitized list of set names
|
|
102
|
-
*/
|
|
103
|
-
function sanitizeFlagSets(log: ILogger, flagSets: string[]) {
|
|
104
|
-
let sanitizedSets = flagSets
|
|
105
|
-
.map(flagSet => {
|
|
106
|
-
if (CAPITAL_LETTERS_REGEX.test(flagSet)){
|
|
107
|
-
log.warn(WARN_SPLITS_FILTER_LOWERCASE_SET,[flagSet]);
|
|
108
|
-
flagSet = flagSet.toLowerCase();
|
|
109
|
-
}
|
|
110
|
-
return flagSet;
|
|
111
|
-
})
|
|
112
|
-
.filter(flagSet => {
|
|
113
|
-
if (!VALID_FLAGSET_REGEX.test(flagSet)){
|
|
114
|
-
log.warn(WARN_SPLITS_FILTER_INVALID_SET, [flagSet,VALID_FLAGSET_REGEX,flagSet]);
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
if (typeof flagSet !== 'string') return false;
|
|
118
|
-
return true;
|
|
119
|
-
});
|
|
120
|
-
return uniq(sanitizedSets);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function configuredFilter(validFilters: SplitIO.SplitFilter[], filterType: SplitIO.SplitFilterType) {
|
|
124
|
-
return find(validFilters, (filter: SplitIO.SplitFilter) => filter.type === filterType && filter.values.length > 0);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
75
|
/**
|
|
128
76
|
* Validates `splitFilters` configuration object and parses it into a query string for filtering splits on `/splitChanges` fetch.
|
|
129
77
|
*
|
|
@@ -142,7 +90,7 @@ export function validateSplitFilters(log: ILogger, maybeSplitFilters: any, mode:
|
|
|
142
90
|
const res = {
|
|
143
91
|
validFilters: [],
|
|
144
92
|
queryString: null,
|
|
145
|
-
groupedFilters: {
|
|
93
|
+
groupedFilters: { byName: [], byPrefix: [] }
|
|
146
94
|
} as ISplitFiltersValidation;
|
|
147
95
|
|
|
148
96
|
// do nothing if `splitFilters` param is not a non-empty array or mode is not STANDALONE
|
|
@@ -174,32 +122,9 @@ export function validateSplitFilters(log: ILogger, maybeSplitFilters: any, mode:
|
|
|
174
122
|
if (res.groupedFilters[type].length > 0) res.groupedFilters[type] = validateSplitFilter(log, type, res.groupedFilters[type], maxLength);
|
|
175
123
|
});
|
|
176
124
|
|
|
177
|
-
const setFilter = configuredFilter(res.validFilters, 'bySet');
|
|
178
|
-
// Clean all filters if set filter is present
|
|
179
|
-
if (setFilter) {
|
|
180
|
-
if (configuredFilter(res.validFilters, 'byName') || configuredFilter(res.validFilters, 'byPrefix')) log.error(ERROR_SETS_FILTER_EXCLUSIVE);
|
|
181
|
-
objectAssign(res.groupedFilters, { byName: [], byPrefix: [] });
|
|
182
|
-
}
|
|
183
|
-
|
|
184
125
|
// build query string
|
|
185
126
|
res.queryString = queryStringBuilder(res.groupedFilters);
|
|
186
127
|
log.debug(SETTINGS_SPLITS_FILTER, [res.queryString]);
|
|
187
128
|
|
|
188
129
|
return res;
|
|
189
130
|
}
|
|
190
|
-
|
|
191
|
-
export function flagSetsAreValid(log: ILogger, method: string, flagSets: string[], flagSetsInConfig: string[]): string[] {
|
|
192
|
-
const sets = validateSplits(log, flagSets, method, 'flag sets', 'flag set');
|
|
193
|
-
let toReturn = sets ? sanitizeFlagSets(log, sets) : [];
|
|
194
|
-
if (flagSetsInConfig.length > 0) {
|
|
195
|
-
toReturn = toReturn.filter(flagSet => {
|
|
196
|
-
if (flagSetsInConfig.indexOf(flagSet) > -1) {
|
|
197
|
-
return true;
|
|
198
|
-
}
|
|
199
|
-
log.warn(WARN_FLAGSET_NOT_CONFIGURED, [method, flagSet]);
|
|
200
|
-
return false;
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
return toReturn;
|
|
205
|
-
}
|
package/types/dtos/types.d.ts
CHANGED
|
@@ -132,7 +132,6 @@ export interface ISplit {
|
|
|
132
132
|
configurations?: {
|
|
133
133
|
[treatmentName: string]: string;
|
|
134
134
|
};
|
|
135
|
-
sets?: string[];
|
|
136
135
|
}
|
|
137
136
|
export declare type ISplitPartial = Pick<ISplit, 'conditions' | 'configurations' | 'trafficTypeName'>;
|
|
138
137
|
/** Interface of the parsed JSON response of `/splitChanges` */
|
|
@@ -5,4 +5,3 @@ 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>>;
|
|
@@ -95,9 +95,6 @@ export declare const WARN_SPLITS_FILTER_EMPTY = 221;
|
|
|
95
95
|
export declare const WARN_SDK_KEY = 222;
|
|
96
96
|
export declare const STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2 = 223;
|
|
97
97
|
export declare const STREAMING_PARSING_SPLIT_UPDATE = 224;
|
|
98
|
-
export declare const WARN_SPLITS_FILTER_INVALID_SET = 225;
|
|
99
|
-
export declare const WARN_SPLITS_FILTER_LOWERCASE_SET = 226;
|
|
100
|
-
export declare const WARN_FLAGSET_NOT_CONFIGURED = 227;
|
|
101
98
|
export declare const ERROR_ENGINE_COMBINER_IFELSEIF = 300;
|
|
102
99
|
export declare const ERROR_LOGLEVEL_INVALID = 301;
|
|
103
100
|
export declare const ERROR_CLIENT_LISTENER = 302;
|
|
@@ -125,8 +122,6 @@ export declare const ERROR_LOCALHOST_MODULE_REQUIRED = 323;
|
|
|
125
122
|
export declare const ERROR_STORAGE_INVALID = 324;
|
|
126
123
|
export declare const ERROR_NOT_BOOLEAN = 325;
|
|
127
124
|
export declare const ERROR_MIN_CONFIG_PARAM = 326;
|
|
128
|
-
export declare const ERROR_TOO_MANY_SETS = 327;
|
|
129
|
-
export declare const ERROR_SETS_FILTER_EXCLUSIVE = 328;
|
|
130
125
|
export declare const LOG_PREFIX_SETTINGS = "settings";
|
|
131
126
|
export declare const LOG_PREFIX_INSTANTIATION = "Factory instantiation";
|
|
132
127
|
export declare const LOG_PREFIX_ENGINE = "engine";
|
|
@@ -8,10 +8,6 @@ export declare function clientAttributesDecoration<TClient extends SplitIO.IClie
|
|
|
8
8
|
getTreatmentWithConfig: (maybeKey: SplitIO.SplitKey, maybeFeatureFlagName: string, maybeAttributes?: SplitIO.Attributes | undefined) => SplitIO.TreatmentWithConfig | SplitIO.AsyncTreatmentWithConfig;
|
|
9
9
|
getTreatments: (maybeKey: SplitIO.SplitKey, maybeFeatureFlagNames: string[], maybeAttributes?: SplitIO.Attributes | undefined) => SplitIO.Treatments | SplitIO.AsyncTreatments;
|
|
10
10
|
getTreatmentsWithConfig: (maybeKey: SplitIO.SplitKey, maybeFeatureFlagNames: string[], maybeAttributes?: SplitIO.Attributes | undefined) => SplitIO.TreatmentsWithConfig | SplitIO.AsyncTreatmentsWithConfig;
|
|
11
|
-
getTreatmentsByFlagSets: (maybeKey: SplitIO.SplitKey, maybeFlagSets: string[], maybeAttributes?: SplitIO.Attributes | undefined) => SplitIO.Treatments | SplitIO.AsyncTreatments;
|
|
12
|
-
getTreatmentsWithConfigByFlagSets: (maybeKey: SplitIO.SplitKey, maybeFlagSets: string[], maybeAttributes?: SplitIO.Attributes | undefined) => SplitIO.TreatmentsWithConfig | SplitIO.AsyncTreatmentsWithConfig;
|
|
13
|
-
getTreatmentsByFlagSet: (maybeKey: SplitIO.SplitKey, maybeFlagSet: string, maybeAttributes?: SplitIO.Attributes | undefined) => SplitIO.Treatments | SplitIO.AsyncTreatments;
|
|
14
|
-
getTreatmentsWithConfigByFlagSet: (maybeKey: SplitIO.SplitKey, maybeFlagSet: string, maybeAttributes?: SplitIO.Attributes | undefined) => SplitIO.TreatmentsWithConfig | SplitIO.AsyncTreatmentsWithConfig;
|
|
15
11
|
track: (maybeKey: SplitIO.SplitKey, maybeTT: string, maybeEvent: string, maybeEventValue?: number | undefined, maybeProperties?: SplitIO.Properties | undefined) => boolean | Promise<boolean>;
|
|
16
12
|
/**
|
|
17
13
|
* Add an attribute to client's in memory attributes storage
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SplitIO } from '../types';
|
|
2
2
|
import { ISdkFactoryContext } from '../sdkFactory/types';
|
|
3
3
|
/**
|
|
4
|
-
* Factory of client method for the client-side API variant where TT is ignored
|
|
5
|
-
* clients don't have a
|
|
4
|
+
* Factory of client method for the client-side API variant where TT is ignored.
|
|
5
|
+
* Therefore, clients don't have a bound TT for the track method.
|
|
6
6
|
*/
|
|
7
7
|
export declare function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: SplitIO.SplitKey) => SplitIO.ICsClient;
|
|
@@ -2,7 +2,7 @@ import { SplitIO } from '../types';
|
|
|
2
2
|
import { ISdkFactoryContext } from '../sdkFactory/types';
|
|
3
3
|
/**
|
|
4
4
|
* Factory of client method for the client-side (browser) variant of the Isomorphic JS SDK,
|
|
5
|
-
* where clients can have a
|
|
5
|
+
* where clients can have a bound TT for the track method, which is provided via the settings
|
|
6
6
|
* (default client) or the client method (shared clients).
|
|
7
7
|
*/
|
|
8
8
|
export declare function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: SplitIO.SplitKey, trafficType?: string) => SplitIO.ICsClient;
|
|
@@ -35,6 +35,7 @@ export declare abstract class AbstractSegmentsCacheSync implements ISegmentsCach
|
|
|
35
35
|
abstract getRegisteredSegments(): string[];
|
|
36
36
|
/**
|
|
37
37
|
* Only used for the `skC`(segment keys count) telemetry stat: 1 for client-side, and total count of keys in server-side.
|
|
38
|
+
* @TODO for client-side it should be the number of clients, but it requires a refactor of MySegments caches to simplify the code.
|
|
38
39
|
*/
|
|
39
40
|
abstract getKeysCount(): number;
|
|
40
41
|
/**
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ISplitsCacheAsync } from './types';
|
|
2
2
|
import { ISplit } from '../dtos/types';
|
|
3
|
-
import { ISet } from '../utils/lang/sets';
|
|
4
3
|
/**
|
|
5
4
|
* This class provides a skeletal implementation of the ISplitsCacheAsync interface
|
|
6
5
|
* to minimize the effort required to implement this interface.
|
|
@@ -15,7 +14,6 @@ export declare abstract class AbstractSplitsCacheAsync implements ISplitsCacheAs
|
|
|
15
14
|
abstract getChangeNumber(): Promise<number>;
|
|
16
15
|
abstract getAll(): Promise<ISplit[]>;
|
|
17
16
|
abstract getSplitNames(): Promise<string[]>;
|
|
18
|
-
abstract getNamesByFlagSets(flagSets: string[]): Promise<ISet<string>>;
|
|
19
17
|
abstract trafficTypeExists(trafficType: string): Promise<boolean>;
|
|
20
18
|
abstract clear(): Promise<boolean | void>;
|
|
21
19
|
usesSegments(): Promise<boolean>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ISplitsCacheSync } from './types';
|
|
2
2
|
import { ISplit } from '../dtos/types';
|
|
3
|
-
import { ISet } from '../utils/lang/sets';
|
|
4
3
|
/**
|
|
5
4
|
* This class provides a skeletal implementation of the ISplitsCacheSync interface
|
|
6
5
|
* to minimize the effort required to implement this interface.
|
|
@@ -35,7 +34,6 @@ export declare abstract class AbstractSplitsCacheSync implements ISplitsCacheSyn
|
|
|
35
34
|
* 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
35
|
*/
|
|
37
36
|
killLocally(name: string, defaultTreatment: string, changeNumber: number): boolean;
|
|
38
|
-
abstract getNamesByFlagSets(flagSets: string[]): ISet<string>;
|
|
39
37
|
}
|
|
40
38
|
/**
|
|
41
39
|
* Given a parsed split, it returns a boolean flagging if its conditions use segments matchers (rules & whitelists).
|
|
@@ -3,7 +3,6 @@ export declare class KeyBuilder {
|
|
|
3
3
|
protected readonly prefix: string;
|
|
4
4
|
constructor(prefix?: string);
|
|
5
5
|
buildTrafficTypeKey(trafficType: string): string;
|
|
6
|
-
buildFlagSetKey(flagSet: string): string;
|
|
7
6
|
buildSplitKey(splitName: string): string;
|
|
8
7
|
buildSplitsTillKey(): string;
|
|
9
8
|
isSplitKey(key: string): boolean;
|
|
@@ -2,7 +2,6 @@ import { ISplit, ISplitFiltersValidation } from '../../dtos/types';
|
|
|
2
2
|
import { AbstractSplitsCacheSync } from '../AbstractSplitsCacheSync';
|
|
3
3
|
import { KeyBuilderCS } from '../KeyBuilderCS';
|
|
4
4
|
import { ILogger } from '../../logger/types';
|
|
5
|
-
import { ISet } from '../../utils/lang/sets';
|
|
6
5
|
/**
|
|
7
6
|
* ISplitsCacheSync implementation that stores split definitions in browser LocalStorage.
|
|
8
7
|
*/
|
|
@@ -10,8 +9,8 @@ export declare class SplitsCacheInLocal extends AbstractSplitsCacheSync {
|
|
|
10
9
|
private readonly log;
|
|
11
10
|
private readonly keys;
|
|
12
11
|
private readonly splitFiltersValidation;
|
|
13
|
-
private readonly flagSetsFilter;
|
|
14
12
|
private hasSync?;
|
|
13
|
+
private cacheReadyButNeedsToFlush;
|
|
15
14
|
private updateNewFilter?;
|
|
16
15
|
/**
|
|
17
16
|
* @param {KeyBuilderCS} keys
|
|
@@ -48,8 +47,4 @@ export declare class SplitsCacheInLocal extends AbstractSplitsCacheSync {
|
|
|
48
47
|
*/
|
|
49
48
|
private _checkExpiration;
|
|
50
49
|
private _checkFilterQuery;
|
|
51
|
-
getNamesByFlagSets(flagSets: string[]): ISet<string>;
|
|
52
|
-
private addToFlagSets;
|
|
53
|
-
private removeFromFlagSets;
|
|
54
|
-
private removeNames;
|
|
55
50
|
}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import { ISplit
|
|
1
|
+
import { ISplit } from '../../dtos/types';
|
|
2
2
|
import { AbstractSplitsCacheSync } from '../AbstractSplitsCacheSync';
|
|
3
|
-
import { ISet } from '../../utils/lang/sets';
|
|
4
3
|
/**
|
|
5
4
|
* Default ISplitsCacheSync implementation that stores split definitions in memory.
|
|
6
5
|
* Supported by all JS runtimes.
|
|
7
6
|
*/
|
|
8
7
|
export declare class SplitsCacheInMemory extends AbstractSplitsCacheSync {
|
|
9
|
-
private flagSetsFilter;
|
|
10
8
|
private splitsCache;
|
|
11
9
|
private ttCache;
|
|
12
10
|
private changeNumber;
|
|
13
11
|
private splitsWithSegmentsCount;
|
|
14
|
-
private flagSetsCache;
|
|
15
|
-
constructor(splitFiltersValidation?: ISplitFiltersValidation);
|
|
16
12
|
clear(): void;
|
|
17
13
|
addSplit(name: string, split: ISplit): boolean;
|
|
18
14
|
removeSplit(name: string): boolean;
|
|
@@ -22,8 +18,4 @@ export declare class SplitsCacheInMemory extends AbstractSplitsCacheSync {
|
|
|
22
18
|
getSplitNames(): string[];
|
|
23
19
|
trafficTypeExists(trafficType: string): boolean;
|
|
24
20
|
usesSegments(): boolean;
|
|
25
|
-
getNamesByFlagSets(flagSets: string[]): ISet<string>;
|
|
26
|
-
private addToFlagSets;
|
|
27
|
-
private removeFromFlagSets;
|
|
28
|
-
private removeNames;
|
|
29
21
|
}
|
|
@@ -3,7 +3,6 @@ import { Redis } from 'ioredis';
|
|
|
3
3
|
import { ILogger } from '../../logger/types';
|
|
4
4
|
import { ISplit } from '../../dtos/types';
|
|
5
5
|
import { AbstractSplitsCacheAsync } from '../AbstractSplitsCacheAsync';
|
|
6
|
-
import { ISet } from '../../utils/lang/sets';
|
|
7
6
|
/**
|
|
8
7
|
* ISplitsCacheAsync implementation that stores split definitions in Redis.
|
|
9
8
|
* Supported by Node.
|
|
@@ -72,13 +71,6 @@ export declare class SplitsCacheInRedis extends AbstractSplitsCacheAsync {
|
|
|
72
71
|
* or rejected if redis operation fails.
|
|
73
72
|
*/
|
|
74
73
|
getSplitNames(): Promise<string[]>;
|
|
75
|
-
/**
|
|
76
|
-
* Get list of split names related to a given flag set names list.
|
|
77
|
-
* The returned promise is resolved with the list of split names,
|
|
78
|
-
* or rejected if wrapper operation fails.
|
|
79
|
-
* @todo this is a no-op method to be implemented
|
|
80
|
-
*/
|
|
81
|
-
getNamesByFlagSets(): Promise<ISet<string>>;
|
|
82
74
|
/**
|
|
83
75
|
* Check traffic type existence.
|
|
84
76
|
* The returned promise is resolved with a boolean indicating whether the TT exist or not.
|
|
@@ -3,7 +3,6 @@ import { IPluggableStorageWrapper } from '../types';
|
|
|
3
3
|
import { ILogger } from '../../logger/types';
|
|
4
4
|
import { ISplit } from '../../dtos/types';
|
|
5
5
|
import { AbstractSplitsCacheAsync } from '../AbstractSplitsCacheAsync';
|
|
6
|
-
import { ISet } from '../../utils/lang/sets';
|
|
7
6
|
/**
|
|
8
7
|
* ISplitsCacheAsync implementation for pluggable storages.
|
|
9
8
|
*/
|
|
@@ -68,13 +67,6 @@ export declare class SplitsCachePluggable extends AbstractSplitsCacheAsync {
|
|
|
68
67
|
* or rejected if wrapper operation fails.
|
|
69
68
|
*/
|
|
70
69
|
getSplitNames(): Promise<string[]>;
|
|
71
|
-
/**
|
|
72
|
-
* Get list of split names related to a given flag set names list.
|
|
73
|
-
* 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
|
-
*/
|
|
77
|
-
getNamesByFlagSets(): Promise<ISet<string>>;
|
|
78
70
|
/**
|
|
79
71
|
* Check traffic type existence.
|
|
80
72
|
* The returned promise is resolved with a boolean indicating whether the TT exist or not.
|
|
@@ -1,7 +1,6 @@
|
|
|
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';
|
|
5
4
|
/**
|
|
6
5
|
* Interface of a pluggable storage wrapper.
|
|
7
6
|
*/
|
|
@@ -193,7 +192,6 @@ export interface ISplitsCacheBase {
|
|
|
193
192
|
clear(): MaybeThenable<boolean | void>;
|
|
194
193
|
checkCache(): MaybeThenable<boolean>;
|
|
195
194
|
killLocally(name: string, defaultTreatment: string, changeNumber: number): MaybeThenable<boolean>;
|
|
196
|
-
getNamesByFlagSets(flagSets: string[]): MaybeThenable<ISet<string>>;
|
|
197
195
|
}
|
|
198
196
|
export interface ISplitsCacheSync extends ISplitsCacheBase {
|
|
199
197
|
addSplits(entries: [string, ISplit][]): boolean[];
|
|
@@ -209,7 +207,6 @@ export interface ISplitsCacheSync extends ISplitsCacheBase {
|
|
|
209
207
|
clear(): void;
|
|
210
208
|
checkCache(): boolean;
|
|
211
209
|
killLocally(name: string, defaultTreatment: string, changeNumber: number): boolean;
|
|
212
|
-
getNamesByFlagSets(flagSets: string[]): ISet<string>;
|
|
213
210
|
}
|
|
214
211
|
export interface ISplitsCacheAsync extends ISplitsCacheBase {
|
|
215
212
|
addSplits(entries: [string, ISplit][]): Promise<boolean[] | void>;
|
|
@@ -225,7 +222,6 @@ export interface ISplitsCacheAsync extends ISplitsCacheBase {
|
|
|
225
222
|
clear(): Promise<boolean | void>;
|
|
226
223
|
checkCache(): Promise<boolean>;
|
|
227
224
|
killLocally(name: string, defaultTreatment: string, changeNumber: number): Promise<boolean>;
|
|
228
|
-
getNamesByFlagSets(flagSets: string[]): Promise<ISet<string>>;
|
|
229
225
|
}
|
|
230
226
|
/** Segments cache */
|
|
231
227
|
export interface ISegmentsCacheBase {
|
|
@@ -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
|
|
4
|
+
import { ISplit } 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[]
|
|
26
|
+
export declare function computeSplitsMutation(entries: ISplit[]): 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[], filters: ISplit
|
|
|
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,
|
|
41
|
+
export declare function splitChangesUpdaterFactory(log: ILogger, splitChangesFetcher: ISplitChangesFetcher, splits: ISplitsCacheBase, segments: ISegmentsCacheBase, splitsEventEmitter?: ISplitsEventEmitter, requestTimeoutBeforeReady?: number, retriesOnFailureBeforeReady?: number, isClientSide?: boolean): ISplitChangesUpdater;
|
|
42
42
|
export {};
|
|
@@ -110,11 +110,7 @@ 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
|
|
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;
|
|
113
|
+
export declare type Method = TREATMENT | TREATMENTS | TREATMENT_WITH_CONFIG | TREATMENTS_WITH_CONFIG | TRACK;
|
|
118
114
|
export declare type MethodLatencies = Partial<Record<Method, Array<number>>>;
|
|
119
115
|
export declare type MethodExceptions = Partial<Record<Method, number>>;
|
|
120
116
|
export declare type CONNECTION_ESTABLISHED = 0;
|
|
@@ -205,8 +201,6 @@ export declare type TelemetryConfigStatsPayload = TelemetryConfigStats & {
|
|
|
205
201
|
nR: number;
|
|
206
202
|
i?: Array<string>;
|
|
207
203
|
uC: number;
|
|
208
|
-
fsT: number;
|
|
209
|
-
fsI: number;
|
|
210
204
|
};
|
|
211
205
|
export interface ISubmitterManager extends ISyncTask {
|
|
212
206
|
start(onlyTelemetry?: boolean): void;
|