MCPcopy Create free account
hub / github.com/massCodeIO/massCode / registerIPC

Function registerIPC

src/main/ipc/index.ts:22–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20}
21
22export function registerIPC() {
23 registerDialogHandlers()
24 registerSystemHandlers()
25 registerPrettierHandlers()
26 registerFsHandlers()
27 registerThemeHandlers()
28 registerSpacesHandlers()
29 registerHttpHandlers()
30
31 ipcMain.on('main-menu:update-context', (_, payload: MainMenuContext) => {
32 updateMainMenu(payload)
33 })
34
35 ipcMain.handle('db:migrate-to-markdown', async (_, sqliteDbPath?: string) => {
36 const storagePath = store.preferences.get('storage.rootPath') as string
37 const dbPath
38 = typeof sqliteDbPath === 'string' && sqliteDbPath.trim()
39 ? sqliteDbPath
40 : `${storagePath}/massCode.db`
41
42 if (!isSqliteFile(dbPath)) {
43 throw new Error(
44 'No valid massCode.db found. '
45 + 'Select a massCode.db file from a previous version and try again.',
46 )
47 }
48
49 const { closeDB } = lazyRequire('../db') as typeof import('../db')
50 const { migrateSqliteToMarkdownStorage } = lazyRequire(
51 '../storage/providers/markdown',
52 ) as typeof import('../storage/providers/markdown')
53
54 try {
55 return migrateSqliteToMarkdownStorage(dbPath)
56 }
57 finally {
58 closeDB()
59 }
60 })
61}

Callers 1

index.tsFile · 0.90

Calls 13

registerDialogHandlersFunction · 0.90
registerSystemHandlersFunction · 0.90
registerPrettierHandlersFunction · 0.90
registerFsHandlersFunction · 0.90
registerThemeHandlersFunction · 0.90
registerSpacesHandlersFunction · 0.90
registerHttpHandlersFunction · 0.90
updateMainMenuFunction · 0.90
isSqliteFileFunction · 0.90
closeDBFunction · 0.85
handleMethod · 0.80

Tested by

no test coverage detected