(value: unknown)
| 290 | } |
| 291 | |
| 292 | function isRemoteConnectionState(value: unknown): value is RemoteConnectionState { |
| 293 | if (!value || typeof value !== 'object' || Array.isArray(value)) return false; |
| 294 | const record = value as Record<string, unknown>; |
| 295 | return ( |
| 296 | record.version === 1 && |
| 297 | hasStringFields(record, [ |
| 298 | 'session', |
| 299 | 'remoteConfigPath', |
| 300 | 'remoteConfigHash', |
| 301 | 'tenant', |
| 302 | 'runId', |
| 303 | 'connectedAt', |
| 304 | 'updatedAt', |
| 305 | ]) && |
| 306 | hasOptionalStringFields(record, [ |
| 307 | 'leaseId', |
| 308 | 'leaseBackend', |
| 309 | 'leaseProvider', |
| 310 | 'deviceKey', |
| 311 | 'clientId', |
| 312 | ]) && |
| 313 | isOptionalRemoteConnectionDaemonState(record.daemon) |
| 314 | ); |
| 315 | } |
| 316 | |
| 317 | function hasStringFields(record: Record<string, unknown>, fields: string[]): boolean { |
| 318 | return fields.every((field) => typeof record[field] === 'string'); |
no test coverage detected