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

Function fileToStub

apps/sim/connectors/google-docs/google-docs.ts:137–152  ·  view source on GitHub ↗

* Creates a lightweight stub from a Drive file entry. Content is deferred * and only fetched via getDocument for new or changed documents.

(file: DriveFile)

Source from the content-addressed store, hash-verified

135 * and only fetched via getDocument for new or changed documents.
136 */
137function fileToStub(file: DriveFile): ExternalDocument {
138 return {
139 externalId: file.id,
140 title: file.name || 'Untitled',
141 content: '',
142 contentDeferred: true,
143 mimeType: 'text/plain',
144 sourceUrl: file.webViewLink || `https://docs.google.com/document/d/${file.id}/edit`,
145 contentHash: `gdocs:${file.id}:${file.modifiedTime ?? ''}`,
146 metadata: {
147 modifiedTime: file.modifiedTime,
148 createdTime: file.createdTime,
149 owners: file.owners?.map((o) => o.displayName || o.emailAddress).filter(Boolean),
150 },
151 }
152}
153
154/**
155 * Builds the Drive API query string for listing Google Docs.

Callers 1

google-docs.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected