@launchdarkly/js-client-sdk-common 1.9.1-beta.1 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/dist/{index.cjs → cjs/index.cjs} +1 -1
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/DataManager.d.ts +65 -0
- package/dist/esm/DataManager.d.ts.map +1 -0
- package/dist/esm/HookRunner.d.ts +12 -0
- package/dist/esm/HookRunner.d.ts.map +1 -0
- package/dist/esm/LDClientImpl.d.ts +84 -0
- package/dist/esm/LDClientImpl.d.ts.map +1 -0
- package/dist/esm/LDEmitter.d.ts +32 -0
- package/dist/esm/LDEmitter.d.ts.map +1 -0
- package/dist/esm/api/ConnectionMode.d.ts +16 -0
- package/dist/esm/api/ConnectionMode.d.ts.map +1 -0
- package/dist/esm/api/LDClient.d.ts +315 -0
- package/dist/esm/api/LDClient.d.ts.map +1 -0
- package/dist/esm/api/LDEvaluationDetail.d.ts +26 -0
- package/dist/esm/api/LDEvaluationDetail.d.ts.map +1 -0
- package/dist/esm/api/LDIdentifyOptions.d.ts +23 -0
- package/dist/esm/api/LDIdentifyOptions.d.ts.map +1 -0
- package/dist/esm/api/LDInspection.d.ts +105 -0
- package/dist/esm/api/LDInspection.d.ts.map +1 -0
- package/dist/esm/api/LDOptions.d.ts +246 -0
- package/dist/esm/api/LDOptions.d.ts.map +1 -0
- package/dist/esm/api/index.d.ts +8 -0
- package/dist/esm/api/index.d.ts.map +1 -0
- package/dist/esm/api/integrations/Hooks.d.ts +133 -0
- package/dist/esm/api/integrations/Hooks.d.ts.map +1 -0
- package/dist/esm/api/integrations/index.d.ts +2 -0
- package/dist/esm/api/integrations/index.d.ts.map +1 -0
- package/dist/esm/configuration/Configuration.d.ts +86 -0
- package/dist/esm/configuration/Configuration.d.ts.map +1 -0
- package/dist/esm/configuration/index.d.ts +3 -0
- package/dist/esm/configuration/index.d.ts.map +1 -0
- package/dist/esm/configuration/validators.d.ts +5 -0
- package/dist/esm/configuration/validators.d.ts.map +1 -0
- package/dist/esm/context/addAutoEnv.d.ts +31 -0
- package/dist/esm/context/addAutoEnv.d.ts.map +1 -0
- package/dist/esm/context/ensureKey.d.ts +10 -0
- package/dist/esm/context/ensureKey.d.ts.map +1 -0
- package/dist/esm/crypto/digest.d.ts +3 -0
- package/dist/esm/crypto/digest.d.ts.map +1 -0
- package/dist/esm/datasource/DataSourceConfig.d.ts +25 -0
- package/dist/esm/datasource/DataSourceConfig.d.ts.map +1 -0
- package/dist/esm/datasource/DataSourceEventHandler.d.ts +16 -0
- package/dist/esm/datasource/DataSourceEventHandler.d.ts.map +1 -0
- package/dist/esm/datasource/DataSourceStatus.d.ts +39 -0
- package/dist/esm/datasource/DataSourceStatus.d.ts.map +1 -0
- package/dist/esm/datasource/DataSourceStatusErrorInfo.d.ts +8 -0
- package/dist/esm/datasource/DataSourceStatusErrorInfo.d.ts.map +1 -0
- package/dist/esm/datasource/DataSourceStatusManager.d.ts +40 -0
- package/dist/esm/datasource/DataSourceStatusManager.d.ts.map +1 -0
- package/dist/esm/datasource/Requestor.d.ts +26 -0
- package/dist/esm/datasource/Requestor.d.ts.map +1 -0
- package/dist/esm/diagnostics/createDiagnosticsInitConfig.d.ts +16 -0
- package/dist/esm/diagnostics/createDiagnosticsInitConfig.d.ts.map +1 -0
- package/dist/esm/diagnostics/createDiagnosticsManager.d.ts +5 -0
- package/dist/esm/diagnostics/createDiagnosticsManager.d.ts.map +1 -0
- package/dist/esm/evaluation/evaluationDetail.d.ts +5 -0
- package/dist/esm/evaluation/evaluationDetail.d.ts.map +1 -0
- package/dist/esm/events/EventFactory.d.ts +2 -0
- package/dist/esm/events/EventFactory.d.ts.map +1 -0
- package/dist/esm/events/createEventProcessor.d.ts +5 -0
- package/dist/esm/events/createEventProcessor.d.ts.map +1 -0
- package/dist/esm/flag-manager/ContextIndex.d.ts +39 -0
- package/dist/esm/flag-manager/ContextIndex.d.ts.map +1 -0
- package/dist/esm/flag-manager/FlagManager.d.ts +81 -0
- package/dist/esm/flag-manager/FlagManager.d.ts.map +1 -0
- package/dist/esm/flag-manager/FlagPersistence.d.ts +43 -0
- package/dist/esm/flag-manager/FlagPersistence.d.ts.map +1 -0
- package/dist/esm/flag-manager/FlagStore.d.ts +29 -0
- package/dist/esm/flag-manager/FlagStore.d.ts.map +1 -0
- package/dist/esm/flag-manager/FlagUpdater.d.ts +40 -0
- package/dist/esm/flag-manager/FlagUpdater.d.ts.map +1 -0
- package/dist/esm/flag-manager/ItemDescriptor.d.ts +10 -0
- package/dist/esm/flag-manager/ItemDescriptor.d.ts.map +1 -0
- package/dist/esm/flag-manager/calculateChangedKeys.d.ts +6 -0
- package/dist/esm/flag-manager/calculateChangedKeys.d.ts.map +1 -0
- package/dist/esm/index.d.ts +20 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/{index.mjs → esm/index.mjs} +1 -1
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/inspection/InspectorManager.d.ts +41 -0
- package/dist/esm/inspection/InspectorManager.d.ts.map +1 -0
- package/dist/esm/inspection/createSafeInspector.d.ts +8 -0
- package/dist/esm/inspection/createSafeInspector.d.ts.map +1 -0
- package/dist/esm/inspection/getInspectorHook.d.ts +4 -0
- package/dist/esm/inspection/getInspectorHook.d.ts.map +1 -0
- package/dist/esm/inspection/messages.d.ts +3 -0
- package/dist/esm/inspection/messages.d.ts.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/polling/PollingProcessor.d.ts +3 -0
- package/dist/esm/polling/PollingProcessor.d.ts.map +1 -0
- package/dist/esm/storage/getOrGenerateKey.d.ts +11 -0
- package/dist/esm/storage/getOrGenerateKey.d.ts.map +1 -0
- package/dist/esm/storage/namespaceUtils.d.ts +20 -0
- package/dist/esm/storage/namespaceUtils.d.ts.map +1 -0
- package/dist/esm/streaming/StreamingProcessor.d.ts +35 -0
- package/dist/esm/streaming/StreamingProcessor.d.ts.map +1 -0
- package/dist/esm/streaming/index.d.ts +4 -0
- package/dist/esm/streaming/index.d.ts.map +1 -0
- package/dist/esm/types/index.d.ts +21 -0
- package/dist/esm/types/index.d.ts.map +1 -0
- package/package.json +16 -8
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- /package/dist/{DataManager.d.ts → cjs/DataManager.d.ts} +0 -0
- /package/dist/{DataManager.d.ts.map → cjs/DataManager.d.ts.map} +0 -0
- /package/dist/{HookRunner.d.ts → cjs/HookRunner.d.ts} +0 -0
- /package/dist/{HookRunner.d.ts.map → cjs/HookRunner.d.ts.map} +0 -0
- /package/dist/{LDClientImpl.d.ts → cjs/LDClientImpl.d.ts} +0 -0
- /package/dist/{LDClientImpl.d.ts.map → cjs/LDClientImpl.d.ts.map} +0 -0
- /package/dist/{LDEmitter.d.ts → cjs/LDEmitter.d.ts} +0 -0
- /package/dist/{LDEmitter.d.ts.map → cjs/LDEmitter.d.ts.map} +0 -0
- /package/dist/{api → cjs/api}/ConnectionMode.d.ts +0 -0
- /package/dist/{api → cjs/api}/ConnectionMode.d.ts.map +0 -0
- /package/dist/{api → cjs/api}/LDClient.d.ts +0 -0
- /package/dist/{api → cjs/api}/LDClient.d.ts.map +0 -0
- /package/dist/{api → cjs/api}/LDEvaluationDetail.d.ts +0 -0
- /package/dist/{api → cjs/api}/LDEvaluationDetail.d.ts.map +0 -0
- /package/dist/{api → cjs/api}/LDIdentifyOptions.d.ts +0 -0
- /package/dist/{api → cjs/api}/LDIdentifyOptions.d.ts.map +0 -0
- /package/dist/{api → cjs/api}/LDInspection.d.ts +0 -0
- /package/dist/{api → cjs/api}/LDInspection.d.ts.map +0 -0
- /package/dist/{api → cjs/api}/LDOptions.d.ts +0 -0
- /package/dist/{api → cjs/api}/LDOptions.d.ts.map +0 -0
- /package/dist/{api → cjs/api}/index.d.ts +0 -0
- /package/dist/{api → cjs/api}/index.d.ts.map +0 -0
- /package/dist/{api → cjs/api}/integrations/Hooks.d.ts +0 -0
- /package/dist/{api → cjs/api}/integrations/Hooks.d.ts.map +0 -0
- /package/dist/{api → cjs/api}/integrations/index.d.ts +0 -0
- /package/dist/{api → cjs/api}/integrations/index.d.ts.map +0 -0
- /package/dist/{configuration → cjs/configuration}/Configuration.d.ts +0 -0
- /package/dist/{configuration → cjs/configuration}/Configuration.d.ts.map +0 -0
- /package/dist/{configuration → cjs/configuration}/index.d.ts +0 -0
- /package/dist/{configuration → cjs/configuration}/index.d.ts.map +0 -0
- /package/dist/{configuration → cjs/configuration}/validators.d.ts +0 -0
- /package/dist/{configuration → cjs/configuration}/validators.d.ts.map +0 -0
- /package/dist/{context → cjs/context}/addAutoEnv.d.ts +0 -0
- /package/dist/{context → cjs/context}/addAutoEnv.d.ts.map +0 -0
- /package/dist/{context → cjs/context}/ensureKey.d.ts +0 -0
- /package/dist/{context → cjs/context}/ensureKey.d.ts.map +0 -0
- /package/dist/{crypto → cjs/crypto}/digest.d.ts +0 -0
- /package/dist/{crypto → cjs/crypto}/digest.d.ts.map +0 -0
- /package/dist/{datasource → cjs/datasource}/DataSourceConfig.d.ts +0 -0
- /package/dist/{datasource → cjs/datasource}/DataSourceConfig.d.ts.map +0 -0
- /package/dist/{datasource → cjs/datasource}/DataSourceEventHandler.d.ts +0 -0
- /package/dist/{datasource → cjs/datasource}/DataSourceEventHandler.d.ts.map +0 -0
- /package/dist/{datasource → cjs/datasource}/DataSourceStatus.d.ts +0 -0
- /package/dist/{datasource → cjs/datasource}/DataSourceStatus.d.ts.map +0 -0
- /package/dist/{datasource → cjs/datasource}/DataSourceStatusErrorInfo.d.ts +0 -0
- /package/dist/{datasource → cjs/datasource}/DataSourceStatusErrorInfo.d.ts.map +0 -0
- /package/dist/{datasource → cjs/datasource}/DataSourceStatusManager.d.ts +0 -0
- /package/dist/{datasource → cjs/datasource}/DataSourceStatusManager.d.ts.map +0 -0
- /package/dist/{datasource → cjs/datasource}/Requestor.d.ts +0 -0
- /package/dist/{datasource → cjs/datasource}/Requestor.d.ts.map +0 -0
- /package/dist/{diagnostics → cjs/diagnostics}/createDiagnosticsInitConfig.d.ts +0 -0
- /package/dist/{diagnostics → cjs/diagnostics}/createDiagnosticsInitConfig.d.ts.map +0 -0
- /package/dist/{diagnostics → cjs/diagnostics}/createDiagnosticsManager.d.ts +0 -0
- /package/dist/{diagnostics → cjs/diagnostics}/createDiagnosticsManager.d.ts.map +0 -0
- /package/dist/{evaluation → cjs/evaluation}/evaluationDetail.d.ts +0 -0
- /package/dist/{evaluation → cjs/evaluation}/evaluationDetail.d.ts.map +0 -0
- /package/dist/{events → cjs/events}/EventFactory.d.ts +0 -0
- /package/dist/{events → cjs/events}/EventFactory.d.ts.map +0 -0
- /package/dist/{events → cjs/events}/createEventProcessor.d.ts +0 -0
- /package/dist/{events → cjs/events}/createEventProcessor.d.ts.map +0 -0
- /package/dist/{flag-manager → cjs/flag-manager}/ContextIndex.d.ts +0 -0
- /package/dist/{flag-manager → cjs/flag-manager}/ContextIndex.d.ts.map +0 -0
- /package/dist/{flag-manager → cjs/flag-manager}/FlagManager.d.ts +0 -0
- /package/dist/{flag-manager → cjs/flag-manager}/FlagManager.d.ts.map +0 -0
- /package/dist/{flag-manager → cjs/flag-manager}/FlagPersistence.d.ts +0 -0
- /package/dist/{flag-manager → cjs/flag-manager}/FlagPersistence.d.ts.map +0 -0
- /package/dist/{flag-manager → cjs/flag-manager}/FlagStore.d.ts +0 -0
- /package/dist/{flag-manager → cjs/flag-manager}/FlagStore.d.ts.map +0 -0
- /package/dist/{flag-manager → cjs/flag-manager}/FlagUpdater.d.ts +0 -0
- /package/dist/{flag-manager → cjs/flag-manager}/FlagUpdater.d.ts.map +0 -0
- /package/dist/{flag-manager → cjs/flag-manager}/ItemDescriptor.d.ts +0 -0
- /package/dist/{flag-manager → cjs/flag-manager}/ItemDescriptor.d.ts.map +0 -0
- /package/dist/{flag-manager → cjs/flag-manager}/calculateChangedKeys.d.ts +0 -0
- /package/dist/{flag-manager → cjs/flag-manager}/calculateChangedKeys.d.ts.map +0 -0
- /package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
- /package/dist/{index.d.ts.map → cjs/index.d.ts.map} +0 -0
- /package/dist/{inspection → cjs/inspection}/InspectorManager.d.ts +0 -0
- /package/dist/{inspection → cjs/inspection}/InspectorManager.d.ts.map +0 -0
- /package/dist/{inspection → cjs/inspection}/createSafeInspector.d.ts +0 -0
- /package/dist/{inspection → cjs/inspection}/createSafeInspector.d.ts.map +0 -0
- /package/dist/{inspection → cjs/inspection}/getInspectorHook.d.ts +0 -0
- /package/dist/{inspection → cjs/inspection}/getInspectorHook.d.ts.map +0 -0
- /package/dist/{inspection → cjs/inspection}/messages.d.ts +0 -0
- /package/dist/{inspection → cjs/inspection}/messages.d.ts.map +0 -0
- /package/dist/{polling → cjs/polling}/PollingProcessor.d.ts +0 -0
- /package/dist/{polling → cjs/polling}/PollingProcessor.d.ts.map +0 -0
- /package/dist/{storage → cjs/storage}/getOrGenerateKey.d.ts +0 -0
- /package/dist/{storage → cjs/storage}/getOrGenerateKey.d.ts.map +0 -0
- /package/dist/{storage → cjs/storage}/namespaceUtils.d.ts +0 -0
- /package/dist/{storage → cjs/storage}/namespaceUtils.d.ts.map +0 -0
- /package/dist/{streaming → cjs/streaming}/StreamingProcessor.d.ts +0 -0
- /package/dist/{streaming → cjs/streaming}/StreamingProcessor.d.ts.map +0 -0
- /package/dist/{streaming → cjs/streaming}/index.d.ts +0 -0
- /package/dist/{streaming → cjs/streaming}/index.d.ts.map +0 -0
- /package/dist/{types → cjs/types}/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/index.d.ts.map +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import DataSourceStatusErrorInfo from './DataSourceStatusErrorInfo';
|
|
2
|
+
export declare enum DataSourceState {
|
|
3
|
+
Initializing = "INITIALIZING",
|
|
4
|
+
Valid = "VALID",
|
|
5
|
+
Interrupted = "INTERRUPTED",
|
|
6
|
+
SetOffline = "SET_OFFLINE",
|
|
7
|
+
Closed = "CLOSED"
|
|
8
|
+
}
|
|
9
|
+
export default interface DataSourceStatus {
|
|
10
|
+
/**
|
|
11
|
+
* An enumerated value representing the overall current state of the data source.
|
|
12
|
+
*/
|
|
13
|
+
readonly state: DataSourceState;
|
|
14
|
+
/**
|
|
15
|
+
* The UNIX epoch timestamp in milliseconds that the value of State most recently changed.
|
|
16
|
+
*
|
|
17
|
+
* The meaning of this depends on the current state:
|
|
18
|
+
* For {@link DataSourceState.Initializing}, it is the time that the datasource started
|
|
19
|
+
* attempting to retrieve data.
|
|
20
|
+
*
|
|
21
|
+
* For {@link DataSourceState.Valid}, it is the time that the data source most
|
|
22
|
+
* recently entered a valid state, after previously having been
|
|
23
|
+
* {@link DataSourceStatus.Initializing} or an invalid state such as
|
|
24
|
+
* {@link DataSourceState.Interrupted}.
|
|
25
|
+
*
|
|
26
|
+
* - For {@link DataSourceState.interrupted}, it is the time that the data source
|
|
27
|
+
* most recently entered an error state, after previously having been
|
|
28
|
+
* {@link DataSourceState.valid}.
|
|
29
|
+
*
|
|
30
|
+
* For {@link DataSourceState.Closed}, it is the time that the data source
|
|
31
|
+
* encountered an unrecoverable error or that the datasource was explicitly closed.
|
|
32
|
+
*/
|
|
33
|
+
readonly stateSince: number;
|
|
34
|
+
/**
|
|
35
|
+
* The last error encountered. May be absent after application restart.
|
|
36
|
+
*/
|
|
37
|
+
readonly lastError?: DataSourceStatusErrorInfo;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=DataSourceStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataSourceStatus.d.ts","sourceRoot":"","sources":["../../src/datasource/DataSourceStatus.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,MAAM,6BAA6B,CAAC;AAEpE,oBAAY,eAAe;IACzB,YAAY,iBAAiB;IAC7B,KAAK,UAAU;IACf,WAAW,gBAAgB;IAC3B,UAAU,gBAAgB;IAC1B,MAAM,WAAW;CAGlB;AAED,MAAM,CAAC,OAAO,WAAW,gBAAgB;IACvC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAEhC;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,yBAAyB,CAAC;CAChD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DataSourceErrorKind } from '@launchdarkly/js-sdk-common';
|
|
2
|
+
export default interface DataSourceStatusErrorInfo {
|
|
3
|
+
readonly kind: DataSourceErrorKind;
|
|
4
|
+
readonly message: string;
|
|
5
|
+
readonly time: number;
|
|
6
|
+
readonly statusCode?: number;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=DataSourceStatusErrorInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataSourceStatusErrorInfo.d.ts","sourceRoot":"","sources":["../../src/datasource/DataSourceStatusErrorInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAGlE,MAAM,CAAC,OAAO,WAAW,yBAAyB;IAEhD,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IAMnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAGzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAGtB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DataSourceErrorKind } from '@launchdarkly/js-sdk-common';
|
|
2
|
+
import LDEmitter from '../LDEmitter';
|
|
3
|
+
import DataSourceStatus, { DataSourceState } from './DataSourceStatus';
|
|
4
|
+
/**
|
|
5
|
+
* Tracks the current data source status and emits updates when the status changes.
|
|
6
|
+
*/
|
|
7
|
+
export default class DataSourceStatusManager {
|
|
8
|
+
private readonly _emitter;
|
|
9
|
+
private _state;
|
|
10
|
+
private _stateSinceMillis;
|
|
11
|
+
private _errorInfo?;
|
|
12
|
+
private _timeStamper;
|
|
13
|
+
constructor(_emitter: LDEmitter, timeStamper?: () => number);
|
|
14
|
+
get status(): DataSourceStatus;
|
|
15
|
+
/**
|
|
16
|
+
* Updates the state of the manager.
|
|
17
|
+
*
|
|
18
|
+
* @param requestedState to track
|
|
19
|
+
* @param isError to indicate that the state update is a result of an error occurring.
|
|
20
|
+
*/
|
|
21
|
+
private _updateState;
|
|
22
|
+
/**
|
|
23
|
+
* Requests the manager move to the provided state. This request may be ignored
|
|
24
|
+
* if the current state cannot transition to the requested state.
|
|
25
|
+
* @param state that is requested
|
|
26
|
+
*/
|
|
27
|
+
requestStateUpdate(state: DataSourceState): void;
|
|
28
|
+
/**
|
|
29
|
+
* Reports a datasource error to this manager. Since the {@link DataSourceStatus} includes error
|
|
30
|
+
* information, it is possible that that a {@link DataSourceStatus} update is emitted with
|
|
31
|
+
* the same {@link DataSourceState}.
|
|
32
|
+
*
|
|
33
|
+
* @param kind of the error
|
|
34
|
+
* @param message for the error
|
|
35
|
+
* @param statusCode of the error if there was one
|
|
36
|
+
* @param recoverable to indicate that the error is anticipated to be recoverable
|
|
37
|
+
*/
|
|
38
|
+
reportError(kind: DataSourceErrorKind, message: string, statusCode?: number, recoverable?: boolean): void;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=DataSourceStatusManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataSourceStatusManager.d.ts","sourceRoot":"","sources":["../../src/datasource/DataSourceStatusManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,gBAAgB,EAAE,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGvE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,uBAAuB;IAOxC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAN3B,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,UAAU,CAAC,CAA4B;IAC/C,OAAO,CAAC,YAAY,CAAe;gBAGhB,QAAQ,EAAE,SAAS,EACpC,WAAW,GAAE,MAAM,MAAyB;IAO9C,IAAI,MAAM,IAAI,gBAAgB,CAM7B;IAED;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAiBpB;;;;OAIG;IACH,kBAAkB,CAAC,KAAK,EAAE,eAAe;IAIzC;;;;;;;;;OASG;IACH,WAAW,CACT,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,EACnB,WAAW,GAAE,OAAe;CAgB/B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Encoding, HttpErrorResponse, LDHeaders, Requests, ServiceEndpoints } from '@launchdarkly/js-sdk-common';
|
|
2
|
+
import { DataSourcePaths } from './DataSourceConfig';
|
|
3
|
+
export declare class LDRequestError extends Error implements HttpErrorResponse {
|
|
4
|
+
status?: number;
|
|
5
|
+
constructor(message: string, status?: number);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Note: The requestor is implemented independently from polling such that it can be used to
|
|
9
|
+
* make a one-off request.
|
|
10
|
+
*/
|
|
11
|
+
export default class Requestor {
|
|
12
|
+
private _requests;
|
|
13
|
+
private readonly _uri;
|
|
14
|
+
private readonly _headers;
|
|
15
|
+
private readonly _method;
|
|
16
|
+
private readonly _body?;
|
|
17
|
+
constructor(_requests: Requests, _uri: string, _headers: {
|
|
18
|
+
[key: string]: string;
|
|
19
|
+
}, _method: string, _body?: string | undefined);
|
|
20
|
+
requestPayload(): Promise<string>;
|
|
21
|
+
}
|
|
22
|
+
export declare function makeRequestor(plainContextString: string, serviceEndpoints: ServiceEndpoints, paths: DataSourcePaths, requests: Requests, encoding: Encoding, baseHeaders?: LDHeaders, baseQueryParams?: {
|
|
23
|
+
key: string;
|
|
24
|
+
value: string;
|
|
25
|
+
}[], withReasons?: boolean, useReport?: boolean, secureModeHash?: string): Requestor;
|
|
26
|
+
//# sourceMappingURL=Requestor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Requestor.d.ts","sourceRoot":"","sources":["../../src/datasource/Requestor.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAER,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,gBAAgB,EACjB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAMrD,qBAAa,cAAe,SAAQ,KAAM,YAAW,iBAAiB;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;gBAEX,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAK7C;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAE1B,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAJf,SAAS,EAAE,QAAQ,EACV,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,EACnC,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,oBAAQ;IAG3B,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;CAkBxC;AAED,wBAAgB,aAAa,CAC3B,kBAAkB,EAAE,MAAM,EAC1B,gBAAgB,EAAE,gBAAgB,EAClC,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,WAAW,CAAC,EAAE,SAAS,EACvB,eAAe,CAAC,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,EAClD,WAAW,CAAC,EAAE,OAAO,EACrB,SAAS,CAAC,EAAE,OAAO,EACnB,cAAc,CAAC,EAAE,MAAM,aA0BxB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Configuration } from '../configuration';
|
|
2
|
+
export type DiagnosticsInitConfig = {
|
|
3
|
+
customBaseURI: boolean;
|
|
4
|
+
customStreamURI: boolean;
|
|
5
|
+
customEventsURI: boolean;
|
|
6
|
+
eventsCapacity: number;
|
|
7
|
+
eventsFlushIntervalMillis: number;
|
|
8
|
+
reconnectTimeMillis: number;
|
|
9
|
+
diagnosticRecordingIntervalMillis: number;
|
|
10
|
+
allAttributesPrivate: boolean;
|
|
11
|
+
usingSecureMode: boolean;
|
|
12
|
+
bootstrapMode: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const createDiagnosticsInitConfig: (config: Configuration) => DiagnosticsInitConfig;
|
|
15
|
+
export default createDiagnosticsInitConfig;
|
|
16
|
+
//# sourceMappingURL=createDiagnosticsInitConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDiagnosticsInitConfig.d.ts","sourceRoot":"","sources":["../../src/diagnostics/createDiagnosticsInitConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAmC,MAAM,kBAAkB,CAAC;AAElF,MAAM,MAAM,qBAAqB,GAAG;IAElC,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,yBAAyB,EAAE,MAAM,CAAC;IAClC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iCAAiC,EAAE,MAAM,CAAC;IAC1C,oBAAoB,EAAE,OAAO,CAAC;IAG9B,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AACF,QAAA,MAAM,2BAA2B,WAAY,aAAa,KAAG,qBAY3D,CAAC;AAEH,eAAe,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { internal, Platform } from '@launchdarkly/js-sdk-common';
|
|
2
|
+
import { Configuration } from '../configuration';
|
|
3
|
+
declare const createDiagnosticsManager: (clientSideID: string, config: Configuration, platform: Platform) => internal.DiagnosticsManager | undefined;
|
|
4
|
+
export default createDiagnosticsManager;
|
|
5
|
+
//# sourceMappingURL=createDiagnosticsManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDiagnosticsManager.d.ts","sourceRoot":"","sources":["../../src/diagnostics/createDiagnosticsManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,QAAA,MAAM,wBAAwB,iBACd,MAAM,UACZ,aAAa,YACX,QAAQ,4CAWnB,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { internal, LDEvaluationReason, LDFlagValue } from '@launchdarkly/js-sdk-common';
|
|
2
|
+
import { LDEvaluationDetail } from '../api';
|
|
3
|
+
export declare function createErrorEvaluationDetail(errorKind: internal.ErrorKinds, def?: LDFlagValue): LDEvaluationDetail;
|
|
4
|
+
export declare function createSuccessEvaluationDetail(value: LDFlagValue, variationIndex?: number, reason?: LDEvaluationReason): LDEvaluationDetail;
|
|
5
|
+
//# sourceMappingURL=evaluationDetail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluationDetail.d.ts","sourceRoot":"","sources":["../../src/evaluation/evaluationDetail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAExF,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE5C,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,QAAQ,CAAC,UAAU,EAC9B,GAAG,CAAC,EAAE,WAAW,GAChB,kBAAkB,CAMpB;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,WAAW,EAClB,cAAc,CAAC,EAAE,MAAM,EACvB,MAAM,CAAC,EAAE,kBAAkB,GAC1B,kBAAkB,CAOpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventFactory.d.ts","sourceRoot":"","sources":["../../src/events/EventFactory.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { internal, LDHeaders, Platform } from '@launchdarkly/js-sdk-common';
|
|
2
|
+
import { Configuration } from '../configuration';
|
|
3
|
+
declare const createEventProcessor: (clientSideID: string, config: Configuration, platform: Platform, baseHeaders: LDHeaders, diagnosticsManager?: internal.DiagnosticsManager) => internal.EventProcessor | undefined;
|
|
4
|
+
export default createEventProcessor;
|
|
5
|
+
//# sourceMappingURL=createEventProcessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createEventProcessor.d.ts","sourceRoot":"","sources":["../../src/events/createEventProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE3F,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,QAAA,MAAM,oBAAoB,iBACV,MAAM,UACZ,aAAa,YACX,QAAQ,eACL,SAAS,uBACD,SAAS,kBAAkB,KAC/C,SAAS,cAAc,GAAG,SAa5B,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An index for tracking the most recently used contexts by timestamp with the ability to
|
|
3
|
+
* update entry timestamps and prune out least used contexts above a max capacity provided.
|
|
4
|
+
*/
|
|
5
|
+
export default class ContextIndex {
|
|
6
|
+
container: IndexContainer;
|
|
7
|
+
/**
|
|
8
|
+
* Creates a {@link ContextIndex} from its JSON representation (likely retrieved from persistence).
|
|
9
|
+
* @param json representation of the {@link ContextIndex}
|
|
10
|
+
* @returns the {@link ContextIndex}
|
|
11
|
+
*/
|
|
12
|
+
static fromJson(json: string): ContextIndex;
|
|
13
|
+
/**
|
|
14
|
+
* @returns the JSON representation of the {@link ContextIndex} (like for saving to persistence)
|
|
15
|
+
*/
|
|
16
|
+
toJson(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Notice that a context has been used and when it was used. This will update an existing record
|
|
19
|
+
* with the given timestamp, or create a new record if one doesn't exist.
|
|
20
|
+
* @param id of the corresponding context
|
|
21
|
+
* @param timestamp in millis since epoch
|
|
22
|
+
*/
|
|
23
|
+
notice(id: string, timestamp: number): void;
|
|
24
|
+
/**
|
|
25
|
+
* Prune the index to the specified max size and then return the IDs
|
|
26
|
+
* @param maxContexts the maximum number of contexts to retain after this prune
|
|
27
|
+
* @returns an array of removed entries
|
|
28
|
+
*/
|
|
29
|
+
prune(maxContexts: number): Array<IndexEntry>;
|
|
30
|
+
}
|
|
31
|
+
export interface IndexContainer {
|
|
32
|
+
index: Array<IndexEntry>;
|
|
33
|
+
}
|
|
34
|
+
interface IndexEntry {
|
|
35
|
+
id: string;
|
|
36
|
+
timestamp: number;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=ContextIndex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextIndex.d.ts","sourceRoot":"","sources":["../../src/flag-manager/ContextIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,YAAY;IAC/B,SAAS,EAAE,cAAc,CAAsC;IAE/D;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY;IAW3C;;OAEG;IACH,MAAM,IAAI,MAAM;IAIhB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IASpC;;;;OAIG;IACH,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC;CAU9C;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;CAC1B;AAED,UAAU,UAAU;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Context, LDLogger, Platform } from '@launchdarkly/js-sdk-common';
|
|
2
|
+
import { FlagsChangeCallback } from './FlagUpdater';
|
|
3
|
+
import { ItemDescriptor } from './ItemDescriptor';
|
|
4
|
+
/**
|
|
5
|
+
* Top level manager of flags for the client. LDClient should be using this
|
|
6
|
+
* interface and not any of the specific instances managed by it. Updates from
|
|
7
|
+
* data sources should be directed to the [init] and [upsert] methods of this
|
|
8
|
+
* interface.
|
|
9
|
+
*/
|
|
10
|
+
export interface FlagManager {
|
|
11
|
+
/**
|
|
12
|
+
* Attempts to get a flag by key from the current flags.
|
|
13
|
+
*/
|
|
14
|
+
get(key: string): ItemDescriptor | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Gets all the current flags.
|
|
17
|
+
*/
|
|
18
|
+
getAll(): {
|
|
19
|
+
[key: string]: ItemDescriptor;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Initializes the flag manager with data from a data source.
|
|
23
|
+
* Persistence initialization is handled by {@link FlagPersistence}
|
|
24
|
+
*/
|
|
25
|
+
init(context: Context, newFlags: {
|
|
26
|
+
[key: string]: ItemDescriptor;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Attempt to update a flag. If the flag is for the wrong context, or
|
|
30
|
+
* it is of an older version, then an update will not be performed.
|
|
31
|
+
*/
|
|
32
|
+
upsert(context: Context, key: string, item: ItemDescriptor): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Asynchronously load cached values from persistence.
|
|
35
|
+
*/
|
|
36
|
+
loadCached(context: Context): Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Update in-memory storage with the specified flags, but do not persistent them to cache
|
|
39
|
+
* storage.
|
|
40
|
+
*/
|
|
41
|
+
setBootstrap(context: Context, newFlags: {
|
|
42
|
+
[key: string]: ItemDescriptor;
|
|
43
|
+
}): void;
|
|
44
|
+
/**
|
|
45
|
+
* Register a flag change callback.
|
|
46
|
+
*/
|
|
47
|
+
on(callback: FlagsChangeCallback): void;
|
|
48
|
+
/**
|
|
49
|
+
* Unregister a flag change callback.
|
|
50
|
+
*/
|
|
51
|
+
off(callback: FlagsChangeCallback): void;
|
|
52
|
+
}
|
|
53
|
+
export default class DefaultFlagManager implements FlagManager {
|
|
54
|
+
private _flagStore;
|
|
55
|
+
private _flagUpdater;
|
|
56
|
+
private _flagPersistencePromise;
|
|
57
|
+
/**
|
|
58
|
+
* @param platform implementation of various platform provided functionality
|
|
59
|
+
* @param sdkKey that will be used to distinguish different environments
|
|
60
|
+
* @param maxCachedContexts that specifies the max number of contexts that will be cached in persistence
|
|
61
|
+
* @param logger used for logging various messages
|
|
62
|
+
* @param timeStamper exists for testing purposes
|
|
63
|
+
*/
|
|
64
|
+
constructor(platform: Platform, sdkKey: string, maxCachedContexts: number, logger: LDLogger, timeStamper?: () => number);
|
|
65
|
+
private _initPersistence;
|
|
66
|
+
get(key: string): ItemDescriptor | undefined;
|
|
67
|
+
getAll(): {
|
|
68
|
+
[key: string]: ItemDescriptor;
|
|
69
|
+
};
|
|
70
|
+
setBootstrap(context: Context, newFlags: {
|
|
71
|
+
[key: string]: ItemDescriptor;
|
|
72
|
+
}): void;
|
|
73
|
+
init(context: Context, newFlags: {
|
|
74
|
+
[key: string]: ItemDescriptor;
|
|
75
|
+
}): Promise<void>;
|
|
76
|
+
upsert(context: Context, key: string, item: ItemDescriptor): Promise<boolean>;
|
|
77
|
+
loadCached(context: Context): Promise<boolean>;
|
|
78
|
+
on(callback: FlagsChangeCallback): void;
|
|
79
|
+
off(callback: FlagsChangeCallback): void;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=FlagManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlagManager.d.ts","sourceRoot":"","sources":["../../src/flag-manager/FlagManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAK1E,OAAoB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAAC;IAE7C;;OAEG;IACH,MAAM,IAAI;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,CAAC;IAE5C;;;OAGG;IACH,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnF;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9E;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE/C;;;OAGG;IACH,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,GAAG,IAAI,CAAC;IAElF;;OAEG;IACH,EAAE,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAExC;;OAEG;IACH,GAAG,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAC;CAC1C;AAED,MAAM,CAAC,OAAO,OAAO,kBAAmB,YAAW,WAAW;IAC5D,OAAO,CAAC,UAAU,CAA0B;IAC5C,OAAO,CAAC,YAAY,CAAc;IAClC,OAAO,CAAC,uBAAuB,CAA2B;IAE1D;;;;;;OAMG;gBAED,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,MAAM,EACzB,MAAM,EAAE,QAAQ,EAChB,WAAW,GAAE,MAAM,MAAyB;YAYhC,gBAAgB;IAoB9B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAI5C,MAAM,IAAI;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE;IAI3C,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,GAAG,IAAI;IAM3E,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlF,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAI7E,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAIpD,EAAE,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI;IAIvC,GAAG,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI;CAGzC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Context, LDLogger, Platform } from '@launchdarkly/js-sdk-common';
|
|
2
|
+
import FlagStore from './FlagStore';
|
|
3
|
+
import FlagUpdater from './FlagUpdater';
|
|
4
|
+
import { ItemDescriptor } from './ItemDescriptor';
|
|
5
|
+
/**
|
|
6
|
+
* This class handles persisting and loading flag values from a persistent
|
|
7
|
+
* store. It intercepts updates and forwards them to the flag updater and
|
|
8
|
+
* then persists changes after the updater has completed.
|
|
9
|
+
*/
|
|
10
|
+
export default class FlagPersistence {
|
|
11
|
+
private readonly _platform;
|
|
12
|
+
private readonly _environmentNamespace;
|
|
13
|
+
private readonly _maxCachedContexts;
|
|
14
|
+
private readonly _flagStore;
|
|
15
|
+
private readonly _flagUpdater;
|
|
16
|
+
private readonly _logger;
|
|
17
|
+
private readonly _timeStamper;
|
|
18
|
+
private _contextIndex;
|
|
19
|
+
private _indexKey?;
|
|
20
|
+
private _indexKeyPromise;
|
|
21
|
+
constructor(_platform: Platform, _environmentNamespace: string, _maxCachedContexts: number, _flagStore: FlagStore, _flagUpdater: FlagUpdater, _logger: LDLogger, _timeStamper?: () => number);
|
|
22
|
+
/**
|
|
23
|
+
* Inits flag persistence for the provided context with the provided flags. This will result
|
|
24
|
+
* in the underlying {@link FlagUpdater} switching its active context.
|
|
25
|
+
*/
|
|
26
|
+
init(context: Context, newFlags: {
|
|
27
|
+
[key: string]: ItemDescriptor;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Upserts a flag into the {@link FlagUpdater} and stores that to persistence if the upsert
|
|
31
|
+
* was successful / accepted. An upsert may be rejected if the provided context is not
|
|
32
|
+
* the active context.
|
|
33
|
+
*/
|
|
34
|
+
upsert(context: Context, key: string, item: ItemDescriptor): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Loads the flags from persistence for the provided context and gives those to the
|
|
37
|
+
* {@link FlagUpdater} this {@link FlagPersistence} was constructed with.
|
|
38
|
+
*/
|
|
39
|
+
loadCached(context: Context): Promise<boolean>;
|
|
40
|
+
private _loadIndex;
|
|
41
|
+
private _storeCache;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=FlagPersistence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlagPersistence.d.ts","sourceRoot":"","sources":["../../src/flag-manager/FlagPersistence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAK1E,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,eAAe;IAMhC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAX/B,OAAO,CAAC,aAAa,CAA2B;IAChD,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,gBAAgB,CAAkB;gBAGvB,SAAS,EAAE,QAAQ,EACnB,qBAAqB,EAAE,MAAM,EAC7B,kBAAkB,EAAE,MAAM,EAC1B,UAAU,EAAE,SAAS,EACrB,YAAY,EAAE,WAAW,EACzB,OAAO,EAAE,QAAQ,EACjB,YAAY,GAAE,MAAM,MAAyB;IAKhE;;;OAGG;IACG,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAKxF;;;;OAIG;IACG,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAQnF;;;OAGG;IACG,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;YA4CtC,UAAU;YAqBV,WAAW;CA4B1B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ItemDescriptor } from './ItemDescriptor';
|
|
2
|
+
/**
|
|
3
|
+
* This interface exists for testing purposes
|
|
4
|
+
*/
|
|
5
|
+
export default interface FlagStore {
|
|
6
|
+
init(newFlags: {
|
|
7
|
+
[key: string]: ItemDescriptor;
|
|
8
|
+
}): void;
|
|
9
|
+
insertOrUpdate(key: string, update: ItemDescriptor): void;
|
|
10
|
+
get(key: string): ItemDescriptor | undefined;
|
|
11
|
+
getAll(): {
|
|
12
|
+
[key: string]: ItemDescriptor;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* In memory flag store.
|
|
17
|
+
*/
|
|
18
|
+
export declare class DefaultFlagStore implements FlagStore {
|
|
19
|
+
private _flags;
|
|
20
|
+
init(newFlags: {
|
|
21
|
+
[key: string]: ItemDescriptor;
|
|
22
|
+
}): void;
|
|
23
|
+
insertOrUpdate(key: string, update: ItemDescriptor): void;
|
|
24
|
+
get(key: string): ItemDescriptor | undefined;
|
|
25
|
+
getAll(): {
|
|
26
|
+
[key: string]: ItemDescriptor;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=FlagStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlagStore.d.ts","sourceRoot":"","sources":["../../src/flag-manager/FlagStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,SAAS;IAChC,IAAI,CAAC,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,GAAG,IAAI,CAAC;IACxD,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC1D,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAAC;IAC7C,MAAM,IAAI;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,CAAC;CAC7C;AAED;;GAEG;AACH,qBAAa,gBAAiB,YAAW,SAAS;IAChD,OAAO,CAAC,MAAM,CAAyC;IAEvD,IAAI,CAAC,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE;IAUhD,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc;IAIlD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAO5C,MAAM,IAAI;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE;CAG5C"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Context, LDLogger } from '@launchdarkly/js-sdk-common';
|
|
2
|
+
import FlagStore from './FlagStore';
|
|
3
|
+
import { ItemDescriptor } from './ItemDescriptor';
|
|
4
|
+
export type FlagChangeType = 'init' | 'patch';
|
|
5
|
+
/**
|
|
6
|
+
* This callback indicates that the details associated with one or more flags
|
|
7
|
+
* have changed.
|
|
8
|
+
*
|
|
9
|
+
* This could be the value of the flag, but it could also include changes
|
|
10
|
+
* to the evaluation reason, such as being included in an experiment.
|
|
11
|
+
*
|
|
12
|
+
* It can include new or deleted flags as well, so an evaluation may result
|
|
13
|
+
* in a FLAG_NOT_FOUND reason.
|
|
14
|
+
*
|
|
15
|
+
* This event does not include the value of the flag. It is expected that you
|
|
16
|
+
* will call a variation method for flag values which you require.
|
|
17
|
+
*/
|
|
18
|
+
export type FlagsChangeCallback = (context: Context, flagKeys: Array<string>, type: FlagChangeType) => void;
|
|
19
|
+
/**
|
|
20
|
+
* The flag updater handles logic required during the flag update process.
|
|
21
|
+
* It handles versions checking to handle out of order flag updates and
|
|
22
|
+
* also handles flag comparisons for change notification.
|
|
23
|
+
*/
|
|
24
|
+
export default class FlagUpdater {
|
|
25
|
+
private _flagStore;
|
|
26
|
+
private _logger;
|
|
27
|
+
private _activeContextKey;
|
|
28
|
+
private _changeCallbacks;
|
|
29
|
+
constructor(flagStore: FlagStore, logger: LDLogger);
|
|
30
|
+
init(context: Context, newFlags: {
|
|
31
|
+
[key: string]: ItemDescriptor;
|
|
32
|
+
}): void;
|
|
33
|
+
initCached(context: Context, newFlags: {
|
|
34
|
+
[key: string]: ItemDescriptor;
|
|
35
|
+
}): void;
|
|
36
|
+
upsert(context: Context, key: string, item: ItemDescriptor): boolean;
|
|
37
|
+
on(callback: FlagsChangeCallback): void;
|
|
38
|
+
off(callback: FlagsChangeCallback): void;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=FlagUpdater.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlagUpdater.d.ts","sourceRoot":"","sources":["../../src/flag-manager/FlagUpdater.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAChC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,EACvB,IAAI,EAAE,cAAc,KACjB,IAAI,CAAC;AAEV;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,OAAO,CAAW;IAC1B,OAAO,CAAC,iBAAiB,CAAqB;IAC9C,OAAO,CAAC,gBAAgB,CAAoC;gBAEhD,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ;IAKlD,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE;IAgBlE,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE;IAQxE,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO;IAuBpE,EAAE,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI;IAIvC,GAAG,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI;CAMzC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Flag } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* An item descriptor is an abstraction that allows for Flag data to be
|
|
4
|
+
* handled using the same type in both a put or a patch.
|
|
5
|
+
*/
|
|
6
|
+
export interface ItemDescriptor {
|
|
7
|
+
version: number;
|
|
8
|
+
flag: Flag;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=ItemDescriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemDescriptor.d.ts","sourceRoot":"","sources":["../../src/flag-manager/ItemDescriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,IAAI,CAAC;CACZ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculateChangedKeys.d.ts","sourceRoot":"","sources":["../../src/flag-manager/calculateChangedKeys.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,cAAc,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EACpC,SAAS,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,YAoBhC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LDClientInternalOptions } from './configuration/Configuration';
|
|
2
|
+
import DataSourceStatus, { DataSourceState } from './datasource/DataSourceStatus';
|
|
3
|
+
import DataSourceStatusErrorInfo from './datasource/DataSourceStatusErrorInfo';
|
|
4
|
+
import Requestor, { makeRequestor } from './datasource/Requestor';
|
|
5
|
+
import LDClientImpl from './LDClientImpl';
|
|
6
|
+
import LDEmitter, { EventName } from './LDEmitter';
|
|
7
|
+
export * from '@launchdarkly/js-sdk-common';
|
|
8
|
+
export * as platform from '@launchdarkly/js-sdk-common';
|
|
9
|
+
export type { LDEvaluationDetail, LDEvaluationDetailTyped, LDClient, LDOptions, ConnectionMode, LDIdentifyOptions, Hook, HookMetadata, EvaluationSeriesContext, EvaluationSeriesData, IdentifySeriesContext, IdentifySeriesData, IdentifySeriesResult, IdentifySeriesStatus, } from './api';
|
|
10
|
+
export type { DataManager, DataManagerFactory, ConnectionParams } from './DataManager';
|
|
11
|
+
export type { FlagManager } from './flag-manager/FlagManager';
|
|
12
|
+
export type { Configuration } from './configuration/Configuration';
|
|
13
|
+
export type { LDEmitter };
|
|
14
|
+
export type { ItemDescriptor } from './flag-manager/ItemDescriptor';
|
|
15
|
+
export type { Flag } from './types';
|
|
16
|
+
export { DataSourcePaths } from './streaming';
|
|
17
|
+
export { BaseDataManager } from './DataManager';
|
|
18
|
+
export { makeRequestor, Requestor };
|
|
19
|
+
export { DataSourceStatus, DataSourceStatusErrorInfo, LDClientImpl, LDClientInternalOptions, DataSourceState, EventName as LDEmitterEventName, };
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,gBAAgB,EAAE,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,yBAAyB,MAAM,wCAAwC,CAAC;AAC/E,OAAO,SAAS,EAAE,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,SAAS,EAAE,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnD,cAAc,6BAA6B,CAAC;AAE5C,OAAO,KAAK,QAAQ,MAAM,6BAA6B,CAAC;AAMxD,YAAY,EACV,kBAAkB,EAClB,uBAAuB,EACvB,QAAQ,EACR,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,IAAI,EACJ,YAAY,EACZ,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,OAAO,CAAC;AAEf,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACvF,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,YAAY,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,YAAY,EAAE,SAAS,EAAE,CAAC;AAC1B,YAAY,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,YAAY,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;AAEpC,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,YAAY,EACZ,uBAAuB,EACvB,eAAe,EACf,SAAS,IAAI,kBAAkB,GAChC,CAAC"}
|
|
@@ -1314,7 +1314,7 @@ class LDClientImpl {
|
|
|
1314
1314
|
successDetail.value = defaultValue;
|
|
1315
1315
|
}
|
|
1316
1316
|
prerequisites?.forEach((prereqKey) => {
|
|
1317
|
-
this.
|
|
1317
|
+
this._variationInternal(prereqKey, undefined, this._eventFactoryDefault);
|
|
1318
1318
|
});
|
|
1319
1319
|
this._eventProcessor?.sendEvent(eventFactory.evalEventClient(flagKey, value, defaultValue, foundItem.flag, evalContext, reason));
|
|
1320
1320
|
return successDetail;
|