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

Function getFieldText

apps/sim/connectors/jsm/jsm.ts:150–160  ·  view source on GitHub ↗

* Extracts a plain-text value for a given request field id (e.g. `summary`, * `description`) from a request's `requestFieldValues`. The JSM API returns * `value` either as a plain string (wiki markup) or, for some rich-text fields, * as an ADF document — both are handled.

(request: JsmRequest, fieldId: string)

Source from the content-addressed store, hash-verified

148 * as an ADF document — both are handled.
149 */
150function getFieldText(request: JsmRequest, fieldId: string): string {
151 const field = request.requestFieldValues?.find((f) => f.fieldId === fieldId)
152 if (!field) return ''
153 const { value } = field
154 if (typeof value === 'string') return value
155 if (value && typeof value === 'object') {
156 const adf = extractAdfText(value)
157 if (adf) return adf
158 }
159 return ''
160}
161
162/**
163 * Resolves the best available "change indicator" timestamp for a request.

Callers 2

requestToStubFunction · 0.85
buildContentFunction · 0.85

Calls 1

extractAdfTextFunction · 0.90

Tested by

no test coverage detected