The best way to control Claude Code, Codex and more from any computer or phone

main
ts 22 lines 849 Bytes
Raw
1 import * as Redacted from "effect/Redacted";
2
3 /**
4 * Distilled decodes `smithy.api#sensitive` strings to `Redacted<string>` on
5 * responses while accepting plain strings on requests. Attributes expose
6 * plain strings, so unwrap defensively.
7 */
8 export const unredact = (
9 value: string | Redacted.Redacted<string> | undefined,
10 ): string | undefined =>
11 value === undefined ? undefined : Redacted.isRedacted(value) ? Redacted.value(value) : value;
12
13 /**
14 * Audit Manager tag maps arrive as `{ [key]: string | undefined }` — narrow
15 * to the `Record<string, string>` shape the Tags helpers expect.
16 */
17 export const toTagRecord = (
18 tags: { [key: string]: string | undefined } | undefined,
19 ): Record<string, string> =>
20 Object.fromEntries(
21 Object.entries(tags ?? {}).filter((entry): entry is [string, string] => entry[1] !== undefined),
22 );