* Reads the `cursor` of the `rel="next"` link from a Sentry `Link` header. * * Sentry paginates via the `Link` header: each link is annotated with `rel`, * `results`, and `cursor` attributes, e.g. * ` ; rel="next"; results="true"; cursor="0:100:0"`. * A further
(linkHeader: string | null)
| 192 | * which is the canonical token Sentry expects echoed back on the next request. |
| 193 | */ |
| 194 | function parseNextCursor(linkHeader: string | null): string | undefined { |
| 195 | if (!linkHeader) return undefined |
| 196 | |
| 197 | for (const part of linkHeader.split(',')) { |
| 198 | if (!/rel="next"/.test(part)) continue |
| 199 | if (!/results="true"/.test(part)) return undefined |
| 200 | const cursorMatch = part.match(/cursor="([^"]*)"/) |
| 201 | if (cursorMatch) return cursorMatch[1] |
| 202 | return undefined |
| 203 | } |
| 204 | |
| 205 | return undefined |
| 206 | } |
| 207 | |
| 208 | /** |
| 209 | * Builds the metadata-based content hash for an issue. |