Skip to content

Commit d40119a

Browse files
committed
review
1 parent 96400ee commit d40119a

20 files changed

+224
-17
lines changed

lib/event_processor/batch_event_processor.react_native.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2024, Optimizely
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
import { vi, describe, it, expect, beforeEach } from 'vitest';
218

319
const mockNetInfo = vi.hoisted(() => {

lib/event_processor/batch_event_processor.react_native.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2024, Optimizely
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
import {
218
NetInfoState,
319
addEventListener as addConnectionListener,

lib/event_processor/batch_event_processor.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2024, Optimizely
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
import { EventProcessor, ProcessableEvent } from "./eventProcessor";
218
import { Cache } from "../utils/cache/cache";
319
import { EventDispatcher, EventDispatcherResponse, EventV1Request } from "./eventDispatcher";

lib/event_processor/eventProcessor.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,12 @@
1616
import { ConversionEvent, ImpressionEvent } from './events'
1717
import { EventV1Request } from './eventDispatcher'
1818
import { getLogger } from '../modules/logging'
19-
import { NOTIFICATION_TYPES } from '../utils/enums'
20-
import { NotificationSender } from '../core/notification_center'
2119
import { Service } from '../service'
2220
import { Consumer, Fn } from '../utils/type';
2321

2422
export const DEFAULT_FLUSH_INTERVAL = 30000 // Unit is ms - default flush interval is 30s
2523
export const DEFAULT_BATCH_SIZE = 10
2624

27-
const logger = getLogger('EventProcessor')
28-
2925
export type ProcessableEvent = ConversionEvent | ImpressionEvent
3026

3127
export interface EventProcessor extends Service {

lib/event_processor/event_processor_factory.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2024, Optimizely
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
import { describe, it, expect, beforeEach, vi, MockInstance } from 'vitest';
218
import { DEFAULT_EVENT_BATCH_SIZE, DEFAULT_EVENT_FLUSH_INTERVAL, DEFAULT_MAX_BACKOFF, DEFAULT_MIN_BACKOFF, getBatchEventProcessor } from './event_processor_factory';
319
import { BatchEventProcessor, BatchEventProcessorConfig, EventWithId } from './batch_event_processor';

lib/event_processor/event_processor_factory.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2024, Optimizely
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
import { LogLevel } from "../common_exports";
218
import { StartupLog } from "../service";
319
import { ExponentialBackoff, IntervalRepeater } from "../utils/repeater/repeater";

lib/event_processor/forwarding_event_processor.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const getMockEventDispatcher = (): EventDispatcher => {
3030
describe('ForwardingEventProcessor', () => {
3131
it('should resolve onRunning() when start is called', async () => {
3232
const dispatcher = getMockEventDispatcher();
33-
const mockDispatch = vi.mocked(dispatcher.dispatchEvent);
3433

3534
const processor = getForwardingEventProcessor(dispatcher);
3635

@@ -56,7 +55,6 @@ describe('ForwardingEventProcessor', () => {
5655

5756
it('should emit dispatch event when event is dispatched', async() => {
5857
const dispatcher = getMockEventDispatcher();
59-
const mockDispatch = vi.mocked(dispatcher.dispatchEvent);
6058

6159
const processor = getForwardingEventProcessor(dispatcher);
6260

@@ -76,7 +74,6 @@ describe('ForwardingEventProcessor', () => {
7674

7775
it('should remove dispatch listener when the function returned from onDispatch is called', async() => {
7876
const dispatcher = getMockEventDispatcher();
79-
const mockDispatch = vi.mocked(dispatcher.dispatchEvent);
8077

8178
const processor = getForwardingEventProcessor(dispatcher);
8279

lib/index.node.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import { NodeOdpManager } from './plugins/odp_manager/index.node';
2727
import * as commonExports from './common_exports';
2828
import { createPollingProjectConfigManager } from './project_config/config_manager_factory.node';
2929
import { createForwardingEventProcessor, createBatchEventProcessor } from './event_processor/event_processor_factory.node';
30-
import { create } from 'domain';
3130

3231
const logger = getLogger();
3332
setLogLevel(LogLevel.ERROR);

lib/optimizely/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ import { NotificationCenter } from '../core/notification_center';
2020
import { EventProcessor } from '../event_processor/eventProcessor';
2121

2222
import { IOdpManager } from '../core/odp/odp_manager';
23-
import { OdpConfig } from '../core/odp/odp_config';
2423
import { OdpEvent } from '../core/odp/odp_event';
2524
import { OptimizelySegmentOption } from '../core/odp/optimizely_segment_option';
2625

2726
import {
2827
UserAttributes,
2928
EventTags,
3029
OptimizelyConfig,
31-
OnReadyResult,
3230
UserProfileService,
3331
Variation,
3432
FeatureFlag,

lib/tests/mock/create_event.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
import { EventV1 } from "../../event_processor";
2-
import { Event } from "../../shared_types";
1+
/**
2+
* Copyright 2024, Optimizely
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
316

417
export function createImpressionEvent(id = 'uuid'): any {
518
return {

0 commit comments

Comments
 (0)