Skip to content

Commit 5e6600e

Browse files
committed
Additional changes after contract tests integration
1 parent bb47dde commit 5e6600e

File tree

7 files changed

+28
-27
lines changed

7 files changed

+28
-27
lines changed

packages/shared/common/src/datasource/CompositeDataSource.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ interface TransitionRequest {
2929
err?: Error;
3030
}
3131

32-
// TODO SDK-858: move this out of API directory to neighbor datasource folder
3332
/**
3433
* The {@link CompositeDataSource} can combine a number of {@link DataSystemInitializer}s and {@link DataSystemSynchronizer}s
3534
* into a single {@link DataSource}, implementing fallback and recovery logic internally to choose where data is sourced from.

packages/shared/sdk-server/src/LDClientImpl.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ import { Hook } from './api/integrations/Hook';
3131
import { BigSegmentStoreMembership } from './api/interfaces';
3232
import { LDWaitForInitializationOptions } from './api/LDWaitForInitializationOptions';
3333
import {
34-
isPollingOptions,
34+
isPollingOnlyOptions,
3535
isStandardOptions,
36-
isStreamingOptions,
36+
isStreamingOnlyOptions,
3737
} from './api/options/LDDataSystemOptions';
3838
import BigSegmentsManager from './BigSegmentsManager';
3939
import BigSegmentStoreStatusProvider from './BigSegmentStatusProviderImpl';
@@ -225,7 +225,7 @@ export default class LDClientImpl implements LDClient {
225225
put: () => this._initSuccess(),
226226
});
227227
const makeDefaultProcessor = () => {
228-
if (isPollingOptions(config.dataSystem.dataSource)) {
228+
if (isPollingOnlyOptions(config.dataSystem.dataSource)) {
229229
return new PollingProcessor(
230230
new Requestor(config, this._platform.requests, baseHeaders),
231231
config.dataSystem.dataSource.pollInterval ?? 30,
@@ -238,7 +238,7 @@ export default class LDClientImpl implements LDClient {
238238
// TODO: SDK-858 Hook up composite data source and config
239239
const reconnectDelay =
240240
isStandardOptions(config.dataSystem.dataSource) ||
241-
isStreamingOptions(config.dataSystem.dataSource)
241+
isStreamingOnlyOptions(config.dataSystem.dataSource)
242242
? config.dataSystem.dataSource.streamInitialReconnectDelay
243243
: 1;
244244
return new StreamingProcessor(

packages/shared/sdk-server/src/api/options/LDDataSystemOptions.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { PersistentDataStore } from '../interfaces';
2121
*
2222
* let dataSystemOptions = {
2323
* dataSource: {
24-
* type: 'polling';
24+
* type: 'pollingOnly';
2525
* pollInterval: 300;
2626
* },
2727
* persistentStore: DynamoDBFeatureStore('your-table', { cacheTTL: 30 });
@@ -116,7 +116,7 @@ export interface StandardDataSourceOptions {
116116
* to provide real time data updates.
117117
*/
118118
export interface StreamingDataSourceOptions {
119-
type: 'streaming';
119+
type: 'streamingOnly';
120120

121121
/**
122122
* Sets the initial reconnect delay for the streaming connection, in seconds. Default if omitted.
@@ -134,7 +134,7 @@ export interface StreamingDataSourceOptions {
134134
* This data source will periodically make a request to LaunchDarkly services to retrieve updated data.
135135
*/
136136
export interface PollingDataSourceOptions {
137-
type: 'polling';
137+
type: 'pollingOnly';
138138

139139
/**
140140
* The time between polling requests, in seconds. Default if omitted.
@@ -146,10 +146,10 @@ export function isStandardOptions(u: any): u is StandardDataSourceOptions {
146146
return u.type === 'standard';
147147
}
148148

149-
export function isStreamingOptions(u: any): u is StreamingDataSourceOptions {
150-
return u.type === 'streaming';
149+
export function isStreamingOnlyOptions(u: any): u is StreamingDataSourceOptions {
150+
return u.type === 'streamingOnly';
151151
}
152152

153-
export function isPollingOptions(u: any): u is PollingDataSourceOptions {
154-
return u.type === 'polling';
153+
export function isPollingOnlyOptions(u: any): u is PollingDataSourceOptions {
154+
return u.type === 'pollingOnly';
155155
}

packages/shared/sdk-server/src/api/options/LDOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export interface LDOptions {
100100
*
101101
* let dataSystemOptions = {
102102
* dataSource: {
103-
* type: 'polling';
103+
* type: 'pollingOnly';
104104
* pollInterval: 300;
105105
* },
106106
* persistentStore: DynamoDBFeatureStore('your-table', { cacheTTL: 30 });

packages/shared/sdk-server/src/data_sources/PollingProcessor.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ import {
99
} from '@launchdarkly/js-sdk-common';
1010

1111
import { LDDataSourceUpdates } from '../api/subsystems';
12-
import Configuration from '../options/Configuration';
1312
import { deserializePoll } from '../store';
1413
import VersionedDataKinds from '../store/VersionedDataKinds';
1514
import Requestor from './Requestor';
16-
import { isPollingOptions, isStandardOptions } from '../api/options/LDDataSystemOptions';
1715

1816
export type PollingErrorHandler = (err: LDPollingError) => void;
1917

packages/shared/sdk-server/src/diagnostics/createDiagnosticsInitConfig.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { Platform, secondsToMillis } from '@launchdarkly/js-sdk-common';
22

3-
import { isPollingOptions, isStandardOptions, isStreamingOptions, LDFeatureStore } from '../api';
3+
import {
4+
isPollingOnlyOptions,
5+
isStandardOptions,
6+
isStreamingOnlyOptions,
7+
LDFeatureStore,
8+
} from '../api';
49
import Configuration, { defaultValues } from '../options/Configuration';
510

611
const createDiagnosticsInitConfig = (
@@ -20,20 +25,20 @@ const createDiagnosticsInitConfig = (
2025
eventsFlushIntervalMillis: secondsToMillis(config.flushInterval),
2126
// include polling interval if data source config has it
2227
...((isStandardOptions(config.dataSystem.dataSource) ||
23-
isPollingOptions(config.dataSystem.dataSource)) &&
28+
isPollingOnlyOptions(config.dataSystem.dataSource)) &&
2429
config.dataSystem.dataSource.pollInterval
2530
? { pollingIntervalMillis: config.dataSystem.dataSource.pollInterval }
2631
: null),
2732
// include reconnect delay if data source config has it
2833
...((isStandardOptions(config.dataSystem.dataSource) ||
29-
isStreamingOptions(config.dataSystem.dataSource)) &&
34+
isStreamingOnlyOptions(config.dataSystem.dataSource)) &&
3035
config.dataSystem.dataSource.streamInitialReconnectDelay
3136
? { reconnectTimeMillis: config.dataSystem.dataSource.streamInitialReconnectDelay }
3237
: null),
3338
contextKeysFlushIntervalMillis: secondsToMillis(config.contextKeysFlushInterval),
3439
diagnosticRecordingIntervalMillis: secondsToMillis(config.diagnosticRecordingInterval),
3540

36-
streamingDisabled: isPollingOptions(config.dataSystem.dataSource),
41+
streamingDisabled: isPollingOnlyOptions(config.dataSystem.dataSource),
3742
usingRelayDaemon: config.useLdd,
3843
offline: config.offline,
3944
allAttributesPrivate: config.allAttributesPrivate,

packages/shared/sdk-server/src/options/Configuration.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@ import { LDBigSegmentsOptions, LDOptions, LDProxyOptions, LDTLSOptions } from '.
1616
import { Hook } from '../api/integrations';
1717
import {
1818
DataSourceOptions,
19-
isPollingOptions,
19+
isPollingOnlyOptions,
2020
isStandardOptions,
21-
isStreamingOptions,
21+
isStreamingOnlyOptions,
2222
LDDataSystemOptions,
2323
PollingDataSourceOptions,
2424
StandardDataSourceOptions,
2525
StreamingDataSourceOptions,
2626
} from '../api/options/LDDataSystemOptions';
2727
import { LDDataSourceUpdates, LDFeatureStore } from '../api/subsystems';
28-
import { PersistentDataStoreWrapper } from '../store';
2928
import InMemoryFeatureStore from '../store/InMemoryFeatureStore';
3029
import { ValidatedOptions } from './ValidatedOptions';
3130

@@ -82,12 +81,12 @@ const defaultStandardDataSourceOptions: StandardDataSourceOptions = {
8281
};
8382

8483
const defaultStreamingDataSourceOptions: StreamingDataSourceOptions = {
85-
type: 'streaming',
84+
type: 'streamingOnly',
8685
streamInitialReconnectDelay: DEFAULT_STREAM_RECONNECT_DELAY,
8786
};
8887

8988
const defaultPollingDataSourceOptions: PollingDataSourceOptions = {
90-
type: 'polling',
89+
type: 'pollingOnly',
9190
pollInterval: DEFAULT_POLL_INTERVAL,
9291
};
9392

@@ -232,12 +231,12 @@ function validateDataSystemOptions(options: Options): {
232231
options.dataSource,
233232
defaultStandardDataSourceOptions,
234233
));
235-
} else if (isStreamingOptions(options.dataSource)) {
234+
} else if (isStreamingOnlyOptions(options.dataSource)) {
236235
({ errors, validatedOptions: validatedDataSourceOptions } = validateTypesAndNames(
237236
options.dataSource,
238237
defaultStreamingDataSourceOptions,
239238
));
240-
} else if (isPollingOptions(options.dataSource)) {
239+
} else if (isPollingOnlyOptions(options.dataSource)) {
241240
({ errors, validatedOptions: validatedDataSourceOptions } = validateTypesAndNames(
242241
options.dataSource,
243242
defaultPollingDataSourceOptions,
@@ -395,7 +394,7 @@ export default class Configuration {
395394
pollInterval: validatedOptions.pollInterval,
396395
}
397396
: {
398-
type: 'polling',
397+
type: 'pollingOnly',
399398
pollInterval: validatedOptions.pollInterval,
400399
},
401400
useLdd: validatedOptions.useLdd,

0 commit comments

Comments
 (0)