@qontinui/ui-bridge-wrapper 0.4.2 → 0.6.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/README.md +4 -4
- package/dist/capture-specs-cli.cjs +34 -4
- package/dist/capture-specs-cli.cjs.map +1 -1
- package/dist/index.cjs +34 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +34 -4
- package/dist/index.js.map +1 -1
- package/dist/inject-cli.cjs +123 -4
- package/dist/inject-cli.cjs.map +1 -1
- package/dist/inject-cli.d.ts +29 -1
- package/dist/inject-cli.d.ts.map +1 -1
- package/dist/login-web-cli.cjs +150 -10
- package/dist/login-web-cli.cjs.map +1 -1
- package/dist/login-web-cli.d.ts +5 -1
- package/dist/login-web-cli.d.ts.map +1 -1
- package/dist/session-storage-capture.d.ts +78 -0
- package/dist/session-storage-capture.d.ts.map +1 -0
- package/dist/transports/headless.d.ts +26 -0
- package/dist/transports/headless.d.ts.map +1 -1
- package/dist/transports/injected.d.ts +10 -0
- package/dist/transports/injected.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -222,13 +222,17 @@ var HeadlessTransport = class extends BaseTransport {
|
|
|
222
222
|
uiBridgeBase: typeof raw["uiBridgeBase"] === "string" ? raw["uiBridgeBase"] : void 0,
|
|
223
223
|
waitForUiBridgeMs: typeof raw["waitForUiBridgeMs"] === "number" ? raw["waitForUiBridgeMs"] : void 0,
|
|
224
224
|
userAgent: typeof raw["userAgent"] === "string" ? raw["userAgent"] : void 0,
|
|
225
|
-
forwardConsole: typeof raw["forwardConsole"] === "boolean" ? raw["forwardConsole"] : void 0
|
|
225
|
+
forwardConsole: typeof raw["forwardConsole"] === "boolean" ? raw["forwardConsole"] : void 0,
|
|
226
|
+
launchArgs: Array.isArray(raw["launchArgs"]) && raw["launchArgs"].every((a) => typeof a === "string") ? raw["launchArgs"] : void 0,
|
|
227
|
+
storageStatePath: typeof raw["storageStatePath"] === "string" ? raw["storageStatePath"] : void 0
|
|
226
228
|
};
|
|
227
229
|
}
|
|
228
230
|
async onReady() {
|
|
229
231
|
let launchHeadlessTab;
|
|
232
|
+
const headlessSpecifier = "@qontinui/ui-bridge-headless";
|
|
230
233
|
try {
|
|
231
|
-
|
|
234
|
+
const mod = await import(headlessSpecifier);
|
|
235
|
+
({ launchHeadlessTab } = mod);
|
|
232
236
|
} catch (err) {
|
|
233
237
|
const cause = err instanceof Error ? err.message : String(err);
|
|
234
238
|
const code = err?.code;
|
|
@@ -248,6 +252,7 @@ Underlying import error: ${cause}`
|
|
|
248
252
|
);
|
|
249
253
|
}
|
|
250
254
|
const initScripts = await this.buildInitScripts();
|
|
255
|
+
const relayAuth = this.relayAuth();
|
|
251
256
|
let tab;
|
|
252
257
|
try {
|
|
253
258
|
tab = await launchHeadlessTab({
|
|
@@ -259,7 +264,11 @@ Underlying import error: ${cause}`
|
|
|
259
264
|
viewportHeight: this.options.viewportHeight,
|
|
260
265
|
userAgent: this.options.userAgent,
|
|
261
266
|
forwardConsole: this.options.forwardConsole,
|
|
262
|
-
initScripts: initScripts.length > 0 ? initScripts : void 0
|
|
267
|
+
initScripts: initScripts.length > 0 ? initScripts : void 0,
|
|
268
|
+
launchArgs: this.options.launchArgs && this.options.launchArgs.length > 0 ? this.options.launchArgs : void 0,
|
|
269
|
+
storageStatePath: this.options.storageStatePath,
|
|
270
|
+
...relayAuth.authToken ? { authToken: relayAuth.authToken } : {},
|
|
271
|
+
...relayAuth.callerUserId ? { callerUserId: relayAuth.callerUserId } : {}
|
|
263
272
|
});
|
|
264
273
|
} catch (err) {
|
|
265
274
|
const cause = err instanceof Error ? err.message : String(err);
|
|
@@ -291,6 +300,15 @@ Underlying launch error: ${cause}`
|
|
|
291
300
|
async buildInitScripts() {
|
|
292
301
|
return [];
|
|
293
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* Subclass hook: credentials for the launcher's Node-side relay registration
|
|
305
|
+
* poll (`<uiBridgeBase>/tabs`). Default: none (anonymous poll — correct for an
|
|
306
|
+
* ungated relay). Injected mode overrides this with the `--auth-token` bearer
|
|
307
|
+
* and the `--registration-metadata` userId.
|
|
308
|
+
*/
|
|
309
|
+
relayAuth() {
|
|
310
|
+
return {};
|
|
311
|
+
}
|
|
294
312
|
/**
|
|
295
313
|
* Subclass hook: run after launch + navigation, before `ready()` resolves.
|
|
296
314
|
* Default: no-op. Injected mode overrides it to await the in-page runtime.
|
|
@@ -384,8 +402,8 @@ var InjectedTransport = class extends HeadlessTransport {
|
|
|
384
402
|
cfg.registrationMetadata = this.injected.registrationMetadata;
|
|
385
403
|
if (this.injected.appId) cfg.appId = this.injected.appId;
|
|
386
404
|
if (this.injected.appName) cfg.appName = this.injected.appName;
|
|
387
|
-
if (this.injected.tabId) cfg.tabId = this.injected.tabId;
|
|
388
405
|
}
|
|
406
|
+
if (this.injected.tabId) cfg.tabId = this.injected.tabId;
|
|
389
407
|
if (this.injected.settleQuietMs !== void 0)
|
|
390
408
|
cfg.settleQuietMs = this.injected.settleQuietMs;
|
|
391
409
|
if (this.injected.settleTimeoutMs !== void 0)
|
|
@@ -394,6 +412,18 @@ var InjectedTransport = class extends HeadlessTransport {
|
|
|
394
412
|
cfg.expectSelector = this.injected.expectSelector;
|
|
395
413
|
return Object.keys(cfg).length > 0 ? cfg : null;
|
|
396
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* The relay credentials the Node-side registration poll needs. Same bearer the
|
|
417
|
+
* page-side client gets via `__uiBridgeInjectedConfig.authToken`; without it
|
|
418
|
+
* the poll against a gated relay 401s and the CLI reports `tabId: null` on a
|
|
419
|
+
* launch that actually registered.
|
|
420
|
+
*/
|
|
421
|
+
relayAuth() {
|
|
422
|
+
return {
|
|
423
|
+
...this.injected.authToken ? { authToken: this.injected.authToken } : {},
|
|
424
|
+
...this.injected.registrationMetadata?.userId ? { callerUserId: this.injected.registrationMetadata.userId } : {}
|
|
425
|
+
};
|
|
426
|
+
}
|
|
397
427
|
async buildInitScripts() {
|
|
398
428
|
const scripts = [];
|
|
399
429
|
const cfg = this.injectedConfig();
|