@abapify/adt-puppeteer 0.4.33 → 0.4.38
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 +16 -330
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +9 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,352 +1,38 @@
|
|
|
1
1
|
# @abapify/adt-puppeteer
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@abapify/adt-puppeteer)
|
|
4
|
+
[](https://github.com/abapify/adt-cli/blob/main/LICENSE)
|
|
4
5
|
|
|
5
|
-
Puppeteer-based
|
|
6
|
+
Puppeteer-based authentication for SAP ADT (SSO/IDP).
|
|
6
7
|
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
- 🔐 **SSO/IDP Support** - Works with Okta, Azure AD, and other identity providers
|
|
10
|
-
- 💾 **Session Persistence** - Reuse Okta tokens across runs
|
|
11
|
-
- 🎭 **Puppeteer-powered** - Mature, well-tested browser automation
|
|
12
|
-
- ⚡ **Fast** - Skip login when session is still valid
|
|
13
|
-
- 🔄 **AuthManager Integration** - Works seamlessly with ADT CLI
|
|
14
|
-
|
|
15
|
-
## Installation
|
|
8
|
+
## Install
|
|
16
9
|
|
|
17
10
|
```bash
|
|
18
|
-
npm install @abapify/adt-puppeteer
|
|
11
|
+
npm install @abapify/adt-puppeteer
|
|
19
12
|
```
|
|
20
13
|
|
|
21
|
-
##
|
|
14
|
+
## Usage
|
|
22
15
|
|
|
23
|
-
```
|
|
16
|
+
```ts
|
|
24
17
|
// adt.config.ts
|
|
25
18
|
import { defineConfig } from '@abapify/adt-config';
|
|
26
19
|
import { withPuppeteer } from '@abapify/adt-puppeteer';
|
|
27
20
|
|
|
28
21
|
export default withPuppeteer(
|
|
29
|
-
defineConfig({
|
|
30
|
-
destinations: {
|
|
31
|
-
DEV: 'https://sap-dev.example.com',
|
|
32
|
-
PROD: 'https://sap-prod.example.com',
|
|
33
|
-
},
|
|
34
|
-
}),
|
|
35
|
-
{
|
|
36
|
-
userDataDir: true, // Enable session persistence
|
|
37
|
-
headless: false, // Show browser window for SSO
|
|
38
|
-
requiredCookies: ['SAP_SESSIONID_*', 'sap-usercontext'],
|
|
39
|
-
},
|
|
40
|
-
);
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Direct API Usage
|
|
44
|
-
|
|
45
|
-
```typescript
|
|
46
|
-
import { puppeteerAuth, toCookieHeader } from '@abapify/adt-puppeteer';
|
|
47
|
-
|
|
48
|
-
// Authenticate - opens browser for SSO login
|
|
49
|
-
const credentials = await puppeteerAuth.authenticate({
|
|
50
|
-
url: 'https://sap-system.example.com',
|
|
51
|
-
userDataDir: true,
|
|
52
|
-
headless: false,
|
|
53
|
-
requiredCookies: ['SAP_SESSIONID_*', 'sap-usercontext'],
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// Convert to Cookie header for HTTP requests
|
|
57
|
-
const cookieHeader = toCookieHeader(credentials);
|
|
58
|
-
|
|
59
|
-
// Test if session is still valid
|
|
60
|
-
const result = await puppeteerAuth.test(credentials);
|
|
61
|
-
console.log(result.valid); // true/false
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## How It Works
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
68
|
-
│ Authentication Flow │
|
|
69
|
-
├─────────────────────────────────────────────────────────────────┤
|
|
70
|
-
│ │
|
|
71
|
-
│ 1. Launch Browser ──► 2. Navigate to SAP ──► 3. SSO Redirect │
|
|
72
|
-
│ │ │ │
|
|
73
|
-
│ ▼ ▼ │
|
|
74
|
-
│ [Persistent Profile] [User completes login] │
|
|
75
|
-
│ │ │ │
|
|
76
|
-
│ ▼ ▼ │
|
|
77
|
-
│ 4. Check Session ◄─────────────────────── 5. Capture Cookies │
|
|
78
|
-
│ │ │ │
|
|
79
|
-
│ ▼ ▼ │
|
|
80
|
-
│ [Valid? Skip login] [Return credentials] │
|
|
81
|
-
│ │
|
|
82
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
1. **Launch Browser** - Opens Chrome with optional persistent profile
|
|
86
|
-
2. **Navigate to SAP** - Goes to ADT discovery endpoint
|
|
87
|
-
3. **SSO Redirect** - Browser redirects to Okta/IDP
|
|
88
|
-
4. **User Login** - User completes 2FA/SSO in browser
|
|
89
|
-
5. **Capture Cookies** - Waits for required cookies, extracts session
|
|
90
|
-
|
|
91
|
-
## Options
|
|
92
|
-
|
|
93
|
-
````typescript
|
|
94
|
-
interface PuppeteerAuthOptions {
|
|
95
|
-
/** SAP system URL (required) */
|
|
96
|
-
url: string;
|
|
97
|
-
|
|
98
|
-
/** Hide browser window (default: false) */
|
|
99
|
-
headless?: boolean;
|
|
100
|
-
|
|
101
|
-
/** Login timeout in ms (default: 300000 = 5 minutes) */
|
|
102
|
-
timeout?: number;
|
|
103
|
-
|
|
104
|
-
/** Custom user agent */
|
|
105
|
-
userAgent?: string;
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Cookie patterns to wait for before completing auth.
|
|
109
|
-
* Supports wildcards: 'SAP_SESSIONID_*'
|
|
110
|
-
* @example ['SAP_SESSIONID_*', 'sap-usercontext']
|
|
111
|
-
*/
|
|
112
|
-
requiredCookies?: string[];
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Session persistence directory.
|
|
116
|
-
* - true: Use default (~/.adt/browser-profile)
|
|
117
|
-
* - string: Custom path
|
|
118
|
-
* - false/undefined: No persistence
|
|
119
|
-
*/
|
|
120
|
-
userDataDir?: string | boolean;
|
|
121
|
-
|
|
122
|
-
/** Ignore HTTPS errors (default: true) */
|
|
123
|
-
ignoreHTTPSErrors?: boolean;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
## Session Persistence
|
|
127
|
-
|
|
128
|
-
By default, Puppeteer starts a fresh browser session each time. Enable `userDataDir` to persist browser state (cookies, localStorage, cache) across runs - perfect for long-lived Okta/IDP tokens!
|
|
129
|
-
|
|
130
|
-
### Benefits
|
|
131
|
-
- **Skip repeated logins**: Okta tokens persist across runs
|
|
132
|
-
- **Faster authentication**: Only refresh SAP cookies when needed
|
|
133
|
-
- **Better UX**: Same experience as using a regular browser
|
|
134
|
-
|
|
135
|
-
### Plugin-Level Configuration (Recommended)
|
|
136
|
-
|
|
137
|
-
Configure once, applies to all destinations:
|
|
138
|
-
|
|
139
|
-
```typescript
|
|
140
|
-
import { withPuppeteer } from '@abapify/adt-puppeteer';
|
|
141
|
-
|
|
142
|
-
export default withPuppeteer(
|
|
143
|
-
defineConfig({
|
|
144
|
-
destinations: {
|
|
145
|
-
DEV: 'https://sap-dev.example.com',
|
|
146
|
-
PROD: 'https://sap-prod.example.com',
|
|
147
|
-
},
|
|
148
|
-
}),
|
|
149
|
-
{
|
|
150
|
-
userDataDir: true, // ALL destinations share the same profile
|
|
151
|
-
}
|
|
22
|
+
defineConfig({ destinations: { DEV: 'https://sap-dev.example.com' } }),
|
|
152
23
|
);
|
|
153
|
-
````
|
|
154
|
-
|
|
155
|
-
### Per-Destination Configuration
|
|
156
|
-
|
|
157
|
-
Only use if you need different profiles per destination:
|
|
158
|
-
|
|
159
|
-
```typescript
|
|
160
|
-
import { puppeteer } from '@abapify/adt-puppeteer';
|
|
161
|
-
|
|
162
|
-
export default defineConfig({
|
|
163
|
-
destinations: {
|
|
164
|
-
DEV: puppeteer({
|
|
165
|
-
url: 'https://sap-dev.example.com',
|
|
166
|
-
userDataDir: '/path/to/dev-profile', // Custom profile for DEV
|
|
167
|
-
}),
|
|
168
|
-
PROD: puppeteer({
|
|
169
|
-
url: 'https://sap-prod.example.com',
|
|
170
|
-
// No userDataDir = fresh session every time
|
|
171
|
-
}),
|
|
172
|
-
},
|
|
173
|
-
});
|
|
174
24
|
```
|
|
175
25
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
- `userDataDir: true` - Use default directory (~/.adt/puppeteer-profile)
|
|
179
|
-
- `userDataDir: '/custom/path'` - Custom directory path
|
|
180
|
-
- `userDataDir: false` or omitted - No persistence (default)
|
|
181
|
-
|
|
182
|
-
### How It Works
|
|
183
|
-
|
|
184
|
-
1. **First run**: Opens browser, user logs in via Okta → profile saved
|
|
185
|
-
2. **Subsequent runs**: Loads existing profile → checks if session valid
|
|
186
|
-
- ✅ **Valid**: Skips login, extracts cookies
|
|
187
|
-
- ❌ **Expired**: Prompts for re-login (only SAP cookies need refresh)
|
|
188
|
-
|
|
189
|
-
### Silent Session Refresh
|
|
190
|
-
|
|
191
|
-
When SAP cookies expire but Okta session is still valid, use `adt auth refresh`:
|
|
192
|
-
|
|
193
|
-
```bash
|
|
194
|
-
# Refresh expired SAP session using stored Okta cookies
|
|
195
|
-
npx adt auth refresh
|
|
196
|
-
|
|
197
|
-
# Or specify a system
|
|
198
|
-
npx adt auth refresh --sid TRL
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
**How it works:**
|
|
202
|
-
|
|
203
|
-
1. Launches **headless browser** with persistent profile (no window popup!)
|
|
204
|
-
2. Navigates to SAP system
|
|
205
|
-
3. Okta **auto-authenticates** from stored session
|
|
206
|
-
4. Extracts fresh SAP cookies
|
|
207
|
-
5. Updates `~/.adt/auth.json`
|
|
208
|
-
|
|
209
|
-
**Benefits:**
|
|
210
|
-
|
|
211
|
-
- ⚡ **Fast** - No manual login, typically <30 seconds
|
|
212
|
-
- 🤫 **Silent** - Runs in background, no browser window
|
|
213
|
-
- 🔄 **Automatic** - ADT CLI can auto-refresh when detecting expired sessions
|
|
214
|
-
|
|
215
|
-
**Note:** Refresh only works when `userDataDir` is enabled. Without it, you'll need to run `adt auth login` again.
|
|
216
|
-
|
|
217
|
-
### Clearing Sessions
|
|
218
|
-
|
|
219
|
-
If authentication fails or you need a fresh start:
|
|
220
|
-
|
|
221
|
-
```bash
|
|
222
|
-
# Remove default profile
|
|
223
|
-
rm -rf ~/.adt/browser-profile
|
|
224
|
-
|
|
225
|
-
# Or remove custom profile
|
|
226
|
-
rm -rf /path/to/custom/profile
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
## Configuration Patterns
|
|
230
|
-
|
|
231
|
-
### Pattern 1: All destinations use Puppeteer (Recommended)
|
|
232
|
-
|
|
233
|
-
```typescript
|
|
234
|
-
// adt.config.ts
|
|
235
|
-
import { defineConfig } from '@abapify/adt-config';
|
|
236
|
-
import { withPuppeteer } from '@abapify/adt-puppeteer';
|
|
237
|
-
|
|
238
|
-
export default withPuppeteer(
|
|
239
|
-
defineConfig({
|
|
240
|
-
destinations: {
|
|
241
|
-
DEV: 'https://sap-dev.example.com',
|
|
242
|
-
QAS: 'https://sap-qas.example.com',
|
|
243
|
-
PROD: 'https://sap-prod.example.com',
|
|
244
|
-
},
|
|
245
|
-
}),
|
|
246
|
-
{
|
|
247
|
-
// Plugin options applied to ALL destinations
|
|
248
|
-
userDataDir: true, // Session persistence
|
|
249
|
-
headless: false, // Show browser
|
|
250
|
-
timeout: 120000, // 2 min timeout
|
|
251
|
-
requiredCookies: ['MYSAPSSO2', 'SAP_SESSIONID_*'],
|
|
252
|
-
},
|
|
253
|
-
);
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
### Pattern 2: Mixed auth types
|
|
257
|
-
|
|
258
|
-
```typescript
|
|
259
|
-
import { defineConfig } from '@abapify/adt-config';
|
|
260
|
-
import { basic } from '@abapify/adt-client';
|
|
261
|
-
import { puppeteer } from '@abapify/adt-puppeteer';
|
|
262
|
-
|
|
263
|
-
export default defineConfig({
|
|
264
|
-
destinations: {
|
|
265
|
-
// Basic auth for dev
|
|
266
|
-
DEV: basic({ url: 'https://dev.example.com', client: '100' }),
|
|
267
|
-
|
|
268
|
-
// Puppeteer for production (SSO)
|
|
269
|
-
PROD: puppeteer({ url: 'https://prod.example.com' }),
|
|
270
|
-
},
|
|
271
|
-
});
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
### Pattern 3: Per-destination Puppeteer options
|
|
275
|
-
|
|
276
|
-
```typescript
|
|
277
|
-
import { puppeteer } from '@abapify/adt-puppeteer';
|
|
278
|
-
|
|
279
|
-
export default defineConfig({
|
|
280
|
-
destinations: {
|
|
281
|
-
DEV: puppeteer({
|
|
282
|
-
url: 'https://sap-dev.example.com',
|
|
283
|
-
timeout: 60000, // Custom timeout for DEV
|
|
284
|
-
}),
|
|
285
|
-
|
|
286
|
-
PROD: puppeteer({
|
|
287
|
-
url: 'https://sap-prod.example.com',
|
|
288
|
-
requiredCookies: ['MYSAPSSO2', 'SAP_SESSIONID_*'],
|
|
289
|
-
}),
|
|
290
|
-
},
|
|
291
|
-
});
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
## Architecture
|
|
295
|
-
|
|
296
|
-
This package is a thin wrapper around `@abapify/browser-auth`:
|
|
297
|
-
|
|
298
|
-
```
|
|
299
|
-
@abapify/browser-auth (core logic)
|
|
300
|
-
├── Event-driven auth flow
|
|
301
|
-
├── Cookie utilities
|
|
302
|
-
└── Pattern matching
|
|
303
|
-
↑
|
|
304
|
-
@abapify/adt-puppeteer (this package)
|
|
305
|
-
├── adapter.ts - Puppeteer BrowserAdapter implementation
|
|
306
|
-
├── puppeteer-auth.ts - Wrapper around browser-auth
|
|
307
|
-
├── auth-plugin.ts - AuthManager compatibility
|
|
308
|
-
└── index.ts - Public exports
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
## Exports
|
|
312
|
-
|
|
313
|
-
```typescript
|
|
314
|
-
// Main auth object
|
|
315
|
-
export { puppeteerAuth, puppeteer } from '@abapify/adt-puppeteer';
|
|
316
|
-
|
|
317
|
-
// Config helper
|
|
318
|
-
export { withPuppeteer } from '@abapify/adt-puppeteer';
|
|
319
|
-
|
|
320
|
-
// Utilities
|
|
321
|
-
export { toCookieHeader, toHeaders } from '@abapify/adt-puppeteer';
|
|
322
|
-
|
|
323
|
-
// AuthManager plugin (default export)
|
|
324
|
-
import authPlugin from '@abapify/adt-puppeteer';
|
|
325
|
-
|
|
326
|
-
// Types
|
|
327
|
-
export type {
|
|
328
|
-
PuppeteerCredentials,
|
|
329
|
-
PuppeteerAuthOptions,
|
|
330
|
-
PuppeteerPluginOptions,
|
|
331
|
-
CookieData,
|
|
332
|
-
} from '@abapify/adt-puppeteer';
|
|
333
|
-
```
|
|
26
|
+
## Features
|
|
334
27
|
|
|
335
|
-
|
|
28
|
+
- Browser-based SSO login (SAML / IdP) with Puppeteer
|
|
29
|
+
- Session cookie persistence and reuse
|
|
30
|
+
- Drop-in wrapper for `adt.config.ts`
|
|
336
31
|
|
|
337
|
-
|
|
338
|
-
| ------------------- | -------------------------- | ------------------------ |
|
|
339
|
-
| **Browser Support** | Chromium, Firefox, WebKit | Chrome/Chromium |
|
|
340
|
-
| **Maintenance** | Microsoft-backed | Google-backed |
|
|
341
|
-
| **API Style** | Modern, auto-waiting | Classic, manual waits |
|
|
342
|
-
| **Bundle Size** | Larger | Smaller |
|
|
343
|
-
| **Recommendation** | Preferred for new projects | Legacy/existing projects |
|
|
32
|
+
## Documentation
|
|
344
33
|
|
|
345
|
-
|
|
34
|
+
**[adt-cli.netlify.app/sdk/packages/adt-puppeteer](https://adt-cli.netlify.app/sdk/packages/adt-puppeteer)**
|
|
346
35
|
|
|
347
|
-
|
|
36
|
+
---
|
|
348
37
|
|
|
349
|
-
|
|
350
|
-
- [`@abapify/adt-playwright`](../adt-playwright) - Playwright alternative (recommended)
|
|
351
|
-
- [`@abapify/adt-auth`](../adt-auth) - Authentication manager
|
|
352
|
-
- [`@abapify/adt-config`](../adt-config) - Configuration utilities
|
|
38
|
+
Part of [**abapify**](https://github.com/abapify/adt-cli) — open, typed tooling for SAP ABAP Development Tools (ADT): CLI, MCP server, and SDK.
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":["BrowserCredentials","BrowserAuthOptions","BrowserAuthOptions"],"sources":["../src/puppeteer-auth.ts","../src/auth-plugin.ts","../src/index.ts"],"mappings":";;;KAeY,uBAAuBA;KACvB,uBAAuBC;;;;cAKtB;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["BrowserCredentials","BrowserAuthOptions","BrowserAuthOptions"],"sources":["../src/puppeteer-auth.ts","../src/auth-plugin.ts","../src/index.ts"],"mappings":";;;KAeY,uBAAuBA;KACvB,uBAAuBC;;;;cAKtB;;;;EAIW,aAAA,SAAA,uBAAuB,QAAQ;;;;;;;;EAapC,QAAA;IACf;MAAS;QAAkB,OAAO;;;MAChC,QAAQ;;cAYD;;;;EA3BW,aAAA,SAAA,uBAAuB,QAAQ;;;;;;;;EAapC,QAAA;IACf;MAAS;QAAkB,OAAO;;;MAChC,QAAQ;;;;;cCRR,YAAY;;;;KCRN,yBAAyBC;;;;iBAerB,cACd,QAAQ,WACR,UAAU,QAAQA,wBACjB"}
|
package/dist/index.mjs
CHANGED
|
@@ -77,13 +77,13 @@ function createPuppeteerAdapter() {
|
|
|
77
77
|
const client = await page.createCDPSession();
|
|
78
78
|
const { cookies } = await client.send("Network.getAllCookies");
|
|
79
79
|
const toRemove = cookies.filter((c) => c.domain.includes(domain) || domain.includes(c.domain.replace(/^\./, "")));
|
|
80
|
-
|
|
80
|
+
await Promise.all(toRemove.map((cookie) => client.send("Network.deleteCookies", {
|
|
81
81
|
name: cookie.name,
|
|
82
82
|
domain: cookie.domain
|
|
83
|
-
});
|
|
83
|
+
})));
|
|
84
84
|
},
|
|
85
|
-
|
|
86
|
-
if (!page)
|
|
85
|
+
getUserAgent() {
|
|
86
|
+
if (!page) return Promise.reject(/* @__PURE__ */ new Error("Page not created"));
|
|
87
87
|
return page.evaluate(() => navigator.userAgent);
|
|
88
88
|
},
|
|
89
89
|
async closePage() {
|
|
@@ -121,7 +121,7 @@ const puppeteerAuth = {
|
|
|
121
121
|
/**
|
|
122
122
|
* Authenticate using Puppeteer browser
|
|
123
123
|
*/
|
|
124
|
-
|
|
124
|
+
authenticate(options) {
|
|
125
125
|
const adapter = createPuppeteerAdapter();
|
|
126
126
|
return authenticate(adapter, options);
|
|
127
127
|
},
|
|
@@ -132,9 +132,9 @@ const puppeteerAuth = {
|
|
|
132
132
|
/**
|
|
133
133
|
* Refresh is not reliable with Okta SSO - always return null to trigger full re-authentication
|
|
134
134
|
*/
|
|
135
|
-
|
|
135
|
+
refresh(session) {
|
|
136
136
|
(session?.auth?.pluginOptions?.log ?? console.log)("🔄 Session expired, will trigger full re-authentication...");
|
|
137
|
-
return null;
|
|
137
|
+
return Promise.resolve(null);
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
const puppeteer = puppeteerAuth;
|
|
@@ -162,8 +162,8 @@ const authPlugin = {
|
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
164
|
},
|
|
165
|
-
|
|
166
|
-
return null;
|
|
165
|
+
refresh(_session) {
|
|
166
|
+
return Promise.resolve(null);
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
169
|
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["puppeteer"],"sources":["../src/adapter.ts","../src/puppeteer-auth.ts","../src/auth-plugin.ts","../src/index.ts"],"sourcesContent":["/**\n * Puppeteer Browser Adapter\n *\n * Implements BrowserAdapter interface for Puppeteer.\n * This is a thin wrapper - all auth logic is in @abapify/browser-auth.\n */\n\nimport puppeteer from 'puppeteer';\nimport type { Browser, Page, Protocol } from 'puppeteer';\nimport type {\n BrowserAdapter,\n CookieData,\n ResponseEvent,\n} from '@abapify/browser-auth';\n\n/**\n * Convert Puppeteer cookie to CookieData\n */\nfunction convertCookie(cookie: Protocol.Network.Cookie): CookieData {\n return {\n name: cookie.name,\n value: cookie.value,\n domain: cookie.domain,\n path: cookie.path,\n expires: cookie.expires,\n httpOnly: cookie.httpOnly,\n secure: cookie.secure,\n sameSite: cookie.sameSite as CookieData['sameSite'],\n };\n}\n\n/**\n * Create a Puppeteer browser adapter\n */\nexport function createPuppeteerAdapter(): BrowserAdapter {\n let browser: Browser | null = null;\n let page: Page | null = null;\n let launchOptions: { ignoreHTTPSErrors?: boolean; userAgent?: string } = {};\n\n const responseHandlers: ((event: ResponseEvent) => void)[] = [];\n const closeHandlers: (() => void)[] = [];\n\n return {\n async launch(options: {\n headless: boolean;\n userDataDir?: string;\n ignoreHTTPSErrors?: boolean;\n userAgent?: string;\n }) {\n const { headless, userDataDir, ignoreHTTPSErrors, userAgent } = options;\n launchOptions = { ignoreHTTPSErrors, userAgent };\n\n browser = await puppeteer.launch({\n headless,\n userDataDir,\n args: userAgent ? [`--user-agent=${userAgent}`] : [],\n });\n },\n\n async newPage() {\n if (!browser) throw new Error('Browser not launched');\n page = await browser.newPage();\n\n // Set page-level options\n if (launchOptions.ignoreHTTPSErrors) {\n await page.setBypassCSP(true);\n }\n\n // Wire up event handlers\n page.on('response', (response) => {\n const event: ResponseEvent = {\n url: response.url(),\n status: response.status(),\n };\n responseHandlers.forEach((handler) => handler(event));\n });\n\n page.once('close', () => {\n closeHandlers.forEach((handler) => handler());\n });\n },\n\n async goto(url: string, options?: { timeout?: number }) {\n if (!page) throw new Error('Page not created');\n await page\n .goto(url, {\n waitUntil: 'domcontentloaded',\n timeout: options?.timeout ?? 30000,\n })\n // Navigation errors are intentionally ignored; caller handles auth via event listeners\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n .catch(() => {});\n },\n\n async getCookies(): Promise<CookieData[]> {\n if (!page) throw new Error('Page not created');\n const client = await page.createCDPSession();\n const { cookies } = await client.send('Network.getAllCookies');\n return cookies.map(convertCookie);\n },\n\n async clearCookies(domain: string): Promise<void> {\n if (!page) throw new Error('Page not created');\n const client = await page.createCDPSession();\n const { cookies } = await client.send('Network.getAllCookies');\n const toRemove = cookies.filter(\n (c) =>\n c.domain.includes(domain) ||\n domain.includes(c.domain.replace(/^\\./, '')),\n );\n for (const cookie of toRemove) {\n await client.send('Network.deleteCookies', {\n name: cookie.name,\n domain: cookie.domain,\n });\n }\n },\n\n async getUserAgent(): Promise<string> {\n if (!page) throw new Error('Page not created');\n return page.evaluate(() => navigator.userAgent);\n },\n\n async closePage() {\n if (page) {\n await page.close();\n page = null;\n }\n },\n\n async close() {\n if (browser) {\n await browser.close();\n browser = null;\n }\n },\n\n onResponse(handler: (event: ResponseEvent) => void) {\n responseHandlers.push(handler);\n },\n\n onPageClose(handler: () => void) {\n closeHandlers.push(handler);\n },\n };\n}\n","/**\n * Puppeteer Authentication Plugin\n *\n * Thin wrapper around @abapify/browser-auth core.\n * Provides Puppeteer-specific browser adapter.\n */\n\nimport { authenticate, testCredentials } from '@abapify/browser-auth';\nimport type {\n BrowserCredentials,\n BrowserAuthOptions,\n} from '@abapify/browser-auth';\nimport { createPuppeteerAdapter } from './adapter';\n\n// Re-export types with Puppeteer-specific names for backwards compatibility\nexport type PuppeteerCredentials = BrowserCredentials;\nexport type PuppeteerAuthOptions = BrowserAuthOptions;\n\n/**\n * Puppeteer authentication object\n */\nexport const puppeteerAuth = {\n /**\n * Authenticate using Puppeteer browser\n */\n async authenticate(\n options: PuppeteerAuthOptions,\n ): Promise<PuppeteerCredentials> {\n const adapter = createPuppeteerAdapter();\n return authenticate(adapter, options);\n },\n\n /**\n * Test if credentials are still valid\n */\n test: testCredentials,\n\n /**\n * Refresh is not reliable with Okta SSO - always return null to trigger full re-authentication\n */\n async refresh(session: {\n auth?: { pluginOptions?: { log?: (message: string) => void } };\n }): Promise<PuppeteerCredentials | null> {\n const log = session?.auth?.pluginOptions?.log as\n | ((message: string) => void)\n | undefined;\n (log ?? console.log)(\n '🔄 Session expired, will trigger full re-authentication...',\n );\n return null;\n },\n};\n\n// Re-export utilities\n// Legacy export\nexport const puppeteer = puppeteerAuth;\nexport { toCookieHeader, toHeaders } from '@abapify/browser-auth';\n","/**\n * Standard authPlugin export for AuthManager compatibility\n *\n * Wraps puppeteerAuth to return AuthPluginResult format expected by AuthManager.\n */\n\nimport type {\n AuthPlugin,\n AuthPluginResult,\n AuthPluginOptions,\n AuthSession,\n} from '@abapify/adt-auth';\nimport { puppeteerAuth, toCookieHeader } from './puppeteer-auth';\n\n/**\n * Get earliest expiration from cookies, or default to 8 hours\n */\nfunction getExpiresAt(cookies: { expires?: number }[]): Date {\n const expirations = cookies\n .filter((c) => c.expires && c.expires > 0)\n .map((c) => c.expires! * 1000); // Convert seconds to ms\n\n if (expirations.length > 0) {\n return new Date(Math.min(...expirations));\n }\n // Default fallback if no expiration set\n return new Date(Date.now() + 8 * 60 * 60 * 1000);\n}\n\n/**\n * Standard auth plugin that conforms to AuthPluginResult interface.\n */\nconst authPlugin: AuthPlugin = {\n async authenticate(options: AuthPluginOptions): Promise<AuthPluginResult> {\n const credentials = await puppeteerAuth.authenticate(options);\n const cookieString = toCookieHeader(credentials);\n\n return {\n method: 'cookie',\n credentials: {\n cookies: cookieString,\n expiresAt: getExpiresAt(credentials.cookies),\n },\n };\n },\n\n async refresh(_session: AuthSession): Promise<AuthPluginResult | null> {\n // Don't try to refresh - Okta SSO cookies can't be silently refreshed\n return null;\n },\n};\n\nexport default authPlugin;\n","/**\n * @abapify/adt-puppeteer\n *\n * Puppeteer-based SSO authentication plugin for ADT client.\n * Uses @abapify/browser-auth core with Puppeteer adapter.\n */\n\nimport type { AdtConfig, Destination } from '@abapify/adt-config';\nimport type { BrowserAuthOptions } from '@abapify/browser-auth';\n\n// Re-export types\nexport type {\n PuppeteerCredentials,\n PuppeteerAuthOptions,\n} from './puppeteer-auth';\nexport type {\n BrowserCredentials,\n BrowserAuthOptions,\n CookieData,\n} from '@abapify/browser-auth';\n\n/**\n * Plugin-level options applied to all destinations\n */\nexport type PuppeteerPluginOptions = BrowserAuthOptions;\n\n/**\n * Create a puppeteer destination config\n */\nfunction createPuppeteerDestination(options: BrowserAuthOptions): Destination {\n return {\n type: '@abapify/adt-puppeteer',\n options,\n };\n}\n\n/**\n * Wrap a standard config with puppeteer auth for all destinations.\n */\nexport function withPuppeteer(\n config: AdtConfig,\n options?: Partial<BrowserAuthOptions>,\n): AdtConfig {\n if (!config.destinations) {\n return config;\n }\n\n const destinations: Record<string, Destination> = {};\n\n for (const [name, dest] of Object.entries(config.destinations)) {\n if (typeof dest === 'object' && 'type' in dest) {\n if (dest.type === '@abapify/adt-puppeteer' || dest.type === 'puppeteer') {\n destinations[name] = {\n type: '@abapify/adt-puppeteer',\n options: { ...options, ...(dest.options as BrowserAuthOptions) },\n };\n } else {\n destinations[name] = dest;\n }\n } else if (typeof dest === 'string') {\n destinations[name] = createPuppeteerDestination({\n url: dest,\n ...options,\n });\n } else {\n destinations[name] = createPuppeteerDestination({\n ...(dest as BrowserAuthOptions),\n ...options,\n });\n }\n }\n\n return { ...config, destinations };\n}\n\n// Main exports\nexport {\n puppeteerAuth,\n puppeteer,\n toCookieHeader,\n toHeaders,\n} from './puppeteer-auth';\n\n// AuthManager compatibility exports\nexport { default } from './auth-plugin';\nexport { default as authPlugin } from './auth-plugin';\n"],"mappings":";;;;;;;;;;;;;AAkBA,SAAS,cAAc,QAA6C;CAClE,OAAO;EACL,MAAM,OAAO;EACb,OAAO,OAAO;EACd,QAAQ,OAAO;EACf,MAAM,OAAO;EACb,SAAS,OAAO;EAChB,UAAU,OAAO;EACjB,QAAQ,OAAO;EACf,UAAU,OAAO;CACnB;AACF;;;;AAKA,SAAgB,yBAAyC;CACvD,IAAI,UAA0B;CAC9B,IAAI,OAAoB;CACxB,IAAI,gBAAqE,CAAC;CAE1E,MAAM,mBAAuD,CAAC;CAC9D,MAAM,gBAAgC,CAAC;CAEvC,OAAO;EACL,MAAM,OAAO,SAKV;GACD,MAAM,EAAE,UAAU,aAAa,mBAAmB,cAAc;GAChE,gBAAgB;IAAE;IAAmB;GAAU;GAE/C,UAAU,MAAMA,YAAU,OAAO;IAC/B;IACA;IACA,MAAM,YAAY,CAAC,gBAAgB,WAAW,IAAI,CAAC;GACrD,CAAC;EACH;EAEA,MAAM,UAAU;GACd,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,sBAAsB;GACpD,O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,KAAK,MAAM,CAAC,MAAM,SAAS,OAAO,QAAQ,OAAO,YAAY,GAC3D,IAAI,OAAO,SAAS,YAAY,UAAU,MAAM;EAC9C,IAAI,KAAK,SAAS,4BAA4B,KAAK,SAAS,aAC1D,aAAa,QAAQ;GACnB,MAAM;GACN,SAAS;IAAE,GAAG;IAAS,GAAI,KAAK;GAA+B;EACjE;OAEA,aAAa,QAAQ;CAEzB,OAAO,IAAI,OAAO,SAAS,UACzB,aAAa,QAAQ,2BAA2B;EAC9C,KAAK;EACL,GAAG;CACL,CAAC;MAED,aAAa,QAAQ,2BAA2B;EAC9C,GAAI;EACJ,GAAG;CACL,CAAC;CAIL,OAAO;EAAE,GAAG;EAAQ;CAAa;AACnC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["puppeteer"],"sources":["../src/adapter.ts","../src/puppeteer-auth.ts","../src/auth-plugin.ts","../src/index.ts"],"sourcesContent":["/**\n * Puppeteer Browser Adapter\n *\n * Implements BrowserAdapter interface for Puppeteer.\n * This is a thin wrapper - all auth logic is in @abapify/browser-auth.\n */\n\nimport puppeteer from 'puppeteer';\nimport type { Browser, Page, Protocol } from 'puppeteer';\nimport type {\n BrowserAdapter,\n CookieData,\n ResponseEvent,\n} from '@abapify/browser-auth';\n\n/**\n * Convert Puppeteer cookie to CookieData\n */\nfunction convertCookie(cookie: Protocol.Network.Cookie): CookieData {\n return {\n name: cookie.name,\n value: cookie.value,\n domain: cookie.domain,\n path: cookie.path,\n expires: cookie.expires,\n httpOnly: cookie.httpOnly,\n secure: cookie.secure,\n sameSite: cookie.sameSite as CookieData['sameSite'],\n };\n}\n\n/**\n * Create a Puppeteer browser adapter\n */\nexport function createPuppeteerAdapter(): BrowserAdapter {\n let browser: Browser | null = null;\n let page: Page | null = null;\n let launchOptions: { ignoreHTTPSErrors?: boolean; userAgent?: string } = {};\n\n const responseHandlers: ((event: ResponseEvent) => void)[] = [];\n const closeHandlers: (() => void)[] = [];\n\n return {\n async launch(options: {\n headless: boolean;\n userDataDir?: string;\n ignoreHTTPSErrors?: boolean;\n userAgent?: string;\n }) {\n const { headless, userDataDir, ignoreHTTPSErrors, userAgent } = options;\n launchOptions = { ignoreHTTPSErrors, userAgent };\n\n browser = await puppeteer.launch({\n headless,\n userDataDir,\n args: userAgent ? [`--user-agent=${userAgent}`] : [],\n });\n },\n\n async newPage() {\n if (!browser) throw new Error('Browser not launched');\n page = await browser.newPage();\n\n // Set page-level options\n if (launchOptions.ignoreHTTPSErrors) {\n await page.setBypassCSP(true);\n }\n\n // Wire up event handlers\n page.on('response', (response) => {\n const event: ResponseEvent = {\n url: response.url(),\n status: response.status(),\n };\n responseHandlers.forEach((handler) => handler(event));\n });\n\n page.once('close', () => {\n closeHandlers.forEach((handler) => handler());\n });\n },\n\n async goto(url: string, options?: { timeout?: number }) {\n if (!page) throw new Error('Page not created');\n await page\n .goto(url, {\n waitUntil: 'domcontentloaded',\n timeout: options?.timeout ?? 30000,\n })\n // Navigation errors are intentionally ignored; caller handles auth via event listeners\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n .catch(() => {});\n },\n\n async getCookies(): Promise<CookieData[]> {\n if (!page) throw new Error('Page not created');\n const client = await page.createCDPSession();\n const { cookies } = await client.send('Network.getAllCookies');\n return cookies.map(convertCookie);\n },\n\n async clearCookies(domain: string): Promise<void> {\n if (!page) throw new Error('Page not created');\n const client = await page.createCDPSession();\n const { cookies } = await client.send('Network.getAllCookies');\n const toRemove = cookies.filter(\n (c) =>\n c.domain.includes(domain) ||\n domain.includes(c.domain.replace(/^\\./, '')),\n );\n await Promise.all(\n toRemove.map((cookie) =>\n client.send('Network.deleteCookies', {\n name: cookie.name,\n domain: cookie.domain,\n }),\n ),\n );\n },\n\n getUserAgent(): Promise<string> {\n if (!page) return Promise.reject(new Error('Page not created'));\n return page.evaluate(() => navigator.userAgent);\n },\n\n async closePage() {\n if (page) {\n await page.close();\n page = null;\n }\n },\n\n async close() {\n if (browser) {\n await browser.close();\n browser = null;\n }\n },\n\n onResponse(handler: (event: ResponseEvent) => void) {\n responseHandlers.push(handler);\n },\n\n onPageClose(handler: () => void) {\n closeHandlers.push(handler);\n },\n };\n}\n","/**\n * Puppeteer Authentication Plugin\n *\n * Thin wrapper around @abapify/browser-auth core.\n * Provides Puppeteer-specific browser adapter.\n */\n\nimport { authenticate, testCredentials } from '@abapify/browser-auth';\nimport type {\n BrowserCredentials,\n BrowserAuthOptions,\n} from '@abapify/browser-auth';\nimport { createPuppeteerAdapter } from './adapter';\n\n// Re-export types with Puppeteer-specific names for backwards compatibility\nexport type PuppeteerCredentials = BrowserCredentials;\nexport type PuppeteerAuthOptions = BrowserAuthOptions;\n\n/**\n * Puppeteer authentication object\n */\nexport const puppeteerAuth = {\n /**\n * Authenticate using Puppeteer browser\n */\n authenticate(options: PuppeteerAuthOptions): Promise<PuppeteerCredentials> {\n const adapter = createPuppeteerAdapter();\n return authenticate(adapter, options);\n },\n\n /**\n * Test if credentials are still valid\n */\n test: testCredentials,\n\n /**\n * Refresh is not reliable with Okta SSO - always return null to trigger full re-authentication\n */\n refresh(session: {\n auth?: { pluginOptions?: { log?: (message: string) => void } };\n }): Promise<PuppeteerCredentials | null> {\n const log = session?.auth?.pluginOptions?.log as\n ((message: string) => void) | undefined;\n (log ?? console.log)(\n '🔄 Session expired, will trigger full re-authentication...',\n );\n return Promise.resolve(null);\n },\n};\n\n// Re-export utilities\n// Legacy export\nexport const puppeteer = puppeteerAuth;\nexport { toCookieHeader, toHeaders } from '@abapify/browser-auth';\n","/**\n * Standard authPlugin export for AuthManager compatibility\n *\n * Wraps puppeteerAuth to return AuthPluginResult format expected by AuthManager.\n */\n\nimport type {\n AuthPlugin,\n AuthPluginResult,\n AuthPluginOptions,\n AuthSession,\n} from '@abapify/adt-auth';\nimport { puppeteerAuth, toCookieHeader } from './puppeteer-auth';\n\n/**\n * Get earliest expiration from cookies, or default to 8 hours\n */\nfunction getExpiresAt(cookies: { expires?: number }[]): Date {\n const expirations = cookies\n .filter((c) => c.expires && c.expires > 0)\n .map((c) => c.expires! * 1000); // Convert seconds to ms\n\n if (expirations.length > 0) {\n return new Date(Math.min(...expirations));\n }\n // Default fallback if no expiration set\n return new Date(Date.now() + 8 * 60 * 60 * 1000);\n}\n\n/**\n * Standard auth plugin that conforms to AuthPluginResult interface.\n */\nconst authPlugin: AuthPlugin = {\n async authenticate(options: AuthPluginOptions): Promise<AuthPluginResult> {\n const credentials = await puppeteerAuth.authenticate(options);\n const cookieString = toCookieHeader(credentials);\n\n return {\n method: 'cookie',\n credentials: {\n cookies: cookieString,\n expiresAt: getExpiresAt(credentials.cookies),\n },\n };\n },\n\n refresh(_session: AuthSession): Promise<AuthPluginResult | null> {\n // Don't try to refresh - Okta SSO cookies can't be silently refreshed\n return Promise.resolve(null);\n },\n};\n\nexport default authPlugin;\n","/**\n * @abapify/adt-puppeteer\n *\n * Puppeteer-based SSO authentication plugin for ADT client.\n * Uses @abapify/browser-auth core with Puppeteer adapter.\n */\n\nimport type { AdtConfig, Destination } from '@abapify/adt-config';\nimport type { BrowserAuthOptions } from '@abapify/browser-auth';\n\n// Re-export types\nexport type {\n PuppeteerCredentials,\n PuppeteerAuthOptions,\n} from './puppeteer-auth';\nexport type {\n BrowserCredentials,\n BrowserAuthOptions,\n CookieData,\n} from '@abapify/browser-auth';\n\n/**\n * Plugin-level options applied to all destinations\n */\nexport type PuppeteerPluginOptions = BrowserAuthOptions;\n\n/**\n * Create a puppeteer destination config\n */\nfunction createPuppeteerDestination(options: BrowserAuthOptions): Destination {\n return {\n type: '@abapify/adt-puppeteer',\n options,\n };\n}\n\n/**\n * Wrap a standard config with puppeteer auth for all destinations.\n */\nexport function withPuppeteer(\n config: AdtConfig,\n options?: Partial<BrowserAuthOptions>,\n): AdtConfig {\n if (!config.destinations) {\n return config;\n }\n\n const destinations: Record<string, Destination> = {};\n\n for (const [name, dest] of Object.entries(config.destinations)) {\n if (typeof dest === 'object' && 'type' in dest) {\n if (dest.type === '@abapify/adt-puppeteer' || dest.type === 'puppeteer') {\n destinations[name] = {\n type: '@abapify/adt-puppeteer',\n options: { ...options, ...(dest.options as BrowserAuthOptions) },\n };\n } else {\n destinations[name] = dest;\n }\n } else if (typeof dest === 'string') {\n destinations[name] = createPuppeteerDestination({\n url: dest,\n ...options,\n });\n } else {\n destinations[name] = createPuppeteerDestination({\n ...(dest as BrowserAuthOptions),\n ...options,\n });\n }\n }\n\n return { ...config, destinations };\n}\n\n// Main exports\nexport {\n puppeteerAuth,\n puppeteer,\n toCookieHeader,\n toHeaders,\n} from './puppeteer-auth';\n\n// AuthManager compatibility exports\nexport { default } from './auth-plugin';\nexport { default as authPlugin } from './auth-plugin';\n"],"mappings":";;;;;;;;;;;;;AAkBA,SAAS,cAAc,QAA6C;CAClE,OAAO;EACL,MAAM,OAAO;EACb,OAAO,OAAO;EACd,QAAQ,OAAO;EACf,MAAM,OAAO;EACb,SAAS,OAAO;EAChB,UAAU,OAAO;EACjB,QAAQ,OAAO;EACf,UAAU,OAAO;CACnB;AACF;;;;AAKA,SAAgB,yBAAyC;CACvD,IAAI,UAA0B;CAC9B,IAAI,OAAoB;CACxB,IAAI,gBAAqE,CAAC;CAE1E,MAAM,mBAAuD,CAAC;CAC9D,MAAM,gBAAgC,CAAC;CAEvC,OAAO;EACL,MAAM,OAAO,SAKV;GACD,MAAM,EAAE,UAAU,aAAa,mBAAmB,cAAc;GAChE,gBAAgB;IAAE;IAAmB;GAAU;GAE/C,UAAU,MAAMA,YAAU,OAAO;IAC/B;IACA;IACA,MAAM,YAAY,CAAC,gBAAgB,WAAW,IAAI,CAAC;GACrD,CAAC;EACH;EAEA,MAAM,UAAU;GACd,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,sBAAsB;GACpD,OAAO,MAAM,QAAQ,QAAQ;GAG7B,IAAI,cAAc,mBAChB,MAAM,KAAK,aAAa,IAAI;GAI9B,KAAK,GAAG,aAAa,aAAa;IAChC,MAAM,QAAuB;KAC3B,KAAK,SAAS,IAAI;KAClB,QAAQ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C,IAAI,KAAK,SAAS,4BAA4B,KAAK,SAAS,aAC1D,aAAa,QAAQ;GACnB,MAAM;GACN,SAAS;IAAE,GAAG;IAAS,GAAI,KAAK;GAA+B;EACjE;OAEA,aAAa,QAAQ;CAEzB,OAAO,IAAI,OAAO,SAAS,UACzB,aAAa,QAAQ,2BAA2B;EAC9C,KAAK;EACL,GAAG;CACL,CAAC;MAED,aAAa,QAAQ,2BAA2B;EAC9C,GAAI;EACJ,GAAG;CACL,CAAC;CAIL,OAAO;EAAE,GAAG;EAAQ;CAAa;AACnC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abapify/adt-puppeteer",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.38",
|
|
4
4
|
"description": "Puppeteer-based authentication for SAP ADT (SSO/IDP)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"README.md"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@abapify/adt-auth": "0.4.
|
|
21
|
-
"@abapify/adt-config": "0.4.
|
|
22
|
-
"@abapify/browser-auth": "0.4.
|
|
20
|
+
"@abapify/adt-auth": "0.4.38",
|
|
21
|
+
"@abapify/adt-config": "0.4.38",
|
|
22
|
+
"@abapify/browser-auth": "0.4.38",
|
|
23
23
|
"puppeteer": "^25.15.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|