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

Function itemToDocument

apps/sim/connectors/webflow/webflow.ts:345–368  ·  view source on GitHub ↗

* Converts a Webflow CMS item to an ExternalDocument.

(
  item: WebflowItem,
  collectionId: string,
  collectionName: string
)

Source from the content-addressed store, hash-verified

343 * Converts a Webflow CMS item to an ExternalDocument.
344 */
345function itemToDocument(
346 item: WebflowItem,
347 collectionId: string,
348 collectionName: string
349): ExternalDocument {
350 const plainText = itemToPlainText(item, collectionName)
351 const lastModified = item.lastUpdated || item.lastPublished || item.createdOn || ''
352 const contentHash = `webflow:${item.id}:${lastModified}`
353 const title = extractItemTitle(item)
354 const slug = (item.fieldData?.slug as string) || ''
355
356 return {
357 externalId: `${collectionId}:${item.id}`,
358 title,
359 content: plainText,
360 mimeType: 'text/plain',
361 contentHash,
362 metadata: {
363 collectionName,
364 lastModified: item.lastUpdated || item.lastPublished || item.createdOn,
365 slug,
366 },
367 }
368}
369
370/**
371 * Fetches collection IDs for a site. If a specific collectionId is provided,

Callers 1

webflow.tsFile · 0.70

Calls 2

itemToPlainTextFunction · 0.85
extractItemTitleFunction · 0.85

Tested by

no test coverage detected