(value: unknown)
| 493 | } |
| 494 | |
| 495 | function sanitizeAppStore(value: unknown): AppStore { |
| 496 | const source = asRecord(value) |
| 497 | const windowSource = asRecord(source.window) |
| 498 | const codeSource = asRecord(source.code) |
| 499 | const httpSource = asRecord(source.http) |
| 500 | const notesSource = asRecord(source.notes) |
| 501 | const notificationsSource = asRecord(source.notifications) |
| 502 | const commandPaletteSource = asRecord(source.commandPalette) |
| 503 | const legacySizes = asRecord(source.sizes) |
| 504 | const codeLayoutSource = asRecord(codeSource.layout) |
| 505 | const httpLayoutSource = asRecord(httpSource.layout) |
| 506 | const notesLayoutSource = asRecord(notesSource.layout) |
| 507 | |
| 508 | return { |
| 509 | window: { |
| 510 | bounds: isRecord(windowSource.bounds) |
| 511 | ? windowSource.bounds |
| 512 | : isRecord(source.bounds) |
| 513 | ? source.bounds |
| 514 | : APP_STORE_DEFAULTS.window.bounds, |
| 515 | }, |
| 516 | ui: { |
| 517 | compactListMode: |
| 518 | typeof asRecord(source.ui).compactListMode === 'boolean' |
| 519 | ? Boolean(asRecord(source.ui).compactListMode) |
| 520 | : typeof source.compactListMode === 'boolean' |
| 521 | ? source.compactListMode |
| 522 | : APP_STORE_DEFAULTS.ui.compactListMode, |
| 523 | }, |
| 524 | code: { |
| 525 | selection: sanitizeCodeState( |
| 526 | Object.keys(asRecord(codeSource.selection)).length > 0 |
| 527 | ? codeSource.selection |
| 528 | : source.state, |
| 529 | ), |
| 530 | contentSort: sanitizeContentSort(codeSource.contentSort), |
| 531 | layout: { |
| 532 | mode: readEnum( |
| 533 | codeLayoutSource, |
| 534 | 'mode', |
| 535 | ['all-panels', 'list-editor', 'editor-only'] as const, |
| 536 | getLegacyCodeLayoutMode(asRecord(source.state)), |
| 537 | ), |
| 538 | tagsListHeight: (() => { |
| 539 | const raw = readNumber( |
| 540 | codeLayoutSource, |
| 541 | 'tagsListHeight', |
| 542 | readNumber( |
| 543 | legacySizes, |
| 544 | 'tagsListHeight', |
| 545 | LAYOUT_DEFAULTS.tags.height, |
| 546 | ), |
| 547 | ) |
| 548 | return raw < 100 ? LAYOUT_DEFAULTS.tags.height : raw |
| 549 | })(), |
| 550 | threePanel: |
| 551 | readOptionalNumberArray(codeLayoutSource, 'threePanel') |
| 552 | || readOptionalNumberArray(legacySizes, 'layout'), |
no test coverage detected