Skip to content

Commit de2c3cd

Browse files
committed
Renamed remaining normalizations to translations.
1 parent 630d0bf commit de2c3cd

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/common/control-protocol.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from '../types/extraction';
1010
import { LoaderEventType } from '../types/loading';
1111
import { LIBRARY_VERSION } from './constants';
12-
import { normalizeOutgoingEventType } from './event-type-normalization';
12+
import { translateOutgoingEventType } from './event-type-translation';
1313

1414
export interface EmitInterface {
1515
event: AirdropEvent;
@@ -24,7 +24,7 @@ export const emit = async ({
2424
}: EmitInterface): Promise<AxiosResponse> => {
2525
// Normalize outgoing event type to ensure we always send new event types
2626
// TODO: Remove when the old types are completely phased out
27-
const translatedEventType = normalizeOutgoingEventType(eventType);
27+
const translatedEventType = translateOutgoingEventType(eventType);
2828

2929
const newEvent: ExtractorEvent | LoaderEvent = {
3030
event_type: translatedEventType,

src/common/event-type-normalization.ts renamed to src/common/event-type-translation.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function normalizeIncomingEventType(eventTypeString: string): EventType {
6969
* Normalizes ExtractorEventType enum values by converting old enum members to new ones.
7070
* Old enum members are deprecated and should be replaced with new ones.
7171
*/
72-
export function normalizeExtractorEventType(
72+
export function translateExtractorEventType(
7373
eventType: ExtractorEventType
7474
): ExtractorEventType {
7575
// Map old enum members to new enum members
@@ -119,7 +119,7 @@ export function normalizeExtractorEventType(
119119
* Normalizes LoaderEventType enum values by converting old enum members to new ones.
120120
* Old enum members are deprecated and should be replaced with new ones.
121121
*/
122-
export function normalizeLoaderEventType(
122+
export function translateLoaderEventType(
123123
eventType: LoaderEventType
124124
): LoaderEventType {
125125
// Map old enum members to new enum members
@@ -145,18 +145,18 @@ export function normalizeLoaderEventType(
145145
/**
146146
* Normalizes any outgoing event type (Extractor or Loader) to ensure new event types are used.
147147
*/
148-
export function normalizeOutgoingEventType(
148+
export function translateOutgoingEventType(
149149
eventType: ExtractorEventType | LoaderEventType
150150
): ExtractorEventType | LoaderEventType {
151151
// Check if it's an ExtractorEventType by checking if the value exists in ExtractorEventType
152152
if (
153153
Object.values(ExtractorEventType).includes(eventType as ExtractorEventType)
154154
) {
155-
return normalizeExtractorEventType(eventType as ExtractorEventType);
155+
return translateExtractorEventType(eventType as ExtractorEventType);
156156
}
157157
// Otherwise treat as LoaderEventType
158158
if (Object.values(LoaderEventType).includes(eventType as LoaderEventType)) {
159-
return normalizeLoaderEventType(eventType as LoaderEventType);
159+
return translateLoaderEventType(eventType as LoaderEventType);
160160
}
161161
// If neither, return as-is
162162
return eventType;

src/deprecated/adapter/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { STATELESS_EVENT_TYPES } from '../../common/constants';
1414
import { getTimeoutExtractorEventType } from '../common/helpers';
1515
// import { Logger } from '../../logger/logger';
1616
import { State, createAdapterState } from '../../state/state';
17-
import { normalizeIncomingEventType } from '../../common/event-type-normalization';
17+
import { normalizeIncomingEventType } from '../../common/event-type-translation';
1818

1919
/**
2020
* Adapter class is used to interact with Airdrop platform. The class provides

src/workers/process-task.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { isMainThread, parentPort, workerData } from 'node:worker_threads';
2-
import { normalizeIncomingEventType } from '../common/event-type-normalization';
2+
import { normalizeIncomingEventType } from '../common/event-type-translation';
33
import { Logger, serializeError } from '../logger/logger';
44
import { createAdapterState } from '../state/state';
55
import {

src/workers/spawn.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import yargs from 'yargs';
33
import { hideBin } from 'yargs/helpers';
44

55
import { emit } from '../common/control-protocol';
6-
import { normalizeIncomingEventType } from '../common/event-type-normalization';
6+
import { normalizeIncomingEventType } from '../common/event-type-translation';
77
import { getMemoryUsage, getTimeoutErrorEventType } from '../common/helpers';
88
import { Logger, serializeError } from '../logger/logger';
99
import {

0 commit comments

Comments
 (0)