@launchdarkly/js-client-sdk-common 1.22.0 → 1.24.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 +40 -0
- package/dist/cjs/DataManager.d.ts +33 -0
- package/dist/cjs/DataManager.d.ts.map +1 -1
- package/dist/cjs/api/LDOptions.d.ts +17 -5
- package/dist/cjs/api/LDOptions.d.ts.map +1 -1
- package/dist/cjs/api/datasource/DataSourceEntry.d.ts +57 -0
- package/dist/cjs/api/datasource/DataSourceEntry.d.ts.map +1 -1
- package/dist/cjs/api/datasource/FDv2ConnectionMode.d.ts +5 -0
- package/dist/cjs/api/datasource/FDv2ConnectionMode.d.ts.map +1 -1
- package/dist/cjs/api/datasource/LDClientDataSystemOptions.d.ts +55 -37
- package/dist/cjs/api/datasource/LDClientDataSystemOptions.d.ts.map +1 -1
- package/dist/cjs/api/datasource/ModeDefinition.d.ts +19 -3
- package/dist/cjs/api/datasource/ModeDefinition.d.ts.map +1 -1
- package/dist/cjs/api/datasource/index.d.ts +2 -2
- package/dist/cjs/api/datasource/index.d.ts.map +1 -1
- package/dist/cjs/configuration/Configuration.d.ts +3 -3
- package/dist/cjs/configuration/Configuration.d.ts.map +1 -1
- package/dist/cjs/configuration/validateOptions.d.ts +18 -2
- package/dist/cjs/configuration/validateOptions.d.ts.map +1 -1
- package/dist/cjs/configuration/validators.d.ts +1 -1
- package/dist/cjs/configuration/validators.d.ts.map +1 -1
- package/dist/cjs/datasource/ConnectionModeConfig.d.ts +4 -2
- package/dist/cjs/datasource/ConnectionModeConfig.d.ts.map +1 -1
- package/dist/cjs/datasource/FDv2DataManagerBase.d.ts +87 -0
- package/dist/cjs/datasource/FDv2DataManagerBase.d.ts.map +1 -0
- package/dist/cjs/datasource/LDClientDataSystemOptions.d.ts +38 -3
- package/dist/cjs/datasource/LDClientDataSystemOptions.d.ts.map +1 -1
- package/dist/cjs/datasource/SourceFactoryProvider.d.ts +77 -0
- package/dist/cjs/datasource/SourceFactoryProvider.d.ts.map +1 -0
- package/dist/cjs/datasource/fdv2/FDv2DataSource.d.ts.map +1 -1
- package/dist/cjs/flag-manager/FlagManager.d.ts +16 -1
- package/dist/cjs/flag-manager/FlagManager.d.ts.map +1 -1
- package/dist/cjs/flag-manager/FlagPersistence.d.ts +13 -1
- package/dist/cjs/flag-manager/FlagPersistence.d.ts.map +1 -1
- package/dist/cjs/flag-manager/FlagStore.d.ts +10 -0
- package/dist/cjs/flag-manager/FlagStore.d.ts.map +1 -1
- package/dist/cjs/flag-manager/FlagUpdater.d.ts +13 -1
- package/dist/cjs/flag-manager/FlagUpdater.d.ts.map +1 -1
- package/dist/cjs/index.cjs +2271 -12
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +12 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/types/index.d.ts +2 -2
- package/dist/esm/DataManager.d.ts +33 -0
- package/dist/esm/DataManager.d.ts.map +1 -1
- package/dist/esm/api/LDOptions.d.ts +17 -5
- package/dist/esm/api/LDOptions.d.ts.map +1 -1
- package/dist/esm/api/datasource/DataSourceEntry.d.ts +57 -0
- package/dist/esm/api/datasource/DataSourceEntry.d.ts.map +1 -1
- package/dist/esm/api/datasource/FDv2ConnectionMode.d.ts +5 -0
- package/dist/esm/api/datasource/FDv2ConnectionMode.d.ts.map +1 -1
- package/dist/esm/api/datasource/LDClientDataSystemOptions.d.ts +55 -37
- package/dist/esm/api/datasource/LDClientDataSystemOptions.d.ts.map +1 -1
- package/dist/esm/api/datasource/ModeDefinition.d.ts +19 -3
- package/dist/esm/api/datasource/ModeDefinition.d.ts.map +1 -1
- package/dist/esm/api/datasource/index.d.ts +2 -2
- package/dist/esm/api/datasource/index.d.ts.map +1 -1
- package/dist/esm/configuration/Configuration.d.ts +3 -3
- package/dist/esm/configuration/Configuration.d.ts.map +1 -1
- package/dist/esm/configuration/validateOptions.d.ts +18 -2
- package/dist/esm/configuration/validateOptions.d.ts.map +1 -1
- package/dist/esm/configuration/validators.d.ts +1 -1
- package/dist/esm/configuration/validators.d.ts.map +1 -1
- package/dist/esm/datasource/ConnectionModeConfig.d.ts +4 -2
- package/dist/esm/datasource/ConnectionModeConfig.d.ts.map +1 -1
- package/dist/esm/datasource/FDv2DataManagerBase.d.ts +87 -0
- package/dist/esm/datasource/FDv2DataManagerBase.d.ts.map +1 -0
- package/dist/esm/datasource/LDClientDataSystemOptions.d.ts +38 -3
- package/dist/esm/datasource/LDClientDataSystemOptions.d.ts.map +1 -1
- package/dist/esm/datasource/SourceFactoryProvider.d.ts +77 -0
- package/dist/esm/datasource/SourceFactoryProvider.d.ts.map +1 -0
- package/dist/esm/datasource/fdv2/FDv2DataSource.d.ts.map +1 -1
- package/dist/esm/flag-manager/FlagManager.d.ts +16 -1
- package/dist/esm/flag-manager/FlagManager.d.ts.map +1 -1
- package/dist/esm/flag-manager/FlagPersistence.d.ts +13 -1
- package/dist/esm/flag-manager/FlagPersistence.d.ts.map +1 -1
- package/dist/esm/flag-manager/FlagStore.d.ts +10 -0
- package/dist/esm/flag-manager/FlagStore.d.ts.map +1 -1
- package/dist/esm/flag-manager/FlagUpdater.d.ts +13 -1
- package/dist/esm/flag-manager/FlagUpdater.d.ts.map +1 -1
- package/dist/esm/index.d.ts +12 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.mjs +2267 -14
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/types/index.d.ts +2 -2
- package/package.json +2 -2
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { LDHeaders, Platform } from '@launchdarkly/js-sdk-common';
|
|
2
|
+
import { FDv2ConnectionMode, ModeResolutionTable } from '../api/datasource';
|
|
3
|
+
import { LDIdentifyOptions } from '../api/LDIdentifyOptions';
|
|
4
|
+
import { Configuration } from '../configuration/Configuration';
|
|
5
|
+
import { DataManager } from '../DataManager';
|
|
6
|
+
import { FlagManager } from '../flag-manager/FlagManager';
|
|
7
|
+
import LDEmitter from '../LDEmitter';
|
|
8
|
+
import { ModeTable } from './ConnectionModeConfig';
|
|
9
|
+
import { DataSourceEndpoints } from './Endpoints';
|
|
10
|
+
import { SourceFactoryProvider } from './SourceFactoryProvider';
|
|
11
|
+
import { LifecycleState, NetworkState } from './StateDebounceManager';
|
|
12
|
+
/**
|
|
13
|
+
* Configuration for creating an {@link FDv2DataManagerControl}.
|
|
14
|
+
*/
|
|
15
|
+
export interface FDv2DataManagerBaseConfig {
|
|
16
|
+
platform: Platform;
|
|
17
|
+
flagManager: FlagManager;
|
|
18
|
+
credential: string;
|
|
19
|
+
config: Configuration;
|
|
20
|
+
baseHeaders: LDHeaders;
|
|
21
|
+
emitter: LDEmitter;
|
|
22
|
+
/** Mode resolution table for this platform. */
|
|
23
|
+
transitionTable: ModeResolutionTable;
|
|
24
|
+
/** The configured foreground connection mode. Use {@link resolveForegroundMode} to derive. */
|
|
25
|
+
foregroundMode: FDv2ConnectionMode;
|
|
26
|
+
/** The background connection mode, if any. */
|
|
27
|
+
backgroundMode: FDv2ConnectionMode | undefined;
|
|
28
|
+
/** The mode table mapping modes to data source definitions. */
|
|
29
|
+
modeTable: ModeTable;
|
|
30
|
+
/** Provider that converts DataSourceEntry descriptors to concrete factories. */
|
|
31
|
+
sourceFactoryProvider: SourceFactoryProvider;
|
|
32
|
+
/**
|
|
33
|
+
* Platform-specific function to build query params for each identify call.
|
|
34
|
+
* Browser returns `[{ key: 'auth', value: credential }]` + optional hash.
|
|
35
|
+
* Mobile returns `[]` (uses Authorization header instead).
|
|
36
|
+
*/
|
|
37
|
+
buildQueryParams: (identifyOptions?: LDIdentifyOptions) => {
|
|
38
|
+
key: string;
|
|
39
|
+
value: string;
|
|
40
|
+
}[];
|
|
41
|
+
/**
|
|
42
|
+
* FDv1 endpoint factory for fallback. When provided, a blocked FDv1
|
|
43
|
+
* polling synchronizer slot is automatically appended to every data
|
|
44
|
+
* source. It is activated when an FDv2 response includes the
|
|
45
|
+
* `x-ld-fd-fallback` header.
|
|
46
|
+
*
|
|
47
|
+
* Browser: `browserFdv1Endpoints(clientSideId)`
|
|
48
|
+
* Mobile: `mobileFdv1Endpoints()`
|
|
49
|
+
*/
|
|
50
|
+
fdv1Endpoints?: DataSourceEndpoints;
|
|
51
|
+
/** Fallback condition timeout in ms (default 120s). */
|
|
52
|
+
fallbackTimeoutMs?: number;
|
|
53
|
+
/** Recovery condition timeout in ms (default 300s). */
|
|
54
|
+
recoveryTimeoutMs?: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The public interface returned by {@link createFDv2DataManagerBase}.
|
|
58
|
+
* Extends {@link DataManager} with mode control methods.
|
|
59
|
+
*/
|
|
60
|
+
export interface FDv2DataManagerControl extends DataManager {
|
|
61
|
+
/** Update the pending network state. Goes through debounce. */
|
|
62
|
+
setNetworkState(state: NetworkState): void;
|
|
63
|
+
/** Update the pending lifecycle state. Goes through debounce. */
|
|
64
|
+
setLifecycleState(state: LifecycleState): void;
|
|
65
|
+
/**
|
|
66
|
+
* Set an explicit connection mode override that bypasses all automatic
|
|
67
|
+
* behavior (transition table, streaming, lifecycle). Pass undefined to
|
|
68
|
+
* clear the override and return to automatic behavior.
|
|
69
|
+
*/
|
|
70
|
+
setConnectionMode(mode?: FDv2ConnectionMode): void;
|
|
71
|
+
/** Get the currently resolved connection mode. */
|
|
72
|
+
getCurrentMode(): FDv2ConnectionMode;
|
|
73
|
+
/** The configured default foreground mode (from config, not auto-promoted). */
|
|
74
|
+
readonly configuredForegroundMode: FDv2ConnectionMode;
|
|
75
|
+
/**
|
|
76
|
+
* Set a callback to flush pending analytics events. Called immediately
|
|
77
|
+
* (not debounced) when the lifecycle transitions to background.
|
|
78
|
+
*/
|
|
79
|
+
setFlushCallback(callback: () => void): void;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Creates a shared FDv2 data manager that owns mode resolution, debouncing,
|
|
83
|
+
* selector state, and FDv2DataSource lifecycle. Platform SDKs (browser, RN)
|
|
84
|
+
* wrap this with platform-specific config and event wiring.
|
|
85
|
+
*/
|
|
86
|
+
export declare function createFDv2DataManagerBase(baseConfig: FDv2DataManagerBaseConfig): FDv2DataManagerControl;
|
|
87
|
+
//# sourceMappingURL=FDv2DataManagerBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FDv2DataManagerBase.d.ts","sourceRoot":"","sources":["../../src/datasource/FDv2DataManagerBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EACT,QAAQ,EAET,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,kBAAkB,EAElB,mBAAmB,EAEpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,mBAAmB,EAAiB,MAAM,aAAa,CAAC;AAQjE,OAAO,EAAwB,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAEL,cAAc,EACd,YAAY,EAGb,MAAM,wBAAwB,CAAC;AAIhC;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,aAAa,CAAC;IACtB,WAAW,EAAE,SAAS,CAAC;IACvB,OAAO,EAAE,SAAS,CAAC;IAEnB,+CAA+C;IAC/C,eAAe,EAAE,mBAAmB,CAAC;IACrC,8FAA8F;IAC9F,cAAc,EAAE,kBAAkB,CAAC;IACnC,8CAA8C;IAC9C,cAAc,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAC/C,+DAA+D;IAC/D,SAAS,EAAE,SAAS,CAAC;IACrB,gFAAgF;IAChF,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C;;;;OAIG;IACH,gBAAgB,EAAE,CAAC,eAAe,CAAC,EAAE,iBAAiB,KAAK;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAE5F;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,mBAAmB,CAAC;IAEpC,uDAAuD;IACvD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uDAAuD;IACvD,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAuB,SAAQ,WAAW;IACzD,+DAA+D;IAC/D,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IAC3C,iEAAiE;IACjE,iBAAiB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/C;;;;OAIG;IACH,iBAAiB,CAAC,IAAI,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACnD,kDAAkD;IAClD,cAAc,IAAI,kBAAkB,CAAC;IACrC,+EAA+E;IAC/E,QAAQ,CAAC,wBAAwB,EAAE,kBAAkB,CAAC;IACtD;;;OAGG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CAC9C;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,yBAAyB,GACpC,sBAAsB,CA4fxB"}
|
|
@@ -1,8 +1,37 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type FDv2ConnectionMode from '../api/datasource/FDv2ConnectionMode';
|
|
2
|
+
import type { AutomaticModeSwitchingConfig, LDClientDataSystemOptions, ManualModeSwitching } from '../api/datasource/LDClientDataSystemOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Internal data system options that extend the public type with fields
|
|
5
|
+
* that are set by platform SDKs but not exposed to end users.
|
|
6
|
+
*/
|
|
7
|
+
export interface InternalDataSystemOptions extends LDClientDataSystemOptions {
|
|
8
|
+
/**
|
|
9
|
+
* The default foreground connection mode for this platform.
|
|
10
|
+
* Populated from platform defaults during validation.
|
|
11
|
+
*/
|
|
12
|
+
foregroundConnectionMode?: FDv2ConnectionMode;
|
|
13
|
+
/**
|
|
14
|
+
* The connection mode to use when the application transitions to the background.
|
|
15
|
+
* Set by platform SDKs (e.g., mobile) via platform defaults.
|
|
16
|
+
*/
|
|
17
|
+
backgroundConnectionMode?: FDv2ConnectionMode;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Platform-specific default configuration for the FDv2 data system.
|
|
21
|
+
* Internal to the SDK — not exposed to end users.
|
|
22
|
+
*/
|
|
23
|
+
export interface PlatformDataSystemDefaults {
|
|
24
|
+
/** The default foreground connection mode for this platform. */
|
|
25
|
+
readonly foregroundConnectionMode: FDv2ConnectionMode;
|
|
26
|
+
/** The default background connection mode, if any. */
|
|
27
|
+
readonly backgroundConnectionMode?: FDv2ConnectionMode;
|
|
28
|
+
/** Whether automatic mode switching is enabled by default. */
|
|
29
|
+
readonly automaticModeSwitching: boolean | AutomaticModeSwitchingConfig | ManualModeSwitching;
|
|
30
|
+
}
|
|
2
31
|
declare const dataSystemValidators: {
|
|
3
|
-
initialConnectionMode: import("@launchdarkly/js-sdk-common").OneOf;
|
|
4
32
|
backgroundConnectionMode: import("@launchdarkly/js-sdk-common").OneOf;
|
|
5
33
|
automaticModeSwitching: import("../configuration/validateOptions").CompoundValidator;
|
|
34
|
+
connectionModes: import("../configuration/validateOptions").CompoundValidator;
|
|
6
35
|
};
|
|
7
36
|
/**
|
|
8
37
|
* Default FDv2 data system configuration for browser SDKs.
|
|
@@ -16,5 +45,11 @@ declare const MOBILE_DATA_SYSTEM_DEFAULTS: PlatformDataSystemDefaults;
|
|
|
16
45
|
* Default FDv2 data system configuration for desktop SDKs (Electron, etc.).
|
|
17
46
|
*/
|
|
18
47
|
declare const DESKTOP_DATA_SYSTEM_DEFAULTS: PlatformDataSystemDefaults;
|
|
19
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Resolve the foreground connection mode from a validated data system config
|
|
50
|
+
* and platform defaults. Uses the mode from `ManualModeSwitching` when present,
|
|
51
|
+
* otherwise falls back to the platform default.
|
|
52
|
+
*/
|
|
53
|
+
declare function resolveForegroundMode(dataSystem: InternalDataSystemOptions, defaults: PlatformDataSystemDefaults): FDv2ConnectionMode;
|
|
54
|
+
export { dataSystemValidators, resolveForegroundMode, BROWSER_DATA_SYSTEM_DEFAULTS, MOBILE_DATA_SYSTEM_DEFAULTS, DESKTOP_DATA_SYSTEM_DEFAULTS, };
|
|
20
55
|
//# sourceMappingURL=LDClientDataSystemOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LDClientDataSystemOptions.d.ts","sourceRoot":"","sources":["../../src/datasource/LDClientDataSystemOptions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"LDClientDataSystemOptions.d.ts","sourceRoot":"","sources":["../../src/datasource/LDClientDataSystemOptions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,kBAAkB,MAAM,sCAAsC,CAAC;AAC3E,OAAO,KAAK,EACV,4BAA4B,EAC5B,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,6CAA6C,CAAC;AAIrD;;;GAGG;AACH,MAAM,WAAW,yBAA0B,SAAQ,yBAAyB;IAC1E;;;OAGG;IACH,wBAAwB,CAAC,EAAE,kBAAkB,CAAC;IAE9C;;;OAGG;IACH,wBAAwB,CAAC,EAAE,kBAAkB,CAAC;CAC/C;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,gEAAgE;IAChE,QAAQ,CAAC,wBAAwB,EAAE,kBAAkB,CAAC;IACtD,sDAAsD;IACtD,QAAQ,CAAC,wBAAwB,CAAC,EAAE,kBAAkB,CAAC;IACvD,8DAA8D;IAC9D,QAAQ,CAAC,sBAAsB,EAAE,OAAO,GAAG,4BAA4B,GAAG,mBAAmB,CAAC;CAC/F;AAiBD,QAAA,MAAM,oBAAoB;;;;CAQzB,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,4BAA4B,EAAE,0BAInC,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,2BAA2B,EAAE,0BAIlC,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,4BAA4B,EAAE,0BAInC,CAAC;AAQF;;;;GAIG;AACH,iBAAS,qBAAqB,CAC5B,UAAU,EAAE,yBAAyB,EACrC,QAAQ,EAAE,0BAA0B,GACnC,kBAAkB,CAKpB;AAED,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC5B,2BAA2B,EAC3B,4BAA4B,GAC7B,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Context, Crypto, Encoding, LDHeaders, LDLogger, Requests, ServiceEndpoints, Storage } from '@launchdarkly/js-sdk-common';
|
|
2
|
+
import { InitializerEntry, SynchronizerEntry } from '../api/datasource';
|
|
3
|
+
import { DataSourcePaths } from './DataSourceConfig';
|
|
4
|
+
import { FDv2Requestor } from './fdv2/FDv2Requestor';
|
|
5
|
+
import { InitializerFactory, SynchronizerSlot } from './fdv2/SourceManager';
|
|
6
|
+
/**
|
|
7
|
+
* Context needed to create concrete initializer/synchronizer factories
|
|
8
|
+
* for a given identify call. Built once per identify and reused across
|
|
9
|
+
* mode switches.
|
|
10
|
+
*/
|
|
11
|
+
export interface SourceFactoryContext {
|
|
12
|
+
/** The FDv2 requestor for polling requests. */
|
|
13
|
+
requestor: FDv2Requestor;
|
|
14
|
+
/** Platform request abstraction. */
|
|
15
|
+
requests: Requests;
|
|
16
|
+
/** Platform encoding abstraction. */
|
|
17
|
+
encoding: Encoding;
|
|
18
|
+
/** Service endpoint configuration. */
|
|
19
|
+
serviceEndpoints: ServiceEndpoints;
|
|
20
|
+
/** Default HTTP headers. */
|
|
21
|
+
baseHeaders: LDHeaders;
|
|
22
|
+
/** Query parameters for requests (e.g., auth, secure mode hash). */
|
|
23
|
+
queryParams: {
|
|
24
|
+
key: string;
|
|
25
|
+
value: string;
|
|
26
|
+
}[];
|
|
27
|
+
/** JSON-serialized evaluation context. */
|
|
28
|
+
plainContextString: string;
|
|
29
|
+
/** Logger. */
|
|
30
|
+
logger: LDLogger;
|
|
31
|
+
/** Polling-specific configuration. */
|
|
32
|
+
polling: {
|
|
33
|
+
/** The polling endpoint paths. */
|
|
34
|
+
paths: DataSourcePaths;
|
|
35
|
+
/** Default poll interval in seconds. */
|
|
36
|
+
intervalSeconds: number;
|
|
37
|
+
};
|
|
38
|
+
/** Streaming-specific configuration. */
|
|
39
|
+
streaming: {
|
|
40
|
+
/** The streaming endpoint paths. */
|
|
41
|
+
paths: DataSourcePaths;
|
|
42
|
+
/** Default initial reconnect delay in seconds. */
|
|
43
|
+
initialReconnectDelaySeconds: number;
|
|
44
|
+
};
|
|
45
|
+
/** Platform storage for reading cached data. */
|
|
46
|
+
storage: Storage | undefined;
|
|
47
|
+
/** Platform crypto for computing storage keys. */
|
|
48
|
+
crypto: Crypto;
|
|
49
|
+
/** Environment namespace (hashed SDK key). */
|
|
50
|
+
environmentNamespace: string;
|
|
51
|
+
/** The context being identified. */
|
|
52
|
+
context: Context;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Converts declarative {@link InitializerEntry} and {@link SynchronizerEntry}
|
|
56
|
+
* descriptors from the mode table into concrete {@link InitializerFactory}
|
|
57
|
+
* and {@link SynchronizerSlot} instances that the {@link FDv2DataSource}
|
|
58
|
+
* orchestrator can use.
|
|
59
|
+
*/
|
|
60
|
+
export interface SourceFactoryProvider {
|
|
61
|
+
/**
|
|
62
|
+
* Create an initializer factory from an initializer entry descriptor.
|
|
63
|
+
* Returns `undefined` if the entry type is not supported.
|
|
64
|
+
*/
|
|
65
|
+
createInitializerFactory(entry: InitializerEntry, ctx: SourceFactoryContext): InitializerFactory | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Create a synchronizer slot from a synchronizer entry descriptor.
|
|
68
|
+
* Returns `undefined` if the entry type is not supported.
|
|
69
|
+
*/
|
|
70
|
+
createSynchronizerSlot(entry: SynchronizerEntry, ctx: SourceFactoryContext): SynchronizerSlot | undefined;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Creates a {@link SourceFactoryProvider} that handles `cache`, `polling`,
|
|
74
|
+
* and `streaming` data source entries.
|
|
75
|
+
*/
|
|
76
|
+
export declare function createDefaultSourceFactoryProvider(): SourceFactoryProvider;
|
|
77
|
+
//# sourceMappingURL=SourceFactoryProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceFactoryProvider.d.ts","sourceRoot":"","sources":["../../src/datasource/SourceFactoryProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,MAAM,EACN,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACR,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAkB,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAqB,MAAM,sBAAsB,CAAC;AAIxE,OAAO,EAA0B,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAKpG;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,+CAA+C;IAC/C,SAAS,EAAE,aAAa,CAAC;IACzB,oCAAoC;IACpC,QAAQ,EAAE,QAAQ,CAAC;IACnB,qCAAqC;IACrC,QAAQ,EAAE,QAAQ,CAAC;IACnB,sCAAsC;IACtC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,4BAA4B;IAC5B,WA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M,YAAY,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,KAAK,IAAI,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,oBAAoB,EAAE,kBAAkB,EAAE,CAAC;IAE3C,qDAAqD;IACrD,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IAEtC,2DAA2D;IAC3D,YAAY,EAAE,YAAY,CAAC;IAE3B,kEAAkE;IAClE,aAAa,EAAE,uBAAuB,CAAC;IAEvC;;;;OAIG;IACH,cAAc,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAEzC,uBAAuB;IACvB,MAAM,CAAC,EAAE,QAAQ,CAAC;IAElB,uDAAuD;IACvD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,uDAAuD;IACvD,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB,wDAAwD;IACxD,KAAK,IAAI,IAAI,CAAC;CACf;AAMD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,CA8QjF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context, LDFlagValue, LDLogger, Platform } from '@launchdarkly/js-sdk-common';
|
|
1
|
+
import { Context, internal, LDFlagValue, LDLogger, Platform } from '@launchdarkly/js-sdk-common';
|
|
2
2
|
import { FlagsChangeCallback } from './FlagUpdater';
|
|
3
3
|
import { ItemDescriptor } from './ItemDescriptor';
|
|
4
4
|
/**
|
|
@@ -51,6 +51,18 @@ export interface FlagManager {
|
|
|
51
51
|
setBootstrap(context: Context, newFlags: {
|
|
52
52
|
[key: string]: ItemDescriptor;
|
|
53
53
|
}): void;
|
|
54
|
+
/**
|
|
55
|
+
* Applies a changeset to the flag store.
|
|
56
|
+
* - `'full'`: replaces all flags (like {@link init}).
|
|
57
|
+
* - `'partial'`: upserts individual flags (like calling {@link upsert} for each entry).
|
|
58
|
+
* - `'none'`: persists cache (updating freshness) without changing any flags.
|
|
59
|
+
*
|
|
60
|
+
* Designed for the FDv2 data path where init/upsert semantics, selector
|
|
61
|
+
* tracking, and freshness updates are all handled in one call.
|
|
62
|
+
*/
|
|
63
|
+
applyChanges(context: Context, updates: {
|
|
64
|
+
[key: string]: ItemDescriptor;
|
|
65
|
+
}, type: internal.PayloadType): Promise<void>;
|
|
54
66
|
/**
|
|
55
67
|
* Register a flag change callback.
|
|
56
68
|
*/
|
|
@@ -137,6 +149,9 @@ export default class DefaultFlagManager implements FlagManager {
|
|
|
137
149
|
}): Promise<void>;
|
|
138
150
|
upsert(context: Context, key: string, item: ItemDescriptor): Promise<boolean>;
|
|
139
151
|
loadCached(context: Context): Promise<boolean>;
|
|
152
|
+
applyChanges(context: Context, updates: {
|
|
153
|
+
[key: string]: ItemDescriptor;
|
|
154
|
+
}, type: internal.PayloadType): Promise<void>;
|
|
140
155
|
on(callback: FlagsChangeCallback): void;
|
|
141
156
|
off(callback: FlagsChangeCallback): void;
|
|
142
157
|
private _convertValueToOverrideDescripter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlagManager.d.ts","sourceRoot":"","sources":["../../src/flag-manager/FlagManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"FlagManager.d.ts","sourceRoot":"","sources":["../../src/flag-manager/FlagManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAKjG,OAA0B,EAAE,mBAAmB,EAAe,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB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AAE,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;IAI9C,YAAY,CAChB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,EAC1C,IAAI,EAAE,QAAQ,CAAC,WAAW,GACzB,OAAO,CAAC,IAAI,CAAC;IAIhB,EAAE,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI;IAIvC,GAAG,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI;IAIxC,OAAO,CAAC,iCAAiC;IAUzC,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW;IAQ3C,cAAc,CAAC,OAAO,EAAE,MAAM;IAe9B,iBAAiB;IAQjB,eAAe;;;IAWf,gBAAgB,IAAI,eAAe;CAQpC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context, LDLogger, Platform } from '@launchdarkly/js-sdk-common';
|
|
1
|
+
import { Context, internal, LDLogger, Platform } from '@launchdarkly/js-sdk-common';
|
|
2
2
|
import FlagStore from './FlagStore';
|
|
3
3
|
import { FlagUpdater } from './FlagUpdater';
|
|
4
4
|
import { ItemDescriptor } from './ItemDescriptor';
|
|
@@ -38,6 +38,18 @@ export default class FlagPersistence {
|
|
|
38
38
|
* the active context.
|
|
39
39
|
*/
|
|
40
40
|
upsert(context: Context, key: string, item: ItemDescriptor): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Applies a changeset to the flag store.
|
|
43
|
+
* - `'full'`: replaces all flags via {@link FlagUpdater.init}.
|
|
44
|
+
* - `'partial'`: upserts individual flags via {@link FlagUpdater.upsert}.
|
|
45
|
+
* - `'none'`: no flag changes, only persists cache to update freshness.
|
|
46
|
+
*
|
|
47
|
+
* Always persists to cache afterwards, which updates the freshness timestamp
|
|
48
|
+
* even when no flags change (e.g., transfer-none).
|
|
49
|
+
*/
|
|
50
|
+
applyChanges(context: Context, updates: {
|
|
51
|
+
[key: string]: ItemDescriptor;
|
|
52
|
+
}, type: internal.PayloadType): Promise<void>;
|
|
41
53
|
/**
|
|
42
54
|
* Loads the flags from persistence for the provided context and gives those to the
|
|
43
55
|
* {@link FlagUpdater} this {@link FlagPersistence} was constructed with.
|
|
@@ -1 +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;
|
|
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,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAOpF,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;;;;;;GASG;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,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAZ/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,aAAa,EAAE,OAAO,EACtB,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;;;;;;;;OAQG;IACG,YAAY,CAChB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,EAC1C,IAAI,EAAE,QAAQ,CAAC,WAAW,GACzB,OAAO,CAAC,IAAI,CAAC;IAKhB;;;OAGG;IACG,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;YAuCtC,eAAe;YAiBf,UAAU;YAqBV,WAAW;CAuD1B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { internal } from '@launchdarkly/js-sdk-common';
|
|
1
2
|
import { ItemDescriptor } from './ItemDescriptor';
|
|
2
3
|
/**
|
|
3
4
|
* FlagStore used to store flag data in memory.
|
|
@@ -23,6 +24,15 @@ export default interface FlagStore {
|
|
|
23
24
|
getAll(): {
|
|
24
25
|
[key: string]: ItemDescriptor;
|
|
25
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Applies a changeset to the store without version checks.
|
|
29
|
+
* - `'full'`: replaces all flags.
|
|
30
|
+
* - `'partial'`: merges updates into existing flags.
|
|
31
|
+
* - `'none'`: no-op.
|
|
32
|
+
*/
|
|
33
|
+
applyChanges(updates: {
|
|
34
|
+
[key: string]: ItemDescriptor;
|
|
35
|
+
}, type: internal.PayloadType): void;
|
|
26
36
|
}
|
|
27
37
|
/**
|
|
28
38
|
* Creates the default implementation of the flag store.
|
|
@@ -1 +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;;OAEG;IACH,IAAI,CAAC,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,GAAG,IAAI,CAAC;IACxD;;OAEG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC1D;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAAC;IAC7C;;OAEG;IACH,MAAM,IAAI;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"FlagStore.d.ts","sourceRoot":"","sources":["../../src/flag-manager/FlagStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,SAAS;IAChC;;OAEG;IACH,IAAI,CAAC,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,GAAG,IAAI,CAAC;IACxD;;OAEG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC1D;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAAC;IAC7C;;OAEG;IACH,MAAM,IAAI;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,CAAC;IAE5C;;;;;OAKG;IACH,YAAY,CAAC,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,WAAW,GAAG,IAAI,CAAC;CAC5F;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,SAAS,CAkClD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context, LDLogger } from '@launchdarkly/js-sdk-common';
|
|
1
|
+
import { Context, internal, LDLogger } from '@launchdarkly/js-sdk-common';
|
|
2
2
|
import FlagStore from './FlagStore';
|
|
3
3
|
import { ItemDescriptor } from './ItemDescriptor';
|
|
4
4
|
export type FlagChangeType = 'init' | 'patch' | 'override';
|
|
@@ -51,6 +51,18 @@ export interface FlagUpdater {
|
|
|
51
51
|
* @returns true if the flag was upserted, false otherwise
|
|
52
52
|
*/
|
|
53
53
|
upsert(context: Context, key: string, item: ItemDescriptor): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Applies a changeset directly to the flag store, bypassing version checks
|
|
56
|
+
* and inactive-context guards. Used by the FDv2 data path where ordering
|
|
57
|
+
* is handled at the protocol layer.
|
|
58
|
+
*
|
|
59
|
+
* - `'full'`: replaces all flags and emits change events for differences.
|
|
60
|
+
* - `'partial'`: merges updates and emits change events for each key.
|
|
61
|
+
* - `'none'`: no flag changes (caller handles freshness separately).
|
|
62
|
+
*/
|
|
63
|
+
applyChanges(context: Context, updates: {
|
|
64
|
+
[key: string]: ItemDescriptor;
|
|
65
|
+
}, type: internal.PayloadType): void;
|
|
54
66
|
/**
|
|
55
67
|
* Registers a callback to be called when the flags change.
|
|
56
68
|
*
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"FlagUpdater.d.ts","sourceRoot":"","sources":["../../src/flag-manager/FlagUpdater.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAG1E,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;AAE3D;;;;;;;;;;;;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,WAAW,WAAW;IAC1B;;;;;OAKG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IAE9D;;;;;;OAMG;IACH,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,GAAG,IAAI,CAAC;IAE1E,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,GAAG,IAAI,CAAC;IAEhF;;;;;;;OAOG;IACH,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG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