@mcp-abap-adt/adt-clients 45.0.0 → 45.1.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.
- package/README.md +14 -0
- package/dist/utils/adtResponse.d.ts.map +1 -1
- package/dist/utils/adtResponse.js +28 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1003,6 +1003,20 @@ in the other half of the answer.
|
|
|
1003
1003
|
any other until your `analyse` says it is a failure: that is the one decision
|
|
1004
1004
|
this package leaves wholly to you.
|
|
1005
1005
|
|
|
1006
|
+
**A connection failure names its cause by code.** When the request threw
|
|
1007
|
+
below the ADT conversation with one of the network codes
|
|
1008
|
+
`ADT_CONNECTION_CAUSES` lists (`@mcp-abap-adt/interfaces-adt`), the failure
|
|
1009
|
+
carries it as `connectionCause` — on a connection already made too, when the
|
|
1010
|
+
system went away between two requests. Any other code, or none, leaves it
|
|
1011
|
+
absent; a refusal carries none. Tell "the system is not reachable" from the
|
|
1012
|
+
code, never from `message`:
|
|
1013
|
+
|
|
1014
|
+
```typescript
|
|
1015
|
+
if (!answer.ok && answer.getError().connectionCause !== undefined) {
|
|
1016
|
+
// no answer came back: ECONNREFUSED, ENOTFOUND, ETIMEDOUT, …
|
|
1017
|
+
}
|
|
1018
|
+
```
|
|
1019
|
+
|
|
1006
1020
|
**What throws, and what does not.** The boundary is the cause. A failure caused
|
|
1007
1021
|
by SAP's answer comes back through the strategies, with the response attached —
|
|
1008
1022
|
never as an exception, and never rewrapped into one that drops the response.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adtResponse.d.ts","sourceRoot":"","sources":["../../src/utils/adtResponse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"adtResponse.d.ts","sourceRoot":"","sources":["../../src/utils/adtResponse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;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,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,CAAC,SAAS,SAAS,GAAG,SAAS,EACxE,GAAG,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,EAChC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,EACxB,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,GACpB,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAuD7B;AAED;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAAC,CAAC,EAC7B,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GACjD,OAAO,CAAC,CAAC,CAAC,CASZ"}
|
|
@@ -101,6 +101,30 @@ function isUnansweredCredentialRefusal(error) {
|
|
|
101
101
|
const refused = credentialRefusal(error);
|
|
102
102
|
return refused !== undefined && refused.answered === undefined;
|
|
103
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* The network code `error` was thrown with, when it is one of
|
|
106
|
+
* `ADT_CONNECTION_CAUSES`; any other code, none, or a code that is not an own
|
|
107
|
+
* data property is `undefined`.
|
|
108
|
+
*
|
|
109
|
+
* The thrown value comes from below the ADT conversation, outside the type
|
|
110
|
+
* system, so `code` is read by {@link ownValue} — a getter is never run — and
|
|
111
|
+
* compared with each listed code as it is. The message is never read: a code
|
|
112
|
+
* is named only by a code.
|
|
113
|
+
*
|
|
114
|
+
* An inspection that throws (a Proxy's `getOwnPropertyDescriptor` trap) is no
|
|
115
|
+
* cause: the classifier never throws on what was thrown at it, and without the
|
|
116
|
+
* code the failure is the one it was before the cause existed.
|
|
117
|
+
*/
|
|
118
|
+
function connectionCauseOf(error) {
|
|
119
|
+
let code;
|
|
120
|
+
try {
|
|
121
|
+
code = ownValue(error, 'code');
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
return interfaces_adt_1.ADT_CONNECTION_CAUSES.find((listed) => listed === code);
|
|
127
|
+
}
|
|
104
128
|
/**
|
|
105
129
|
* The default error strategy: what this library recognises as a failure.
|
|
106
130
|
*
|
|
@@ -143,6 +167,9 @@ function recogniseFailure(error) {
|
|
|
143
167
|
// Everything else reached us from below the ADT conversation: a status the
|
|
144
168
|
// transport refused, a socket that would not open, a session that is gone.
|
|
145
169
|
const carried = error;
|
|
170
|
+
// The network code, by code alone, so a caller can say "no connection"
|
|
171
|
+
// without reading the message. Absent unless it is a listed one.
|
|
172
|
+
const connectionCause = connectionCauseOf(error);
|
|
146
173
|
return {
|
|
147
174
|
origin: 'connection',
|
|
148
175
|
message: carried?.message ??
|
|
@@ -152,6 +179,7 @@ function recogniseFailure(error) {
|
|
|
152
179
|
// most common failure — a status the transport refused — as the one a
|
|
153
180
|
// caller could not locate in a chain of six.
|
|
154
181
|
request: carried?.request,
|
|
182
|
+
...(connectionCause === undefined ? {} : { connectionCause }),
|
|
155
183
|
};
|
|
156
184
|
}
|
|
157
185
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-abap-adt/adt-clients",
|
|
3
|
-
"version": "45.
|
|
3
|
+
"version": "45.1.0",
|
|
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",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"node": ">=18.0.0"
|
|
117
117
|
},
|
|
118
118
|
"dependencies": {
|
|
119
|
-
"@mcp-abap-adt/interfaces-adt": "^27.
|
|
119
|
+
"@mcp-abap-adt/interfaces-adt": "^27.1.0",
|
|
120
120
|
"@mcp-abap-adt/interfaces-adt-connection": "^4.0.0",
|
|
121
121
|
"@mcp-abap-adt/interfaces-network": "^2.0.1",
|
|
122
122
|
"@mcp-abap-adt/interfaces-utils": "^1.1.1",
|