(sandboxId: string)
| 45 | * Throws if the sandboxId is not in the expected format. |
| 46 | */ |
| 47 | export function instanceIdFromSandboxId(sandboxId: string): string { |
| 48 | if (!isInstanceKeyedSandboxId(sandboxId)) { |
| 49 | throw new Error('Not an instance-keyed sandboxId (expected ki_ prefix, 35 chars)'); |
| 50 | } |
| 51 | const hex = sandboxId.slice(3); // strip "ki_" |
| 52 | return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Return the subject used to bucket image-version rollouts. |
no test coverage detected