@splitsoftware/splitio-commons 1.6.2-rc.8 → 1.7.0

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 (177) hide show
  1. package/CHANGES.txt +4 -1
  2. package/cjs/evaluator/index.js +5 -5
  3. package/cjs/listeners/browser.js +9 -11
  4. package/cjs/sdkClient/client.js +19 -7
  5. package/cjs/sdkFactory/index.js +7 -25
  6. package/cjs/services/splitApi.js +4 -4
  7. package/cjs/storages/AbstractSplitsCacheAsync.js +1 -1
  8. package/cjs/storages/AbstractSplitsCacheSync.js +1 -1
  9. package/cjs/storages/KeyBuilderSS.js +9 -9
  10. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +0 -1
  11. package/cjs/storages/inLocalStorage/index.js +15 -11
  12. package/cjs/storages/inMemory/InMemoryStorage.js +11 -8
  13. package/cjs/storages/inMemory/InMemoryStorageCS.js +11 -8
  14. package/cjs/storages/inMemory/TelemetryCacheInMemory.js +65 -37
  15. package/cjs/storages/inMemory/{uniqueKeysCacheInMemory.js → UniqueKeysCacheInMemory.js} +24 -25
  16. package/cjs/storages/inMemory/{uniqueKeysCacheInMemoryCS.js → UniqueKeysCacheInMemoryCS.js} +10 -12
  17. package/cjs/storages/inRedis/EventsCacheInRedis.js +1 -1
  18. package/cjs/storages/inRedis/ImpressionCountsCacheInRedis.js +37 -2
  19. package/cjs/storages/inRedis/ImpressionsCacheInRedis.js +2 -19
  20. package/cjs/storages/inRedis/TelemetryCacheInRedis.js +100 -0
  21. package/cjs/storages/inRedis/{uniqueKeysCacheInRedis.js → UniqueKeysCacheInRedis.js} +16 -4
  22. package/cjs/storages/inRedis/index.js +6 -4
  23. package/cjs/storages/pluggable/ImpressionCountsCachePluggable.js +81 -0
  24. package/cjs/storages/pluggable/ImpressionsCachePluggable.js +2 -19
  25. package/cjs/storages/pluggable/TelemetryCachePluggable.js +126 -0
  26. package/cjs/storages/pluggable/UniqueKeysCachePluggable.js +61 -0
  27. package/cjs/storages/pluggable/inMemoryWrapper.js +8 -6
  28. package/cjs/storages/pluggable/index.js +51 -18
  29. package/cjs/storages/utils.js +73 -0
  30. package/cjs/sync/submitters/submitterManager.js +1 -1
  31. package/cjs/sync/submitters/telemetrySubmitter.js +4 -37
  32. package/cjs/sync/submitters/uniqueKeysSubmitter.js +4 -3
  33. package/cjs/trackers/impressionObserver/utils.js +1 -17
  34. package/cjs/trackers/uniqueKeysTracker.js +1 -1
  35. package/cjs/utils/lang/maps.js +15 -7
  36. package/cjs/utils/redis/RedisMock.js +31 -0
  37. package/cjs/utils/settingsValidation/index.js +7 -4
  38. package/esm/evaluator/index.js +5 -5
  39. package/esm/listeners/browser.js +9 -11
  40. package/esm/sdkClient/client.js +19 -7
  41. package/esm/sdkFactory/index.js +7 -25
  42. package/esm/services/splitApi.js +4 -4
  43. package/esm/storages/AbstractSplitsCacheAsync.js +1 -1
  44. package/esm/storages/AbstractSplitsCacheSync.js +1 -1
  45. package/esm/storages/KeyBuilderSS.js +8 -8
  46. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +0 -1
  47. package/esm/storages/inLocalStorage/index.js +16 -12
  48. package/esm/storages/inMemory/InMemoryStorage.js +13 -10
  49. package/esm/storages/inMemory/InMemoryStorageCS.js +12 -9
  50. package/esm/storages/inMemory/TelemetryCacheInMemory.js +64 -37
  51. package/esm/storages/inMemory/{uniqueKeysCacheInMemory.js → UniqueKeysCacheInMemory.js} +22 -24
  52. package/esm/storages/inMemory/{uniqueKeysCacheInMemoryCS.js → UniqueKeysCacheInMemoryCS.js} +10 -12
  53. package/esm/storages/inRedis/EventsCacheInRedis.js +1 -1
  54. package/esm/storages/inRedis/ImpressionCountsCacheInRedis.js +37 -2
  55. package/esm/storages/inRedis/ImpressionsCacheInRedis.js +2 -19
  56. package/esm/storages/inRedis/TelemetryCacheInRedis.js +100 -0
  57. package/esm/storages/inRedis/{uniqueKeysCacheInRedis.js → UniqueKeysCacheInRedis.js} +15 -3
  58. package/esm/storages/inRedis/index.js +5 -3
  59. package/esm/storages/pluggable/ImpressionCountsCachePluggable.js +78 -0
  60. package/esm/storages/pluggable/ImpressionsCachePluggable.js +2 -19
  61. package/esm/storages/pluggable/TelemetryCachePluggable.js +126 -0
  62. package/esm/storages/pluggable/UniqueKeysCachePluggable.js +58 -0
  63. package/esm/storages/pluggable/inMemoryWrapper.js +8 -6
  64. package/esm/storages/pluggable/index.js +52 -19
  65. package/esm/storages/utils.js +65 -0
  66. package/esm/sync/submitters/submitterManager.js +1 -1
  67. package/esm/sync/submitters/telemetrySubmitter.js +4 -36
  68. package/esm/sync/submitters/uniqueKeysSubmitter.js +4 -3
  69. package/esm/trackers/impressionObserver/utils.js +1 -15
  70. package/esm/trackers/uniqueKeysTracker.js +1 -1
  71. package/esm/utils/lang/maps.js +15 -7
  72. package/esm/utils/redis/RedisMock.js +28 -0
  73. package/esm/utils/settingsValidation/index.js +7 -4
  74. package/package.json +2 -2
  75. package/src/consent/sdkUserConsent.ts +1 -1
  76. package/src/evaluator/index.ts +6 -6
  77. package/src/listeners/browser.ts +9 -13
  78. package/src/logger/.DS_Store +0 -0
  79. package/src/sdkClient/client.ts +21 -8
  80. package/src/sdkClient/sdkClient.ts +1 -1
  81. package/src/sdkFactory/index.ts +10 -33
  82. package/src/sdkFactory/types.ts +2 -2
  83. package/src/services/splitApi.ts +6 -6
  84. package/src/services/types.ts +2 -2
  85. package/src/storages/AbstractSplitsCacheAsync.ts +1 -1
  86. package/src/storages/AbstractSplitsCacheSync.ts +1 -1
  87. package/src/storages/KeyBuilderSS.ts +13 -11
  88. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +0 -1
  89. package/src/storages/inLocalStorage/index.ts +17 -12
  90. package/src/storages/inMemory/AttributesCacheInMemory.ts +7 -7
  91. package/src/storages/inMemory/ImpressionCountsCacheInMemory.ts +2 -2
  92. package/src/storages/inMemory/InMemoryStorage.ts +14 -10
  93. package/src/storages/inMemory/InMemoryStorageCS.ts +13 -10
  94. package/src/storages/inMemory/TelemetryCacheInMemory.ts +72 -35
  95. package/src/storages/inMemory/{uniqueKeysCacheInMemory.ts → UniqueKeysCacheInMemory.ts} +26 -28
  96. package/src/storages/inMemory/{uniqueKeysCacheInMemoryCS.ts → UniqueKeysCacheInMemoryCS.ts} +15 -17
  97. package/src/storages/inRedis/EventsCacheInRedis.ts +1 -1
  98. package/src/storages/inRedis/ImpressionCountsCacheInRedis.ts +51 -8
  99. package/src/storages/inRedis/ImpressionsCacheInRedis.ts +2 -22
  100. package/src/storages/inRedis/TelemetryCacheInRedis.ts +122 -1
  101. package/src/storages/inRedis/{uniqueKeysCacheInRedis.ts → UniqueKeysCacheInRedis.ts} +25 -12
  102. package/src/storages/inRedis/index.ts +6 -3
  103. package/src/storages/pluggable/ImpressionCountsCachePluggable.ts +92 -0
  104. package/src/storages/pluggable/ImpressionsCachePluggable.ts +3 -23
  105. package/src/storages/pluggable/TelemetryCachePluggable.ts +147 -1
  106. package/src/storages/pluggable/UniqueKeysCachePluggable.ts +67 -0
  107. package/src/storages/pluggable/inMemoryWrapper.ts +6 -6
  108. package/src/storages/pluggable/index.ts +56 -20
  109. package/src/storages/types.ts +53 -70
  110. package/src/storages/utils.ts +78 -0
  111. package/src/sync/submitters/submitter.ts +2 -2
  112. package/src/sync/submitters/submitterManager.ts +1 -1
  113. package/src/sync/submitters/telemetrySubmitter.ts +9 -39
  114. package/src/sync/submitters/types.ts +33 -17
  115. package/src/sync/submitters/uniqueKeysSubmitter.ts +6 -5
  116. package/src/trackers/impressionObserver/utils.ts +1 -16
  117. package/src/trackers/impressionsTracker.ts +2 -2
  118. package/src/trackers/strategy/strategyDebug.ts +4 -4
  119. package/src/trackers/strategy/strategyNone.ts +9 -9
  120. package/src/trackers/strategy/strategyOptimized.ts +9 -9
  121. package/src/trackers/uniqueKeysTracker.ts +6 -6
  122. package/src/types.ts +0 -2
  123. package/src/utils/lang/maps.ts +20 -8
  124. package/src/utils/redis/RedisMock.ts +33 -0
  125. package/src/utils/settingsValidation/index.ts +5 -5
  126. package/types/services/types.d.ts +2 -2
  127. package/types/storages/AbstractSplitsCacheAsync.d.ts +1 -1
  128. package/types/storages/AbstractSplitsCacheSync.d.ts +1 -1
  129. package/types/storages/KeyBuilderSS.d.ts +5 -2
  130. package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +0 -1
  131. package/types/storages/inMemory/TelemetryCacheInMemory.d.ts +23 -9
  132. package/types/storages/inMemory/uniqueKeysCacheInMemory.d.ts +9 -9
  133. package/types/storages/inMemory/uniqueKeysCacheInMemoryCS.d.ts +2 -4
  134. package/types/storages/inRedis/EventsCacheInRedis.d.ts +1 -1
  135. package/types/storages/inRedis/ImpressionCountsCacheInRedis.d.ts +3 -1
  136. package/types/storages/inRedis/ImpressionsCacheInRedis.d.ts +0 -1
  137. package/types/storages/inRedis/TelemetryCacheInRedis.d.ts +16 -1
  138. package/types/storages/inRedis/uniqueKeysCacheInRedis.d.ts +8 -2
  139. package/types/storages/pluggable/ImpressionCountsCachePluggable.d.ts +16 -0
  140. package/types/storages/pluggable/ImpressionsCachePluggable.d.ts +1 -2
  141. package/types/storages/pluggable/TelemetryCachePluggable.d.ts +17 -1
  142. package/types/storages/pluggable/UniqueKeysCachePluggable.d.ts +20 -0
  143. package/types/storages/types.d.ts +42 -49
  144. package/types/storages/utils.d.ts +8 -0
  145. package/types/sync/submitters/submitter.d.ts +2 -2
  146. package/types/sync/submitters/telemetrySubmitter.d.ts +2 -10
  147. package/types/sync/submitters/types.d.ts +27 -18
  148. package/types/trackers/impressionObserver/utils.d.ts +0 -8
  149. package/types/trackers/strategy/strategyNone.d.ts +2 -2
  150. package/types/trackers/strategy/strategyOptimized.d.ts +2 -2
  151. package/types/trackers/uniqueKeysTracker.d.ts +1 -1
  152. package/types/types.d.ts +0 -2
  153. package/types/utils/lang/maps.d.ts +6 -2
  154. package/types/utils/redis/RedisMock.d.ts +4 -0
  155. package/types/utils/settingsValidation/index.d.ts +0 -1
  156. package/cjs/storages/metadataBuilder.js +0 -12
  157. package/esm/storages/metadataBuilder.js +0 -8
  158. package/src/storages/metadataBuilder.ts +0 -11
  159. package/types/sdkClient/types.d.ts +0 -18
  160. package/types/storages/inMemory/CountsCacheInMemory.d.ts +0 -20
  161. package/types/storages/inMemory/LatenciesCacheInMemory.d.ts +0 -20
  162. package/types/storages/inRedis/CountsCacheInRedis.d.ts +0 -9
  163. package/types/storages/inRedis/LatenciesCacheInRedis.d.ts +0 -9
  164. package/types/sync/offline/LocalhostFromFile.d.ts +0 -2
  165. package/types/sync/offline/splitsParser/splitsParserFromFile.d.ts +0 -2
  166. package/types/sync/submitters/eventsSyncTask.d.ts +0 -8
  167. package/types/sync/submitters/impressionCountsSubmitterInRedis.d.ts +0 -5
  168. package/types/sync/submitters/impressionCountsSyncTask.d.ts +0 -13
  169. package/types/sync/submitters/impressionsSyncTask.d.ts +0 -14
  170. package/types/sync/submitters/metricsSyncTask.d.ts +0 -12
  171. package/types/sync/submitters/submitterSyncTask.d.ts +0 -10
  172. package/types/sync/submitters/uniqueKeysSubmitterInRedis.d.ts +0 -5
  173. package/types/sync/syncTaskComposite.d.ts +0 -5
  174. package/types/trackers/filter/bloomFilter.d.ts +0 -10
  175. package/types/trackers/filter/dictionaryFilter.d.ts +0 -8
  176. package/types/trackers/filter/types.d.ts +0 -5
  177. package/types/utils/timeTracker/index.d.ts +0 -70
@@ -23,7 +23,7 @@ export declare class EventsCacheInRedis implements IEventsCacheAsync {
23
23
  drop(count?: number): Promise<any>;
24
24
  /**
25
25
  * Pop the given number of events from the storage.
26
- * The returned promise rejects if the wrapper operation fails.
26
+ * The returned promise rejects if the redis operation fails.
27
27
  *
28
28
  * NOTE: this method doesn't take into account MAX_EVENT_SIZE or MAX_QUEUE_BYTE_SIZE limits.
29
29
  * It is the submitter responsability to handle that.
@@ -1,5 +1,6 @@
1
1
  import { Redis } from 'ioredis';
2
2
  import { ILogger } from '../../logger/types';
3
+ import { ImpressionCountsPayload } from '../../sync/submitters/types';
3
4
  import { ImpressionCountsCacheInMemory } from '../inMemory/ImpressionCountsCacheInMemory';
4
5
  export declare class ImpressionCountsCacheInRedis extends ImpressionCountsCacheInMemory {
5
6
  private readonly log;
@@ -8,7 +9,8 @@ export declare class ImpressionCountsCacheInRedis extends ImpressionCountsCacheI
8
9
  private readonly refreshRate;
9
10
  private intervalId;
10
11
  constructor(log: ILogger, key: string, redis: Redis, impressionCountsCacheSize?: number, refreshRate?: number);
11
- postImpressionCountsInRedis(): Promise<boolean | import("ioredis").BooleanResponse | undefined>;
12
+ private postImpressionCountsInRedis;
12
13
  start(): void;
13
14
  stop(): Promise<boolean | import("ioredis").BooleanResponse | undefined>;
15
+ getImpressionsCount(): Promise<ImpressionCountsPayload | undefined>;
14
16
  }
@@ -11,7 +11,6 @@ export declare class ImpressionsCacheInRedis implements IImpressionsCacheAsync {
11
11
  private readonly metadata;
12
12
  constructor(log: ILogger, key: string, redis: Redis, metadata: IMetadata);
13
13
  track(impressions: ImpressionDTO[]): Promise<void>;
14
- private _toJSON;
15
14
  count(): Promise<number>;
16
15
  drop(count?: number): Promise<any>;
17
16
  popNWithMetadata(count: number): Promise<StoredImpressionWithMetadata[]>;
@@ -1,5 +1,5 @@
1
1
  import { ILogger } from '../../logger/types';
2
- import { Method } from '../../sync/submitters/types';
2
+ import { Method, MultiConfigs, MultiMethodExceptions, MultiMethodLatencies } from '../../sync/submitters/types';
3
3
  import { KeyBuilderSS } from '../KeyBuilderSS';
4
4
  import { ITelemetryCacheAsync } from '../types';
5
5
  import { Redis } from 'ioredis';
@@ -17,4 +17,19 @@ export declare class TelemetryCacheInRedis implements ITelemetryCacheAsync {
17
17
  recordLatency(method: Method, latencyMs: number): Promise<number | void>;
18
18
  recordException(method: Method): Promise<number | void>;
19
19
  recordConfig(): Promise<number | void>;
20
+ /**
21
+ * Pop telemetry latencies.
22
+ * The returned promise rejects if redis operations fail.
23
+ */
24
+ popLatencies(): Promise<MultiMethodLatencies>;
25
+ /**
26
+ * Pop telemetry exceptions.
27
+ * The returned promise rejects if redis operations fail.
28
+ */
29
+ popExceptions(): Promise<MultiMethodExceptions>;
30
+ /**
31
+ * Pop telemetry configs.
32
+ * The returned promise rejects if redis operations fail.
33
+ */
34
+ popConfigs(): Promise<MultiConfigs>;
20
35
  }
@@ -1,7 +1,8 @@
1
1
  import { IUniqueKeysCacheBase } from '../types';
2
2
  import { Redis } from 'ioredis';
3
- import { UniqueKeysCacheInMemory } from '../inMemory/uniqueKeysCacheInMemory';
3
+ import { UniqueKeysCacheInMemory } from '../inMemory/UniqueKeysCacheInMemory';
4
4
  import { ILogger } from '../../logger/types';
5
+ import { UniqueKeysItemSs } from '../../sync/submitters/types';
5
6
  export declare class UniqueKeysCacheInRedis extends UniqueKeysCacheInMemory implements IUniqueKeysCacheBase {
6
7
  private readonly log;
7
8
  private readonly key;
@@ -9,7 +10,12 @@ export declare class UniqueKeysCacheInRedis extends UniqueKeysCacheInMemory impl
9
10
  private readonly refreshRate;
10
11
  private intervalId;
11
12
  constructor(log: ILogger, key: string, redis: Redis, uniqueKeysQueueSize?: number, refreshRate?: number);
12
- postUniqueKeysInRedis(): Promise<boolean | import("ioredis").BooleanResponse | undefined>;
13
+ private postUniqueKeysInRedis;
13
14
  start(): void;
14
15
  stop(): Promise<boolean | import("ioredis").BooleanResponse | undefined>;
16
+ /**
17
+ * Async consumer API, used by synchronizer.
18
+ * @param count number of items to pop from the queue. If not provided or equal 0, all items will be popped.
19
+ */
20
+ popNRaw(count?: number): Promise<UniqueKeysItemSs[]>;
15
21
  }
@@ -0,0 +1,16 @@
1
+ import { ILogger } from '../../logger/types';
2
+ import { ImpressionCountsPayload } from '../../sync/submitters/types';
3
+ import { ImpressionCountsCacheInMemory } from '../inMemory/ImpressionCountsCacheInMemory';
4
+ import { IPluggableStorageWrapper } from '../types';
5
+ export declare class ImpressionCountsCachePluggable extends ImpressionCountsCacheInMemory {
6
+ private readonly log;
7
+ private readonly key;
8
+ private readonly wrapper;
9
+ private readonly refreshRate;
10
+ private intervalId;
11
+ constructor(log: ILogger, key: string, wrapper: IPluggableStorageWrapper, impressionCountsCacheSize?: number, refreshRate?: number);
12
+ private storeImpressionCounts;
13
+ start(): void;
14
+ stop(): Promise<any>;
15
+ getImpressionsCount(): Promise<ImpressionCountsPayload | undefined>;
16
+ }
@@ -1,8 +1,8 @@
1
1
  import { IPluggableStorageWrapper, IImpressionsCacheAsync } from '../types';
2
2
  import { IMetadata } from '../../dtos/types';
3
3
  import { ImpressionDTO } from '../../types';
4
- import { ILogger } from '../../logger/types';
5
4
  import { StoredImpressionWithMetadata } from '../../sync/submitters/types';
5
+ import { ILogger } from '../../logger/types';
6
6
  export declare class ImpressionsCachePluggable implements IImpressionsCacheAsync {
7
7
  private readonly log;
8
8
  private readonly key;
@@ -16,7 +16,6 @@ export declare class ImpressionsCachePluggable implements IImpressionsCacheAsync
16
16
  * or rejected if the wrapper operation fails.
17
17
  */
18
18
  track(impressions: ImpressionDTO[]): Promise<void>;
19
- private _toJSON;
20
19
  /**
21
20
  * Returns a promise that resolves with the count of stored impressions, or 0 if there was some error.
22
21
  * The promise will never be rejected.
@@ -1,5 +1,5 @@
1
1
  import { ILogger } from '../../logger/types';
2
- import { Method } from '../../sync/submitters/types';
2
+ import { Method, MultiConfigs, MultiMethodExceptions, MultiMethodLatencies } from '../../sync/submitters/types';
3
3
  import { KeyBuilderSS } from '../KeyBuilderSS';
4
4
  import { IPluggableStorageWrapper, ITelemetryCacheAsync } from '../types';
5
5
  export declare class TelemetryCachePluggable implements ITelemetryCacheAsync {
@@ -15,4 +15,20 @@ export declare class TelemetryCachePluggable implements ITelemetryCacheAsync {
15
15
  constructor(log: ILogger, keys: KeyBuilderSS, wrapper: IPluggableStorageWrapper);
16
16
  recordLatency(method: Method, latencyMs: number): Promise<number | void>;
17
17
  recordException(method: Method): Promise<number | void>;
18
+ recordConfig(): Promise<boolean | void>;
19
+ /**
20
+ * Pop telemetry latencies.
21
+ * The returned promise rejects if wrapper operations fail.
22
+ */
23
+ popLatencies(): Promise<MultiMethodLatencies>;
24
+ /**
25
+ * Pop telemetry exceptions.
26
+ * The returned promise rejects if wrapper operations fail.
27
+ */
28
+ popExceptions(): Promise<MultiMethodExceptions>;
29
+ /**
30
+ * Pop telemetry configs.
31
+ * The returned promise rejects if wrapper operations fail.
32
+ */
33
+ popConfigs(): Promise<MultiConfigs>;
18
34
  }
@@ -0,0 +1,20 @@
1
+ import { IPluggableStorageWrapper, IUniqueKeysCacheBase } from '../types';
2
+ import { UniqueKeysCacheInMemory } from '../inMemory/UniqueKeysCacheInMemory';
3
+ import { ILogger } from '../../logger/types';
4
+ import { UniqueKeysItemSs } from '../../sync/submitters/types';
5
+ export declare class UniqueKeysCachePluggable extends UniqueKeysCacheInMemory implements IUniqueKeysCacheBase {
6
+ private readonly log;
7
+ private readonly key;
8
+ private readonly wrapper;
9
+ private readonly refreshRate;
10
+ private intervalId;
11
+ constructor(log: ILogger, key: string, wrapper: IPluggableStorageWrapper, uniqueKeysQueueSize?: number, refreshRate?: number);
12
+ storeUniqueKeys(): Promise<any>;
13
+ start(): void;
14
+ stop(): Promise<any>;
15
+ /**
16
+ * Async consumer API, used by synchronizer.
17
+ * @param count number of items to pop from the queue. If not provided or equal 0, all items will be popped.
18
+ */
19
+ popNRaw(count?: number): Promise<UniqueKeysItemSs[]>;
20
+ }
@@ -1,7 +1,6 @@
1
- import { MaybeThenable, IMetadata, ISplitFiltersValidation, ISplit } from '../dtos/types';
2
- import { ILogger } from '../logger/types';
3
- import { EventDataType, HttpErrors, HttpLatencies, ImpressionDataType, LastSync, Method, MethodExceptions, MethodLatencies, OperationType, StoredEventWithMetadata, StoredImpressionWithMetadata, StreamingEvent, UniqueKeysPayloadCs, UniqueKeysPayloadSs } from '../sync/submitters/types';
4
- import { SplitIO, ImpressionDTO, SDKMode } from '../types';
1
+ import { MaybeThenable, ISplit } from '../dtos/types';
2
+ import { EventDataType, HttpErrors, HttpLatencies, ImpressionDataType, LastSync, Method, MethodExceptions, MethodLatencies, MultiMethodExceptions, MultiMethodLatencies, MultiConfigs, OperationType, StoredEventWithMetadata, StoredImpressionWithMetadata, StreamingEvent, UniqueKeysPayloadCs, UniqueKeysPayloadSs, TelemetryUsageStatsPayload } from '../sync/submitters/types';
3
+ import { SplitIO, ImpressionDTO, ISettings } from '../types';
5
4
  /**
6
5
  * Interface of a pluggable storage wrapper.
7
6
  */
@@ -65,23 +64,25 @@ export interface IPluggableStorageWrapper {
65
64
  getMany: (keys: string[]) => Promise<(string | null)[]>;
66
65
  /** Integer operations */
67
66
  /**
68
- * Increments in 1 the given `key` value or set it to 1 if the value doesn't exist.
67
+ * Increments the number stored at `key` by `increment`, or set it to `increment` if the value doesn't exist.
69
68
  *
70
69
  * @function incr
71
70
  * @param {string} key Key to increment
71
+ * @param {number} increment Value to increment by. Defaults to 1.
72
72
  * @returns {Promise<number>} A promise that resolves with the value of key after the increment. The promise rejects if the operation fails,
73
73
  * for example, if there is a connection error or the key contains a string that can not be represented as integer.
74
74
  */
75
- incr: (key: string) => Promise<number>;
75
+ incr: (key: string, increment?: number) => Promise<number>;
76
76
  /**
77
- * Decrements in 1 the given `key` value or set it to -1 if the value doesn't exist.
77
+ * Decrements the number stored at `key` by `decrement`, or set it to minus `decrement` if the value doesn't exist.
78
78
  *
79
79
  * @function decr
80
80
  * @param {string} key Key to decrement
81
+ * @param {number} decrement Value to decrement by. Defaults to 1.
81
82
  * @returns {Promise<number>} A promise that resolves with the value of key after the decrement. The promise rejects if the operation fails,
82
83
  * for example, if there is a connection error or the key contains a string that can not be represented as integer.
83
84
  */
84
- decr: (key: string) => Promise<number>;
85
+ decr: (key: string, decrement?: number) => Promise<number>;
85
86
  /** Queue operations */
86
87
  /**
87
88
  * Inserts given items at the tail of `key` list. If `key` does not exist, an empty list is created before pushing the items.
@@ -262,48 +263,43 @@ export interface IImpressionsCacheBase {
262
263
  export interface IEventsCacheBase {
263
264
  track(data: SplitIO.EventData, size?: number): MaybeThenable<boolean>;
264
265
  }
265
- /** Impressions and events cache for standalone mode (sync) */
266
- export interface IRecorderCacheProducerSync<T> {
266
+ export interface IImpressionCountsCacheBase {
267
+ track(featureName: string, timeFrame: number, amount: number): void;
268
+ }
269
+ export interface IUniqueKeysCacheBase {
270
+ track(key: string, value: string): void;
271
+ }
272
+ /** Impressions and events cache for standalone and partial consumer modes (sync methods) */
273
+ export interface IRecorderCacheSync<T> {
267
274
  isEmpty(): boolean;
268
275
  clear(): void;
269
276
  pop(toMerge?: T): T;
270
277
  }
271
- export interface IImpressionsCacheSync extends IImpressionsCacheBase, IRecorderCacheProducerSync<ImpressionDTO[]> {
278
+ export interface IImpressionsCacheSync extends IImpressionsCacheBase, IRecorderCacheSync<ImpressionDTO[]> {
272
279
  track(data: ImpressionDTO[]): void;
273
280
  setOnFullQueueCb(cb: () => void): void;
274
281
  }
275
- export interface IEventsCacheSync extends IEventsCacheBase, IRecorderCacheProducerSync<SplitIO.EventData[]> {
282
+ export interface IEventsCacheSync extends IEventsCacheBase, IRecorderCacheSync<SplitIO.EventData[]> {
276
283
  track(data: SplitIO.EventData, size?: number): boolean;
277
284
  setOnFullQueueCb(cb: () => void): void;
278
285
  }
279
- /** Impressions and events cache for consumer and producer mode (async) */
280
- export interface IRecorderCacheProducerAsync<T> {
286
+ export interface IImpressionCountsCacheSync extends IImpressionCountsCacheBase, IRecorderCacheSync<Record<string, number>> {
287
+ }
288
+ export interface IUniqueKeysCacheSync extends IUniqueKeysCacheBase, IRecorderCacheSync<UniqueKeysPayloadSs | UniqueKeysPayloadCs> {
289
+ setOnFullQueueCb(cb: () => void): void;
290
+ }
291
+ /** Impressions and events cache for consumer and producer modes (async methods) */
292
+ export interface IRecorderCacheAsync<T> {
281
293
  count(): Promise<number>;
282
294
  drop(count?: number): Promise<void>;
283
295
  popNWithMetadata(count: number): Promise<T>;
284
296
  }
285
- export interface IImpressionsCacheAsync extends IImpressionsCacheBase, IRecorderCacheProducerAsync<StoredImpressionWithMetadata[]> {
297
+ export interface IImpressionsCacheAsync extends IImpressionsCacheBase, IRecorderCacheAsync<StoredImpressionWithMetadata[]> {
286
298
  track(data: ImpressionDTO[]): Promise<void>;
287
299
  }
288
- export interface IEventsCacheAsync extends IEventsCacheBase, IRecorderCacheProducerAsync<StoredEventWithMetadata[]> {
300
+ export interface IEventsCacheAsync extends IEventsCacheBase, IRecorderCacheAsync<StoredEventWithMetadata[]> {
289
301
  track(data: SplitIO.EventData, size?: number): Promise<boolean>;
290
302
  }
291
- /**
292
- * Impression counts cache for impressions dedup in standalone and producer mode.
293
- * Only in memory. Named `ImpressionsCounter` in spec.
294
- */
295
- export interface IImpressionCountsCacheSync extends IRecorderCacheProducerSync<Record<string, number>> {
296
- track(featureName: string, timeFrame: number, amount: number): void;
297
- isEmpty(): boolean;
298
- pop(toMerge?: Record<string, number>): Record<string, number>;
299
- }
300
- export interface IUniqueKeysCacheBase {
301
- track(key: string, value: string): void;
302
- isEmpty(): boolean;
303
- pop(): UniqueKeysPayloadSs | UniqueKeysPayloadCs;
304
- setOnFullQueueCb(cb: () => void): void;
305
- clear(): void;
306
- }
307
303
  /**
308
304
  * Telemetry storage interface for standalone and partial consumer modes.
309
305
  * Methods are sync because data is stored in memory.
@@ -354,26 +350,28 @@ export interface ITelemetryEvaluationProducerSync {
354
350
  }
355
351
  export interface ITelemetryStorageProducerSync extends ITelemetryInitProducerSync, ITelemetryRuntimeProducerSync, ITelemetryEvaluationProducerSync {
356
352
  }
357
- export interface ITelemetryCacheSync extends ITelemetryStorageConsumerSync, ITelemetryStorageProducerSync {
353
+ export interface ITelemetryCacheSync extends ITelemetryStorageConsumerSync, ITelemetryStorageProducerSync, IRecorderCacheSync<TelemetryUsageStatsPayload> {
358
354
  }
359
355
  /**
360
356
  * Telemetry storage interface for consumer mode.
361
357
  * Methods are async because data is stored in Redis or a pluggable storage.
362
358
  */
363
359
  export interface ITelemetryEvaluationConsumerAsync {
364
- popExceptions(): Promise<MethodExceptions>;
365
- popLatencies(): Promise<MethodLatencies>;
360
+ popLatencies(): Promise<MultiMethodLatencies>;
361
+ popExceptions(): Promise<MultiMethodExceptions>;
362
+ popConfigs(): Promise<MultiConfigs>;
366
363
  }
367
364
  export interface ITelemetryEvaluationProducerAsync {
368
365
  recordLatency(method: Method, latencyMs: number): Promise<any>;
369
366
  recordException(method: Method): Promise<any>;
367
+ recordConfig(): Promise<any>;
370
368
  }
371
- export interface ITelemetryCacheAsync extends ITelemetryEvaluationProducerAsync {
369
+ export interface ITelemetryCacheAsync extends ITelemetryEvaluationProducerAsync, ITelemetryEvaluationConsumerAsync {
372
370
  }
373
371
  /**
374
372
  * Storages
375
373
  */
376
- export interface IStorageBase<TSplitsCache extends ISplitsCacheBase, TSegmentsCache extends ISegmentsCacheBase, TImpressionsCache extends IImpressionsCacheBase, TImpressionsCountCache extends IImpressionCountsCacheSync, TEventsCache extends IEventsCacheBase, TTelemetryCache extends ITelemetryCacheSync | ITelemetryCacheAsync, TUniqueKeysCache extends IUniqueKeysCacheBase> {
374
+ export interface IStorageBase<TSplitsCache extends ISplitsCacheBase, TSegmentsCache extends ISegmentsCacheBase, TImpressionsCache extends IImpressionsCacheBase, TImpressionsCountCache extends IImpressionCountsCacheBase, TEventsCache extends IEventsCacheBase, TTelemetryCache extends ITelemetryCacheSync | ITelemetryCacheAsync, TUniqueKeysCache extends IUniqueKeysCacheBase> {
377
375
  splits: TSplitsCache;
378
376
  segments: TSegmentsCache;
379
377
  impressions: TImpressionsCache;
@@ -384,24 +382,19 @@ export interface IStorageBase<TSplitsCache extends ISplitsCacheBase, TSegmentsCa
384
382
  destroy(): void | Promise<void>;
385
383
  shared?: (matchingKey: string, onReadyCb: (error?: any) => void) => this;
386
384
  }
387
- export interface IStorageSync extends IStorageBase<ISplitsCacheSync, ISegmentsCacheSync, IImpressionsCacheSync, IImpressionCountsCacheSync, IEventsCacheSync, ITelemetryCacheSync, IUniqueKeysCacheBase> {
385
+ export interface IStorageSync extends IStorageBase<ISplitsCacheSync, ISegmentsCacheSync, IImpressionsCacheSync, IImpressionCountsCacheSync, IEventsCacheSync, ITelemetryCacheSync, IUniqueKeysCacheSync> {
388
386
  }
389
- export interface IStorageAsync extends IStorageBase<ISplitsCacheAsync, ISegmentsCacheAsync, IImpressionsCacheAsync | IImpressionsCacheSync, IImpressionCountsCacheSync, IEventsCacheAsync | IEventsCacheSync, ITelemetryCacheAsync, IUniqueKeysCacheBase> {
387
+ export interface IStorageAsync extends IStorageBase<ISplitsCacheAsync, ISegmentsCacheAsync, IImpressionsCacheAsync | IImpressionsCacheSync, IImpressionCountsCacheBase, IEventsCacheAsync | IEventsCacheSync, ITelemetryCacheAsync | ITelemetryCacheSync, IUniqueKeysCacheBase> {
390
388
  }
391
389
  /** StorageFactory */
392
390
  export declare type DataLoader = (storage: IStorageSync, matchingKey: string) => void;
393
391
  export interface IStorageFactoryParams {
394
- log: ILogger;
395
- impressionsQueueSize?: number;
396
- uniqueKeysCacheSize?: number;
397
- eventsQueueSize?: number;
398
- optimize?: boolean;
399
- mode: SDKMode;
400
- impressionsMode?: string;
401
- matchingKey?: string;
402
- splitFiltersValidation?: ISplitFiltersValidation;
392
+ settings: ISettings;
393
+ /**
394
+ * Error-first callback invoked when the storage is ready to be used. An error means that the storage failed to connect and shouldn't be used.
395
+ * It is meant for emitting SDK_READY event in consumer mode, and waiting before using the storage in the synchronizer.
396
+ */
403
397
  onReadyCb: (error?: any) => void;
404
- metadata: IMetadata;
405
398
  }
406
399
  export declare type StorageType = 'MEMORY' | 'LOCALSTORAGE' | 'REDIS' | 'PLUGGABLE';
407
400
  export declare type IStorageSyncFactory = {
@@ -0,0 +1,8 @@
1
+ import { IMetadata } from '../dtos/types';
2
+ import { Method } from '../sync/submitters/types';
3
+ import { ImpressionDTO, ISettings } from '../types';
4
+ export declare function metadataBuilder(settings: Pick<ISettings, 'version' | 'runtime'>): IMetadata;
5
+ export declare function impressionsToJSON(impressions: ImpressionDTO[], metadata: IMetadata): string[];
6
+ export declare function parseMetadata(field: string): [metadata: string] | string;
7
+ export declare function parseExceptionField(field: string): [metadata: string, method: Method] | string;
8
+ export declare function parseLatencyField(field: string): [metadata: string, method: Method, bucket: number] | string;
@@ -1,11 +1,11 @@
1
1
  import { ISyncTask } from '../types';
2
- import { IRecorderCacheProducerSync } from '../../storages/types';
2
+ import { IRecorderCacheSync } from '../../storages/types';
3
3
  import { ILogger } from '../../logger/types';
4
4
  import { IResponse } from '../../services/types';
5
5
  /**
6
6
  * Base function to create submitters, such as ImpressionsSubmitter and EventsSubmitter
7
7
  */
8
- export declare function submitterFactory<T>(log: ILogger, postClient: (body: string) => Promise<IResponse>, sourceCache: IRecorderCacheProducerSync<T>, postRate: number, dataName: string, fromCacheToPayload?: (cacheData: T) => any, maxRetries?: number, debugLogs?: boolean): ISyncTask<[], void>;
8
+ export declare function submitterFactory<T>(log: ILogger, postClient: (body: string) => Promise<IResponse>, sourceCache: IRecorderCacheSync<T>, postRate: number, dataName: string, fromCacheToPayload?: (cacheData: T) => any, maxRetries?: number, debugLogs?: boolean): ISyncTask<[], void>;
9
9
  /**
10
10
  * Decorates a provided submitter with a first execution window
11
11
  */
@@ -1,15 +1,7 @@
1
- import { ISegmentsCacheSync, ISplitsCacheSync, ITelemetryCacheSync } from '../../storages/types';
2
- import { TelemetryUsageStatsPayload, TelemetryConfigStatsPayload, TelemetryConfigStats } from './types';
1
+ import { ITelemetryCacheSync } from '../../storages/types';
2
+ import { TelemetryConfigStatsPayload, TelemetryConfigStats } from './types';
3
3
  import { ISettings, SDKMode } from '../../types';
4
4
  import { ISdkFactoryContextSync } from '../../sdkFactory/types';
5
- /**
6
- * Converts data from telemetry cache into /metrics/usage request payload.
7
- */
8
- export declare function telemetryCacheStatsAdapter(telemetry: ITelemetryCacheSync, splits: ISplitsCacheSync, segments: ISegmentsCacheSync): {
9
- isEmpty(): boolean;
10
- clear(): void;
11
- pop(): TelemetryUsageStatsPayload;
12
- };
13
5
  export declare function getTelemetryConfigStats(mode: SDKMode, storageType: string): TelemetryConfigStats;
14
6
  /**
15
7
  * Converts data from telemetry cache and settings into /metrics/config request payload.
@@ -1,5 +1,6 @@
1
1
  import { IMetadata } from '../../dtos/types';
2
2
  import { SplitIO } from '../../types';
3
+ import { IMap } from '../../utils/lang/maps';
3
4
  import { ISyncTask } from '../types';
4
5
  export declare type ImpressionsPayload = {
5
6
  /** Split name */
@@ -32,13 +33,14 @@ export declare type ImpressionCountsPayload = {
32
33
  rc: number;
33
34
  }[];
34
35
  };
36
+ export declare type UniqueKeysItemSs = {
37
+ /** Split name */
38
+ f: string;
39
+ /** keyNames */
40
+ ks: string[];
41
+ };
35
42
  export declare type UniqueKeysPayloadSs = {
36
- keys: {
37
- /** Split name */
38
- f: string;
39
- /** keyNames */
40
- ks: string[];
41
- }[];
43
+ keys: UniqueKeysItemSs[];
42
44
  };
43
45
  export declare type UniqueKeysPayloadCs = {
44
46
  keys: {
@@ -67,6 +69,8 @@ export declare type StoredImpressionWithMetadata = {
67
69
  c: number;
68
70
  /** time */
69
71
  m: number;
72
+ /** previous time */
73
+ pt?: number;
70
74
  };
71
75
  };
72
76
  export declare type StoredEventWithMetadata = {
@@ -75,6 +79,9 @@ export declare type StoredEventWithMetadata = {
75
79
  /** Stored event */
76
80
  e: SplitIO.EventData;
77
81
  };
82
+ export declare type MultiMethodLatencies = IMap<string, MethodLatencies>;
83
+ export declare type MultiMethodExceptions = IMap<string, MethodExceptions>;
84
+ export declare type MultiConfigs = IMap<string, TelemetryConfigStats>;
78
85
  /**
79
86
  * Telemetry usage stats
80
87
  */
@@ -92,19 +99,19 @@ export declare type TOKEN = 'to';
92
99
  export declare type SEGMENT = 'se';
93
100
  export declare type MY_SEGMENT = 'ms';
94
101
  export declare type OperationType = SPLITS | IMPRESSIONS | IMPRESSIONS_COUNT | EVENTS | TELEMETRY | TOKEN | SEGMENT | MY_SEGMENT;
95
- export declare type LastSync = Record<OperationType, number | undefined>;
96
- export declare type HttpErrors = Record<OperationType, {
102
+ export declare type LastSync = Partial<Record<OperationType, number | undefined>>;
103
+ export declare type HttpErrors = Partial<Record<OperationType, {
97
104
  [statusCode: string]: number;
98
- }>;
99
- export declare type HttpLatencies = Record<OperationType, Array<number>>;
105
+ }>>;
106
+ export declare type HttpLatencies = Partial<Record<OperationType, Array<number>>>;
100
107
  export declare type TREATMENT = 't';
101
108
  export declare type TREATMENTS = 'ts';
102
109
  export declare type TREATMENT_WITH_CONFIG = 'tc';
103
110
  export declare type TREATMENTS_WITH_CONFIG = 'tcs';
104
111
  export declare type TRACK = 'tr';
105
112
  export declare type Method = TREATMENT | TREATMENTS | TREATMENT_WITH_CONFIG | TREATMENTS_WITH_CONFIG | TRACK;
106
- export declare type MethodLatencies = Record<Method, Array<number>>;
107
- export declare type MethodExceptions = Record<Method, number>;
113
+ export declare type MethodLatencies = Partial<Record<Method, Array<number>>>;
114
+ export declare type MethodExceptions = Partial<Record<Method, number>>;
108
115
  export declare type CONNECTION_ESTABLISHED = 0;
109
116
  export declare type OCCUPANCY_PRI = 10;
110
117
  export declare type OCCUPANCY_SEC = 20;
@@ -119,10 +126,12 @@ export declare type StreamingEvent = {
119
126
  d?: number;
120
127
  t: number;
121
128
  };
122
- export declare type TelemetryUsageStatsPayload = {
129
+ export declare type TelemetryUsageStats = {
130
+ mL?: MethodLatencies;
131
+ mE?: MethodExceptions;
132
+ };
133
+ export declare type TelemetryUsageStatsPayload = TelemetryUsageStats & {
123
134
  lS: LastSync;
124
- mL: MethodLatencies;
125
- mE: MethodExceptions;
126
135
  hE: HttpErrors;
127
136
  hL: HttpLatencies;
128
137
  tR: number;
@@ -130,9 +139,9 @@ export declare type TelemetryUsageStatsPayload = {
130
139
  iQ: number;
131
140
  iDe: number;
132
141
  iDr: number;
133
- spC: number;
134
- seC: number;
135
- skC: number;
142
+ spC?: number;
143
+ seC?: number;
144
+ skC?: number;
136
145
  sL?: number;
137
146
  eQ: number;
138
147
  eD: number;
@@ -1,12 +1,4 @@
1
1
  import { ISettings } from '../../types';
2
- /**
3
- * Checks if impressions previous time should be added or not.
4
- */
5
- export declare function shouldAddPt(settings: ISettings): boolean;
6
- /**
7
- * Checks if it should dedupe impressions or not.
8
- */
9
- export declare function shouldBeOptimized(settings: ISettings): boolean;
10
2
  /**
11
3
  * Storage is async if mode is consumer or partial consumer
12
4
  */
@@ -1,4 +1,4 @@
1
- import { IImpressionCountsCacheSync } from '../../storages/types';
1
+ import { IImpressionCountsCacheBase } from '../../storages/types';
2
2
  import { IStrategy, IUniqueKeysTracker } from '../types';
3
3
  /**
4
4
  * None strategy for impressions tracker.
@@ -7,4 +7,4 @@ import { IStrategy, IUniqueKeysTracker } from '../types';
7
7
  * @param uniqueKeysTracker unique keys tracker in charge of tracking the unique keys per split.
8
8
  * @returns IStrategyResult
9
9
  */
10
- export declare function strategyNoneFactory(impressionsCounter: IImpressionCountsCacheSync, uniqueKeysTracker: IUniqueKeysTracker): IStrategy;
10
+ export declare function strategyNoneFactory(impressionsCounter: IImpressionCountsCacheBase, uniqueKeysTracker: IUniqueKeysTracker): IStrategy;
@@ -1,4 +1,4 @@
1
- import { IImpressionCountsCacheSync } from '../../storages/types';
1
+ import { IImpressionCountsCacheBase } from '../../storages/types';
2
2
  import { IImpressionObserver } from '../impressionObserver/types';
3
3
  import { IStrategy } from '../types';
4
4
  /**
@@ -8,4 +8,4 @@ import { IStrategy } from '../types';
8
8
  * @param impressionsCounter cache to save impressions count. impressions will be deduped (OPTIMIZED mode)
9
9
  * @returns IStrategyResult
10
10
  */
11
- export declare function strategyOptimizedFactory(impressionsObserver: IImpressionObserver, impressionsCounter: IImpressionCountsCacheSync): IStrategy;
11
+ export declare function strategyOptimizedFactory(impressionsObserver: IImpressionObserver, impressionsCounter: IImpressionCountsCacheBase): IStrategy;
@@ -4,7 +4,7 @@ import { IFilterAdapter, IUniqueKeysTracker } from './types';
4
4
  /**
5
5
  * Trackes uniques keys
6
6
  * Unique Keys Tracker will be in charge of checking if the MTK was already sent to the BE in the last period
7
- * or schedule to be sent; if not it will be added in an internal cache and sent in the next post.
7
+ * or schedule to be sent; if not it will be added in an internal cache and sent in the next post.
8
8
  *
9
9
  * @param log Logger instance
10
10
  * @param uniqueKeysCache cache to save unique keys
package/types/types.d.ts CHANGED
@@ -74,8 +74,6 @@ export interface ISettings {
74
74
  featuresRefreshRate: number;
75
75
  impressionsRefreshRate: number;
76
76
  impressionsQueueSize: number;
77
- uniqueKeysRefreshRate: number;
78
- uniqueKeysCacheSize: number;
79
77
  /**
80
78
  * @deprecated
81
79
  */
@@ -23,10 +23,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  THE SOFTWARE.
24
24
  **/
25
25
  export interface IMap<K, V> {
26
- set(key: K, value: V): this;
27
26
  clear(): void;
28
27
  delete(key: K): boolean;
28
+ forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
29
29
  get(key: K): V | undefined;
30
+ has(key: K): boolean;
31
+ set(key: K, value: V): this;
30
32
  readonly size: number;
31
33
  }
32
34
  export declare class MapPoly<K, V> implements IMap<K, V> {
@@ -34,9 +36,11 @@ export declare class MapPoly<K, V> implements IMap<K, V> {
34
36
  private __mapValuesData__;
35
37
  constructor(entries?: readonly (readonly [K, V])[] | null);
36
38
  clear(): void;
37
- set(key: K, value: V): this;
38
39
  delete(key: K): boolean;
40
+ forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
39
41
  get(key: K): V | undefined;
42
+ has(key: K): boolean;
43
+ set(key: K, value: V): this;
40
44
  get size(): number;
41
45
  }
42
46
  interface IMapConstructor {
@@ -0,0 +1,4 @@
1
+ export declare class RedisMock {
2
+ private pipelineMethods;
3
+ constructor();
4
+ }
@@ -14,7 +14,6 @@ export declare const base: {
14
14
  segmentsRefreshRate: number;
15
15
  telemetryRefreshRate: number;
16
16
  impressionsRefreshRate: number;
17
- uniqueKeysRefreshRate: number;
18
17
  offlineRefreshRate: number;
19
18
  eventsPushRate: number;
20
19
  eventsQueueSize: number;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.metadataBuilder = void 0;
4
- var constants_1 = require("../utils/constants");
5
- function metadataBuilder(settings) {
6
- return {
7
- s: settings.version,
8
- i: settings.runtime.ip || constants_1.UNKNOWN,
9
- n: settings.runtime.hostname || constants_1.UNKNOWN,
10
- };
11
- }
12
- exports.metadataBuilder = metadataBuilder;
@@ -1,8 +0,0 @@
1
- import { UNKNOWN } from '../utils/constants';
2
- export function metadataBuilder(settings) {
3
- return {
4
- s: settings.version,
5
- i: settings.runtime.ip || UNKNOWN,
6
- n: settings.runtime.hostname || UNKNOWN,
7
- };
8
- }
@@ -1,11 +0,0 @@
1
- import { IMetadata } from '../dtos/types';
2
- import { ISettings } from '../types';
3
- import { UNKNOWN } from '../utils/constants';
4
-
5
- export function metadataBuilder(settings: Pick<ISettings, 'version' | 'runtime'>): IMetadata {
6
- return {
7
- s: settings.version,
8
- i: settings.runtime.ip || UNKNOWN,
9
- n: settings.runtime.hostname || UNKNOWN,
10
- };
11
- }