@allwright.dev/core 0.0.61 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bootstrap.js CHANGED
@@ -12,7 +12,7 @@ const ALLWRIGHT_HOME_ENV_VAR = "ALLWRIGHT_HOME";
12
12
  const ALLWRIGHT_REPOSITORY_ENV_VAR = "ALLWRIGHT_REPOSITORY";
13
13
  const ALLWRIGHT_VERSION_ENV_VAR = "ALLWRIGHT_VERSION";
14
14
  const DEFAULT_RELEASE_REPOSITORY = "allwright-dev/allwright";
15
- const DEFAULT_RELEASE_VERSION = "0.0.61";
15
+ const DEFAULT_RELEASE_VERSION = "0.1.1";
16
16
  const STARTUP_TIMEOUT_MS = 20_000;
17
17
  const PING_TIMEOUT_MS = 1_000;
18
18
  const PROTO_ROOT = fileURLToPath(new URL("../proto/", import.meta.url));
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import { PageImpl } from "./page.js";
5
5
  import { setServerAddr, shutdown } from "./runtime.js";
6
6
  import type { Browser, BrowserKind, BrowserType, LaunchOptions, Page, ResolveConfigOptions, ResolvedAllwrightConfig } from "./types.js";
7
7
  export { findConfigFile, loadConfigFile, resolveConfig, setServerAddr, shutdown };
8
- export type { AllwrightConfig, Browser, BrowserInfo, BrowserKind, BrowserType, ClickResult, CommandOptions, CountResult, ElementResult, FillResult, HighlightOptions, HighlightResult, LaunchOptions, MobileAndroidConnectOptions, MobileAndroidDevice, MobileAndroidLaunchOptions, MobileAndroidLocator, MobileAndroidApp, Locator, LocatorInfo, MobileSurfaceNamespace, NavigateResult, Page, PageInfo, PressOptions, PressResult, ResolveConfigOptions, ResolvedAllwrightConfig, RetryConfig, ScreenshotOptions, ScreenshotResult, TextResult, WaitForSelectorOptions, WaitForSelectorResult, } from "./types.js";
8
+ export type { AccessibilitySnapshotOptions, AllwrightConfig, Browser, BrowserInfo, BrowserKind, BrowserType, ClickResult, CommandOptions, CountResult, ElementResult, FillResult, HighlightOptions, HighlightResult, LaunchOptions, MobileAndroidConnectOptions, MobileAndroidDevice, MobileAndroidLaunchOptions, MobileAndroidLocator, MobileAndroidApp, Locator, LocatorInfo, MobileSurfaceNamespace, NavigateResult, Page, PageInfo, PressOptions, PressResult, ResolveConfigOptions, ResolvedAllwrightConfig, RetryConfig, ScreenshotOptions, ScreenshotResult, TextResult, WaitForSelectorOptions, WaitForSelectorResult, } from "./types.js";
9
9
  export declare const chromium: BrowserType;
10
10
  export declare const firefox: BrowserType;
11
11
  export { mobile };
package/dist/page.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ClickResult, CommandOptions, CountResult, ElementResult, FillResult, HighlightOptions, HighlightResult, Locator, NavigateResult, Page, PageInfo, PressOptions, PressResult, RuntimeClient, ScreenshotOptions, ScreenshotResult, TextResult, WaitForSelectorOptions, WaitForSelectorResult } from "./types.js";
1
+ import type { AccessibilitySnapshotOptions, ClickResult, CommandOptions, CountResult, ElementResult, FillResult, HighlightOptions, HighlightResult, Locator, NavigateResult, Page, PageInfo, PressOptions, PressResult, RuntimeClient, ScreenshotOptions, ScreenshotResult, TextResult, WaitForSelectorOptions, WaitForSelectorResult } from "./types.js";
2
2
  export declare class PageImpl implements Page {
3
3
  #private;
4
4
  constructor(input: PageInfo & {
@@ -18,6 +18,7 @@ export declare class PageImpl implements Page {
18
18
  textContent(selector: string, options?: CommandOptions): Promise<TextResult>;
19
19
  innerText(selector: string, options?: CommandOptions): Promise<TextResult>;
20
20
  waitForSelector(selector: string, options?: WaitForSelectorOptions): Promise<WaitForSelectorResult>;
21
+ accessibilitySnapshot(options?: AccessibilitySnapshotOptions): Promise<string>;
21
22
  screenshot(options?: ScreenshotOptions): Promise<ScreenshotResult>;
22
23
  close(): Promise<void>;
23
24
  ping(message?: string): Promise<string>;
package/dist/page.js CHANGED
@@ -305,6 +305,33 @@ export class PageImpl {
305
305
  }
306
306
  }
307
307
  }
308
+ async accessibilitySnapshot(options = {}) {
309
+ const format = options.format ?? "json";
310
+ if (format !== "json" && format !== "yaml") {
311
+ throw new Error("accessibility snapshot format must be 'json' or 'yaml'");
312
+ }
313
+ const handle = await this.#getHandle();
314
+ this.#ensureOpen(handle);
315
+ handle.stream.write({
316
+ surfaceSessionId: this.browserSessionId,
317
+ contextSessionId: this.sessionId,
318
+ accessibilitySnapshot: {
319
+ format,
320
+ retryOptions: options.timeoutMs ? { timeoutMs: options.timeoutMs } : undefined,
321
+ },
322
+ });
323
+ while (true) {
324
+ const event = await handle.queue.next();
325
+ if (event.accessibilitySnapshotCaptured)
326
+ return event.accessibilitySnapshotCaptured.snapshot ?? "";
327
+ if (event.error?.message)
328
+ throw formatActionError("accessibility snapshot", event.error.message);
329
+ if (event.closed) {
330
+ handle.closed = true;
331
+ throw new Error(`page session ${this.sessionId} closed while waiting for accessibility snapshot`);
332
+ }
333
+ }
334
+ }
308
335
  async screenshot(options = {}) {
309
336
  const handle = await this.#getHandle();
310
337
  this.#ensureOpen(handle);
package/dist/types.d.ts CHANGED
@@ -8,6 +8,9 @@ export type BrowserKind = "chromium" | "firefox";
8
8
  export interface CommandOptions {
9
9
  timeoutMs?: number;
10
10
  }
11
+ export interface AccessibilitySnapshotOptions extends CommandOptions {
12
+ format?: "json" | "yaml";
13
+ }
11
14
  export interface NavigateResult {
12
15
  url: string;
13
16
  note: string;
@@ -105,6 +108,7 @@ export interface Browser extends BrowserInfo {
105
108
  browserInfo(): BrowserInfo;
106
109
  }
107
110
  export interface Page extends PageInfo {
111
+ accessibilitySnapshot(options?: AccessibilitySnapshotOptions): Promise<string>;
108
112
  locator(selector: string): Locator;
109
113
  goto(url: string, options?: CommandOptions): Promise<NavigateResult>;
110
114
  navigate(url: string, options?: CommandOptions): Promise<NavigateResult>;
@@ -337,6 +341,10 @@ export interface SurfaceSessionEvent {
337
341
  };
338
342
  }
339
343
  export interface ContextSessionEvent {
344
+ accessibilitySnapshotCaptured?: {
345
+ snapshot?: string;
346
+ format?: string;
347
+ };
340
348
  contextSessionId?: string;
341
349
  event?: string;
342
350
  attached?: {
@@ -591,6 +599,16 @@ export interface WaitForSelectorRequest {
591
599
  };
592
600
  };
593
601
  }
602
+ export interface AccessibilitySnapshotRequest {
603
+ surfaceSessionId: string;
604
+ contextSessionId: string;
605
+ accessibilitySnapshot: {
606
+ format: string;
607
+ retryOptions?: {
608
+ timeoutMs?: number;
609
+ };
610
+ };
611
+ }
594
612
  export interface ScreenshotRequest {
595
613
  surfaceSessionId: string;
596
614
  contextSessionId: string;
@@ -607,7 +625,7 @@ export interface CloseContextRequest {
607
625
  close: Record<string, never>;
608
626
  }
609
627
  export type SurfaceSessionRequest = LaunchBrowserRequest | LaunchChromeRequest | OpenContextRequest | ConnectMobileRequest | LaunchAppRequest | SurfacePingRequest | CloseSurfaceRequest;
610
- export type ContextSessionRequest = ContextPingRequest | NavigateRequest | ClickRequest | CountRequest | HighlightRequest | FocusRequest | FillRequest | HoverRequest | PressRequest | TextContentRequest | InnerTextRequest | WaitForSelectorRequest | ScreenshotRequest | CloseContextRequest;
628
+ export type ContextSessionRequest = ContextPingRequest | NavigateRequest | ClickRequest | CountRequest | HighlightRequest | FocusRequest | FillRequest | HoverRequest | PressRequest | TextContentRequest | InnerTextRequest | WaitForSelectorRequest | AccessibilitySnapshotRequest | ScreenshotRequest | CloseContextRequest;
611
629
  export type SurfaceSessionStream = grpc.ClientDuplexStream<SurfaceSessionRequest, SurfaceSessionEvent>;
612
630
  export type ContextSessionStream = grpc.ClientDuplexStream<ContextSessionRequest, ContextSessionEvent>;
613
631
  export interface EngineServiceClientShape {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allwright.dev/core",
3
- "version": "0.0.61",
3
+ "version": "0.1.1",
4
4
  "description": "High-level TypeScript client for the allwright automation engine.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -2,8 +2,11 @@ syntax = "proto3";
2
2
 
3
3
  package allwright.engine.v1;
4
4
  option go_package = "allwright.dev/gen/allwright/engine/v1;enginev1";
5
+ option java_package = "dev.allwright.engine.v1";
6
+ option java_multiple_files = true;
5
7
 
6
8
  import "core/v1/common.proto";
9
+ import "surfaces/web/v1/web.proto";
7
10
 
8
11
  message ContextSessionCommand {
9
12
  string surface_session_id = 1;
@@ -24,6 +27,7 @@ message ContextSessionCommand {
24
27
  GetInnerTextCommand get_inner_text = 14;
25
28
  WaitForSelectorCommand wait_for_selector = 15;
26
29
  ScreenshotCommand screenshot = 16;
30
+ AccessibilitySnapshotCommand accessibility_snapshot = 17;
27
31
  }
28
32
  }
29
33
 
@@ -54,6 +58,7 @@ message ContextSessionEvent {
54
58
  InnerTextResolvedEvent inner_text_resolved = 16;
55
59
  SelectorWaitSatisfiedEvent selector_wait_satisfied = 17;
56
60
  ScreenshotCapturedEvent screenshot_captured = 18;
61
+ AccessibilitySnapshotCapturedEvent accessibility_snapshot_captured = 19;
57
62
  }
58
63
  }
59
64
 
@@ -2,6 +2,8 @@ syntax = "proto3";
2
2
 
3
3
  package allwright.engine.v1;
4
4
  option go_package = "allwright.dev/gen/allwright/engine/v1;enginev1";
5
+ option java_package = "dev.allwright.engine.v1";
6
+ option java_multiple_files = true;
5
7
 
6
8
  import "core/v1/common.proto";
7
9
 
@@ -37,3 +39,15 @@ message ChromeLaunchedEvent {
37
39
  string user_data_dir = 4;
38
40
  string initial_page_session_id = 5;
39
41
  }
42
+
43
+ // Empty format defaults to JSON. Accepted values are "json" and "yaml".
44
+ message AccessibilitySnapshotCommand {
45
+ string format = 1;
46
+ optional CommandRetryOptions retry_options = 2;
47
+ }
48
+
49
+ // Both formats encode the same versioned, structured document.
50
+ message AccessibilitySnapshotCapturedEvent {
51
+ string snapshot = 1;
52
+ string format = 2;
53
+ }