(value: unknown)
| 28 | } |
| 29 | |
| 30 | export function isLargeValueRef(value: unknown): value is LargeValueRef { |
| 31 | if (!value || typeof value !== 'object') return false |
| 32 | |
| 33 | const candidate = value as Record<string, unknown> |
| 34 | const id = candidate.id |
| 35 | const key = candidate.key |
| 36 | const executionId = candidate.executionId |
| 37 | |
| 38 | return ( |
| 39 | candidate[LARGE_VALUE_REF_MARKER] === true && |
| 40 | candidate.version === LARGE_VALUE_REF_VERSION && |
| 41 | typeof id === 'string' && |
| 42 | LARGE_VALUE_ID_PATTERN.test(id) && |
| 43 | typeof candidate.kind === 'string' && |
| 44 | (LARGE_VALUE_KINDS as readonly string[]).includes(candidate.kind) && |
| 45 | typeof candidate.size === 'number' && |
| 46 | Number.isFinite(candidate.size) && |
| 47 | candidate.size > 0 && |
| 48 | (executionId === undefined || typeof executionId === 'string') && |
| 49 | (key === undefined || |
| 50 | (typeof key === 'string' && |
| 51 | isLargeValueStorageKey(key, id, executionId as string | undefined))) |
| 52 | ) |
| 53 | } |
| 54 | |
| 55 | export function containsLargeValueRef( |
| 56 | value: unknown, |
no test coverage detected