Skip to content

Commit 098bee4

Browse files
committed
remove grouping by operation id
1 parent e7d5499 commit 098bee4

File tree

3 files changed

+5
-26
lines changed

3 files changed

+5
-26
lines changed

src/handlers/StackHandler.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { OperationEvent } from '@aws-sdk/client-cloudformation';
21
import { ErrorCodes, RequestHandler, ResponseError } from 'vscode-languageserver';
32
import { ArtifactExporter } from '../artifactexporter/ArtifactExporter';
43
import { TopLevelSection } from '../context/ContextType';
@@ -464,22 +463,8 @@ export function describeEventsHandler(
464463
NextToken: params.nextToken,
465464
});
466465

467-
const operations = new Map<string, OperationEvent[]>();
468-
for (const event of response.OperationEvents ?? []) {
469-
const opId = event.OperationId ?? 'unknown';
470-
const existing = operations.get(opId);
471-
if (existing) {
472-
existing.push(event);
473-
} else {
474-
operations.set(opId, [event]);
475-
}
476-
}
477-
478466
return {
479-
operations: [...operations.entries()].map(([operationId, events]) => ({
480-
operationId,
481-
events: events.sort((a, b) => (b.Timestamp?.getTime() ?? 0) - (a.Timestamp?.getTime() ?? 0)),
482-
})),
467+
events: response.OperationEvents ?? [],
483468
nextToken: response.NextToken,
484469
};
485470
} catch (error) {

src/stacks/StackRequestType.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,8 @@ export type DescribeEventsParams = {
127127
nextToken?: string;
128128
};
129129

130-
export type StackOperationGroup = {
131-
operationId: string;
132-
events: OperationEvent[];
133-
};
134-
135130
export type DescribeEventsResult = {
136-
operations: StackOperationGroup[];
131+
events: OperationEvent[];
137132
nextToken?: string;
138133
};
139134

tst/unit/handlers/StackHandler.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ describe('StackActionHandler', () => {
927927
});
928928

929929
describe('describeEventsHandler', () => {
930-
it('should fetch and group events by operation ID', async () => {
930+
it('should return flat events from API', async () => {
931931
mockComponents.cfnService.describeEvents.resolves({
932932
OperationEvents: [
933933
{ EventId: '1', OperationId: 'op1', Timestamp: new Date('2024-01-01') },
@@ -940,9 +940,8 @@ describe('StackActionHandler', () => {
940940
const handler = describeEventsHandler(mockComponents);
941941
const result = (await handler({ stackName: 'test-stack' }, CancellationToken.None)) as DescribeEventsResult;
942942

943-
expect(result.operations).toHaveLength(2);
944-
expect(result.operations[0].operationId).toBe('op1');
945-
expect(result.operations[0].events).toHaveLength(2);
943+
expect(result.events).toHaveLength(3);
944+
expect(result.events[0].EventId).toBe('1');
946945
});
947946

948947
it('should pass all parameters to API', async () => {

0 commit comments

Comments
 (0)