@launchdarkly/js-sdk-common 2.10.0 → 2.10.1-beta.1

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