@splitsoftware/splitio-commons 1.9.2-rc.1 → 1.9.2-rc.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.
Files changed (132) hide show
  1. package/cjs/evaluator/index.js +1 -18
  2. package/cjs/logger/constants.js +2 -7
  3. package/cjs/logger/messages/error.js +0 -2
  4. package/cjs/logger/messages/info.js +1 -1
  5. package/cjs/logger/messages/warn.js +1 -4
  6. package/cjs/sdkClient/client.js +0 -33
  7. package/cjs/sdkClient/clientAttributesDecoration.js +0 -20
  8. package/cjs/sdkClient/clientCS.js +4 -5
  9. package/cjs/sdkClient/clientInputValidation.js +3 -52
  10. package/cjs/sdkManager/index.js +1 -2
  11. package/cjs/services/splitApi.js +1 -7
  12. package/cjs/storages/KeyBuilder.js +0 -3
  13. package/cjs/storages/KeyBuilderSS.js +0 -4
  14. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +27 -63
  15. package/cjs/storages/inLocalStorage/index.js +2 -2
  16. package/cjs/storages/inMemory/InMemoryStorage.js +2 -2
  17. package/cjs/storages/inMemory/InMemoryStorageCS.js +3 -3
  18. package/cjs/storages/inMemory/SplitsCacheInMemory.js +2 -47
  19. package/cjs/storages/inRedis/SplitsCacheInRedis.js +0 -11
  20. package/cjs/storages/pluggable/SplitsCachePluggable.js +0 -11
  21. package/cjs/sync/polling/syncTasks/splitsSyncTask.js +1 -1
  22. package/cjs/sync/polling/updaters/splitChangesUpdater.js +4 -24
  23. package/cjs/sync/submitters/telemetrySubmitter.js +1 -15
  24. package/cjs/utils/constants/index.js +2 -6
  25. package/cjs/utils/lang/sets.js +1 -9
  26. package/cjs/utils/settingsValidation/splitFilters.js +2 -72
  27. package/esm/evaluator/index.js +0 -16
  28. package/esm/logger/constants.js +0 -5
  29. package/esm/logger/messages/error.js +0 -2
  30. package/esm/logger/messages/info.js +1 -1
  31. package/esm/logger/messages/warn.js +1 -4
  32. package/esm/sdkClient/client.js +2 -35
  33. package/esm/sdkClient/clientAttributesDecoration.js +0 -20
  34. package/esm/sdkClient/clientCS.js +4 -5
  35. package/esm/sdkClient/clientInputValidation.js +3 -52
  36. package/esm/sdkManager/index.js +1 -2
  37. package/esm/services/splitApi.js +1 -7
  38. package/esm/storages/KeyBuilder.js +0 -3
  39. package/esm/storages/KeyBuilderSS.js +0 -4
  40. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +27 -63
  41. package/esm/storages/inLocalStorage/index.js +2 -2
  42. package/esm/storages/inMemory/InMemoryStorage.js +2 -2
  43. package/esm/storages/inMemory/InMemoryStorageCS.js +3 -3
  44. package/esm/storages/inMemory/SplitsCacheInMemory.js +2 -47
  45. package/esm/storages/inRedis/SplitsCacheInRedis.js +0 -11
  46. package/esm/storages/pluggable/SplitsCachePluggable.js +0 -11
  47. package/esm/sync/polling/syncTasks/splitsSyncTask.js +1 -1
  48. package/esm/sync/polling/updaters/splitChangesUpdater.js +4 -24
  49. package/esm/sync/submitters/telemetrySubmitter.js +1 -15
  50. package/esm/utils/constants/index.js +0 -4
  51. package/esm/utils/lang/sets.js +0 -7
  52. package/esm/utils/settingsValidation/splitFilters.js +2 -71
  53. package/package.json +1 -1
  54. package/src/dtos/types.ts +2 -3
  55. package/src/evaluator/index.ts +0 -24
  56. package/src/logger/constants.ts +0 -5
  57. package/src/logger/messages/error.ts +0 -2
  58. package/src/logger/messages/info.ts +1 -1
  59. package/src/logger/messages/warn.ts +1 -4
  60. package/src/sdkClient/client.ts +2 -42
  61. package/src/sdkClient/clientAttributesDecoration.ts +0 -24
  62. package/src/sdkClient/clientCS.ts +4 -5
  63. package/src/sdkClient/clientInputValidation.ts +4 -56
  64. package/src/sdkManager/index.ts +1 -2
  65. package/src/services/splitApi.ts +1 -6
  66. package/src/storages/AbstractSegmentsCacheSync.ts +1 -0
  67. package/src/storages/AbstractSplitsCacheAsync.ts +0 -2
  68. package/src/storages/AbstractSplitsCacheSync.ts +0 -3
  69. package/src/storages/KeyBuilder.ts +0 -4
  70. package/src/storages/KeyBuilderSS.ts +0 -4
  71. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +28 -74
  72. package/src/storages/inLocalStorage/index.ts +2 -2
  73. package/src/storages/inMemory/InMemoryStorage.ts +2 -2
  74. package/src/storages/inMemory/InMemoryStorageCS.ts +3 -3
  75. package/src/storages/inMemory/SplitsCacheInMemory.ts +1 -50
  76. package/src/storages/inRedis/SplitsCacheInRedis.ts +0 -12
  77. package/src/storages/pluggable/SplitsCachePluggable.ts +0 -12
  78. package/src/storages/types.ts +3 -7
  79. package/src/sync/polling/syncTasks/splitsSyncTask.ts +0 -1
  80. package/src/sync/polling/updaters/splitChangesUpdater.ts +4 -27
  81. package/src/sync/submitters/telemetrySubmitter.ts +2 -19
  82. package/src/sync/submitters/types.ts +1 -7
  83. package/src/types.ts +1 -118
  84. package/src/utils/constants/index.ts +0 -4
  85. package/src/utils/lang/sets.ts +0 -8
  86. package/src/utils/settingsValidation/splitFilters.ts +2 -77
  87. package/types/dtos/types.d.ts +0 -1
  88. package/types/evaluator/index.d.ts +0 -1
  89. package/types/logger/constants.d.ts +0 -5
  90. package/types/sdkClient/clientAttributesDecoration.d.ts +0 -4
  91. package/types/sdkClient/identity.d.ts +6 -0
  92. package/types/storages/AbstractSegmentsCacheSync.d.ts +1 -0
  93. package/types/storages/AbstractSplitsCacheAsync.d.ts +0 -2
  94. package/types/storages/AbstractSplitsCacheSync.d.ts +0 -2
  95. package/types/storages/KeyBuilder.d.ts +0 -1
  96. package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +1 -6
  97. package/types/storages/inMemory/SplitsCacheInMemory.d.ts +1 -9
  98. package/types/storages/inRedis/SplitsCacheInRedis.d.ts +0 -8
  99. package/types/storages/pluggable/SplitsCachePluggable.d.ts +0 -8
  100. package/types/storages/types.d.ts +0 -4
  101. package/types/sync/polling/updaters/splitChangesUpdater.d.ts +3 -3
  102. package/types/sync/submitters/types.d.ts +1 -7
  103. package/types/types.d.ts +1 -118
  104. package/types/utils/constants/index.d.ts +0 -4
  105. package/types/utils/inputValidation/sdkKey.d.ts +7 -0
  106. package/types/utils/lang/sets.d.ts +0 -1
  107. package/types/utils/settingsValidation/splitFilters.d.ts +0 -1
  108. package/types/myLogger.d.ts +0 -5
  109. package/types/sdkClient/types.d.ts +0 -18
  110. package/types/storages/inMemory/CountsCacheInMemory.d.ts +0 -20
  111. package/types/storages/inMemory/LatenciesCacheInMemory.d.ts +0 -20
  112. package/types/storages/inRedis/CountsCacheInRedis.d.ts +0 -9
  113. package/types/storages/inRedis/LatenciesCacheInRedis.d.ts +0 -9
  114. package/types/storages/metadataBuilder.d.ts +0 -3
  115. package/types/sync/offline/LocalhostFromFile.d.ts +0 -2
  116. package/types/sync/offline/splitsParser/splitsParserFromFile.d.ts +0 -2
  117. package/types/sync/offline/updaters/splitChangesUpdater.d.ts +0 -0
  118. package/types/sync/submitters/eventsSyncTask.d.ts +0 -8
  119. package/types/sync/submitters/impressionCountsSubmitterInRedis.d.ts +0 -5
  120. package/types/sync/submitters/impressionCountsSyncTask.d.ts +0 -13
  121. package/types/sync/submitters/impressionsSyncTask.d.ts +0 -14
  122. package/types/sync/submitters/metricsSyncTask.d.ts +0 -12
  123. package/types/sync/submitters/submitterSyncTask.d.ts +0 -10
  124. package/types/sync/submitters/uniqueKeysSubmitterInRedis.d.ts +0 -5
  125. package/types/sync/syncTaskComposite.d.ts +0 -5
  126. package/types/trackers/filter/bloomFilter.d.ts +0 -10
  127. package/types/trackers/filter/dictionaryFilter.d.ts +0 -8
  128. package/types/trackers/filter/types.d.ts +0 -5
  129. package/types/utils/timeTracker/index.d.ts +0 -70
  130. /package/types/storages/inMemory/{uniqueKeysCacheInMemory.d.ts → UniqueKeysCacheInMemory.d.ts} +0 -0
  131. /package/types/storages/inMemory/{uniqueKeysCacheInMemoryCS.d.ts → UniqueKeysCacheInMemoryCS.d.ts} +0 -0
  132. /package/types/storages/inRedis/{uniqueKeysCacheInRedis.d.ts → UniqueKeysCacheInRedis.d.ts} +0 -0
package/types/types.d.ts CHANGED
@@ -601,11 +601,6 @@ 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[];
609
604
  };
610
605
  /**
611
606
  * A promise that resolves to a feature flag view.
@@ -711,7 +706,7 @@ export declare namespace SplitIO {
711
706
  * SplitFilter type.
712
707
  * @typedef {string} SplitFilterType
713
708
  */
714
- type SplitFilterType = 'byName' | 'byPrefix' | 'bySet';
709
+ type SplitFilterType = 'byName' | 'byPrefix';
715
710
  /**
716
711
  * Defines a feature flag filter, described by a type and list of values.
717
712
  */
@@ -1061,42 +1056,6 @@ export declare namespace SplitIO {
1061
1056
  * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1062
1057
  */
1063
1058
  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;
1100
1059
  /**
1101
1060
  * Tracks an event to be fed to the results product on Split user interface.
1102
1061
  * @function track
@@ -1157,46 +1116,6 @@ export declare namespace SplitIO {
1157
1116
  * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects.
1158
1117
  */
1159
1118
  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;
1200
1119
  /**
1201
1120
  * 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).
1202
1121
  * @function track
@@ -1247,42 +1166,6 @@ export declare namespace SplitIO {
1247
1166
  * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1248
1167
  */
1249
1168
  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;
1286
1169
  /**
1287
1170
  * Tracks an event to be fed to the results product on Split user interface.
1288
1171
  * @function track
@@ -45,10 +45,6 @@ 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";
52
48
  export declare const TRACK = "tr";
53
49
  export declare const CONNECTION_ESTABLISHED = 0;
54
50
  export declare const OCCUPANCY_PRI = 10;
@@ -0,0 +1,7 @@
1
+ import { ILogger } from '../../logger/types';
2
+ /** validates the given SDK key */
3
+ export declare function validateApiKey(log: ILogger, maybeSdkKey: any): string | false;
4
+ export declare const usedKeysMap: Record<string, number>;
5
+ /** validates the given SDK key and also warns if it is in use */
6
+ export declare function validateAndTrackApiKey(log: ILogger, maybeSdkKey: any): string | false;
7
+ export declare function releaseApiKey(sdkKey: string): void;
@@ -57,5 +57,4 @@ interface ISetConstructor {
57
57
  */
58
58
  export declare function __getSetConstructor(): ISetConstructor;
59
59
  export declare const _Set: ISetConstructor;
60
- export declare function returnSetsUnion<T>(set: ISet<T>, set2: ISet<T>): ISet<T>;
61
60
  export {};
@@ -14,4 +14,3 @@ 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[];
@@ -1,5 +0,0 @@
1
- export declare const myLogger: {
2
- log: (msg: any) => void;
3
- logCsv: (msg: any) => void;
4
- logToFile: (file: any, msg: any) => void;
5
- };
@@ -1,18 +0,0 @@
1
- import { ISignalListener } from '../listeners/types';
2
- import { ISdkReadinessManager } from '../readiness/types';
3
- import { IStorageAsync, IStorageSync } from '../storages/types';
4
- import { ISyncManager } from '../sync/types';
5
- import { IEventTracker, IImpressionsTracker } from '../trackers/types';
6
- import { ISettings } from '../types';
7
- export interface IClientFactoryParams {
8
- storage: IStorageSync | IStorageAsync;
9
- sdkReadinessManager: ISdkReadinessManager;
10
- settings: ISettings;
11
- impressionsTracker: IImpressionsTracker;
12
- eventTracker: IEventTracker;
13
- }
14
- export interface ISdkClientFactoryParams extends IClientFactoryParams {
15
- signalListener?: ISignalListener;
16
- syncManager?: ISyncManager;
17
- sharedClient?: boolean;
18
- }
@@ -1,20 +0,0 @@
1
- import { ICountsCacheSync } from '../types';
2
- export declare class CountsCacheInMemory implements ICountsCacheSync {
3
- private counters;
4
- /**
5
- * Add counts.
6
- */
7
- track(metricName: string): boolean;
8
- /**
9
- * Clear the collector
10
- */
11
- clear(): void;
12
- /**
13
- * Get the collected data, used as payload for posting.
14
- */
15
- state(): Record<string, number>;
16
- /**
17
- * Check if the cache is empty.
18
- */
19
- isEmpty(): boolean;
20
- }
@@ -1,20 +0,0 @@
1
- import { ILatenciesCacheSync } from '../types';
2
- export declare class LatenciesCacheInMemory implements ILatenciesCacheSync {
3
- private counters;
4
- /**
5
- * Add latencies.
6
- */
7
- track(metricName: string, latency: number): boolean;
8
- /**
9
- * Clear the collector
10
- */
11
- clear(): void;
12
- /**
13
- * Get the collected data, used as payload for posting.
14
- */
15
- state(): Record<string, number[]>;
16
- /**
17
- * Check if the cache is empty.
18
- */
19
- isEmpty(): boolean;
20
- }
@@ -1,9 +0,0 @@
1
- import { ICountsCacheAsync } from '../types';
2
- import { KeyBuilderSS } from '../KeyBuilderSS';
3
- import { Redis } from 'ioredis';
4
- export declare class CountsCacheInRedis implements ICountsCacheAsync {
5
- private readonly redis;
6
- private readonly keys;
7
- constructor(keys: KeyBuilderSS, redis: Redis);
8
- track(metricName: string): Promise<boolean>;
9
- }
@@ -1,9 +0,0 @@
1
- import { ILatenciesCacheAsync } from '../types';
2
- import { KeyBuilderSS } from '../KeyBuilderSS';
3
- import { Redis } from 'ioredis';
4
- export declare class LatenciesCacheInRedis implements ILatenciesCacheAsync {
5
- private readonly redis;
6
- private readonly keys;
7
- constructor(keys: KeyBuilderSS, redis: Redis);
8
- track(metricName: string, latency: number): Promise<boolean>;
9
- }
@@ -1,3 +0,0 @@
1
- import { IMetadata } from '../dtos/types';
2
- import { ISettings } from '../types';
3
- export declare function metadataBuilder(settings: Pick<ISettings, 'version' | 'runtime'>): IMetadata;
@@ -1,2 +0,0 @@
1
- import { SplitIO } from '../../types';
2
- export declare function LocalhostFromFile(): SplitIO.LocalhostFactory;
@@ -1,2 +0,0 @@
1
- import { ISplitsParser } from './types';
2
- export declare function splitsParserFromFileFactory(): ISplitsParser;
@@ -1,8 +0,0 @@
1
- import { IEventsCacheSync } from '../../storages/types';
2
- import { IPostEventsBulk } from '../../services/types';
3
- import { ISyncTask, ITimeTracker } from '../types';
4
- import { ILogger } from '../../logger/types';
5
- /**
6
- * Sync task that periodically posts tracked events
7
- */
8
- export declare function eventsSyncTaskFactory(log: ILogger, postEventsBulk: IPostEventsBulk, eventsCache: IEventsCacheSync, eventsPushRate: number, eventsFirstPushWindow: number, latencyTracker?: ITimeTracker): ISyncTask;
@@ -1,5 +0,0 @@
1
- import { ISdkFactoryContextSync } from '../../sdkFactory/types';
2
- /**
3
- * Submitter that periodically posts impression counts
4
- */
5
- export declare function impressionCountsSubmitterInRedisFactory(params: ISdkFactoryContextSync): import("../types").ISyncTask<[], void>;
@@ -1,13 +0,0 @@
1
- import { ISyncTask, ITimeTracker } from '../types';
2
- import { IPostTestImpressionsCount } from '../../services/types';
3
- import { IImpressionCountsCacheSync } from '../../storages/types';
4
- import { ImpressionCountsPayload } from './types';
5
- import { ILogger } from '../../logger/types';
6
- /**
7
- * Converts `impressionCounts` data from cache into request payload.
8
- */
9
- export declare function fromImpressionCountsCollector(impressionsCount: Record<string, number>): ImpressionCountsPayload;
10
- /**
11
- * Sync task that periodically posts impression counts
12
- */
13
- export declare function impressionCountsSyncTaskFactory(log: ILogger, postTestImpressionsCount: IPostTestImpressionsCount, impressionCountsCache: IImpressionCountsCacheSync, latencyTracker?: ITimeTracker): ISyncTask;
@@ -1,14 +0,0 @@
1
- import { ISyncTask, ITimeTracker } from '../types';
2
- import { IPostTestImpressionsBulk } from '../../services/types';
3
- import { IImpressionsCacheSync } from '../../storages/types';
4
- import { ImpressionDTO } from '../../types';
5
- import { ImpressionsPayload } from './types';
6
- import { ILogger } from '../../logger/types';
7
- /**
8
- * Converts `impressions` data from cache into request payload.
9
- */
10
- export declare function fromImpressionsCollector(sendLabels: boolean, data: ImpressionDTO[]): ImpressionsPayload;
11
- /**
12
- * Sync task that periodically posts impressions data
13
- */
14
- export declare function impressionsSyncTaskFactory(log: ILogger, postTestImpressionsBulk: IPostTestImpressionsBulk, impressionsCache: IImpressionsCacheSync, impressionsRefreshRate: number, sendLabels?: boolean, latencyTracker?: ITimeTracker): ISyncTask;
@@ -1,12 +0,0 @@
1
- import { ICountsCacheSync, ILatenciesCacheSync } from '../../storages/types';
2
- import { IPostMetricsCounters, IPostMetricsTimes } from '../../services/types';
3
- import { ISyncTask, ITimeTracker } from '../types';
4
- import { ILogger } from '../../logger/types';
5
- /**
6
- * Sync task that periodically posts telemetry counts
7
- */
8
- export declare function countsSyncTaskFactory(log: ILogger, postMetricsCounters: IPostMetricsCounters, countsCache: ICountsCacheSync, metricsRefreshRate: number, latencyTracker?: ITimeTracker): ISyncTask;
9
- /**
10
- * Sync task that periodically posts telemetry latencies
11
- */
12
- export declare function latenciesSyncTaskFactory(log: ILogger, postMetricsLatencies: IPostMetricsTimes, latenciesCache: ILatenciesCacheSync, metricsRefreshRate: number, latencyTracker?: ITimeTracker): ISyncTask;
@@ -1,10 +0,0 @@
1
- import { ISyncTask, ITimeTracker } from '../types';
2
- import { IRecorderCacheProducerSync } from '../../storages/types';
3
- import { ILogger } from '../../logger/types';
4
- import { IResponse } from '../../services/types';
5
- /**
6
- * Base function to create submitter sync tasks, such as ImpressionsSyncTask and EventsSyncTask
7
- */
8
- export declare function submitterSyncTaskFactory<TState extends {
9
- length?: number;
10
- }>(log: ILogger, postClient: (body: string) => Promise<IResponse>, sourceCache: IRecorderCacheProducerSync<TState>, postRate: number, dataName: string, latencyTracker?: ITimeTracker, fromCacheToPayload?: (cacheData: TState) => any, maxRetries?: number, debugLogs?: boolean): ISyncTask<[], void>;
@@ -1,5 +0,0 @@
1
- import { ISdkFactoryContextSync } from '../../sdkFactory/types';
2
- /**
3
- * Submitter that periodically posts impression counts
4
- */
5
- export declare function uniqueKeysSubmitterInRedisFactory(params: ISdkFactoryContextSync): import("../types").ISyncTask<[], void>;
@@ -1,5 +0,0 @@
1
- import { ISyncTask } from './types';
2
- /**
3
- * Composite Sync Task: group of sync tasks that are treated as a single one.
4
- */
5
- export declare function syncTaskComposite(syncTasks: ISyncTask[]): ISyncTask;
@@ -1,10 +0,0 @@
1
- import { IFilter } from './types';
2
- export declare class BloomFilterImp implements IFilter {
3
- private spectedInsertions;
4
- private errorRate;
5
- private filter;
6
- constructor(spectedInsertions: number, errorRate: number);
7
- add(data: string): boolean;
8
- contains(data: string): boolean;
9
- clear(): void;
10
- }
@@ -1,8 +0,0 @@
1
- import { IFilter } from './types';
2
- export declare class DictionaryFilter implements IFilter {
3
- private filter;
4
- constructor();
5
- add(data: string): boolean;
6
- contains(data: string): boolean;
7
- clear(): void;
8
- }
@@ -1,5 +0,0 @@
1
- export interface IFilter {
2
- add(data: string): boolean;
3
- contains(data: string): boolean;
4
- clear(): void;
5
- }
@@ -1,70 +0,0 @@
1
- import { ILogger } from '../../logger/types';
2
- import { IResponse } from '../../services/types';
3
- interface MetricsCollector {
4
- countException(): void;
5
- count(status: number): void;
6
- latency(ms: number): void;
7
- ready(ms: number): void;
8
- getTreatment(ms: number): void;
9
- getTreatments(ms: number): void;
10
- getTreatmentWithConfig(ms: number): void;
11
- getTreatmentsWithConfig(ms: number): void;
12
- [method: string]: (ms: number) => void;
13
- }
14
- export declare const TrackerAPI: {
15
- /**
16
- * "Private" method, used to attach count/countException and stop callbacks to a promise.
17
- *
18
- * @param {ILogger} log - Logger.
19
- * @param {Promise} promise - The promise we want to attach the callbacks.
20
- * @param {string} task - The name of the task.
21
- * @param {number | string} modifier - (optional) The modifier for the task, if any.
22
- */
23
- __attachToPromise(log: ILogger, promise: Promise<IResponse>, task: string, collector: false | MetricsCollector, modifier?: string | number | undefined): Promise<IResponse>;
24
- /**
25
- * Starts tracking the time for a given task. All tasks tracked are considered "unique" because
26
- * there may be multiple SDK instances tracking a "generic" task, making any task non-generic.
27
- *
28
- * @param {ILogger} log - Logger.
29
- * @param {string} task - The task we are starting.
30
- * @param {Object} collectors - The collectors map.
31
- * @param {Promise} promise - (optional) The promise we are tracking.
32
- * @return {Function | Promise} The stop function for this specific task or the promise received with the callbacks registered.
33
- */
34
- start(log: ILogger, task: string, collectors?: Record<string, MetricsCollector> | undefined, promise?: Promise<IResponse> | undefined, now?: (() => number) | undefined): Promise<IResponse> | (() => number);
35
- /**
36
- * Setup the collector for a task that reports metrics.
37
- *
38
- * @param {string} task - The task name
39
- * @param {number | string} taskUniqueId - The unique identifier for this task
40
- * @param {Object} collectors - The collectors map.
41
- */
42
- setCollectorForTask(task: string, taskUniqueId: number | string, collectors: Record<string, MetricsCollector>): void;
43
- /**
44
- * Stops the tracking of a given task.
45
- *
46
- * @param {ILogger} log - Logger.
47
- * @param {string} task - The task we are starting.
48
- * @param {number | string} modifier - (optional) The modifier for that specific task.
49
- */
50
- stop(log: ILogger, task: string, modifier?: string | number | undefined): number | undefined;
51
- /**
52
- * The constants shortcut for the task names.
53
- */
54
- TaskNames: {
55
- SDK_READY: string;
56
- SDK_GET_TREATMENT: string;
57
- SDK_GET_TREATMENTS: string;
58
- SDK_GET_TREATMENT_WITH_CONFIG: string;
59
- SDK_GET_TREATMENTS_WITH_CONFIG: string;
60
- SPLITS_READY: string;
61
- SEGMENTS_READY: string;
62
- METRICS_PUSH: string;
63
- IMPRESSIONS_PUSH: string;
64
- EVENTS_PUSH: string;
65
- MY_SEGMENTS_FETCH: string;
66
- SEGMENTS_FETCH: string;
67
- SPLITS_FETCH: string;
68
- };
69
- };
70
- export {};