Skip to content

Commit bcaca52

Browse files
authored
feat: Create fetcher utility (#1062)
* Create fetcher utility Signed-off-by: Assem Hafez <[email protected]> * rename query Signed-off-by: Assem Hafez <[email protected]> * update fetcher based on feedback Signed-off-by: Assem Hafez <[email protected]> * rename unmout to destroy Signed-off-by: Assem Hafez <[email protected]> --------- Signed-off-by: Assem Hafez <[email protected]>
1 parent 4ac3547 commit bcaca52

File tree

5 files changed

+575
-0
lines changed

5 files changed

+575
-0
lines changed

src/route-handlers/get-workflow-history/get-workflow-history.types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
import { type z } from 'zod';
2+
13
import { type GetWorkflowExecutionHistoryResponse } from '@/__generated__/proto-ts/uber/cadence/api/v1/GetWorkflowExecutionHistoryResponse';
24
import { type DefaultMiddlewaresContext } from '@/utils/route-handlers-middleware';
35

6+
import type getWorkflowHistoryQueryParamsSchema from './schemas/get-workflow-history-query-params-schema';
7+
48
export type RouteParams = {
59
domain: string;
610
cluster: string;
@@ -12,6 +16,10 @@ export type RequestParams = {
1216
params: RouteParams;
1317
};
1418

19+
export type WorkflowHistoryQueryParams = z.infer<
20+
typeof getWorkflowHistoryQueryParamsSchema
21+
>;
22+
1523
export type GetWorkflowHistoryResponse = GetWorkflowExecutionHistoryResponse;
1624

1725
export type Context = DefaultMiddlewaresContext;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { type GetWorkflowHistoryResponse } from '@/route-handlers/get-workflow-history/get-workflow-history.types';
2+
3+
import {
4+
scheduleActivityTaskEvent,
5+
startActivityTaskEvent,
6+
completeActivityTaskEvent,
7+
} from './workflow-history-activity-events';
8+
import {
9+
completeDecisionTaskEvent,
10+
scheduleDecisionTaskEvent,
11+
startDecisionTaskEvent,
12+
} from './workflow-history-decision-events';
13+
14+
/**
15+
* Multi-page workflow history fixture for testing pagination
16+
* Contains 3 pages with various events
17+
*/
18+
const workflowHistoryMultiPageFixture: GetWorkflowHistoryResponse[] = [
19+
// Page 1: Activity task scheduled and started
20+
{
21+
history: { events: [scheduleActivityTaskEvent, startActivityTaskEvent] },
22+
rawHistory: [],
23+
archived: false,
24+
nextPageToken: 'page2',
25+
},
26+
// Page 2: Activity completed and decision task scheduled
27+
{
28+
history: { events: [completeActivityTaskEvent, scheduleDecisionTaskEvent] },
29+
rawHistory: [],
30+
archived: false,
31+
nextPageToken: 'page3',
32+
},
33+
// Page 3: Decision task started and completed (last page)
34+
{
35+
history: { events: [startDecisionTaskEvent, completeDecisionTaskEvent] },
36+
rawHistory: [],
37+
archived: false,
38+
nextPageToken: '',
39+
},
40+
];
41+
42+
export default workflowHistoryMultiPageFixture;

0 commit comments

Comments
 (0)