@mcp-abap-adt/connection 15.1.0 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/CHANGELOG.md +144 -1
  2. package/README.md +68 -20
  3. package/dist/connection/AbstractAbapConnection.d.ts +89 -39
  4. package/dist/connection/AbstractAbapConnection.d.ts.map +1 -1
  5. package/dist/connection/AbstractAbapConnection.js +249 -223
  6. package/dist/connection/CloudHttpTransport.d.ts +8 -1
  7. package/dist/connection/CloudHttpTransport.d.ts.map +1 -1
  8. package/dist/connection/CloudHttpTransport.js +28 -15
  9. package/dist/connection/HttpTransport.d.ts +61 -6
  10. package/dist/connection/HttpTransport.d.ts.map +1 -1
  11. package/dist/connection/HttpTransport.js +144 -21
  12. package/dist/connection/IAdtTransport.d.ts +12 -19
  13. package/dist/connection/IAdtTransport.d.ts.map +1 -1
  14. package/dist/connection/OnPremHttpTransport.d.ts +2 -13
  15. package/dist/connection/OnPremHttpTransport.d.ts.map +1 -1
  16. package/dist/connection/OnPremHttpTransport.js +16 -32
  17. package/dist/connection/RfcTransport.d.ts +0 -6
  18. package/dist/connection/RfcTransport.d.ts.map +1 -1
  19. package/dist/connection/RfcTransport.js +13 -46
  20. package/dist/connection/createConnection.d.ts +77 -0
  21. package/dist/connection/createConnection.d.ts.map +1 -0
  22. package/dist/connection/createConnection.js +39 -0
  23. package/dist/index.d.ts +1 -0
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +5 -1
  26. package/docs/INDEX.md +4 -2
  27. package/docs/MIGRATION-16.0.md +123 -0
  28. package/docs/SCOPE.md +17 -45
  29. package/docs/STATEFUL_SESSION_GUIDE.md +37 -38
  30. package/docs/USAGE.md +156 -84
  31. package/package.json +2 -2
  32. package/dist/connection/requestAbort.d.ts +0 -32
  33. package/dist/connection/requestAbort.d.ts.map +0 -1
  34. package/dist/connection/requestAbort.js +0 -69
@@ -9,7 +9,6 @@ const timeouts_js_1 = require("../utils/timeouts.js");
9
9
  const authErrors_js_1 = require("./authErrors.js");
10
10
  const csrfConfig_js_1 = require("./csrfConfig.js");
11
11
  const IAdtTransport_js_1 = require("./IAdtTransport.js");
12
- const requestAbort_js_1 = require("./requestAbort.js");
13
12
  /**
14
13
  * Declares the capabilities explicitly rather than satisfying them by accident.
15
14
  * `AbapConnection` is the base contract every transport honours; these two are
@@ -49,6 +48,10 @@ function hasHeader(headers, name) {
49
48
  * wire's session token and the request's content negotiation.
50
49
  */
51
50
  const OUTRANK_THE_CREDENTIAL = ['x-csrf-token', 'content-type', 'accept'];
51
+ /** What a spent instance answers to `connect()`. Fixed words. */
52
+ function spentError() {
53
+ return (0, SessionLifecycle_js_1.sessionError)(interfaces_adt_connection_1.ADT_SESSION_ERROR.NOT_CONNECTED, "This connection's SAP session has ended (it was disconnected, logged off or lost); one connection instance is one session. Create a new connection for a new session.");
54
+ }
52
55
  class AbstractAbapConnection {
53
56
  config;
54
57
  transport;
@@ -92,10 +95,11 @@ class AbstractAbapConnection {
92
95
  /**
93
96
  * The last goodbye this connection dispatched, so a caller can wait for it.
94
97
  *
95
- * `disconnect()` sends the logoff without awaiting it, for the reason stated
96
- * there. That is right for a teardown and wrong for a caller who is about to
97
- * `connect()` again: the next session opens while the previous one's goodbye
98
- * is still being assembled, and a caller who recycles in a loop leaves one
98
+ * `disconnect()` waits for the logoff to be written, not answered, for the
99
+ * reason stated there. That is right for a teardown and wrong for a caller
100
+ * who is about to `connect()` again: the next session opens while the
101
+ * previous one's goodbye is still unanswered, and a caller who recycles in a
102
+ * loop leaves one
99
103
  * abandoned session per iteration. Measured against E19 from
100
104
  * `@mcp-abap-adt/adt-clients`: a session every 1-2 seconds for a whole test
101
105
  * run, none of them released, each surviving to its 30-minute idle timeout.
@@ -104,6 +108,26 @@ class AbstractAbapConnection {
104
108
  * before this, the promise was created and dropped on the floor.
105
109
  */
106
110
  goodbye = Promise.resolve();
111
+ /**
112
+ * Whether `disconnect()` was called on this instance. A second call
113
+ * rejects: `disconnect()` is called once per instance, and a caller that calls it
114
+ * twice is told so rather than handed a success that waited for nothing.
115
+ */
116
+ disconnectCalled = false;
117
+ /**
118
+ * Whether this instance's one SAP session has ended: it was disconnected,
119
+ * a failed `connect()` logged off the session it had received, or the
120
+ * session was lost (`raiseSessionLost`). One instance is one session —
121
+ * after its logoff it is spent, and `connect()` refuses. A new session is a
122
+ * new instance, which the consumer creates (its own factory, or
123
+ * `createConnection`).
124
+ */
125
+ spent = false;
126
+ /**
127
+ * Every logoff `endSession()` dispatched for this instance, merged: what
128
+ * `disconnect()` waits for (the writes) and `flushGoodbye()` (the answers).
129
+ */
130
+ ended = null;
107
131
  inCriticalSection = false;
108
132
  /** Reference count for nested beginCriticalSection()/endCriticalSection() pairs. */
109
133
  criticalSectionDepth = 0;
@@ -295,8 +319,20 @@ class AbstractAbapConnection {
295
319
  // requested afterwards has already bumped the epoch — and comparing it
296
320
  // against itself would let the connect publish a session the caller had
297
321
  // asked to stop. The baseline is "when the caller asked to connect".
322
+ // One instance is one SAP session: once that session has ended — a
323
+ // disconnect(), a failed connect() that logged it off, or a lost
324
+ // session — the instance is spent, and a new session needs a new
325
+ // instance.
326
+ if (this.spent)
327
+ throw spentError();
298
328
  const baselineEpoch = this.lifecycle.teardownEpoch;
299
329
  await this.lifecycle.transition('connect', async () => {
330
+ // Again here: a disconnect() queued ahead of this connect — called in
331
+ // the same turn, before it — spends the instance only when its
332
+ // transition runs, after the check at entry. Nothing is asked of the
333
+ // credential on a spent instance.
334
+ if (this.spent)
335
+ throw spentError();
300
336
  if (this.lifecycle.connected)
301
337
  return;
302
338
  // Before the wire opens, so that a credential which cannot get ready
@@ -309,8 +345,12 @@ class AbstractAbapConnection {
309
345
  }
310
346
  catch (error) {
311
347
  const rejection = this.credentialRejection(error);
348
+ // A failed establishment that ended a session it had received (a
349
+ // cloud preflight's, say) has spent the instance: no second attempt
350
+ // on it — the original failure is the answer.
312
351
  if (!(error instanceof authErrors_js_1.WireLogonError) ||
313
352
  !rejection ||
353
+ this.spent ||
314
354
  this.lifecycle.teardownEpoch !== baselineEpoch) {
315
355
  throw error;
316
356
  }
@@ -344,12 +384,29 @@ class AbstractAbapConnection {
344
384
  * request cannot use, so the leak surfaces as a half-written object rather
345
385
  * than as anything about sessions.
346
386
  *
347
- * **Nothing is waited for.** The logoff is dispatched, not awaited: this
348
- * method notifies, and whether the server has acted on the notice is not
349
- * something it reports. Finishing chains and releasing locks stay the
350
- * caller's to do BEFORE calling — waiting here on a request that carries no
351
- * timeout by design is what made a teardown unbounded, which blocks every
352
- * later transition on the serialized tail.
387
+ * **Resolves once the logoff is WRITTEN, not answered.** The logoff's bytes
388
+ * handed to the socket (over RFC: the close call returned) is the point a
389
+ * caller needs: SAP queues a logoff behind a request still running in the
390
+ * same stateful ABAP session and answers it only after — ~96 s in one
391
+ * measurement, never in another — yet once it has arrived the ENQUEUE locks
392
+ * go with it, even if the client is killed while waiting for the answer
393
+ * (measured on an on-premise system, 2026-10-12; checked against 16.0.0 on 2026-10-13 with
394
+ * the process exiting right after this resolved: the lock was free ~70 s
395
+ * later, long before the idle timeout). A connection dropped WITHOUT a
396
+ * logoff keeps its locks. So a caller about to exit awaits this, and one
397
+ * that needs the answer awaits `flushGoodbye()` as well. The answer itself
398
+ * is not waited for here, and nothing bounds the write with a timer of its
399
+ * own: a server that never takes the bytes holds this until the socket
400
+ * fails, and that failure is logged, not thrown. Finishing chains and
401
+ * releasing locks stay the caller's to do BEFORE calling.
402
+ *
403
+ * **Called once per `connect()`.** A second call — while the first is still
404
+ * writing, or after it — rejects with `ADT_SESSION_ERROR.NOT_CONNECTED`; the
405
+ * first call is unaffected. A goodbye a failed `connect()` dispatched — to
406
+ * the HTTP security session a connect failing after authentication leaves
407
+ * alive — is written before that
408
+ * `connect()` rejects, so a caller's `disconnect()` in its `finally` is the
409
+ * first of that life and has nothing of it to wait for.
353
410
  *
354
411
  * **Requests already in flight are not waited for, and the logoff ends the
355
412
  * session they are running on** — so they will start failing against a
@@ -358,55 +415,80 @@ class AbstractAbapConnection {
358
415
  * dropped the cookie. Generation fencing (see `SessionLifecycle.isCurrent`)
359
416
  * keeps their results from reaching this connection either way.
360
417
  *
361
- * **Nothing to wait for.** This TELLS the server the session is finished and
362
- * does not act on the answer — whether and when the session is freed is the
363
- * server's affair. Waiting for a reply nobody reads was also the one thing
364
- * that could make a teardown unbounded, since the goodbye carries no request
365
- * timeout by design.
418
+ * **The answer is not waited for.** This TELLS the server the session is
419
+ * finished and does not act on the answer — whether and when the session is
420
+ * freed is the server's affair, and with a request still running in it SAP
421
+ * answers the logoff only once that request is done. Waiting for a reply
422
+ * nobody reads would make a teardown as long as the longest request; the
423
+ * write is what a caller needs, and `flushGoodbye()` is the wait for the
424
+ * answer.
366
425
  */
367
426
  async disconnect() {
368
- // Nothing here throws. This method's place is a `finally` — a connection
369
- // that was connected must be disconnected — and an exception raised there
370
- // replaces the error that sent the caller into it.
427
+ // Called once. A second call — while the first is writing its logoff, or
428
+ // after — rejects, in fixed words: it has nothing to end and nothing to
429
+ // wait for, and resolving would tell a caller about to exit that a logoff
430
+ // it never waited for has left. The first call is unaffected.
431
+ if (this.disconnectCalled) {
432
+ throw (0, SessionLifecycle_js_1.sessionError)(interfaces_adt_connection_1.ADT_SESSION_ERROR.NOT_CONNECTED, 'disconnect() was already called for this connection; call it once per instance');
433
+ }
434
+ this.disconnectCalled = true;
435
+ // Beyond that, nothing here throws. This method's place is a `finally` — a
436
+ // connection that was connected must be disconnected — and an exception
437
+ // raised there replaces the error that sent the caller into it.
438
+ let written = Promise.resolve();
371
439
  // Synchronous, at the call: admission shuts and the generation moves before
372
440
  // anything is queued, so a caller who has asked to disconnect cannot have
373
441
  // requests still going through while this waits its turn.
374
442
  this.lifecycle.beginTeardown({ origin: 'caller', sessionLost: false });
375
443
  await this.lifecycle.transition('disconnect', async () => {
376
- // DISPATCHED, not awaited. The goodbye carries no request timeout by
377
- // design — a server that never answers must not hold a teardown open —
378
- // and nothing bounds it here either, because there is nothing to bound:
379
- // awaiting an unbounded request is precisely what would make every
380
- // teardown unbounded.
444
+ // Dispatched here; awaited below only until it is WRITTEN. The goodbye
445
+ // carries no request timeout by design — a server that never answers
446
+ // must not hold a teardown open — and its answer is not waited for.
381
447
  //
382
448
  // The context is taken now, while the session is still true: the clear
383
449
  // below runs while the close is suspended on its first await.
384
450
  const context = this.sessionContext();
385
451
  // Kept, not dropped: `flushGoodbye()` is how a caller who is about to
386
- // reconnect waits for it. Rejections are absorbed here so that holding
452
+ // open a new connection waits for it. Rejections are absorbed here so that holding
387
453
  // the promise never turns a failed goodbye into an unhandled rejection —
388
454
  // the transport already logs what went wrong.
389
- this.goodbye = this.dispatchGoodbye(context);
455
+ // The terminal teardown: the logoff (when the wire holds a session),
456
+ // the instance spent, and — merged with any logoff the connection
457
+ // already sent on its own — the write the caller waits for and the
458
+ // answer `flushGoodbye()` does.
459
+ written = this.endSession(context).written;
390
460
  this.clearSessionState();
391
461
  this.lifecycle.markDisconnected();
392
462
  });
463
+ // The point this resolves at: the logoff written. Awaited after the
464
+ // transition, so the transition queue — a later connect() — is not held
465
+ // by the write.
466
+ await written;
393
467
  }
394
468
  /**
395
- * Wait for the last dispatched goodbye, bounded.
469
+ * Wait for SAP's answer to the last dispatched goodbye.
396
470
  *
397
471
  * For the caller who ends a session and immediately opens another. Without
398
472
  * it the two overlap and the server keeps both; with it the previous session
399
473
  * is gone — or known not to be going — before the next one is asked for.
400
474
  *
401
- * Bounded because the goodbye deliberately carries no request timeout: a
402
- * server that never answers must not hold a teardown open, and it must not
403
- * hold this open either. On expiry this returns rather than throwing, since
404
- * "the goodbye has not arrived yet" is not a failure of the caller's next
405
- * step — and the session it addressed will fall to the idle timeout anyway.
475
+ * **The bound is the caller's, and optional.** Without `timeoutMs` this waits
476
+ * for the answer as long as it takes, and creates no timer: a timeout of the
477
+ * library's own choosing is not one. With it, this waits at most that long
478
+ * and then returns rather than throwing — "the goodbye has not answered yet"
479
+ * is not a failure of the caller's next step. SAP answers a logoff queued
480
+ * behind a running request only once that request is done (~96 s in one
481
+ * measurement, never in another), so a caller that cannot wait that long
482
+ * passes a budget.
406
483
  *
407
- * Safe to call at any time: with nothing dispatched it returns immediately.
484
+ * Never rejects: a failed goodbye is absorbed. Safe to call at any time:
485
+ * with nothing dispatched it returns immediately.
408
486
  */
409
- async flushGoodbye(timeoutMs = 5000) {
487
+ async flushGoodbye(timeoutMs) {
488
+ if (timeoutMs === undefined) {
489
+ await this.goodbye;
490
+ return;
491
+ }
410
492
  let timer;
411
493
  try {
412
494
  await Promise.race([
@@ -423,6 +505,29 @@ class AbstractAbapConnection {
423
505
  clearTimeout(timer);
424
506
  }
425
507
  }
508
+ /**
509
+ * The one terminal teardown of this instance's session: `disconnect()`, and
510
+ * a failed `connect()` that had received a session.
511
+ *
512
+ * Dispatches the logoff — the wire snapshots its cookies synchronously,
513
+ * without `sap-contextid`, and sends it only when it holds a live
514
+ * `SAP_SESSIONID` — marks the instance spent, and keeps the logoff's write
515
+ * and answer, merged with any earlier one of this instance, for
516
+ * `disconnect()` and `flushGoodbye()`. The caller clears the cookies after.
517
+ */
518
+ endSession(context) {
519
+ const goodbye = this.dispatchGoodbye(context);
520
+ this.spent = true;
521
+ const previous = this.ended;
522
+ this.ended = previous
523
+ ? {
524
+ answered: Promise.all([previous.answered, goodbye.answered]).then(() => { }),
525
+ written: Promise.all([previous.written, goodbye.written]).then(() => { }),
526
+ }
527
+ : goodbye;
528
+ this.goodbye = this.ended.answered;
529
+ return this.ended;
530
+ }
426
531
  /**
427
532
  * Say goodbye to the session `context` describes, without waiting for it.
428
533
  *
@@ -439,16 +544,25 @@ class AbstractAbapConnection {
439
544
  * would send the goodbye without the session it is ending.
440
545
  */
441
546
  dispatchGoodbye(context) {
547
+ let wroteIt;
548
+ const written = new Promise((resolve) => {
549
+ wroteIt = resolve;
550
+ });
442
551
  let closing;
443
552
  try {
444
- closing = Promise.resolve(this.transport.close(context));
553
+ closing = Promise.resolve(this.transport.close(context, () => wroteIt()));
445
554
  }
446
555
  catch (error) {
447
556
  closing = Promise.reject(error);
448
557
  }
449
- return closing.catch((error) => {
558
+ const answered = closing.catch((error) => {
450
559
  this.logger?.debug(`Could not tell the server the session is finished: ${error instanceof Error ? error.message : String(error)}`);
451
560
  });
561
+ // A close that is over is past its write: it sent nothing, it failed to
562
+ // send — logged above, and reported by `answered` settling — or its wire
563
+ // does not tell the write apart (RFC, a custom wire).
564
+ void answered.then(wroteIt);
565
+ return { answered, written };
452
566
  }
453
567
  isConnected() {
454
568
  return this.lifecycle.connected;
@@ -511,6 +625,10 @@ class AbstractAbapConnection {
511
625
  * than written twice — the two would drift apart, as they did once before.
512
626
  */
513
627
  async establishAndCommit(baselineEpoch) {
628
+ // Every establishment attempt, the internal retry included: a spent
629
+ // instance opens no session.
630
+ if (this.spent)
631
+ throw spentError();
514
632
  if (this.lifecycle.teardownEpoch !== baselineEpoch) {
515
633
  throw (0, SessionLifecycle_js_1.sessionError)(interfaces_adt_connection_1.ADT_SESSION_ERROR.NOT_CONNECTED, 'Establishment abandoned: a teardown was requested for this connection');
516
634
  }
@@ -561,15 +679,24 @@ class AbstractAbapConnection {
561
679
  // finished with something we never had sends a request nobody asked for
562
680
  // — into the middle of an authentication exchange, in the case that found
563
681
  // this.
564
- // Whether there is anything to say is the wire's to know: a cloud
565
- // session has an address or it does not, and an on-prem one was
566
- // established or the cookie is debris from the refusal. The connection
567
- // asks, and each wire answers by doing nothing when it has nothing.
682
+ // Whether there is anything to say is the wire's to know, and both
683
+ // shipped wires answer by one rule: a logoff iff they hold a non-empty
684
+ // SAP_SESSIONID they received, whatever the status that brought it — a
685
+ // 404/403 at logon carries one (a live security session), a 401's
686
+ // debris cookie does not. Reached only when connect() as a whole failed:
687
+ // a 404 on core discovery is not that, its fallback runs in the same
688
+ // session. The connection asks, and each wire answers by doing nothing
689
+ // when it has nothing.
568
690
  // Its failure is absorbed, a synchronous throw included: a wire's
569
691
  // close() may reject — its context.authorize throws when the provider
570
692
  // refuses — and nobody awaits this one. A throw that escaped here would
571
693
  // replace the establishment error and skip the clearing below.
572
- const goodbye = this.dispatchGoodbye(this.sessionContext());
694
+ // A session was held — the wire's logoff gate — so this ends it, and
695
+ // the instance is spent; with none held, nothing is sent and connect()
696
+ // may be retried.
697
+ const goodbye = this.transport.sessionFingerprint().size > 0
698
+ ? this.endSession(this.sessionContext())
699
+ : this.dispatchGoodbye(this.sessionContext());
573
700
  this.invalidateSession();
574
701
  // And the identity with it. The rejecting response was still observed, so
575
702
  // its cookie was recorded as a session that had just been established —
@@ -577,10 +704,19 @@ class AbstractAbapConnection {
577
704
  // isConnected() says false. Two answers to one question is worse than
578
705
  // either.
579
706
  this.lifecycle.markDisconnected();
580
- // Not awaited, for the same reason a teardown does not wait: the caller
581
- // is owed the establishment error now, not after a round trip nobody is
582
- // waiting on. Its rejection was absorbed above, so nothing goes unhandled.
583
- void goodbye;
707
+ // The goodbye is the connector's own, so connect() rejects only once it
708
+ // is WRITTEN: a caller that exits on the error must not lose it. When
709
+ // the wire dispatches none (nothing to end), this resolves at once.
710
+ // A failure after authentication leaves a live HTTP security session
711
+ // (ICF, SAP_SESSIONID) on both wires: the cloud preflight opens one
712
+ // (BTP trial, 2026-10-12), and on-prem an authenticated error answer
713
+ // still sets a live SAP_SESSIONID (measured on an on-premise system, 2026-10-13: 404 and
714
+ // 403 each did; ABAP code: CL_HTTP_SERVER_NET->authentication creates
715
+ // it before any handler runs, send_response sets the cookie whatever
716
+ // the status). A failed connect() takes no ENQUEUE lock. The answer is not
717
+ // waited for, as a teardown does not wait for one; its failure was
718
+ // absorbed above, so nothing goes unhandled.
719
+ await goodbye.written;
584
720
  throw error;
585
721
  }
586
722
  if (this.lifecycle.teardownEpoch !== baselineEpoch) {
@@ -631,12 +767,20 @@ class AbstractAbapConnection {
631
767
  // preflight may have opened a session — on cloud it does — and this path
632
768
  // is about to drop the cookies that are the only permission to close it.
633
769
  // Refusing to connect must not leak the session the refusal is about.
634
- // Dispatched, not awaited; a close that throws or rejects is logged and
635
- // absorbed, never left unhandled.
636
- void this.dispatchGoodbye(this.sessionContext());
770
+ // Written before connect() rejects, as above, when the wire sends one.
771
+ // A shipped wire sends none here: this path means the wire holds no
772
+ // SAP_SESSIONID, and without it the logoff would end nothing —
773
+ // CL_HTTP_SERVER_NET->if_http_server~logoff terminates the security
774
+ // session only when that cookie is present (an on-premise system's ABAP code). A custom
775
+ // wire's close() may still send one, and is waited for. Its answer is not waited for, and a close that throws or
776
+ // rejects is logged and absorbed.
777
+ // No session held — that is what this path means — so nothing was
778
+ // logged off, and the instance stays usable: connect() may be retried.
779
+ const goodbye = this.dispatchGoodbye(this.sessionContext());
637
780
  this.invalidateSession();
638
781
  this.lifecycle.forgetIdentity();
639
782
  this.lifecycle.markDisconnected();
783
+ await goodbye.written;
640
784
  throw (0, SessionLifecycle_js_1.sessionError)(interfaces_adt_connection_1.ADT_SESSION_ERROR.NOT_CONNECTED, `The server authenticated the request but opened no ABAP session: the ${this.transport.kind} wire reports it is on none, so there is nothing for a lock to be bound to. The wire itself is fine — the request was carried and answered — which is why this is not a transport failure and does not look like one. ` +
641
785
  'Stateless reads would still work over it, but a lock, and any write under that lock, is dead the moment it is issued. ' +
642
786
  'The usual cause is the system declining to open another session for this user: they are limited per user, shared with every other tool logged on as them, and released either by disconnecting or by their own idle timeout. ' +
@@ -682,6 +826,9 @@ class AbstractAbapConnection {
682
826
  */
683
827
  raiseSessionLost(reason) {
684
828
  this.logger?.warn(`Session lost: ${reason}`);
829
+ // The instance's one session is gone: it is spent, as after disconnect().
830
+ // Nothing else is decided here — the caller is told, and decides.
831
+ this.spent = true;
685
832
  this.lifecycle.beginTeardown({ origin: 'internal', sessionLost: true });
686
833
  void this.lifecycle.transition('cleanup', async () => {
687
834
  this.clearSessionState();
@@ -856,11 +1003,8 @@ class AbstractAbapConnection {
856
1003
  }
857
1004
  }
858
1005
  async performRequest(options, lease) {
859
- const { url: endpoint, method, timeout, data, params, headers: customHeaders, signal, } = options;
1006
+ const { url: endpoint, method, timeout, data, params, headers: customHeaders, } = options;
860
1007
  const normalizedMethod = method.toUpperCase();
861
- // Before the first send: a request its caller has already given up on
862
- // asks the provider nothing and sends nothing.
863
- (0, requestAbort_js_1.throwIfAborted)(signal);
864
1008
  // The PATH, not an address. Which server it belongs in front of — or
865
1009
  // whether it belongs in front of one at all — is the wire's to say.
866
1010
  const requestUrl = endpoint;
@@ -875,7 +1019,7 @@ class AbstractAbapConnection {
875
1019
  // exchange itself does not stop the request — the CSRF recovery below
876
1020
  // handles a token that is missing — but a refused credential does.
877
1021
  if (mutation && !this.transport.csrfToken()) {
878
- await this.readyWireUpfront(renewal, lease, signal);
1022
+ await this.readyWireUpfront(renewal, lease);
879
1023
  }
880
1024
  // The request's own headers: everything but the credential's, which is
881
1025
  // written fresh onto a copy of these for every attempt (`authorizedFrom`).
@@ -962,7 +1106,7 @@ class AbstractAbapConnection {
962
1106
  // the request's content negotiation outrank it (`authorizedFrom`).
963
1107
  // A provider that answers after the session went away answers for a
964
1108
  // request that no longer has one.
965
- headers: await this.authorizedFrom(requestHeaders, signal).catch((error) => {
1109
+ headers: await this.authorizedFrom(requestHeaders).catch((error) => {
966
1110
  throw this.staleOr(error, lease);
967
1111
  }),
968
1112
  timeout: effectiveTimeout,
@@ -970,9 +1114,6 @@ class AbstractAbapConnection {
970
1114
  // transports serialise a query differently and both need the pairs.
971
1115
  params: params,
972
1116
  stateful: this.sessionMode === 'stateful',
973
- // For the waits the wire makes on this request's behalf — over RFC, the
974
- // logon and the open of a conversation of its own.
975
- ...(signal ? { signal } : {}),
976
1117
  };
977
1118
  if (data !== undefined) {
978
1119
  requestConfig.data = data;
@@ -993,17 +1134,14 @@ class AbstractAbapConnection {
993
1134
  return response;
994
1135
  }
995
1136
  catch (error) {
996
- // The wire ended one of its waits for this request: nothing to recover.
997
- if ((0, requestAbort_js_1.isRequestAborted)(error))
998
- throw error;
999
1137
  let survived;
1000
1138
  try {
1001
- return await this.recoverOnWire(error, requestConfig, requestHeaders, lease, signal);
1139
+ return await this.recoverOnWire(error, requestConfig, requestHeaders, lease);
1002
1140
  }
1003
1141
  catch (failure) {
1004
1142
  survived = failure;
1005
1143
  }
1006
- return await this.answerCredentialFailure(survived, requestConfig, requestHeaders, lease, renewal, signal);
1144
+ return await this.answerCredentialFailure(survived, requestConfig, requestHeaders, lease, renewal);
1007
1145
  }
1008
1146
  }
1009
1147
  /**
@@ -1019,10 +1157,6 @@ class AbstractAbapConnection {
1019
1157
  if (!this.lifecycle.isCurrent(lease)) {
1020
1158
  throw (0, SessionLifecycle_js_1.sessionError)(interfaces_adt_connection_1.ADT_SESSION_ERROR.NOT_CONNECTED, 'The session this request was admitted to is gone; nothing was sent');
1021
1159
  }
1022
- // The last point before the wire, for the same reason: a raced wait that
1023
- // answered still leaves turns before this one, and an abort in any of
1024
- // them must stop the send. Covers the first send and every resend.
1025
- (0, requestAbort_js_1.throwIfAborted)(requestConfig.signal);
1026
1160
  const response = await this.transport.send(requestConfig);
1027
1161
  this.observeResponse(response.headers, lease.generation);
1028
1162
  return response;
@@ -1043,11 +1177,9 @@ class AbstractAbapConnection {
1043
1177
  * and `Accept`: those are put back from `base` whichever way the provider
1044
1178
  * spelled them — as the wire's own token fetch already does.
1045
1179
  */
1046
- async authorizedFrom(base, signal) {
1180
+ async authorizedFrom(base) {
1047
1181
  const headers = { ...base };
1048
- // The provider's answer is waited for by this request alone: an abort
1049
- // ends the wait at once, and the provider runs on for whoever shares it.
1050
- await (0, requestAbort_js_1.untilAborted)(signal, this.credentialHeaders(headers));
1182
+ await this.credentialHeaders(headers);
1051
1183
  for (const name of OUTRANK_THE_CREDENTIAL) {
1052
1184
  const own = Object.keys(base).filter((key) => key.toLowerCase() === name);
1053
1185
  if (own.length === 0)
@@ -1062,22 +1194,22 @@ class AbstractAbapConnection {
1062
1194
  return headers;
1063
1195
  }
1064
1196
  /**
1065
- * The wire's own recovery from a failed attempt: the session faults it can
1066
- * cure — a stale CSRF token, a login-form 401 on a mutation, a GET 401 that
1067
- * cookies answer — and the verdicts it must not hide.
1197
+ * The wire's own recovery from a failed attempt: the one fault it can cure
1198
+ * in the same session — a CSRF token SAP refused (a 403 "CSRF token
1199
+ * validation failed", or a 401 to a mutation holding no token yet) — and
1200
+ * the verdicts it must not hide.
1068
1201
  *
1069
- * Runs before anything asks the credential, because it cures session
1070
- * faults, not credential ones: a stale CSRF token under Basic must not
1071
- * become "the user or password was refused". What it cannot cure it throws,
1072
- * and a credential failure among that goes on to the provider. One
1073
- * exception: inside a critical section the login-form 401 is not cured
1074
- * here, because curing it discards the session and the lock with it.
1202
+ * Runs before anything asks the credential: a stale CSRF token under Basic
1203
+ * must not become "the user or password was refused". What it cannot cure
1204
+ * it throws, and a credential failure among that — any other 401, a GET's
1205
+ * included — goes on to the provider. Nothing here resends a 401 as it is,
1206
+ * and nothing discards the session to retry in another.
1075
1207
  *
1076
1208
  * `requestHeaders` are the request's own, without the credential's: what
1077
1209
  * the recovery adds — a new token, the jar's cookies — goes there, and each
1078
1210
  * resend is authorized anew on top (`authorizedFrom`).
1079
1211
  */
1080
- async recoverOnWire(error, requestConfig, requestHeaders, lease, signal) {
1212
+ async recoverOnWire(error, requestConfig, requestHeaders, lease) {
1081
1213
  const requestUrl = requestConfig.url;
1082
1214
  const normalizedMethod = requestConfig.method;
1083
1215
  // FENCE FIRST, before anything reads or writes shared state.
@@ -1085,9 +1217,9 @@ class AbstractAbapConnection {
1085
1217
  // Fencing observeResponse() alone was not enough, and the gap was wide:
1086
1218
  // everything below acts on this connection, not on the request. A late
1087
1219
  // 400 "session not found" would call raiseSessionLost() and tear down the
1088
- // healthy session established since; a late 401/403 would call
1089
- // invalidateSession(), write a fresh CSRF token, and RETRY — replaying a
1090
- // mutation from a dead session inside the live one.
1220
+ // healthy session established since; a late 403 would write a fresh CSRF
1221
+ // token and RETRY — replaying a mutation from a dead session inside the
1222
+ // live one.
1091
1223
  //
1092
1224
  // A stale request gets its error back and nothing else happens.
1093
1225
  if (!this.lifecycle.isCurrent(lease)) {
@@ -1127,46 +1259,20 @@ class AbstractAbapConnection {
1127
1259
  else {
1128
1260
  this.logger?.error(errorDetails.message, errorDetails);
1129
1261
  }
1130
- // The "login-form 401": SAP refused a mutation while we hold a cached CSRF
1131
- // token, so the token and the session it is bound to are dead and must be
1132
- // discarded before the retry.
1133
- //
1134
- // These retries cure the session. A 401 that survives them is the
1135
- // credential's, not the session's.
1136
- const isCachedTokenStale = (normalizedMethod === 'POST' ||
1137
- normalizedMethod === 'PUT' ||
1138
- normalizedMethod === 'DELETE') &&
1139
- (0, IAdtTransport_js_1.refusalOf)(error)?.status === 401 &&
1140
- this.getCsrfToken() !== null;
1141
- // Not inside a critical section. Curing the login-form 401 discards the
1142
- // session, and with it the lock the section exists to hold; a renewal
1143
- // must keep it (goal decision 2). There the 401 goes to the provider,
1144
- // whose Ok resends on the same session — and a session SAP really
1145
- // replaced is reported as SESSION_REPLACED from that resend's refusal.
1146
- // Keyed on the section, not the session mode: the write under a lock is
1147
- // itself stateless.
1148
- if (isCachedTokenStale && this.inCriticalSection)
1149
- throw error;
1150
- // Retry logic for CSRF token errors (403 with CSRF message) and the
1151
- // login-form 401 pattern.
1152
- if (this.shouldRetryCsrf(error, normalizedMethod) || isCachedTokenStale) {
1153
- this.logger?.debug(isCachedTokenStale
1154
- ? 'Stale CSRF token / SAP session — invalidating and retrying'
1155
- : 'CSRF token validation failed, fetching new token and retrying request', {
1262
+ // No session is discarded and reopened on this instance to retry a
1263
+ // request: one instance is one session. A 401 on a mutation that holds a
1264
+ // CSRF token (a login form) is not cured here; it goes to the provider
1265
+ // like any other 401, and SAP's answer reaches the caller.
1266
+ // A CSRF complaint (403 "CSRF token validation failed", or a 401 to a
1267
+ // mutation that holds no token yet): a token earned in the SAME session —
1268
+ // the cookies are kept — and one resend.
1269
+ if (this.shouldRetryCsrf(error, normalizedMethod)) {
1270
+ this.logger?.debug('CSRF token validation failed, fetching new token and retrying request', {
1156
1271
  url: requestUrl,
1157
1272
  method: normalizedMethod,
1158
1273
  });
1159
- // Before the CSRF recovery and its resend. The session's token and
1160
- // cookies are every caller's: an aborted request neither discards them
1161
- // nor earns new ones.
1162
- (0, requestAbort_js_1.throwIfAborted)(signal);
1163
- if (isCachedTokenStale) {
1164
- this.invalidateSession();
1165
- delete requestHeaders.Cookie;
1166
- delete requestHeaders.cookie;
1167
- }
1168
1274
  try {
1169
- this.setCsrfToken(await (0, requestAbort_js_1.untilAborted)(signal, this.fetchCsrfToken(requestUrl, 5, 2000, lease, signal)));
1275
+ this.setCsrfToken(await this.fetchCsrfToken(requestUrl, 5, 2000, lease));
1170
1276
  const refreshedToken = this.getCsrfToken();
1171
1277
  if (refreshedToken) {
1172
1278
  requestHeaders['x-csrf-token'] = refreshedToken;
@@ -1176,7 +1282,7 @@ class AbstractAbapConnection {
1176
1282
  requestHeaders.Cookie = refreshedCookies;
1177
1283
  }
1178
1284
  // Re-authorized: a provider may have renewed since the first attempt.
1179
- requestConfig.headers = await this.authorizedFrom(requestHeaders, signal);
1285
+ requestConfig.headers = await this.authorizedFrom(requestHeaders);
1180
1286
  return await this.sendObserved(requestConfig, lease);
1181
1287
  }
1182
1288
  catch (retryError) {
@@ -1199,54 +1305,6 @@ class AbstractAbapConnection {
1199
1305
  throw error;
1200
1306
  }
1201
1307
  }
1202
- // A 401 on a GET where cookies have since arrived: the first request had
1203
- // none, and the session they name is what the retry needs. Guarded below
1204
- // on actually holding some, so a wire that issues no cookies — RFC —
1205
- // never takes it.
1206
- if ((0, IAdtTransport_js_1.refusalOf)(error)?.status === 401 && normalizedMethod === 'GET') {
1207
- // Before the resend, and before the token fetch that would earn it.
1208
- (0, requestAbort_js_1.throwIfAborted)(signal);
1209
- // If we already have cookies from error response, retry immediately
1210
- const afterError = this.transport.cookies();
1211
- if (afterError) {
1212
- this.logger?.debug(`401 on GET request, retrying with cookies from error response`);
1213
- requestHeaders.Cookie = afterError;
1214
- try {
1215
- requestConfig.headers = await this.authorizedFrom(requestHeaders, signal);
1216
- return await this.sendObserved(requestConfig, lease);
1217
- }
1218
- catch (resendError) {
1219
- throw this.staleOr(resendError, lease);
1220
- }
1221
- }
1222
- // If no cookies, try to get them via CSRF token fetch
1223
- this.logger?.debug(`401 on GET request, attempting to get cookies via CSRF token fetch`);
1224
- try {
1225
- // Try to get CSRF token (this will also get cookies)
1226
- this.setCsrfToken(await (0, requestAbort_js_1.untilAborted)(signal, this.fetchCsrfToken(requestUrl, 3, 1000, lease, signal)));
1227
- const afterCsrf = this.transport.cookies();
1228
- if (afterCsrf) {
1229
- requestHeaders.Cookie = afterCsrf;
1230
- this.logger?.debug(`Retrying GET request with cookies from CSRF fetch`);
1231
- requestConfig.headers = await this.authorizedFrom(requestHeaders, signal);
1232
- return await this.sendObserved(requestConfig, lease);
1233
- }
1234
- }
1235
- catch (csrfError) {
1236
- // As in path (a): a stale request gets the session verdict.
1237
- if (!this.lifecycle.isCurrent(lease)) {
1238
- throw this.staleVerdict(csrfError);
1239
- }
1240
- this.throwIfSessionDead(csrfError, lease);
1241
- // Swallowed, unless it says more than the 401 that started this —
1242
- // a session verdict, or the credential's failure.
1243
- if (this.outranksOriginal(csrfError)) {
1244
- throw csrfError;
1245
- }
1246
- this.logger?.debug(`Failed to get CSRF token for 401 retry: ${csrfError instanceof Error ? csrfError.message : String(csrfError)}`);
1247
- // Fall through to throw original error
1248
- }
1249
- }
1250
1308
  throw error;
1251
1309
  }
1252
1310
  /**
@@ -1261,7 +1319,7 @@ class AbstractAbapConnection {
1261
1319
  * credential failure in either is the verdict. As in `recoverOnWire`,
1262
1320
  * `requestHeaders` are the request's own, and the resend is authorized anew.
1263
1321
  */
1264
- async answerCredentialFailure(failure, requestConfig, requestHeaders, lease, renewal, signal) {
1322
+ async answerCredentialFailure(failure, requestConfig, requestHeaders, lease, renewal) {
1265
1323
  // A resend inside the wire's recovery that met a dead session.
1266
1324
  this.throwIfSessionDead(failure, lease);
1267
1325
  const rejection = this.credentialRejection(failure);
@@ -1271,7 +1329,7 @@ class AbstractAbapConnection {
1271
1329
  throw failure;
1272
1330
  if (!this.lifecycle.isCurrent(lease))
1273
1331
  throw this.staleVerdict(failure);
1274
- await this.renewCredential(rejection, renewal, signal).catch((error) => {
1332
+ await this.renewCredential(rejection, renewal).catch((error) => {
1275
1333
  throw this.staleOr(error, lease);
1276
1334
  });
1277
1335
  if (!this.lifecycle.isCurrent(lease))
@@ -1279,7 +1337,7 @@ class AbstractAbapConnection {
1279
1337
  try {
1280
1338
  if (rejection.at === 'logon') {
1281
1339
  this.transport.adoptCsrfToken(null);
1282
- await this.ensureWireReady(lease, signal);
1340
+ await this.ensureWireReady(lease);
1283
1341
  const token = this.transport.csrfToken();
1284
1342
  if (token && ['POST', 'PUT', 'DELETE'].includes(requestConfig.method)) {
1285
1343
  requestHeaders['x-csrf-token'] = token;
@@ -1288,7 +1346,7 @@ class AbstractAbapConnection {
1288
1346
  if (cookies)
1289
1347
  requestHeaders.Cookie = cookies;
1290
1348
  }
1291
- requestConfig.headers = await this.authorizedFrom(requestHeaders, signal);
1349
+ requestConfig.headers = await this.authorizedFrom(requestHeaders);
1292
1350
  return await this.sendObserved(requestConfig, lease);
1293
1351
  }
1294
1352
  catch (again) {
@@ -1340,8 +1398,7 @@ class AbstractAbapConnection {
1340
1398
  * NOT_CONNECTED, because it is about a session the request no longer holds.
1341
1399
  */
1342
1400
  staleVerdict(error) {
1343
- // The caller's abort is its own answer, whichever session is current.
1344
- if (this.isSessionVerdict(error) || (0, requestAbort_js_1.isRequestAborted)(error))
1401
+ if (this.isSessionVerdict(error))
1345
1402
  return error;
1346
1403
  return (0, SessionLifecycle_js_1.sessionError)(interfaces_adt_connection_1.ADT_SESSION_ERROR.NOT_CONNECTED, 'The session this request was admitted to is gone');
1347
1404
  }
@@ -1357,18 +1414,12 @@ class AbstractAbapConnection {
1357
1414
  * that throw. A refusal after the retry was spent is the verdict, and the
1358
1415
  * provider is not asked again — asking would invite a second renewal.
1359
1416
  */
1360
- async renewCredential(rejection, renewal,
1361
- /** The request's; `connect()` has none. */
1362
- signal) {
1417
+ async renewCredential(rejection, renewal) {
1363
1418
  if (renewal.spent) {
1364
1419
  throw new authErrors_js_1.AuthRefusedError((0, authErrors_js_1.refusedAgain)(rejection.at), rejection.at, rejection.error);
1365
1420
  }
1366
- // Before rejected(): an aborted request asks the provider nothing.
1367
- (0, requestAbort_js_1.throwIfAborted)(signal);
1368
1421
  renewal.spent = true;
1369
- // After it: the renewal is the provider's, shared with whoever else was
1370
- // refused; this request stops waiting for it at its abort.
1371
- const answer = await (0, requestAbort_js_1.untilAborted)(signal, this.credentialRejected(rejection));
1422
+ const answer = await this.credentialRejected(rejection);
1372
1423
  if (!answer.outcome.ok) {
1373
1424
  throw new authErrors_js_1.AuthRefusedError(answer.outcome.refusal, rejection.at, 'thrown' in answer ? answer.thrown : rejection.error);
1374
1425
  }
@@ -1396,7 +1447,6 @@ class AbstractAbapConnection {
1396
1447
  */
1397
1448
  outranksOriginal(retryError) {
1398
1449
  return (this.isSessionVerdict(retryError) ||
1399
- (0, requestAbort_js_1.isRequestAborted)(retryError) ||
1400
1450
  retryError instanceof authErrors_js_1.AuthRefusedError ||
1401
1451
  this.credentialRejection(retryError) !== null);
1402
1452
  }
@@ -1408,16 +1458,13 @@ class AbstractAbapConnection {
1408
1458
  * fetch within the request's one retry — unless the session the request
1409
1459
  * was admitted to is gone by then, when nothing more is sent.
1410
1460
  */
1411
- async readyWireUpfront(renewal, lease, signal) {
1461
+ async readyWireUpfront(renewal, lease) {
1412
1462
  for (;;) {
1413
1463
  try {
1414
- await this.ensureWireReady(lease, signal);
1464
+ await this.ensureWireReady(lease);
1415
1465
  return;
1416
1466
  }
1417
1467
  catch (error) {
1418
- // The caller's abort is not a failed exchange to shrug off.
1419
- if ((0, requestAbort_js_1.isRequestAborted)(error))
1420
- throw error;
1421
1468
  // The session the request was admitted to is gone: nothing more of it
1422
1469
  // is sent, the provider is not asked, and what the caller gets is the
1423
1470
  // session verdict — never the wire's error, nor the provider's, about
@@ -1431,7 +1478,7 @@ class AbstractAbapConnection {
1431
1478
  return;
1432
1479
  }
1433
1480
  const rejection = this.credentialRejection(error);
1434
- await this.renewCredential(rejection, renewal, signal).catch((refused) => {
1481
+ await this.renewCredential(rejection, renewal).catch((refused) => {
1435
1482
  throw this.staleOr(refused, lease);
1436
1483
  });
1437
1484
  if (!this.lifecycle.isCurrent(lease)) {
@@ -1458,25 +1505,19 @@ class AbstractAbapConnection {
1458
1505
  * wire's own ingest of it, and never stops the request being sent.
1459
1506
  * Omitted during connect(), which has no lease.
1460
1507
  */
1461
- fence,
1462
- /**
1463
- * The request's signal: the exchange's own attempts stop once it aborts.
1464
- * Omitted during connect(), whose exchange is nobody's single request.
1465
- */
1466
- signal) {
1508
+ fence) {
1467
1509
  // Dropped first, because this is only ever reached to REPLACE one: the
1468
1510
  // establishment is idempotent and would hand back the very token the
1469
1511
  // caller has just been told is stale.
1470
1512
  this.transport.adoptCsrfToken(null);
1471
1513
  await this.transport.establish({
1472
1514
  ...(typeof fence === 'number'
1473
- ? this.leasedContext(undefined, fence, signal)
1474
- : this.leasedContext(fence, fence?.generation, signal)),
1515
+ ? this.leasedContext(undefined, fence)
1516
+ : this.leasedContext(fence)),
1475
1517
  retries: retryCount,
1476
1518
  retryDelayMs: retryDelay,
1477
1519
  timeoutMs: (0, timeouts_js_1.getTimeout)('csrf'),
1478
1520
  isFatal: (error) => this.endsTheExchange(error),
1479
- ...(signal ? { signal } : {}),
1480
1521
  });
1481
1522
  const token = this.transport.csrfToken();
1482
1523
  if (!token)
@@ -1523,16 +1564,11 @@ class AbstractAbapConnection {
1523
1564
  */
1524
1565
  async ensureWireReady(
1525
1566
  /** The request's lease: fences what is sent and the response effects. */
1526
- lease,
1527
- /** The request's signal: its wait ends at the abort, the exchange runs on. */
1528
- signal) {
1529
- // Raced: an exchange already sent is not recalled, and what it earns is
1530
- // the wire's, for every caller — but this request stops waiting for it.
1531
- await (0, requestAbort_js_1.untilAborted)(signal, this.transport.establish({
1532
- ...this.leasedContext(lease, lease.generation, signal),
1567
+ lease) {
1568
+ await this.transport.establish({
1569
+ ...this.leasedContext(lease),
1533
1570
  isFatal: (error) => this.endsTheExchange(error),
1534
- ...(signal ? { signal } : {}),
1535
- }));
1571
+ });
1536
1572
  }
1537
1573
  /**
1538
1574
  * The context for a token exchange a request makes on its own behalf — its
@@ -1550,24 +1586,16 @@ class AbstractAbapConnection {
1550
1586
  * what the connection does with an answer, and nothing else: the request is
1551
1587
  * sent, and the wire still folds the answer into its jar.
1552
1588
  */
1553
- leasedContext(lease, generation = lease?.generation,
1554
- /**
1555
- * The request's signal. Each attempt of the exchange is authorized
1556
- * raced against it, so an exchange whose request was aborted sends
1557
- * nothing more: the abort ends the exchange (`endsTheExchange`).
1558
- */
1559
- signal) {
1589
+ leasedContext(lease, generation = lease?.generation) {
1560
1590
  return {
1561
1591
  baseUrl: this.baseUrl,
1562
1592
  authorize: async (headers) => {
1563
- await (0, requestAbort_js_1.untilAborted)(signal, this.credentialHeaders(headers));
1593
+ await this.credentialHeaders(headers);
1564
1594
  if (lease && !this.lifecycle.isCurrent(lease)) {
1565
1595
  throw (0, SessionLifecycle_js_1.sessionError)(interfaces_adt_connection_1.ADT_SESSION_ERROR.NOT_CONNECTED, 'The session this request was admitted to is gone; nothing was sent');
1566
1596
  }
1567
1597
  },
1568
- // A wire that logs on inside a request's own exchange: the logon is
1569
- // the request's wait like any other, and the exchange stops with it.
1570
- logon: (target) => (0, requestAbort_js_1.untilAborted)(signal, this.logon(target)),
1598
+ logon: (target) => this.logon(target),
1571
1599
  extraHeaders: { 'sap-adt-connection-id': this.sessionId ?? '' },
1572
1600
  // An answer that arrives after the lease went stale belongs to a session
1573
1601
  // that is gone. Refused with the session verdict, which every wire hands
@@ -1583,13 +1611,11 @@ class AbstractAbapConnection {
1583
1611
  }
1584
1612
  /**
1585
1613
  * What stops a token exchange at once, past its retries: a session verdict,
1586
- * the provider's refusal to authorize it — asking again would only ask
1587
- * the provider again — or the abort of the request it was made for.
1614
+ * or the provider's refusal to authorize it — asking again would only ask
1615
+ * the provider again.
1588
1616
  */
1589
1617
  endsTheExchange(error) {
1590
- return (this.isSessionVerdict(error) ||
1591
- (0, requestAbort_js_1.isRequestAborted)(error) ||
1592
- error instanceof authErrors_js_1.AuthRefusedError);
1618
+ return this.isSessionVerdict(error) || error instanceof authErrors_js_1.AuthRefusedError;
1593
1619
  }
1594
1620
  /**
1595
1621
  * Clear SAP-side session state when SAP rejects the cached CSRF token + session