Skip to content

Commit 1e931af

Browse files
author
uzair-folio3
committed
index.node.js converted to ts
1 parent 227ab98 commit 1e931af

File tree

2 files changed

+7
-44
lines changed

2 files changed

+7
-44
lines changed

packages/optimizely-sdk/lib/index.node.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,23 @@ import {
2525
} from '@optimizely/js-sdk-logging';
2626

2727
import { assign } from './utils/fns';
28-
import { Optimizely } from '@optimizely/optimizely-sdk/optimizely';
28+
import Optimizely from './optimizely';
2929
import * as enums from './utils/enums';
3030
import loggerPlugin from './plugins/logger';
3131
import configValidator from './utils/config_validator';
3232
import defaultErrorHandler from './plugins/error_handler';
3333
import defaultEventDispatcher from './plugins/event_dispatcher/index.node';
3434
import eventProcessorConfigValidator from './utils/event_processor_config_validator';
35-
import { ProjectConfig } from '@optimizely/optimizely-sdk/lib/core/project_config';
35+
import * as projectConfig from './core/project_config';
3636

3737
const logger = getLogger();
3838
setLogLevel(LogLevel.ERROR);
3939

4040
const DEFAULT_EVENT_BATCH_SIZE = 10;
4141
const DEFAULT_EVENT_FLUSH_INTERVAL = 30000; // Unit is ms, default is 30s
4242

43-
export interface Config {
44-
datafile?: ProjectConfig;
43+
interface Config {
44+
datafile?: projectConfig.ProjectConfig;
4545
errorHandler?: ErrorHandler;
4646
eventDispatcher?: (...args: unknown[]) => unknown;
4747
logger?: LogHandler;
@@ -102,19 +102,19 @@ const createInstance = function (config: Config): Optimizely | null {
102102
logger: logger,
103103
errorHandler: getErrorHandler(),
104104
}
105-
);
105+
) as projectConfig.ProjectConfig;
106106

107107
if (!eventProcessorConfigValidator.validateEventBatchSize(config.eventBatchSize)) {
108108
logger.warn('Invalid eventBatchSize %s, defaulting to %s', config.eventBatchSize, DEFAULT_EVENT_BATCH_SIZE);
109-
config.eventBatchSize = DEFAULT_EVENT_BATCH_SIZE;
109+
optimizelyConfig.eventBatchSize = DEFAULT_EVENT_BATCH_SIZE;
110110
}
111111
if (!eventProcessorConfigValidator.validateEventFlushInterval(config.eventFlushInterval)) {
112112
logger.warn(
113113
'Invalid eventFlushInterval %s, defaulting to %s',
114114
config.eventFlushInterval,
115115
DEFAULT_EVENT_FLUSH_INTERVAL
116116
);
117-
config.eventFlushInterval = DEFAULT_EVENT_FLUSH_INTERVAL;
117+
optimizelyConfig.eventFlushInterval = DEFAULT_EVENT_FLUSH_INTERVAL;
118118
}
119119

120120
return new Optimizely(optimizelyConfig);

packages/optimizely-sdk/lib/optimizely/index.d.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)