@showrun/core 0.1.10-rc.4 → 0.1.10-rc.5
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/dist/__tests__/registry-client.test.js +4 -4
- package/dist/__tests__/transport.test.d.ts +2 -0
- package/dist/__tests__/transport.test.d.ts.map +1 -0
- package/dist/__tests__/transport.test.js +112 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/networkCapture.d.ts +2 -1
- package/dist/networkCapture.d.ts.map +1 -1
- package/dist/networkCapture.js +11 -8
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +4 -1
- package/dist/transport/impitTransport.d.ts +22 -0
- package/dist/transport/impitTransport.d.ts.map +1 -0
- package/dist/transport/impitTransport.js +84 -0
- package/dist/transport/index.d.ts +15 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +26 -0
- package/dist/transport/playwrightTransport.d.ts +13 -0
- package/dist/transport/playwrightTransport.d.ts.map +1 -0
- package/dist/transport/playwrightTransport.js +41 -0
- package/dist/transport/types.d.ts +56 -0
- package/dist/transport/types.d.ts.map +1 -0
- package/dist/transport/types.js +5 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -107,11 +107,11 @@ describe('RegistryClient', () => {
|
|
|
107
107
|
}
|
|
108
108
|
vi.restoreAllMocks();
|
|
109
109
|
});
|
|
110
|
-
it('
|
|
110
|
+
it('falls back to default registry URL when not configured', async () => {
|
|
111
111
|
delete process.env.SHOWRUN_REGISTRY_URL;
|
|
112
|
-
const { RegistryClient
|
|
113
|
-
|
|
114
|
-
expect(
|
|
112
|
+
const { RegistryClient } = await import('../registry/client.js');
|
|
113
|
+
const client = new RegistryClient();
|
|
114
|
+
expect(client).toBeDefined();
|
|
115
115
|
});
|
|
116
116
|
it('constructs with explicit URL', async () => {
|
|
117
117
|
const { RegistryClient } = await import('../registry/client.js');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/transport.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { createReplayTransport } from '../transport/index.js';
|
|
3
|
+
import { PlaywrightTransport } from '../transport/playwrightTransport.js';
|
|
4
|
+
import { ImpitTransport } from '../transport/impitTransport.js';
|
|
5
|
+
// --- Factory ---
|
|
6
|
+
describe('createReplayTransport', () => {
|
|
7
|
+
const mockPage = {};
|
|
8
|
+
const mockContext = {};
|
|
9
|
+
it('returns ImpitTransport by default (no config)', () => {
|
|
10
|
+
const transport = createReplayTransport(undefined, mockPage, mockContext);
|
|
11
|
+
expect(transport).toBeInstanceOf(ImpitTransport);
|
|
12
|
+
expect(transport.name).toBe('impit');
|
|
13
|
+
});
|
|
14
|
+
it('returns PlaywrightTransport when explicitly configured', () => {
|
|
15
|
+
const transport = createReplayTransport({ transport: 'playwright' }, mockPage, mockContext);
|
|
16
|
+
expect(transport).toBeInstanceOf(PlaywrightTransport);
|
|
17
|
+
});
|
|
18
|
+
it('returns ImpitTransport when configured', () => {
|
|
19
|
+
const transport = createReplayTransport({ transport: 'impit' }, mockPage, mockContext);
|
|
20
|
+
expect(transport).toBeInstanceOf(ImpitTransport);
|
|
21
|
+
expect(transport.name).toBe('impit');
|
|
22
|
+
});
|
|
23
|
+
it('passes impit options through', () => {
|
|
24
|
+
const transport = createReplayTransport({ transport: 'impit', impit: { browser: 'chrome', timeout: 5000 } }, mockPage, mockContext);
|
|
25
|
+
expect(transport).toBeInstanceOf(ImpitTransport);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
// --- PlaywrightTransport ---
|
|
29
|
+
describe('PlaywrightTransport', () => {
|
|
30
|
+
it('calls page.request.fetch with correct arguments', async () => {
|
|
31
|
+
const mockFetch = vi.fn().mockResolvedValue({
|
|
32
|
+
status: () => 200,
|
|
33
|
+
headers: () => ({ 'content-type': 'application/json' }),
|
|
34
|
+
body: () => Promise.resolve(Buffer.from('{"ok":true}')),
|
|
35
|
+
});
|
|
36
|
+
const mockPage = { request: { fetch: mockFetch } };
|
|
37
|
+
const transport = new PlaywrightTransport(mockPage);
|
|
38
|
+
const request = {
|
|
39
|
+
url: 'https://api.example.com/data',
|
|
40
|
+
method: 'POST',
|
|
41
|
+
headers: { 'content-type': 'application/json' },
|
|
42
|
+
body: '{"query":"test"}',
|
|
43
|
+
};
|
|
44
|
+
const result = await transport.execute(request);
|
|
45
|
+
expect(mockFetch).toHaveBeenCalledWith('https://api.example.com/data', {
|
|
46
|
+
method: 'POST',
|
|
47
|
+
headers: { 'content-type': 'application/json' },
|
|
48
|
+
data: '{"query":"test"}',
|
|
49
|
+
});
|
|
50
|
+
expect(result.status).toBe(200);
|
|
51
|
+
expect(result.contentType).toBe('application/json');
|
|
52
|
+
expect(result.body).toBe('{"ok":true}');
|
|
53
|
+
});
|
|
54
|
+
it('throws when page.request is unavailable', async () => {
|
|
55
|
+
const transport = new PlaywrightTransport({});
|
|
56
|
+
await expect(transport.execute({ url: 'https://x.com', method: 'GET', headers: {} }))
|
|
57
|
+
.rejects.toThrow('Browser context does not support API request');
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
// --- ImpitTransport ---
|
|
61
|
+
describe('ImpitTransport', () => {
|
|
62
|
+
it('extracts cookies from browser context and injects as header', async () => {
|
|
63
|
+
const mockCookies = vi.fn().mockResolvedValue([
|
|
64
|
+
{ name: 'session', value: 'abc123', domain: 'api.example.com', path: '/', expires: -1, httpOnly: true, secure: true, sameSite: 'Lax' },
|
|
65
|
+
{ name: 'csrf', value: 'xyz', domain: 'api.example.com', path: '/', expires: -1, httpOnly: false, secure: true, sameSite: 'Lax' },
|
|
66
|
+
]);
|
|
67
|
+
const mockContext = { cookies: mockCookies };
|
|
68
|
+
const mockFetch = vi.fn().mockResolvedValue({
|
|
69
|
+
status: 200,
|
|
70
|
+
headers: { get: (name) => name === 'content-type' ? 'application/json' : null },
|
|
71
|
+
text: () => Promise.resolve('{"data":"ok"}'),
|
|
72
|
+
});
|
|
73
|
+
const transport = new ImpitTransport(mockContext, { browser: 'firefox' });
|
|
74
|
+
// Inject mock impit instance directly
|
|
75
|
+
transport.impitInstance = { fetch: mockFetch };
|
|
76
|
+
const request = {
|
|
77
|
+
url: 'https://api.example.com/data',
|
|
78
|
+
method: 'GET',
|
|
79
|
+
headers: { 'accept': 'application/json', 'content-length': '0' },
|
|
80
|
+
};
|
|
81
|
+
const result = await transport.execute(request);
|
|
82
|
+
// Verify cookies were extracted for the request URL
|
|
83
|
+
expect(mockCookies).toHaveBeenCalledWith('https://api.example.com/data');
|
|
84
|
+
// Verify cookie header was injected
|
|
85
|
+
const fetchCall = mockFetch.mock.calls[0];
|
|
86
|
+
expect(fetchCall[1].headers['cookie']).toBe('session=abc123; csrf=xyz');
|
|
87
|
+
// Verify content-length was stripped (impit manages it)
|
|
88
|
+
expect(fetchCall[1].headers['content-length']).toBeUndefined();
|
|
89
|
+
// Verify accept header passed through
|
|
90
|
+
expect(fetchCall[1].headers['accept']).toBe('application/json');
|
|
91
|
+
expect(result.status).toBe(200);
|
|
92
|
+
expect(result.body).toBe('{"data":"ok"}');
|
|
93
|
+
});
|
|
94
|
+
it('throws clear error when impit import fails', async () => {
|
|
95
|
+
const mockContext = { cookies: vi.fn().mockResolvedValue([]) };
|
|
96
|
+
const transport = new ImpitTransport(mockContext);
|
|
97
|
+
// Force the dynamic import to fail by injecting a failing initPromise
|
|
98
|
+
transport.impitInstance = null;
|
|
99
|
+
transport.initPromise = Promise.reject(new Error('Replay transport "impit" is configured but the "impit" package is not installed. Install it with: pnpm add impit'));
|
|
100
|
+
await expect(transport.execute({ url: 'https://x.com', method: 'GET', headers: {} }))
|
|
101
|
+
.rejects.toThrow(/impit.*not installed/);
|
|
102
|
+
});
|
|
103
|
+
it('dispose clears the instance', () => {
|
|
104
|
+
const mockContext = {};
|
|
105
|
+
const transport = new ImpitTransport(mockContext);
|
|
106
|
+
transport.impitInstance = { fetch: vi.fn() };
|
|
107
|
+
transport.initPromise = Promise.resolve();
|
|
108
|
+
transport.dispose();
|
|
109
|
+
expect(transport.impitInstance).toBeNull();
|
|
110
|
+
expect(transport.initPromise).toBeNull();
|
|
111
|
+
});
|
|
112
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from './requestSnapshot.js';
|
|
|
15
15
|
export * from './httpReplay.js';
|
|
16
16
|
export * from './registry/index.js';
|
|
17
17
|
export * from './proxy/index.js';
|
|
18
|
+
export * from './transport/index.js';
|
|
18
19
|
export * from './storage/index.js';
|
|
19
20
|
export * from './dsl/types.js';
|
|
20
21
|
export * from './dsl/builders.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAGhC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAGhC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,8 @@ export * from './httpReplay.js';
|
|
|
17
17
|
export * from './registry/index.js';
|
|
18
18
|
// Proxy exports
|
|
19
19
|
export * from './proxy/index.js';
|
|
20
|
+
// Transport exports
|
|
21
|
+
export * from './transport/index.js';
|
|
20
22
|
// Storage exports
|
|
21
23
|
export * from './storage/index.js';
|
|
22
24
|
// DSL exports
|
package/dist/networkCapture.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Full request headers kept in-memory for replay only; redacted everywhere else.
|
|
5
5
|
*/
|
|
6
6
|
import type { Page } from 'playwright';
|
|
7
|
+
import type { ReplayTransport } from './transport/types.js';
|
|
7
8
|
export interface NetworkEntryInternal {
|
|
8
9
|
id: string;
|
|
9
10
|
ts: number;
|
|
@@ -109,5 +110,5 @@ export interface NetworkCaptureApi {
|
|
|
109
110
|
* Attach network capture to a Playwright page and return the capture API.
|
|
110
111
|
* Full request headers are kept in-memory only for replay; list/get return redacted summaries.
|
|
111
112
|
*/
|
|
112
|
-
export declare function attachNetworkCapture(page: Page): NetworkCaptureApi;
|
|
113
|
+
export declare function attachNetworkCapture(page: Page, transport?: ReplayTransport): NetworkCaptureApi;
|
|
113
114
|
//# sourceMappingURL=networkCapture.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networkCapture.d.ts","sourceRoot":"","sources":["../src/networkCapture.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AA+
|
|
1
|
+
{"version":3,"file":"networkCapture.d.ts","sourceRoot":"","sources":["../src/networkCapture.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AA+D5D,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,mEAAmE;IACnE,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,C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I,CAAC;IACnD,IAAI,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,mBAAmB,GAAG,IAAI,CAAC;IAClF,MAAM,CACJ,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,sBAAsB,GACjC,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrF,KAAK,IAAI,IAAI,CAAC;IACd,qDAAqD;IACrD,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACpF,6DAA6D;IAC7D,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,wBAAwB,GAAG,IAAI,CAAC;IAChE,iEAAiE;IACjE,WAAW,CAAC,KAAK,EAAE,wBAAwB,GAAG,IAAI,CAAC;CACpD;AAgBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,eAAe,GAAG,iBAAiB,CA2V/F"}
|
package/dist/networkCapture.js
CHANGED
|
@@ -76,7 +76,7 @@ function truncatePostData(raw) {
|
|
|
76
76
|
* Attach network capture to a Playwright page and return the capture API.
|
|
77
77
|
* Full request headers are kept in-memory only for replay; list/get return redacted summaries.
|
|
78
78
|
*/
|
|
79
|
-
export function attachNetworkCapture(page) {
|
|
79
|
+
export function attachNetworkCapture(page, transport) {
|
|
80
80
|
const buffer = [];
|
|
81
81
|
const mapById = new Map();
|
|
82
82
|
let totalBytesEstimate = 0;
|
|
@@ -264,14 +264,9 @@ export function attachNetworkCapture(page) {
|
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
|
-
//
|
|
268
|
-
const requestContext = page.request;
|
|
269
|
-
if (!requestContext || typeof requestContext.fetch !== 'function') {
|
|
270
|
-
throw new Error('Browser context does not support API request (replay). Playwright version may be too old.');
|
|
271
|
-
}
|
|
267
|
+
// Build request: apply overrides to captured entry
|
|
272
268
|
let url = entry.url;
|
|
273
269
|
if (overrides?.urlReplace) {
|
|
274
|
-
// Normalize to array (accepts single object or array)
|
|
275
270
|
const urlReplaces = Array.isArray(overrides.urlReplace) ? overrides.urlReplace : [overrides.urlReplace];
|
|
276
271
|
for (const ur of urlReplaces) {
|
|
277
272
|
try {
|
|
@@ -287,7 +282,6 @@ export function attachNetworkCapture(page) {
|
|
|
287
282
|
url = overrides.url;
|
|
288
283
|
let body = entry.postData ?? undefined;
|
|
289
284
|
if (body != null && overrides?.bodyReplace) {
|
|
290
|
-
// Normalize to array (accepts single object or array)
|
|
291
285
|
const bodyReplaces = Array.isArray(overrides.bodyReplace) ? overrides.bodyReplace : [overrides.bodyReplace];
|
|
292
286
|
for (const br of bodyReplaces) {
|
|
293
287
|
try {
|
|
@@ -317,6 +311,15 @@ export function attachNetworkCapture(page) {
|
|
|
317
311
|
}
|
|
318
312
|
url = u.toString();
|
|
319
313
|
}
|
|
314
|
+
// Delegate to transport (swappable HTTP client)
|
|
315
|
+
if (transport) {
|
|
316
|
+
return transport.execute({ url, method, headers, body });
|
|
317
|
+
}
|
|
318
|
+
// Fallback: Playwright page.request.fetch (backward compat when no transport injected)
|
|
319
|
+
const requestContext = page.request;
|
|
320
|
+
if (!requestContext || typeof requestContext.fetch !== 'function') {
|
|
321
|
+
throw new Error('Browser context does not support API request (replay). Playwright version may be too old.');
|
|
322
|
+
}
|
|
320
323
|
const response = await requestContext.fetch(url, {
|
|
321
324
|
method,
|
|
322
325
|
headers,
|
package/dist/runner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAc,MAAM,YAAY,CAAC;AAElE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAc,MAAM,YAAY,CAAC;AAElE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAczC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAClD;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,iBAAiB,CAAC,CAqR5B"}
|
package/dist/runner.js
CHANGED
|
@@ -4,6 +4,7 @@ import { InputValidator, RunContextFactory, runFlow, attachNetworkCapture, TaskP
|
|
|
4
4
|
import { launchBrowser } from './browserLauncher.js';
|
|
5
5
|
import { isFlowHttpCompatible } from './httpReplay.js';
|
|
6
6
|
import { resolveProxy } from './proxy/proxyService.js';
|
|
7
|
+
import { createReplayTransport } from './transport/index.js';
|
|
7
8
|
import { writeSnapshots, extractTopLevelKeys, detectSensitiveHeaders, } from './requestSnapshot.js';
|
|
8
9
|
/**
|
|
9
10
|
* Runs a task pack with Playwright
|
|
@@ -86,8 +87,10 @@ export async function runTaskPack(taskPack, inputs, options) {
|
|
|
86
87
|
cdpUrl: options.cdpUrl,
|
|
87
88
|
});
|
|
88
89
|
page = browserSession.page;
|
|
90
|
+
// Create replay transport (swappable HTTP client for network_replay steps)
|
|
91
|
+
const replayTransport = createReplayTransport(taskPack.browser?.replayTransport, page, browserSession.context);
|
|
89
92
|
// Attach network capture (rolling buffer, redacted for logs; full headers in-memory for replay only)
|
|
90
|
-
const networkCapture = attachNetworkCapture(page);
|
|
93
|
+
const networkCapture = attachNetworkCapture(page, replayTransport);
|
|
91
94
|
// Create run context
|
|
92
95
|
// Note: browserSession.browser may be null for persistent contexts or Camoufox
|
|
93
96
|
// We pass a proxy that satisfies the Browser type for the RunContext
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replay transport using impit for browser-grade TLS fingerprinting.
|
|
3
|
+
* Bypasses bot detection (Cloudflare, etc.) by impersonating browser
|
|
4
|
+
* TLS/HTTP2 fingerprints via a controlled Rust native addon.
|
|
5
|
+
*
|
|
6
|
+
* Cookies are bridged from the Playwright BrowserContext to impit
|
|
7
|
+
* on each request, so authenticated sessions work transparently.
|
|
8
|
+
*/
|
|
9
|
+
import type { BrowserContext } from 'playwright';
|
|
10
|
+
import type { ReplayTransport, ReplayRequest, ReplayResponse, ReplayTransportConfig } from './types.js';
|
|
11
|
+
export declare class ImpitTransport implements ReplayTransport {
|
|
12
|
+
private browserContext;
|
|
13
|
+
private options?;
|
|
14
|
+
readonly name: "impit";
|
|
15
|
+
private impitInstance;
|
|
16
|
+
private initPromise;
|
|
17
|
+
constructor(browserContext: BrowserContext, options?: ReplayTransportConfig['impit']);
|
|
18
|
+
private ensureImpit;
|
|
19
|
+
execute(request: ReplayRequest): Promise<ReplayResponse>;
|
|
20
|
+
dispose(): void;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=impitTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impitTransport.d.ts","sourceRoot":"","sources":["../../src/transport/impitTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAUxG,qBAAa,cAAe,YAAW,eAAe;IAMlD,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,OAAO,CAAC;IANlB,QAAQ,CAAC,IAAI,EAAG,OAAO,CAAU;IACjC,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,WAAW,CAA8B;gBAGvC,cAAc,EAAE,cAAc,EAC9B,OAAO,CAAC,EAAE,qBAAqB,CAAC,OAAO,CAAC;YAGpC,WAAW;IA0BnB,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IAoC9D,OAAO,IAAI,IAAI;CAIhB"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replay transport using impit for browser-grade TLS fingerprinting.
|
|
3
|
+
* Bypasses bot detection (Cloudflare, etc.) by impersonating browser
|
|
4
|
+
* TLS/HTTP2 fingerprints via a controlled Rust native addon.
|
|
5
|
+
*
|
|
6
|
+
* Cookies are bridged from the Playwright BrowserContext to impit
|
|
7
|
+
* on each request, so authenticated sessions work transparently.
|
|
8
|
+
*/
|
|
9
|
+
/** Headers that impit handles internally or that conflict with its request processing */
|
|
10
|
+
const IMPIT_MANAGED_HEADERS = new Set([
|
|
11
|
+
'content-length',
|
|
12
|
+
'host',
|
|
13
|
+
'connection',
|
|
14
|
+
'transfer-encoding',
|
|
15
|
+
]);
|
|
16
|
+
export class ImpitTransport {
|
|
17
|
+
browserContext;
|
|
18
|
+
options;
|
|
19
|
+
name = 'impit';
|
|
20
|
+
impitInstance = null;
|
|
21
|
+
initPromise = null;
|
|
22
|
+
constructor(browserContext, options) {
|
|
23
|
+
this.browserContext = browserContext;
|
|
24
|
+
this.options = options;
|
|
25
|
+
}
|
|
26
|
+
async ensureImpit() {
|
|
27
|
+
if (this.impitInstance)
|
|
28
|
+
return this.impitInstance;
|
|
29
|
+
// Prevent concurrent initialization
|
|
30
|
+
if (!this.initPromise) {
|
|
31
|
+
this.initPromise = (async () => {
|
|
32
|
+
try {
|
|
33
|
+
// Dynamic import — impit is an optional dependency.
|
|
34
|
+
const { Impit: ImpitClass } = await import('impit');
|
|
35
|
+
this.impitInstance = new ImpitClass({
|
|
36
|
+
browser: this.options?.browser ?? 'firefox',
|
|
37
|
+
timeout: this.options?.timeout ?? 30_000,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
throw new Error('Replay transport "impit" is configured but the "impit" package is not installed. ' +
|
|
42
|
+
'Install it with: pnpm add impit');
|
|
43
|
+
}
|
|
44
|
+
})();
|
|
45
|
+
}
|
|
46
|
+
await this.initPromise;
|
|
47
|
+
return this.impitInstance;
|
|
48
|
+
}
|
|
49
|
+
async execute(request) {
|
|
50
|
+
const impit = await this.ensureImpit();
|
|
51
|
+
if (!impit)
|
|
52
|
+
throw new Error('Failed to initialize impit');
|
|
53
|
+
// Cookie bridging: extract cookies from browser context for the request URL
|
|
54
|
+
const cookies = await this.browserContext.cookies(request.url);
|
|
55
|
+
const cookieHeader = cookies.map(c => `${c.name}=${c.value}`).join('; ');
|
|
56
|
+
// Build headers, stripping ones impit manages internally
|
|
57
|
+
const headers = {};
|
|
58
|
+
for (const [key, value] of Object.entries(request.headers)) {
|
|
59
|
+
if (!IMPIT_MANAGED_HEADERS.has(key.toLowerCase())) {
|
|
60
|
+
headers[key] = value;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (cookieHeader) {
|
|
64
|
+
headers['cookie'] = cookieHeader;
|
|
65
|
+
}
|
|
66
|
+
const init = { method: request.method, headers };
|
|
67
|
+
if (request.body && request.method !== 'GET' && request.method !== 'HEAD') {
|
|
68
|
+
init.body = request.body;
|
|
69
|
+
}
|
|
70
|
+
const response = await impit.fetch(request.url, init);
|
|
71
|
+
const bodyText = await response.text();
|
|
72
|
+
const contentType = response.headers.get('content-type') ?? undefined;
|
|
73
|
+
return {
|
|
74
|
+
status: response.status,
|
|
75
|
+
contentType,
|
|
76
|
+
body: bodyText,
|
|
77
|
+
bodySize: Buffer.byteLength(bodyText, 'utf8'),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
dispose() {
|
|
81
|
+
this.impitInstance = null;
|
|
82
|
+
this.initPromise = null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replay transport factory and re-exports.
|
|
3
|
+
* Creates the appropriate transport based on taskpack configuration.
|
|
4
|
+
*/
|
|
5
|
+
import type { Page, BrowserContext } from 'playwright';
|
|
6
|
+
import type { ReplayTransport, ReplayTransportConfig } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Create a replay transport based on configuration.
|
|
9
|
+
* Default: ImpitTransport (browser-grade TLS fingerprinting).
|
|
10
|
+
*/
|
|
11
|
+
export declare function createReplayTransport(config: ReplayTransportConfig | undefined, page: Page, browserContext: BrowserContext): ReplayTransport;
|
|
12
|
+
export * from './types.js';
|
|
13
|
+
export { PlaywrightTransport } from './playwrightTransport.js';
|
|
14
|
+
export { ImpitTransport } from './impitTransport.js';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transport/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAIzE;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,qBAAqB,GAAG,SAAS,EACzC,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,cAAc,GAC7B,eAAe,CAajB;AAED,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replay transport factory and re-exports.
|
|
3
|
+
* Creates the appropriate transport based on taskpack configuration.
|
|
4
|
+
*/
|
|
5
|
+
import { PlaywrightTransport } from './playwrightTransport.js';
|
|
6
|
+
import { ImpitTransport } from './impitTransport.js';
|
|
7
|
+
/**
|
|
8
|
+
* Create a replay transport based on configuration.
|
|
9
|
+
* Default: ImpitTransport (browser-grade TLS fingerprinting).
|
|
10
|
+
*/
|
|
11
|
+
export function createReplayTransport(config, page, browserContext) {
|
|
12
|
+
const transportName = config?.transport ?? 'impit';
|
|
13
|
+
switch (transportName) {
|
|
14
|
+
case 'impit':
|
|
15
|
+
return new ImpitTransport(browserContext, config?.impit);
|
|
16
|
+
case 'playwright':
|
|
17
|
+
return new PlaywrightTransport(page);
|
|
18
|
+
default: {
|
|
19
|
+
const _exhaustive = transportName;
|
|
20
|
+
throw new Error(`Unknown replay transport: ${_exhaustive}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export * from './types.js';
|
|
25
|
+
export { PlaywrightTransport } from './playwrightTransport.js';
|
|
26
|
+
export { ImpitTransport } from './impitTransport.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default replay transport using Playwright's page.request.fetch().
|
|
3
|
+
* Shares cookies with the browser context automatically.
|
|
4
|
+
*/
|
|
5
|
+
import type { Page } from 'playwright';
|
|
6
|
+
import type { ReplayTransport, ReplayRequest, ReplayResponse } from './types.js';
|
|
7
|
+
export declare class PlaywrightTransport implements ReplayTransport {
|
|
8
|
+
private page;
|
|
9
|
+
readonly name: "playwright";
|
|
10
|
+
constructor(page: Page);
|
|
11
|
+
execute(request: ReplayRequest): Promise<ReplayResponse>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=playwrightTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playwrightTransport.d.ts","sourceRoot":"","sources":["../../src/transport/playwrightTransport.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAUjF,qBAAa,mBAAoB,YAAW,eAAe;IAG7C,OAAO,CAAC,IAAI;IAFxB,QAAQ,CAAC,IAAI,EAAG,YAAY,CAAU;gBAElB,IAAI,EAAE,IAAI;IAExB,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;CAoC/D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default replay transport using Playwright's page.request.fetch().
|
|
3
|
+
* Shares cookies with the browser context automatically.
|
|
4
|
+
*/
|
|
5
|
+
const RESPONSE_BODY_MAX_STORE_BYTES = 5 * 1024 * 1024; // 5MB
|
|
6
|
+
function isTextOrJsonContentType(ct) {
|
|
7
|
+
if (!ct)
|
|
8
|
+
return false;
|
|
9
|
+
const lower = ct.toLowerCase();
|
|
10
|
+
return lower.includes('application/json') || lower.includes('+json') || lower.includes('text/');
|
|
11
|
+
}
|
|
12
|
+
export class PlaywrightTransport {
|
|
13
|
+
page;
|
|
14
|
+
name = 'playwright';
|
|
15
|
+
constructor(page) {
|
|
16
|
+
this.page = page;
|
|
17
|
+
}
|
|
18
|
+
async execute(request) {
|
|
19
|
+
const requestContext = this.page.request;
|
|
20
|
+
if (!requestContext || typeof requestContext.fetch !== 'function') {
|
|
21
|
+
throw new Error('Browser context does not support API request (replay). Playwright version may be too old.');
|
|
22
|
+
}
|
|
23
|
+
const response = await requestContext.fetch(request.url, {
|
|
24
|
+
method: request.method,
|
|
25
|
+
headers: request.headers,
|
|
26
|
+
data: request.body,
|
|
27
|
+
});
|
|
28
|
+
const respBody = await response.body();
|
|
29
|
+
const bodySize = respBody.length;
|
|
30
|
+
const contentType = response.headers()['content-type'] ?? response.headers()['Content-Type'];
|
|
31
|
+
const bodyText = bodySize <= RESPONSE_BODY_MAX_STORE_BYTES && isTextOrJsonContentType(contentType)
|
|
32
|
+
? respBody.toString('utf8')
|
|
33
|
+
: respBody.toString('utf8').slice(0, 2048) + (bodySize > 2048 ? '...[truncated]' : '');
|
|
34
|
+
return {
|
|
35
|
+
status: response.status(),
|
|
36
|
+
contentType,
|
|
37
|
+
body: bodyText,
|
|
38
|
+
bodySize,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Swappable replay transport for network_replay steps.
|
|
3
|
+
* Follows the same pluggable-provider pattern as proxy/ module.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Available replay transport implementations.
|
|
7
|
+
* - 'playwright': Uses Playwright's page.request.fetch() (default)
|
|
8
|
+
* - 'impit': Uses impit for browser-grade TLS fingerprinting
|
|
9
|
+
*/
|
|
10
|
+
export type ReplayTransportName = 'playwright' | 'impit';
|
|
11
|
+
/**
|
|
12
|
+
* Transport configuration stored in taskpack.json under `browser.replayTransport`.
|
|
13
|
+
*/
|
|
14
|
+
export interface ReplayTransportConfig {
|
|
15
|
+
/** Transport to use for network_replay. Default: 'playwright' */
|
|
16
|
+
transport?: ReplayTransportName;
|
|
17
|
+
/** Impit-specific options (only used when transport is 'impit') */
|
|
18
|
+
impit?: {
|
|
19
|
+
/** Browser TLS fingerprint to emulate (default: 'firefox') */
|
|
20
|
+
browser?: 'firefox' | 'chrome';
|
|
21
|
+
/** Request timeout in milliseconds (default: 30000) */
|
|
22
|
+
timeout?: number;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Fully resolved request ready for transport execution.
|
|
27
|
+
* Built by networkCapture.replay() after applying all overrides.
|
|
28
|
+
*/
|
|
29
|
+
export interface ReplayRequest {
|
|
30
|
+
url: string;
|
|
31
|
+
method: string;
|
|
32
|
+
headers: Record<string, string>;
|
|
33
|
+
body?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Response returned by a replay transport.
|
|
37
|
+
*/
|
|
38
|
+
export interface ReplayResponse {
|
|
39
|
+
status: number;
|
|
40
|
+
contentType?: string;
|
|
41
|
+
body: string;
|
|
42
|
+
bodySize: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Interface for pluggable replay transports.
|
|
46
|
+
* Implement this to add support for a new HTTP client.
|
|
47
|
+
*/
|
|
48
|
+
export interface ReplayTransport {
|
|
49
|
+
/** Transport name for logging/diagnostics */
|
|
50
|
+
readonly name: ReplayTransportName;
|
|
51
|
+
/** Execute a fully-resolved HTTP request and return the response */
|
|
52
|
+
execute(request: ReplayRequest): Promise<ReplayResponse>;
|
|
53
|
+
/** Optional cleanup when the transport is no longer needed */
|
|
54
|
+
dispose?(): void;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/transport/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,OAAO,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,iEAAiE;IACjE,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,mEAAmE;IACnE,KAAK,CAAC,EAAE;QACN,8DAA8D;QAC9D,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;QAC/B,uDAAuD;QACvD,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,6CAA6C;IAC7C,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IAEnC,oEAAoE;IACpE,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEzD,8DAA8D;IAC9D,OAAO,CAAC,IAAI,IAAI,CAAC;CAClB"}
|
package/dist/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { DslStep } from './dsl/types.js';
|
|
|
3
3
|
import type { NetworkCaptureApi } from './networkCapture.js';
|
|
4
4
|
import type { SnapshotFile } from './requestSnapshot.js';
|
|
5
5
|
import type { ProxyConfig } from './proxy/types.js';
|
|
6
|
+
import type { ReplayTransportConfig } from './transport/types.js';
|
|
6
7
|
/**
|
|
7
8
|
* Primitive types supported in input/collectible schemas
|
|
8
9
|
*/
|
|
@@ -46,6 +47,12 @@ export interface BrowserSettings {
|
|
|
46
47
|
* Set by the agent's `set_proxy` tool or manually in taskpack.json.
|
|
47
48
|
*/
|
|
48
49
|
proxy?: ProxyConfig;
|
|
50
|
+
/**
|
|
51
|
+
* Replay transport for network_replay steps.
|
|
52
|
+
* Controls which HTTP client sends replayed requests.
|
|
53
|
+
* Default: 'playwright' (uses page.request.fetch)
|
|
54
|
+
*/
|
|
55
|
+
replayTransport?: ReplayTransportConfig;
|
|
49
56
|
}
|
|
50
57
|
/**
|
|
51
58
|
* Field definition in a schema
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE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AAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACvD;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,qBAAqB,EAAE,CAAC;IACtC;;OAEG;IACH,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,YAAY,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,WAAW,CAAC;IACtC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@showrun/core",
|
|
3
|
-
"version": "0.1.10-rc.
|
|
3
|
+
"version": "0.1.10-rc.5",
|
|
4
4
|
"description": "Core types and utilities for Task Pack framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"camoufox-js": "^0.8.5",
|
|
20
20
|
"nunjucks": "^3.2.4",
|
|
21
21
|
"otplib": "^12.0.1",
|
|
22
|
+
"impit": "^0.10.1",
|
|
22
23
|
"playwright": "^1.58.0"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|