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

Function buildQuery

apps/sim/connectors/google-drive/google-drive.ts:139–171  ·  view source on GitHub ↗
(sourceConfig: Record<string, unknown>)

Source from the content-addressed store, hash-verified

137}
138
139function buildQuery(sourceConfig: Record<string, unknown>): string {
140 const parts: string[] = ['trashed = false']
141
142 const parentsClause = buildDriveParentsClause(parseMultiValue(sourceConfig.folderId))
143 if (parentsClause) parts.push(parentsClause)
144
145 const fileType = (sourceConfig.fileType as string) || 'all'
146 switch (fileType) {
147 case 'documents':
148 parts.push("mimeType = 'application/vnd.google-apps.document'")
149 break
150 case 'spreadsheets':
151 parts.push("mimeType = 'application/vnd.google-apps.spreadsheet'")
152 break
153 case 'presentations':
154 parts.push("mimeType = 'application/vnd.google-apps.presentation'")
155 break
156 case 'text':
157 parts.push(`(${SUPPORTED_TEXT_MIME_TYPES.map((t) => `mimeType = '${t}'`).join(' or ')})`)
158 break
159 default: {
160 // Include Google Workspace files + plain text files, exclude folders
161 const allMimeTypes = [
162 ...Object.keys(GOOGLE_WORKSPACE_MIME_TYPES),
163 ...SUPPORTED_TEXT_MIME_TYPES,
164 ]
165 parts.push(`(${allMimeTypes.map((t) => `mimeType = '${t}'`).join(' or ')})`)
166 break
167 }
168 }
169
170 return parts.join(' and ')
171}
172
173function fileToStub(file: DriveFile): ExternalDocument {
174 return {

Callers 1

google-drive.tsFile · 0.70

Calls 4

buildDriveParentsClauseFunction · 0.90
parseMultiValueFunction · 0.90
joinMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected