@launchdarkly/js-sdk-common 2.10.0 → 2.11.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 (401) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{AttributeReference.d.ts → cjs/AttributeReference.d.ts} +2 -2
  3. package/dist/{AttributeReference.d.ts.map → cjs/AttributeReference.d.ts.map} +1 -1
  4. package/dist/{Context.d.ts → cjs/Context.d.ts} +13 -13
  5. package/dist/cjs/Context.d.ts.map +1 -0
  6. package/dist/cjs/ContextFilter.d.ts +11 -0
  7. package/dist/cjs/ContextFilter.d.ts.map +1 -0
  8. package/dist/{index.cjs → cjs/index.cjs} +286 -284
  9. package/dist/cjs/index.cjs.map +1 -0
  10. package/dist/{internal → cjs/internal}/diagnostics/DiagnosticsManager.d.ts +7 -7
  11. package/dist/{internal → cjs/internal}/diagnostics/DiagnosticsManager.d.ts.map +1 -1
  12. package/dist/{internal → cjs/internal}/evaluation/EventFactoryBase.d.ts +2 -2
  13. package/dist/{internal → cjs/internal}/evaluation/EventFactoryBase.d.ts.map +1 -1
  14. package/dist/{internal → cjs/internal}/events/ClientMessages.d.ts +1 -1
  15. package/dist/cjs/internal/events/EventProcessor.d.ts +44 -0
  16. package/dist/cjs/internal/events/EventProcessor.d.ts.map +1 -0
  17. package/dist/{internal → cjs/internal}/events/EventSender.d.ts +6 -6
  18. package/dist/{internal → cjs/internal}/events/EventSender.d.ts.map +1 -1
  19. package/dist/{internal → cjs/internal}/stream/StreamingProcessor.d.ts +14 -14
  20. package/dist/cjs/internal/stream/StreamingProcessor.d.ts.map +1 -0
  21. package/dist/{logging → cjs/logging}/BasicLogger.d.ts +7 -7
  22. package/dist/cjs/logging/BasicLogger.d.ts.map +1 -0
  23. package/dist/{logging → cjs/logging}/SafeLogger.d.ts +3 -3
  24. package/dist/{logging → cjs/logging}/SafeLogger.d.ts.map +1 -1
  25. package/dist/{options → cjs/options}/ServiceEndpoints.d.ts.map +1 -1
  26. package/dist/cjs/package.json +1 -0
  27. package/dist/{validators.d.ts → cjs/validators.d.ts} +2 -2
  28. package/dist/{validators.d.ts.map → cjs/validators.d.ts.map} +1 -1
  29. package/dist/esm/AttributeReference.d.ts +35 -0
  30. package/dist/esm/AttributeReference.d.ts.map +1 -0
  31. package/dist/esm/Context.d.ts +95 -0
  32. package/dist/esm/Context.d.ts.map +1 -0
  33. package/dist/esm/ContextFilter.d.ts +11 -0
  34. package/dist/esm/ContextFilter.d.ts.map +1 -0
  35. package/dist/esm/api/context/LDContext.d.ts +8 -0
  36. package/dist/esm/api/context/LDContext.d.ts.map +1 -0
  37. package/dist/esm/api/context/LDContextCommon.d.ts +29 -0
  38. package/dist/esm/api/context/LDContextCommon.d.ts.map +1 -0
  39. package/dist/esm/api/context/LDContextMeta.d.ts +52 -0
  40. package/dist/esm/api/context/LDContextMeta.d.ts.map +1 -0
  41. package/dist/esm/api/context/LDMultiKindContext.d.ts +46 -0
  42. package/dist/esm/api/context/LDMultiKindContext.d.ts.map +1 -0
  43. package/dist/esm/api/context/LDSingleKindContext.d.ts +24 -0
  44. package/dist/esm/api/context/LDSingleKindContext.d.ts.map +1 -0
  45. package/dist/esm/api/context/LDUser.d.ts +66 -0
  46. package/dist/esm/api/context/LDUser.d.ts.map +1 -0
  47. package/dist/esm/api/context/index.d.ts +7 -0
  48. package/dist/esm/api/context/index.d.ts.map +1 -0
  49. package/dist/esm/api/data/LDEvaluationDetail.d.ts +43 -0
  50. package/dist/esm/api/data/LDEvaluationDetail.d.ts.map +1 -0
  51. package/dist/esm/api/data/LDEvaluationReason.d.ts +57 -0
  52. package/dist/esm/api/data/LDEvaluationReason.d.ts.map +1 -0
  53. package/dist/esm/api/data/LDFlagSet.d.ts +8 -0
  54. package/dist/esm/api/data/LDFlagSet.d.ts.map +1 -0
  55. package/dist/esm/api/data/LDFlagValue.d.ts +7 -0
  56. package/dist/esm/api/data/LDFlagValue.d.ts.map +1 -0
  57. package/dist/esm/api/data/index.d.ts +5 -0
  58. package/dist/esm/api/data/index.d.ts.map +1 -0
  59. package/dist/esm/api/index.d.ts +7 -0
  60. package/dist/esm/api/index.d.ts.map +1 -0
  61. package/dist/esm/api/logging/BasicLoggerOptions.d.ts +43 -0
  62. package/dist/esm/api/logging/BasicLoggerOptions.d.ts.map +1 -0
  63. package/dist/esm/api/logging/LDLogLevel.d.ts +10 -0
  64. package/dist/esm/api/logging/LDLogLevel.d.ts.map +1 -0
  65. package/dist/esm/api/logging/LDLogger.d.ts +47 -0
  66. package/dist/esm/api/logging/LDLogger.d.ts.map +1 -0
  67. package/dist/esm/api/logging/index.d.ts +4 -0
  68. package/dist/esm/api/logging/index.d.ts.map +1 -0
  69. package/dist/esm/api/options/LDClientContext.d.ts +46 -0
  70. package/dist/esm/api/options/LDClientContext.d.ts.map +1 -0
  71. package/dist/esm/api/options/index.d.ts +3 -0
  72. package/dist/esm/api/options/index.d.ts.map +1 -0
  73. package/dist/esm/api/platform/AutoEnv.d.ts +50 -0
  74. package/dist/esm/api/platform/AutoEnv.d.ts.map +1 -0
  75. package/dist/esm/api/platform/Crypto.d.ts +45 -0
  76. package/dist/esm/api/platform/Crypto.d.ts.map +1 -0
  77. package/dist/esm/api/platform/Encoding.d.ts +4 -0
  78. package/dist/esm/api/platform/Encoding.d.ts.map +1 -0
  79. package/dist/esm/api/platform/EventSource.d.ts +31 -0
  80. package/dist/esm/api/platform/EventSource.d.ts.map +1 -0
  81. package/dist/esm/api/platform/Filesystem.d.ts +40 -0
  82. package/dist/esm/api/platform/Filesystem.d.ts.map +1 -0
  83. package/dist/esm/api/platform/Info.d.ts +80 -0
  84. package/dist/esm/api/platform/Info.d.ts.map +1 -0
  85. package/dist/esm/api/platform/Platform.d.ts +36 -0
  86. package/dist/esm/api/platform/Platform.d.ts.map +1 -0
  87. package/dist/esm/api/platform/Requests.d.ts +107 -0
  88. package/dist/esm/api/platform/Requests.d.ts.map +1 -0
  89. package/dist/esm/api/platform/Storage.d.ts +28 -0
  90. package/dist/esm/api/platform/Storage.d.ts.map +1 -0
  91. package/dist/esm/api/platform/index.d.ts +10 -0
  92. package/dist/esm/api/platform/index.d.ts.map +1 -0
  93. package/dist/esm/api/subsystem/LDContextDeduplicator.d.ts +24 -0
  94. package/dist/esm/api/subsystem/LDContextDeduplicator.d.ts.map +1 -0
  95. package/dist/esm/api/subsystem/LDEventProcessor.d.ts +7 -0
  96. package/dist/esm/api/subsystem/LDEventProcessor.d.ts.map +1 -0
  97. package/dist/esm/api/subsystem/LDEventSender.d.ts +18 -0
  98. package/dist/esm/api/subsystem/LDEventSender.d.ts.map +1 -0
  99. package/dist/esm/api/subsystem/LDStreamProcessor.d.ts +13 -0
  100. package/dist/esm/api/subsystem/LDStreamProcessor.d.ts.map +1 -0
  101. package/dist/esm/api/subsystem/index.d.ts +6 -0
  102. package/dist/esm/api/subsystem/index.d.ts.map +1 -0
  103. package/dist/esm/datasource/DataSourceErrorKinds.d.ts +7 -0
  104. package/dist/esm/datasource/DataSourceErrorKinds.d.ts.map +1 -0
  105. package/dist/esm/datasource/errors.d.ts +17 -0
  106. package/dist/esm/datasource/errors.d.ts.map +1 -0
  107. package/dist/esm/datasource/index.d.ts +4 -0
  108. package/dist/esm/datasource/index.d.ts.map +1 -0
  109. package/dist/esm/errors.d.ts +25 -0
  110. package/dist/esm/errors.d.ts.map +1 -0
  111. package/dist/esm/index.d.ts +13 -0
  112. package/dist/esm/index.d.ts.map +1 -0
  113. package/dist/{index.mjs → esm/index.mjs} +286 -284
  114. package/dist/esm/index.mjs.map +1 -0
  115. package/dist/esm/internal/context/index.d.ts +24 -0
  116. package/dist/esm/internal/context/index.d.ts.map +1 -0
  117. package/dist/esm/internal/diagnostics/DiagnosticsManager.d.ts +35 -0
  118. package/dist/esm/internal/diagnostics/DiagnosticsManager.d.ts.map +1 -0
  119. package/dist/esm/internal/diagnostics/index.d.ts +3 -0
  120. package/dist/esm/internal/diagnostics/index.d.ts.map +1 -0
  121. package/dist/esm/internal/diagnostics/types.d.ts +65 -0
  122. package/dist/esm/internal/diagnostics/types.d.ts.map +1 -0
  123. package/dist/esm/internal/evaluation/ErrorKinds.d.ts +12 -0
  124. package/dist/esm/internal/evaluation/ErrorKinds.d.ts.map +1 -0
  125. package/dist/esm/internal/evaluation/EventFactoryBase.d.ts +27 -0
  126. package/dist/esm/internal/evaluation/EventFactoryBase.d.ts.map +1 -0
  127. package/dist/esm/internal/evaluation/index.d.ts +4 -0
  128. package/dist/esm/internal/evaluation/index.d.ts.map +1 -0
  129. package/dist/esm/internal/events/ClientMessages.d.ts +8 -0
  130. package/dist/esm/internal/events/ClientMessages.d.ts.map +1 -0
  131. package/dist/esm/internal/events/EventProcessor.d.ts +44 -0
  132. package/dist/esm/internal/events/EventProcessor.d.ts.map +1 -0
  133. package/dist/esm/internal/events/EventSender.d.ts +14 -0
  134. package/dist/esm/internal/events/EventSender.d.ts.map +1 -0
  135. package/dist/esm/internal/events/EventSummarizer.d.ts +2 -0
  136. package/dist/esm/internal/events/EventSummarizer.d.ts.map +1 -0
  137. package/dist/esm/internal/events/InputClickEvent.d.ts +11 -0
  138. package/dist/esm/internal/events/InputClickEvent.d.ts.map +1 -0
  139. package/dist/esm/internal/events/InputCustomEvent.d.ts +13 -0
  140. package/dist/esm/internal/events/InputCustomEvent.d.ts.map +1 -0
  141. package/dist/esm/internal/events/InputEvalEvent.d.ts +22 -0
  142. package/dist/esm/internal/events/InputEvalEvent.d.ts.map +1 -0
  143. package/dist/esm/internal/events/InputEvent.d.ts +9 -0
  144. package/dist/esm/internal/events/InputEvent.d.ts.map +1 -0
  145. package/dist/esm/internal/events/InputEventBase.d.ts +8 -0
  146. package/dist/esm/internal/events/InputEventBase.d.ts.map +1 -0
  147. package/dist/esm/internal/events/InputIdentifyEvent.d.ts +9 -0
  148. package/dist/esm/internal/events/InputIdentifyEvent.d.ts.map +1 -0
  149. package/dist/esm/internal/events/InputMigrationEvent.d.ts +10 -0
  150. package/dist/esm/internal/events/InputMigrationEvent.d.ts.map +1 -0
  151. package/dist/esm/internal/events/InputPageViewEvent.d.ts +10 -0
  152. package/dist/esm/internal/events/InputPageViewEvent.d.ts.map +1 -0
  153. package/dist/esm/internal/events/LDInternalOptions.d.ts +25 -0
  154. package/dist/esm/internal/events/LDInternalOptions.d.ts.map +1 -0
  155. package/dist/esm/internal/events/LDInvalidSDKKeyError.d.ts +4 -0
  156. package/dist/esm/internal/events/LDInvalidSDKKeyError.d.ts.map +1 -0
  157. package/dist/esm/internal/events/NullEventProcessor.d.ts +7 -0
  158. package/dist/esm/internal/events/NullEventProcessor.d.ts.map +1 -0
  159. package/dist/esm/internal/events/SummaryCounter.d.ts +2 -0
  160. package/dist/esm/internal/events/SummaryCounter.d.ts.map +1 -0
  161. package/dist/esm/internal/events/guards.d.ts +9 -0
  162. package/dist/esm/internal/events/guards.d.ts.map +1 -0
  163. package/dist/esm/internal/events/index.d.ts +12 -0
  164. package/dist/esm/internal/events/index.d.ts.map +1 -0
  165. package/dist/esm/internal/events/sampling.d.ts +6 -0
  166. package/dist/esm/internal/events/sampling.d.ts.map +1 -0
  167. package/dist/esm/internal/index.d.ts +6 -0
  168. package/dist/esm/internal/index.d.ts.map +1 -0
  169. package/dist/esm/internal/stream/StreamingProcessor.d.ts +39 -0
  170. package/dist/esm/internal/stream/StreamingProcessor.d.ts.map +1 -0
  171. package/dist/esm/internal/stream/index.d.ts +5 -0
  172. package/dist/esm/internal/stream/index.d.ts.map +1 -0
  173. package/dist/esm/internal/stream/types.d.ts +3 -0
  174. package/dist/esm/internal/stream/types.d.ts.map +1 -0
  175. package/dist/esm/logging/BasicLogger.d.ts +33 -0
  176. package/dist/esm/logging/BasicLogger.d.ts.map +1 -0
  177. package/dist/esm/logging/SafeLogger.d.ts +28 -0
  178. package/dist/esm/logging/SafeLogger.d.ts.map +1 -0
  179. package/dist/esm/logging/createSafeLogger.d.ts +6 -0
  180. package/dist/esm/logging/createSafeLogger.d.ts.map +1 -0
  181. package/dist/esm/logging/format.d.ts +2 -0
  182. package/dist/esm/logging/format.d.ts.map +1 -0
  183. package/dist/esm/logging/index.d.ts +5 -0
  184. package/dist/esm/logging/index.d.ts.map +1 -0
  185. package/dist/esm/options/ApplicationTags.d.ts +17 -0
  186. package/dist/esm/options/ApplicationTags.d.ts.map +1 -0
  187. package/dist/esm/options/ClientContext.d.ts +43 -0
  188. package/dist/esm/options/ClientContext.d.ts.map +1 -0
  189. package/dist/esm/options/OptionMessages.d.ts +14 -0
  190. package/dist/esm/options/OptionMessages.d.ts.map +1 -0
  191. package/dist/esm/options/ServiceEndpoints.d.ts +58 -0
  192. package/dist/esm/options/ServiceEndpoints.d.ts.map +1 -0
  193. package/dist/esm/options/index.d.ts +6 -0
  194. package/dist/esm/options/index.d.ts.map +1 -0
  195. package/dist/esm/package.json +1 -0
  196. package/dist/esm/utils/VoidFunction.d.ts +2 -0
  197. package/dist/esm/utils/VoidFunction.d.ts.map +1 -0
  198. package/dist/esm/utils/cancelableTimedPromise.d.ts +20 -0
  199. package/dist/esm/utils/cancelableTimedPromise.d.ts.map +1 -0
  200. package/dist/esm/utils/clone.d.ts +2 -0
  201. package/dist/esm/utils/clone.d.ts.map +1 -0
  202. package/dist/esm/utils/date.d.ts +2 -0
  203. package/dist/esm/utils/date.d.ts.map +1 -0
  204. package/dist/esm/utils/debounce.d.ts +23 -0
  205. package/dist/esm/utils/debounce.d.ts.map +1 -0
  206. package/dist/esm/utils/deepCompact.d.ts +11 -0
  207. package/dist/esm/utils/deepCompact.d.ts.map +1 -0
  208. package/dist/esm/utils/fast-deep-equal/index.d.ts +2 -0
  209. package/dist/esm/utils/fast-deep-equal/index.d.ts.map +1 -0
  210. package/dist/esm/utils/http.d.ts +23 -0
  211. package/dist/esm/utils/http.d.ts.map +1 -0
  212. package/dist/esm/utils/index.d.ts +13 -0
  213. package/dist/esm/utils/index.d.ts.map +1 -0
  214. package/dist/esm/utils/isEmptyObject.d.ts +3 -0
  215. package/dist/esm/utils/isEmptyObject.d.ts.map +1 -0
  216. package/dist/esm/utils/noop.d.ts +3 -0
  217. package/dist/esm/utils/noop.d.ts.map +1 -0
  218. package/dist/esm/utils/sleep.d.ts +3 -0
  219. package/dist/esm/utils/sleep.d.ts.map +1 -0
  220. package/dist/esm/utils/timedPromise.d.ts +9 -0
  221. package/dist/esm/utils/timedPromise.d.ts.map +1 -0
  222. package/dist/esm/validators.d.ts +98 -0
  223. package/dist/esm/validators.d.ts.map +1 -0
  224. package/package.json +15 -7
  225. package/dist/Context.d.ts.map +0 -1
  226. package/dist/ContextFilter.d.ts +0 -11
  227. package/dist/ContextFilter.d.ts.map +0 -1
  228. package/dist/index.cjs.map +0 -1
  229. package/dist/index.mjs.map +0 -1
  230. package/dist/internal/events/EventProcessor.d.ts +0 -44
  231. package/dist/internal/events/EventProcessor.d.ts.map +0 -1
  232. package/dist/internal/stream/StreamingProcessor.d.ts.map +0 -1
  233. package/dist/logging/BasicLogger.d.ts.map +0 -1
  234. /package/dist/{api → cjs/api}/context/LDContext.d.ts +0 -0
  235. /package/dist/{api → cjs/api}/context/LDContext.d.ts.map +0 -0
  236. /package/dist/{api → cjs/api}/context/LDContextCommon.d.ts +0 -0
  237. /package/dist/{api → cjs/api}/context/LDContextCommon.d.ts.map +0 -0
  238. /package/dist/{api → cjs/api}/context/LDContextMeta.d.ts +0 -0
  239. /package/dist/{api → cjs/api}/context/LDContextMeta.d.ts.map +0 -0
  240. /package/dist/{api → cjs/api}/context/LDMultiKindContext.d.ts +0 -0
  241. /package/dist/{api → cjs/api}/context/LDMultiKindContext.d.ts.map +0 -0
  242. /package/dist/{api → cjs/api}/context/LDSingleKindContext.d.ts +0 -0
  243. /package/dist/{api → cjs/api}/context/LDSingleKindContext.d.ts.map +0 -0
  244. /package/dist/{api → cjs/api}/context/LDUser.d.ts +0 -0
  245. /package/dist/{api → cjs/api}/context/LDUser.d.ts.map +0 -0
  246. /package/dist/{api → cjs/api}/context/index.d.ts +0 -0
  247. /package/dist/{api → cjs/api}/context/index.d.ts.map +0 -0
  248. /package/dist/{api → cjs/api}/data/LDEvaluationDetail.d.ts +0 -0
  249. /package/dist/{api → cjs/api}/data/LDEvaluationDetail.d.ts.map +0 -0
  250. /package/dist/{api → cjs/api}/data/LDEvaluationReason.d.ts +0 -0
  251. /package/dist/{api → cjs/api}/data/LDEvaluationReason.d.ts.map +0 -0
  252. /package/dist/{api → cjs/api}/data/LDFlagSet.d.ts +0 -0
  253. /package/dist/{api → cjs/api}/data/LDFlagSet.d.ts.map +0 -0
  254. /package/dist/{api → cjs/api}/data/LDFlagValue.d.ts +0 -0
  255. /package/dist/{api → cjs/api}/data/LDFlagValue.d.ts.map +0 -0
  256. /package/dist/{api → cjs/api}/data/index.d.ts +0 -0
  257. /package/dist/{api → cjs/api}/data/index.d.ts.map +0 -0
  258. /package/dist/{api → cjs/api}/index.d.ts +0 -0
  259. /package/dist/{api → cjs/api}/index.d.ts.map +0 -0
  260. /package/dist/{api → cjs/api}/logging/BasicLoggerOptions.d.ts +0 -0
  261. /package/dist/{api → cjs/api}/logging/BasicLoggerOptions.d.ts.map +0 -0
  262. /package/dist/{api → cjs/api}/logging/LDLogLevel.d.ts +0 -0
  263. /package/dist/{api → cjs/api}/logging/LDLogLevel.d.ts.map +0 -0
  264. /package/dist/{api → cjs/api}/logging/LDLogger.d.ts +0 -0
  265. /package/dist/{api → cjs/api}/logging/LDLogger.d.ts.map +0 -0
  266. /package/dist/{api → cjs/api}/logging/index.d.ts +0 -0
  267. /package/dist/{api → cjs/api}/logging/index.d.ts.map +0 -0
  268. /package/dist/{api → cjs/api}/options/LDClientContext.d.ts +0 -0
  269. /package/dist/{api → cjs/api}/options/LDClientContext.d.ts.map +0 -0
  270. /package/dist/{api → cjs/api}/options/index.d.ts +0 -0
  271. /package/dist/{api → cjs/api}/options/index.d.ts.map +0 -0
  272. /package/dist/{api → cjs/api}/platform/AutoEnv.d.ts +0 -0
  273. /package/dist/{api → cjs/api}/platform/AutoEnv.d.ts.map +0 -0
  274. /package/dist/{api → cjs/api}/platform/Crypto.d.ts +0 -0
  275. /package/dist/{api → cjs/api}/platform/Crypto.d.ts.map +0 -0
  276. /package/dist/{api → cjs/api}/platform/Encoding.d.ts +0 -0
  277. /package/dist/{api → cjs/api}/platform/Encoding.d.ts.map +0 -0
  278. /package/dist/{api → cjs/api}/platform/EventSource.d.ts +0 -0
  279. /package/dist/{api → cjs/api}/platform/EventSource.d.ts.map +0 -0
  280. /package/dist/{api → cjs/api}/platform/Filesystem.d.ts +0 -0
  281. /package/dist/{api → cjs/api}/platform/Filesystem.d.ts.map +0 -0
  282. /package/dist/{api → cjs/api}/platform/Info.d.ts +0 -0
  283. /package/dist/{api → cjs/api}/platform/Info.d.ts.map +0 -0
  284. /package/dist/{api → cjs/api}/platform/Platform.d.ts +0 -0
  285. /package/dist/{api → cjs/api}/platform/Platform.d.ts.map +0 -0
  286. /package/dist/{api → cjs/api}/platform/Requests.d.ts +0 -0
  287. /package/dist/{api → cjs/api}/platform/Requests.d.ts.map +0 -0
  288. /package/dist/{api → cjs/api}/platform/Storage.d.ts +0 -0
  289. /package/dist/{api → cjs/api}/platform/Storage.d.ts.map +0 -0
  290. /package/dist/{api → cjs/api}/platform/index.d.ts +0 -0
  291. /package/dist/{api → cjs/api}/platform/index.d.ts.map +0 -0
  292. /package/dist/{api → cjs/api}/subsystem/LDContextDeduplicator.d.ts +0 -0
  293. /package/dist/{api → cjs/api}/subsystem/LDContextDeduplicator.d.ts.map +0 -0
  294. /package/dist/{api → cjs/api}/subsystem/LDEventProcessor.d.ts +0 -0
  295. /package/dist/{api → cjs/api}/subsystem/LDEventProcessor.d.ts.map +0 -0
  296. /package/dist/{api → cjs/api}/subsystem/LDEventSender.d.ts +0 -0
  297. /package/dist/{api → cjs/api}/subsystem/LDEventSender.d.ts.map +0 -0
  298. /package/dist/{api → cjs/api}/subsystem/LDStreamProcessor.d.ts +0 -0
  299. /package/dist/{api → cjs/api}/subsystem/LDStreamProcessor.d.ts.map +0 -0
  300. /package/dist/{api → cjs/api}/subsystem/index.d.ts +0 -0
  301. /package/dist/{api → cjs/api}/subsystem/index.d.ts.map +0 -0
  302. /package/dist/{datasource → cjs/datasource}/DataSourceErrorKinds.d.ts +0 -0
  303. /package/dist/{datasource → cjs/datasource}/DataSourceErrorKinds.d.ts.map +0 -0
  304. /package/dist/{datasource → cjs/datasource}/errors.d.ts +0 -0
  305. /package/dist/{datasource → cjs/datasource}/errors.d.ts.map +0 -0
  306. /package/dist/{datasource → cjs/datasource}/index.d.ts +0 -0
  307. /package/dist/{datasource → cjs/datasource}/index.d.ts.map +0 -0
  308. /package/dist/{errors.d.ts → cjs/errors.d.ts} +0 -0
  309. /package/dist/{errors.d.ts.map → cjs/errors.d.ts.map} +0 -0
  310. /package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
  311. /package/dist/{index.d.ts.map → cjs/index.d.ts.map} +0 -0
  312. /package/dist/{internal → cjs/internal}/context/index.d.ts +0 -0
  313. /package/dist/{internal → cjs/internal}/context/index.d.ts.map +0 -0
  314. /package/dist/{internal → cjs/internal}/diagnostics/index.d.ts +0 -0
  315. /package/dist/{internal → cjs/internal}/diagnostics/index.d.ts.map +0 -0
  316. /package/dist/{internal → cjs/internal}/diagnostics/types.d.ts +0 -0
  317. /package/dist/{internal → cjs/internal}/diagnostics/types.d.ts.map +0 -0
  318. /package/dist/{internal → cjs/internal}/evaluation/ErrorKinds.d.ts +0 -0
  319. /package/dist/{internal → cjs/internal}/evaluation/ErrorKinds.d.ts.map +0 -0
  320. /package/dist/{internal → cjs/internal}/evaluation/index.d.ts +0 -0
  321. /package/dist/{internal → cjs/internal}/evaluation/index.d.ts.map +0 -0
  322. /package/dist/{internal → cjs/internal}/events/ClientMessages.d.ts.map +0 -0
  323. /package/dist/{internal → cjs/internal}/events/EventSummarizer.d.ts +0 -0
  324. /package/dist/{internal → cjs/internal}/events/EventSummarizer.d.ts.map +0 -0
  325. /package/dist/{internal → cjs/internal}/events/InputClickEvent.d.ts +0 -0
  326. /package/dist/{internal → cjs/internal}/events/InputClickEvent.d.ts.map +0 -0
  327. /package/dist/{internal → cjs/internal}/events/InputCustomEvent.d.ts +0 -0
  328. /package/dist/{internal → cjs/internal}/events/InputCustomEvent.d.ts.map +0 -0
  329. /package/dist/{internal → cjs/internal}/events/InputEvalEvent.d.ts +0 -0
  330. /package/dist/{internal → cjs/internal}/events/InputEvalEvent.d.ts.map +0 -0
  331. /package/dist/{internal → cjs/internal}/events/InputEvent.d.ts +0 -0
  332. /package/dist/{internal → cjs/internal}/events/InputEvent.d.ts.map +0 -0
  333. /package/dist/{internal → cjs/internal}/events/InputEventBase.d.ts +0 -0
  334. /package/dist/{internal → cjs/internal}/events/InputEventBase.d.ts.map +0 -0
  335. /package/dist/{internal → cjs/internal}/events/InputIdentifyEvent.d.ts +0 -0
  336. /package/dist/{internal → cjs/internal}/events/InputIdentifyEvent.d.ts.map +0 -0
  337. /package/dist/{internal → cjs/internal}/events/InputMigrationEvent.d.ts +0 -0
  338. /package/dist/{internal → cjs/internal}/events/InputMigrationEvent.d.ts.map +0 -0
  339. /package/dist/{internal → cjs/internal}/events/InputPageViewEvent.d.ts +0 -0
  340. /package/dist/{internal → cjs/internal}/events/InputPageViewEvent.d.ts.map +0 -0
  341. /package/dist/{internal → cjs/internal}/events/LDInternalOptions.d.ts +0 -0
  342. /package/dist/{internal → cjs/internal}/events/LDInternalOptions.d.ts.map +0 -0
  343. /package/dist/{internal → cjs/internal}/events/LDInvalidSDKKeyError.d.ts +0 -0
  344. /package/dist/{internal → cjs/internal}/events/LDInvalidSDKKeyError.d.ts.map +0 -0
  345. /package/dist/{internal → cjs/internal}/events/NullEventProcessor.d.ts +0 -0
  346. /package/dist/{internal → cjs/internal}/events/NullEventProcessor.d.ts.map +0 -0
  347. /package/dist/{internal → cjs/internal}/events/SummaryCounter.d.ts +0 -0
  348. /package/dist/{internal → cjs/internal}/events/SummaryCounter.d.ts.map +0 -0
  349. /package/dist/{internal → cjs/internal}/events/guards.d.ts +0 -0
  350. /package/dist/{internal → cjs/internal}/events/guards.d.ts.map +0 -0
  351. /package/dist/{internal → cjs/internal}/events/index.d.ts +0 -0
  352. /package/dist/{internal → cjs/internal}/events/index.d.ts.map +0 -0
  353. /package/dist/{internal → cjs/internal}/events/sampling.d.ts +0 -0
  354. /package/dist/{internal → cjs/internal}/events/sampling.d.ts.map +0 -0
  355. /package/dist/{internal → cjs/internal}/index.d.ts +0 -0
  356. /package/dist/{internal → cjs/internal}/index.d.ts.map +0 -0
  357. /package/dist/{internal → cjs/internal}/stream/index.d.ts +0 -0
  358. /package/dist/{internal → cjs/internal}/stream/index.d.ts.map +0 -0
  359. /package/dist/{internal → cjs/internal}/stream/types.d.ts +0 -0
  360. /package/dist/{internal → cjs/internal}/stream/types.d.ts.map +0 -0
  361. /package/dist/{logging → cjs/logging}/createSafeLogger.d.ts +0 -0
  362. /package/dist/{logging → cjs/logging}/createSafeLogger.d.ts.map +0 -0
  363. /package/dist/{logging → cjs/logging}/format.d.ts +0 -0
  364. /package/dist/{logging → cjs/logging}/format.d.ts.map +0 -0
  365. /package/dist/{logging → cjs/logging}/index.d.ts +0 -0
  366. /package/dist/{logging → cjs/logging}/index.d.ts.map +0 -0
  367. /package/dist/{options → cjs/options}/ApplicationTags.d.ts +0 -0
  368. /package/dist/{options → cjs/options}/ApplicationTags.d.ts.map +0 -0
  369. /package/dist/{options → cjs/options}/ClientContext.d.ts +0 -0
  370. /package/dist/{options → cjs/options}/ClientContext.d.ts.map +0 -0
  371. /package/dist/{options → cjs/options}/OptionMessages.d.ts +0 -0
  372. /package/dist/{options → cjs/options}/OptionMessages.d.ts.map +0 -0
  373. /package/dist/{options → cjs/options}/ServiceEndpoints.d.ts +0 -0
  374. /package/dist/{options → cjs/options}/index.d.ts +0 -0
  375. /package/dist/{options → cjs/options}/index.d.ts.map +0 -0
  376. /package/dist/{utils → cjs/utils}/VoidFunction.d.ts +0 -0
  377. /package/dist/{utils → cjs/utils}/VoidFunction.d.ts.map +0 -0
  378. /package/dist/{utils → cjs/utils}/cancelableTimedPromise.d.ts +0 -0
  379. /package/dist/{utils → cjs/utils}/cancelableTimedPromise.d.ts.map +0 -0
  380. /package/dist/{utils → cjs/utils}/clone.d.ts +0 -0
  381. /package/dist/{utils → cjs/utils}/clone.d.ts.map +0 -0
  382. /package/dist/{utils → cjs/utils}/date.d.ts +0 -0
  383. /package/dist/{utils → cjs/utils}/date.d.ts.map +0 -0
  384. /package/dist/{utils → cjs/utils}/debounce.d.ts +0 -0
  385. /package/dist/{utils → cjs/utils}/debounce.d.ts.map +0 -0
  386. /package/dist/{utils → cjs/utils}/deepCompact.d.ts +0 -0
  387. /package/dist/{utils → cjs/utils}/deepCompact.d.ts.map +0 -0
  388. /package/dist/{utils → cjs/utils}/fast-deep-equal/index.d.ts +0 -0
  389. /package/dist/{utils → cjs/utils}/fast-deep-equal/index.d.ts.map +0 -0
  390. /package/dist/{utils → cjs/utils}/http.d.ts +0 -0
  391. /package/dist/{utils → cjs/utils}/http.d.ts.map +0 -0
  392. /package/dist/{utils → cjs/utils}/index.d.ts +0 -0
  393. /package/dist/{utils → cjs/utils}/index.d.ts.map +0 -0
  394. /package/dist/{utils → cjs/utils}/isEmptyObject.d.ts +0 -0
  395. /package/dist/{utils → cjs/utils}/isEmptyObject.d.ts.map +0 -0
  396. /package/dist/{utils → cjs/utils}/noop.d.ts +0 -0
  397. /package/dist/{utils → cjs/utils}/noop.d.ts.map +0 -0
  398. /package/dist/{utils → cjs/utils}/sleep.d.ts +0 -0
  399. /package/dist/{utils → cjs/utils}/sleep.d.ts.map +0 -0
  400. /package/dist/{utils → cjs/utils}/timedPromise.d.ts +0 -0
  401. /package/dist/{utils → cjs/utils}/timedPromise.d.ts.map +0 -0
@@ -46,23 +46,23 @@ class AttributeReference {
46
46
  this.redactionName = refOrLiteral;
47
47
  if (refOrLiteral === '' || refOrLiteral === '/' || !validate(refOrLiteral)) {
48
48
  this.isValid = false;
49
- this.components = [];
49
+ this._components = [];
50
50
  return;
51
51
  }
52
52
  if (isLiteral(refOrLiteral)) {
53
- this.components = [refOrLiteral];
53
+ this._components = [refOrLiteral];
54
54
  }
55
55
  else if (refOrLiteral.indexOf('/', 1) < 0) {
56
- this.components = [unescape(refOrLiteral.slice(1))];
56
+ this._components = [unescape(refOrLiteral.slice(1))];
57
57
  }
58
58
  else {
59
- this.components = getComponents(refOrLiteral);
59
+ this._components = getComponents(refOrLiteral);
60
60
  }
61
61
  // The items inside of '_meta' are not intended to be addressable.
62
62
  // Excluding it as a valid reference means that we can make it non-addressable
63
63
  // without having to copy all the attributes out of the context object
64
64
  // provided by the user.
65
- if (this.components[0] === '_meta') {
65
+ if (this._components[0] === '_meta') {
66
66
  this.isValid = false;
67
67
  }
68
68
  else {
@@ -71,14 +71,14 @@ class AttributeReference {
71
71
  }
72
72
  else {
73
73
  const literalVal = refOrLiteral;
74
- this.components = [literalVal];
74
+ this._components = [literalVal];
75
75
  this.isValid = literalVal !== '';
76
76
  // Literals which start with '/' need escaped to prevent ambiguity.
77
77
  this.redactionName = literalVal.startsWith('/') ? toRefString(literalVal) : literalVal;
78
78
  }
79
79
  }
80
80
  get(target) {
81
- const { components, isValid } = this;
81
+ const { _components: components, isValid } = this;
82
82
  if (!isValid) {
83
83
  return undefined;
84
84
  }
@@ -105,23 +105,23 @@ class AttributeReference {
105
105
  return current;
106
106
  }
107
107
  getComponent(depth) {
108
- return this.components[depth];
108
+ return this._components[depth];
109
109
  }
110
110
  get depth() {
111
- return this.components.length;
111
+ return this._components.length;
112
112
  }
113
113
  get isKind() {
114
- return this.components.length === 1 && this.components[0] === 'kind';
114
+ return this._components.length === 1 && this._components[0] === 'kind';
115
115
  }
116
116
  compare(other) {
117
117
  return (this.depth === other.depth &&
118
- this.components.every((value, index) => value === other.getComponent(index)));
118
+ this._components.every((value, index) => value === other.getComponent(index)));
119
119
  }
120
120
  }
121
121
  /**
122
122
  * For use as invalid references when deserializing Flag/Segment data.
123
123
  */
124
- AttributeReference.invalidReference = new AttributeReference('');
124
+ AttributeReference.InvalidReference = new AttributeReference('');
125
125
 
126
126
  /* eslint-disable class-methods-use-this */
127
127
  /* eslint-disable max-classes-per-file */
@@ -146,7 +146,7 @@ class FactoryOrInstance {
146
146
  */
147
147
  class Type {
148
148
  constructor(typeName, example) {
149
- this.typeName = typeName;
149
+ this._typeName = typeName;
150
150
  this.typeOf = typeof example;
151
151
  }
152
152
  is(u) {
@@ -156,7 +156,7 @@ class Type {
156
156
  return typeof u === this.typeOf;
157
157
  }
158
158
  getType() {
159
- return this.typeName;
159
+ return this._typeName;
160
160
  }
161
161
  }
162
162
  /**
@@ -167,7 +167,7 @@ class Type {
167
167
  */
168
168
  class TypeArray {
169
169
  constructor(typeName, example) {
170
- this.typeName = typeName;
170
+ this._typeName = typeName;
171
171
  this.typeOf = typeof example;
172
172
  }
173
173
  is(u) {
@@ -180,7 +180,7 @@ class TypeArray {
180
180
  return false;
181
181
  }
182
182
  getType() {
183
- return this.typeName;
183
+ return this._typeName;
184
184
  }
185
185
  }
186
186
  /**
@@ -450,18 +450,18 @@ class Context {
450
450
  * implementation details, so they cannot be free functions.
451
451
  */
452
452
  constructor(valid, kind, message) {
453
- this.isMulti = false;
454
- this.isUser = false;
455
- this.wasLegacy = false;
456
- this.contexts = {};
453
+ this._isMulti = false;
454
+ this._isUser = false;
455
+ this._wasLegacy = false;
456
+ this._contexts = {};
457
457
  this.kind = kind;
458
458
  this.valid = valid;
459
459
  this.message = message;
460
460
  }
461
- static contextForError(kind, message) {
461
+ static _contextForError(kind, message) {
462
462
  return new Context(false, kind, message);
463
463
  }
464
- static getValueFromContext(reference, context) {
464
+ static _getValueFromContext(reference, context) {
465
465
  if (!context || !reference.isValid) {
466
466
  return undefined;
467
467
  }
@@ -470,23 +470,23 @@ class Context {
470
470
  }
471
471
  return reference.get(context);
472
472
  }
473
- contextForKind(kind) {
474
- if (this.isMulti) {
475
- return this.contexts[kind];
473
+ _contextForKind(kind) {
474
+ if (this._isMulti) {
475
+ return this._contexts[kind];
476
476
  }
477
477
  if (this.kind === kind) {
478
- return this.context;
478
+ return this._context;
479
479
  }
480
480
  return undefined;
481
481
  }
482
- static fromMultiKindContext(context) {
482
+ static _fromMultiKindContext(context) {
483
483
  const kinds = Object.keys(context).filter((key) => key !== 'kind');
484
484
  const kindsValid = kinds.every(validKind);
485
485
  if (!kinds.length) {
486
- return Context.contextForError('multi', 'A multi-kind context must contain at least one kind');
486
+ return Context._contextForError('multi', 'A multi-kind context must contain at least one kind');
487
487
  }
488
488
  if (!kindsValid) {
489
- return Context.contextForError('multi', 'Context contains invalid kinds');
489
+ return Context._contextForError('multi', 'Context contains invalid kinds');
490
490
  }
491
491
  const privateAttributes = {};
492
492
  let contextsAreObjects = true;
@@ -503,59 +503,59 @@ class Context {
503
503
  return acc;
504
504
  }, {});
505
505
  if (!contextsAreObjects) {
506
- return Context.contextForError('multi', 'Context contained contexts that were not objects');
506
+ return Context._contextForError('multi', 'Context contained contexts that were not objects');
507
507
  }
508
508
  if (!Object.values(contexts).every((part) => validKey(part.key))) {
509
- return Context.contextForError('multi', 'Context contained invalid keys');
509
+ return Context._contextForError('multi', 'Context contained invalid keys');
510
510
  }
511
511
  // There was only a single kind in the multi-kind context.
512
512
  // So we can just translate this to a single-kind context.
513
513
  if (kinds.length === 1) {
514
514
  const kind = kinds[0];
515
515
  const created = new Context(true, kind);
516
- created.context = { ...contexts[kind], kind };
517
- created.privateAttributeReferences = privateAttributes;
518
- created.isUser = kind === 'user';
516
+ created._context = { ...contexts[kind], kind };
517
+ created._privateAttributeReferences = privateAttributes;
518
+ created._isUser = kind === 'user';
519
519
  return created;
520
520
  }
521
521
  const created = new Context(true, context.kind);
522
- created.contexts = contexts;
523
- created.privateAttributeReferences = privateAttributes;
524
- created.isMulti = true;
522
+ created._contexts = contexts;
523
+ created._privateAttributeReferences = privateAttributes;
524
+ created._isMulti = true;
525
525
  return created;
526
526
  }
527
- static fromSingleKindContext(context) {
527
+ static _fromSingleKindContext(context) {
528
528
  const { key, kind } = context;
529
529
  const kindValid = validKind(kind);
530
530
  const keyValid = validKey(key);
531
531
  if (!kindValid) {
532
- return Context.contextForError(kind ?? 'unknown', 'The kind was not valid for the context');
532
+ return Context._contextForError(kind ?? 'unknown', 'The kind was not valid for the context');
533
533
  }
534
534
  if (!keyValid) {
535
- return Context.contextForError(kind, 'The key for the context was not valid');
535
+ return Context._contextForError(kind, 'The key for the context was not valid');
536
536
  }
537
537
  // The JSON interfaces uses dangling _.
538
538
  // eslint-disable-next-line no-underscore-dangle
539
539
  const privateAttributeReferences = processPrivateAttributes(context._meta?.privateAttributes);
540
540
  const created = new Context(true, kind);
541
- created.isUser = kind === 'user';
542
- created.context = context;
543
- created.privateAttributeReferences = {
541
+ created._isUser = kind === 'user';
542
+ created._context = context;
543
+ created._privateAttributeReferences = {
544
544
  [kind]: privateAttributeReferences,
545
545
  };
546
546
  return created;
547
547
  }
548
- static fromLegacyUser(context) {
548
+ static _fromLegacyUser(context) {
549
549
  const keyValid = context.key !== undefined && context.key !== null;
550
550
  // For legacy users we allow empty keys.
551
551
  if (!keyValid) {
552
- return Context.contextForError('user', 'The key for the context was not valid');
552
+ return Context._contextForError('user', 'The key for the context was not valid');
553
553
  }
554
554
  const created = new Context(true, 'user');
555
- created.isUser = true;
556
- created.wasLegacy = true;
557
- created.context = legacyToSingleKind(context);
558
- created.privateAttributeReferences = {
555
+ created._isUser = true;
556
+ created._wasLegacy = true;
557
+ created._context = legacyToSingleKind(context);
558
+ created._privateAttributeReferences = {
559
559
  user: processPrivateAttributes(context.privateAttributeNames, true),
560
560
  };
561
561
  return created;
@@ -568,18 +568,18 @@ class Context {
568
568
  */
569
569
  static fromLDContext(context) {
570
570
  if (!context) {
571
- return Context.contextForError('unknown', 'No context specified. Returning default value');
571
+ return Context._contextForError('unknown', 'No context specified. Returning default value');
572
572
  }
573
573
  if (isSingleKind(context)) {
574
- return Context.fromSingleKindContext(context);
574
+ return Context._fromSingleKindContext(context);
575
575
  }
576
576
  if (isMultiKind(context)) {
577
- return Context.fromMultiKindContext(context);
577
+ return Context._fromMultiKindContext(context);
578
578
  }
579
579
  if (isLegacyUser(context)) {
580
- return Context.fromLegacyUser(context);
580
+ return Context._fromLegacyUser(context);
581
581
  }
582
- return Context.contextForError('unknown', 'Context was not of a valid kind');
582
+ return Context._contextForError('unknown', 'Context was not of a valid kind');
583
583
  }
584
584
  /**
585
585
  * Creates a {@link LDContext} from a {@link Context}.
@@ -591,7 +591,7 @@ class Context {
591
591
  return undefined;
592
592
  }
593
593
  const contexts = context.getContexts();
594
- if (!context.isMulti) {
594
+ if (!context._isMulti) {
595
595
  return contexts[0][1];
596
596
  }
597
597
  const result = {
@@ -614,7 +614,7 @@ class Context {
614
614
  if (reference.isKind) {
615
615
  return this.kinds;
616
616
  }
617
- return Context.getValueFromContext(reference, this.contextForKind(kind));
617
+ return Context._getValueFromContext(reference, this._contextForKind(kind));
618
618
  }
619
619
  /**
620
620
  * Attempt to get a key for the specified kind.
@@ -622,35 +622,35 @@ class Context {
622
622
  * @returns The key for the specified kind, or undefined.
623
623
  */
624
624
  key(kind = DEFAULT_KIND) {
625
- return this.contextForKind(kind)?.key;
625
+ return this._contextForKind(kind)?.key;
626
626
  }
627
627
  /**
628
628
  * True if this is a multi-kind context.
629
629
  */
630
630
  get isMultiKind() {
631
- return this.isMulti;
631
+ return this._isMulti;
632
632
  }
633
633
  /**
634
634
  * Get the canonical key for this context.
635
635
  */
636
636
  get canonicalKey() {
637
- if (this.isUser) {
638
- return this.context.key;
637
+ if (this._isUser) {
638
+ return this._context.key;
639
639
  }
640
- if (this.isMulti) {
641
- return Object.keys(this.contexts)
640
+ if (this._isMulti) {
641
+ return Object.keys(this._contexts)
642
642
  .sort()
643
- .map((key) => `${key}:${encodeKey(this.contexts[key].key)}`)
643
+ .map((key) => `${key}:${encodeKey(this._contexts[key].key)}`)
644
644
  .join(':');
645
645
  }
646
- return `${this.kind}:${encodeKey(this.context.key)}`;
646
+ return `${this.kind}:${encodeKey(this._context.key)}`;
647
647
  }
648
648
  /**
649
649
  * Get the kinds of this context.
650
650
  */
651
651
  get kinds() {
652
- if (this.isMulti) {
653
- return Object.keys(this.contexts);
652
+ if (this._isMulti) {
653
+ return Object.keys(this._contexts);
654
654
  }
655
655
  return [this.kind];
656
656
  }
@@ -658,13 +658,13 @@ class Context {
658
658
  * Get the kinds, and their keys, for this context.
659
659
  */
660
660
  get kindsAndKeys() {
661
- if (this.isMulti) {
662
- return Object.entries(this.contexts).reduce((acc, [kind, context]) => {
661
+ if (this._isMulti) {
662
+ return Object.entries(this._contexts).reduce((acc, [kind, context]) => {
663
663
  acc[kind] = context.key;
664
664
  return acc;
665
665
  }, {});
666
666
  }
667
- return { [this.kind]: this.context.key };
667
+ return { [this.kind]: this._context.key };
668
668
  }
669
669
  /**
670
670
  * Get the attribute references.
@@ -672,7 +672,7 @@ class Context {
672
672
  * @param kind
673
673
  */
674
674
  privateAttributes(kind) {
675
- return this.privateAttributeReferences?.[kind] || [];
675
+ return this._privateAttributeReferences?.[kind] || [];
676
676
  }
677
677
  /**
678
678
  * Get the underlying context objects from this context.
@@ -682,16 +682,16 @@ class Context {
682
682
  * The returned objects should not be modified.
683
683
  */
684
684
  getContexts() {
685
- if (this.isMulti) {
686
- return Object.entries(this.contexts);
685
+ if (this._isMulti) {
686
+ return Object.entries(this._contexts);
687
687
  }
688
- return [[this.kind, this.context]];
688
+ return [[this.kind, this._context]];
689
689
  }
690
690
  get legacy() {
691
- return this.wasLegacy;
691
+ return this._wasLegacy;
692
692
  }
693
693
  }
694
- Context.userKind = DEFAULT_KIND;
694
+ Context.UserKind = DEFAULT_KIND;
695
695
 
696
696
  // _meta is part of the specification.
697
697
  // These attributes cannot be removed via a private attribute.
@@ -765,31 +765,31 @@ function cloneWithRedactions(target, references) {
765
765
  return { cloned, excluded: excluded.sort() };
766
766
  }
767
767
  class ContextFilter {
768
- constructor(allAttributesPrivate, privateAttributes) {
769
- this.allAttributesPrivate = allAttributesPrivate;
770
- this.privateAttributes = privateAttributes;
768
+ constructor(_allAttributesPrivate, _privateAttributes) {
769
+ this._allAttributesPrivate = _allAttributesPrivate;
770
+ this._privateAttributes = _privateAttributes;
771
771
  }
772
772
  filter(context, redactAnonymousAttributes = false) {
773
773
  const contexts = context.getContexts();
774
774
  if (contexts.length === 1) {
775
- return this.filterSingleKind(context, contexts[0][1], contexts[0][0], redactAnonymousAttributes);
775
+ return this._filterSingleKind(context, contexts[0][1], contexts[0][0], redactAnonymousAttributes);
776
776
  }
777
777
  const filteredMulti = {
778
778
  kind: 'multi',
779
779
  };
780
780
  contexts.forEach(([kind, single]) => {
781
- filteredMulti[kind] = this.filterSingleKind(context, single, kind, redactAnonymousAttributes);
781
+ filteredMulti[kind] = this._filterSingleKind(context, single, kind, redactAnonymousAttributes);
782
782
  });
783
783
  return filteredMulti;
784
784
  }
785
- getAttributesToFilter(context, single, kind, redactAllAttributes) {
785
+ _getAttributesToFilter(context, single, kind, redactAllAttributes) {
786
786
  return (redactAllAttributes
787
787
  ? Object.keys(single).map((k) => new AttributeReference(k, true))
788
- : [...this.privateAttributes, ...context.privateAttributes(kind)]).filter((attr) => !protectedAttributes.some((protectedAttr) => protectedAttr.compare(attr)));
788
+ : [...this._privateAttributes, ...context.privateAttributes(kind)]).filter((attr) => !protectedAttributes.some((protectedAttr) => protectedAttr.compare(attr)));
789
789
  }
790
- filterSingleKind(context, single, kind, redactAnonymousAttributes) {
791
- const redactAllAttributes = this.allAttributesPrivate || (redactAnonymousAttributes && single.anonymous === true);
792
- const { cloned, excluded } = cloneWithRedactions(single, this.getAttributesToFilter(context, single, kind, redactAllAttributes));
790
+ _filterSingleKind(context, single, kind, redactAnonymousAttributes) {
791
+ const redactAllAttributes = this._allAttributesPrivate || (redactAnonymousAttributes && single.anonymous === true);
792
+ const { cloned, excluded } = cloneWithRedactions(single, this._getAttributesToFilter(context, single, kind, redactAllAttributes));
793
793
  if (context.legacy) {
794
794
  legacyTopLevelCopyAttributes.forEach((name) => {
795
795
  if (name in cloned) {
@@ -981,6 +981,7 @@ const escapes = {
981
981
  f: (val) => toFloat(val),
982
982
  j: (val) => tryStringify(val),
983
983
  o: (val) => tryStringify(val),
984
+ // eslint-disable-next-line @typescript-eslint/naming-convention
984
985
  O: (val) => tryStringify(val),
985
986
  c: () => '',
986
987
  };
@@ -1067,17 +1068,17 @@ class BasicLogger {
1067
1068
  return new BasicLogger({});
1068
1069
  }
1069
1070
  constructor(options) {
1070
- this.logLevel = LogPriority[options.level ?? 'info'] ?? LogPriority.info;
1071
- this.name = options.name ?? 'LaunchDarkly';
1071
+ this._logLevel = LogPriority[options.level ?? 'info'] ?? LogPriority.info;
1072
+ this._name = options.name ?? 'LaunchDarkly';
1072
1073
  // eslint-disable-next-line no-console
1073
- this.destination = options.destination;
1074
- this.formatter = options.formatter;
1074
+ this._destination = options.destination;
1075
+ this._formatter = options.formatter;
1075
1076
  }
1076
- tryFormat(...args) {
1077
+ _tryFormat(...args) {
1077
1078
  try {
1078
- if (this.formatter) {
1079
+ if (this._formatter) {
1079
1080
  // In case the provided formatter fails.
1080
- return this.formatter?.(...args);
1081
+ return this._formatter?.(...args);
1081
1082
  }
1082
1083
  return format(...args);
1083
1084
  }
@@ -1085,21 +1086,21 @@ class BasicLogger {
1085
1086
  return format(...args);
1086
1087
  }
1087
1088
  }
1088
- tryWrite(msg) {
1089
+ _tryWrite(msg) {
1089
1090
  try {
1090
- this.destination(msg);
1091
+ this._destination(msg);
1091
1092
  }
1092
1093
  catch {
1093
1094
  // eslint-disable-next-line no-console
1094
1095
  console.error(msg);
1095
1096
  }
1096
1097
  }
1097
- log(level, args) {
1098
- if (level >= this.logLevel) {
1099
- const prefix = `${LevelNames[level]}: [${this.name}]`;
1098
+ _log(level, args) {
1099
+ if (level >= this._logLevel) {
1100
+ const prefix = `${LevelNames[level]}: [${this._name}]`;
1100
1101
  try {
1101
- if (this.destination) {
1102
- this.tryWrite(`${prefix} ${this.tryFormat(...args)}`);
1102
+ if (this._destination) {
1103
+ this._tryWrite(`${prefix} ${this._tryFormat(...args)}`);
1103
1104
  }
1104
1105
  else {
1105
1106
  // `console.error` has its own formatter.
@@ -1116,16 +1117,16 @@ class BasicLogger {
1116
1117
  }
1117
1118
  }
1118
1119
  error(...args) {
1119
- this.log(LogPriority.error, args);
1120
+ this._log(LogPriority.error, args);
1120
1121
  }
1121
1122
  warn(...args) {
1122
- this.log(LogPriority.warn, args);
1123
+ this._log(LogPriority.warn, args);
1123
1124
  }
1124
1125
  info(...args) {
1125
- this.log(LogPriority.info, args);
1126
+ this._log(LogPriority.info, args);
1126
1127
  }
1127
1128
  debug(...args) {
1128
- this.log(LogPriority.debug, args);
1129
+ this._log(LogPriority.debug, args);
1129
1130
  }
1130
1131
  }
1131
1132
 
@@ -1162,29 +1163,29 @@ class SafeLogger {
1162
1163
  // criteria since the SDK calls the logger during nearly all of its operations.
1163
1164
  }
1164
1165
  });
1165
- this.logger = logger;
1166
- this.fallback = fallback;
1166
+ this._logger = logger;
1167
+ this._fallback = fallback;
1167
1168
  }
1168
- log(level, args) {
1169
+ _log(level, args) {
1169
1170
  try {
1170
- this.logger[level](...args);
1171
+ this._logger[level](...args);
1171
1172
  }
1172
1173
  catch {
1173
1174
  // If all else fails do not break.
1174
- this.fallback[level](...args);
1175
+ this._fallback[level](...args);
1175
1176
  }
1176
1177
  }
1177
1178
  error(...args) {
1178
- this.log('error', args);
1179
+ this._log('error', args);
1179
1180
  }
1180
1181
  warn(...args) {
1181
- this.log('warn', args);
1182
+ this._log('warn', args);
1182
1183
  }
1183
1184
  info(...args) {
1184
- this.log('info', args);
1185
+ this._log('info', args);
1185
1186
  }
1186
1187
  debug(...args) {
1187
- this.log('debug', args);
1188
+ this._log('debug', args);
1188
1189
  }
1189
1190
  }
1190
1191
 
@@ -1315,6 +1316,7 @@ class ServiceEndpoints {
1315
1316
  this.payloadFilterKey = payloadFilterKey;
1316
1317
  }
1317
1318
  }
1319
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1318
1320
  ServiceEndpoints.DEFAULT_EVENTS = 'https://events.launchdarkly.com';
1319
1321
  function getWithParams(uri, parameters) {
1320
1322
  if (parameters.length === 0) {
@@ -1653,14 +1655,14 @@ const timedPromise = (t, taskName) => new Promise((_res, reject) => {
1653
1655
  });
1654
1656
 
1655
1657
  class DiagnosticsManager {
1656
- constructor(sdkKey, platform, diagnosticInitConfig) {
1657
- this.platform = platform;
1658
- this.diagnosticInitConfig = diagnosticInitConfig;
1659
- this.streamInits = [];
1660
- this.startTime = Date.now();
1661
- this.dataSinceDate = this.startTime;
1662
- this.id = {
1663
- diagnosticId: platform.crypto.randomUUID(),
1658
+ constructor(sdkKey, _platform, _diagnosticInitConfig) {
1659
+ this._platform = _platform;
1660
+ this._diagnosticInitConfig = _diagnosticInitConfig;
1661
+ this._streamInits = [];
1662
+ this._startTime = Date.now();
1663
+ this._dataSinceDate = this._startTime;
1664
+ this._id = {
1665
+ diagnosticId: _platform.crypto.randomUUID(),
1664
1666
  sdkKeySuffix: sdkKey.length > 6 ? sdkKey.substring(sdkKey.length - 6) : sdkKey,
1665
1667
  };
1666
1668
  }
@@ -1669,14 +1671,14 @@ class DiagnosticsManager {
1669
1671
  * not be repeated during the lifetime of the SDK client.
1670
1672
  */
1671
1673
  createInitEvent() {
1672
- const sdkData = this.platform.info.sdkData();
1673
- const platformData = this.platform.info.platformData();
1674
+ const sdkData = this._platform.info.sdkData();
1675
+ const platformData = this._platform.info.platformData();
1674
1676
  return {
1675
1677
  kind: 'diagnostic-init',
1676
- id: this.id,
1677
- creationDate: this.startTime,
1678
+ id: this._id,
1679
+ creationDate: this._startTime,
1678
1680
  sdk: sdkData,
1679
- configuration: this.diagnosticInitConfig,
1681
+ configuration: this._diagnosticInitConfig,
1680
1682
  platform: {
1681
1683
  name: platformData.name,
1682
1684
  osArch: platformData.os?.arch,
@@ -1696,7 +1698,7 @@ class DiagnosticsManager {
1696
1698
  */
1697
1699
  recordStreamInit(timestamp, failed, durationMillis) {
1698
1700
  const item = { timestamp, failed, durationMillis };
1699
- this.streamInits.push(item);
1701
+ this._streamInits.push(item);
1700
1702
  }
1701
1703
  /**
1702
1704
  * Creates a periodic event containing time-dependent stats, and resets the state of the manager
@@ -1710,16 +1712,16 @@ class DiagnosticsManager {
1710
1712
  const currentTime = Date.now();
1711
1713
  const evt = {
1712
1714
  kind: 'diagnostic',
1713
- id: this.id,
1715
+ id: this._id,
1714
1716
  creationDate: currentTime,
1715
- dataSinceDate: this.dataSinceDate,
1717
+ dataSinceDate: this._dataSinceDate,
1716
1718
  droppedEvents,
1717
1719
  deduplicatedUsers,
1718
1720
  eventsInLastBatch,
1719
- streamInits: this.streamInits,
1721
+ streamInits: this._streamInits,
1720
1722
  };
1721
- this.streamInits = [];
1722
- this.dataSinceDate = currentTime;
1723
+ this._streamInits = [];
1724
+ this._dataSinceDate = currentTime;
1723
1725
  return evt;
1724
1726
  }
1725
1727
  }
@@ -1746,25 +1748,25 @@ class ClientMessages {
1746
1748
  ` (${badType}), only numeric metric values are supported.`);
1747
1749
  }
1748
1750
  }
1749
- ClientMessages.missingContextKeyNoEvent = 'Context was unspecified or had no key; event will not be sent';
1751
+ ClientMessages.MissingContextKeyNoEvent = 'Context was unspecified or had no key; event will not be sent';
1750
1752
 
1751
1753
  class EventSender {
1752
1754
  constructor(clientContext, baseHeaders) {
1753
1755
  const { basicConfiguration, platform } = clientContext;
1754
1756
  const { serviceEndpoints: { analyticsEventPath, diagnosticEventPath }, } = basicConfiguration;
1755
1757
  const { crypto, requests } = platform;
1756
- this.defaultHeaders = { ...baseHeaders };
1757
- this.eventsUri = getEventsUri(basicConfiguration.serviceEndpoints, analyticsEventPath, []);
1758
- this.diagnosticEventsUri = getEventsUri(basicConfiguration.serviceEndpoints, diagnosticEventPath, []);
1759
- this.requests = requests;
1760
- this.crypto = crypto;
1758
+ this._defaultHeaders = { ...baseHeaders };
1759
+ this._eventsUri = getEventsUri(basicConfiguration.serviceEndpoints, analyticsEventPath, []);
1760
+ this._diagnosticEventsUri = getEventsUri(basicConfiguration.serviceEndpoints, diagnosticEventPath, []);
1761
+ this._requests = requests;
1762
+ this._crypto = crypto;
1761
1763
  }
1762
- async tryPostingEvents(events, uri, payloadId, canRetry) {
1764
+ async _tryPostingEvents(events, uri, payloadId, canRetry) {
1763
1765
  const tryRes = {
1764
1766
  status: LDDeliveryStatus.Succeeded,
1765
1767
  };
1766
1768
  const headers = {
1767
- ...this.defaultHeaders,
1769
+ ...this._defaultHeaders,
1768
1770
  'content-type': 'application/json',
1769
1771
  };
1770
1772
  if (payloadId) {
@@ -1773,7 +1775,7 @@ class EventSender {
1773
1775
  }
1774
1776
  let error;
1775
1777
  try {
1776
- const { status, headers: resHeaders } = await this.requests.fetch(uri, {
1778
+ const { status, headers: resHeaders } = await this._requests.fetch(uri, {
1777
1779
  headers,
1778
1780
  body: JSON.stringify(events),
1779
1781
  method: 'POST',
@@ -1815,12 +1817,12 @@ class EventSender {
1815
1817
  }
1816
1818
  // wait 1 second before retrying
1817
1819
  await sleep();
1818
- return this.tryPostingEvents(events, this.eventsUri, payloadId, false);
1820
+ return this._tryPostingEvents(events, this._eventsUri, payloadId, false);
1819
1821
  }
1820
1822
  async sendEventData(type, data) {
1821
- const payloadId = type === LDEventType.AnalyticsEvents ? this.crypto.randomUUID() : undefined;
1822
- const uri = type === LDEventType.AnalyticsEvents ? this.eventsUri : this.diagnosticEventsUri;
1823
- return this.tryPostingEvents(data, uri, payloadId, true);
1823
+ const payloadId = type === LDEventType.AnalyticsEvents ? this._crypto.randomUUID() : undefined;
1824
+ const uri = type === LDEventType.AnalyticsEvents ? this._eventsUri : this._diagnosticEventsUri;
1825
+ return this._tryPostingEvents(data, uri, payloadId, true);
1824
1826
  }
1825
1827
  }
1826
1828
 
@@ -1859,43 +1861,43 @@ function counterKey(event) {
1859
1861
  */
1860
1862
  class EventSummarizer {
1861
1863
  constructor() {
1862
- this.startDate = 0;
1863
- this.endDate = 0;
1864
- this.counters = {};
1865
- this.contextKinds = {};
1864
+ this._startDate = 0;
1865
+ this._endDate = 0;
1866
+ this._counters = {};
1867
+ this._contextKinds = {};
1866
1868
  }
1867
1869
  summarizeEvent(event) {
1868
1870
  if (isFeature(event) && !event.excludeFromSummaries) {
1869
1871
  const countKey = counterKey(event);
1870
- const counter = this.counters[countKey];
1871
- let kinds = this.contextKinds[event.key];
1872
+ const counter = this._counters[countKey];
1873
+ let kinds = this._contextKinds[event.key];
1872
1874
  if (!kinds) {
1873
1875
  kinds = new Set();
1874
- this.contextKinds[event.key] = kinds;
1876
+ this._contextKinds[event.key] = kinds;
1875
1877
  }
1876
1878
  event.context.kinds.forEach((kind) => kinds.add(kind));
1877
1879
  if (counter) {
1878
1880
  counter.increment();
1879
1881
  }
1880
1882
  else {
1881
- this.counters[countKey] = new SummaryCounter(1, event.key, event.value, event.default, event.version, event.variation);
1883
+ this._counters[countKey] = new SummaryCounter(1, event.key, event.value, event.default, event.version, event.variation);
1882
1884
  }
1883
- if (this.startDate === 0 || event.creationDate < this.startDate) {
1884
- this.startDate = event.creationDate;
1885
+ if (this._startDate === 0 || event.creationDate < this._startDate) {
1886
+ this._startDate = event.creationDate;
1885
1887
  }
1886
- if (event.creationDate > this.endDate) {
1887
- this.endDate = event.creationDate;
1888
+ if (event.creationDate > this._endDate) {
1889
+ this._endDate = event.creationDate;
1888
1890
  }
1889
1891
  }
1890
1892
  }
1891
1893
  getSummary() {
1892
- const features = Object.values(this.counters).reduce((acc, counter) => {
1894
+ const features = Object.values(this._counters).reduce((acc, counter) => {
1893
1895
  let flagSummary = acc[counter.key];
1894
1896
  if (!flagSummary) {
1895
1897
  flagSummary = {
1896
1898
  default: counter.default,
1897
1899
  counters: [],
1898
- contextKinds: [...this.contextKinds[counter.key]],
1900
+ contextKinds: [...this._contextKinds[counter.key]],
1899
1901
  };
1900
1902
  acc[counter.key] = flagSummary;
1901
1903
  }
@@ -1916,17 +1918,17 @@ class EventSummarizer {
1916
1918
  return acc;
1917
1919
  }, {});
1918
1920
  return {
1919
- startDate: this.startDate,
1920
- endDate: this.endDate,
1921
+ startDate: this._startDate,
1922
+ endDate: this._endDate,
1921
1923
  features,
1922
1924
  kind: 'summary',
1923
1925
  };
1924
1926
  }
1925
1927
  clearSummary() {
1926
- this.startDate = 0;
1927
- this.endDate = 0;
1928
- this.counters = {};
1929
- this.contextKinds = {};
1928
+ this._startDate = 0;
1929
+ this._endDate = 0;
1930
+ this._counters = {};
1931
+ this._contextKinds = {};
1930
1932
  }
1931
1933
  }
1932
1934
 
@@ -1958,88 +1960,88 @@ function shouldSample(ratio) {
1958
1960
  }
1959
1961
 
1960
1962
  class EventProcessor {
1961
- constructor(config, clientContext, baseHeaders, contextDeduplicator, diagnosticsManager, start = true) {
1962
- this.config = config;
1963
- this.contextDeduplicator = contextDeduplicator;
1964
- this.diagnosticsManager = diagnosticsManager;
1965
- this.summarizer = new EventSummarizer();
1966
- this.queue = [];
1967
- this.lastKnownPastTime = 0;
1968
- this.droppedEvents = 0;
1969
- this.deduplicatedUsers = 0;
1970
- this.exceededCapacity = false;
1971
- this.eventsInLastBatch = 0;
1972
- this.shutdown = false;
1973
- this.flushUsersTimer = null;
1974
- this.capacity = config.eventsCapacity;
1975
- this.logger = clientContext.basicConfiguration.logger;
1976
- this.eventSender = new EventSender(clientContext, baseHeaders);
1977
- this.contextFilter = new ContextFilter(config.allAttributesPrivate, config.privateAttributes.map((ref) => new AttributeReference(ref)));
1963
+ constructor(_config, clientContext, baseHeaders, _contextDeduplicator, _diagnosticsManager, start = true) {
1964
+ this._config = _config;
1965
+ this._contextDeduplicator = _contextDeduplicator;
1966
+ this._diagnosticsManager = _diagnosticsManager;
1967
+ this._summarizer = new EventSummarizer();
1968
+ this._queue = [];
1969
+ this._lastKnownPastTime = 0;
1970
+ this._droppedEvents = 0;
1971
+ this._deduplicatedUsers = 0;
1972
+ this._exceededCapacity = false;
1973
+ this._eventsInLastBatch = 0;
1974
+ this._shutdown = false;
1975
+ this._flushUsersTimer = null;
1976
+ this._capacity = _config.eventsCapacity;
1977
+ this._logger = clientContext.basicConfiguration.logger;
1978
+ this._eventSender = new EventSender(clientContext, baseHeaders);
1979
+ this._contextFilter = new ContextFilter(_config.allAttributesPrivate, _config.privateAttributes.map((ref) => new AttributeReference(ref)));
1978
1980
  if (start) {
1979
1981
  this.start();
1980
1982
  }
1981
1983
  }
1982
1984
  start() {
1983
- if (this.contextDeduplicator?.flushInterval !== undefined) {
1984
- this.flushUsersTimer = setInterval(() => {
1985
- this.contextDeduplicator?.flush();
1986
- }, this.contextDeduplicator.flushInterval * 1000);
1985
+ if (this._contextDeduplicator?.flushInterval !== undefined) {
1986
+ this._flushUsersTimer = setInterval(() => {
1987
+ this._contextDeduplicator?.flush();
1988
+ }, this._contextDeduplicator.flushInterval * 1000);
1987
1989
  }
1988
- this.flushTimer = setInterval(async () => {
1990
+ this._flushTimer = setInterval(async () => {
1989
1991
  try {
1990
1992
  await this.flush();
1991
1993
  }
1992
1994
  catch (e) {
1993
1995
  // Log errors and swallow them
1994
- this.logger?.debug(`Flush failed: ${e}`);
1996
+ this._logger?.debug(`Flush failed: ${e}`);
1995
1997
  }
1996
- }, this.config.flushInterval * 1000);
1997
- if (this.diagnosticsManager) {
1998
- const initEvent = this.diagnosticsManager.createInitEvent();
1999
- this.postDiagnosticEvent(initEvent);
2000
- this.diagnosticsTimer = setInterval(() => {
2001
- const statsEvent = this.diagnosticsManager.createStatsEventAndReset(this.droppedEvents, this.deduplicatedUsers, this.eventsInLastBatch);
2002
- this.droppedEvents = 0;
2003
- this.deduplicatedUsers = 0;
2004
- this.postDiagnosticEvent(statsEvent);
2005
- }, this.config.diagnosticRecordingInterval * 1000);
2006
- }
2007
- this.logger?.debug('Started EventProcessor.');
2008
- }
2009
- postDiagnosticEvent(event) {
2010
- this.eventSender.sendEventData(LDEventType.DiagnosticEvent, event);
1998
+ }, this._config.flushInterval * 1000);
1999
+ if (this._diagnosticsManager) {
2000
+ const initEvent = this._diagnosticsManager.createInitEvent();
2001
+ this._postDiagnosticEvent(initEvent);
2002
+ this._diagnosticsTimer = setInterval(() => {
2003
+ const statsEvent = this._diagnosticsManager.createStatsEventAndReset(this._droppedEvents, this._deduplicatedUsers, this._eventsInLastBatch);
2004
+ this._droppedEvents = 0;
2005
+ this._deduplicatedUsers = 0;
2006
+ this._postDiagnosticEvent(statsEvent);
2007
+ }, this._config.diagnosticRecordingInterval * 1000);
2008
+ }
2009
+ this._logger?.debug('Started EventProcessor.');
2010
+ }
2011
+ _postDiagnosticEvent(event) {
2012
+ this._eventSender.sendEventData(LDEventType.DiagnosticEvent, event);
2011
2013
  }
2012
2014
  close() {
2013
- clearInterval(this.flushTimer);
2014
- if (this.flushUsersTimer) {
2015
- clearInterval(this.flushUsersTimer);
2015
+ clearInterval(this._flushTimer);
2016
+ if (this._flushUsersTimer) {
2017
+ clearInterval(this._flushUsersTimer);
2016
2018
  }
2017
- if (this.diagnosticsTimer) {
2018
- clearInterval(this.diagnosticsTimer);
2019
+ if (this._diagnosticsTimer) {
2020
+ clearInterval(this._diagnosticsTimer);
2019
2021
  }
2020
2022
  }
2021
2023
  async flush() {
2022
- if (this.shutdown) {
2024
+ if (this._shutdown) {
2023
2025
  throw new LDInvalidSDKKeyError('Events cannot be posted because a permanent error has been encountered. ' +
2024
2026
  'This is most likely an invalid SDK key. The specific error information ' +
2025
2027
  'is logged independently.');
2026
2028
  }
2027
- const eventsToFlush = this.queue;
2028
- this.queue = [];
2029
- const summary = this.summarizer.getSummary();
2030
- this.summarizer.clearSummary();
2029
+ const eventsToFlush = this._queue;
2030
+ this._queue = [];
2031
+ const summary = this._summarizer.getSummary();
2032
+ this._summarizer.clearSummary();
2031
2033
  if (Object.keys(summary.features).length) {
2032
2034
  eventsToFlush.push(summary);
2033
2035
  }
2034
2036
  if (!eventsToFlush.length) {
2035
2037
  return;
2036
2038
  }
2037
- this.eventsInLastBatch = eventsToFlush.length;
2038
- this.logger?.debug('Flushing %d events', eventsToFlush.length);
2039
- await this.tryPostingEvents(eventsToFlush);
2039
+ this._eventsInLastBatch = eventsToFlush.length;
2040
+ this._logger?.debug('Flushing %d events', eventsToFlush.length);
2041
+ await this._tryPostingEvents(eventsToFlush);
2040
2042
  }
2041
2043
  sendEvent(inputEvent) {
2042
- if (this.shutdown) {
2044
+ if (this._shutdown) {
2043
2045
  return;
2044
2046
  }
2045
2047
  if (isMigration(inputEvent)) {
@@ -2053,25 +2055,25 @@ class EventProcessor {
2053
2055
  if (migrationEvent.samplingRatio === 1) {
2054
2056
  delete migrationEvent.samplingRatio;
2055
2057
  }
2056
- this.enqueue(migrationEvent);
2058
+ this._enqueue(migrationEvent);
2057
2059
  }
2058
2060
  return;
2059
2061
  }
2060
- this.summarizer.summarizeEvent(inputEvent);
2062
+ this._summarizer.summarizeEvent(inputEvent);
2061
2063
  const isFeatureEvent = isFeature(inputEvent);
2062
2064
  const addFullEvent = (isFeatureEvent && inputEvent.trackEvents) || !isFeatureEvent;
2063
- const addDebugEvent = this.shouldDebugEvent(inputEvent);
2065
+ const addDebugEvent = this._shouldDebugEvent(inputEvent);
2064
2066
  const isIdentifyEvent = isIdentify(inputEvent);
2065
- const shouldNotDeduplicate = this.contextDeduplicator?.processContext(inputEvent.context);
2067
+ const shouldNotDeduplicate = this._contextDeduplicator?.processContext(inputEvent.context);
2066
2068
  // If there is no cache, then it will never be in the cache.
2067
2069
  if (!shouldNotDeduplicate) {
2068
2070
  if (!isIdentifyEvent) {
2069
- this.deduplicatedUsers += 1;
2071
+ this._deduplicatedUsers += 1;
2070
2072
  }
2071
2073
  }
2072
2074
  const addIndexEvent = shouldNotDeduplicate && !isIdentifyEvent;
2073
2075
  if (addIndexEvent) {
2074
- this.enqueue(this.makeOutputEvent({
2076
+ this._enqueue(this._makeOutputEvent({
2075
2077
  kind: 'index',
2076
2078
  creationDate: inputEvent.creationDate,
2077
2079
  context: inputEvent.context,
@@ -2079,19 +2081,19 @@ class EventProcessor {
2079
2081
  }, false));
2080
2082
  }
2081
2083
  if (addFullEvent && shouldSample(inputEvent.samplingRatio)) {
2082
- this.enqueue(this.makeOutputEvent(inputEvent, false));
2084
+ this._enqueue(this._makeOutputEvent(inputEvent, false));
2083
2085
  }
2084
2086
  if (addDebugEvent && shouldSample(inputEvent.samplingRatio)) {
2085
- this.enqueue(this.makeOutputEvent(inputEvent, true));
2087
+ this._enqueue(this._makeOutputEvent(inputEvent, true));
2086
2088
  }
2087
2089
  }
2088
- makeOutputEvent(event, debug) {
2090
+ _makeOutputEvent(event, debug) {
2089
2091
  switch (event.kind) {
2090
2092
  case 'feature': {
2091
2093
  const out = {
2092
2094
  kind: debug ? 'debug' : 'feature',
2093
2095
  creationDate: event.creationDate,
2094
- context: this.contextFilter.filter(event.context, !debug),
2096
+ context: this._contextFilter.filter(event.context, !debug),
2095
2097
  key: event.key,
2096
2098
  value: event.value,
2097
2099
  default: event.default,
@@ -2118,7 +2120,7 @@ class EventProcessor {
2118
2120
  const out = {
2119
2121
  kind: event.kind,
2120
2122
  creationDate: event.creationDate,
2121
- context: this.contextFilter.filter(event.context),
2123
+ context: this._contextFilter.filter(event.context),
2122
2124
  };
2123
2125
  if (event.samplingRatio !== 1) {
2124
2126
  out.samplingRatio = event.samplingRatio;
@@ -2172,32 +2174,32 @@ class EventProcessor {
2172
2174
  return event;
2173
2175
  }
2174
2176
  }
2175
- enqueue(event) {
2176
- if (this.queue.length < this.capacity) {
2177
- this.queue.push(event);
2178
- this.exceededCapacity = false;
2177
+ _enqueue(event) {
2178
+ if (this._queue.length < this._capacity) {
2179
+ this._queue.push(event);
2180
+ this._exceededCapacity = false;
2179
2181
  }
2180
2182
  else {
2181
- if (!this.exceededCapacity) {
2182
- this.exceededCapacity = true;
2183
- this.logger?.warn('Exceeded event queue capacity. Increase capacity to avoid dropping events.');
2183
+ if (!this._exceededCapacity) {
2184
+ this._exceededCapacity = true;
2185
+ this._logger?.warn('Exceeded event queue capacity. Increase capacity to avoid dropping events.');
2184
2186
  }
2185
- this.droppedEvents += 1;
2187
+ this._droppedEvents += 1;
2186
2188
  }
2187
2189
  }
2188
- shouldDebugEvent(event) {
2190
+ _shouldDebugEvent(event) {
2189
2191
  return (isFeature(event) &&
2190
2192
  event.debugEventsUntilDate &&
2191
- event.debugEventsUntilDate > this.lastKnownPastTime &&
2193
+ event.debugEventsUntilDate > this._lastKnownPastTime &&
2192
2194
  event.debugEventsUntilDate > Date.now());
2193
2195
  }
2194
- async tryPostingEvents(events) {
2195
- const res = await this.eventSender.sendEventData(LDEventType.AnalyticsEvents, events);
2196
+ async _tryPostingEvents(events) {
2197
+ const res = await this._eventSender.sendEventData(LDEventType.AnalyticsEvents, events);
2196
2198
  if (res.status === LDDeliveryStatus.FailedAndMustShutDown) {
2197
- this.shutdown = true;
2199
+ this._shutdown = true;
2198
2200
  }
2199
2201
  if (res.serverTime) {
2200
- this.lastKnownPastTime = res.serverTime;
2202
+ this._lastKnownPastTime = res.serverTime;
2201
2203
  }
2202
2204
  if (res.error) {
2203
2205
  throw res.error;
@@ -2277,16 +2279,16 @@ class NullEventProcessor {
2277
2279
  }
2278
2280
 
2279
2281
  class EventFactoryBase {
2280
- constructor(withReasons) {
2281
- this.withReasons = withReasons;
2282
+ constructor(_withReasons) {
2283
+ this._withReasons = _withReasons;
2282
2284
  }
2283
2285
  evalEvent(e) {
2284
- return new InputEvalEvent(this.withReasons, e.context, e.flagKey, e.value, e.defaultVal, e.version,
2286
+ return new InputEvalEvent(this._withReasons, e.context, e.flagKey, e.value, e.defaultVal, e.version,
2285
2287
  // Exclude null as a possibility.
2286
- e.variation ?? undefined, e.trackEvents || e.addExperimentData, e.prereqOfFlagKey, this.withReasons || e.addExperimentData ? e.reason : undefined, e.debugEventsUntilDate, e.excludeFromSummaries, e.samplingRatio);
2288
+ e.variation ?? undefined, e.trackEvents || e.addExperimentData, e.prereqOfFlagKey, this._withReasons || e.addExperimentData ? e.reason : undefined, e.debugEventsUntilDate, e.excludeFromSummaries, e.samplingRatio);
2287
2289
  }
2288
2290
  unknownFlagEvent(key, defVal, context) {
2289
- return new InputEvalEvent(this.withReasons, context, key, defVal, defVal,
2291
+ return new InputEvalEvent(this._withReasons, context, key, defVal, defVal,
2290
2292
  // This isn't ideal, but the purpose of the factory is to at least
2291
2293
  // handle this situation.
2292
2294
  undefined, // version
@@ -2316,27 +2318,27 @@ const reportJsonError = (type, data, logger, errorHandler) => {
2316
2318
  };
2317
2319
  // TODO: SDK-156 - Move to Server SDK specific location
2318
2320
  class StreamingProcessor {
2319
- constructor(clientContext, streamUriPath, parameters, listeners, baseHeaders, diagnosticsManager, errorHandler, streamInitialReconnectDelay = 1) {
2320
- this.listeners = listeners;
2321
- this.diagnosticsManager = diagnosticsManager;
2322
- this.errorHandler = errorHandler;
2323
- this.streamInitialReconnectDelay = streamInitialReconnectDelay;
2321
+ constructor(clientContext, streamUriPath, parameters, _listeners, baseHeaders, _diagnosticsManager, _errorHandler, _streamInitialReconnectDelay = 1) {
2322
+ this._listeners = _listeners;
2323
+ this._diagnosticsManager = _diagnosticsManager;
2324
+ this._errorHandler = _errorHandler;
2325
+ this._streamInitialReconnectDelay = _streamInitialReconnectDelay;
2324
2326
  const { basicConfiguration, platform } = clientContext;
2325
2327
  const { logger } = basicConfiguration;
2326
2328
  const { requests } = platform;
2327
- this.headers = { ...baseHeaders };
2328
- this.logger = logger;
2329
- this.requests = requests;
2330
- this.streamUri = getStreamingUri(basicConfiguration.serviceEndpoints, streamUriPath, parameters);
2329
+ this._headers = { ...baseHeaders };
2330
+ this._logger = logger;
2331
+ this._requests = requests;
2332
+ this._streamUri = getStreamingUri(basicConfiguration.serviceEndpoints, streamUriPath, parameters);
2331
2333
  }
2332
- logConnectionStarted() {
2333
- this.connectionAttemptStartTime = Date.now();
2334
+ _logConnectionStarted() {
2335
+ this._connectionAttemptStartTime = Date.now();
2334
2336
  }
2335
- logConnectionResult(success) {
2336
- if (this.connectionAttemptStartTime && this.diagnosticsManager) {
2337
- this.diagnosticsManager.recordStreamInit(this.connectionAttemptStartTime, !success, Date.now() - this.connectionAttemptStartTime);
2337
+ _logConnectionResult(success) {
2338
+ if (this._connectionAttemptStartTime && this._diagnosticsManager) {
2339
+ this._diagnosticsManager.recordStreamInit(this._connectionAttemptStartTime, !success, Date.now() - this._connectionAttemptStartTime);
2338
2340
  }
2339
- this.connectionAttemptStartTime = undefined;
2341
+ this._connectionAttemptStartTime = undefined;
2340
2342
  }
2341
2343
  /**
2342
2344
  * This is a wrapper around the passed errorHandler which adds additional
@@ -2347,63 +2349,63 @@ class StreamingProcessor {
2347
2349
  *
2348
2350
  * @private
2349
2351
  */
2350
- retryAndHandleError(err) {
2352
+ _retryAndHandleError(err) {
2351
2353
  if (!shouldRetry(err)) {
2352
- this.logConnectionResult(false);
2353
- this.errorHandler?.(new LDStreamingError(exports.DataSourceErrorKind.ErrorResponse, err.message, err.status));
2354
- this.logger?.error(httpErrorMessage(err, 'streaming request'));
2354
+ this._logConnectionResult(false);
2355
+ this._errorHandler?.(new LDStreamingError(exports.DataSourceErrorKind.ErrorResponse, err.message, err.status));
2356
+ this._logger?.error(httpErrorMessage(err, 'streaming request'));
2355
2357
  return false;
2356
2358
  }
2357
- this.logger?.warn(httpErrorMessage(err, 'streaming request', 'will retry'));
2358
- this.logConnectionResult(false);
2359
- this.logConnectionStarted();
2359
+ this._logger?.warn(httpErrorMessage(err, 'streaming request', 'will retry'));
2360
+ this._logConnectionResult(false);
2361
+ this._logConnectionStarted();
2360
2362
  return true;
2361
2363
  }
2362
2364
  start() {
2363
- this.logConnectionStarted();
2365
+ this._logConnectionStarted();
2364
2366
  // TLS is handled by the platform implementation.
2365
- const eventSource = this.requests.createEventSource(this.streamUri, {
2366
- headers: this.headers,
2367
- errorFilter: (error) => this.retryAndHandleError(error),
2368
- initialRetryDelayMillis: 1000 * this.streamInitialReconnectDelay,
2367
+ const eventSource = this._requests.createEventSource(this._streamUri, {
2368
+ headers: this._headers,
2369
+ errorFilter: (error) => this._retryAndHandleError(error),
2370
+ initialRetryDelayMillis: 1000 * this._streamInitialReconnectDelay,
2369
2371
  readTimeoutMillis: 5 * 60 * 1000,
2370
2372
  retryResetIntervalMillis: 60 * 1000,
2371
2373
  });
2372
- this.eventSource = eventSource;
2374
+ this._eventSource = eventSource;
2373
2375
  eventSource.onclose = () => {
2374
- this.logger?.info('Closed LaunchDarkly stream connection');
2376
+ this._logger?.info('Closed LaunchDarkly stream connection');
2375
2377
  };
2376
2378
  eventSource.onerror = () => {
2377
2379
  // The work is done by `errorFilter`.
2378
2380
  };
2379
2381
  eventSource.onopen = () => {
2380
- this.logger?.info('Opened LaunchDarkly stream connection');
2382
+ this._logger?.info('Opened LaunchDarkly stream connection');
2381
2383
  };
2382
2384
  eventSource.onretrying = (e) => {
2383
- this.logger?.info(`Will retry stream connection in ${e.delayMillis} milliseconds`);
2385
+ this._logger?.info(`Will retry stream connection in ${e.delayMillis} milliseconds`);
2384
2386
  };
2385
- this.listeners.forEach(({ deserializeData, processJson }, eventName) => {
2387
+ this._listeners.forEach(({ deserializeData, processJson }, eventName) => {
2386
2388
  eventSource.addEventListener(eventName, (event) => {
2387
- this.logger?.debug(`Received ${eventName} event`);
2389
+ this._logger?.debug(`Received ${eventName} event`);
2388
2390
  if (event?.data) {
2389
- this.logConnectionResult(true);
2391
+ this._logConnectionResult(true);
2390
2392
  const { data } = event;
2391
2393
  const dataJson = deserializeData(data);
2392
2394
  if (!dataJson) {
2393
- reportJsonError(eventName, data, this.logger, this.errorHandler);
2395
+ reportJsonError(eventName, data, this._logger, this._errorHandler);
2394
2396
  return;
2395
2397
  }
2396
2398
  processJson(dataJson);
2397
2399
  }
2398
2400
  else {
2399
- this.errorHandler?.(new LDStreamingError(exports.DataSourceErrorKind.Unknown, 'Unexpected payload from event stream'));
2401
+ this._errorHandler?.(new LDStreamingError(exports.DataSourceErrorKind.Unknown, 'Unexpected payload from event stream'));
2400
2402
  }
2401
2403
  });
2402
2404
  });
2403
2405
  }
2404
2406
  stop() {
2405
- this.eventSource?.close();
2406
- this.eventSource = undefined;
2407
+ this._eventSource?.close();
2408
+ this._eventSource = undefined;
2407
2409
  }
2408
2410
  close() {
2409
2411
  this.stop();