Skip to content

Commit 9ec0f35

Browse files
committed
Prettier
1 parent d14138a commit 9ec0f35

File tree

9 files changed

+44
-22
lines changed

9 files changed

+44
-22
lines changed

src/common/helpers.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,29 @@ import {
2020
} from './constants';
2121

2222
const EVENT_TYPE_TRANSLATION_TABLE = {
23-
"EXTRACTION_EXTERNAL_SYNC_UNITS_START": EventType.ExtractionExternalSyncUnitsStart,
24-
"EXTRACTION_METADATA_START": EventType.ExtractionMetadataStart,
25-
"EXTRACTION_DATA_START": EventType.ExtractionDataStart,
26-
"EXTRACTION_DATA_CONTINUE": EventType.ExtractionDataContinue,
27-
"EXTRACTION_ATTACHMENTS_START": EventType.ExtractionAttachmentsStart,
28-
"EXTRACTION_ATTACHMENTS_CONTINUE": EventType.ExtractionAttachmentsContinue,
29-
"EXTRACTION_DATA_DELETE": EventType.ExtractionDataDelete,
30-
"EXTRACTION_ATTACHMENTS_DELETE": EventType.ExtractionAttachmentsDelete,
23+
EXTRACTION_EXTERNAL_SYNC_UNITS_START:
24+
EventType.ExtractionExternalSyncUnitsStart,
25+
EXTRACTION_METADATA_START: EventType.ExtractionMetadataStart,
26+
EXTRACTION_DATA_START: EventType.ExtractionDataStart,
27+
EXTRACTION_DATA_CONTINUE: EventType.ExtractionDataContinue,
28+
EXTRACTION_ATTACHMENTS_START: EventType.ExtractionAttachmentsStart,
29+
EXTRACTION_ATTACHMENTS_CONTINUE: EventType.ExtractionAttachmentsContinue,
30+
EXTRACTION_DATA_DELETE: EventType.ExtractionDataDelete,
31+
EXTRACTION_ATTACHMENTS_DELETE: EventType.ExtractionAttachmentsDelete,
3132
};
3233

3334
/**
3435
* Translates Event type from the old naming scheme to the new one
3536
*/
3637
export function getEventType(eventType: string): EventType {
3738
// If we notice that the event has a newer translation, translate to that
38-
if(eventType in EVENT_TYPE_TRANSLATION_TABLE){
39-
return EVENT_TYPE_TRANSLATION_TABLE[eventType as keyof typeof EVENT_TYPE_TRANSLATION_TABLE];
39+
if (eventType in EVENT_TYPE_TRANSLATION_TABLE) {
40+
return EVENT_TYPE_TRANSLATION_TABLE[
41+
eventType as keyof typeof EVENT_TYPE_TRANSLATION_TABLE
42+
];
4043
}
4144

42-
// Event type doesn't need translation, return
45+
// Event type doesn't need translation, return
4346
if (Object.values(EventType).includes(eventType as EventType)) {
4447
return eventType as EventType;
4548
}

src/logger/logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export const serializeError = (error: unknown) => {
134134
export interface AxiosErrorResponse {
135135
config: {
136136
method: string | undefined;
137-
params: any;
137+
params: object;
138138
url: string | undefined;
139139
};
140140
isAxiosError: boolean;

src/tests/backwards-compatibility/backwards-compatibility.test.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,18 @@ export function checkFunctionCompatibility(
6565
currentFunction instanceof ApiFunction &&
6666
newFunction instanceof ApiFunction
6767
) {
68-
if(!currentFunction.returnTypeExcerpt?.isEmpty) {
69-
if(newFunction.returnTypeExcerpt.text != currentFunction.returnTypeExcerpt.text) {
68+
if (!currentFunction.returnTypeExcerpt?.isEmpty) {
69+
if (
70+
newFunction.returnTypeExcerpt.text !=
71+
currentFunction.returnTypeExcerpt.text
72+
) {
7073
// This will pass, if the new implementation is an object and the current one is not specified or a hard-coded type.
71-
if(!(currentFunction.returnTypeExcerpt.text.split(" ").length != 1 && newFunction.returnTypeExcerpt.text.split(" ").length == 1)) {
74+
if (
75+
!(
76+
currentFunction.returnTypeExcerpt.text.split(' ').length != 1 &&
77+
newFunction.returnTypeExcerpt.text.split(' ').length == 1
78+
)
79+
) {
7280
it(`Function ${newFunction.displayName} should have the same return type as the current function`, () => {
7381
expect(newFunction.returnTypeExcerpt.text).toEqual(
7482
currentFunction.returnTypeExcerpt.text

src/tests/timeout-handling/timeout-1.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ describe('timeout-1 extraction', () => {
4343
// Expect last request to be emission of done event
4444
expect(lastRequest.url).toContain('airdrop.external-extractor.message');
4545
expect(lastRequest.method).toBe('POST');
46-
expect(lastRequest.body.event_type).toBe(ExtractorEventType.ExtractionDataDone);
46+
expect(lastRequest.body.event_type).toBe(
47+
ExtractorEventType.ExtractionDataDone
48+
);
4749
});
4850
});

src/tests/timeout-handling/timeout-2.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ describe('timeout-2 extraction', () => {
4545
// Expect last request to be emission of progress event
4646
expect(lastRequest.url).toContain('airdrop.external-extractor.message');
4747
expect(lastRequest.method).toBe('POST');
48-
expect(lastRequest.body.event_type).toBe(ExtractorEventType.ExtractionDataProgress);
48+
expect(lastRequest.body.event_type).toBe(
49+
ExtractorEventType.ExtractionDataProgress
50+
);
4951
});
5052
});

src/tests/timeout-handling/timeout-3a.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ describe('timeout-3a extraction', () => {
4545
// Expect last request to be emission of error event since we force-kill the worker
4646
expect(lastRequest.url).toContain('airdrop.external-extractor.message');
4747
expect(lastRequest.method).toBe('POST');
48-
expect(lastRequest.body.event_type).toBe(ExtractorEventType.ExtractionDataError);
48+
expect(lastRequest.body.event_type).toBe(
49+
ExtractorEventType.ExtractionDataError
50+
);
4951
});
5052
});

src/tests/timeout-handling/timeout-3b.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ describe('timeout-3b extraction', () => {
4545
// Expect last request to be emission of progress event
4646
expect(lastRequest.url).toContain('airdrop.external-extractor.message');
4747
expect(lastRequest.method).toBe('POST');
48-
expect(lastRequest.body.event_type).toBe(ExtractorEventType.ExtractionDataProgress);
48+
expect(lastRequest.body.event_type).toBe(
49+
ExtractorEventType.ExtractionDataProgress
50+
);
4951
});
5052
});

src/types/extraction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { DonV2, LoaderReport, RateLimited } from './loading';
1313
* EventType is an enum that defines the different types of events that can be sent to the external extractor from ADaaS.
1414
* The external extractor can use these events to know what to do next in the extraction process.
1515
*/
16-
export enum EventType {
16+
export enum EventType {
1717
// Extraction
1818
ExtractionExternalSyncUnitsStart = 'START_EXTRACTING_EXTERNAL_SYNC_UNITS',
1919
ExtractionMetadataStart = 'START_EXTRACTING_METADATA',

src/workers/spawn.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
21
import yargs from 'yargs';
32
import { hideBin } from 'yargs/helpers';
43

54
import { emit } from '../common/control-protocol';
6-
import { getMemoryUsage, getEventType, getTimeoutErrorEventType } from '../common/helpers';
5+
import {
6+
getEventType,
7+
getMemoryUsage,
8+
getTimeoutErrorEventType,
9+
} from '../common/helpers';
710
import { Logger, serializeError } from '../logger/logger';
811
import {
912
AirdropEvent,

0 commit comments

Comments
 (0)