catalyst-relay 0.2.0 → 0.2.2

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 CHANGED
@@ -59,6 +59,29 @@ const [session, loginError] = await client.login();
59
59
  if (loginError) throw loginError;
60
60
  console.log(`Logged in as ${session.username}`);
61
61
 
62
+ // --- SAML Authentication (requires playwright) ---
63
+ const [samlClient] = createClient({
64
+ url: 'https://sap-server:443',
65
+ client: '100',
66
+ auth: {
67
+ type: 'saml',
68
+ username: 'user@company.com',
69
+ password: 'pass'
70
+ },
71
+ insecure: true
72
+ });
73
+
74
+ // --- SSO Authentication (requires kerberos) ---
75
+ const [ssoClient] = createClient({
76
+ url: 'https://sap-server:443',
77
+ client: '100',
78
+ auth: {
79
+ type: 'sso',
80
+ slsUrl: 'https://sapsso.company.com'
81
+ },
82
+ insecure: true
83
+ });
84
+
62
85
  // Read ABAP objects
63
86
  const [objects, readError] = await client.read([
64
87
  { name: 'ZCL_MY_CLASS', extension: 'aclass' },
@@ -94,10 +117,33 @@ curl -X POST http://localhost:3000/login \
94
117
  }'
95
118
 
96
119
  # Response: { "success": true, "data": { "sessionId": "abc123", "username": "USER" } }
120
+
121
+ # Login with SAML
122
+ curl -X POST http://localhost:3000/login \
123
+ -H "Content-Type: application/json" \
124
+ -d '{
125
+ "url": "https://sap-server:443",
126
+ "client": "100",
127
+ "auth": { "type": "saml", "username": "user@company.com", "password": "pass" }
128
+ }'
129
+
130
+ # Login with SSO (Kerberos)
131
+ curl -X POST http://localhost:3000/login \
132
+ -H "Content-Type: application/json" \
133
+ -d '{
134
+ "url": "https://sap-server:443",
135
+ "client": "100",
136
+ "auth": { "type": "sso", "slsUrl": "https://sapsso.company.com" }
137
+ }'
97
138
  ```
98
139
 
99
140
  ## Features
100
141
 
142
+ ### Authentication
143
+ - **Basic Auth** — Username/password authentication
144
+ - **SAML** — Browser-automated SSO via identity providers (Azure AD, Okta, SAP IDP)
145
+ - **SSO (Kerberos)** — Windows domain authentication via SAP Secure Login Server
146
+
101
147
  ### Session Management
102
148
  - Login/logout with session tokens
103
149
  - Automatic CSRF token handling and refresh
@@ -224,9 +270,9 @@ if (!error) {
224
270
  ```typescript
225
271
  const [data, error] = await client.previewData({
226
272
  objectName: 'T000',
227
- columns: ['MANDT', 'MTEXT'],
228
- limit: 10,
229
- where: "MANDT = '100'"
273
+ objectType: 'table',
274
+ sqlQuery: "SELECT MANDT, MTEXT FROM T000 WHERE MANDT = '100'",
275
+ limit: 10
230
276
  });
231
277
  ```
232
278
 
@@ -281,7 +327,8 @@ curl -X POST http://localhost:3000/preview/data \
281
327
  -H "x-session-id: abc123" \
282
328
  -d '{
283
329
  "objectName": "T000",
284
- "columns": ["MANDT", "MTEXT"],
330
+ "objectType": "table",
331
+ "sqlQuery": "SELECT MANDT, MTEXT FROM T000 WHERE MANDT = '\''100'\''",
285
332
  "limit": 10
286
333
  }'
287
334
  ```
@@ -376,9 +423,8 @@ The library uses only web standard APIs (`fetch`, `Request`, `Response`, `URL`)
376
423
 
377
424
  ## Known Limitations
378
425
 
379
- - **SAML authentication**: Stubbed out, not yet implemented
380
- - **SSO (Kerberos) authentication**: Stubbed out, not yet implemented
381
- - Basic authentication is fully functional
426
+ - **SSO (Kerberos)**: Primarily tested on Windows with Active Directory; Linux/macOS requires MIT Kerberos with valid ticket (`kinit`)
427
+ - **SAML**: First run downloads Chromium browser (~150MB) for headless automation
382
428
 
383
429
  ## Dependencies
384
430
 
@@ -389,6 +435,14 @@ The library uses only web standard APIs (`fetch`, `Request`, `Response`, `URL`)
389
435
  | `undici` | HTTP client with SSL bypass support |
390
436
  | `@xmldom/xmldom` | XML parsing for ADT responses |
391
437
  | `diff` | Text diffing for git-diff feature |
438
+ | `node-forge` | Certificate parsing and RSA key generation (SSO) |
439
+
440
+ ### Optional Peer Dependencies
441
+
442
+ | Package | Required For | Install |
443
+ |---------|--------------|---------|
444
+ | `playwright` | SAML authentication | `npm install playwright` |
445
+ | `kerberos` | SSO (Kerberos) authentication | `npm install kerberos` |
392
446
 
393
447
  ## Project Structure
394
448
 
@@ -401,6 +455,9 @@ src/
401
455
  │ ├── config.ts # Configuration loading
402
456
  │ ├── adt/ # ADT operations
403
457
  │ ├── auth/ # Authentication strategies
458
+ │ │ ├── basic/ # Username/password auth
459
+ │ │ ├── saml/ # SAML browser automation
460
+ │ │ └── sso/ # Kerberos + mTLS certificates
404
461
  │ ├── session/ # Session management
405
462
  │ └── utils/ # Shared utilities
406
463
  ├── types/ # TypeScript type definitions
package/dist/index.d.mts CHANGED
@@ -10,6 +10,26 @@ interface BasicAuthConfig {
10
10
  username: string;
11
11
  password: string;
12
12
  }
13
+ /**
14
+ * CSS selectors for SAML login form
15
+ */
16
+ interface SamlFormSelectors {
17
+ /** CSS selector for username input field */
18
+ username: string;
19
+ /** CSS selector for password input field */
20
+ password: string;
21
+ /** CSS selector for submit button */
22
+ submit: string;
23
+ }
24
+ /**
25
+ * SAML provider configuration
26
+ */
27
+ interface SamlProviderConfig {
28
+ /** Whether to ignore HTTPS certificate errors */
29
+ ignoreHttpsErrors: boolean;
30
+ /** CSS selectors for login form elements */
31
+ formSelectors: SamlFormSelectors;
32
+ }
13
33
  /**
14
34
  * SAML authentication configuration
15
35
  */
@@ -17,13 +37,23 @@ interface SamlAuthConfig {
17
37
  type: 'saml';
18
38
  username: string;
19
39
  password: string;
20
- provider?: string;
40
+ /** Optional custom provider configuration for non-standard login forms */
41
+ providerConfig?: SamlProviderConfig;
21
42
  }
22
43
  /**
23
44
  * SSO (Kerberos) authentication configuration
24
45
  */
25
46
  interface SsoAuthConfig {
26
47
  type: 'sso';
48
+ /** Secure Login Server URL (e.g., https://sapsso.corp.example.com) */
49
+ slsUrl: string;
50
+ /** SLS profile name (default: SAPSSO_P) */
51
+ profile?: string;
52
+ /** Kerberos service principal name override */
53
+ servicePrincipalName?: string;
54
+ /** Force certificate re-enrollment even if valid cert exists */
55
+ forceEnroll?: boolean;
56
+ /** @deprecated Use slsUrl instead */
27
57
  certificate?: string;
28
58
  }
29
59
  /**
@@ -83,30 +113,10 @@ interface PreviewQuery {
83
113
  objectName: string;
84
114
  /** Object type ('table' or 'view') */
85
115
  objectType: 'table' | 'view';
86
- /** WHERE clause filters */
87
- filters?: Filter[];
88
- /** ORDER BY columns */
89
- orderBy?: OrderBy[];
116
+ /** SQL query to execute */
117
+ sqlQuery: string;
90
118
  /** Maximum rows to return (default: 100) */
91
119
  limit?: number;
92
- /** Row offset for pagination */
93
- offset?: number;
94
- }
95
- /**
96
- * Filter condition for data preview
97
- */
98
- interface Filter {
99
- column: string;
100
- operator: FilterOperator;
101
- value: string | number | boolean | null;
102
- }
103
- type FilterOperator = 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le' | 'like' | 'in';
104
- /**
105
- * Sort specification for data preview
106
- */
107
- interface OrderBy {
108
- column: string;
109
- direction: 'asc' | 'desc';
110
120
  }
111
121
 
112
122
  /**
@@ -402,12 +412,11 @@ interface DiffResult {
402
412
  * HTTP client for SAP ADT (ABAP Development Tools) with:
403
413
  * - Session management (login/logout)
404
414
  * - CSRF token fetching and automatic refresh
405
- * - Basic authentication (SAML and SSO to be implemented)
415
+ * - Basic, SAML, and SSO (Kerberos + mTLS) authentication
406
416
  * - Automatic retry on 403 CSRF errors
407
417
  * - Session reset on 500 errors
408
418
  *
409
419
  * Uses web standard APIs (fetch, Request, Response) - runtime-agnostic.
410
- * High-level ADT operations (CRAUD, preview, etc.) are stubs to be implemented.
411
420
  */
412
421
 
413
422
  interface ADTClient {
@@ -435,4 +444,4 @@ interface ADTClient {
435
444
  }
436
445
  declare function createClient(config: ClientConfig): Result<ADTClient, Error>;
437
446
 
438
- export { type ADTClient, type ActivationMessage, type ActivationResult, type ApiResponse, type AsyncResult, type AuthConfig, type AuthType, type BasicAuthConfig, type ClientConfig, type ColumnInfo, type DataFrame, type Dependency, type DiffResult, type DistinctResult, type ErrorCode, type ErrorResponse, type Filter, type FilterOperator, type ObjectConfig, type ObjectContent, type ObjectMetadata, type ObjectRef, type ObjectWithContent, type OrderBy, type Package, type PreviewQuery, type Result, type SamlAuthConfig, type SearchResult, type Session, type SsoAuthConfig, type SuccessResponse, type Transport, type TransportConfig, type TreeNode, type TreeQuery, type UpsertResult, createClient, err, ok };
447
+ export { type ADTClient, type ActivationMessage, type ActivationResult, type ApiResponse, type AsyncResult, type AuthConfig, type AuthType, type BasicAuthConfig, type ClientConfig, type ColumnInfo, type DataFrame, type Dependency, type DiffResult, type DistinctResult, type ErrorCode, type ErrorResponse, type ObjectConfig, type ObjectContent, type ObjectMetadata, type ObjectRef, type ObjectWithContent, type Package, type PreviewQuery, type Result, type SamlAuthConfig, type SearchResult, type Session, type SsoAuthConfig, type SuccessResponse, type Transport, type TransportConfig, type TreeNode, type TreeQuery, type UpsertResult, createClient, err, ok };
package/dist/index.d.ts CHANGED
@@ -10,6 +10,26 @@ interface BasicAuthConfig {
10
10
  username: string;
11
11
  password: string;
12
12
  }
13
+ /**
14
+ * CSS selectors for SAML login form
15
+ */
16
+ interface SamlFormSelectors {
17
+ /** CSS selector for username input field */
18
+ username: string;
19
+ /** CSS selector for password input field */
20
+ password: string;
21
+ /** CSS selector for submit button */
22
+ submit: string;
23
+ }
24
+ /**
25
+ * SAML provider configuration
26
+ */
27
+ interface SamlProviderConfig {
28
+ /** Whether to ignore HTTPS certificate errors */
29
+ ignoreHttpsErrors: boolean;
30
+ /** CSS selectors for login form elements */
31
+ formSelectors: SamlFormSelectors;
32
+ }
13
33
  /**
14
34
  * SAML authentication configuration
15
35
  */
@@ -17,13 +37,23 @@ interface SamlAuthConfig {
17
37
  type: 'saml';
18
38
  username: string;
19
39
  password: string;
20
- provider?: string;
40
+ /** Optional custom provider configuration for non-standard login forms */
41
+ providerConfig?: SamlProviderConfig;
21
42
  }
22
43
  /**
23
44
  * SSO (Kerberos) authentication configuration
24
45
  */
25
46
  interface SsoAuthConfig {
26
47
  type: 'sso';
48
+ /** Secure Login Server URL (e.g., https://sapsso.corp.example.com) */
49
+ slsUrl: string;
50
+ /** SLS profile name (default: SAPSSO_P) */
51
+ profile?: string;
52
+ /** Kerberos service principal name override */
53
+ servicePrincipalName?: string;
54
+ /** Force certificate re-enrollment even if valid cert exists */
55
+ forceEnroll?: boolean;
56
+ /** @deprecated Use slsUrl instead */
27
57
  certificate?: string;
28
58
  }
29
59
  /**
@@ -83,30 +113,10 @@ interface PreviewQuery {
83
113
  objectName: string;
84
114
  /** Object type ('table' or 'view') */
85
115
  objectType: 'table' | 'view';
86
- /** WHERE clause filters */
87
- filters?: Filter[];
88
- /** ORDER BY columns */
89
- orderBy?: OrderBy[];
116
+ /** SQL query to execute */
117
+ sqlQuery: string;
90
118
  /** Maximum rows to return (default: 100) */
91
119
  limit?: number;
92
- /** Row offset for pagination */
93
- offset?: number;
94
- }
95
- /**
96
- * Filter condition for data preview
97
- */
98
- interface Filter {
99
- column: string;
100
- operator: FilterOperator;
101
- value: string | number | boolean | null;
102
- }
103
- type FilterOperator = 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le' | 'like' | 'in';
104
- /**
105
- * Sort specification for data preview
106
- */
107
- interface OrderBy {
108
- column: string;
109
- direction: 'asc' | 'desc';
110
120
  }
111
121
 
112
122
  /**
@@ -402,12 +412,11 @@ interface DiffResult {
402
412
  * HTTP client for SAP ADT (ABAP Development Tools) with:
403
413
  * - Session management (login/logout)
404
414
  * - CSRF token fetching and automatic refresh
405
- * - Basic authentication (SAML and SSO to be implemented)
415
+ * - Basic, SAML, and SSO (Kerberos + mTLS) authentication
406
416
  * - Automatic retry on 403 CSRF errors
407
417
  * - Session reset on 500 errors
408
418
  *
409
419
  * Uses web standard APIs (fetch, Request, Response) - runtime-agnostic.
410
- * High-level ADT operations (CRAUD, preview, etc.) are stubs to be implemented.
411
420
  */
412
421
 
413
422
  interface ADTClient {
@@ -435,4 +444,4 @@ interface ADTClient {
435
444
  }
436
445
  declare function createClient(config: ClientConfig): Result<ADTClient, Error>;
437
446
 
438
- export { type ADTClient, type ActivationMessage, type ActivationResult, type ApiResponse, type AsyncResult, type AuthConfig, type AuthType, type BasicAuthConfig, type ClientConfig, type ColumnInfo, type DataFrame, type Dependency, type DiffResult, type DistinctResult, type ErrorCode, type ErrorResponse, type Filter, type FilterOperator, type ObjectConfig, type ObjectContent, type ObjectMetadata, type ObjectRef, type ObjectWithContent, type OrderBy, type Package, type PreviewQuery, type Result, type SamlAuthConfig, type SearchResult, type Session, type SsoAuthConfig, type SuccessResponse, type Transport, type TransportConfig, type TreeNode, type TreeQuery, type UpsertResult, createClient, err, ok };
447
+ export { type ADTClient, type ActivationMessage, type ActivationResult, type ApiResponse, type AsyncResult, type AuthConfig, type AuthType, type BasicAuthConfig, type ClientConfig, type ColumnInfo, type DataFrame, type Dependency, type DiffResult, type DistinctResult, type ErrorCode, type ErrorResponse, type ObjectConfig, type ObjectContent, type ObjectMetadata, type ObjectRef, type ObjectWithContent, type Package, type PreviewQuery, type Result, type SamlAuthConfig, type SearchResult, type Session, type SsoAuthConfig, type SuccessResponse, type Transport, type TransportConfig, type TreeNode, type TreeQuery, type UpsertResult, createClient, err, ok };