MCPcopy Index your code
hub / github.com/massCodeIO/massCode / sanitizeAppStore

Function sanitizeAppStore

src/main/store/module/app.ts:495–738  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

493}
494
495function 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'),

Callers 1

app.tsFile · 0.85

Calls 15

asRecordFunction · 0.90
isRecordFunction · 0.90
readEnumFunction · 0.90
readNumberFunction · 0.90
readOptionalNumberArrayFunction · 0.90
readOptionalNumberFunction · 0.90
sanitizeCodeStateFunction · 0.85
sanitizeContentSortFunction · 0.85
getLegacyCodeLayoutModeFunction · 0.85
sanitizeHttpStateFunction · 0.85
sanitizeNotesStateFunction · 0.85
getLegacyNotesLayoutModeFunction · 0.85

Tested by

no test coverage detected