The canonical builders for JsonEnvelope values. Hosts that hand-craft envelopes would drift on the version field; these functions stamp envelopeVersion and unwrap engine NogginErrors into the wire payload for you.
function formatSuccess<T>(opts: {
data?: T;
verb?: string;
}): SuccessEnvelope<T>;
Type Parameters
Parameters
| Parameter | Type |
opts | { data?: T; verb?: string; } |
opts.data? | T |
opts.verb? | string |
Returns
SuccessEnvelope<T>
function formatError(opts: {
error: unknown;
verb?: string;
}): ErrorEnvelope;
Parameters
| Parameter | Type |
opts | { error: unknown; verb?: string; } |
opts.error | unknown |
opts.verb? | string |
Returns
ErrorEnvelope