abap-local-client 1.4.0 → 1.4.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/sso-sap-client.mjs +16 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abap-local-client",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "SAP Local Client — WebSocket bridge with Basic, SPNEGO, X.509, SAML & SNC authentication",
5
5
  "main": "sso-sap-client.mjs",
6
6
  "type": "module",
@@ -63,13 +63,22 @@ async function _createSession(resolvedId) {
63
63
  let useRfc = (authMode === 'snc' || hasSaprouter);
64
64
 
65
65
  if (useRfc) {
66
- console.log(` 🛰️ RFC mode (no HTTP)`);
67
- rfcClient = new SAPRFCClient({
66
+ console.log(` 🛰️ RFC mode (${authMode === 'snc' ? 'SNC' : 'Basic'})`);
67
+ const rfcParams = {
68
68
  host: conn.host, sysnr: conn.sysnr || '00',
69
69
  client: conn.client || '100', username: conn.username || '',
70
70
  password: conn.password || '', language: conn.language || 'EN',
71
71
  saprouter: conn.saprouter || '',
72
- });
72
+ };
73
+ if (authMode === 'snc') {
74
+ rfcParams.sncMode = '1';
75
+ if (conn.sncPartnerName) rfcParams.sncPartnerName = conn.sncPartnerName;
76
+ if (conn.sncMyName) rfcParams.sncMyName = conn.sncMyName;
77
+ if (conn.sncQop) rfcParams.sncQop = conn.sncQop;
78
+ if (conn.sncLib) rfcParams.sncLib = conn.sncLib;
79
+ console.log(` 🔐 SNC partner: ${conn.sncPartnerName || '(not set)'}`);
80
+ }
81
+ rfcClient = new SAPRFCClient(rfcParams);
73
82
  try {
74
83
  await rfcClient.connect();
75
84
  console.log(` ✅ RFC connection established`);
@@ -85,8 +94,8 @@ async function _createSession(resolvedId) {
85
94
  conn.username || '', conn.password || '',
86
95
  { language: conn.language || 'EN' });
87
96
  await httpSession.init();
88
- } else if (!useRfc && authMode === 'snc') {
89
- throw new Error(`Auth mode not yet implemented: ${authMode}`);
97
+ } else if (!useRfc) {
98
+ throw new Error(`RFC connection required for auth mode "${authMode}" but failed to connect`);
90
99
  }
91
100
 
92
101
  return { useRfc, rfcClient, httpSession, authMode, sysConfig, resolvedId };
@@ -644,7 +653,8 @@ class WebSocketClient {
644
653
  if (!sys) { this.sendResponse(requestId, false, { error: `Unknown system: ${sid}` }); return; }
645
654
  this.currentSystemId = sid;
646
655
  this.lockManager.clearAll();
647
- await this.initSapClient();
656
+ const ok = await this.initSapClient();
657
+ if (!ok) { this.sendResponse(requestId, false, { error: `Failed to connect to ${sid}. Check RFC/SNC config and logs.` }); return; }
648
658
  this.sendResponse(requestId, true, [{ success: true, data: { system: sid, authMode: sys.authMode } }]);
649
659
  return;
650
660
  }