MCPcopy Index your code
hub / github.com/simstudioai/sim / treeEntryToStub

Function treeEntryToStub

apps/sim/connectors/gitlab/gitlab.ts:294–316  ·  view source on GitHub ↗

* Builds a deferred stub for a repository file from a tree entry. Content is empty * and fetched lazily via getDocument for new/changed files only.

(
  apiBase: string,
  encodedProject: string,
  host: string,
  projectPath: string,
  ref: string,
  entry: GitLabTreeEntry
)

Source from the content-addressed store, hash-verified

292 * and fetched lazily via getDocument for new/changed files only.
293 */
294function treeEntryToStub(
295 apiBase: string,
296 encodedProject: string,
297 host: string,
298 projectPath: string,
299 ref: string,
300 entry: GitLabTreeEntry
301): ExternalDocument {
302 return {
303 externalId: `${FILE_PREFIX}${entry.path}`,
304 title: entry.name || entry.path,
305 content: '',
306 contentDeferred: true,
307 mimeType: 'text/plain',
308 sourceUrl: buildFileSourceUrl(apiBase, encodedProject, host, projectPath, ref, entry.path),
309 contentHash: buildFileContentHash(encodedProject, entry.path, entry.id),
310 metadata: {
311 contentType: 'file',
312 title: entry.name || entry.path,
313 path: entry.path,
314 },
315 }
316}
317
318/**
319 * Builds a repository-file document from a fetched (non-raw) file response. Returns

Callers 1

gitlab.tsFile · 0.85

Calls 2

buildFileSourceUrlFunction · 0.70
buildFileContentHashFunction · 0.70

Tested by

no test coverage detected