MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / loadAll

Method loadAll

packages/sync/src/data-source-manager.ts:57–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55 // ==================== Load / Save ====================
56
57 loadAll(): DataSource[] {
58 try {
59 const filePath = this.getConfigPath()
60 if (fs.existsSync(filePath)) {
61 const raw = fs.readFileSync(filePath, 'utf-8')
62 const parsed = JSON.parse(raw)
63
64 if (!isValidDataSourceArray(parsed)) {
65 this.logger.warn('[DataSource] Incompatible config format detected, returning empty.')
66 return []
67 }
68
69 for (const ds of parsed) {
70 if (!ds.pullLimit) ds.pullLimit = 1000
71 }
72 return parsed
73 }
74 } catch (err) {
75 this.logger.error('[DataSource] Failed to load config', err)
76 }
77 return []
78 }
79
80 private saveAll(sources: DataSource[]): void {
81 try {

Callers 12

getMethod · 0.95
addMethod · 0.95
updateMethod · 0.95
deleteMethod · 0.95
addSessionsMethod · 0.95
removeSessionMethod · 0.95
updateSessionMethod · 0.95
startTimerFunction · 0.45
initSchedulerFunction · 0.45
reloadTimerFunction · 0.45
registerApiHandlersFunction · 0.45
registerAutomationRoutesFunction · 0.45

Calls 5

getConfigPathMethod · 0.95
isValidDataSourceArrayFunction · 0.85
parseMethod · 0.80
warnMethod · 0.65
errorMethod · 0.65

Tested by

no test coverage detected