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

Function validateProviderSupport

apps/sim/providers/attachments.ts:318–333  ·  view source on GitHub ↗
(
  attachment: Omit<PreparedProviderAttachment, 'providerMimeType' | 'dataUrl' | 'text'>,
  provider: AttachmentProvider,
  providerId: ProviderId | string
)

Source from the content-addressed store, hash-verified

316}
317
318function validateProviderSupport(
319 attachment: Omit<PreparedProviderAttachment, 'providerMimeType' | 'dataUrl' | 'text'>,
320 provider: AttachmentProvider,
321 providerId: ProviderId | string
322) {
323 const { filename, mimeType, contentType, extension } = attachment
324 const supportedLabel = PROVIDER_SUPPORTED_LABELS[provider]
325
326 const supported = isMimeTypeSupportedByProvider(provider, mimeType, contentType, extension)
327
328 if (!supported) {
329 throw new Error(
330 `File "${filename}" has MIME type "${mimeType}", which is not supported by provider "${providerId}". Supported attachments: ${supportedLabel}.`
331 )
332 }
333}
334
335export function prepareProviderAttachments(
336 files: UserFile[] | undefined,

Callers 1

Calls 1

Tested by

no test coverage detected