@mcp-abap-adt/connection 19.1.0 → 20.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +83 -1
  2. package/README.md +110 -26
  3. package/dist/config/sapConfig.d.ts +6 -1
  4. package/dist/config/sapConfig.d.ts.map +1 -1
  5. package/dist/config/sapConfig.js +11 -0
  6. package/dist/connection/AbstractAbapConnection.d.ts +8 -2
  7. package/dist/connection/AbstractAbapConnection.d.ts.map +1 -1
  8. package/dist/connection/AbstractAbapConnection.js +17 -8
  9. package/dist/connection/CloudHttpTransport.js +2 -2
  10. package/dist/connection/CredentialAbapConnection.d.ts.map +1 -1
  11. package/dist/connection/CredentialAbapConnection.js +0 -1
  12. package/dist/connection/HttpTransport.d.ts +60 -18
  13. package/dist/connection/HttpTransport.d.ts.map +1 -1
  14. package/dist/connection/HttpTransport.js +46 -27
  15. package/dist/connection/IAdtTransport.d.ts +3 -2
  16. package/dist/connection/IAdtTransport.d.ts.map +1 -1
  17. package/dist/connection/RfcTransport.d.ts +64 -9
  18. package/dist/connection/RfcTransport.d.ts.map +1 -1
  19. package/dist/connection/RfcTransport.js +174 -31
  20. package/dist/connection/createConnection.d.ts +20 -4
  21. package/dist/connection/createConnection.d.ts.map +1 -1
  22. package/dist/connection/createConnection.js +45 -28
  23. package/dist/connection/rfcConversation.d.ts +31 -26
  24. package/dist/connection/rfcConversation.d.ts.map +1 -1
  25. package/dist/connection/rfcConversation.js +32 -46
  26. package/dist/index.d.ts +3 -3
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +2 -1
  29. package/docs/INDEX.md +2 -0
  30. package/docs/MIGRATION-18.0.md +2 -0
  31. package/docs/MIGRATION-20.0.md +121 -0
  32. package/docs/MIGRATION-6.0.md +2 -0
  33. package/docs/USAGE.md +37 -13
  34. package/package.json +3 -3
package/docs/USAGE.md CHANGED
@@ -163,11 +163,14 @@ the factory picks the connector and the transport. Nothing is inferred:
163
163
  | `cloud` | `http` | `AdtCloudConnector` over `CloudHttpTransport` |
164
164
  | `onprem` | `http` | `AdtOnPremConnector` over `OnPremHttpTransport` |
165
165
  | `onprem` | `legacy-http` | `AdtOnPremConnector` over `LegacyOnPremHttpTransport` (BASIS 7.40) |
166
- | `onprem` | `rfc` | `AdtOnPremConnector` over `RfcTransport(rfcConversationFrom(config))` |
167
-
168
- Any other combination is refused at construction with a `TypeError`.
169
- `client` and `baseUrl` reach the HTTP wires from `config`. `agentOptions`,
170
- `rfc`, `wireLogger`, `logger` and `sessionId` are passed through exactly as
166
+ | `onprem` | `rfc` | `AdtOnPremConnector` over `RfcTransport(rfcConversationFrom(rfcConfig))` |
167
+
168
+ Any other combination does not compile, and one built past the types is
169
+ refused at construction with a `TypeError`. Each wire takes its own config
170
+ shape: the HTTP wires a `SapHttpConfig` (its `url`), RFC a `SapRfcConfig` (its
171
+ stated address, `client` and `language`, no URL). `client` and `baseUrl` (the
172
+ config's `url`) reach the HTTP wires from `config`. `agentOptions`,
173
+ `httpClient` (HTTP), `rfc`, `wireLogger`, `logger` and `sessionId` are passed through exactly as
171
174
  you give them; whatever you leave out takes the constructors' own defaults.
172
175
 
173
176
  **A new instance on every call.** One instance is one SAP session. After its
@@ -428,9 +431,9 @@ implied. Four things follow from it.
428
431
  > tearDownAfter(conn); // ✅ checked
429
432
  >
430
433
  > const overRfc = new AdtOnPremConnector(
431
- > config,
434
+ > rfcConfig, // a SapRfcConfig: its stated address, client and language
432
435
  > provider,
433
- > new RfcTransport(rfcConversationFrom(config), logger),
436
+ > new RfcTransport(rfcConversationFrom(rfcConfig), logger),
434
437
  > logger,
435
438
  > );
436
439
  > tearDownAfter(overRfc); // ✅ also checked — same class, different wire
@@ -930,7 +933,7 @@ interface AbapConnection {
930
933
  makeAdtRequest<T = unknown, D = unknown>(
931
934
  options: AbapRequestOptions,
932
935
  ): Promise<IAdtWireResponse<T, D>>;
933
- getBaseUrl(): Promise<string>;
936
+ getBaseUrl(): Promise<string | undefined>; // undefined over RFC: no HTTP origin
934
937
  setSessionType(type: "stateless" | "stateful"): void;
935
938
  getSessionId(): string | null; // client-side conversation id
936
939
  }
@@ -998,9 +1001,9 @@ What a request travels over, and everything true of that wire: addressing,
998
1001
  establishing, and whatever session state it keeps.
999
1002
 
1000
1003
  ```text
1001
- new HttpTransport(agentOptions?, logger?, { client?, baseUrl? })
1004
+ new HttpTransport(agentOptions?, logger?, { client?, baseUrl, httpClient? })
1002
1005
  new RfcTransport(
1003
- connect: (logon: Readonly<Record<string, string>>) => IRfcConversation,
1006
+ connect: RfcConversationFactory, // (logon) => IRfcConversation, and its logon `language`
1004
1007
  logger?,
1005
1008
  { logWire?, maxLoggedBodyChars? },
1006
1009
  )
@@ -1009,9 +1012,30 @@ new RfcTransport(
1009
1012
  `HttpTransport` is the ordinary wire, and you name it because the connector
1010
1013
  takes no default. In practice you name one of its two subclasses — the session
1011
1014
  mechanism is what differs, and `OnPremHttpTransport` / `CloudHttpTransport` are
1012
- what the connectors' type parameters admit. `RfcTransport`
1013
- you build with `rfcConversationFrom(config)`, which derives `ashost` and `sysnr`
1014
- and loads the SAP NW RFC SDK only when a conversation opens.
1015
+ what the connectors' type parameters admit. An HTTP wire is built with its
1016
+ `baseUrl`, required: a path a caller sends is put on it, and the requests the
1017
+ wire makes on its own — the CSRF fetch, the cloud preflight, the logoff — go to
1018
+ its origin. The connection hands the wire no address. `httpClient`, optional
1019
+ (20.0.0), is how the wire reaches the network — an `HttpClientFactory`:
1020
+ `create(agents)` returns the axios instance every request goes through, built
1021
+ from the wire's two pooled agents (`{ httpAgent, httpsAgent }`) when it first
1022
+ sends, and anew when a logon offers other TLS material; `logoffRequest(options,
1023
+ onResponse)` returns the Node `ClientRequest` a logoff goes out on, whose
1024
+ `finish` is the write `disconnect()` resolves at. Left out, it is the exported
1025
+ `nodeHttpClient` — axios over those agents, Node's `http` / `https` for the
1026
+ logoff — so nothing changes for a wire built without it. A test double goes
1027
+ here, under the wire, so what the wire adds to its own requests still runs.
1028
+ `RfcTransport` you build
1029
+ with `rfcConversationFrom(rfcConfig)`, which takes the RFC config's stated
1030
+ address, `client` and `language` as they are and loads the SAP NW RFC SDK only
1031
+ when a conversation opens. It states that `language` as the factory's logon
1032
+ language. A request's `sap-language` (header or query parameter) is compared
1033
+ with the logon language of the conversation that would carry it — the `lang`
1034
+ its logon carries: the provider's where it writes one, else the factory's. A
1035
+ non-stateful request naming another one goes on a conversation logged on in
1036
+ it, opened for that call and closed after it, and a stateful one is refused
1037
+ before it is sent — a session cannot change its language. See the README, "A request's
1038
+ language over RFC".
1015
1039
 
1016
1040
  **What the wire takes from the credential.** The provider writes it, the wire
1017
1041
  carries it; the wire never reads `config.username` or `config.password`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/connection",
3
- "version": "19.1.0",
3
+ "version": "20.1.0",
4
4
  "description": "ABAP connection layer for MCP ABAP ADT server",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -52,9 +52,9 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@mcp-abap-adt/auth-errors": "^2.2.1",
55
- "@mcp-abap-adt/interfaces-adt-connection": "^3.0.0",
55
+ "@mcp-abap-adt/interfaces-adt-connection": "^4.0.0",
56
56
  "@mcp-abap-adt/interfaces-auth": "^7.5.0",
57
- "@mcp-abap-adt/interfaces-auth-sap": "^3.4.0",
57
+ "@mcp-abap-adt/interfaces-auth-sap": "^4.0.0",
58
58
  "@mcp-abap-adt/interfaces-network": "^2.0.1",
59
59
  "@mcp-abap-adt/interfaces-utils": "^1.1.1",
60
60
  "axios": "^1.16.0"