Skip to content

Commit 723804b

Browse files
authored
fix: Fix typings for big segment store factories. (#413)
The typings were incorrect for the factories. I am not making this a major version as internally the factories were being called with this type. Additionally the integrations don't use the logger which is what they access from these options. The feature stores had the correct options.
1 parent e3f5e3c commit 723804b

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { LDOptions } from '@launchdarkly/node-server-sdk';
2+
3+
import DynamoDBBigSegmentStoreFactory from '../src/DynamoDBBigSegmentStoreFactory';
4+
5+
it('can construct options with a big segment store', () => {
6+
// This is just a typescript test to ensure the typings match.
7+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
8+
const options: LDOptions = {
9+
bigSegments: {
10+
store: DynamoDBBigSegmentStoreFactory('my-table'),
11+
},
12+
};
13+
});

packages/store/node-server-sdk-dynamodb/src/DynamoDBBigSegmentStoreFactory.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { interfaces, LDOptions } from '@launchdarkly/node-server-sdk';
1+
import { interfaces, LDClientContext } from '@launchdarkly/node-server-sdk';
22

33
import DynamoDBBigSegmentStore from './DynamoDBBigSegmentStore';
44
import LDDynamoDBOptions from './LDDynamoDBOptions';
@@ -18,6 +18,7 @@ import LDDynamoDBOptions from './LDDynamoDBOptions';
1818
export default function DynamoDBBigSegmentStoreFactory(
1919
tableName: string,
2020
options?: LDDynamoDBOptions,
21-
): (config: LDOptions) => interfaces.BigSegmentStore {
22-
return (config: LDOptions) => new DynamoDBBigSegmentStore(tableName, options, config.logger);
21+
): (config: LDClientContext) => interfaces.BigSegmentStore {
22+
return (config: LDClientContext) =>
23+
new DynamoDBBigSegmentStore(tableName, options, config.basicConfiguration.logger);
2324
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { LDOptions } from '@launchdarkly/node-server-sdk';
2+
3+
import RedisBigSegmentStoreFactory from '../src/RedisBigSegmentStoreFactory';
4+
5+
it('can construct options with a big segment store', () => {
6+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
7+
const options: LDOptions = {
8+
bigSegments: {
9+
store: RedisBigSegmentStoreFactory(),
10+
},
11+
};
12+
});

packages/store/node-server-sdk-redis/src/RedisBigSegmentStoreFactory.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { interfaces, LDOptions } from '@launchdarkly/node-server-sdk';
1+
import { interfaces, LDClientContext } from '@launchdarkly/node-server-sdk';
22

33
import LDRedisOptions from './LDRedisOptions';
44
import RedisBigSegmentStore from './RedisBigSegmentStore';
@@ -16,6 +16,7 @@ import RedisBigSegmentStore from './RedisBigSegmentStore';
1616
*/
1717
export default function RedisBigSegmentStoreFactory(
1818
options?: LDRedisOptions,
19-
): (config: LDOptions) => interfaces.BigSegmentStore {
20-
return (config: LDOptions) => new RedisBigSegmentStore(options, config.logger);
19+
): (config: LDClientContext) => interfaces.BigSegmentStore {
20+
return (config: LDClientContext) =>
21+
new RedisBigSegmentStore(options, config?.basicConfiguration.logger);
2122
}

0 commit comments

Comments
 (0)