Reading tickets
safran.tickets is one API over every tracker in the profile. You pass whatever a person would paste (a key, a URL, a tracker's short form); Safran finds the tracker it belongs to and returns the same neutral shapes whichever product is behind it. This page covers reading one ticket, the reference forms, paging, search across trackers and what happens when a tracker cannot do something.
Read a ticket with comments and links
import { createSafran } from "@safran/core";
await using safran = await createSafran();
const ticket = await safran.tickets.get("PAY-1423");
console.log(`${ticket.key} ${ticket.title}`);
console.log(`${ticket.type} · ${ticket.status} (${ticket.statusCategory}) · ${ticket.assignee?.name ?? "unassigned"}`);
console.log(ticket.description);
const comments = await safran.tickets.comments("PAY-1423", { limit: 20 });
for (const comment of comments.items) {
console.log(`- ${comment.author?.name ?? "unknown"}: ${comment.body}`);
}
for (const link of await safran.tickets.links("PAY-1423")) {
if (link.kind === "ticket") console.log(`${link.relation} ${link.ticket?.key} ${link.ticket?.title}`);
else console.log(`${link.relation} ${link.url}${safran.docs.canFetch(link.url ?? "") ? " (fetchable)" : ""}`);
}$ bun read-ticket.ts
PAY-1423 Kısmi iade işlemi İstanbul şubesinde başarısız oluyor
Bug · Done (done) · Ayşe Yılmaz
Müşteri kısmi iade istediğinde ödeme sağlayıcısı hata döndürüyor.
Beklenen: iade tutarı sipariş tutarından küçükse işlem tamamlanmalı.
- Ayşe Yılmaz: Sağlayıcı yanıtını inceledim, yuvarlama hatası görünüyor.
- Çağrı Öztürk: Düzeltme canlıya alındı.
blocks PAY-1500 Refund webhook retries are not idempotent
mentioned in https://wiki.acme.test/refundsThree things to notice:
descriptionand comment bodies are Markdown. Trackers that store rich formats convert them in the connector.statusis the tracker's own word (Done,Canlıda);statusCategoryis the neutraltodo,in_progressordone. Branch on the category.- A
weblink is a URL the ticket points at.docs.canFetchtells you offline whether a configured doc source can fetch it.
References
Every method takes a ref: a string in any form one of the profile's trackers recognises. Which forms exist is up to each connector (a key such as PAY-1423, the ticket's URL, a short form such as #412); the connector pages list them. Recognition is offline: it is a string match, not a lookup.
tickets.resolve(ref) shows the routing without fetching anything. It returns the tracker and the canonical key:
import { createSafran, isSafranError } from "@safran/core";
await using safran = await createSafran();
const { tracker, key } = safran.tickets.resolve("https://jira.acme.example/browse/pay-1423");
console.log(tracker.id, key);
console.log(safran.tickets.resolve("jira:PAY-1423").key);
try {
safran.tickets.resolve("OPS-7");
} catch (error) {
if (!isSafranError(error, "NOT_FOUND")) throw error;
console.log(error.format());
}$ bun resolve.ts
jira PAY-1423
PAY-1423
No tracker recognises "OPS-7" as a ticket reference
→ Configured trackers: jira (PAY, MOB, WEB).The rules, in order:
- The reference is trimmed. An empty one is
INVALID_INPUT. - Explicit form
<trackerId>:<ref>. When the part before the first colon is the id of a tracker in the profile, only that tracker is asked. If it does not recognise the rest, the error isNOT_FOUND. A URL is never read as this form (https:is not a tracker id). - Otherwise every tracker is asked. No match is
NOT_FOUND, with the configured trackers and their projects in the hint. One match wins. - Several matches. The tracker whose profile entry lists the key's project under
projectswins. If none or more than one does, the error isINVALID_INPUTanddetails.trackersholds the candidate ids; use the explicit form, or declare the project under one tracker.
With two trackers that both use PROJECT-123 keys, declaring projects on each entry is what makes plain keys unambiguous. See multiple sources.
The ticket methods
| Method | Returns | Capability needed |
|---|---|---|
get(ref, options?) | Ticket | none: every tracker has it |
comments(ref, options?) | Page<Comment> | comments |
attachments(ref, options?) | Attachment[] | attachments |
attachment(ref, attachmentId, options?) | AttachmentContent | attachments |
links(ref, options?) | TicketLink[] | links |
history(ref, options?) | Page<HistoryEntry> | history |
search(query, options?) | TicketSearchResult | search |
children(ref, options?) | Page<TicketChild> | children |
family(ref, options?) | TicketFamily | none; a missing part is listed in unsupported |
linkedWork(ref, options?) | LinkedWork | links |
changes(ref, options?) | TicketChanges | history or comments |
worklogs(ref, options?) | Page<Worklog> | worklogs |
time(ref, options?) | TicketTime | none; a missing part is listed in unsupported |
resolve(ref) | ResolvedTicketRef | none; synchronous and offline |
All of them except resolve accept a signal in their options (cancellation). A ticket that does not exist is NOT_FOUND from the tracker.
/**
* Ticket access across every tracker in the profile. `ref` is whatever a person would
* paste: a key ("PAY-1423"), a URL, or a tracker-specific short form ("#412").
* Methods a tracker does not support throw UNSUPPORTED.
*
* `get` also fills `Ticket.designLinks` (kit `extractDesignLinks` over the description, the text
* fields and the web links); connectors do not. `search` with `createdSince` leaves out, with a
* warning, every tracker that lacks the `created-since` capability.
*/
export interface TicketsApi extends TicketDepthApi {
/** Finds the tracker a reference belongs to. Throws NOT_FOUND when none recognises it. */
resolve(ref: string): ResolvedTicketRef;
get(ref: string, options?: CallOptions): Promise<Ticket>;
comments(ref: string, options?: PageOptions): Promise<Page<Comment>>;
attachments(ref: string, options?: CallOptions): Promise<Attachment[]>;
attachment(ref: string, attachmentId: string, options?: CallOptions): Promise<AttachmentContent>;
links(ref: string, options?: CallOptions): Promise<TicketLink[]>;
history(ref: string, options?: PageOptions): Promise<Page<HistoryEntry>>;
search(query: TicketSearchQuery, options?: TicketSearchOptions): Promise<TicketSearchResult>;
}defined in packages/core/src/api.ts
Comments and history
Both are paged. limit is the page size and cursor continues where the previous page ended; the default page size is the connector's own. The rules for limit and cursors are the same everywhere and are described in pagination.
import { createSafran, type Comment } from "@safran/core";
await using safran = await createSafran();
const all: Comment[] = [];
let cursor: string | undefined;
do {
const page = await safran.tickets.comments("PAY-1423", { limit: 50, ...(cursor === undefined ? {} : { cursor }) });
all.push(...page.items);
cursor = page.nextCursor;
} while (cursor !== undefined);
console.log(`${all.length} comments`);A HistoryEntry is one field change: at, field, and from / to as the tracker words them.
Attachments
attachments lists metadata; attachment downloads one by the id from that list and returns the same metadata plus data as a Uint8Array.
import { createSafran } from "@safran/core";
await using safran = await createSafran();
const files = await safran.tickets.attachments("PAY-1423");
for (const file of files) console.log(file.id, file.filename, file.mimeType, file.sizeBytes);
const [first] = files;
if (first) {
const content = await safran.tickets.attachment("PAY-1423", first.id);
await Bun.write(`/work/acme/tmp/${first.filename}`, content.data);
}Requirements often arrive as a spreadsheet. readSpreadsheet from @safran/kit turns an .xlsx attachment into rows of cell text without any dependency; isSpreadsheet decides from the bytes, never from the file name. Delimited text is read only when you say so (format: "csv" or "tsv"). Formulas are not evaluated (the cached value is used), dates become ISO dates, hidden sheets are left out, and .xls / .ods are not read. Cell text is third-party text.
import { createSafran } from "@safran/core";
import { isSpreadsheet, readSpreadsheet } from "@safran/kit";
await using safran = await createSafran();
const files = await safran.tickets.attachments("PAY-1423");
for (const file of files) {
const content = await safran.tickets.attachment("PAY-1423", file.id);
if (!isSpreadsheet(content.data)) continue;
const workbook = await readSpreadsheet(content.data, { maxRows: 100 });
for (const sheet of workbook.sheets) {
console.log(`${file.filename} / ${sheet.name}: ${sheet.totalRows} rows × ${sheet.totalColumns} columns${sheet.truncated ? " (cut)" : ""}`);
for (const row of sheet.rows.slice(0, 5)) console.log(row.join(" | "));
}
}Links
A TicketLink is either kind: "ticket" (another ticket, in ticket, as a TicketSummary) or kind: "web" (a remote link, in url and title). relation is the tracker's wording: blocks, is blocked by, child, relates to.
Depth: family, linked work, changes, time
Four methods answer the questions people ask before they start work on a ticket, each in one call. They are built from the same reads as above, so they work on every tracker; a part a tracker cannot provide is named in unsupported and the rest is still returned.
import { createSafran } from "@safran/core";
await using safran = await createSafran();
const hours = (seconds: number | undefined): string => (seconds === undefined ? "-" : `${seconds / 3600} h`);
// Where the ticket sits: parent, children, siblings, with progress.
const family = await safran.tickets.family("PAY-10");
const progress = family.siblingProgress;
console.log(`parent ${family.parent?.key ?? "none"}: ${progress ? `${progress.done}/${progress.total} done` : "no siblings"}`);
for (const sibling of family.siblings) console.log(` ${sibling.key} ${sibling.status ?? "?"} ${sibling.title}`);
// Can work start, and what else must be read first?
const linked = await safran.tickets.linkedWork("PAY-10");
console.log(`verdict: ${linked.verdict}`);
for (const reason of linked.reasons ?? []) console.log(` ${reason}`);
for (const other of linked.counterparts) console.log(` counterpart (${other.side}): ${other.key} ${other.title}`);
// What happened since the ticket last changed status.
const changes = await safran.tickets.changes("PAY-10");
console.log(`since ${changes.since ?? "the beginning"}: ${changes.digest.scopeChanges.length} scope change(s), ${changes.comments.length} new comment(s)`);
for (const back of changes.digest.returns) console.log(` sent back: ${back.from} → ${back.to} by ${back.by?.name ?? "unknown"}`);
// Estimate, logged work and sprints.
const time = await safran.tickets.time("PAY-10");
console.log(`estimate ${hours(time.tracking?.originalEstimateSeconds)}, spent ${hours(time.tracking?.spentSeconds)}`);
for (const row of time.loggedByPerson) console.log(` ${row.person}: ${hours(row.seconds)}`);
console.log(`sprints: ${time.iterations.map((iteration) => iteration.name).join(" → ")}`);
// Design files the ticket points at: ids for a design tool, never fetched by Safran.
const ticket = await safran.tickets.get("PAY-10");
for (const design of ticket.designLinks ?? []) console.log(`design: ${design.kind} file ${design.fileKey ?? "-"} node ${design.nodeId ?? "-"}`);Captured with Safran's in-memory test connectors and acme's data:
$ bun ticket-depth.ts
parent PAY-1: 1/3 done
PAY-12 Done Refund ledger migration
PAY-13 To Do Refund receipt e-mail
verdict: blocked
PAY-11 blocks this ticket and is not done (In Review).
counterpart (mobile): PAY-14 [iOS] Kısmi iade tutarı yuvarlanıyor
since 2026-03-12T09:00:00.000Z: 1 scope change(s), 1 new comment(s)
sent back: In Review → In Progress by Çağrı Öztürk
estimate 8 h, spent 4.5 h
Ayşe Yılmaz: 3 h
Çağrı Öztürk: 1.5 h
sprints: Sprint 41 → Sprint 42
design: figma file AbC123xyz node 12:345Family
family returns the parent above, the direct children below and the siblings beside (the parent's other children), each member with its current status, assignee and last update. childProgress and siblingProgress count members per status category (todo, inProgress, done, unknown); siblingProgress includes the ticket itself, so it is the progress of the parent. limit caps children and siblings each (default DEFAULT_FAMILY_LIMIT, 40; at most 200), and childrenTruncated / siblingsTruncated say when there were more: the counts then cover only what was returned. children(ref) is the plain paged list, and is UNSUPPORTED without the children capability.
Linked work
linkedWork digests a ticket's links for "can I start, and what else must I read". Each linked ticket gets a role decided from the tracker's relation wording (blocker, blocks, duplicate, related) and its current status, read now.
verdict | When |
|---|---|
blocked | At least one blocker is not done. |
not_blocked | Every blocker is done, or there is none. |
unknown | A blocker's status could not be read. |
reasons has one line per blocker that decided it, with keys and status names only. Unfinished blockers and counterparts carry their description as body (at most expandBodies of them, default 3, each cut to bodyChars, default 2,000 characters). At most DEFAULT_LINKED_WORK_MAX_TICKETS (50) linked tickets are re-read; the rest keep the link's own snapshot.
Counterparts are not links. When the profile has tickets.title_prefixes and the tracker can search, linkedWork looks for tickets whose title is the same once the prefix is removed, with a prefix of another side: the [iOS] ticket of a [BE] ticket. Pass counterparts: false to skip that search.
Changes
changes answers "what happened to this ticket since …". since is an ISO date or date-time, a duration back from now (36h, 3d, 2w), or "last_status_change", the default. The result holds a HistoryDigest and the comments created inside the window.
The digest reads the change log the way a person does: statusPath (every stay in a status, with durations), timeInStatus, returns (moves back to a status the ticket had already been in: reopened, sent back from review), scopeChanges (title, description, estimate, type), iterationChanges (sprint moves), and counts for everything else. statusPath and timeInStatus always cover the whole history read; the other parts cover the window. historyComplete is false when the history was longer than historyLimit (default 500 entries). The same digest is available without a tracker call as summariseHistory(entries, options).
Time
time puts the tracker's own time summary (tracking: original estimate, remaining, spent, in seconds), the worklogs (oldest first, with loggedByPerson sums) and the iterations the ticket was in (oldest first, the current one last) in one answer. It is never UNSUPPORTED as a whole: of worklogs, time-tracking and iterations, what the tracker lacks is listed in unsupported. A value the tracker does not have is absent, never 0. worklogs(ref) is the plain paged list.
Design links
get fills Ticket.designLinks from the description, the text fields and the web links: Figma and Miro links with their file key and node id (in API form, 12:345), and links to other known design tools as they are. Safran never fetches a design; it recognises the link and hands the ids on, for an agent that also has a design tool connected. extractDesignLinks(text) is the same recognition as a function.
/** The wave 2 additions to `TicketsApi`, kept apart so the two halves can be built separately. */
export interface TicketDepthApi {
/** Direct children, one page. UNSUPPORTED without the `children` capability. */
children(ref: string, options?: PageOptions): Promise<Page<TicketChild>>;
/** Parent, children and siblings with progress. Works on any tracker; missing parts are listed in `unsupported`. */
family(ref: string, options?: TicketFamilyOptions): Promise<TicketFamily>;
/** The links digest. UNSUPPORTED without the `links` capability. */
linkedWork(ref: string, options?: LinkedWorkOptions): Promise<LinkedWork>;
/** One page of worklogs. UNSUPPORTED without the `worklogs` capability. */
worklogs(ref: string, options?: PageOptions): Promise<Page<Worklog>>;
/** Time tracking, worklogs and iterations together; never UNSUPPORTED as a whole. */
time(ref: string, options?: TicketTimeOptions): Promise<TicketTime>;
/** The change digest. UNSUPPORTED when the tracker has neither `history` nor `comments`. */
changes(ref: string, options?: TicketChangesOptions): Promise<TicketChanges>;
}
/** A ticket's place in its hierarchy: the parent above, the children below, the siblings beside. */
export interface TicketFamily {
ticket: TicketSummary;
parent?: TicketSummary;
/** Direct children, in the tracker's order. */
children: FamilyMember[];
/** Counted over the children RETURNED; exact when `childrenTruncated` is false. */
childProgress: FamilyProgress;
/** True when the ticket has more children than `limit`. */
childrenTruncated: boolean;
/** The parent's other children (this ticket is not among them). Empty without a parent. */
siblings: FamilyMember[];
/** Counted over the siblings returned PLUS this ticket: the progress of the parent. */
siblingProgress?: FamilyProgress;
siblingsTruncated: boolean;
/** Parts the tracker cannot provide ("children"). The rest is still returned. */
unsupported: string[];
}
/**
* The links of a ticket, digested for the question "can I start, and what else must I read".
* `verdict` is `blocked` when at least one blocker is not done, `not_blocked` when every
* blocker is done or there is none, `unknown` when a blocker's status could not be read.
*/
export interface LinkedWork {
ticket: TicketSummary;
verdict: "blocked" | "not_blocked" | "unknown";
/** Why the verdict is what it is, one line per blocker that decided it. Keys and status names only: no ticket titles or bodies. */
reasons?: string[];
/** Blockers that are not done, the ones with a body first. */
unfinishedBlockers: LinkedTicket[];
/** Blockers that are done. */
finishedBlockers: LinkedTicket[];
/** Tickets waiting for this one. */
blocks: LinkedTicket[];
related: LinkedTicket[];
counterparts: CounterpartTicket[];
/** Web links (wiki pages, design files) as the tracker gave them. */
web: { relation: string; url: string; title?: string }[];
/** Linked tickets that could not be read now; their link data is still in the lists above. */
warnings?: SafranWarning[];
unsupported: string[];
}
/** "What happened to this ticket since …", in one answer. */
export interface TicketChanges {
ticket: TicketSummary;
/** Start of the window as an ISO time. Absent when it could not be determined (no status change on record): the digest then covers everything read. */
since?: string;
digest: HistoryDigest;
/** False when the history was longer than `historyLimit`: older entries were not read, so durations of early statuses may be missing. */
historyComplete: boolean;
/** Comments created inside the window, oldest first. */
comments: Comment[];
commentsTruncated: boolean;
/** Of "history", "comments": what the tracker cannot provide. */
unsupported: string[];
}
/** Estimate, logged work and scheduling of one ticket, each part present when the tracker has it. */
export interface TicketTime {
ticket: TicketSummary;
tracking?: TimeTracking;
/** Oldest first. */
worklogs: Worklog[];
/** True when the ticket has more worklogs than were read; the sums below then cover only those read. */
worklogsTruncated: boolean;
/** Seconds logged per person, most first, over the worklogs read. */
loggedByPerson: { person: string; seconds: number }[];
/** Oldest first, current last. */
iterations: Iteration[];
/** Of "worklogs", "time-tracking", "iterations": what the tracker cannot provide. */
unsupported: string[];
}defined in packages/core/src/api.ts
Search across trackers
tickets.search sends one neutral query to every tracker that can search and merges the answers into one page. Each item is a TicketSummary tagged with the tracker it came from.
import { createSafran } from "@safran/core";
await using safran = await createSafran();
const result = await safran.tickets.search({ text: "refund", projects: ["PAY"], statusCategories: ["todo", "in_progress"] }, { limit: 20 });
for (const item of result.items) console.log(`${item.tracker} ${item.key} [${item.status}] ${item.title}`);
for (const warning of result.warnings ?? []) console.warn(`${warning.source}: ${warning.code}: ${warning.message}`);
if (result.nextCursor !== undefined) console.log("more results: pass nextCursor back as `cursor`");$ bun search-tickets.ts
jira PAY-1500 [In Progress] Refund webhook retries are not idempotentThe query
| Field | Type | Meaning |
|---|---|---|
text | string | Free text matched against title and description. How it is matched (words, phrases, stemming) is the tracker's search. |
projects | string[] | Project keys. Also decides which trackers are asked (below). |
statusCategories | StatusCategory[] | Any of todo, in_progress, done. |
updatedSince | string | ISO date; only tickets updated at or after it. |
createdSince | string | ISO date; only tickets created at or after it. Needs the created-since capability: a tracker without it is left out of the search and named in warnings. |
assignee | string | Only tickets assigned to this person: a display name, a username or an e-mail address as the tracker knows them, or "me" for the owner of the tracker's token. Needs the assignee-filter capability, under the same rule as createdSince. |
native | string | A query in the tracker's own language (JQL, WIQL, a hosted search syntax). Needs the native-query capability. |
The options
| Option | Default | Meaning |
|---|---|---|
tracker | every tracker that can search | Restrict the search to one tracker entry id. |
limit | 50 (DEFAULT_TICKET_SEARCH_LIMIT) | Total page size across all trackers. Above 500 it is clamped. |
cursor | none | nextCursor of the previous page, passed back with the same query and options. |
signal | none | Cancels the search. |
Which trackers are asked
- With
tracker: only that one. An unknown id isINVALID_INPUT; a tracker withoutsearch(or withoutnative-querywhennativeis set) isUNSUPPORTED. - Without it: every tracker with the
searchcapability. If none has it, the call throwsUNSUPPORTED. - With
native: only trackers withnative-query. A native query is written for one product, so combine it withtracker. - With
projects: a tracker whose profile entry declares itsprojectsand has none of the wanted ones is not asked. A tracker that declares no projects is always asked.
How a page is filled
Each tracker that still has results gets an equal share of limit; a remainder goes to the trackers listed first in the profile. With limit: 20 and three trackers, the shares are 7, 7 and 6. A tracker that returns fewer than its share does not hand the rest to the others, so a page can be shorter than limit while nextCursor is still present. The end of the results is nextCursor === undefined, never a short page. With more trackers than limit, the ones beyond it wait in the cursor for a later page.
Items are grouped by tracker in profile order. There is no cross-tracker ranking: scores of different products are not comparable.
Warnings: a page that does not cover every tracker
A search does not fail because one tracker did. warnings is present when the page leaves a tracker out, one entry per tracker:
code | Meaning |
|---|---|
UNSUPPORTED | The tracker cannot run this search (no search, or no native-query for a native query) and was not asked. |
| any other code | The tracker failed with that code (AUTH_FAILED, RATE_LIMITED, UPSTREAM, …). Its error message is in message. |
A failed tracker is dropped from the cursor, so later pages continue with the others instead of failing again. UNSUPPORTED warnings are repeated on every page of a paged search. When every asked tracker fails, the call throws: the single tracker's own error, or one error listing each tracker's message.
export interface TicketSearchResult extends Page<TicketSummary & { tracker: string }> {
/**
* Present when the page does not cover every tracker: one entry per tracker that failed (with
* the code of its failure) or was left out because it cannot run this search (UNSUPPORTED).
* The items of the others are still returned.
*/
warnings?: SafranWarning[];
}
/** Something that did not stop a call but made its answer incomplete or ambiguous. */
export interface SafranWarning {
/** Profile entry id of the tracker or code host the warning is about. */
source: string;
code: SafranErrorCode;
message: string;
}defined in packages/core/src/api.ts
When a tracker cannot do it
Optional features are capabilities. Calling a method the ticket's tracker does not support throws UNSUPPORTED with the tracker's capabilities in the hint and details.tracker / details.method for programs:
import { createSafran, isSafranError, type Attachment } from "@safran/core";
await using safran = await createSafran();
async function attachmentsOf(ref: string): Promise<Attachment[]> {
// Check first when you can: no round trip, no exception.
const { tracker } = safran.tickets.resolve(ref);
if (!tracker.capabilities.has("attachments")) return [];
return safran.tickets.attachments(ref);
}
try {
console.log(await safran.tickets.history("PAY-1423"));
} catch (error) {
// Or catch: the code is stable, the message is for people.
if (!isSafranError(error, "UNSUPPORTED")) throw error;
console.log(error.format());
}
console.log((await attachmentsOf("PAY-1423")).length);What the built-in trackers support:
| Capability | jira | azure-boards | linear | github-issues |
|---|---|---|---|---|
comments | yes | yes | yes | yes |
attachments | yes | yes | no | no |
links | yes | yes | yes | yes |
history | yes | yes | yes | yes |
search | yes | yes | yes | yes |
native-query | yes | yes | no | yes |
created-since | yes | yes | yes | yes |
assignee-filter | yes | yes | yes | yes |
children | yes | yes | yes | yes |
worklogs | yes | no | no | no |
time-tracking | yes | yes | no | no |
iterations | yes | yes | yes | yes |
write:comment | yes | yes | yes | yes |
write:create-child | yes | yes | yes | yes |
A write: capability says the connector can do it with its API. Whether Safran may is decided by the profile's writes section; see writes.
The domain types
export interface Ticket extends TicketSummary {
/** Id of the tracker entry in the profile this ticket came from. */
tracker: string;
url: string;
/** Project / team / repository key the ticket belongs to. */
project: string;
/** Markdown. Rich formats (ADF, HTML) are converted by the tracker plugin. */
description: string;
priority?: string;
labels: string[];
assignee?: Person;
reporter?: Person;
parent?: TicketSummary;
createdAt?: string;
updatedAt?: string;
resolvedAt?: string;
/**
* Tracker-specific extras that have no neutral home (story points, sprint, custom fields).
* Keys are human-readable field names; values are JSON-serialisable.
*/
fields: Record<string, unknown>;
/**
* Design files the ticket points at (see `extractDesignLinks`). NOT a connector duty: a
* connector leaves it unset and `@safran/core` fills it in `tickets.get` from the description,
* the text fields and the web links, so every tracker gets it the same way. Absent when none
* was found.
*/
designLinks?: DesignLink[];
}
/** Short reference to a ticket, as it appears in links, parents and search results. */
export interface TicketSummary {
key: string;
title: string;
url?: string;
type?: string;
status?: string;
statusCategory?: StatusCategory;
/**
* Who has the ticket, when the list this summary came from carries it (search results and
* children do, where the tracker's list API returns it). Absent means "not known here", not
* "unassigned": a link target or a parent usually comes without it.
*/
assignee?: Person;
}
export interface Person {
id?: string;
name: string;
email?: string;
}defined in packages/kit/src/types.ts
fields holds what has no neutral home: story points, sprint, the custom fields a connector is configured to copy. Keys are the field names people see, not vendor ids.
export interface Comment {
id: string;
author?: Person;
/** Markdown. */
body: string;
createdAt?: string;
updatedAt?: string;
}
export interface TicketLink {
/** `ticket` points at another ticket; `web` is a remote link (wiki page, design file, PR). */
kind: "ticket" | "web";
/** Relation as the tracker words it: "blocks", "is blocked by", "child", "relates to", … */
relation: string;
ticket?: TicketSummary;
url?: string;
title?: string;
}
export interface HistoryEntry {
at: string;
author?: Person;
field: string;
from?: string;
to?: string;
}
export interface Attachment {
id: string;
filename: string;
mimeType?: string;
sizeBytes?: number;
createdAt?: string;
author?: Person;
}defined in packages/kit/src/types.ts
/** A child of a ticket: a sub-task, a story of an epic, a child work item, a sub-issue. */
export interface TicketChild extends TicketSummary {
updatedAt?: string;
/**
* The child's size, when the tracker's children listing returns it in the same request (the
* `estimates` capability does not promise it here: it is about the work listings). Absent
* otherwise, never an invented 0, so a sum over children may cover only some of them.
*/
estimate?: WorkEstimate;
}
/** One logged piece of work. */
export interface Worklog {
id: string;
author?: Person;
/** ISO time the work started, when the tracker records it. */
startedAt?: string;
/** Always seconds, whatever unit the tracker stores (Azure Boards keeps hours). Never negative. */
seconds: number;
/** Markdown, like every other body. */
note?: string;
}
/**
* The tracker's own time summary for one ticket. Every field is absent when the tracker has no
* value for it; a connector never invents a 0. Seconds, converted by the connector.
*/
export interface TimeTracking {
originalEstimateSeconds?: number;
remainingSeconds?: number;
spentSeconds?: number;
}
/** A sprint, cycle, iteration or milestone: whatever the tracker schedules work in. */
export interface Iteration {
id: string;
name: string;
state?: "future" | "active" | "closed";
startsAt?: string;
endsAt?: string;
/** Board or team the iteration belongs to, when the tracker has such a thing. */
board?: string;
}
export interface DesignLink {
/** The URL as written, without trailing punctuation. */
url: string;
kind: DesignLinkKind;
/** What the link opens, when the URL says: a design file, a clickable prototype, a whiteboard, a slide deck. */
surface?: "design" | "prototype" | "board" | "slides";
/** Figma: the file key (the branch key for a branch URL). Miro: the board id. Absent for `other`. */
fileKey?: string;
/** Figma: the node id in API form (`12:345`, never the URL's `12-345`). Miro: the widget the link jumps to. */
nodeId?: string;
/** The file's name as the URL spells it, decoded. Third-party text: wrap it before showing it to a model. */
name?: string;
}defined in packages/kit/src/types.ts, packages/kit/src/design-links.ts
export interface TicketSearchQuery {
/** Free text matched against title and description. */
text?: string;
projects?: string[];
statusCategories?: StatusCategory[];
/** ISO date; only tickets updated at or after it. */
updatedSince?: string;
/**
* ISO date; only tickets created at or after it. Needs the `created-since` capability: a
* tracker without it must never be handed this field, because it would ignore it and answer
* with tickets of any age. Callers check the capability, as they do for `native`.
*/
createdSince?: string;
/**
* Only tickets assigned to this person: a display name, a username or an e-mail address as the
* tracker knows them, or `ASSIGNEE_ME` ("me") for the owner of the tracker's token. Needs the
* `assignee-filter` capability, under the same rule as `createdSince`: a tracker without it is
* never handed the field. What a name matches is the tracker's own rule (GitHub only knows
* logins); a name the tracker does not know is its `INVALID_INPUT`, or simply no results.
*/
assignee?: string;
/** Tracker-native query (JQL, WIQL, GitHub search syntax). Needs the `native-query` capability. */
native?: string;
}
export interface TicketSearchOptions extends PageOptions {
/** Restrict to one tracker entry id. Default: every tracker that supports search. */
tracker?: string;
}defined in packages/kit/src/types.ts, packages/core/src/api.ts
Common mistakes
| Symptom | Cause |
|---|---|
NOT_FOUND: No tracker recognises "…" | The reference has no form any configured tracker accepts. Check the key's project against projects in the profile; the hint lists them. |
INVALID_INPUT: "…" could belong to several trackers | Two trackers accept the shape and the profile does not say who owns the project. Use <trackerId>:<ref> or declare projects. |
A page shorter than limit, treated as the last one | Loop until nextCursor is undefined. |
INVALID_INPUT: The search cursor does not belong to this search | The cursor was passed with a different tracker, native or projects, which changes the set of trackers. Pass it with the same query and options. |
| Results silently missing one tracker | Read warnings. A search with one failing tracker still returns the others. |