Commit 46728d2
committed
feat: the transport takes a signal, a fetch of your own, and stops taking a refused credential for a result
Three requests older than 6.0, all of them the same shape: the client had no seam. `fetch` was reached as a global, a
request could not be cancelled, and a response's headers were read for one thing and thrown away. None of it was
visible from outside.
Every call takes an `AbortSignal` as an optional last argument — an operation with no parameters takes it in their
place — and the signal reaches `fetch` as well as cutting short a retry back-off that until now had no bound on total
wall time. The abort reason is rethrown untouched rather than wrapped, so `error.name === 'AbortError'` and
`error === signal.reason` both hold, and a `TimeoutError` from `AbortSignal.timeout()` stays one. Fixes #406.
The `fetch` the client calls is yours to replace. It receives the URL and the `RequestInit` the client built, headers
included, and returns a `Response` — logging, tracing, a corporate proxy, fixture recording. The OAuth 2.0 token and
cloud-id calls go through it too, so a proxy covers the whole flow rather than working until the first refresh. Its
type is `(url: string, init: RequestInit) => Promise<Response>` rather than `typeof globalThis.fetch`, so undici's
fetch fits without a cast. Fixes #404.
An expired API token is an error rather than an empty result, and this changes behaviour. Around a quarter of Jira's
operations can be reached anonymously, and there a dead token does not fail the request: Jira answers as the anonymous
user and reports the refusal only in `X-Seraph-LoginReason`. Measured against a live site, `GET
/rest/api/3/project/search` with a dead token answers 200 and `{"total":0,"isLast":true,"values":[]}`. The client reads
that header now and throws `AuthError` whatever the status, recording the status that actually arrived. Fixes #418.
Two smaller ones ride along. A header set to `undefined` is left out rather than sent, and falls through to the
client-wide value instead of erasing it. And two authentication strategies for a self-hosted instance arrive with the
core rather than with the surface they serve — `src/core` is generated whole and `createClient` branches on the
strategy, so separating them would mean hand-writing a core the generator does not produce.
Riding along with the regeneration is specification drift, and one part of it breaks callers. Four operations declared
their body as `Record<string, any>` — the generator's fallback for a request body that is not an object — and now
declare what the endpoint reads: `addWatcher` and `setPreference` take a `string`, `updateEntityPropertiesValue` an
`EntityPropertyDetails[]`, and Service Management's `attachTemporaryFile` a `MultipartFile[]`. None of the four could
be called correctly through the old declaration; the live suite carried two helpers whose only job was to cast a
string past it, and both are deleted here. That cast is the break.
`updateEntityPropertiesValue` and `attachTemporaryFile` had no coverage at all, and a live run cannot give them much:
one is addressed with a Connect app's JWT, the other needs an agent licence this tenant does not hold. Both gain a
live test pinning the typed refusal, and all four gain unit coverage asserting what leaves the client — the
neighbouring `updateIssueFields` wraps its body under a key, so a bare array is a distinction worth holding.
Four generated doc comments are restored rather than regressed. The generator's HTML stripper could not tell a tag
from a placeholder — `<project ID or key>` reads as an element named `project` — and turned a format string into "The
format is `,,`" while emptying the API token out of three curl examples. Fixed upstream in apis-code-gen; regenerating
with the fix changes exactly these four files, all of them restorations to what master already says.1 parent dbf6d78 commit 46728d2
165 files changed
Lines changed: 6031 additions & 1760 deletions
File tree
- src
- agile
- api
- cloud
- api
- models
- parameters
- core
- errors
- interfaces
- oauthServer
- oauth
- schemas
- serviceDesk
- api
- models
- parameters
- tests
- live
- cloud
- serviceDesk
- unit
- core
- oauthServer
- oauth
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
5 | 48 | | |
6 | 49 | | |
7 | 50 | | |
| |||
19 | 62 | | |
20 | 63 | | |
21 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
22 | 87 | | |
23 | 88 | | |
24 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
| 20 | + | |
16 | 21 | | |
17 | 22 | | |
18 | 23 | | |
| |||
26 | 31 | | |
27 | 32 | | |
28 | 33 | | |
| 34 | + | |
29 | 35 | | |
30 | 36 | | |
31 | 37 | | |
| |||
36 | 42 | | |
37 | 43 | | |
38 | 44 | | |
| 45 | + | |
39 | 46 | | |
40 | 47 | | |
41 | 48 | | |
| |||
0 commit comments