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

Function issueToStub

apps/sim/connectors/jira/jira.ts:55–88  ·  view source on GitHub ↗

* Extracts common metadata fields from a Jira issue into an ExternalDocument * stub with deferred content. The contentHash is metadata-based so it is * identical whether produced during listing or full fetch.

(issue: Record<string, unknown>, domain: string)

Source from the content-addressed store, hash-verified

53 * identical whether produced during listing or full fetch.
54 */
55function issueToStub(issue: Record<string, unknown>, domain: string): ExternalDocument {
56 const fields = (issue.fields || {}) as Record<string, unknown>
57 const key = issue.key as string
58 const issueType = fields.issuetype as Record<string, unknown> | undefined
59 const status = fields.status as Record<string, unknown> | undefined
60 const priority = fields.priority as Record<string, unknown> | undefined
61 const assignee = fields.assignee as Record<string, unknown> | undefined
62 const reporter = fields.reporter as Record<string, unknown> | undefined
63 const project = fields.project as Record<string, unknown> | undefined
64 const labels = Array.isArray(fields.labels) ? (fields.labels as string[]) : []
65 const updated = (fields.updated as string) ?? ''
66
67 return {
68 externalId: String(issue.id),
69 title: `${key}: ${(fields.summary as string) || 'Untitled'}`,
70 content: '',
71 contentDeferred: true,
72 mimeType: 'text/plain',
73 sourceUrl: `https://${domain}/browse/${key}`,
74 contentHash: `jira:${issue.id}:${updated}`,
75 metadata: {
76 key,
77 issueType: issueType?.name,
78 status: status?.name,
79 priority: priority?.name,
80 assignee: assignee?.displayName,
81 reporter: reporter?.displayName,
82 project: project?.key,
83 labels,
84 created: fields.created,
85 updated: fields.updated,
86 },
87 }
88}
89
90/**
91 * Converts a fully-fetched Jira issue (with description and comments) into an

Callers 2

issueToFullDocumentFunction · 0.70
jira.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected