@mcp-abap-adt/adt-clients 34.2.0 → 34.2.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"AdtBatchConnection.d.ts","sourceRoot":"","sources":["../../src/batch/AdtBatchConnection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAS9D,KAAK,OAAO,GAAG,UAAU,GAAG,WAAW,CAAC;AAQxC,sFAAsF;AACtF,qBAAa,kBAAmB,YAAW,eAAe;IAOtD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAP1B,OAAO,CAAC,KAAK,CAAiB;IAC9B,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAU;IACzC,OAAO,CAAC,iBAAiB,CAAC,CAAqB;IAC/C,OAAO,CAAC,SAAS,CAAS;gBAEP,UAAU,EAAE,eAAe,EAC3B,OAAO,EAAE;QACxB,QAAQ,EAAE,eAAe,GAAG,UAAU,CAAC;QACvC,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB;IAWH,OAAO,CAAC,cAAc;IAWtB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAGxB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAG7B,YAAY,IAAI,MAAM,GAAG,IAAI;IAG7B,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAGnC,cAAc,IAAI,OAAO;IAGzB,cAAc,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EACrC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAuBlC,OAA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I,OAAO,CAAC,gBAAgB,CAAC;CAmH3C"}
@@ -4,6 +4,7 @@ exports.AdtBatchConnection = void 0;
4
4
  const objects_1 = require("../endpoints/objects");
5
5
  const acceptNegotiation_1 = require("../utils/acceptNegotiation");
6
6
  const adtResponse_1 = require("../utils/adtResponse");
7
+ const requestTrace_1 = require("../utils/requestTrace");
7
8
  const wire_1 = require("./wire");
8
9
  /** Records member requests; execute also drains requests queued during settlement. */
9
10
  class AdtBatchConnection {
@@ -149,6 +150,25 @@ class AdtBatchConnection {
149
150
  const unsentError = (0, adtResponse_1.isUnansweredCredentialRefusal)(error)
150
151
  ? error
151
152
  : new Error('ADT batch request not sent because an earlier batch envelope failed', { cause: error });
153
+ // The envelope failed as a whole: every part it carried rejects with
154
+ // this one object. The request that failed is the envelope's own POST,
155
+ // not any part — and no part's trace may write its own over it.
156
+ // Marked first: the mark cannot fail. The request is written only where
157
+ // the failure takes it — a frozen one does not, and the parts settle
158
+ // with it as it came either way.
159
+ if (active.length && !(0, adtResponse_1.isUnansweredCredentialRefusal)(error)) {
160
+ (0, requestTrace_1.markEnvelopeFailure)(error);
161
+ if (error !== null && typeof error === 'object')
162
+ Reflect.defineProperty(error, 'request', {
163
+ value: { method: 'POST', url: objects_1.BATCH[this.options.endpoint] },
164
+ writable: true,
165
+ enumerable: true,
166
+ configurable: true,
167
+ });
168
+ }
169
+ // The "not sent" failure is one object shared by every unsent part, too.
170
+ if (unsentError !== error)
171
+ (0, requestTrace_1.markEnvelopeFailure)(unsentError);
152
172
  this.settlementFailure = { error: unsentError };
153
173
  for (const part of active)
154
174
  part.reject(error);
@@ -44,6 +44,12 @@ export interface IAdtRequestTrace {
44
44
  * the field only when it means something.
45
45
  */
46
46
  export declare function requestOf(answer?: IAdtWireResponse): IAdtRequestTrace | undefined;
47
+ /**
48
+ * Mark `error` as a batch envelope's failure, so the trace leaves it as it
49
+ * came. Module-internal (not in the package's index): the batch connection is
50
+ * its one caller.
51
+ */
52
+ export declare function markEnvelopeFailure(error: unknown): void;
47
53
  /**
48
54
  * Put the request back on the answer.
49
55
  *
@@ -1 +1 @@
1
- {"version":3,"file":"requestTrace.d.ts","sourceRoot":"","sources":["../../src/utils/requestTrace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EACV,eAAe,EAEf,gBAAgB,EACjB,MAAM,yCAAyC,CAAC;AAGjD,+EAA+E;AAC/E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,MAAM,CAAC,EAAE,gBAAgB,GACxB,gBAAgB,GAAG,SAAS,CAI9B;AAKD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,eAAe,GAAG,eAAe,CAmD7E"}
1
+ {"version":3,"file":"requestTrace.d.ts","sourceRoot":"","sources":["../../src/utils/requestTrace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EACV,eAAe,EAEf,gBAAgB,EACjB,MAAM,yCAAyC,CAAC;AAGjD,+EAA+E;AAC/E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,MAAM,CAAC,EAAE,gBAAgB,GACxB,gBAAgB,GAAG,SAAS,CAI9B;AAgBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAExD;AAWD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,eAAe,GAAG,eAAe,CAsD7E"}
@@ -32,6 +32,7 @@
32
32
  */
33
33
  Object.defineProperty(exports, "__esModule", { value: true });
34
34
  exports.requestOf = requestOf;
35
+ exports.markEnvelopeFailure = markEnvelopeFailure;
35
36
  exports.withRequestTrace = withRequestTrace;
36
37
  const adtResponse_1 = require("./adtResponse");
37
38
  /**
@@ -48,6 +49,31 @@ function requestOf(answer) {
48
49
  return undefined;
49
50
  return { method: carried.method, url: carried.url };
50
51
  }
52
+ /**
53
+ * The mark of a batch envelope's failure: one object, rejected to every part
54
+ * the envelope carried. Each part's request passes through the trace, and a
55
+ * part writing its own request onto that shared object would name itself on
56
+ * every other part's failure — the last part's winning, a request never sent
57
+ * on its own. The object carries the envelope's own request instead, set by
58
+ * the batch connection that sent it.
59
+ *
60
+ * Kept in a `WeakSet` rather than under a symbol on the error: a transport may
61
+ * reject with a frozen error, which takes no property, and the mark must hold
62
+ * on it all the same — the parts settle with that failure as it came.
63
+ */
64
+ const envelopeFailures = new WeakSet();
65
+ /**
66
+ * Mark `error` as a batch envelope's failure, so the trace leaves it as it
67
+ * came. Module-internal (not in the package's index): the batch connection is
68
+ * its one caller.
69
+ */
70
+ function markEnvelopeFailure(error) {
71
+ if (error !== null && typeof error === 'object')
72
+ envelopeFailures.add(error);
73
+ }
74
+ function isEnvelopeFailure(error) {
75
+ return (error !== null && typeof error === 'object' && envelopeFailures.has(error));
76
+ }
51
77
  /** Connections already carrying the trace. */
52
78
  const traced = new WeakSet();
53
79
  /**
@@ -101,8 +127,10 @@ function withRequestTrace(connection) {
101
127
  //
102
128
  // A credential refusal SAP was never asked about is not annotated: it is
103
129
  // the connection's own object, rethrown to the caller as it came, and
104
- // this wrapper does not write onto it.
105
- if ((0, adtResponse_1.isUnansweredCredentialRefusal)(error))
130
+ // this wrapper does not write onto it. Nor is a batch envelope's
131
+ // failure: every part of the envelope rejects with that one object, and
132
+ // it already names the request that failed — the envelope's own.
133
+ if ((0, adtResponse_1.isUnansweredCredentialRefusal)(error) || isEnvelopeFailure(error))
106
134
  throw error;
107
135
  error.request = asked;
108
136
  throw error;
@@ -118,9 +118,14 @@ Recorded request promises receive inner responses, in order: 2xx resolves; other
118
118
  statuses reject with an Error carrying `response: { status, statusText, headers,
119
119
  data }`, matching direct HTTP failure handling. Members keep their usual
120
120
  `IAdtResponse` and strategy behavior. Envelope/parse failures stop execution immediately and reject `execute()` and
121
- parts in the failed envelope. Unsent runs and queued follow-ups reject with a
121
+ parts in the failed envelope. Every part of that envelope rejects with the same
122
+ object and message, and its `request` is the envelope's own
123
+ (`{ method: 'POST', url: '/sap/bc/adt/communication/batch' }`, or the debugger's
124
+ batch URL), not any part's; a failure that takes no property, a frozen one,
125
+ reaches every part as it came, without it. Unsent runs and queued follow-ups reject with a
122
126
  library error saying the request was not sent because an earlier envelope failed;
123
- that error carries the cause, without a SAP response. Missing parts reject with a part-count error. A count
127
+ that error carries the cause, without a SAP response and without a `request` of
128
+ its own. Missing parts reject with a part-count error. A count
124
129
  mismatch also rejects `execute()`. Attach rejection handlers before execution when
125
130
  using raw connection promises. Each execute sends follow-up envelopes for requests recorded during settlement
126
131
  by member continuations; accept negotiation records none. It yields one event-loop turn
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/adt-clients",
3
- "version": "34.2.0",
3
+ "version": "34.2.1",
4
4
  "description": "ADT clients for SAP ABAP systems - AdtClient and AdtRuntimeClient",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",