@flopflip/launchdarkly-adapter 14.0.0 → 14.0.2
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.
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types=".pnpm/launchdarkly-js-sdk-common@5.1.0/node_modules/launchdarkly-js-sdk-common" />
|
|
2
1
|
import { AdapterConfigurationStatus, adapterIdentifiers, AdapterInitializationStatus, type TAdapterEventHandlers, type TFlagName, type TFlags, type TFlagVariation, type TLaunchDarklyAdapterArgs, type TLaunchDarklyAdapterInterface, type TUpdateFlagsOptions } from '@flopflip/types';
|
|
3
2
|
import { type LDClient } from 'launchdarkly-js-client-sdk';
|
|
4
3
|
declare class LaunchDarklyAdapter implements TLaunchDarklyAdapterInterface {
|
|
@@ -117,9 +117,9 @@ class LaunchDarklyAdapter {
|
|
|
117
117
|
writable: true,
|
|
118
118
|
value: async (flagsToCache, cacheIdentifier) => {
|
|
119
119
|
if (cacheIdentifier) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
const cache$1 = await cache.getCache(cacheIdentifier, types.adapterIdentifiers.launchdarkly,
|
|
121
|
+
// NOTE: LDContextCommon is part of the type which we never use.
|
|
122
|
+
_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context);
|
|
123
123
|
const cachedFlags = cache$1.get();
|
|
124
124
|
cache$1.set(_objectSpread(_objectSpread({}, cachedFlags), flagsToCache));
|
|
125
125
|
}
|
|
@@ -191,7 +191,7 @@ class LaunchDarklyAdapter {
|
|
|
191
191
|
for (const flagName in flagsFromSdk) {
|
|
192
192
|
// Dispatch whenever a configured flag value changes
|
|
193
193
|
if (Object.hasOwn(flagsFromSdk, flagName) && _classPrivateFieldLooseBase(this, _adapterState)[_adapterState].client) {
|
|
194
|
-
_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].client.on(
|
|
194
|
+
_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].client.on(`change:${flagName}`, async flagValue => {
|
|
195
195
|
const _normalizeFlag = adapterUtilities.normalizeFlag(flagName, flagValue),
|
|
196
196
|
_normalizeFlag2 = _slicedToArray(_normalizeFlag, 2),
|
|
197
197
|
normalizedFlagName = _normalizeFlag2[0],
|
|
@@ -289,7 +289,7 @@ class LaunchDarklyAdapter {
|
|
|
289
289
|
let cachedFlags;
|
|
290
290
|
_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context = _classPrivateFieldLooseBase(this, _ensureContext)[_ensureContext](context);
|
|
291
291
|
if (adapterArgs.cacheIdentifier) {
|
|
292
|
-
const cache$1 = await cache.getCache(adapterArgs.cacheIdentifier, types.adapterIdentifiers.launchdarkly, context
|
|
292
|
+
const cache$1 = await cache.getCache(adapterArgs.cacheIdentifier, types.adapterIdentifiers.launchdarkly, _classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context);
|
|
293
293
|
cachedFlags = cache$1.get();
|
|
294
294
|
if (cachedFlags) {
|
|
295
295
|
_classPrivateFieldLooseBase(this, _updateFlagsInAdapterState)[_updateFlagsInAdapterState](cachedFlags);
|
|
@@ -324,15 +324,11 @@ class LaunchDarklyAdapter {
|
|
|
324
324
|
const nextContext = _classPrivateFieldLooseBase(this, _ensureContext)[_ensureContext](adapterArgs.context);
|
|
325
325
|
if (!isEqual__default["default"](_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context, nextContext)) {
|
|
326
326
|
if (adapterArgs.cacheIdentifier) {
|
|
327
|
-
|
|
328
|
-
const cache$1 = await cache.getCache(adapterArgs.cacheIdentifier, types.adapterIdentifiers.launchdarkly, (_classPrivateFieldLoo3 = _classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context) === null || _classPrivateFieldLoo3 === void 0 ? void 0 : _classPrivateFieldLoo3.key);
|
|
327
|
+
const cache$1 = await cache.getCache(adapterArgs.cacheIdentifier, types.adapterIdentifiers.launchdarkly, _classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context);
|
|
329
328
|
cache$1.unset();
|
|
330
329
|
}
|
|
331
330
|
_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context = nextContext;
|
|
332
331
|
await _classPrivateFieldLooseBase(this, _changeClientContext)[_changeClientContext](_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context);
|
|
333
|
-
return Promise.resolve({
|
|
334
|
-
initializationStatus: types.AdapterInitializationStatus.Succeeded
|
|
335
|
-
});
|
|
336
332
|
}
|
|
337
333
|
return Promise.resolve({
|
|
338
334
|
initializationStatus: types.AdapterInitializationStatus.Succeeded
|
|
@@ -363,7 +359,7 @@ class LaunchDarklyAdapter {
|
|
|
363
359
|
const adapter = new LaunchDarklyAdapter();
|
|
364
360
|
adapterUtilities.exposeGlobally(adapter);
|
|
365
361
|
|
|
366
|
-
const version = "14.0.
|
|
362
|
+
const version = "14.0.2";
|
|
367
363
|
|
|
368
364
|
exports["default"] = adapter;
|
|
369
365
|
exports.version = version;
|
|
@@ -117,9 +117,9 @@ class LaunchDarklyAdapter {
|
|
|
117
117
|
writable: true,
|
|
118
118
|
value: async (flagsToCache, cacheIdentifier) => {
|
|
119
119
|
if (cacheIdentifier) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
const cache$1 = await cache.getCache(cacheIdentifier, types.adapterIdentifiers.launchdarkly,
|
|
121
|
+
// NOTE: LDContextCommon is part of the type which we never use.
|
|
122
|
+
_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context);
|
|
123
123
|
const cachedFlags = cache$1.get();
|
|
124
124
|
cache$1.set(_objectSpread(_objectSpread({}, cachedFlags), flagsToCache));
|
|
125
125
|
}
|
|
@@ -191,7 +191,7 @@ class LaunchDarklyAdapter {
|
|
|
191
191
|
for (const flagName in flagsFromSdk) {
|
|
192
192
|
// Dispatch whenever a configured flag value changes
|
|
193
193
|
if (Object.hasOwn(flagsFromSdk, flagName) && _classPrivateFieldLooseBase(this, _adapterState)[_adapterState].client) {
|
|
194
|
-
_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].client.on(
|
|
194
|
+
_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].client.on(`change:${flagName}`, async flagValue => {
|
|
195
195
|
const _normalizeFlag = adapterUtilities.normalizeFlag(flagName, flagValue),
|
|
196
196
|
_normalizeFlag2 = _slicedToArray(_normalizeFlag, 2),
|
|
197
197
|
normalizedFlagName = _normalizeFlag2[0],
|
|
@@ -289,7 +289,7 @@ class LaunchDarklyAdapter {
|
|
|
289
289
|
let cachedFlags;
|
|
290
290
|
_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context = _classPrivateFieldLooseBase(this, _ensureContext)[_ensureContext](context);
|
|
291
291
|
if (adapterArgs.cacheIdentifier) {
|
|
292
|
-
const cache$1 = await cache.getCache(adapterArgs.cacheIdentifier, types.adapterIdentifiers.launchdarkly, context
|
|
292
|
+
const cache$1 = await cache.getCache(adapterArgs.cacheIdentifier, types.adapterIdentifiers.launchdarkly, _classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context);
|
|
293
293
|
cachedFlags = cache$1.get();
|
|
294
294
|
if (cachedFlags) {
|
|
295
295
|
_classPrivateFieldLooseBase(this, _updateFlagsInAdapterState)[_updateFlagsInAdapterState](cachedFlags);
|
|
@@ -324,15 +324,11 @@ class LaunchDarklyAdapter {
|
|
|
324
324
|
const nextContext = _classPrivateFieldLooseBase(this, _ensureContext)[_ensureContext](adapterArgs.context);
|
|
325
325
|
if (!isEqual__default["default"](_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context, nextContext)) {
|
|
326
326
|
if (adapterArgs.cacheIdentifier) {
|
|
327
|
-
|
|
328
|
-
const cache$1 = await cache.getCache(adapterArgs.cacheIdentifier, types.adapterIdentifiers.launchdarkly, (_classPrivateFieldLoo3 = _classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context) === null || _classPrivateFieldLoo3 === void 0 ? void 0 : _classPrivateFieldLoo3.key);
|
|
327
|
+
const cache$1 = await cache.getCache(adapterArgs.cacheIdentifier, types.adapterIdentifiers.launchdarkly, _classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context);
|
|
329
328
|
cache$1.unset();
|
|
330
329
|
}
|
|
331
330
|
_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context = nextContext;
|
|
332
331
|
await _classPrivateFieldLooseBase(this, _changeClientContext)[_changeClientContext](_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context);
|
|
333
|
-
return Promise.resolve({
|
|
334
|
-
initializationStatus: types.AdapterInitializationStatus.Succeeded
|
|
335
|
-
});
|
|
336
332
|
}
|
|
337
333
|
return Promise.resolve({
|
|
338
334
|
initializationStatus: types.AdapterInitializationStatus.Succeeded
|
|
@@ -363,7 +359,7 @@ class LaunchDarklyAdapter {
|
|
|
363
359
|
const adapter = new LaunchDarklyAdapter();
|
|
364
360
|
adapterUtilities.exposeGlobally(adapter);
|
|
365
361
|
|
|
366
|
-
const version = "14.0.
|
|
362
|
+
const version = "14.0.2";
|
|
367
363
|
|
|
368
364
|
exports["default"] = adapter;
|
|
369
365
|
exports.version = version;
|
|
@@ -106,9 +106,9 @@ class LaunchDarklyAdapter {
|
|
|
106
106
|
writable: true,
|
|
107
107
|
value: async (flagsToCache, cacheIdentifier) => {
|
|
108
108
|
if (cacheIdentifier) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
const cache = await getCache(cacheIdentifier, adapterIdentifiers.launchdarkly,
|
|
110
|
+
// NOTE: LDContextCommon is part of the type which we never use.
|
|
111
|
+
_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context);
|
|
112
112
|
const cachedFlags = cache.get();
|
|
113
113
|
cache.set(_objectSpread(_objectSpread({}, cachedFlags), flagsToCache));
|
|
114
114
|
}
|
|
@@ -180,7 +180,7 @@ class LaunchDarklyAdapter {
|
|
|
180
180
|
for (const flagName in flagsFromSdk) {
|
|
181
181
|
// Dispatch whenever a configured flag value changes
|
|
182
182
|
if (Object.hasOwn(flagsFromSdk, flagName) && _classPrivateFieldLooseBase(this, _adapterState)[_adapterState].client) {
|
|
183
|
-
_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].client.on(
|
|
183
|
+
_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].client.on(`change:${flagName}`, async flagValue => {
|
|
184
184
|
const _normalizeFlag = normalizeFlag(flagName, flagValue),
|
|
185
185
|
_normalizeFlag2 = _slicedToArray(_normalizeFlag, 2),
|
|
186
186
|
normalizedFlagName = _normalizeFlag2[0],
|
|
@@ -278,7 +278,7 @@ class LaunchDarklyAdapter {
|
|
|
278
278
|
let cachedFlags;
|
|
279
279
|
_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context = _classPrivateFieldLooseBase(this, _ensureContext)[_ensureContext](context);
|
|
280
280
|
if (adapterArgs.cacheIdentifier) {
|
|
281
|
-
const cache = await getCache(adapterArgs.cacheIdentifier, adapterIdentifiers.launchdarkly, context
|
|
281
|
+
const cache = await getCache(adapterArgs.cacheIdentifier, adapterIdentifiers.launchdarkly, _classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context);
|
|
282
282
|
cachedFlags = cache.get();
|
|
283
283
|
if (cachedFlags) {
|
|
284
284
|
_classPrivateFieldLooseBase(this, _updateFlagsInAdapterState)[_updateFlagsInAdapterState](cachedFlags);
|
|
@@ -313,15 +313,11 @@ class LaunchDarklyAdapter {
|
|
|
313
313
|
const nextContext = _classPrivateFieldLooseBase(this, _ensureContext)[_ensureContext](adapterArgs.context);
|
|
314
314
|
if (!isEqual(_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context, nextContext)) {
|
|
315
315
|
if (adapterArgs.cacheIdentifier) {
|
|
316
|
-
|
|
317
|
-
const cache = await getCache(adapterArgs.cacheIdentifier, adapterIdentifiers.launchdarkly, (_classPrivateFieldLoo3 = _classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context) === null || _classPrivateFieldLoo3 === void 0 ? void 0 : _classPrivateFieldLoo3.key);
|
|
316
|
+
const cache = await getCache(adapterArgs.cacheIdentifier, adapterIdentifiers.launchdarkly, _classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context);
|
|
318
317
|
cache.unset();
|
|
319
318
|
}
|
|
320
319
|
_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context = nextContext;
|
|
321
320
|
await _classPrivateFieldLooseBase(this, _changeClientContext)[_changeClientContext](_classPrivateFieldLooseBase(this, _adapterState)[_adapterState].context);
|
|
322
|
-
return Promise.resolve({
|
|
323
|
-
initializationStatus: AdapterInitializationStatus.Succeeded
|
|
324
|
-
});
|
|
325
321
|
}
|
|
326
322
|
return Promise.resolve({
|
|
327
323
|
initializationStatus: AdapterInitializationStatus.Succeeded
|
|
@@ -352,6 +348,6 @@ class LaunchDarklyAdapter {
|
|
|
352
348
|
const adapter = new LaunchDarklyAdapter();
|
|
353
349
|
exposeGlobally(adapter);
|
|
354
350
|
|
|
355
|
-
const version = "14.0.
|
|
351
|
+
const version = "14.0.2";
|
|
356
352
|
|
|
357
353
|
export { adapter as default, version };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flopflip/launchdarkly-adapter",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.2",
|
|
4
4
|
"description": "A adapter around the LaunchDarkly client for flipflop",
|
|
5
5
|
"main": "dist/flopflip-launchdarkly-adapter.cjs.js",
|
|
6
6
|
"module": "dist/flopflip-launchdarkly-adapter.esm.js",
|
|
@@ -23,21 +23,21 @@
|
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://github.com/tdeekens/flopflip#readme",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"globalthis": "1.0.
|
|
26
|
+
"globalthis": "1.0.4"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@babel/runtime": "7.24.
|
|
30
|
-
"@flopflip/adapter-utilities": "14.0.0",
|
|
31
|
-
"@flopflip/cache": "14.0.0",
|
|
32
|
-
"@flopflip/localstorage-cache": "14.0.0",
|
|
33
|
-
"@flopflip/sessionstorage-cache": "14.0.0",
|
|
34
|
-
"@flopflip/types": "14.0.0",
|
|
29
|
+
"@babel/runtime": "7.24.5",
|
|
35
30
|
"debounce-fn": "4.0.0",
|
|
36
|
-
"launchdarkly-js-client-sdk": "3.
|
|
31
|
+
"launchdarkly-js-client-sdk": "3.4.0",
|
|
37
32
|
"lodash": "4.17.21",
|
|
38
33
|
"mitt": "3.0.1",
|
|
39
34
|
"tiny-warning": "1.0.3",
|
|
40
|
-
"ts-deepmerge": "7.0.0"
|
|
35
|
+
"ts-deepmerge": "7.0.0",
|
|
36
|
+
"@flopflip/adapter-utilities": "14.0.2",
|
|
37
|
+
"@flopflip/cache": "14.0.2",
|
|
38
|
+
"@flopflip/localstorage-cache": "14.0.2",
|
|
39
|
+
"@flopflip/sessionstorage-cache": "14.0.2",
|
|
40
|
+
"@flopflip/types": "14.0.2"
|
|
41
41
|
},
|
|
42
42
|
"keywords": [
|
|
43
43
|
"feature-flags",
|