Original code
Input1
// Copyright 2026 Example Contributors. Licensed under MIT.2
export async function submit(orderId: string) {3
// Call the provider.4
// The provider may retry this request; keep processing idempotent.5
const result = await provider.submit(orderId);6
// We used to call the legacy API, but now use the provider.7
// A Map gives us fast access and is a very good choice here.8
const cache = new Map<string, string>();9
// Returns null when the provider fails.10
if (!result.ok) throw new Error('Provider failed');11
// Don't change this; it breaks things.12
cache.set(orderId, result.id);13
return cache;14
}