@shipfox/client-workflows 5.0.0 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +53 -0
  3. package/dist/components/workflow-run-list/types.d.ts +12 -0
  4. package/dist/components/workflow-run-list/types.d.ts.map +1 -1
  5. package/dist/components/workflow-run-list/types.js.map +1 -1
  6. package/dist/components/workflow-run-list/workflow-run-list-view.d.ts +1 -1
  7. package/dist/components/workflow-run-list/workflow-run-list-view.d.ts.map +1 -1
  8. package/dist/components/workflow-run-list/workflow-run-list-view.js +32 -11
  9. package/dist/components/workflow-run-list/workflow-run-list-view.js.map +1 -1
  10. package/dist/components/workflow-run-list/workflow-run-list.d.ts +1 -1
  11. package/dist/components/workflow-run-list/workflow-run-list.d.ts.map +1 -1
  12. package/dist/components/workflow-run-list/workflow-run-list.js +7 -2
  13. package/dist/components/workflow-run-list/workflow-run-list.js.map +1 -1
  14. package/dist/components/workflow-run-summary/workflow-run-summary.d.ts +2 -3
  15. package/dist/components/workflow-run-summary/workflow-run-summary.d.ts.map +1 -1
  16. package/dist/components/workflow-run-summary/workflow-run-summary.js.map +1 -1
  17. package/dist/components/workflow-run-view/job-card.d.ts.map +1 -1
  18. package/dist/components/workflow-run-view/job-card.js +9 -8
  19. package/dist/components/workflow-run-view/job-card.js.map +1 -1
  20. package/dist/components/workflow-run-view/workflow-run-view.js.map +1 -1
  21. package/dist/core/entities/job-execution.d.ts +11 -6
  22. package/dist/core/entities/job-execution.d.ts.map +1 -1
  23. package/dist/core/entities/job-execution.js +0 -19
  24. package/dist/core/entities/job-execution.js.map +1 -1
  25. package/dist/core/entities/job.d.ts +32 -10
  26. package/dist/core/entities/job.d.ts.map +1 -1
  27. package/dist/core/entities/job.js +0 -22
  28. package/dist/core/entities/job.js.map +1 -1
  29. package/dist/core/entities/step-attempt.d.ts +28 -3
  30. package/dist/core/entities/step-attempt.d.ts.map +1 -1
  31. package/dist/core/entities/step-attempt.js +0 -17
  32. package/dist/core/entities/step-attempt.js.map +1 -1
  33. package/dist/core/entities/step.d.ts +6 -6
  34. package/dist/core/entities/step.d.ts.map +1 -1
  35. package/dist/core/entities/step.js +19 -49
  36. package/dist/core/entities/step.js.map +1 -1
  37. package/dist/core/entities/workflow-run-attempt.d.ts +0 -2
  38. package/dist/core/entities/workflow-run-attempt.d.ts.map +1 -1
  39. package/dist/core/entities/workflow-run-attempt.js +0 -12
  40. package/dist/core/entities/workflow-run-attempt.js.map +1 -1
  41. package/dist/core/entities/workflow-run.d.ts +6 -7
  42. package/dist/core/entities/workflow-run.d.ts.map +1 -1
  43. package/dist/core/entities/workflow-run.js +1 -67
  44. package/dist/core/entities/workflow-run.js.map +1 -1
  45. package/dist/core/workflow-run.d.ts +9 -9
  46. package/dist/core/workflow-run.d.ts.map +1 -1
  47. package/dist/core/workflow-run.js +6 -6
  48. package/dist/core/workflow-run.js.map +1 -1
  49. package/dist/feature.d.ts +13 -0
  50. package/dist/feature.d.ts.map +1 -1
  51. package/dist/feature.js +17 -16
  52. package/dist/feature.js.map +1 -1
  53. package/dist/hooks/api/workflow-run-mapper.d.ts +12 -0
  54. package/dist/hooks/api/workflow-run-mapper.d.ts.map +1 -0
  55. package/dist/hooks/api/workflow-run-mapper.js +207 -0
  56. package/dist/hooks/api/workflow-run-mapper.js.map +1 -0
  57. package/dist/hooks/api/workflow-runs.d.ts +25 -55
  58. package/dist/hooks/api/workflow-runs.d.ts.map +1 -1
  59. package/dist/hooks/api/workflow-runs.js +95 -51
  60. package/dist/hooks/api/workflow-runs.js.map +1 -1
  61. package/dist/index.d.ts +2 -2
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +1 -1
  64. package/dist/index.js.map +1 -1
  65. package/dist/pages/project-workflows-page.d.ts.map +1 -1
  66. package/dist/pages/project-workflows-page.js +14 -14
  67. package/dist/pages/project-workflows-page.js.map +1 -1
  68. package/dist/pages/workflow-run-page.d.ts +3 -1
  69. package/dist/pages/workflow-run-page.d.ts.map +1 -1
  70. package/dist/pages/workflow-run-page.js +21 -14
  71. package/dist/pages/workflow-run-page.js.map +1 -1
  72. package/dist/routes/inputs.d.ts +22 -0
  73. package/dist/routes/inputs.d.ts.map +1 -0
  74. package/dist/routes/inputs.js +76 -0
  75. package/dist/routes/inputs.js.map +1 -0
  76. package/dist/routes/run-detail.d.ts +2 -0
  77. package/dist/routes/run-detail.d.ts.map +1 -1
  78. package/dist/routes/run-detail.js +6 -6
  79. package/dist/routes/run-detail.js.map +1 -1
  80. package/dist/routes/runs.d.ts +2 -0
  81. package/dist/routes/runs.d.ts.map +1 -1
  82. package/dist/routes/runs.js +6 -6
  83. package/dist/routes/runs.js.map +1 -1
  84. package/dist/routes/workflows.js +3 -5
  85. package/dist/routes/workflows.js.map +1 -1
  86. package/dist/tsconfig.test.tsbuildinfo +1 -1
  87. package/package.json +13 -14
  88. package/src/components/workflow-run-list/types.ts +6 -0
  89. package/src/components/workflow-run-list/workflow-run-list-view.tsx +27 -11
  90. package/src/components/workflow-run-list/workflow-run-list.tsx +6 -0
  91. package/src/components/workflow-run-summary/workflow-run-attempt-switcher.test.tsx +5 -6
  92. package/src/components/workflow-run-summary/workflow-run-summary.tsx +3 -3
  93. package/src/components/workflow-run-view/job-card.tsx +20 -11
  94. package/src/components/workflow-run-view/workflow-run-view.test.tsx +3 -3
  95. package/src/components/workflow-run-view/workflow-run-view.tsx +2 -2
  96. package/src/core/entities/job-execution.ts +12 -28
  97. package/src/core/entities/job.ts +44 -45
  98. package/src/core/entities/step-attempt.ts +9 -20
  99. package/src/core/entities/step.ts +38 -66
  100. package/src/core/entities/workflow-run-attempt.ts +0 -14
  101. package/src/core/entities/workflow-run.ts +8 -86
  102. package/src/core/workflow-run.test.ts +13 -11
  103. package/src/core/workflow-run.ts +8 -13
  104. package/src/feature.ts +19 -17
  105. package/src/hooks/api/workflow-run-mapper.ts +246 -0
  106. package/src/hooks/api/workflow-runs.test.tsx +57 -59
  107. package/src/hooks/api/workflow-runs.ts +187 -88
  108. package/src/index.ts +4 -0
  109. package/src/pages/project-workflows-page.test.tsx +1 -1
  110. package/src/pages/project-workflows-page.tsx +31 -26
  111. package/src/pages/workflow-run-page.test.tsx +4 -2
  112. package/src/pages/workflow-run-page.tsx +22 -17
  113. package/src/routes/inputs.test.ts +22 -0
  114. package/src/routes/inputs.ts +58 -0
  115. package/src/routes/run-detail.tsx +12 -8
  116. package/src/routes/runs.tsx +11 -4
  117. package/src/routes/workflows.tsx +3 -3
  118. package/test/fixtures/workflow-run.ts +9 -7
  119. package/test/pages.tsx +20 -5
  120. package/tsconfig.build.tsbuildinfo +1 -1
  121. package/vercel.json +5 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/hooks/api/workflow-run-mapper.ts"],"sourcesContent":["import type {\n JobListeningDto,\n StepAttemptDto,\n StepGateResultDto,\n WorkflowExecutionEventDto,\n WorkflowRunAttemptDto,\n WorkflowRunDetailResponseDto,\n WorkflowRunJobDetailDto,\n WorkflowRunJobExecutionDetailDto,\n WorkflowRunListResponseDto,\n WorkflowRunResponseDto,\n WorkflowRunStepDetailDto,\n} from '@shipfox/api-workflows-dto';\nimport {\n Job,\n JobExecution,\n type JobListening,\n type Step,\n StepAttempt,\n type StepGateResult,\n type WorkflowExecutionEvent,\n type WorkflowRun,\n WorkflowRunAttempt,\n WorkflowRunAttemptSummary,\n type WorkflowRunDetail,\n type WorkflowRunListItem,\n type WorkflowRunListPage,\n workflowRunShortId,\n workflowRunTriggerDisplayLabel,\n workflowRunTriggerLabel,\n} from '#core/workflow-run.js';\n\nexport function toWorkflowRun(dto: WorkflowRunResponseDto): WorkflowRun {\n return {\n id: dto.id,\n projectId: dto.project_id,\n definitionId: dto.definition_id,\n name: dto.name,\n currentAttempt: dto.current_attempt,\n triggerProvider: dto.trigger_provider,\n triggerSource: dto.trigger_source,\n triggerEvent: dto.trigger_event,\n triggerDisplayLabel: workflowRunTriggerDisplayLabel({\n triggerSource: dto.trigger_source,\n triggerEvent: dto.trigger_event,\n }),\n triggerLabel: workflowRunTriggerLabel({\n triggerSource: dto.trigger_source,\n triggerEvent: dto.trigger_event,\n }),\n triggerPayload: dto.trigger_payload,\n inputs: dto.inputs ?? null,\n sourceSnapshot: dto.source_snapshot\n ? {content: dto.source_snapshot.content, format: dto.source_snapshot.format}\n : null,\n createdAt: dto.created_at,\n updatedAt: dto.updated_at,\n shortId: workflowRunShortId(dto.id),\n isTemporary: dto.id.startsWith('temp-'),\n };\n}\n\nexport function toWorkflowRunAttempt(dto: WorkflowRunAttemptDto): WorkflowRunAttempt {\n return new WorkflowRunAttempt({\n id: dto.id,\n workflowRunId: dto.workflow_run_id,\n attempt: dto.attempt,\n status: dto.status,\n createdAt: dto.created_at,\n startedAt: dto.started_at ?? null,\n finishedAt: dto.finished_at ?? null,\n rerunMode: dto.rerun_mode,\n });\n}\n\nexport function toWorkflowRunListItem(dto: WorkflowRunResponseDto): WorkflowRunListItem {\n return {\n ...toWorkflowRun(dto),\n status: dto.status,\n latestAttempt: dto.latest_attempt,\n runAttempt: new WorkflowRunAttemptSummary({\n workflowRunId: dto.id,\n attempt: dto.current_attempt,\n status: dto.status,\n createdAt: dto.created_at,\n startedAt: dto.started_at ?? null,\n finishedAt: dto.finished_at ?? null,\n }),\n };\n}\n\nexport function toWorkflowRunListPage(dto: WorkflowRunListResponseDto): WorkflowRunListPage {\n return {\n runs: dto.runs.map(toWorkflowRunListItem),\n nextCursor: dto.next_cursor,\n filteredTotalCount: dto.filtered_total_count,\n };\n}\n\nexport function toWorkflowRunDetail(dto: WorkflowRunDetailResponseDto): WorkflowRunDetail {\n return {\n ...toWorkflowRun(dto),\n latestAttempt: dto.latest_attempt,\n runAttempt: toWorkflowRunAttempt(dto.run_attempt),\n jobs: dto.jobs.map(toJob),\n };\n}\n\nexport function toJob(dto: WorkflowRunJobDetailDto): Job {\n return new Job({\n id: dto.id,\n runAttemptId: dto.run_attempt_id,\n key: dto.key,\n name: dto.name,\n mode: dto.mode,\n status: dto.status,\n statusReason: dto.status_reason,\n carriedOver: dto.carried_over,\n listening: dto.listening ? toJobListening(dto.listening) : null,\n listenerStatus: dto.listener_status,\n resolutionReason: dto.resolution_reason,\n dependencies: dto.dependencies,\n position: dto.position,\n createdAt: dto.created_at,\n updatedAt: dto.updated_at,\n jobExecutions: dto.job_executions.map(toJobExecution),\n });\n}\n\nexport function toJobExecution(dto: WorkflowRunJobExecutionDetailDto): JobExecution {\n return new JobExecution({\n id: dto.id,\n jobId: dto.job_id,\n sequence: dto.sequence,\n name: dto.name,\n status: dto.status,\n statusReason: dto.status_reason,\n triggerEvents: (dto.trigger_events ?? []).map(toWorkflowExecutionEvent),\n queuedAt: dto.queued_at ?? null,\n startedAt: dto.started_at ?? null,\n finishedAt: dto.finished_at ?? null,\n timedOutAt: dto.timed_out_at ?? null,\n createdAt: dto.created_at,\n updatedAt: dto.updated_at,\n steps: dto.steps.map(toStep),\n });\n}\n\nexport function toStep(dto: WorkflowRunStepDetailDto): Step {\n return {\n id: dto.id,\n jobExecutionId: dto.job_execution_id,\n key: dto.key,\n name: dto.name,\n sourceLocation: dto.source_location\n ? {startLine: dto.source_location.start_line, endLine: dto.source_location.end_line}\n : null,\n status: dto.status,\n type: dto.type,\n config: dto.config,\n agentConfig: toAgentStepConfig(dto),\n error: dto.error\n ? {\n message: dto.error.message,\n exitCode: dto.error.exit_code ?? null,\n signal: dto.error.signal,\n reason: dto.error.reason,\n agentConfigIssue: dto.error.agent_config_issue,\n category: dto.error.category,\n }\n : null,\n position: dto.position,\n currentAttempt: dto.current_attempt,\n createdAt: dto.created_at,\n updatedAt: dto.updated_at,\n attempts: dto.attempts.map((attempt) => toStepAttempt(attempt, dto.job_execution_id)),\n };\n}\n\nexport function toStepAttempt(dto: StepAttemptDto, jobExecutionId: string): StepAttempt {\n return new StepAttempt({\n id: dto.id,\n stepId: dto.step_id,\n jobExecutionId,\n attempt: dto.attempt,\n executionOrder: dto.execution_order,\n status: dto.status,\n exitCode: dto.exit_code ?? null,\n output: dto.output ?? null,\n error: dto.error ?? null,\n gateResult: toStepGateResult(dto.gate_result),\n restartFeedback: dto.restart_feedback ?? null,\n startedAt: dto.started_at,\n finishedAt: dto.finished_at ?? null,\n });\n}\n\nfunction toJobListening(dto: JobListeningDto): JobListening {\n return {\n on: dto.on,\n until: dto.until,\n timeoutMs: dto.timeout_ms,\n maxExecutions: dto.max_executions,\n batch: dto.batch\n ? {\n debounceMs: dto.batch.debounce_ms,\n maxSize: dto.batch.max_size,\n maxWaitMs: dto.batch.max_wait_ms,\n }\n : null,\n onResolve: dto.on_resolve,\n executionTimeoutMs: dto.execution_timeout_ms,\n name: dto.name,\n };\n}\n\nfunction toWorkflowExecutionEvent(dto: WorkflowExecutionEventDto): WorkflowExecutionEvent {\n return {\n source: dto.source,\n event: dto.event,\n deliveryId: dto.delivery_id,\n receivedAt: dto.received_at,\n data: dto.data,\n };\n}\n\nfunction toStepGateResult(dto: StepGateResultDto): StepGateResult {\n if (dto === null || dto.kind === 'none' || dto.kind === 'not_evaluated') return dto;\n if (dto.kind === 'passed' || dto.kind === 'failed') return {...dto, exitCode: dto.exit_code};\n if (dto.kind === 'uncheckable' || dto.kind === 'evaluation_error')\n return {...dto, exitCode: dto.exit_code};\n return dto;\n}\n\nfunction toAgentStepConfig(dto: WorkflowRunStepDetailDto): Step['agentConfig'] {\n if (dto.type !== 'agent') return null;\n return {\n provider: stringConfigValue(dto.config.provider),\n model: stringConfigValue(dto.config.model),\n thinking: stringConfigValue(dto.config.thinking),\n };\n}\n\nfunction stringConfigValue(value: unknown): string | null {\n return typeof value === 'string' && value.trim() ? value.trim() : null;\n}\n"],"names":["Job","JobExecution","StepAttempt","WorkflowRunAttempt","WorkflowRunAttemptSummary","workflowRunShortId","workflowRunTriggerDisplayLabel","workflowRunTriggerLabel","toWorkflowRun","dto","id","projectId","project_id","definitionId","definition_id","name","currentAttempt","current_attempt","triggerProvider","trigger_provider","triggerSource","trigger_source","triggerEvent","trigger_event","triggerDisplayLabel","triggerLabel","triggerPayload","trigger_payload","inputs","sourceSnapshot","source_snapshot","content","format","createdAt","created_at","updatedAt","updated_at","shortId","isTemporary","startsWith","toWorkflowRunAttempt","workflowRunId","workflow_run_id","attempt","status","startedAt","started_at","finishedAt","finished_at","rerunMode","rerun_mode","toWorkflowRunListItem","latestAttempt","latest_attempt","runAttempt","toWorkflowRunListPage","runs","map","nextCursor","next_cursor","filteredTotalCount","filtered_total_count","toWorkflowRunDetail","run_attempt","jobs","toJob","runAttemptId","run_attempt_id","key","mode","statusReason","status_reason","carriedOver","carried_over","listening","toJobListening","listenerStatus","listener_status","resolutionReason","resolution_reason","dependencies","position","jobExecutions","job_executions","toJobExecution","jobId","job_id","sequence","triggerEvents","trigger_events","toWorkflowExecutionEvent","queuedAt","queued_at","timedOutAt","timed_out_at","steps","toStep","jobExecutionId","job_execution_id","sourceLocation","source_location","startLine","start_line","endLine","end_line","type","config","agentConfig","toAgentStepConfig","error","message","exitCode","exit_code","signal","reason","agentConfigIssue","agent_config_issue","category","attempts","toStepAttempt","stepId","step_id","executionOrder","execution_order","output","gateResult","toStepGateResult","gate_result","restartFeedback","restart_feedback","on","until","timeoutMs","timeout_ms","maxExecutions","max_executions","batch","debounceMs","debounce_ms","maxSize","max_size","maxWaitMs","max_wait_ms","onResolve","on_resolve","executionTimeoutMs","execution_timeout_ms","source","event","deliveryId","delivery_id","receivedAt","received_at","data","kind","provider","stringConfigValue","model","thinking","value","trim"],"mappings":"AAaA,SACEA,GAAG,EACHC,YAAY,EAGZC,WAAW,EAIXC,kBAAkB,EAClBC,yBAAyB,EAIzBC,kBAAkB,EAClBC,8BAA8B,EAC9BC,uBAAuB,QAClB,wBAAwB;AAE/B,OAAO,SAASC,cAAcC,GAA2B;IACvD,OAAO;QACLC,IAAID,IAAIC,EAAE;QACVC,WAAWF,IAAIG,UAAU;QACzBC,cAAcJ,IAAIK,aAAa;QAC/BC,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AAQ1I,IAAI0I,MAAM;QAClBC,OAAO3I,IAAI2I,KAAK;QAChBC,YAAY5I,IAAI6I,WAAW;QAC3BC,YAAY9I,IAAI+I,WAAW;QAC3BC,MAAMhJ,IAAIgJ,IAAI;IAChB;AACF;AAEA,SAAS3B,iBAAiBrH,GAAsB;IAC9C,IAAIA,QAAQ,QAAQA,IAAIiJ,IAAI,KAAK,UAAUjJ,IAAIiJ,IAAI,KAAK,iBAAiB,OAAOjJ;IAChF,IAAIA,IAAIiJ,IAAI,KAAK,YAAYjJ,IAAIiJ,IAAI,KAAK,UAAU,OAAO;QAAC,GAAGjJ,GAAG;QAAEsG,UAAUtG,IAAIuG,SAAS;IAAA;IAC3F,IAAIvG,IAAIiJ,IAAI,KAAK,iBAAiBjJ,IAAIiJ,IAAI,KAAK,oBAC7C,OAAO;QAAC,GAAGjJ,GAAG;QAAEsG,UAAUtG,IAAIuG,SAAS;IAAA;IACzC,OAAOvG;AACT;AAEA,SAASmG,kBAAkBnG,GAA6B;IACtD,IAAIA,IAAIgG,IAAI,KAAK,SAAS,OAAO;IACjC,OAAO;QACLkD,UAAUC,kBAAkBnJ,IAAIiG,MAAM,CAACiD,QAAQ;QAC/CE,OAAOD,kBAAkBnJ,IAAIiG,MAAM,CAACmD,KAAK;QACzCC,UAAUF,kBAAkBnJ,IAAIiG,MAAM,CAACoD,QAAQ;IACjD;AACF;AAEA,SAASF,kBAAkBG,KAAc;IACvC,OAAO,OAAOA,UAAU,YAAYA,MAAMC,IAAI,KAAKD,MAAMC,IAAI,KAAK;AACpE"}
@@ -1,6 +1,6 @@
1
- import type { WorkflowRunRerunModeDto } from '@shipfox/api-workflows-dto';
2
- import { type InfiniteData } from '@tanstack/react-query';
3
- import { type WorkflowRun, type WorkflowRunAttempt, type WorkflowRunDetail, type WorkflowRunListPage, type WorkflowRunStatus } from '#core/workflow-run.js';
1
+ import { type WorkflowRunRerunModeDto } from '@shipfox/api-workflows-dto';
2
+ import { type InfiniteData, type UseInfiniteQueryOptions, type UseQueryOptions } from '@tanstack/react-query';
3
+ import { type ManualWorkflowLaunch, type WorkflowRun, type WorkflowRunAttempt, type WorkflowRunDetail, type WorkflowRunListItem, type WorkflowRunListPage, type WorkflowRunStatus } from '#core/workflow-run.js';
4
4
  export interface WorkflowRunFilters {
5
5
  status?: WorkflowRunStatus | undefined;
6
6
  definitionId?: string | undefined;
@@ -12,7 +12,7 @@ export declare const workflowRunsQueryKeys: {
12
12
  all: readonly ["workflow-runs"];
13
13
  lists: (projectId: string) => readonly ["workflow-runs", "list", string];
14
14
  list: (projectId: string, filters: WorkflowRunFilters) => readonly ["workflow-runs", "list", string, {
15
- status: "cancelled" | "pending" | "running" | "succeeded" | "failed" | null;
15
+ status: WorkflowRunStatus | null;
16
16
  definitionId: string | null;
17
17
  triggerSource: string | null;
18
18
  createdFrom: string | null;
@@ -21,6 +21,12 @@ export declare const workflowRunsQueryKeys: {
21
21
  detail: (workflowRunId: string, runAttempt?: number | undefined) => readonly ["workflow-runs", "detail", string, number | null];
22
22
  attempts: (workflowRunId: string) => readonly ["workflow-runs", "attempts", string];
23
23
  };
24
+ type WorkflowRunsListQueryKey = ReturnType<typeof workflowRunsQueryKeys.list> | readonly ['workflow-runs', 'list'];
25
+ type WorkflowRunDetailQueryKey = ReturnType<typeof workflowRunsQueryKeys.detail> | readonly ['workflow-runs', 'detail'];
26
+ type WorkflowRunAttemptsQueryKey = ReturnType<typeof workflowRunsQueryKeys.attempts> | readonly ['workflow-runs', 'attempts'];
27
+ type WorkflowRunsInfiniteQueryOptions = UseInfiniteQueryOptions<WorkflowRunListPage, Error, InfiniteData<WorkflowRunListPage, string | undefined>, WorkflowRunsListQueryKey, string | undefined>;
28
+ type WorkflowRunDetailQueryOptions = UseQueryOptions<WorkflowRunDetail, Error, WorkflowRunDetail, WorkflowRunDetailQueryKey>;
29
+ type WorkflowRunAttemptsQueryOptions = UseQueryOptions<WorkflowRunAttempt[], Error, WorkflowRunAttempt[], WorkflowRunAttemptsQueryKey>;
24
30
  /**
25
31
  * Fire the manual trigger of a workflow definition.
26
32
  *
@@ -31,57 +37,14 @@ export declare const workflowRunsQueryKeys: {
31
37
  export declare function fireManualWorkflow({ definitionId, inputs, }: {
32
38
  definitionId: string;
33
39
  inputs?: Record<string, unknown>;
34
- }): Promise<{
35
- workflow_run_id: string;
36
- }>;
40
+ }): Promise<ManualWorkflowLaunch>;
37
41
  export declare function useWorkflowRunsInfiniteQuery(projectId: string | undefined, filters: WorkflowRunFilters, limit?: number): import("@tanstack/react-query").UseInfiniteQueryResult<InfiniteData<WorkflowRunListPage, string | undefined>, Error>;
42
+ export declare function workflowRunsInfiniteQueryOptions(projectId: string | undefined, filters: WorkflowRunFilters, limit?: number): WorkflowRunsInfiniteQueryOptions;
38
43
  export declare function rerunWorkflowRun({ workflowRunId, mode, }: {
39
44
  workflowRunId: string;
40
45
  mode: WorkflowRunRerunModeDto;
41
- }): Promise<{
42
- id: string;
43
- project_id: string;
44
- definition_id: string;
45
- name: string;
46
- status: "cancelled" | "pending" | "running" | "succeeded" | "failed";
47
- current_attempt: number;
48
- latest_attempt: number;
49
- trigger_provider: string | null;
50
- trigger_source: string;
51
- trigger_event: string;
52
- trigger_payload: Record<string, unknown>;
53
- inputs: Record<string, unknown> | null;
54
- source_snapshot: {
55
- content: string;
56
- format: "yaml";
57
- } | null;
58
- created_at: string;
59
- updated_at: string;
60
- started_at: string | null;
61
- finished_at: string | null;
62
- }>;
63
- export declare function useRerunWorkflowRunMutation(projectId: string): import("@tanstack/react-query").UseMutationResult<{
64
- id: string;
65
- project_id: string;
66
- definition_id: string;
67
- name: string;
68
- status: "cancelled" | "pending" | "running" | "succeeded" | "failed";
69
- current_attempt: number;
70
- latest_attempt: number;
71
- trigger_provider: string | null;
72
- trigger_source: string;
73
- trigger_event: string;
74
- trigger_payload: Record<string, unknown>;
75
- inputs: Record<string, unknown> | null;
76
- source_snapshot: {
77
- content: string;
78
- format: "yaml";
79
- } | null;
80
- created_at: string;
81
- updated_at: string;
82
- started_at: string | null;
83
- finished_at: string | null;
84
- }, Error, {
46
+ }): Promise<WorkflowRunListItem>;
47
+ export declare function useRerunWorkflowRunMutation(projectId: string): import("@tanstack/react-query").UseMutationResult<WorkflowRunListItem, Error, {
85
48
  workflowRunId: string;
86
49
  mode: WorkflowRunRerunModeDto;
87
50
  }, unknown>;
@@ -90,9 +53,7 @@ export interface FireManualWorkflowVariables {
90
53
  definitionId: string;
91
54
  inputs?: Record<string, unknown>;
92
55
  }
93
- export declare function useFireManualWorkflowMutation(): import("@tanstack/react-query").UseMutationResult<{
94
- workflow_run_id: string;
95
- }, Error, FireManualWorkflowVariables, {
56
+ export declare function useFireManualWorkflowMutation(): import("@tanstack/react-query").UseMutationResult<ManualWorkflowLaunch, Error, FireManualWorkflowVariables, {
96
57
  tempWorkflowRunId: string;
97
58
  touchedQueryKeys: (readonly unknown[])[];
98
59
  }>;
@@ -101,9 +62,18 @@ export declare function useWorkflowRunAttemptQuery({ workflowRunId, runAttempt,
101
62
  workflowRunId: string | undefined;
102
63
  runAttempt?: number | undefined;
103
64
  }): import("@tanstack/react-query").UseQueryResult<NoInfer<WorkflowRunDetail>, Error>;
65
+ export declare function workflowRunQueryOptions({ workflowRunId, runAttempt, }: {
66
+ workflowRunId: string | undefined;
67
+ runAttempt?: number | undefined;
68
+ }): WorkflowRunDetailQueryOptions;
104
69
  export declare function useWorkflowRunAttemptsQuery({ workflowRunId, enabled, }: {
105
70
  workflowRunId: string | undefined;
106
71
  enabled: boolean;
107
72
  }): import("@tanstack/react-query").UseQueryResult<NoInfer<WorkflowRunAttempt[]>, Error>;
108
- export declare function useCancelWorkflowRunMutation(run: WorkflowRun | undefined): import("@tanstack/react-query").UseMutationResult<import("#core/workflow-run.js").WorkflowRunListItem, Error, void, unknown>;
73
+ export declare function workflowRunAttemptsQueryOptions({ workflowRunId, enabled, }: {
74
+ workflowRunId: string | undefined;
75
+ enabled: boolean;
76
+ }): WorkflowRunAttemptsQueryOptions;
77
+ export declare function useCancelWorkflowRunMutation(run: WorkflowRun | undefined): import("@tanstack/react-query").UseMutationResult<WorkflowRunListItem, Error, void, unknown>;
78
+ export {};
109
79
  //# sourceMappingURL=workflow-runs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-runs.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/workflow-runs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAMV,uBAAuB,EAExB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,KAAK,YAAY,EAMlB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED,eAAO,MAAM,qBAAqB;;uBAEb,MAAM;sBACP,MAAM,WAAW,kBAAkB;;;;;;;4BAE7B,MAAM,eAAe,MAAM,GAAG,SAAS;8BAErC,MAAM;CAEjC,CAAC;AAyCF;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,YAAY,EACZ,MAAM,GACP,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;qBAC2C,MAAM;GAOjD;AAgBD,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,OAAO,EAAE,kBAAkB,EAC3B,KAAK,SAAK,wHAoCX;AA2CD,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b,UAAU,GACX,EAAE;IACD,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC,GAAG,6BAA6B,CAmBhC;AAED,wBAAgB,2BAA2B,CAAC,EAC1C,aAAa,EACb,OAAO,GACR,EAAE;IACD,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,OAAO,EAAE,OAAO,CAAC;CAClB,wFAEA;AAED,wBAAgB,+BAA+B,CAAC,EAC9C,aAAa,EACb,OAAO,GACR,EAAE;IACD,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG,+BAA+B,CAWlC;AAED,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,WAAW,GAAG,SAAS,gGAgBxE"}
@@ -1,6 +1,8 @@
1
- import { apiRequest } from '@shipfox/client-api';
2
- import { keepPreviousData, useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
3
- import { isWorkflowRunTerminal, toWorkflowRunAttempt, toWorkflowRunDetail, toWorkflowRunListItem, toWorkflowRunListPage } from '#core/workflow-run.js';
1
+ import { workflowRunAttemptsResponseSchema, workflowRunDetailResponseSchema, workflowRunDtoSchema, workflowRunListResponseSchema, workflowRunResponseSchema } from '@shipfox/api-workflows-dto';
2
+ import { checkedApiRequest } from '@shipfox/client-api';
3
+ import { infiniteQueryOptions, keepPreviousData, queryOptions, useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
4
+ import { isWorkflowRunTerminal, WorkflowRunAttemptSummary } from '#core/workflow-run.js';
5
+ import { toWorkflowRunAttempt, toWorkflowRunDetail, toWorkflowRunListItem, toWorkflowRunListPage } from './workflow-run-mapper.js';
4
6
  export const workflowRunsQueryKeys = {
5
7
  all: [
6
8
  'workflow-runs'
@@ -42,16 +44,17 @@ function appendFilters(params, filters) {
42
44
  if (filters.createdFrom) params.set('created_from', filters.createdFrom);
43
45
  if (filters.createdTo) params.set('created_to', filters.createdTo);
44
46
  }
45
- async function listWorkflowRunsDto({ projectId, filters, limit = 50, cursor, signal }) {
47
+ async function listWorkflowRuns({ projectId, filters, limit = 50, cursor, signal }) {
46
48
  const params = new URLSearchParams({
47
49
  project_id: projectId,
48
50
  limit: String(limit)
49
51
  });
50
52
  if (cursor) params.set('cursor', cursor);
51
53
  appendFilters(params, filters);
52
- return await apiRequest(`/workflows/runs?${params.toString()}`, {
54
+ const response = await checkedApiRequest(workflowRunListResponseSchema, `/workflows/runs?${params.toString()}`, {
53
55
  signal
54
56
  });
57
+ return toWorkflowRunListPage(response);
55
58
  }
56
59
  /**
57
60
  * Fire the manual trigger of a workflow definition.
@@ -60,22 +63,22 @@ async function listWorkflowRunsDto({ projectId, filters, limit = 50, cursor, sig
60
63
  * may declare at most one manual trigger). `inputs` are forwarded to the
61
64
  * run when provided.
62
65
  */ export async function fireManualWorkflow({ definitionId, inputs }) {
63
- return await apiRequest(`/workflow-definitions/${definitionId}/fire-manual`, {
66
+ const response = await checkedApiRequest(manualWorkflowResponseSchema, `/workflow-definitions/${definitionId}/fire-manual`, {
64
67
  method: 'POST',
65
68
  body: inputs ? {
66
69
  inputs
67
70
  } : {}
68
71
  });
69
- }
70
- const ACTIVE_POLL_MS = 4_000;
71
- const IDLE_POLL_MS = 30_000;
72
- function toWorkflowRunInfiniteData(data) {
73
72
  return {
74
- ...data,
75
- pages: data.pages.map(toWorkflowRunListPage)
73
+ workflowRunId: response.workflow_run_id
76
74
  };
77
75
  }
76
+ const ACTIVE_POLL_MS = 4_000;
77
+ const IDLE_POLL_MS = 30_000;
78
78
  export function useWorkflowRunsInfiniteQuery(projectId, filters, limit = 50) {
79
+ return useInfiniteQuery(workflowRunsInfiniteQueryOptions(projectId, filters, limit));
80
+ }
81
+ export function workflowRunsInfiniteQueryOptions(projectId, filters, limit = 50) {
79
82
  // Polling is owned by react-query, not the page. Polling fast (4s) while
80
83
  // any non-terminal run is visible covers state transitions; polling slow
81
84
  // (30s) when idle covers brand-new external runs (webhook/schedule
@@ -87,22 +90,21 @@ export function useWorkflowRunsInfiniteQuery(projectId, filters, limit = 50) {
87
90
  // of rows can drop into a between-pages gap. Users who scrolled into
88
91
  // history opted into "reading mode": pause until they refocus, filter,
89
92
  // or scroll back.
90
- return useInfiniteQuery({
93
+ return infiniteQueryOptions({
91
94
  queryKey: projectId ? workflowRunsQueryKeys.list(projectId, filters) : [
92
95
  ...workflowRunsQueryKeys.all,
93
96
  'list'
94
97
  ],
95
98
  enabled: Boolean(projectId),
96
99
  initialPageParam: undefined,
97
- queryFn: ({ pageParam, signal })=>listWorkflowRunsDto({
100
+ queryFn: ({ pageParam, signal })=>listWorkflowRuns({
98
101
  projectId: projectId ?? '',
99
102
  filters,
100
103
  limit,
101
104
  cursor: pageParam,
102
105
  signal
103
106
  }),
104
- getNextPageParam: (lastPage)=>lastPage.next_cursor ?? undefined,
105
- select: toWorkflowRunInfiniteData,
107
+ getNextPageParam: (lastPage)=>lastPage.nextCursor ?? undefined,
106
108
  placeholderData: keepPreviousData,
107
109
  staleTime: 2_000,
108
110
  refetchOnWindowFocus: true,
@@ -115,32 +117,53 @@ export function useWorkflowRunsInfiniteQuery(projectId, filters, limit = 50) {
115
117
  refetchIntervalInBackground: false
116
118
  });
117
119
  }
118
- async function getWorkflowRunDto({ workflowRunId, runAttempt, signal }) {
120
+ async function getWorkflowRun({ workflowRunId, runAttempt, signal }) {
119
121
  const params = new URLSearchParams();
120
122
  if (runAttempt) params.set('attempt', String(runAttempt));
121
123
  const query = params.size > 0 ? `?${params.toString()}` : '';
122
- return await apiRequest(`/workflows/runs/${workflowRunId}${query}`, {
124
+ return toWorkflowRunDetail(await checkedApiRequest(workflowRunDetailResponseSchema, `/workflows/runs/${workflowRunId}${query}`, {
123
125
  signal
124
- });
126
+ }));
125
127
  }
126
- async function getWorkflowRunAttemptsDto({ workflowRunId, signal }) {
127
- return await apiRequest(`/workflows/runs/${workflowRunId}/attempts`, {
128
+ async function getWorkflowRunAttempts({ workflowRunId, signal }) {
129
+ const response = await checkedApiRequest(workflowRunAttemptsResponseSchema, `/workflows/runs/${workflowRunId}/attempts`, {
128
130
  signal
129
131
  });
132
+ return response.attempts.map(toWorkflowRunAttempt);
130
133
  }
131
- async function cancelWorkflowRunDto({ workflowRunId }) {
132
- return await apiRequest(`/workflows/runs/${workflowRunId}/cancel`, {
134
+ async function cancelWorkflowRun({ workflowRunId }) {
135
+ return toWorkflowRunListItem(await checkedApiRequest(workflowRunDtoSchema, `/workflows/runs/${workflowRunId}/cancel`, {
133
136
  method: 'POST'
134
- });
137
+ }));
135
138
  }
136
139
  export async function rerunWorkflowRun({ workflowRunId, mode }) {
137
- return await apiRequest(`/workflows/runs/${workflowRunId}/rerun`, {
140
+ return toWorkflowRunListItem(await checkedApiRequest(workflowRunResponseSchema, `/workflows/runs/${workflowRunId}/rerun`, {
138
141
  method: 'POST',
139
142
  body: {
140
143
  mode
141
144
  }
142
- });
145
+ }));
143
146
  }
147
+ const manualWorkflowResponseSchema = {
148
+ '~standard': {
149
+ version: 1,
150
+ vendor: 'client-workflows',
151
+ validate: (value)=>{
152
+ if (typeof value === 'object' && value !== null && 'workflow_run_id' in value && typeof value.workflow_run_id === 'string') return {
153
+ value: {
154
+ workflow_run_id: value.workflow_run_id
155
+ }
156
+ };
157
+ return {
158
+ issues: [
159
+ {
160
+ message: 'Expected workflow_run_id.'
161
+ }
162
+ ]
163
+ };
164
+ }
165
+ }
166
+ };
144
167
  export function useRerunWorkflowRunMutation(projectId) {
145
168
  const queryClient = useQueryClient();
146
169
  return useMutation({
@@ -169,27 +192,38 @@ function filtersAcceptManualPendingRun(filters, definitionId, now) {
169
192
  return true;
170
193
  }
171
194
  function buildTempRun({ projectId, definitionId, name, createdAt }) {
195
+ const id = `temp-${cryptoRandomId()}`;
172
196
  return {
173
- id: `temp-${cryptoRandomId()}`,
174
- project_id: projectId,
175
- definition_id: definitionId,
197
+ id,
198
+ projectId,
199
+ definitionId,
176
200
  name,
177
201
  status: 'pending',
178
- current_attempt: 1,
179
- latest_attempt: 1,
180
- trigger_provider: null,
181
- trigger_source: 'manual',
182
- trigger_event: 'fire',
183
- trigger_payload: {
202
+ currentAttempt: 1,
203
+ latestAttempt: 1,
204
+ triggerProvider: null,
205
+ triggerSource: 'manual',
206
+ triggerEvent: 'fire',
207
+ triggerPayload: {
184
208
  source: 'manual',
185
209
  event: 'fire'
186
210
  },
211
+ triggerDisplayLabel: 'fire',
212
+ triggerLabel: 'manual · fire',
187
213
  inputs: null,
188
- source_snapshot: null,
189
- created_at: createdAt,
190
- updated_at: createdAt,
191
- started_at: null,
192
- finished_at: null
214
+ sourceSnapshot: null,
215
+ createdAt,
216
+ updatedAt: createdAt,
217
+ shortId: id.slice(0, 8),
218
+ isTemporary: true,
219
+ runAttempt: new WorkflowRunAttemptSummary({
220
+ workflowRunId: id,
221
+ attempt: 1,
222
+ status: 'pending',
223
+ createdAt,
224
+ startedAt: null,
225
+ finishedAt: null
226
+ })
193
227
  };
194
228
  }
195
229
  function cryptoRandomId() {
@@ -237,7 +271,7 @@ export function useFireManualWorkflowMutation() {
237
271
  tempRun,
238
272
  ...firstPage.runs
239
273
  ],
240
- filtered_total_count: firstPage.filtered_total_count != null ? firstPage.filtered_total_count + 1 : null
274
+ filteredTotalCount: firstPage.filteredTotalCount != null ? firstPage.filteredTotalCount + 1 : null
241
275
  };
242
276
  return {
243
277
  ...current,
@@ -269,7 +303,7 @@ export function useFireManualWorkflowMutation() {
269
303
  return {
270
304
  ...page,
271
305
  runs,
272
- filtered_total_count: page.filtered_total_count != null ? Math.max(0, page.filtered_total_count - removedCount) : null
306
+ filteredTotalCount: page.filteredTotalCount != null ? Math.max(0, page.filteredTotalCount - removedCount) : null
273
307
  };
274
308
  });
275
309
  if (removedCount === 0) return current;
@@ -324,24 +358,29 @@ export function useWorkflowRunQuery(workflowRunId) {
324
358
  });
325
359
  }
326
360
  export function useWorkflowRunAttemptQuery({ workflowRunId, runAttempt }) {
361
+ return useQuery(workflowRunQueryOptions({
362
+ workflowRunId,
363
+ runAttempt
364
+ }));
365
+ }
366
+ export function workflowRunQueryOptions({ workflowRunId, runAttempt }) {
327
367
  // Poll a non-terminal run so the open run detail stays live (same cadence as the run
328
368
  // list); stop once the run is terminal.
329
- return useQuery({
369
+ return queryOptions({
330
370
  queryKey: workflowRunId ? workflowRunsQueryKeys.detail(workflowRunId, runAttempt) : [
331
371
  ...workflowRunsQueryKeys.all,
332
372
  'detail'
333
373
  ],
334
374
  enabled: Boolean(workflowRunId),
335
- queryFn: ({ signal })=>getWorkflowRunDto({
375
+ queryFn: ({ signal })=>getWorkflowRun({
336
376
  workflowRunId: workflowRunId ?? '',
337
377
  runAttempt,
338
378
  signal
339
379
  }),
340
- select: toWorkflowRunDetail,
341
380
  staleTime: 2_000,
342
381
  refetchOnWindowFocus: true,
343
382
  refetchInterval: (query)=>{
344
- const status = query.state.data?.run_attempt.status;
383
+ const status = query.state.data?.runAttempt.status;
345
384
  if (!status) return false;
346
385
  return isWorkflowRunTerminal(status) ? false : ACTIVE_POLL_MS;
347
386
  },
@@ -349,17 +388,22 @@ export function useWorkflowRunAttemptQuery({ workflowRunId, runAttempt }) {
349
388
  });
350
389
  }
351
390
  export function useWorkflowRunAttemptsQuery({ workflowRunId, enabled }) {
352
- return useQuery({
391
+ return useQuery(workflowRunAttemptsQueryOptions({
392
+ workflowRunId,
393
+ enabled
394
+ }));
395
+ }
396
+ export function workflowRunAttemptsQueryOptions({ workflowRunId, enabled }) {
397
+ return queryOptions({
353
398
  queryKey: workflowRunId ? workflowRunsQueryKeys.attempts(workflowRunId) : [
354
399
  ...workflowRunsQueryKeys.all,
355
400
  'attempts'
356
401
  ],
357
402
  enabled: Boolean(workflowRunId) && enabled,
358
- queryFn: ({ signal })=>getWorkflowRunAttemptsDto({
403
+ queryFn: ({ signal })=>getWorkflowRunAttempts({
359
404
  workflowRunId: workflowRunId ?? '',
360
405
  signal
361
406
  }),
362
- select: (dto)=>dto.attempts.map(toWorkflowRunAttempt),
363
407
  staleTime: 0,
364
408
  refetchOnMount: true,
365
409
  refetchOnWindowFocus: false
@@ -370,9 +414,9 @@ export function useCancelWorkflowRunMutation(run) {
370
414
  return useMutation({
371
415
  mutationFn: async ()=>{
372
416
  if (!run) throw new Error('Workflow run is not loaded');
373
- return toWorkflowRunListItem(await cancelWorkflowRunDto({
417
+ return await cancelWorkflowRun({
374
418
  workflowRunId: run.id
375
- }));
419
+ });
376
420
  },
377
421
  onSuccess: async ()=>{
378
422
  if (!run) return;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hooks/api/workflow-runs.ts"],"sourcesContent":["import type {\n RerunWorkflowRunBodyDto,\n WorkflowRunAttemptsResponseDto,\n WorkflowRunDetailResponseDto,\n WorkflowRunDto,\n WorkflowRunListResponseDto,\n WorkflowRunRerunModeDto,\n WorkflowRunResponseDto,\n} from '@shipfox/api-workflows-dto';\nimport {apiRequest} from '@shipfox/client-api';\nimport {\n type InfiniteData,\n keepPreviousData,\n useInfiniteQuery,\n useMutation,\n useQuery,\n useQueryClient,\n} from '@tanstack/react-query';\nimport {\n isWorkflowRunTerminal,\n toWorkflowRunAttempt,\n toWorkflowRunDetail,\n toWorkflowRunListItem,\n toWorkflowRunListPage,\n type WorkflowRun,\n type WorkflowRunAttempt,\n type WorkflowRunDetail,\n type WorkflowRunListPage,\n type WorkflowRunStatus,\n} from '#core/workflow-run.js';\n\nexport interface WorkflowRunFilters {\n status?: WorkflowRunStatus | undefined;\n definitionId?: string | undefined;\n triggerSource?: string | undefined;\n createdFrom?: string | undefined;\n createdTo?: string | undefined;\n}\n\nexport const workflowRunsQueryKeys = {\n all: ['workflow-runs'] as const,\n lists: (projectId: string) => [...workflowRunsQueryKeys.all, 'list', projectId] as const,\n list: (projectId: string, filters: WorkflowRunFilters) =>\n [...workflowRunsQueryKeys.lists(projectId), normalizeFilters(filters)] as const,\n detail: (workflowRunId: string, runAttempt?: number | undefined) =>\n [...workflowRunsQueryKeys.all, 'detail', workflowRunId, runAttempt ?? null] as const,\n attempts: (workflowRunId: string) =>\n [...workflowRunsQueryKeys.all, 'attempts', workflowRunId] as const,\n};\n\nfunction normalizeFilters(filters: WorkflowRunFilters) {\n return {\n status: filters.status ?? null,\n definitionId: filters.definitionId ?? null,\n triggerSource: filters.triggerSource ?? null,\n createdFrom: filters.createdFrom ?? null,\n createdTo: filters.createdTo ?? null,\n };\n}\n\nfunction appendFilters(params: URLSearchParams, filters: WorkflowRunFilters) {\n if (filters.status) params.set('status', filters.status);\n if (filters.definitionId) params.set('definition_id', filters.definitionId);\n if (filters.triggerSource) params.set('trigger_source', filters.triggerSource);\n if (filters.createdFrom) params.set('created_from', filters.createdFrom);\n if (filters.createdTo) params.set('created_to', filters.createdTo);\n}\n\nasync function listWorkflowRunsDto({\n projectId,\n filters,\n limit = 50,\n cursor,\n signal,\n}: {\n projectId: string;\n filters: WorkflowRunFilters;\n limit?: number;\n cursor?: string | undefined;\n signal?: AbortSignal;\n}) {\n const params = new URLSearchParams({project_id: projectId, limit: String(limit)});\n if (cursor) params.set('cursor', cursor);\n appendFilters(params, filters);\n return await apiRequest<WorkflowRunListResponseDto>(`/workflows/runs?${params.toString()}`, {\n signal,\n });\n}\n\n/**\n * Fire the manual trigger of a workflow definition.\n *\n * The server resolves the manual subscription by definition id (workflows\n * may declare at most one manual trigger). `inputs` are forwarded to the\n * run when provided.\n */\nexport async function fireManualWorkflow({\n definitionId,\n inputs,\n}: {\n definitionId: string;\n inputs?: Record<string, unknown>;\n}) {\n return await apiRequest<{workflow_run_id: string}>(\n `/workflow-definitions/${definitionId}/fire-manual`,\n {\n method: 'POST',\n body: inputs ? {inputs} : {},\n },\n );\n}\n\nconst ACTIVE_POLL_MS = 4_000;\nconst IDLE_POLL_MS = 30_000;\n\ntype RunListInfinite = InfiniteData<WorkflowRunListResponseDto, string | undefined>;\n\nfunction toWorkflowRunInfiniteData(\n data: InfiniteData<WorkflowRunListResponseDto, string | undefined>,\n): InfiniteData<WorkflowRunListPage, string | undefined> {\n return {\n ...data,\n pages: data.pages.map(toWorkflowRunListPage),\n };\n}\n\nexport function useWorkflowRunsInfiniteQuery(\n projectId: string | undefined,\n filters: WorkflowRunFilters,\n limit = 50,\n) {\n // Polling is owned by react-query, not the page. Polling fast (4s) while\n // any non-terminal run is visible covers state transitions; polling slow\n // (30s) when idle covers brand-new external runs (webhook/schedule\n // triggers) without leaving the list stale.\n //\n // We disable polling once the user has loaded more than one page. With\n // cursor pagination the cursor that bounds page 1 was computed from\n // page 0's last row; if a refetch shifts that boundary, a small range\n // of rows can drop into a between-pages gap. Users who scrolled into\n // history opted into \"reading mode\": pause until they refocus, filter,\n // or scroll back.\n return useInfiniteQuery({\n queryKey: projectId\n ? workflowRunsQueryKeys.list(projectId, filters)\n : [...workflowRunsQueryKeys.all, 'list'],\n enabled: Boolean(projectId),\n initialPageParam: undefined as string | undefined,\n queryFn: ({pageParam, signal}) =>\n listWorkflowRunsDto({projectId: projectId ?? '', filters, limit, cursor: pageParam, signal}),\n getNextPageParam: (lastPage) => lastPage.next_cursor ?? undefined,\n select: toWorkflowRunInfiniteData,\n placeholderData: keepPreviousData,\n staleTime: 2_000,\n refetchOnWindowFocus: true,\n refetchInterval: (query) => {\n const data = query.state.data;\n if (!data || data.pages.length > 1) return false;\n const hasActive = data.pages.some((page) =>\n page.runs.some((run) => !isWorkflowRunTerminal(run.status)),\n );\n return hasActive ? ACTIVE_POLL_MS : IDLE_POLL_MS;\n },\n refetchIntervalInBackground: false,\n });\n}\n\nasync function getWorkflowRunDto({\n workflowRunId,\n runAttempt,\n signal,\n}: {\n workflowRunId: string;\n runAttempt?: number | undefined;\n signal?: AbortSignal;\n}) {\n const params = new URLSearchParams();\n if (runAttempt) params.set('attempt', String(runAttempt));\n const query = params.size > 0 ? `?${params.toString()}` : '';\n return await apiRequest<WorkflowRunDetailResponseDto>(\n `/workflows/runs/${workflowRunId}${query}`,\n {\n signal,\n },\n );\n}\n\nasync function getWorkflowRunAttemptsDto({\n workflowRunId,\n signal,\n}: {\n workflowRunId: string;\n signal?: AbortSignal;\n}) {\n return await apiRequest<WorkflowRunAttemptsResponseDto>(\n `/workflows/runs/${workflowRunId}/attempts`,\n {\n signal,\n },\n );\n}\n\nasync function cancelWorkflowRunDto({workflowRunId}: {workflowRunId: string}) {\n return await apiRequest<WorkflowRunDto>(`/workflows/runs/${workflowRunId}/cancel`, {\n method: 'POST',\n });\n}\n\nexport async function rerunWorkflowRun({\n workflowRunId,\n mode,\n}: {\n workflowRunId: string;\n mode: WorkflowRunRerunModeDto;\n}) {\n return await apiRequest<WorkflowRunResponseDto>(`/workflows/runs/${workflowRunId}/rerun`, {\n method: 'POST',\n body: {mode} satisfies RerunWorkflowRunBodyDto,\n });\n}\n\nexport function useRerunWorkflowRunMutation(projectId: string) {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: rerunWorkflowRun,\n onSuccess: async (_run, variables) => {\n await Promise.all([\n queryClient.invalidateQueries({queryKey: workflowRunsQueryKeys.lists(projectId)}),\n queryClient.invalidateQueries({\n queryKey: workflowRunsQueryKeys.detail(variables.workflowRunId),\n }),\n queryClient.invalidateQueries({\n queryKey: workflowRunsQueryKeys.attempts(variables.workflowRunId),\n }),\n ]);\n },\n });\n}\n\nfunction filtersAcceptManualPendingRun(\n filters: WorkflowRunFilters,\n definitionId: string,\n now: Date,\n): boolean {\n if (filters.status && filters.status !== 'pending') return false;\n if (filters.definitionId && filters.definitionId !== definitionId) return false;\n if (filters.triggerSource && filters.triggerSource !== 'manual') return false;\n if (filters.createdFrom && Date.parse(filters.createdFrom) > now.getTime()) return false;\n if (filters.createdTo && Date.parse(filters.createdTo) < now.getTime()) return false;\n return true;\n}\n\nfunction buildTempRun({\n projectId,\n definitionId,\n name,\n createdAt,\n}: {\n projectId: string;\n definitionId: string;\n name: string;\n createdAt: string;\n}): WorkflowRunDto {\n return {\n id: `temp-${cryptoRandomId()}`,\n project_id: projectId,\n definition_id: definitionId,\n name,\n status: 'pending',\n current_attempt: 1,\n latest_attempt: 1,\n trigger_provider: null,\n trigger_source: 'manual',\n trigger_event: 'fire',\n trigger_payload: {source: 'manual', event: 'fire'},\n inputs: null,\n source_snapshot: null,\n created_at: createdAt,\n updated_at: createdAt,\n started_at: null,\n finished_at: null,\n };\n}\n\nfunction cryptoRandomId(): string {\n if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n return crypto.randomUUID();\n }\n return `${Date.now()}-${Math.random().toString(36).slice(2)}`;\n}\n\nexport interface FireManualWorkflowVariables {\n projectId: string;\n definitionId: string;\n inputs?: Record<string, unknown>;\n}\n\nexport function useFireManualWorkflowMutation() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (variables: FireManualWorkflowVariables) =>\n fireManualWorkflow(\n variables.inputs\n ? {definitionId: variables.definitionId, inputs: variables.inputs}\n : {definitionId: variables.definitionId},\n ),\n onMutate: (variables) => {\n const definitionName = lookupDefinitionName(\n queryClient,\n variables.projectId,\n variables.definitionId,\n );\n const createdAt = new Date().toISOString();\n const tempRun = buildTempRun({\n projectId: variables.projectId,\n definitionId: variables.definitionId,\n name: definitionName ?? 'New run',\n createdAt,\n });\n\n const listsKey = workflowRunsQueryKeys.lists(variables.projectId);\n const touchedQueryKeys: Array<readonly unknown[]> = [];\n\n const entries = queryClient.getQueriesData<RunListInfinite>({queryKey: listsKey});\n const now = new Date(createdAt);\n for (const [queryKey] of entries) {\n const filters = readFiltersFromKey(queryKey);\n if (!filters) continue;\n if (!filtersAcceptManualPendingRun(filters, variables.definitionId, now)) continue;\n\n touchedQueryKeys.push(queryKey);\n queryClient.setQueryData<RunListInfinite>(queryKey, (current) => {\n if (!current || current.pages.length === 0) return current;\n const firstPage = current.pages[0];\n if (!firstPage) return current;\n const nextFirstPage: WorkflowRunListResponseDto = {\n ...firstPage,\n runs: [tempRun, ...firstPage.runs],\n filtered_total_count:\n firstPage.filtered_total_count != null ? firstPage.filtered_total_count + 1 : null,\n };\n return {...current, pages: [nextFirstPage, ...current.pages.slice(1)]};\n });\n }\n\n return {tempWorkflowRunId: tempRun.id, touchedQueryKeys};\n },\n onError: (_error, _variables, context) => {\n if (!context) return;\n for (const queryKey of context.touchedQueryKeys) {\n queryClient.setQueryData<RunListInfinite>(queryKey, (current) => {\n if (!current) return current;\n let removedCount = 0;\n const pages = current.pages.map((page) => {\n const runs = page.runs.filter((run) => {\n if (run.id !== context.tempWorkflowRunId) return true;\n removedCount += 1;\n return false;\n });\n if (runs.length === page.runs.length) return page;\n return {\n ...page,\n runs,\n filtered_total_count:\n page.filtered_total_count != null\n ? Math.max(0, page.filtered_total_count - removedCount)\n : null,\n };\n });\n if (removedCount === 0) return current;\n return {...current, pages};\n });\n }\n },\n onSuccess: (_data, variables) => {\n void queryClient.invalidateQueries({\n queryKey: workflowRunsQueryKeys.lists(variables.projectId),\n });\n },\n });\n}\n\nfunction readFiltersFromKey(queryKey: readonly unknown[]): WorkflowRunFilters | null {\n if (queryKey.length < 4) return null;\n const normalized = queryKey[3];\n if (!normalized || typeof normalized !== 'object') return null;\n const obj = normalized as Record<string, unknown>;\n return {\n status: (obj.status as WorkflowRunStatus | null) ?? undefined,\n definitionId: (obj.definitionId as string | null) ?? undefined,\n triggerSource: (obj.triggerSource as string | null) ?? undefined,\n createdFrom: (obj.createdFrom as string | null) ?? undefined,\n createdTo: (obj.createdTo as string | null) ?? undefined,\n };\n}\n\nfunction lookupDefinitionName(\n queryClient: ReturnType<typeof useQueryClient>,\n projectId: string,\n definitionId: string,\n): string | undefined {\n const entries = queryClient.getQueriesData<\n InfiniteData<{definitions: Array<{id: string; project_id: string; name: string}>}>\n >({queryKey: ['definitions', 'list', projectId]});\n for (const [, data] of entries) {\n if (!data) continue;\n for (const page of data.pages) {\n const match = page.definitions.find((d) => d.id === definitionId);\n if (match) return match.name;\n }\n }\n return undefined;\n}\n\nexport function useWorkflowRunQuery(workflowRunId: string | undefined) {\n return useWorkflowRunAttemptQuery({workflowRunId, runAttempt: undefined});\n}\n\nexport function useWorkflowRunAttemptQuery({\n workflowRunId,\n runAttempt,\n}: {\n workflowRunId: string | undefined;\n runAttempt?: number | undefined;\n}) {\n // Poll a non-terminal run so the open run detail stays live (same cadence as the run\n // list); stop once the run is terminal.\n return useQuery({\n queryKey: workflowRunId\n ? workflowRunsQueryKeys.detail(workflowRunId, runAttempt)\n : [...workflowRunsQueryKeys.all, 'detail'],\n enabled: Boolean(workflowRunId),\n queryFn: ({signal}) =>\n getWorkflowRunDto({workflowRunId: workflowRunId ?? '', runAttempt, signal}),\n select: toWorkflowRunDetail,\n staleTime: 2_000,\n refetchOnWindowFocus: true,\n refetchInterval: (query) => {\n const status: WorkflowRunDetail['runAttempt']['status'] | undefined =\n query.state.data?.run_attempt.status;\n if (!status) return false;\n return isWorkflowRunTerminal(status) ? false : ACTIVE_POLL_MS;\n },\n refetchIntervalInBackground: false,\n });\n}\n\nexport function useWorkflowRunAttemptsQuery({\n workflowRunId,\n enabled,\n}: {\n workflowRunId: string | undefined;\n enabled: boolean;\n}) {\n return useQuery({\n queryKey: workflowRunId\n ? workflowRunsQueryKeys.attempts(workflowRunId)\n : [...workflowRunsQueryKeys.all, 'attempts'],\n enabled: Boolean(workflowRunId) && enabled,\n queryFn: ({signal}) => getWorkflowRunAttemptsDto({workflowRunId: workflowRunId ?? '', signal}),\n select: (dto): WorkflowRunAttempt[] => dto.attempts.map(toWorkflowRunAttempt),\n staleTime: 0,\n refetchOnMount: true,\n refetchOnWindowFocus: false,\n });\n}\n\nexport function useCancelWorkflowRunMutation(run: WorkflowRun | undefined) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async () => {\n if (!run) throw new Error('Workflow run is not loaded');\n return toWorkflowRunListItem(await cancelWorkflowRunDto({workflowRunId: run.id}));\n },\n onSuccess: async () => {\n if (!run) return;\n await Promise.all([\n queryClient.invalidateQueries({queryKey: workflowRunsQueryKeys.detail(run.id)}),\n queryClient.invalidateQueries({queryKey: workflowRunsQueryKeys.lists(run.projectId)}),\n queryClient.invalidateQueries({queryKey: workflowRunsQueryKeys.attempts(run.id)}),\n ]);\n },\n });\n}\n"],"names":["apiRequest","keepPreviousData","useInfiniteQuery","useMutation","useQuery","useQueryClient","isWorkflowRunTerminal","toWorkflowRunAttempt","toWorkflowRunDetail","toWorkflowRunListItem","toWorkflowRunListPage","workflowRunsQueryKeys","all","lists","projectId","list","filters","normalizeFilters","detail","workflowRunId","runAttempt","attempts","status","definitionId","triggerSource","createdFrom","createdTo","appendFilters","params","set","listWorkflowRunsDto","limit","cursor","signal","URLSearchParams","project_id","String","toString","fireManualWorkflow","inputs","method","body","ACTIVE_POLL_MS","IDLE_POLL_MS","toWorkflowRunInfiniteData","data","pages","map","useWorkflowRunsInfiniteQuery","queryKey","enabled","Boolean","initialPageParam","undefined","queryFn","pageParam","getNextPageParam","lastPage","next_cursor","select","placeholderData","staleTime","refetchOnWindowFocus","refetchInterval","query","state","length","hasActive","some","page","runs","run","refetchIntervalInBackground","getWorkflowRunDto","size","getWorkflowRunAttemptsDto","cancelWorkflowRunDto","rerunWorkflowRun","mode","useRerunWorkflowRunMutation","queryClient","mutationFn","onSuccess","_run","variables","Promise","invalidateQueries","filtersAcceptManualPendingRun","now","Date","parse","getTime","buildTempRun","name","createdAt","id","cryptoRandomId","definition_id","current_attempt","latest_attempt","trigger_provider","trigger_source","trigger_event","trigger_payload","source","event","source_snapshot","created_at","updated_at","started_at","finished_at","crypto","randomUUID","Math","random","slice","useFireManualWorkflowMutation","onMutate","definitionName","lookupDefinitionName","toISOString","tempRun","listsKey","touchedQueryKeys","entries","getQueriesData","readFiltersFromKey","push","setQueryData","current","firstPage","nextFirstPage","filtered_total_count","tempWorkflowRunId","onError","_error","_variables","context","removedCount","filter","max","_data","normalized","obj","match","definitions","find","d","useWorkflowRunQuery","useWorkflowRunAttemptQuery","run_attempt","useWorkflowRunAttemptsQuery","dto","refetchOnMount","useCancelWorkflowRunMutation","Error"],"mappings":"AASA,SAAQA,UAAU,QAA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AsB,MAAMmE,qBAAqB;gBAACzD,eAAeoD,IAAIwB,EAAE;YAAA;QAChF;QACAb,WAAW;YACT,IAAI,CAACX,KAAK;YACV,MAAMc,QAAQzE,GAAG,CAAC;gBAChBoE,YAAYM,iBAAiB,CAAC;oBAACrC,UAAUtC,sBAAsBO,MAAM,CAACqD,IAAIwB,EAAE;gBAAC;gBAC7Ef,YAAYM,iBAAiB,CAAC;oBAACrC,UAAUtC,sBAAsBE,KAAK,CAAC0D,IAAIzD,SAAS;gBAAC;gBACnFkE,YAAYM,iBAAiB,CAAC;oBAACrC,UAAUtC,sBAAsBU,QAAQ,CAACkD,IAAIwB,EAAE;gBAAC;aAChF;QACH;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/hooks/api/workflow-runs.ts"],"sourcesContent":["import {\n type RerunWorkflowRunBodyDto,\n type WorkflowRunRerunModeDto,\n workflowRunAttemptsResponseSchema,\n workflowRunDetailResponseSchema,\n workflowRunDtoSchema,\n workflowRunListResponseSchema,\n workflowRunResponseSchema,\n} from '@shipfox/api-workflows-dto';\nimport {checkedApiRequest, type StandardSchema} from '@shipfox/client-api';\nimport {\n type InfiniteData,\n infiniteQueryOptions,\n keepPreviousData,\n queryOptions,\n type UseInfiniteQueryOptions,\n type UseQueryOptions,\n useInfiniteQuery,\n useMutation,\n useQuery,\n useQueryClient,\n} from '@tanstack/react-query';\nimport {\n isWorkflowRunTerminal,\n type ManualWorkflowLaunch,\n type WorkflowRun,\n type WorkflowRunAttempt,\n WorkflowRunAttemptSummary,\n type WorkflowRunDetail,\n type WorkflowRunListItem,\n type WorkflowRunListPage,\n type WorkflowRunStatus,\n} from '#core/workflow-run.js';\nimport {\n toWorkflowRunAttempt,\n toWorkflowRunDetail,\n toWorkflowRunListItem,\n toWorkflowRunListPage,\n} from './workflow-run-mapper.js';\n\nexport interface WorkflowRunFilters {\n status?: WorkflowRunStatus | undefined;\n definitionId?: string | undefined;\n triggerSource?: string | undefined;\n createdFrom?: string | undefined;\n createdTo?: string | undefined;\n}\n\nexport const workflowRunsQueryKeys = {\n all: ['workflow-runs'] as const,\n lists: (projectId: string) => [...workflowRunsQueryKeys.all, 'list', projectId] as const,\n list: (projectId: string, filters: WorkflowRunFilters) =>\n [...workflowRunsQueryKeys.lists(projectId), normalizeFilters(filters)] as const,\n detail: (workflowRunId: string, runAttempt?: number | undefined) =>\n [...workflowRunsQueryKeys.all, 'detail', workflowRunId, runAttempt ?? null] as const,\n attempts: (workflowRunId: string) =>\n [...workflowRunsQueryKeys.all, 'attempts', workflowRunId] as const,\n};\n\ntype WorkflowRunsListQueryKey =\n | ReturnType<typeof workflowRunsQueryKeys.list>\n | readonly ['workflow-runs', 'list'];\ntype WorkflowRunDetailQueryKey =\n | ReturnType<typeof workflowRunsQueryKeys.detail>\n | readonly ['workflow-runs', 'detail'];\ntype WorkflowRunAttemptsQueryKey =\n | ReturnType<typeof workflowRunsQueryKeys.attempts>\n | readonly ['workflow-runs', 'attempts'];\ntype WorkflowRunsInfiniteQueryOptions = UseInfiniteQueryOptions<\n WorkflowRunListPage,\n Error,\n InfiniteData<WorkflowRunListPage, string | undefined>,\n WorkflowRunsListQueryKey,\n string | undefined\n>;\ntype WorkflowRunDetailQueryOptions = UseQueryOptions<\n WorkflowRunDetail,\n Error,\n WorkflowRunDetail,\n WorkflowRunDetailQueryKey\n>;\ntype WorkflowRunAttemptsQueryOptions = UseQueryOptions<\n WorkflowRunAttempt[],\n Error,\n WorkflowRunAttempt[],\n WorkflowRunAttemptsQueryKey\n>;\n\nfunction normalizeFilters(filters: WorkflowRunFilters) {\n return {\n status: filters.status ?? null,\n definitionId: filters.definitionId ?? null,\n triggerSource: filters.triggerSource ?? null,\n createdFrom: filters.createdFrom ?? null,\n createdTo: filters.createdTo ?? null,\n };\n}\n\nfunction appendFilters(params: URLSearchParams, filters: WorkflowRunFilters) {\n if (filters.status) params.set('status', filters.status);\n if (filters.definitionId) params.set('definition_id', filters.definitionId);\n if (filters.triggerSource) params.set('trigger_source', filters.triggerSource);\n if (filters.createdFrom) params.set('created_from', filters.createdFrom);\n if (filters.createdTo) params.set('created_to', filters.createdTo);\n}\n\nasync function listWorkflowRuns({\n projectId,\n filters,\n limit = 50,\n cursor,\n signal,\n}: {\n projectId: string;\n filters: WorkflowRunFilters;\n limit?: number;\n cursor?: string | undefined;\n signal?: AbortSignal;\n}): Promise<WorkflowRunListPage> {\n const params = new URLSearchParams({project_id: projectId, limit: String(limit)});\n if (cursor) params.set('cursor', cursor);\n appendFilters(params, filters);\n const response = await checkedApiRequest(\n workflowRunListResponseSchema,\n `/workflows/runs?${params.toString()}`,\n {signal},\n );\n return toWorkflowRunListPage(response);\n}\n\n/**\n * Fire the manual trigger of a workflow definition.\n *\n * The server resolves the manual subscription by definition id (workflows\n * may declare at most one manual trigger). `inputs` are forwarded to the\n * run when provided.\n */\nexport async function fireManualWorkflow({\n definitionId,\n inputs,\n}: {\n definitionId: string;\n inputs?: Record<string, unknown>;\n}): Promise<ManualWorkflowLaunch> {\n const response = await checkedApiRequest(\n manualWorkflowResponseSchema,\n `/workflow-definitions/${definitionId}/fire-manual`,\n {\n method: 'POST',\n body: inputs ? {inputs} : {},\n },\n );\n return {workflowRunId: response.workflow_run_id};\n}\n\nconst ACTIVE_POLL_MS = 4_000;\nconst IDLE_POLL_MS = 30_000;\n\ntype RunListInfinite = InfiniteData<WorkflowRunListPage, string | undefined>;\n\nexport function useWorkflowRunsInfiniteQuery(\n projectId: string | undefined,\n filters: WorkflowRunFilters,\n limit = 50,\n) {\n return useInfiniteQuery(workflowRunsInfiniteQueryOptions(projectId, filters, limit));\n}\n\nexport function workflowRunsInfiniteQueryOptions(\n projectId: string | undefined,\n filters: WorkflowRunFilters,\n limit = 50,\n): WorkflowRunsInfiniteQueryOptions {\n // Polling is owned by react-query, not the page. Polling fast (4s) while\n // any non-terminal run is visible covers state transitions; polling slow\n // (30s) when idle covers brand-new external runs (webhook/schedule\n // triggers) without leaving the list stale.\n //\n // We disable polling once the user has loaded more than one page. With\n // cursor pagination the cursor that bounds page 1 was computed from\n // page 0's last row; if a refetch shifts that boundary, a small range\n // of rows can drop into a between-pages gap. Users who scrolled into\n // history opted into \"reading mode\": pause until they refocus, filter,\n // or scroll back.\n return infiniteQueryOptions({\n queryKey: projectId\n ? workflowRunsQueryKeys.list(projectId, filters)\n : ([...workflowRunsQueryKeys.all, 'list'] as const),\n enabled: Boolean(projectId),\n initialPageParam: undefined as string | undefined,\n queryFn: ({pageParam, signal}) =>\n listWorkflowRuns({projectId: projectId ?? '', filters, limit, cursor: pageParam, signal}),\n getNextPageParam: (lastPage) => lastPage.nextCursor ?? undefined,\n placeholderData: keepPreviousData,\n staleTime: 2_000,\n refetchOnWindowFocus: true,\n refetchInterval: (query) => {\n const data = query.state.data;\n if (!data || data.pages.length > 1) return false;\n const hasActive = data.pages.some((page) =>\n page.runs.some((run) => !isWorkflowRunTerminal(run.status)),\n );\n return hasActive ? ACTIVE_POLL_MS : IDLE_POLL_MS;\n },\n refetchIntervalInBackground: false,\n });\n}\n\nasync function getWorkflowRun({\n workflowRunId,\n runAttempt,\n signal,\n}: {\n workflowRunId: string;\n runAttempt?: number | undefined;\n signal?: AbortSignal;\n}): Promise<WorkflowRunDetail> {\n const params = new URLSearchParams();\n if (runAttempt) params.set('attempt', String(runAttempt));\n const query = params.size > 0 ? `?${params.toString()}` : '';\n return toWorkflowRunDetail(\n await checkedApiRequest(\n workflowRunDetailResponseSchema,\n `/workflows/runs/${workflowRunId}${query}`,\n {\n signal,\n },\n ),\n );\n}\n\nasync function getWorkflowRunAttempts({\n workflowRunId,\n signal,\n}: {\n workflowRunId: string;\n signal?: AbortSignal;\n}): Promise<WorkflowRunAttempt[]> {\n const response = await checkedApiRequest(\n workflowRunAttemptsResponseSchema,\n `/workflows/runs/${workflowRunId}/attempts`,\n {\n signal,\n },\n );\n return response.attempts.map(toWorkflowRunAttempt);\n}\n\nasync function cancelWorkflowRun({\n workflowRunId,\n}: {\n workflowRunId: string;\n}): Promise<WorkflowRunListItem> {\n return toWorkflowRunListItem(\n await checkedApiRequest(workflowRunDtoSchema, `/workflows/runs/${workflowRunId}/cancel`, {\n method: 'POST',\n }),\n );\n}\n\nexport async function rerunWorkflowRun({\n workflowRunId,\n mode,\n}: {\n workflowRunId: string;\n mode: WorkflowRunRerunModeDto;\n}): Promise<WorkflowRunListItem> {\n return toWorkflowRunListItem(\n await checkedApiRequest(workflowRunResponseSchema, `/workflows/runs/${workflowRunId}/rerun`, {\n method: 'POST',\n body: {mode} satisfies RerunWorkflowRunBodyDto,\n }),\n );\n}\n\nconst manualWorkflowResponseSchema: StandardSchema<unknown, {workflow_run_id: string}> = {\n '~standard': {\n version: 1,\n vendor: 'client-workflows',\n validate: (value) => {\n if (\n typeof value === 'object' &&\n value !== null &&\n 'workflow_run_id' in value &&\n typeof value.workflow_run_id === 'string'\n )\n return {value: {workflow_run_id: value.workflow_run_id}};\n return {issues: [{message: 'Expected workflow_run_id.'}]};\n },\n },\n};\n\nexport function useRerunWorkflowRunMutation(projectId: string) {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: rerunWorkflowRun,\n onSuccess: async (_run, variables) => {\n await Promise.all([\n queryClient.invalidateQueries({queryKey: workflowRunsQueryKeys.lists(projectId)}),\n queryClient.invalidateQueries({\n queryKey: workflowRunsQueryKeys.detail(variables.workflowRunId),\n }),\n queryClient.invalidateQueries({\n queryKey: workflowRunsQueryKeys.attempts(variables.workflowRunId),\n }),\n ]);\n },\n });\n}\n\nfunction filtersAcceptManualPendingRun(\n filters: WorkflowRunFilters,\n definitionId: string,\n now: Date,\n): boolean {\n if (filters.status && filters.status !== 'pending') return false;\n if (filters.definitionId && filters.definitionId !== definitionId) return false;\n if (filters.triggerSource && filters.triggerSource !== 'manual') return false;\n if (filters.createdFrom && Date.parse(filters.createdFrom) > now.getTime()) return false;\n if (filters.createdTo && Date.parse(filters.createdTo) < now.getTime()) return false;\n return true;\n}\n\nfunction buildTempRun({\n projectId,\n definitionId,\n name,\n createdAt,\n}: {\n projectId: string;\n definitionId: string;\n name: string;\n createdAt: string;\n}): WorkflowRunListItem {\n const id = `temp-${cryptoRandomId()}`;\n return {\n id,\n projectId,\n definitionId,\n name,\n status: 'pending',\n currentAttempt: 1,\n latestAttempt: 1,\n triggerProvider: null,\n triggerSource: 'manual',\n triggerEvent: 'fire',\n triggerPayload: {source: 'manual', event: 'fire'},\n triggerDisplayLabel: 'fire',\n triggerLabel: 'manual · fire',\n inputs: null,\n sourceSnapshot: null,\n createdAt,\n updatedAt: createdAt,\n shortId: id.slice(0, 8),\n isTemporary: true,\n runAttempt: new WorkflowRunAttemptSummary({\n workflowRunId: id,\n attempt: 1,\n status: 'pending',\n createdAt,\n startedAt: null,\n finishedAt: null,\n }),\n };\n}\n\nfunction cryptoRandomId(): string {\n if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n return crypto.randomUUID();\n }\n return `${Date.now()}-${Math.random().toString(36).slice(2)}`;\n}\n\nexport interface FireManualWorkflowVariables {\n projectId: string;\n definitionId: string;\n inputs?: Record<string, unknown>;\n}\n\nexport function useFireManualWorkflowMutation() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (variables: FireManualWorkflowVariables) =>\n fireManualWorkflow(\n variables.inputs\n ? {definitionId: variables.definitionId, inputs: variables.inputs}\n : {definitionId: variables.definitionId},\n ),\n onMutate: (variables) => {\n const definitionName = lookupDefinitionName(\n queryClient,\n variables.projectId,\n variables.definitionId,\n );\n const createdAt = new Date().toISOString();\n const tempRun = buildTempRun({\n projectId: variables.projectId,\n definitionId: variables.definitionId,\n name: definitionName ?? 'New run',\n createdAt,\n });\n\n const listsKey = workflowRunsQueryKeys.lists(variables.projectId);\n const touchedQueryKeys: Array<readonly unknown[]> = [];\n\n const entries = queryClient.getQueriesData<RunListInfinite>({queryKey: listsKey});\n const now = new Date(createdAt);\n for (const [queryKey] of entries) {\n const filters = readFiltersFromKey(queryKey);\n if (!filters) continue;\n if (!filtersAcceptManualPendingRun(filters, variables.definitionId, now)) continue;\n\n touchedQueryKeys.push(queryKey);\n queryClient.setQueryData<RunListInfinite>(queryKey, (current) => {\n if (!current || current.pages.length === 0) return current;\n const firstPage = current.pages[0];\n if (!firstPage) return current;\n const nextFirstPage: WorkflowRunListPage = {\n ...firstPage,\n runs: [tempRun, ...firstPage.runs],\n filteredTotalCount:\n firstPage.filteredTotalCount != null ? firstPage.filteredTotalCount + 1 : null,\n };\n return {...current, pages: [nextFirstPage, ...current.pages.slice(1)]};\n });\n }\n\n return {tempWorkflowRunId: tempRun.id, touchedQueryKeys};\n },\n onError: (_error, _variables, context) => {\n if (!context) return;\n for (const queryKey of context.touchedQueryKeys) {\n queryClient.setQueryData<RunListInfinite>(queryKey, (current) => {\n if (!current) return current;\n let removedCount = 0;\n const pages = current.pages.map((page) => {\n const runs = page.runs.filter((run) => {\n if (run.id !== context.tempWorkflowRunId) return true;\n removedCount += 1;\n return false;\n });\n if (runs.length === page.runs.length) return page;\n return {\n ...page,\n runs,\n filteredTotalCount:\n page.filteredTotalCount != null\n ? Math.max(0, page.filteredTotalCount - removedCount)\n : null,\n };\n });\n if (removedCount === 0) return current;\n return {...current, pages};\n });\n }\n },\n onSuccess: (_data, variables) => {\n void queryClient.invalidateQueries({\n queryKey: workflowRunsQueryKeys.lists(variables.projectId),\n });\n },\n });\n}\n\nfunction readFiltersFromKey(queryKey: readonly unknown[]): WorkflowRunFilters | null {\n if (queryKey.length < 4) return null;\n const normalized = queryKey[3];\n if (!normalized || typeof normalized !== 'object') return null;\n const obj = normalized as Record<string, unknown>;\n return {\n status: (obj.status as WorkflowRunStatus | null) ?? undefined,\n definitionId: (obj.definitionId as string | null) ?? undefined,\n triggerSource: (obj.triggerSource as string | null) ?? undefined,\n createdFrom: (obj.createdFrom as string | null) ?? undefined,\n createdTo: (obj.createdTo as string | null) ?? undefined,\n };\n}\n\nfunction lookupDefinitionName(\n queryClient: ReturnType<typeof useQueryClient>,\n projectId: string,\n definitionId: string,\n): string | undefined {\n const entries = queryClient.getQueriesData<\n InfiniteData<{definitions: Array<{id: string; name: string}>}>\n >({queryKey: ['definitions', 'list', projectId]});\n for (const [, data] of entries) {\n if (!data) continue;\n for (const page of data.pages) {\n const match = page.definitions.find((d) => d.id === definitionId);\n if (match) return match.name;\n }\n }\n return undefined;\n}\n\nexport function useWorkflowRunQuery(workflowRunId: string | undefined) {\n return useWorkflowRunAttemptQuery({workflowRunId, runAttempt: undefined});\n}\n\nexport function useWorkflowRunAttemptQuery({\n workflowRunId,\n runAttempt,\n}: {\n workflowRunId: string | undefined;\n runAttempt?: number | undefined;\n}) {\n return useQuery(workflowRunQueryOptions({workflowRunId, runAttempt}));\n}\n\nexport function workflowRunQueryOptions({\n workflowRunId,\n runAttempt,\n}: {\n workflowRunId: string | undefined;\n runAttempt?: number | undefined;\n}): WorkflowRunDetailQueryOptions {\n // Poll a non-terminal run so the open run detail stays live (same cadence as the run\n // list); stop once the run is terminal.\n return queryOptions({\n queryKey: workflowRunId\n ? workflowRunsQueryKeys.detail(workflowRunId, runAttempt)\n : ([...workflowRunsQueryKeys.all, 'detail'] as const),\n enabled: Boolean(workflowRunId),\n queryFn: ({signal}) => getWorkflowRun({workflowRunId: workflowRunId ?? '', runAttempt, signal}),\n staleTime: 2_000,\n refetchOnWindowFocus: true,\n refetchInterval: (query) => {\n const status: WorkflowRunDetail['runAttempt']['status'] | undefined =\n query.state.data?.runAttempt.status;\n if (!status) return false;\n return isWorkflowRunTerminal(status) ? false : ACTIVE_POLL_MS;\n },\n refetchIntervalInBackground: false,\n });\n}\n\nexport function useWorkflowRunAttemptsQuery({\n workflowRunId,\n enabled,\n}: {\n workflowRunId: string | undefined;\n enabled: boolean;\n}) {\n return useQuery(workflowRunAttemptsQueryOptions({workflowRunId, enabled}));\n}\n\nexport function workflowRunAttemptsQueryOptions({\n workflowRunId,\n enabled,\n}: {\n workflowRunId: string | undefined;\n enabled: boolean;\n}): WorkflowRunAttemptsQueryOptions {\n return queryOptions({\n queryKey: workflowRunId\n ? workflowRunsQueryKeys.attempts(workflowRunId)\n : ([...workflowRunsQueryKeys.all, 'attempts'] as const),\n enabled: Boolean(workflowRunId) && enabled,\n queryFn: ({signal}) => getWorkflowRunAttempts({workflowRunId: workflowRunId ?? '', signal}),\n staleTime: 0,\n refetchOnMount: true,\n refetchOnWindowFocus: false,\n });\n}\n\nexport function useCancelWorkflowRunMutation(run: WorkflowRun | undefined) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (): Promise<WorkflowRunListItem> => {\n if (!run) throw new Error('Workflow run is not loaded');\n return await cancelWorkflowRun({workflowRunId: run.id});\n },\n onSuccess: async () => {\n if (!run) return;\n await Promise.all([\n queryClient.invalidateQueries({queryKey: workflowRunsQueryKeys.detail(run.id)}),\n queryClient.invalidateQueries({queryKey: workflowRunsQueryKeys.lists(run.projectId)}),\n queryClient.invalidateQueries({queryKey: workflowRunsQueryKeys.attempts(run.id)}),\n ]);\n },\n });\n}\n"],"names":["workflowRunAttemptsResponseSchema","workflowRunDetailResponseSchema","workflowRunDtoSchema","workflowRunListResponseSchema","workflowRunResponseSchema","checkedApiRequest","infiniteQueryOptions","keepPreviousData","queryOptions","useInfiniteQuery","useMutation","useQuery","useQueryClient","isWorkflowRunTerminal","WorkflowRunAttemptSummary","toWorkflowRunAttempt","toWorkflowRunDetail","toWorkflowRunListItem","toWorkflowRunListPage","workflowRunsQueryKeys","all","lists","projectId","list","filters","normalizeFilters","detail","workflowRunId","runAttempt","attempts","status","definitionId","triggerSource","createdFrom","createdTo","appendFilters","params","set","listWorkflowRuns","limit","cursor","signal","URLSearchParams","project_id","String","response","toString","fireManualWorkflow","inputs","manualWorkflowResponseSchema","method","body","workflow_run_id","ACTIVE_POLL_MS","IDLE_POLL_MS","useWorkflowRunsInfiniteQuery","workflowRunsInfiniteQueryOptions","queryKey","enabled","Boolean","initialPageParam","undefined","queryFn","pageParam","getNextPageParam","lastPage","nextCursor","placeholderData","staleTime","refetchOnWindowFocus","refetchInterval","query","data","state","pages","length","hasActive","some","page","runs","run","refetchIntervalInBackground","getWorkflowRun","size","getWorkflowRunAttempts","map","cancelWorkflowRun","rerunWorkflowRun","mode","version","vendor","validate","value","issues","message","useRerunWorkflowRunMutation","queryClient","mutationFn","onSuccess","_run","variables","Promise","invalidateQueries","filtersAcceptManualPendingRun","now","Date","parse","getTime","buildTempRun","name","createdAt","id","cryptoRandomId","currentAttempt","latestAttempt","triggerProvider","triggerEvent","triggerPayload","source","event","triggerDisplayLabel","triggerLabel","sourceSnapshot","updatedAt","shortId","slice","isTemporary","attempt","startedAt","finishedAt","crypto","randomUUID","Math","random","useFireManualWorkflowMutation","onMutate","definitionName","lookupDefinitionName","toISOString","tempRun","listsKey","touchedQueryKeys","entries","getQueriesData","readFiltersFromKey","push","setQueryData","current","firstPage","nextFirstPage","filteredTotalCount","tempWorkflowRunId","onError","_error","_variables","context","removedCount","filter","max","_data","normalized","obj","match","definitions","find","d","useWorkflowRunQuery","useWorkflowRunAttemptQuery","workflowRunQueryOptions","useWorkflowRunAttemptsQuery","workflowRunAttemptsQueryOptions","refetchOnMount","useCancelWorkflowRunMutation","Error"],"mappings":"AAAA,SAGEA,iCAAiC,EACjCC,+BAA+B,EAC/BC,oBAAoB,EACpBC,6BAA6B,EAC7BC,yBAAyB,QACpB,6BAA6B;AACpC,SAAQC,iBAAiB,QAA4B,sBAAsB;AAC3E,SAEEC,oBAAoB,EACpBC,gBAAgB,EAChBC,YAAY,EAGZC,gBAAgB,EAChBC,WAAW,EACXC,QAAQ,EACRC,cAAc,QACT,wBAAwB;AAC/B,SACEC,qBAAqB,EAIrBC,yBAAyB,QAKpB,wBAAwB;AAC/B,SACEC,oBAAoB,EACpBC,mBAAmB,EACnBC,qBAAqB,EACrBC,qBAAqB,QAChB,2BAA2B;AAUlC,OAAO,MAAMC,wBAAwB;IACnCC,KAAK;QAAC;KAAgB;IACtBC,OAAO,CAACC,YAAsB;eAAIH,sBAAsBC,GAAG;YAAE;YAAQE;SAAU;IAC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AO,SAASgH,gCAAgC,EAC9C/I,aAAa,EACb+B,OAAO,EAIR;IACC,OAAOlD,aAAa;QAClBiD,UAAU9B,gBACNR,sBAAsBU,QAAQ,CAACF,iBAC9B;eAAIR,sBAAsBC,GAAG;YAAE;SAAW;QAC/CsC,SAASC,QAAQhC,kBAAkB+B;QACnCI,SAAS,CAAC,EAACrB,MAAM,EAAC,GAAK2C,uBAAuB;gBAACzD,eAAeA,iBAAiB;gBAAIc;YAAM;QACzF2B,WAAW;QACXuG,gBAAgB;QAChBtG,sBAAsB;IACxB;AACF;AAEA,OAAO,SAASuG,6BAA6B5F,GAA4B;IACvE,MAAMgB,cAAcpF;IACpB,OAAOF,YAAY;QACjBuF,YAAY;YACV,IAAI,CAACjB,KAAK,MAAM,IAAI6F,MAAM;YAC1B,OAAO,MAAMvF,kBAAkB;gBAAC3D,eAAeqD,IAAI+B,EAAE;YAAA;QACvD;QACAb,WAAW;YACT,IAAI,CAAClB,KAAK;YACV,MAAMqB,QAAQjF,GAAG,CAAC;gBAChB4E,YAAYM,iBAAiB,CAAC;oBAAC7C,UAAUtC,sBAAsBO,MAAM,CAACsD,IAAI+B,EAAE;gBAAC;gBAC7Ef,YAAYM,iBAAiB,CAAC;oBAAC7C,UAAUtC,sBAAsBE,KAAK,CAAC2D,IAAI1D,SAAS;gBAAC;gBACnF0E,YAAYM,iBAAiB,CAAC;oBAAC7C,UAAUtC,sBAAsBU,QAAQ,CAACmD,IAAI+B,EAAE;gBAAC;aAChF;QACH;IACF;AACF"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export type { AgentConfigIssue, JobDisplayDuration, JobExecutionDisplayDuration, JobExecutionStatus, JobExecutionTime, JobStatus, Step, StepAttempt, StepAttemptDisplayDuration, StepError, StepErrorCategory, StepErrorReason, StepGateResult, StepSourceLocation, WorkflowRun, WorkflowRunAttempt, WorkflowRunDetail, WorkflowRunListPage, WorkflowRunStatus, WorkflowSourceSnapshot, WorkflowStatus, } from '#core/workflow-run.js';
1
+ export type { AgentConfigIssue, JobDisplayDuration, JobExecutionDisplayDuration, JobExecutionStatus, JobExecutionTime, JobStatus, ManualWorkflowLaunch, Step, StepAttempt, StepAttemptDisplayDuration, StepError, StepErrorCategory, StepErrorReason, StepGateResult, StepSourceLocation, WorkflowRun, WorkflowRunAttempt, WorkflowRunDetail, WorkflowRunListPage, WorkflowRunStatus, WorkflowSourceSnapshot, WorkflowStatus, } from '#core/workflow-run.js';
2
2
  export { isWorkflowRunTerminal, isWorkflowStatus, Job, JobExecution, TERMINAL_WORKFLOW_RUN_STATUSES, WORKFLOW_RUN_STATUSES, workflowRunShortId, workflowRunTriggerLabel, } from '#core/workflow-run.js';
3
- export { type FireManualWorkflowVariables, fireManualWorkflow, useCancelWorkflowRunMutation, useFireManualWorkflowMutation, useWorkflowRunAttemptsQuery, useWorkflowRunQuery, useWorkflowRunsInfiniteQuery, type WorkflowRunFilters, workflowRunsQueryKeys, } from './hooks/api/workflow-runs.js';
3
+ export { type FireManualWorkflowVariables, fireManualWorkflow, useCancelWorkflowRunMutation, useFireManualWorkflowMutation, useWorkflowRunAttemptsQuery, useWorkflowRunQuery, useWorkflowRunsInfiniteQuery, type WorkflowRunFilters, workflowRunAttemptsQueryOptions, workflowRunQueryOptions, workflowRunsInfiniteQueryOptions, workflowRunsQueryKeys, } from './hooks/api/workflow-runs.js';
4
4
  export { ProjectWorkflowsPage } from './pages/project-workflows-page.js';
5
5
  export { WorkflowRunPage } from './pages/workflow-run-page.js';
6
6
  //# sourceMappingURL=index.d.ts.map