Skip to content

Commit

Permalink
Bump @typescript-eslint/parser from 5.43.0 to 5.62.0 in /ops/services…
Browse files Browse the repository at this point in the history
…/app_functions/report_stream_batched_publisher/functions (#6225)

* Bump @typescript-eslint/parser

Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.43.0 to 5.62.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.62.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix linting warnings

* run more linting

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Boban <BobanL@users.noreply.github.com>
Co-authored-by: Boban Ljuljdjurovic <ljuljdjurovic@gmail.com>
Co-authored-by: Johanna <103958711+johanna-skylight@users.noreply.github.com>
  • Loading branch information
4 people authored Aug 1, 2023
1 parent 473ca97 commit e8b9560
Show file tree
Hide file tree
Showing 20 changed files with 203 additions and 160 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ PreSelectedAnswer.args = {
value: "YES",
};

export const onError = RadioGroupTemplate.bind({});
onError.args = {
export const OnError = RadioGroupTemplate.bind({});
OnError.args = {
validationStatus: "error",
errorMessage: "Oops something went wrong!",
};
18 changes: 9 additions & 9 deletions frontend/src/stories/DatePicker.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ We may find that we want to expose props for custom event handlers or even a ref
},
};

export const completeDatePicker = (argTypes: {
export const CompleteDatePicker = (argTypes: {
onSubmit: ((event: React.FormEvent<HTMLFormElement>) => void) &
React.FormEventHandler<HTMLFormElement>;
disabled: boolean | undefined;
Expand All @@ -69,19 +69,19 @@ export const completeDatePicker = (argTypes: {
</Form>
);

export const defaultDatePicker = (): React.ReactElement => (
export const DefaultDatePicker = (): React.ReactElement => (
<DatePicker id="birthdate" name="birthdate" />
);

export const disabled = (): React.ReactElement => (
export const Disabled = (): React.ReactElement => (
<DatePicker id="birthdate" name="birthdate" disabled />
);

export const withDefaultValue = (): React.ReactElement => (
export const WithDefaultValue = (): React.ReactElement => (
<DatePicker id="birthdate" name="birthdate" defaultValue="1988-05-16" />
);

export const withDefaultInvalidValue = (): React.ReactElement => (
export const WithDefaultInvalidValue = (): React.ReactElement => (
<DatePicker
id="birthdate"
name="birthdate"
Expand All @@ -90,7 +90,7 @@ export const withDefaultInvalidValue = (): React.ReactElement => (
/>
);

export const withMinMaxInSameMonth = (): React.ReactElement => (
export const WithMinMaxInSameMonth = (): React.ReactElement => (
<DatePicker
id="birthdate"
name="birthdate"
Expand All @@ -99,7 +99,7 @@ export const withMinMaxInSameMonth = (): React.ReactElement => (
/>
);

export const withMinMax = (): React.ReactElement => (
export const WithMinMax = (): React.ReactElement => (
<DatePicker
id="birthdate"
name="birthdate"
Expand All @@ -108,7 +108,7 @@ export const withMinMax = (): React.ReactElement => (
/>
);

export const withRangeDate = (): React.ReactElement => (
export const WithRangeDate = (): React.ReactElement => (
<DatePicker
id="birthdate"
name="birthdate"
Expand All @@ -117,6 +117,6 @@ export const withRangeDate = (): React.ReactElement => (
/>
);

export const withLocalizations = (): React.ReactElement => (
export const WithLocalizations = (): React.ReactElement => (
<DatePicker id="birthdate" name="birthdate" />
);
4 changes: 2 additions & 2 deletions frontend/src/stories/StepIndicator.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ type Props = React.ComponentProps<typeof StepIndicator>;

const Template: StoryFn<Props> = (args) => <StepIndicator {...args} />;

export const noLabels = Template.bind({});
noLabels.args = {
export const NoLabels = Template.bind({});
NoLabels.args = {
noLabels: true,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("data handlers", () => {
expect(processedEvents[0]).toHaveProperty("parseFailure", {});
expect(processedEvents[0]).toHaveProperty(
"testEventsNDJSON",
'{"patientName":"Dexter"}\n{"patientName":"Dee Dee"}\n{"patientName":"Mandark"}'
'{"patientName":"Dexter"}\n{"patientName":"Dee Dee"}\n{"patientName":"Mandark"}',
);
});

Expand All @@ -43,7 +43,7 @@ describe("data handlers", () => {
expect(processedEvents[0]).toHaveProperty("parseFailure", {});
expect(processedEvents[0]).toHaveProperty(
"testEventsNDJSON",
'{"patientName":"Dexter"}'
'{"patientName":"Dexter"}',
);
// bundle 2
expect(processedEvents[1]).toHaveProperty("messages");
Expand All @@ -53,7 +53,7 @@ describe("data handlers", () => {
expect(processedEvents[1]).toHaveProperty("parseFailure", {});
expect(processedEvents[1]).toHaveProperty(
"testEventsNDJSON",
'{"patientName":"Dee Dee"}'
'{"patientName":"Dee Dee"}',
);
// bundle 3
expect(processedEvents[2]).toHaveProperty("messages");
Expand All @@ -63,7 +63,7 @@ describe("data handlers", () => {
expect(processedEvents[2]).toHaveProperty("parseFailure", {});
expect(processedEvents[2]).toHaveProperty(
"testEventsNDJSON",
'{"patientName":"Mandark"}'
'{"patientName":"Mandark"}',
);
});

Expand Down Expand Up @@ -92,7 +92,7 @@ describe("data handlers", () => {
expect(processedEvents[0]).toHaveProperty("parseFailure", { "1": true });
expect(processedEvents[0]).toHaveProperty(
"testEventsNDJSON",
'{"patientName":"Dexter"}'
'{"patientName":"Dexter"}',
);
});

Expand Down Expand Up @@ -144,7 +144,7 @@ describe("data handlers", () => {
expect(processedEvents[0]).toHaveProperty("parseFailure", {});
expect(processedEvents[0]).toHaveProperty(
"testEventsNDJSON",
'{"patientName":"Dexter"}\n{"patientName":"Dee Dee"}'
'{"patientName":"Dexter"}\n{"patientName":"Dee Dee"}',
);
//bundle 2 some invalid
expect(processedEvents[1]).toHaveProperty("messages");
Expand All @@ -154,7 +154,7 @@ describe("data handlers", () => {
expect(processedEvents[1]).toHaveProperty("parseFailure", { "4": true });
expect(processedEvents[1]).toHaveProperty(
"testEventsNDJSON",
'{"patientName":"Mandark"}'
'{"patientName":"Mandark"}',
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function createNewBatch(): FHIRTestEventsBatch {

export function processTestEvents(
messages: DequeuedMessageItem[],
fhirBatchSizeLimit: number
fhirBatchSizeLimit: number,
): FHIRTestEventsBatch[] {
const fhirTestEventsBatches: FHIRTestEventsBatch[] = [];
const delimiterSize = Buffer.byteLength("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jest.mock(
trackEvent: jest.fn(),
trackDependency: jest.fn(),
},
}))
})),
);

describe("FHIRTestEventReporter", () => {
Expand Down Expand Up @@ -79,15 +79,15 @@ describe("FHIRTestEventReporter", () => {
getProperties: jest.fn().mockResolvedValue({
approximateMessagesCount: 10,
}),
} as jest.MockedObject<QueueClient>)
}) as jest.MockedObject<QueueClient>,
);
minimumMessagesAvailableSpy = jest
.spyOn(queueHandlers, "minimumMessagesAvailable")
.mockResolvedValue(true);
processTestEventsSpy = jest.spyOn(dataHandlers, "processTestEvents");
reportToUniversalPipelineSpy = jest.spyOn(
reportingHandlers,
"reportToUniversalPipelineTokenBased"
"reportToUniversalPipelineTokenBased",
);
handleReportStreamResponseSpy = jest
.spyOn(reportingHandlers, "handleReportStreamResponse")
Expand Down Expand Up @@ -122,7 +122,7 @@ describe("FHIRTestEventReporter", () => {
expect(getReportStreamAuthTokenSpy).not.toHaveBeenCalled();
expect(reportToUniversalPipelineSpy).not.toHaveBeenCalled();
expect(context.log).toHaveBeenCalledWith(
"Queue: ciao. Messages Dequeued: 0; aborting."
"Queue: ciao. Messages Dequeued: 0; aborting.",
);
});

Expand Down Expand Up @@ -156,7 +156,7 @@ describe("FHIRTestEventReporter", () => {
expect(getReportStreamAuthTokenSpy).toHaveBeenCalledWith(context);
expect(reportToUniversalPipelineSpy).toHaveBeenCalledWith(
"123abc",
'{"patient":"dexter"}'
'{"patient":"dexter"}',
);
expect(reportToUniversalPipelineSpy).toHaveBeenCalledTimes(1);
expect(handleReportStreamResponseSpy).toHaveBeenCalledTimes(1);
Expand Down Expand Up @@ -185,11 +185,11 @@ describe("FHIRTestEventReporter", () => {
await FHIRTestEventReporter(context);
expect(appInsights.defaultClient.trackEvent).toHaveBeenCalledTimes(2);
expect(appInsights.defaultClient.trackEvent).toHaveBeenCalledWith(
expect.objectContaining({ name: "Queue:ciao. Test Event Parse Failure" })
expect.objectContaining({ name: "Queue:ciao. Test Event Parse Failure" }),
);
expect(reportToUniversalPipelineSpy).not.toHaveBeenCalled();
expect(context.log).toHaveBeenCalledWith(
"Queue: ciao. Successfully parsed message count of 0 in batch 1 is less than 1; aborting"
"Queue: ciao. Successfully parsed message count of 0 in batch 1 is less than 1; aborting",
);
});

Expand Down Expand Up @@ -227,7 +227,7 @@ describe("FHIRTestEventReporter", () => {
reportToUniversalPipelineSpy.mockRejectedValueOnce(errorResponseMock);

await expect(() => FHIRTestEventReporter(context)).rejects.toThrow(
JSON.stringify([{ ok: false, status: 400 }])
JSON.stringify([{ ok: false, status: 400 }]),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ appInsights.setup();
const telemetry = appInsights.defaultClient;

const FHIRTestEventReporter: AzureFunction = async function (
context: Context
context: Context,
): Promise<void> {
const tagOverrides = { "ai.operation.id": context.traceContext.traceparent };
const publishingQueue: QueueClient = getQueueClient(
FHIR_TEST_EVENT_QUEUE_NAME
FHIR_TEST_EVENT_QUEUE_NAME,
);
const publishingErrorQueue: QueueClient = getQueueClient(
FHIR_PUBLISHING_ERROR_QUEUE_NAME
FHIR_PUBLISHING_ERROR_QUEUE_NAME,
);
const exceptionQueue: QueueClient = getQueueClient(
REPORTING_EXCEPTION_QUEUE_NAME
REPORTING_EXCEPTION_QUEUE_NAME,
);

if (!(await minimumMessagesAvailable(context, publishingQueue))) {
Expand All @@ -47,7 +47,7 @@ const FHIRTestEventReporter: AzureFunction = async function (

const messages: DequeuedMessageItem[] = await dequeueMessages(
context,
publishingQueue
publishingQueue,
);

telemetry.trackEvent({
Expand All @@ -58,18 +58,18 @@ const FHIRTestEventReporter: AzureFunction = async function (

if (messages.length === 0) {
context.log(
`Queue: ${publishingQueue.name}. Messages Dequeued: ${messages.length}; aborting.`
`Queue: ${publishingQueue.name}. Messages Dequeued: ${messages.length}; aborting.`,
);
return;
}

const fhirTestEventsBatches: FHIRTestEventsBatch[] = processTestEvents(
messages,
FHIR_BATCH_SIZE_LIMIT
FHIR_BATCH_SIZE_LIMIT,
);

context.log(
`Queue: ${publishingQueue.name}. Processing ${fhirTestEventsBatches.length} batch(s);`
`Queue: ${publishingQueue.name}. Processing ${fhirTestEventsBatches.length} batch(s);`,
);

const bearerToken = await getReportStreamAuthToken(context);
Expand All @@ -94,7 +94,7 @@ const FHIRTestEventReporter: AzureFunction = async function (
publishingQueue.name
}. Successfully parsed message count of ${
testEventBatch.parseSuccessCount
} in batch ${idx + 1} is less than 1; aborting`
} in batch ${idx + 1} is less than 1; aborting`,
);

return resolve();
Expand All @@ -103,13 +103,13 @@ const FHIRTestEventReporter: AzureFunction = async function (
context.log(
`Queue: ${publishingQueue.name}. Starting upload of ${
testEventBatch.parseSuccessCount
} records in batch ${idx + 1} to ReportStream`
} records in batch ${idx + 1} to ReportStream`,
);

const postResult: Response =
await reportToUniversalPipelineTokenBased(
bearerToken,
testEventBatch.testEventsNDJSON
testEventBatch.testEventsNDJSON,
);

const uploadStart = new Date().getTime();
Expand All @@ -134,53 +134,53 @@ const FHIRTestEventReporter: AzureFunction = async function (
publishingQueue,
exceptionQueue,
publishingErrorQueue,
{ telemetry, context }
{ telemetry, context },
);
return resolve();
} catch (e) {
context.log.error(
`Queue: ${publishingQueue.name}. Publishing tasks for batch ${
idx + 1
} failed unexpectedly; ${e}`
} failed unexpectedly; ${e}`,
);

return reject(e);
}
})();
});
}
},
);

// triggers all the publishing tasks
const publishingResults = await Promise.allSettled(fhirPublishingTasks);
const fulfilledPublishing = publishingResults.filter(
(
publishingStatus: PromiseSettledResult<any> // eslint-disable-line @typescript-eslint/no-explicit-any
) => publishingStatus.status === "fulfilled"
publishingStatus: PromiseSettledResult<any>, // eslint-disable-line @typescript-eslint/no-explicit-any
) => publishingStatus.status === "fulfilled",
);
const rejectedPublishing = publishingResults.filter(
(
publishingStatus: PromiseSettledResult<any> // eslint-disable-line @typescript-eslint/no-explicit-any
) => publishingStatus.status === "rejected"
publishingStatus: PromiseSettledResult<any>, // eslint-disable-line @typescript-eslint/no-explicit-any
) => publishingStatus.status === "rejected",
);

if (fulfilledPublishing.length > 0) {
context.log(
`Queue: ${publishingQueue.name}. ${fulfilledPublishing.length} batch(es) out of ${fhirPublishingTasks.length} were published successfully;`
`Queue: ${publishingQueue.name}. ${fulfilledPublishing.length} batch(es) out of ${fhirPublishingTasks.length} were published successfully;`,
);
}

if (rejectedPublishing.length > 0) {
context.log.error(
`Queue: ${publishingQueue.name}. ${rejectedPublishing.length} batch(es) out of ${fhirPublishingTasks.length} were not published;`
`Queue: ${publishingQueue.name}. ${rejectedPublishing.length} batch(es) out of ${fhirPublishingTasks.length} were not published;`,
);

throw new Error(
`[${rejectedPublishing
.map((rejected: PromiseRejectedResult) =>
JSON.stringify(rejected.reason)
JSON.stringify(rejected.reason),
)
.join(", ")}]`
.join(", ")}]`,
);
}
};
Expand Down
Loading

0 comments on commit e8b9560

Please sign in to comment.