@splitsoftware/splitio-commons 1.9.2-rc.0 → 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.
- 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 -3
- 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/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/splitFilters.js +2 -77
- 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 -3
- 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/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/splitFilters.js +2 -76
- 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 -3
- 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/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/splitFilters.ts +2 -82
- 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/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/cjs/myLogger.js +0 -34
- package/esm/myLogger.js +0 -31
- package/src/myLogger.ts +0 -36
- 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/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'
|
|
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;
|
|
@@ -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[];
|
package/cjs/myLogger.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.myLogger = void 0;
|
|
4
|
-
// get the Console class
|
|
5
|
-
// const { Console } = require('console');
|
|
6
|
-
// get fs module for creating write streams
|
|
7
|
-
var fs = require('fs');
|
|
8
|
-
var pjson = require('../package.json');
|
|
9
|
-
//@ts-ignore
|
|
10
|
-
var pad = function (value) { return ('00' + value).slice(-2); };
|
|
11
|
-
var getDate = function () {
|
|
12
|
-
var date = new Date();
|
|
13
|
-
return date.getFullYear() + "-" + pad(date.getMonth() + 1) + "-" + pad(date.getDate()) + "_" + pad(date.getHours()) + ":" + pad(date.getMinutes()) + ":" + pad(date.getSeconds());
|
|
14
|
-
};
|
|
15
|
-
//@ts-ignore
|
|
16
|
-
var logToFile = function (file, msg) {
|
|
17
|
-
//@ts-ignore
|
|
18
|
-
fs.appendFileSync(file, msg + "\n", function (err) {
|
|
19
|
-
if (err) {
|
|
20
|
-
return console.log(err);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
// make a new logger
|
|
25
|
-
var version = pjson.version.replace('.', '').replace('.', '');
|
|
26
|
-
var filePath = "logs/" + version + "_" + getDate();
|
|
27
|
-
exports.myLogger = {
|
|
28
|
-
//@ts-ignore
|
|
29
|
-
log: function (msg) { return logToFile(filePath, msg); },
|
|
30
|
-
//@ts-ignore
|
|
31
|
-
logCsv: function (msg) { return logToFile(filePath + ".csv", msg); },
|
|
32
|
-
//@ts-ignore
|
|
33
|
-
logToFile: function (file, msg) { return logToFile("logs/" + file, msg); },
|
|
34
|
-
};
|
package/esm/myLogger.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// get the Console class
|
|
2
|
-
// const { Console } = require('console');
|
|
3
|
-
// get fs module for creating write streams
|
|
4
|
-
var fs = require('fs');
|
|
5
|
-
var pjson = require('../package.json');
|
|
6
|
-
//@ts-ignore
|
|
7
|
-
var pad = function (value) { return ('00' + value).slice(-2); };
|
|
8
|
-
var getDate = function () {
|
|
9
|
-
var date = new Date();
|
|
10
|
-
return date.getFullYear() + "-" + pad(date.getMonth() + 1) + "-" + pad(date.getDate()) + "_" + pad(date.getHours()) + ":" + pad(date.getMinutes()) + ":" + pad(date.getSeconds());
|
|
11
|
-
};
|
|
12
|
-
//@ts-ignore
|
|
13
|
-
var logToFile = function (file, msg) {
|
|
14
|
-
//@ts-ignore
|
|
15
|
-
fs.appendFileSync(file, msg + "\n", function (err) {
|
|
16
|
-
if (err) {
|
|
17
|
-
return console.log(err);
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
// make a new logger
|
|
22
|
-
var version = pjson.version.replace('.', '').replace('.', '');
|
|
23
|
-
var filePath = "logs/" + version + "_" + getDate();
|
|
24
|
-
export var myLogger = {
|
|
25
|
-
//@ts-ignore
|
|
26
|
-
log: function (msg) { return logToFile(filePath, msg); },
|
|
27
|
-
//@ts-ignore
|
|
28
|
-
logCsv: function (msg) { return logToFile(filePath + ".csv", msg); },
|
|
29
|
-
//@ts-ignore
|
|
30
|
-
logToFile: function (file, msg) { return logToFile("logs/" + file, msg); },
|
|
31
|
-
};
|
package/src/myLogger.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// get the Console class
|
|
2
|
-
// const { Console } = require('console');
|
|
3
|
-
// get fs module for creating write streams
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
var pjson = require('../package.json');
|
|
6
|
-
|
|
7
|
-
//@ts-ignore
|
|
8
|
-
const pad = (value) => ('00'+value).slice(-2);
|
|
9
|
-
const getDate = () => {
|
|
10
|
-
const date = new Date();
|
|
11
|
-
return `${date.getFullYear()}-${pad(date.getMonth()+1)}-${pad(date.getDate())}_${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
//@ts-ignore
|
|
15
|
-
|
|
16
|
-
const logToFile = (file, msg) => {
|
|
17
|
-
//@ts-ignore
|
|
18
|
-
fs.appendFileSync(file, `${msg}\n`, (err) => {
|
|
19
|
-
if (err) {
|
|
20
|
-
return console.log(err);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// make a new logger
|
|
26
|
-
const version = pjson.version.replace('.','').replace('.','');
|
|
27
|
-
const filePath = `logs/${version}_${getDate()}`;
|
|
28
|
-
export const myLogger = {
|
|
29
|
-
//@ts-ignore
|
|
30
|
-
log: (msg) => logToFile(filePath, msg),
|
|
31
|
-
//@ts-ignore
|
|
32
|
-
logCsv: (msg) => logToFile(`${filePath}.csv`, msg),
|
|
33
|
-
//@ts-ignore
|
|
34
|
-
logToFile: (file, msg) => logToFile(`logs/${file}`, msg),
|
|
35
|
-
};
|
|
36
|
-
|
package/types/myLogger.d.ts
DELETED
|
@@ -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
|
-
}
|
|
File without changes
|
|
@@ -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,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,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,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 {};
|
/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
|