( value: unknown, fieldName: string )
| 147 | * attribute indexed fields). Returns undefined for empty input. |
| 148 | */ |
| 149 | export function parseJsonPayloadMap( |
| 150 | value: unknown, |
| 151 | fieldName: string |
| 152 | ): Record<string, TemporalPayload> | undefined { |
| 153 | const parsed = parseJsonValue(value, fieldName) |
| 154 | if (parsed === undefined) return undefined |
| 155 | if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) { |
| 156 | throw new Error(`${fieldName} must be a JSON object`) |
| 157 | } |
| 158 | return Object.fromEntries( |
| 159 | Object.entries(parsed as Record<string, unknown>).map(([key, value]) => [ |
| 160 | key, |
| 161 | encodePayload(value), |
| 162 | ]) |
| 163 | ) |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * Decodes a single Temporal payload: `json/plain` and `json/protobuf` payloads are parsed |
no test coverage detected