@launchdarkly/js-client-sdk-common 1.8.0 → 1.9.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 (146) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/DataManager.d.ts +18 -2
  3. package/dist/DataManager.d.ts.map +1 -1
  4. package/dist/HookRunner.d.ts +12 -0
  5. package/dist/HookRunner.d.ts.map +1 -0
  6. package/dist/LDClientImpl.d.ts +24 -21
  7. package/dist/LDClientImpl.d.ts.map +1 -1
  8. package/dist/LDEmitter.d.ts +17 -5
  9. package/dist/LDEmitter.d.ts.map +1 -1
  10. package/dist/api/LDClient.d.ts +13 -0
  11. package/dist/api/LDClient.d.ts.map +1 -1
  12. package/dist/api/LDInspection.d.ts +105 -0
  13. package/dist/api/LDInspection.d.ts.map +1 -0
  14. package/dist/api/LDOptions.d.ts +31 -2
  15. package/dist/api/LDOptions.d.ts.map +1 -1
  16. package/dist/api/index.d.ts +1 -0
  17. package/dist/api/index.d.ts.map +1 -1
  18. package/dist/api/integrations/Hooks.d.ts +133 -0
  19. package/dist/api/integrations/Hooks.d.ts.map +1 -0
  20. package/dist/api/integrations/index.d.ts +2 -0
  21. package/dist/api/integrations/index.d.ts.map +1 -0
  22. package/dist/configuration/Configuration.d.ts +10 -8
  23. package/dist/configuration/Configuration.d.ts.map +1 -1
  24. package/dist/configuration/validators.d.ts.map +1 -1
  25. package/dist/context/addAutoEnv.d.ts +2 -2
  26. package/dist/context/addAutoEnv.d.ts.map +1 -1
  27. package/dist/context/ensureKey.d.ts +1 -1
  28. package/dist/context/ensureKey.d.ts.map +1 -1
  29. package/dist/{streaming → datasource}/DataSourceConfig.d.ts +5 -0
  30. package/dist/datasource/DataSourceConfig.d.ts.map +1 -0
  31. package/dist/datasource/DataSourceEventHandler.d.ts +16 -0
  32. package/dist/datasource/DataSourceEventHandler.d.ts.map +1 -0
  33. package/dist/datasource/DataSourceStatus.d.ts +39 -0
  34. package/dist/datasource/DataSourceStatus.d.ts.map +1 -0
  35. package/dist/datasource/DataSourceStatusErrorInfo.d.ts +8 -0
  36. package/dist/datasource/DataSourceStatusErrorInfo.d.ts.map +1 -0
  37. package/dist/datasource/DataSourceStatusManager.d.ts +40 -0
  38. package/dist/datasource/DataSourceStatusManager.d.ts.map +1 -0
  39. package/dist/datasource/Requestor.d.ts +26 -0
  40. package/dist/datasource/Requestor.d.ts.map +1 -0
  41. package/dist/evaluation/evaluationDetail.d.ts.map +1 -1
  42. package/dist/flag-manager/FlagManager.d.ts +14 -5
  43. package/dist/flag-manager/FlagManager.d.ts.map +1 -1
  44. package/dist/flag-manager/FlagPersistence.d.ts +13 -13
  45. package/dist/flag-manager/FlagPersistence.d.ts.map +1 -1
  46. package/dist/flag-manager/FlagStore.d.ts +1 -1
  47. package/dist/flag-manager/FlagStore.d.ts.map +1 -1
  48. package/dist/flag-manager/FlagUpdater.d.ts +6 -5
  49. package/dist/flag-manager/FlagUpdater.d.ts.map +1 -1
  50. package/dist/index.cjs +1893 -0
  51. package/dist/index.cjs.map +1 -0
  52. package/dist/index.d.ts +10 -6
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.mjs +1865 -0
  55. package/dist/index.mjs.map +1 -0
  56. package/dist/inspection/InspectorManager.d.ts +41 -0
  57. package/dist/inspection/InspectorManager.d.ts.map +1 -0
  58. package/dist/inspection/createSafeInspector.d.ts +8 -0
  59. package/dist/inspection/createSafeInspector.d.ts.map +1 -0
  60. package/dist/inspection/getInspectorHook.d.ts +4 -0
  61. package/dist/inspection/getInspectorHook.d.ts.map +1 -0
  62. package/dist/inspection/messages.d.ts +3 -0
  63. package/dist/inspection/messages.d.ts.map +1 -0
  64. package/dist/polling/PollingProcessor.d.ts.map +1 -1
  65. package/dist/streaming/StreamingProcessor.d.ts +18 -16
  66. package/dist/streaming/StreamingProcessor.d.ts.map +1 -1
  67. package/dist/streaming/index.d.ts +1 -1
  68. package/dist/streaming/index.d.ts.map +1 -1
  69. package/dist/types/index.d.ts +4 -3
  70. package/dist/types/index.d.ts.map +1 -1
  71. package/package.json +18 -7
  72. package/dist/DataManager.js +0 -98
  73. package/dist/DataManager.js.map +0 -1
  74. package/dist/LDClientImpl.js +0 -334
  75. package/dist/LDClientImpl.js.map +0 -1
  76. package/dist/LDEmitter.js +0 -64
  77. package/dist/LDEmitter.js.map +0 -1
  78. package/dist/api/ConnectionMode.js +0 -3
  79. package/dist/api/ConnectionMode.js.map +0 -1
  80. package/dist/api/LDClient.js +0 -3
  81. package/dist/api/LDClient.js.map +0 -1
  82. package/dist/api/LDEvaluationDetail.js +0 -3
  83. package/dist/api/LDEvaluationDetail.js.map +0 -1
  84. package/dist/api/LDIdentifyOptions.js +0 -3
  85. package/dist/api/LDIdentifyOptions.js.map +0 -1
  86. package/dist/api/LDOptions.js +0 -3
  87. package/dist/api/LDOptions.js.map +0 -1
  88. package/dist/api/index.js +0 -21
  89. package/dist/api/index.js.map +0 -1
  90. package/dist/configuration/Configuration.js +0 -79
  91. package/dist/configuration/Configuration.js.map +0 -1
  92. package/dist/configuration/index.js +0 -8
  93. package/dist/configuration/index.js.map +0 -1
  94. package/dist/configuration/validators.js +0 -29
  95. package/dist/configuration/validators.js.map +0 -1
  96. package/dist/context/addAutoEnv.js +0 -113
  97. package/dist/context/addAutoEnv.js.map +0 -1
  98. package/dist/context/ensureKey.js +0 -72
  99. package/dist/context/ensureKey.js.map +0 -1
  100. package/dist/crypto/digest.js +0 -14
  101. package/dist/crypto/digest.js.map +0 -1
  102. package/dist/diagnostics/createDiagnosticsInitConfig.js +0 -19
  103. package/dist/diagnostics/createDiagnosticsInitConfig.js.map +0 -1
  104. package/dist/diagnostics/createDiagnosticsManager.js +0 -12
  105. package/dist/diagnostics/createDiagnosticsManager.js.map +0 -1
  106. package/dist/evaluation/evaluationDetail.js +0 -20
  107. package/dist/evaluation/evaluationDetail.js.map +0 -1
  108. package/dist/events/EventFactory.js +0 -25
  109. package/dist/events/EventFactory.js.map +0 -1
  110. package/dist/events/createEventProcessor.js +0 -11
  111. package/dist/events/createEventProcessor.js.map +0 -1
  112. package/dist/flag-manager/ContextIndex.js +0 -64
  113. package/dist/flag-manager/ContextIndex.js.map +0 -1
  114. package/dist/flag-manager/FlagManager.js +0 -48
  115. package/dist/flag-manager/FlagManager.js.map +0 -1
  116. package/dist/flag-manager/FlagPersistence.js +0 -120
  117. package/dist/flag-manager/FlagPersistence.js.map +0 -1
  118. package/dist/flag-manager/FlagStore.js +0 -31
  119. package/dist/flag-manager/FlagStore.js.map +0 -1
  120. package/dist/flag-manager/FlagUpdater.js +0 -69
  121. package/dist/flag-manager/FlagUpdater.js.map +0 -1
  122. package/dist/flag-manager/ItemDescriptor.js +0 -3
  123. package/dist/flag-manager/ItemDescriptor.js.map +0 -1
  124. package/dist/flag-manager/calculateChangedKeys.js +0 -22
  125. package/dist/flag-manager/calculateChangedKeys.js.map +0 -1
  126. package/dist/index.js +0 -26
  127. package/dist/index.js.map +0 -1
  128. package/dist/polling/PollingProcessor.js +0 -96
  129. package/dist/polling/PollingProcessor.js.map +0 -1
  130. package/dist/polling/Requestor.d.ts +0 -21
  131. package/dist/polling/Requestor.d.ts.map +0 -1
  132. package/dist/polling/Requestor.js +0 -48
  133. package/dist/polling/Requestor.js.map +0 -1
  134. package/dist/storage/getOrGenerateKey.js +0 -21
  135. package/dist/storage/getOrGenerateKey.js.map +0 -1
  136. package/dist/storage/namespaceUtils.js +0 -62
  137. package/dist/storage/namespaceUtils.js.map +0 -1
  138. package/dist/streaming/DataSourceConfig.d.ts.map +0 -1
  139. package/dist/streaming/DataSourceConfig.js +0 -3
  140. package/dist/streaming/DataSourceConfig.js.map +0 -1
  141. package/dist/streaming/StreamingProcessor.js +0 -126
  142. package/dist/streaming/StreamingProcessor.js.map +0 -1
  143. package/dist/streaming/index.js +0 -6
  144. package/dist/streaming/index.js.map +0 -1
  145. package/dist/types/index.js +0 -3
  146. package/dist/types/index.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.9.0](https://github.com/launchdarkly/js-core/compare/js-client-sdk-common-v1.8.0...js-client-sdk-common-v1.9.0) (2024-10-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * Add basic secure mode support for browser SDK. ([#598](https://github.com/launchdarkly/js-core/issues/598)) ([3389983](https://github.com/launchdarkly/js-core/commit/33899830781affbe986f3bb9df35e5c908884f99))
9
+ * Add bootstrap support. ([#600](https://github.com/launchdarkly/js-core/issues/600)) ([4e5dbee](https://github.com/launchdarkly/js-core/commit/4e5dbee48d6bb236b5febd872c910e809058a012))
10
+ * Add ESM support for common and common-client (rollup) ([#604](https://github.com/launchdarkly/js-core/issues/604)) ([8cd0cdc](https://github.com/launchdarkly/js-core/commit/8cd0cdce988f606b1efdf6bfd19484f6607db2e5))
11
+ * Add support for hooks. ([#605](https://github.com/launchdarkly/js-core/issues/605)) ([04d347b](https://github.com/launchdarkly/js-core/commit/04d347b25e01015134a2545be22bfd8b1d1e85cc))
12
+ * Add visibility handling to allow proactive event flushing. ([#607](https://github.com/launchdarkly/js-core/issues/607)) ([819a311](https://github.com/launchdarkly/js-core/commit/819a311db6f56e323bb84c925789ad4bd19ae4ba))
13
+ * adds datasource status to sdk-client ([#590](https://github.com/launchdarkly/js-core/issues/590)) ([6f26204](https://github.com/launchdarkly/js-core/commit/6f262045b76836e5d2f5ccc2be433094993fcdbb))
14
+ * adds support for individual flag change listeners ([#608](https://github.com/launchdarkly/js-core/issues/608)) ([da31436](https://github.com/launchdarkly/js-core/commit/da3143654331d7d2fd8ba76d9d995855dbf6c7a1))
15
+ * Browser-SDK Automatically start streaming based on event handlers. ([#592](https://github.com/launchdarkly/js-core/issues/592)) ([f2e5cbf](https://github.com/launchdarkly/js-core/commit/f2e5cbf1d0b3ae39a95881fecdcbefc11e9d0363))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * Ensure client logger is always wrapped in a safe logger. ([#599](https://github.com/launchdarkly/js-core/issues/599)) ([980e4da](https://github.com/launchdarkly/js-core/commit/980e4daaf32864e18f14b1e5e28e308dff0ae94f))
21
+ * Use flagVersion in analytics events. ([#611](https://github.com/launchdarkly/js-core/issues/611)) ([35fa033](https://github.com/launchdarkly/js-core/commit/35fa0332dc1553c82afd75c9a4770a4833f2dca3))
22
+
23
+
24
+ ### Dependencies
25
+
26
+ * The following workspace dependencies were updated
27
+ * dependencies
28
+ * @launchdarkly/js-sdk-common bumped from 2.9.0 to 2.10.0
29
+
3
30
  ## [1.8.0](https://github.com/launchdarkly/js-core/compare/js-client-sdk-common-v1.7.0...js-client-sdk-common-v1.8.0) (2024-09-26)
4
31
 
5
32
 
@@ -1,6 +1,8 @@
1
1
  import { Context, EventName, internal, LDContext, LDHeaders, LDLogger, Platform, ProcessStreamResponse, subsystem } from '@launchdarkly/js-sdk-common';
2
2
  import { LDIdentifyOptions } from './api/LDIdentifyOptions';
3
3
  import { Configuration } from './configuration/Configuration';
4
+ import DataSourceStatusManager from './datasource/DataSourceStatusManager';
5
+ import Requestor from './datasource/Requestor';
4
6
  import { FlagManager } from './flag-manager/FlagManager';
5
7
  import LDEmitter from './LDEmitter';
6
8
  import { DataSourcePaths } from './streaming';
@@ -27,6 +29,12 @@ export interface DataManager {
27
29
  export interface DataManagerFactory {
28
30
  (flagManager: FlagManager, configuration: Configuration, baseHeaders: LDHeaders, emitter: LDEmitter, diagnosticsManager?: internal.DiagnosticsManager): DataManager;
29
31
  }
32
+ export interface ConnectionParams {
33
+ queryParameters?: {
34
+ key: string;
35
+ value: string;
36
+ }[];
37
+ }
30
38
  export declare abstract class BaseDataManager implements DataManager {
31
39
  protected readonly platform: Platform;
32
40
  protected readonly flagManager: FlagManager;
@@ -40,10 +48,18 @@ export declare abstract class BaseDataManager implements DataManager {
40
48
  protected updateProcessor?: subsystem.LDStreamProcessor;
41
49
  protected readonly logger: LDLogger;
42
50
  protected context?: Context;
51
+ private _connectionParams?;
52
+ protected readonly dataSourceStatusManager: DataSourceStatusManager;
53
+ private readonly _dataSourceEventHandler;
43
54
  constructor(platform: Platform, flagManager: FlagManager, credential: string, config: Configuration, getPollingPaths: () => DataSourcePaths, getStreamingPaths: () => DataSourcePaths, baseHeaders: LDHeaders, emitter: LDEmitter, diagnosticsManager?: internal.DiagnosticsManager | undefined);
55
+ /**
56
+ * Set additional connection parameters for requests polling/streaming.
57
+ */
58
+ protected setConnectionParams(connectionParams?: ConnectionParams): void;
44
59
  abstract identify(identifyResolve: () => void, identifyReject: (err: Error) => void, context: Context, identifyOptions?: LDIdentifyOptions): Promise<void>;
45
- protected createPollingProcessor(context: LDContext, checkedContext: Context, identifyResolve?: () => void, identifyReject?: (err: Error) => void): void;
46
- protected createStreamingProcessor(context: LDContext, checkedContext: Context, identifyResolve?: () => void, identifyReject?: (err: Error) => void): void;
60
+ protected createPollingProcessor(context: LDContext, checkedContext: Context, requestor: Requestor, identifyResolve?: () => void, identifyReject?: (err: Error) => void): void;
61
+ protected createStreamingProcessor(context: LDContext, checkedContext: Context, pollingRequestor: Requestor, identifyResolve?: () => void, identifyReject?: (err: Error) => void): void;
47
62
  protected createStreamListeners(context: Context, identifyResolve?: () => void): Map<EventName, ProcessStreamResponse>;
63
+ private _decorateProcessorWithStatusReporting;
48
64
  }
49
65
  //# sourceMappingURL=DataManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataManager.d.ts","sourceRoot":"","sources":["../src/DataManager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,SAAS,EACT,QAAQ,EACR,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,qBAAqB,EACrB,SAAS,EACV,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,SAAS,M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,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI;IAiCvC,SAAS,CAAC,qBAAqB,CAC7B,OAAO,EAAE,OAAO,EAChB,eAAe,CAAC,EAAE,MAAM,IAAI,GAC3B,GAAG,CAAC,SAAS,EAAE,qBAAqB,CAAC;IA4BxC,OAAO,CAAC,qCAAqC;CAoB9C"}
@@ -0,0 +1,12 @@
1
+ import { LDContext, LDLogger } from '@launchdarkly/js-sdk-common';
2
+ import { Hook, IdentifySeriesResult } from './api/integrations/Hooks';
3
+ import { LDEvaluationDetail } from './api/LDEvaluationDetail';
4
+ export default class HookRunner {
5
+ private readonly _logger;
6
+ private readonly _hooks;
7
+ constructor(_logger: LDLogger, initialHooks: Hook[]);
8
+ withEvaluation(key: string, context: LDContext | undefined, defaultValue: unknown, method: () => LDEvaluationDetail): LDEvaluationDetail;
9
+ identify(context: LDContext, timeout: number | undefined): (result: IdentifySeriesResult) => void;
10
+ addHook(hook: Hook): void;
11
+ }
12
+ //# sourceMappingURL=HookRunner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HookRunner.d.ts","sourceRoot":"","sources":["../src/HookRunner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAGL,IAAI,EAGJ,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AA0G9D,MAAM,CAAC,OAAO,OAAO,UAAU;IAI3B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAH1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAGlB,OAAO,EAAE,QAAQ,EAClC,YAAY,EAAE,IAAI,EAAE;IAKtB,cAAc,CACZ,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,SAAS,GAAG,SAAS,EAC9B,YAAY,EAAE,OAAO,EACrB,MAAM,EAAE,MAAM,kBAAkB,GAC/B,kBAAkB;IAiBrB,QAAQ,CACN,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI;IAYzC,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;CAG1B"}
@@ -1,30 +1,32 @@
1
1
  import { AutoEnvAttributes, Context, internal, LDContext, LDFlagSet, LDFlagValue, LDLogger, Platform } from '@launchdarkly/js-sdk-common';
2
- import { LDClient, type LDOptions } from './api';
2
+ import { Hook, LDClient, type LDOptions } from './api';
3
3
  import { LDEvaluationDetail, LDEvaluationDetailTyped } from './api/LDEvaluationDetail';
4
4
  import { LDIdentifyOptions } from './api/LDIdentifyOptions';
5
5
  import { LDClientInternalOptions } from './configuration';
6
6
  import { DataManager, DataManagerFactory } from './DataManager';
7
- import { EventName } from './LDEmitter';
7
+ import LDEmitter, { EventName } from './LDEmitter';
8
8
  export default class LDClientImpl implements LDClient {
9
9
  readonly sdkKey: string;
10
10
  readonly autoEnvAttributes: AutoEnvAttributes;
11
11
  readonly platform: Platform;
12
- private readonly config;
13
- private uncheckedContext?;
14
- private checkedContext?;
15
- private readonly diagnosticsManager?;
16
- private eventProcessor?;
17
- private identifyTimeout;
12
+ private readonly _config;
13
+ private _uncheckedContext?;
14
+ private _checkedContext?;
15
+ private readonly _diagnosticsManager?;
16
+ private _eventProcessor?;
17
+ private _identifyTimeout;
18
18
  readonly logger: LDLogger;
19
- private updateProcessor?;
20
- private readonly highTimeoutThreshold;
21
- private eventFactoryDefault;
22
- private eventFactoryWithReasons;
23
- private emitter;
24
- private flagManager;
25
- private eventSendingEnabled;
26
- private baseHeaders;
19
+ private _updateProcessor?;
20
+ private readonly _highTimeoutThreshold;
21
+ private _eventFactoryDefault;
22
+ private _eventFactoryWithReasons;
23
+ protected emitter: LDEmitter;
24
+ private _flagManager;
25
+ private _eventSendingEnabled;
26
+ private _baseHeaders;
27
27
  protected dataManager: DataManager;
28
+ private _hookRunner;
29
+ private _inspectorManager;
28
30
  /**
29
31
  * Creates the client object synchronously. No async, no network calls.
30
32
  */
@@ -37,8 +39,7 @@ export default class LDClientImpl implements LDClient {
37
39
  }>;
38
40
  getContext(): LDContext | undefined;
39
41
  protected getInternalContext(): Context | undefined;
40
- private createStreamListeners;
41
- private createIdentifyPromise;
42
+ private _createIdentifyPromise;
42
43
  /**
43
44
  * Identifies a context to LaunchDarkly. See {@link LDClient.identify}.
44
45
  *
@@ -55,13 +56,13 @@ export default class LDClientImpl implements LDClient {
55
56
  * 3. A network error is encountered during initialization.
56
57
  */
57
58
  identify(pristineContext: LDContext, identifyOptions?: LDIdentifyOptions): Promise<void>;
58
- off(eventName: EventName, listener: Function): void;
59
59
  on(eventName: EventName, listener: Function): void;
60
+ off(eventName: EventName, listener: Function): void;
60
61
  track(key: string, data?: any, metricValue?: number): void;
61
- private variationInternal;
62
+ private _variationInternal;
62
63
  variation(flagKey: string, defaultValue?: LDFlagValue): LDFlagValue;
63
64
  variationDetail(flagKey: string, defaultValue?: LDFlagValue): LDEvaluationDetail;
64
- private typedEval;
65
+ private _typedEval;
65
66
  boolVariation(key: string, defaultValue: boolean): boolean;
66
67
  jsonVariation(key: string, defaultValue: unknown): unknown;
67
68
  numberVariation(key: string, defaultValue: number): number;
@@ -70,6 +71,7 @@ export default class LDClientImpl implements LDClient {
70
71
  numberVariationDetail(key: string, defaultValue: number): LDEvaluationDetailTyped<number>;
71
72
  stringVariationDetail(key: string, defaultValue: string): LDEvaluationDetailTyped<string>;
72
73
  jsonVariationDetail(key: string, defaultValue: unknown): LDEvaluationDetailTyped<unknown>;
74
+ addHook(hook: Hook): void;
73
75
  /**
74
76
  * Enable/Disable event sending.
75
77
  * @param enabled True to enable event processing, false to disable.
@@ -77,5 +79,6 @@ export default class LDClientImpl implements LDClient {
77
79
  */
78
80
  protected setEventSendingEnabled(enabled: boolean, flush: boolean): void;
79
81
  protected sendEvent(event: internal.InputEvent): void;
82
+ private _handleInsp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C,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,uBAAuB,CAAC,OAAO,CAAC;IAOzF,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,uBAAuB,CAAC,MAAM,CAAC;IAOzF,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,uBAAuB,CAAC,MAAM,CAAC;IAOzF,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,uBAAuB,CAAC,OAAO,CAAC;IAIzF,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAIzB;;;;OAIG;IACH,SAAS,CAAC,sBAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IA2BxE,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,UAAU,GAAG,IAAI;IAIrD,OAAO,CAAC,wBAAwB;CAqBjC"}
@@ -1,9 +1,20 @@
1
1
  import { LDLogger } from '@launchdarkly/js-sdk-common';
2
- export type EventName = 'error' | 'change';
2
+ type FlagChangeKey = `change:${string}`;
3
+ /**
4
+ * Type for name of emitted events. 'change' is used for all flag changes. 'change:flag-name-here' is used
5
+ * for specific flag changes.
6
+ */
7
+ export type EventName = 'change' | FlagChangeKey | 'dataSourceStatus' | 'error';
8
+ /**
9
+ * Implementation Note: There should not be any default listeners for change events in a client
10
+ * implementation. Default listeners mean a client cannot determine when there are actual
11
+ * application developer provided listeners. If we require default listeners, then we should add
12
+ * a system to allow listeners which have counts independent of the primary listener counts.
13
+ */
3
14
  export default class LDEmitter {
4
- private logger?;
5
- private listeners;
6
- constructor(logger?: LDLogger | undefined);
15
+ private _logger?;
16
+ private _listeners;
17
+ constructor(_logger?: LDLogger | undefined);
7
18
  on(name: EventName, listener: Function): void;
8
19
  /**
9
20
  * Unsubscribe one or all events.
@@ -12,9 +23,10 @@ export default class LDEmitter {
12
23
  * @param listener Optional. If unspecified, all listeners for the event will be removed.
13
24
  */
14
25
  off(name: EventName, listener?: Function): void;
15
- private invokeListener;
26
+ private _invokeListener;
16
27
  emit(name: EventName, ...detail: any[]): void;
17
28
  eventNames(): string[];
18
29
  listenerCount(name: EventName): number;
19
30
  }
31
+ export {};
20
32
  //# sourceMappingURL=LDEmitter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LDEmitter.d.ts","sourceRoot":"","sources":["../src/LDEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,SAAS;IAGhB,OAAO,CAAC,MAAM,CAAC;IAF3B,OAAO,CAAC,SAAS,CAAyC;gBAEtC,MAAM,CAAC,sBAAU;IAErC,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ;IAQtC;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAqBxC,OAAO,CAAC,cAAc;IAQtB,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE;IAKtC,UAAU,IAAI,MAAM,EAAE;IAItB,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM;CAGvC"}
1
+ {"version":3,"file":"LDEmitter.d.ts","sourceRoot":"","sources":["../src/LDEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,KAAK,aAAa,GAAG,UAAU,MAAM,EAAE,CAAC;AAExC;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,aAAa,GAAG,kBAAkB,GAAG,OAAO,CAAC;AAEhF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAGhB,OAAO,CAAC,OAAO,CAAC;IAF5B,OAAO,CAAC,UAAU,CAAyC;gBAEvC,OAAO,CAAC,sBAAU;IAEtC,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ;IAQtC;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAqBxC,OAAO,CAAC,eAAe;IAQvB,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE;IAKtC,UAAU,IAAI,MAAM,EAAE;IAItB,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM;CAGvC"}
@@ -1,4 +1,5 @@
1
1
  import { LDContext, LDFlagSet, LDFlagValue, LDLogger } from '@launchdarkly/js-sdk-common';
2
+ import { Hook } from './integrations/Hooks';
2
3
  import { LDEvaluationDetail, LDEvaluationDetailTyped } from './LDEvaluationDetail';
3
4
  import { LDIdentifyOptions } from './LDIdentifyOptions';
4
5
  /**
@@ -202,6 +203,9 @@ export interface LDClient {
202
203
  * The callback parameters are the context and an Error object. Errors are also output by
203
204
  * the {@link logger} at the error level.
204
205
  *
206
+ * - `"dataSourceStatus"`: Event indicating that there has been a change in the status of the
207
+ * data source. This will include the state of the data source as well any error information.
208
+ *
205
209
  * @param key
206
210
  * The name of the event for which to listen.
207
211
  * @param callback
@@ -298,5 +302,14 @@ export interface LDClient {
298
302
  * An {@link LDEvaluationDetail} object containing the value and explanation.
299
303
  */
300
304
  variationDetail(key: string, defaultValue?: LDFlagValue): LDEvaluationDetail;
305
+ /**
306
+ * Add a hook to the client. In order to register a hook before the client
307
+ * starts, please use the `hooks` property of {@link LDOptions}.
308
+ *
309
+ * Hooks provide entrypoints which allow for observation of SDK functions.
310
+ *
311
+ * @param Hook The hook to add.
312
+ */
313
+ addHook(hook: Hook): void;
301
314
  }
302
315
  //# sourceMappingURL=LDClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file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AE,MAAM,EAAE,YAAY,CAAC,EAAE,WAAW,GAAG,kBAAkB,CAAC;IAE7E;;;;;;;OAOG;IACH,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;CAC3B"}
@@ -0,0 +1,105 @@
1
+ import { LDContext } from '@launchdarkly/js-sdk-common';
2
+ import { LDEvaluationDetail } from './LDEvaluationDetail';
3
+ /**
4
+ * Callback interface for collecting information about the SDK at runtime.
5
+ *
6
+ * This interface is used to collect information about flag usage.
7
+ *
8
+ * This interface should not be used by the application to access flags for the purpose of controlling application
9
+ * flow. It is intended for monitoring, analytics, or debugging purposes.
10
+ */
11
+ export interface LDInspectionFlagUsedHandler {
12
+ type: 'flag-used';
13
+ /**
14
+ * Name of the inspector. Will be used for logging issues with the inspector.
15
+ */
16
+ name: string;
17
+ /**
18
+ * @deprecated All inspectors run synchronously. This field will be removed in a future major version.
19
+ */
20
+ synchronous?: boolean;
21
+ /**
22
+ * This method is called when a flag is accessed via a variation method, or it can be called based on actions in
23
+ * wrapper SDKs which have different methods of tracking when a flag was accessed. It is not called when a call is made
24
+ * to allFlags.
25
+ */
26
+ method: (flagKey: string, flagDetail: LDEvaluationDetail, context?: LDContext) => void;
27
+ }
28
+ /**
29
+ * Callback interface for collecting information about the SDK at runtime.
30
+ *
31
+ * This interface is used to collect information about flag data. In order to understand the
32
+ * current flag state it should be combined with {@link LDInspectionFlagValueChangedHandler}.
33
+ * This interface will get the initial flag information, and
34
+ * {@link LDInspectionFlagValueChangedHandler} will provide changes to individual flags.
35
+ *
36
+ * This interface should not be used by the application to access flags for the purpose of controlling application
37
+ * flow. It is intended for monitoring, analytics, or debugging purposes.
38
+ */
39
+ export interface LDInspectionFlagDetailsChangedHandler {
40
+ type: 'flag-details-changed';
41
+ /**
42
+ * Name of the inspector. Will be used for logging issues with the inspector.
43
+ */
44
+ name: string;
45
+ /**
46
+ * @deprecated All inspectors run synchronously. This field will be removed in a future major version.
47
+ */
48
+ synchronous?: boolean;
49
+ /**
50
+ * This method is called when the flags in the store are replaced with new flags. It will contain all flags
51
+ * regardless of if they have been evaluated.
52
+ */
53
+ method: (details: Record<string, LDEvaluationDetail>) => void;
54
+ }
55
+ /**
56
+ * Callback interface for collecting information about the SDK at runtime.
57
+ *
58
+ * This interface is used to collect changes to flag data, but does not provide the initial
59
+ * data. It can be combined with {@link LDInspectionFlagValuesChangedHandler} to track the
60
+ * entire flag state.
61
+ *
62
+ * This interface should not be used by the application to access flags for the purpose of controlling application
63
+ * flow. It is intended for monitoring, analytics, or debugging purposes.
64
+ */
65
+ export interface LDInspectionFlagDetailChangedHandler {
66
+ type: 'flag-detail-changed';
67
+ /**
68
+ * Name of the inspector. Will be used for logging issues with the inspector.
69
+ */
70
+ name: string;
71
+ /**
72
+ * @deprecated All inspectors run synchronously. This field will be removed in a future major version.
73
+ */
74
+ synchronous?: boolean;
75
+ /**
76
+ * This method is called when a flag is updated. It will not be called
77
+ * when all flags are updated.
78
+ */
79
+ method: (flagKey: string, detail: LDEvaluationDetail) => void;
80
+ }
81
+ /**
82
+ * Callback interface for collecting information about the SDK at runtime.
83
+ *
84
+ * This interface is used to track current identity state of the SDK.
85
+ *
86
+ * This interface should not be used by the application to access flags for the purpose of controlling application
87
+ * flow. It is intended for monitoring, analytics, or debugging purposes.
88
+ */
89
+ export interface LDInspectionIdentifyHandler {
90
+ type: 'client-identity-changed';
91
+ /**
92
+ * Name of the inspector. Will be used for logging issues with the inspector.
93
+ */
94
+ name: string;
95
+ /**
96
+ * @deprecated All inspectors run synchronously. This field will be removed in a future major version.
97
+ */
98
+ synchronous?: boolean;
99
+ /**
100
+ * This method will be called when an identify operation completes.
101
+ */
102
+ method: (context: LDContext) => void;
103
+ }
104
+ export type LDInspection = LDInspectionFlagUsedHandler | LDInspectionFlagDetailsChangedHandler | LDInspectionFlagDetailChangedHandler | LDInspectionIdentifyHandler;
105
+ //# sourceMappingURL=LDInspection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LDInspection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OAAO,EAAE,SAAS,KAAK,IAAI,CAAC;CACtC;AAED,MAAM,MAAM,YAAY,GACpB,2BAA2B,GAC3B,qCAAqC,GACrC,oCAAoC,GACpC,2BAA2B,CAAC"}
@@ -1,4 +1,6 @@
1
1
  import type { LDLogger } from '@launchdarkly/js-sdk-common';
2
+ import { Hook } from './integrations/Hooks';
3
+ import { LDInspection } from './LDInspection';
2
4
  export interface LDOptions {
3
5
  /**
4
6
  * Whether all context attributes (except the context key) should be marked as private, and
@@ -100,9 +102,9 @@ export interface LDOptions {
100
102
  */
101
103
  eventsUri?: string;
102
104
  /**
103
- * Controls how often the SDK flushes events.
105
+ * The interval in between flushes of the analytics events queue, in seconds.
104
106
  *
105
- * @defaultValue 30s.
107
+ * @defaultValue 2s for browser implementations 30s for others.
106
108
  */
107
109
  flushInterval?: number;
108
110
  /**
@@ -213,5 +215,32 @@ export interface LDOptions {
213
215
  * config property.
214
216
  */
215
217
  payloadFilterKey?: string;
218
+ /**
219
+ * Initial set of hooks for the client.
220
+ *
221
+ * Hooks provide entrypoints which allow for observation of SDK functions.
222
+ *
223
+ * LaunchDarkly provides integration packages, and most applications will not
224
+ * need to implement their own hooks. Refer to the `@launchdarkly/node-server-sdk-otel`
225
+ * for instrumentation for the `@launchdarkly/node-server-sdk`.
226
+ *
227
+ * Example:
228
+ * ```typescript
229
+ * import { init } from '@launchdarkly/node-server-sdk';
230
+ * import { TheHook } from '@launchdarkly/some-hook';
231
+ *
232
+ * const client = init('my-sdk-key', { hooks: [new TheHook()] });
233
+ * ```
234
+ */
235
+ hooks?: Hook[];
236
+ /**
237
+ * Inspectors can be used for collecting information for monitoring, analytics, and debugging.
238
+ *
239
+ *
240
+ * @deprecated Hooks should be used instead of inspectors and inspectors will be removed in
241
+ * a future version. If you need functionality that is not exposed using hooks, then please
242
+ * let us know through a github issue or support.
243
+ */
244
+ inspectors?: LDInspection[];
216
245
  }
217
246
  //# sourceMappingURL=LDOptions.d.ts.map
@@ -1 +1 @@
1
- {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,CAAC;IAEnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAC;IAElB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;;;;;;;;;;;;;OAgBG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAElC;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;;;;OAQG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;IAErC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;;;;;;;;OAaG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IAEf;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,YAAY,EAAE,CAAC;CAC7B"}
@@ -2,6 +2,7 @@ import ConnectionMode from './ConnectionMode';
2
2
  export * from './LDOptions';
3
3
  export * from './LDClient';
4
4
  export * from './LDEvaluationDetail';
5
+ export * from './integrations';
5
6
  export { ConnectionMode };
6
7
  export * from './LDIdentifyOptions';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AAErC,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,133 @@
1
+ import { LDContext } from '@launchdarkly/js-sdk-common';
2
+ import { LDEvaluationDetail } from '../LDEvaluationDetail';
3
+ /**
4
+ * Contextual information provided to evaluation stages.
5
+ */
6
+ export interface EvaluationSeriesContext {
7
+ readonly flagKey: string;
8
+ /**
9
+ * Optional in case evaluations are performed before a context is set.
10
+ */
11
+ readonly context?: LDContext;
12
+ readonly defaultValue: unknown;
13
+ }
14
+ /**
15
+ * Implementation specific hook data for evaluation stages.
16
+ *
17
+ * Hook implementations can use this to store data needed between stages.
18
+ */
19
+ export interface EvaluationSeriesData {
20
+ readonly [index: string]: unknown;
21
+ }
22
+ /**
23
+ * Meta-data about a hook implementation.
24
+ */
25
+ export interface HookMetadata {
26
+ readonly name: string;
27
+ }
28
+ /**
29
+ * Contextual information provided to evaluation stages.
30
+ */
31
+ export interface IdentifySeriesContext {
32
+ readonly context: LDContext;
33
+ /**
34
+ * The timeout, in seconds, associated with the identify operation.
35
+ */
36
+ readonly timeout?: number;
37
+ }
38
+ /**
39
+ * Implementation specific hook data for evaluation stages.
40
+ *
41
+ * Hook implementations can use this to store data needed between stages.
42
+ */
43
+ export interface IdentifySeriesData {
44
+ readonly [index: string]: unknown;
45
+ }
46
+ /**
47
+ * The status an identify operation completed with.
48
+ */
49
+ export type IdentifySeriesStatus = 'completed' | 'error';
50
+ /**
51
+ * The result applies to a single identify operation. An operation may complete
52
+ * with an error and then later complete successfully. Only the first completion
53
+ * will be executed in the evaluation series.
54
+ */
55
+ export interface IdentifySeriesResult {
56
+ status: IdentifySeriesStatus;
57
+ }
58
+ /**
59
+ * Interface for extending SDK functionality via hooks.
60
+ */
61
+ export interface Hook {
62
+ /**
63
+ * Get metadata about the hook implementation.
64
+ */
65
+ getMetadata(): HookMetadata;
66
+ /**
67
+ * This method is called during the execution of a variation method
68
+ * before the flag value has been determined. The method is executed synchronously.
69
+ *
70
+ * @param hookContext Contains information about the evaluation being performed. This is not
71
+ * mutable.
72
+ * @param data A record associated with each stage of hook invocations. Each stage is called with
73
+ * the data of the previous stage for a series. The input record should not be modified.
74
+ * @returns Data to use when executing the next state of the hook in the evaluation series. It is
75
+ * recommended to expand the previous input into the return. This helps ensure your stage remains
76
+ * compatible moving forward as more stages are added.
77
+ * ```js
78
+ * return {...data, "my-new-field": /*my data/*}
79
+ * ```
80
+ */
81
+ beforeEvaluation?(hookContext: EvaluationSeriesContext, data: EvaluationSeriesData): EvaluationSeriesData;
82
+ /**
83
+ * This method is called during the execution of the variation method
84
+ * after the flag value has been determined. The method is executed synchronously.
85
+ *
86
+ * @param hookContext Contains read-only information about the evaluation
87
+ * being performed.
88
+ * @param data A record associated with each stage of hook invocations. Each
89
+ * stage is called with the data of the previous stage for a series.
90
+ * @param detail The result of the evaluation. This value should not be
91
+ * modified.
92
+ * @returns Data to use when executing the next state of the hook in the evaluation series. It is
93
+ * recommended to expand the previous input into the return. This helps ensure your stage remains
94
+ * compatible moving forward as more stages are added.
95
+ * ```js
96
+ * return {...data, "my-new-field": /*my data/*}
97
+ * ```
98
+ */
99
+ afterEvaluation?(hookContext: EvaluationSeriesContext, data: EvaluationSeriesData, detail: LDEvaluationDetail): EvaluationSeriesData;
100
+ /**
101
+ * This method is called during the execution of the identify process before the operation
102
+ * completes, but after any context modifications are performed.
103
+ *
104
+ * @param hookContext Contains information about the evaluation being performed. This is not
105
+ * mutable.
106
+ * @param data A record associated with each stage of hook invocations. Each stage is called with
107
+ * the data of the previous stage for a series. The input record should not be modified.
108
+ * @returns Data to use when executing the next state of the hook in the evaluation series. It is
109
+ * recommended to expand the previous input into the return. This helps ensure your stage remains
110
+ * compatible moving forward as more stages are added.
111
+ * ```js
112
+ * return {...data, "my-new-field": /*my data/*}
113
+ * ```
114
+ */
115
+ beforeIdentify?(hookContext: IdentifySeriesContext, data: IdentifySeriesData): IdentifySeriesData;
116
+ /**
117
+ * This method is called during the execution of the identify process before the operation
118
+ * completes, but after any context modifications are performed.
119
+ *
120
+ * @param hookContext Contains information about the evaluation being performed. This is not
121
+ * mutable.
122
+ * @param data A record associated with each stage of hook invocations. Each stage is called with
123
+ * the data of the previous stage for a series. The input record should not be modified.
124
+ * @returns Data to use when executing the next state of the hook in the evaluation series. It is
125
+ * recommended to expand the previous input into the return. This helps ensure your stage remains
126
+ * compatible moving forward as more stages are added.
127
+ * ```js
128
+ * return {...data, "my-new-field": /*my data/*}
129
+ * ```
130
+ */
131
+ afterIdentify?(hookContext: IdentifySeriesContext, data: IdentifySeriesData, result: IdentifySeriesResult): IdentifySeriesData;
132
+ }
133
+ //# sourceMappingURL=Hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Hooks.d.ts","sourceRoot":"","sources":["../../../src/api/integrations/Hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;CAOhC;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,KAAK,EAAE,MA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d.ts","sourceRoot":"","sources":["../../../src/api/integrations/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}