fix(check): tighten lobster and webhook mutation types

This commit is contained in:
Vincent Koc
2026-04-06 21:02:47 +01:00
parent aa4cb43627
commit 87bcfe796f
2 changed files with 18 additions and 8 deletions

View File

@@ -175,8 +175,12 @@ function parseResumeFlowParams(params: Record<string, unknown>): ManagedFlowResu
}
function formatManagedFlowResult(result: ManagedFlowSuccessResult) {
const envelope =
result.envelope && typeof result.envelope === "object" && !Array.isArray(result.envelope)
? result.envelope
: { envelope: result.envelope };
const details = {
...result.envelope,
...envelope,
flow: result.flow,
mutation: result.mutation,
};

View File

@@ -334,15 +334,21 @@ function mapMutationResult(
return result;
}
function mapFlowMutationResult(result: {
applied: boolean;
code: string;
flow?: Parameters<typeof toFlowView>[0];
current?: Parameters<typeof toFlowView>[0];
}): unknown {
function mapFlowMutationResult(
result:
| {
applied: true;
flow: Parameters<typeof toFlowView>[0];
}
| {
applied: false;
code: string;
current?: Parameters<typeof toFlowView>[0];
},
): unknown {
return mapMutationResult(
result.applied
? { applied: true, flow: toFlowView(result.flow!) }
? { applied: true, flow: toFlowView(result.flow) }
: {
applied: false,
code: result.code,