(state = {})
| 469 | } |
| 470 | |
| 471 | function normalizeAutoRunTimerPlanFromState(state = {}) { |
| 472 | const directPlan = normalizeAutoRunTimerPlan(state.autoRunTimerPlan); |
| 473 | if (directPlan) { |
| 474 | return directPlan; |
| 475 | } |
| 476 | |
| 477 | if (state.autoRunPhase !== 'scheduled') { |
| 478 | return null; |
| 479 | } |
| 480 | |
| 481 | const legacyScheduledAt = Number(state.scheduledAutoRunAt); |
| 482 | if (!Number.isFinite(legacyScheduledAt)) { |
| 483 | return null; |
| 484 | } |
| 485 | |
| 486 | return normalizeAutoRunTimerPlan({ |
| 487 | kind: AUTO_RUN_TIMER_KIND_SCHEDULED_START, |
| 488 | fireAt: legacyScheduledAt, |
| 489 | totalRuns: state.scheduledAutoRunPlan?.totalRuns ?? state.autoRunTotalRuns, |
| 490 | autoRunSkipFailures: state.scheduledAutoRunPlan?.autoRunSkipFailures ?? state.autoRunSkipFailures, |
| 491 | mode: state.scheduledAutoRunPlan?.mode, |
| 492 | }); |
| 493 | } |
| 494 | |
| 495 | function getAutoRunTimerPlanPhase(kind = '') { |
| 496 | return kind === AUTO_RUN_TIMER_KIND_SCHEDULED_START ? 'scheduled' : 'waiting_interval'; |
no test coverage detected