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

Method add

packages/sync/src/data-source-manager.ts:95–117  ·  view source on GitHub ↗
(partial: {
    name?: string
    baseUrl: string
    token: string
    intervalMinutes: number
    pullLimit?: number
  })

Source from the content-addressed store, hash-verified

93 }
94
95 add(partial: {
96 name?: string
97 baseUrl: string
98 token: string
99 intervalMinutes: number
100 pullLimit?: number
101 }): DataSource {
102 const sources = this.loadAll()
103 const ds: DataSource = {
104 id: generateId('src'),
105 name: partial.name || '',
106 baseUrl: normalizeBaseUrl(partial.baseUrl),
107 token: partial.token,
108 intervalMinutes: partial.intervalMinutes,
109 pullLimit: partial.pullLimit || 1000,
110 enabled: true,
111 createdAt: Math.floor(Date.now() / 1000),
112 sessions: [],
113 }
114 sources.push(ds)
115 this.saveAll(sources)
116 return ds
117 }
118
119 update(id: string, updates: DataSourceUpdatable): DataSource | null {
120 const sources = this.loadAll()

Callers 15

resolveModeFunction · 0.45
handlerFunction · 0.45
registerAiLlmRoutesFunction · 0.45
buildChartPayloadFunction · 0.45
fetchMessageContextFunction · 0.45
getSegmentMessagesFunction · 0.45
getMessageContextFunction · 0.45
getSearchMessageContextFunction · 0.45
getRelationshipStatsFunction · 0.45
getMentionAnalysisFunction · 0.45

Calls 5

loadAllMethod · 0.95
saveAllMethod · 0.95
generateIdFunction · 0.70
normalizeBaseUrlFunction · 0.70
nowMethod · 0.45

Tested by

no test coverage detected