@mcp-abap-adt/connection 16.0.0 → 17.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/CHANGELOG.md +63 -1
- package/README.md +74 -18
- package/dist/connection/AbstractAbapConnection.d.ts +67 -19
- package/dist/connection/AbstractAbapConnection.d.ts.map +1 -1
- package/dist/connection/AbstractAbapConnection.js +141 -32
- package/dist/connection/AdtCloudConnector.d.ts +6 -1
- package/dist/connection/AdtCloudConnector.d.ts.map +1 -1
- package/dist/connection/AdtCloudConnector.js +7 -2
- package/dist/connection/AdtOnPremConnector.d.ts +6 -1
- package/dist/connection/AdtOnPremConnector.d.ts.map +1 -1
- package/dist/connection/AdtOnPremConnector.js +7 -2
- package/dist/connection/CloudHttpTransport.d.ts.map +1 -1
- package/dist/connection/CloudHttpTransport.js +2 -3
- package/dist/connection/CredentialAbapConnection.d.ts +3 -1
- package/dist/connection/CredentialAbapConnection.d.ts.map +1 -1
- package/dist/connection/CredentialAbapConnection.js +4 -2
- package/dist/connection/GenericWebSocketTransport.d.ts.map +1 -1
- package/dist/connection/GenericWebSocketTransport.js +7 -4
- package/dist/connection/HttpTransport.d.ts +19 -0
- package/dist/connection/HttpTransport.d.ts.map +1 -1
- package/dist/connection/HttpTransport.js +115 -5
- package/dist/connection/IAdtTransport.d.ts +34 -3
- package/dist/connection/IAdtTransport.d.ts.map +1 -1
- package/dist/connection/RfcTransport.d.ts +7 -0
- package/dist/connection/RfcTransport.d.ts.map +1 -1
- package/dist/connection/RfcTransport.js +14 -3
- package/dist/connection/createConnection.d.ts +18 -0
- package/dist/connection/createConnection.d.ts.map +1 -1
- package/dist/connection/createConnection.js +8 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -5
- package/docs/INDEX.md +2 -0
- package/docs/MIGRATION-17.0.md +119 -0
- package/docs/SCOPE.md +7 -2
- package/docs/STATEFUL_SESSION_GUIDE.md +12 -11
- package/docs/USAGE.md +119 -36
- package/package.json +1 -1
- package/dist/utils/timeouts.d.ts +0 -18
- package/dist/utils/timeouts.d.ts.map +0 -1
- package/dist/utils/timeouts.js +0 -37
package/docs/USAGE.md
CHANGED
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
import {
|
|
20
20
|
AdtOnPremConnector,
|
|
21
21
|
OnPremHttpTransport,
|
|
22
|
-
getTimeout,
|
|
23
22
|
} from '@mcp-abap-adt/connection';
|
|
24
23
|
import { BasicAuthProvider } from '@mcp-abap-adt/auth-providers';
|
|
25
24
|
import { SapConfig } from '@mcp-abap-adt/connection';
|
|
@@ -61,7 +60,7 @@ await connection.connect();
|
|
|
61
60
|
const response = await connection.makeAdtRequest({
|
|
62
61
|
method: 'GET',
|
|
63
62
|
url: '/sap/bc/adt/repository/nodestructure',
|
|
64
|
-
timeout:
|
|
63
|
+
timeout: 0,
|
|
65
64
|
});
|
|
66
65
|
|
|
67
66
|
console.log(response.data);
|
|
@@ -122,7 +121,6 @@ For SAP BTP ABAP Environment. Token refresh belongs to
|
|
|
122
121
|
import {
|
|
123
122
|
AdtCloudConnector,
|
|
124
123
|
CloudHttpTransport,
|
|
125
|
-
getTimeout,
|
|
126
124
|
} from '@mcp-abap-adt/connection';
|
|
127
125
|
import { TokenAuthProvider } from '@mcp-abap-adt/auth-providers';
|
|
128
126
|
|
|
@@ -151,7 +149,7 @@ await connection.connect(); // required: nothing is established implicitly
|
|
|
151
149
|
const response = await connection.makeAdtRequest({
|
|
152
150
|
method: 'GET',
|
|
153
151
|
url: '/sap/bc/adt/repository/nodestructure',
|
|
154
|
-
timeout:
|
|
152
|
+
timeout: 0,
|
|
155
153
|
});
|
|
156
154
|
```
|
|
157
155
|
|
|
@@ -177,6 +175,87 @@ you give them; whatever you leave out takes the constructors' own defaults.
|
|
|
177
175
|
`createConnection(...)`. The constructors still work for anything the
|
|
178
176
|
factory does not name.
|
|
179
177
|
|
|
178
|
+
### An instance on an existing session: `session` and `sessionCookies()`
|
|
179
|
+
|
|
180
|
+
`sessionCookies()` returns the cookies of the instance's SAP session as one
|
|
181
|
+
`Cookie`-header string: `SAP_SESSIONID_*`, `sap-usercontext`, `sap-contextid`
|
|
182
|
+
when a stateful request opened a context, and whatever else the server set to
|
|
183
|
+
keep the session where it lives — everything the wire holds but `sap-XSRF_*`,
|
|
184
|
+
which belongs to the CSRF token and is earned again. It is `null` before a
|
|
185
|
+
session, after the session ended, and over RFC. The string acts as the user
|
|
186
|
+
for as long as the session lives: keep it as a secret. The package never logs
|
|
187
|
+
it.
|
|
188
|
+
|
|
189
|
+
Hand it back as `session` to build an instance on that session instead of a
|
|
190
|
+
new one (HTTP wires only — over RFC, whose session is a conversation, it is
|
|
191
|
+
refused at construction; an empty string is refused too):
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
const resumed = createConnection({
|
|
195
|
+
system: 'onprem',
|
|
196
|
+
transport: 'http',
|
|
197
|
+
config,
|
|
198
|
+
credential: new BasicAuthProvider(config.username, config.password),
|
|
199
|
+
session: keptCookies, // what an earlier instance's sessionCookies() returned
|
|
200
|
+
});
|
|
201
|
+
await resumed.connect();
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
What `connect()` does then:
|
|
205
|
+
|
|
206
|
+
1. It prepares the credential as always, and **logs on nowhere**.
|
|
207
|
+
2. It makes **one request in that session, without the credential**: the CSRF
|
|
208
|
+
fetch (`GET /sap/bc/adt/core/discovery` with `x-csrf-token: fetch`, the
|
|
209
|
+
fallback `/sap/bc/adt/discovery` on a `404`; on cloud with
|
|
210
|
+
`x-sap-security-session: use`, and no preflight), following no redirect.
|
|
211
|
+
Without the credential,
|
|
212
|
+
because a credential on that request would open a NEW session when the old
|
|
213
|
+
one is gone (measured: a dead session cookie with a good password gets a new
|
|
214
|
+
`SAP_SESSIONID`).
|
|
215
|
+
3. **Alive** — a CSRF token, and the `SAP_SESSIONID` that was handed over,
|
|
216
|
+
unchanged: the session is this instance's. A stateful request reaches the
|
|
217
|
+
ABAP context `sap-contextid` names (an `UNLOCK` lands in the old context);
|
|
218
|
+
later requests carry the credential as usual; a session lost later is
|
|
219
|
+
reported as for any instance (`ADT_SESSION_REPLACED`); `disconnect()` logs it
|
|
220
|
+
off as for any instance.
|
|
221
|
+
4. **Gone** — a `401`, a redirect (a `3xx` is not the session answering; it is
|
|
222
|
+
not followed, so its target is never asked and nothing it sets is taken), or
|
|
223
|
+
any answer that is not the session's (another `SAP_SESSIONID`, none, no
|
|
224
|
+
token): `connect()` rejects with SAP's answer as it is (`error.response`,
|
|
225
|
+
with the status and headers SAP gave). Nothing was opened, so nothing is logged off, and the
|
|
226
|
+
instance is spent.
|
|
227
|
+
|
|
228
|
+
The credential's logon moment (`establish`, which brings TLS material) is
|
|
229
|
+
offered only after the session answered, so it never rides on that request.
|
|
230
|
+
|
|
231
|
+
**Logging a kept session off without `connect()`** (since 17.1.0). An instance
|
|
232
|
+
built with `session` may be disconnected without ever connecting — for a
|
|
233
|
+
leftover session of a process that is gone:
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
const leftover = createConnection({
|
|
237
|
+
system: 'onprem',
|
|
238
|
+
transport: 'http',
|
|
239
|
+
config,
|
|
240
|
+
credential: new BasicAuthProvider(config.username, config.password),
|
|
241
|
+
session: keptCookies,
|
|
242
|
+
});
|
|
243
|
+
await leftover.disconnect(); // the logoff has left; no connect() needed
|
|
244
|
+
await leftover.flushGoodbye(); // only if you need SAP's answer too
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
`disconnect()` then sends **the logoff and nothing else**: the ICF logoff
|
|
248
|
+
(`/sap/public/bc/icf/logoff`, on cloud too — measured to end a cloud security
|
|
249
|
+
session) with the handed cookies, without `sap-contextid`, without the
|
|
250
|
+
credential and with no CSRF fetch or other request before it; the credential's
|
|
251
|
+
`prepare()` is never called. It resolves when the logoff is written, as always,
|
|
252
|
+
and `flushGoodbye()` waits for SAP's answer. A string that names no
|
|
253
|
+
`SAP_SESSIONID` sends nothing. The instance is spent either way: a second
|
|
254
|
+
`disconnect()` rejects, and so does a `connect()` after it. An instance built
|
|
255
|
+
without `session` sends nothing at a `disconnect()` before `connect()`, as
|
|
256
|
+
before. Whether the session was still alive is SAP's to know; the logoff's
|
|
257
|
+
answer is not read.
|
|
258
|
+
|
|
180
259
|
Wrapping the connection with your own HTTP request logging stays with the
|
|
181
260
|
consumer. That is a policy of yours, typically read from your environment, not
|
|
182
261
|
a property of the wire. The factory passes `wireLogger` to the transport,
|
|
@@ -192,7 +271,6 @@ them is refused with `ADT_NOT_CONNECTED`.
|
|
|
192
271
|
### GET Request
|
|
193
272
|
|
|
194
273
|
```typescript
|
|
195
|
-
import { getTimeout } from '@mcp-abap-adt/connection';
|
|
196
274
|
// The body is XML: name its type, or the answer's `data` is `unknown`.
|
|
197
275
|
const packages = await connection.makeAdtRequest<string>({
|
|
198
276
|
method: 'GET',
|
|
@@ -202,14 +280,13 @@ const packages = await connection.makeAdtRequest<string>({
|
|
|
202
280
|
parent_type: 'DEVC/K',
|
|
203
281
|
withShortDescriptions: 'true',
|
|
204
282
|
},
|
|
205
|
-
timeout:
|
|
283
|
+
timeout: 0,
|
|
206
284
|
});
|
|
207
285
|
```
|
|
208
286
|
|
|
209
287
|
### POST Request (Create Object)
|
|
210
288
|
|
|
211
289
|
```typescript
|
|
212
|
-
import { getTimeout } from '@mcp-abap-adt/connection';
|
|
213
290
|
const classXml = `<?xml version="1.0" encoding="UTF-8"?>
|
|
214
291
|
<class:abapClass xmlns:class="http://www.sap.com/adt/oo/classes"
|
|
215
292
|
class:name="ZCL_MY_CLASS">
|
|
@@ -222,7 +299,7 @@ const response = await connection.makeAdtRequest({
|
|
|
222
299
|
headers: { 'Content-Type': 'application/xml' },
|
|
223
300
|
data: classXml,
|
|
224
301
|
params: { package: 'ZTEST' },
|
|
225
|
-
timeout:
|
|
302
|
+
timeout: 0,
|
|
226
303
|
});
|
|
227
304
|
```
|
|
228
305
|
|
|
@@ -231,26 +308,24 @@ const response = await connection.makeAdtRequest({
|
|
|
231
308
|
```typescript
|
|
232
309
|
const classSourceCode = 'CLASS zcl_my_class DEFINITION ...';
|
|
233
310
|
const lockToken = 'the handle the lock call returned';
|
|
234
|
-
import { getTimeout } from '@mcp-abap-adt/connection';
|
|
235
311
|
await connection.makeAdtRequest({
|
|
236
312
|
method: 'PUT',
|
|
237
313
|
url: '/sap/bc/adt/oo/classes/zcl_my_class/source/main',
|
|
238
314
|
headers: { 'Content-Type': 'text/plain' },
|
|
239
315
|
data: classSourceCode, // the new source, as a string
|
|
240
316
|
params: { lockHandle: lockToken }, // from the lock you took first
|
|
241
|
-
timeout:
|
|
317
|
+
timeout: 0,
|
|
242
318
|
});
|
|
243
319
|
```
|
|
244
320
|
|
|
245
321
|
### DELETE Request
|
|
246
322
|
|
|
247
323
|
```typescript
|
|
248
|
-
import { getTimeout } from '@mcp-abap-adt/connection';
|
|
249
324
|
await connection.makeAdtRequest({
|
|
250
325
|
method: 'DELETE',
|
|
251
326
|
url: '/sap/bc/adt/oo/classes/zcl_my_class',
|
|
252
327
|
params: { deleteOption: 'deleteAndLocalVersions' },
|
|
253
|
-
timeout:
|
|
328
|
+
timeout: 0,
|
|
254
329
|
});
|
|
255
330
|
```
|
|
256
331
|
|
|
@@ -261,7 +336,7 @@ await connection.makeAdtRequest({
|
|
|
261
336
|
By default, connections are stateless - each request gets fresh cookies and CSRF tokens:
|
|
262
337
|
|
|
263
338
|
```typescript
|
|
264
|
-
import { AdtOnPremConnector, OnPremHttpTransport
|
|
339
|
+
import { AdtOnPremConnector, OnPremHttpTransport } from '@mcp-abap-adt/connection';
|
|
265
340
|
import { BasicAuthProvider } from '@mcp-abap-adt/auth-providers';
|
|
266
341
|
const connection = new AdtOnPremConnector(
|
|
267
342
|
config,
|
|
@@ -275,7 +350,7 @@ const connection = new AdtOnPremConnector(
|
|
|
275
350
|
await connection.connect();
|
|
276
351
|
|
|
277
352
|
// Each request is independent
|
|
278
|
-
await connection.makeAdtRequest({ method: 'GET', url: '/sap/bc/adt/discovery' , timeout:
|
|
353
|
+
await connection.makeAdtRequest({ method: 'GET', url: '/sap/bc/adt/discovery' , timeout: 0 });
|
|
279
354
|
```
|
|
280
355
|
|
|
281
356
|
### Stateful Mode (HTTP Context)
|
|
@@ -287,7 +362,7 @@ writes from running in the lock context and failing with PAK/058 or an invalid
|
|
|
287
362
|
lock handle. See [HTTP context isolation](./STATEFUL_SESSION_GUIDE.md#http-context-isolation-931).
|
|
288
363
|
|
|
289
364
|
```typescript
|
|
290
|
-
import { AdtOnPremConnector, OnPremHttpTransport
|
|
365
|
+
import { AdtOnPremConnector, OnPremHttpTransport } from '@mcp-abap-adt/connection';
|
|
291
366
|
import { BasicAuthProvider } from '@mcp-abap-adt/auth-providers';
|
|
292
367
|
const connection = new AdtOnPremConnector(
|
|
293
368
|
config,
|
|
@@ -304,7 +379,7 @@ await connection.connect();
|
|
|
304
379
|
connection.setSessionType('stateful');
|
|
305
380
|
|
|
306
381
|
// Following requests use the stateful context until the mode is changed
|
|
307
|
-
await connection.makeAdtRequest({ method: 'GET', url: '/sap/bc/adt/discovery' , timeout:
|
|
382
|
+
await connection.makeAdtRequest({ method: 'GET', url: '/sap/bc/adt/discovery' , timeout: 0 });
|
|
308
383
|
|
|
309
384
|
// Check session mode
|
|
310
385
|
console.log(connection.getSessionMode()); // 'stateful'
|
|
@@ -435,12 +510,11 @@ side instead of a condition that silently stops matching. The codes live in
|
|
|
435
510
|
|
|
436
511
|
```typescript
|
|
437
512
|
import { ADT_SESSION_ERROR } from '@mcp-abap-adt/interfaces-adt-connection';
|
|
438
|
-
import { getTimeout } from '@mcp-abap-adt/connection';
|
|
439
513
|
|
|
440
514
|
const options = {
|
|
441
515
|
method: 'GET',
|
|
442
516
|
url: '/sap/bc/adt/repository/nodestructure',
|
|
443
|
-
timeout:
|
|
517
|
+
timeout: 0,
|
|
444
518
|
};
|
|
445
519
|
|
|
446
520
|
try {
|
|
@@ -537,6 +611,9 @@ the logoff is the backstop, not the way to finish your work.
|
|
|
537
611
|
retried.
|
|
538
612
|
3. A successful `connect()` (200) sends no logoff; the session lives until
|
|
539
613
|
`disconnect()`.
|
|
614
|
+
An instance built on a kept session (`session`) and never connected sends
|
|
615
|
+
it at `disconnect()` with the handed cookies when they name a
|
|
616
|
+
`SAP_SESSIONID_*` (see "Logging a kept session off without `connect()`").
|
|
540
617
|
4. Where it goes: on-premise, the platform's ICF logoff
|
|
541
618
|
(`/sap/public/bc/icf/logoff`). On cloud, the logoff resource the session
|
|
542
619
|
document links to; when it links none, the same ICF logoff, sent exactly as
|
|
@@ -555,10 +632,11 @@ The connection does **not** track locks — it does not know one exists, what
|
|
|
555
632
|
object it covers, or what would release it. Pairing every LOCK with its UNLOCK is
|
|
556
633
|
`@mcp-abap-adt/adt-clients`' job, and it does it per object in its lock registry.
|
|
557
634
|
|
|
558
|
-
What this layer owns is
|
|
559
|
-
|
|
560
|
-
leaves an operation whose outcome you cannot
|
|
561
|
-
succeeded server-side, with a handle you
|
|
635
|
+
What this layer owns is that no deadline cuts such a span. A client deadline
|
|
636
|
+
closes the socket, and SAP then ends the synchronous request running on it — a
|
|
637
|
+
write in it lost — and leaves you an operation whose outcome you cannot
|
|
638
|
+
determine: a `LOCK` that may have succeeded server-side, with a handle you
|
|
639
|
+
never received:
|
|
562
640
|
|
|
563
641
|
```typescript
|
|
564
642
|
connection.beginCriticalSection();
|
|
@@ -571,16 +649,21 @@ try {
|
|
|
571
649
|
}
|
|
572
650
|
```
|
|
573
651
|
|
|
574
|
-
While a section is active
|
|
575
|
-
`
|
|
576
|
-
|
|
652
|
+
While a section is active a request carries **no deadline at all** — not the
|
|
653
|
+
`timeout` you passed either, and no ceiling of the package's own (17.0.0
|
|
654
|
+
removed `SAP_TIMEOUT_CRITICAL`). The pair is reference-counted, so nesting is
|
|
577
655
|
safe.
|
|
578
656
|
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
locked object. Those requests share one ABAP session, and
|
|
582
|
-
session in the same uncertain state during a span someone declared
|
|
583
|
-
precisely to avoid it.
|
|
657
|
+
This is **connection-wide**: while any section is active, every request on that
|
|
658
|
+
connection goes without a deadline, including one that has nothing to do with
|
|
659
|
+
the locked object. Those requests share one ABAP session, and a cut one leaves
|
|
660
|
+
that session in the same uncertain state during a span someone declared
|
|
661
|
+
sensitive precisely to avoid it.
|
|
662
|
+
|
|
663
|
+
Outside a section a request carries the `timeout` you passed, unchanged, and
|
|
664
|
+
nothing else: the CSRF fetch and the cloud preflight carry none either.
|
|
665
|
+
`IAbapRequestOptions.timeout` is still a required field of the contract; `0` is
|
|
666
|
+
none over HTTP, and the RFC wire reads it not at all.
|
|
584
667
|
|
|
585
668
|
### When the session is lost
|
|
586
669
|
|
|
@@ -647,7 +730,7 @@ console.log(connectionWithOwnId.getSessionId()); // 'custom-session-123'
|
|
|
647
730
|
Dynamically switch between stateful and stateless modes:
|
|
648
731
|
|
|
649
732
|
```typescript
|
|
650
|
-
import { AdtOnPremConnector, OnPremHttpTransport
|
|
733
|
+
import { AdtOnPremConnector, OnPremHttpTransport } from '@mcp-abap-adt/connection';
|
|
651
734
|
import { BasicAuthProvider } from '@mcp-abap-adt/auth-providers';
|
|
652
735
|
// Start in stateless mode (default)
|
|
653
736
|
const connection = new AdtOnPremConnector(
|
|
@@ -665,7 +748,7 @@ await connection.connect();
|
|
|
665
748
|
connection.setSessionType('stateful');
|
|
666
749
|
|
|
667
750
|
// Do stateful operations...
|
|
668
|
-
await connection.makeAdtRequest({ method: 'POST', url: '...' , timeout:
|
|
751
|
+
await connection.makeAdtRequest({ method: 'POST', url: '...' , timeout: 0 });
|
|
669
752
|
|
|
670
753
|
// Switch back to stateless
|
|
671
754
|
connection.setSessionType('stateless');
|
|
@@ -746,12 +829,11 @@ const connection = new AdtOnPremConnector(
|
|
|
746
829
|
### Basic Error Handling
|
|
747
830
|
|
|
748
831
|
```typescript
|
|
749
|
-
import { getTimeout } from '@mcp-abap-adt/connection';
|
|
750
832
|
try {
|
|
751
833
|
await connection.makeAdtRequest({
|
|
752
834
|
method: 'GET',
|
|
753
835
|
url: '/sap/bc/adt/invalid/endpoint',
|
|
754
|
-
timeout:
|
|
836
|
+
timeout: 0,
|
|
755
837
|
});
|
|
756
838
|
} catch (error) {
|
|
757
839
|
const failure = error as {
|
|
@@ -784,12 +866,11 @@ When these errors occur, the connection:
|
|
|
784
866
|
3. **Logs the error** with full context for troubleshooting
|
|
785
867
|
|
|
786
868
|
```typescript
|
|
787
|
-
import { getTimeout } from '@mcp-abap-adt/connection';
|
|
788
869
|
try {
|
|
789
870
|
await connection.makeAdtRequest({
|
|
790
871
|
method: 'GET',
|
|
791
872
|
url: '/sap/bc/adt/repository/nodestructure',
|
|
792
|
-
timeout:
|
|
873
|
+
timeout: 0,
|
|
793
874
|
});
|
|
794
875
|
} catch (error) {
|
|
795
876
|
const failure = error as {
|
|
@@ -862,6 +943,7 @@ class AdtOnPremConnector<
|
|
|
862
943
|
transport: TTransport,
|
|
863
944
|
logger?: ILogger | null,
|
|
864
945
|
sessionId?: string,
|
|
946
|
+
session?: string, // an existing session to take over; HTTP wires only
|
|
865
947
|
);
|
|
866
948
|
}
|
|
867
949
|
|
|
@@ -875,6 +957,7 @@ class AdtCloudConnector<
|
|
|
875
957
|
transport: TTransport,
|
|
876
958
|
logger?: ILogger | null,
|
|
877
959
|
sessionId?: string,
|
|
960
|
+
session?: string, // an existing session to take over
|
|
878
961
|
);
|
|
879
962
|
}
|
|
880
963
|
```
|
package/package.json
CHANGED
package/dist/utils/timeouts.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ITimeoutConfig } from '@mcp-abap-adt/interfaces-adt-connection';
|
|
2
|
-
export type TimeoutConfig = ITimeoutConfig;
|
|
3
|
-
export declare function getTimeoutConfig(): ITimeoutConfig;
|
|
4
|
-
export declare function getTimeout(type?: 'default' | 'csrf' | 'long' | number): number;
|
|
5
|
-
/**
|
|
6
|
-
* Large ceiling timeout applied while a connection is inside an uninterruptible
|
|
7
|
-
* critical section (lock → modify → unlock). A short per-request timeout must
|
|
8
|
-
* not abort such a request mid-flight — not because aborting ends anything on
|
|
9
|
-
* the server, but because it ends what the CLIENT knows: the modification may
|
|
10
|
-
* or may not have been applied, and the handle `unlock` needs is gone, while
|
|
11
|
-
* the lock and the ABAP session holding it sit there until that server-side
|
|
12
|
-
* idle timeout, which this side can neither read nor influence.
|
|
13
|
-
* Configurable via SAP_TIMEOUT_CRITICAL (ms).
|
|
14
|
-
* Default 600000 (10 minutes) — a generous ceiling that still guards against a
|
|
15
|
-
* permanently dead socket hanging forever.
|
|
16
|
-
*/
|
|
17
|
-
export declare function getCriticalSectionTimeout(): number;
|
|
18
|
-
//# sourceMappingURL=timeouts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timeouts.d.ts","sourceRoot":"","sources":["../../src/utils/timeouts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAG9E,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC;AAE3C,wBAAgB,gBAAgB,IAAI,cAAc,CAajD;AAED,wBAAgB,UAAU,CACxB,IAAI,GAAE,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAkB,GACrD,MAAM,CAOR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAElD"}
|
package/dist/utils/timeouts.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTimeoutConfig = getTimeoutConfig;
|
|
4
|
-
exports.getTimeout = getTimeout;
|
|
5
|
-
exports.getCriticalSectionTimeout = getCriticalSectionTimeout;
|
|
6
|
-
function getTimeoutConfig() {
|
|
7
|
-
const defaultTimeout = parseInt(process.env.SAP_TIMEOUT_DEFAULT || '45000', 10);
|
|
8
|
-
const csrfTimeout = parseInt(process.env.SAP_TIMEOUT_CSRF || '15000', 10);
|
|
9
|
-
const longTimeout = parseInt(process.env.SAP_TIMEOUT_LONG || '60000', 10);
|
|
10
|
-
return {
|
|
11
|
-
default: defaultTimeout,
|
|
12
|
-
csrf: csrfTimeout,
|
|
13
|
-
long: longTimeout,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function getTimeout(type = 'default') {
|
|
17
|
-
if (typeof type === 'number') {
|
|
18
|
-
return type;
|
|
19
|
-
}
|
|
20
|
-
const config = getTimeoutConfig();
|
|
21
|
-
return config[type];
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Large ceiling timeout applied while a connection is inside an uninterruptible
|
|
25
|
-
* critical section (lock → modify → unlock). A short per-request timeout must
|
|
26
|
-
* not abort such a request mid-flight — not because aborting ends anything on
|
|
27
|
-
* the server, but because it ends what the CLIENT knows: the modification may
|
|
28
|
-
* or may not have been applied, and the handle `unlock` needs is gone, while
|
|
29
|
-
* the lock and the ABAP session holding it sit there until that server-side
|
|
30
|
-
* idle timeout, which this side can neither read nor influence.
|
|
31
|
-
* Configurable via SAP_TIMEOUT_CRITICAL (ms).
|
|
32
|
-
* Default 600000 (10 minutes) — a generous ceiling that still guards against a
|
|
33
|
-
* permanently dead socket hanging forever.
|
|
34
|
-
*/
|
|
35
|
-
function getCriticalSectionTimeout() {
|
|
36
|
-
return parseInt(process.env.SAP_TIMEOUT_CRITICAL || '600000', 10);
|
|
37
|
-
}
|