@allwright.dev/core 0.0.54 → 0.0.55

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.54";
15
+ const DEFAULT_RELEASE_VERSION = "0.0.55";
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, ScreenshotResult, TextResult, WaitForSelectorOptions, WaitForSelectorResult, } from "./types.js";
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";
9
9
  export declare const chromium: BrowserType;
10
10
  export declare const firefox: BrowserType;
11
11
  export { mobile };
package/dist/mobile.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { createBrowserSessionHandle, createPageHandle, getRuntime } from "./runtime.js";
2
+ import { writeFile } from "node:fs/promises";
2
3
  import { chainMobileSelectorForTransport, normalizeMobileSelectorForTransport } from "./mobileSelectors.js";
3
4
  function retryOptions(timeoutMs) {
4
5
  return timeoutMs ? { timeoutMs } : undefined;
@@ -83,15 +84,20 @@ class MobileAndroidAppImpl {
83
84
  contextSessionId: this.sessionId,
84
85
  screenshot: {
85
86
  retryOptions: retryOptions(options.timeoutMs),
87
+ fullPage: options.fullPage,
86
88
  },
87
89
  });
88
90
  while (true) {
89
91
  const event = await handle.queue.next();
90
92
  if (event.screenshotCaptured?.pngData) {
91
- return {
93
+ const screenshot = {
92
94
  pngData: event.screenshotCaptured.pngData,
93
95
  note: event.screenshotCaptured.note ?? "",
94
96
  };
97
+ if (options.path) {
98
+ await writeFile(options.path, screenshot.pngData);
99
+ }
100
+ return screenshot;
95
101
  }
96
102
  if (event.error?.message) {
97
103
  throw new Error(event.error.message);
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, ScreenshotResult, TextResult, WaitForSelectorOptions, WaitForSelectorResult } from "./types.js";
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";
2
2
  export declare class PageImpl implements Page {
3
3
  #private;
4
4
  constructor(input: PageInfo & {
@@ -18,7 +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
- screenshot(options?: CommandOptions): Promise<ScreenshotResult>;
21
+ screenshot(options?: ScreenshotOptions): Promise<ScreenshotResult>;
22
22
  close(): Promise<void>;
23
23
  ping(message?: string): Promise<string>;
24
24
  pageInfo(): PageInfo;
package/dist/page.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { LocatorImpl } from "./locator.js";
2
+ import { writeFile } from "node:fs/promises";
2
3
  import { formatActionError } from "./errors.js";
3
4
  import { normalizeSelectorForTransport } from "./selectors.js";
4
5
  import { createPageHandle } from "./runtime.js";
@@ -312,15 +313,20 @@ export class PageImpl {
312
313
  contextSessionId: this.sessionId,
313
314
  screenshot: {
314
315
  retryOptions: options.timeoutMs ? { timeoutMs: options.timeoutMs } : undefined,
316
+ fullPage: options.fullPage,
315
317
  },
316
318
  });
317
319
  while (true) {
318
320
  const event = await handle.queue.next();
319
321
  if (event.screenshotCaptured?.pngData) {
320
- return {
322
+ const screenshot = {
321
323
  pngData: event.screenshotCaptured.pngData,
322
324
  note: event.screenshotCaptured.note ?? "",
323
325
  };
326
+ if (options.path) {
327
+ await writeFile(options.path, screenshot.pngData);
328
+ }
329
+ return screenshot;
324
330
  }
325
331
  if (event.error?.message) {
326
332
  throw formatActionError("screenshot", event.error.message);
package/dist/types.d.ts CHANGED
@@ -71,6 +71,10 @@ export interface ScreenshotResult {
71
71
  pngData: Uint8Array;
72
72
  note: string;
73
73
  }
74
+ export interface ScreenshotOptions extends CommandOptions {
75
+ fullPage?: boolean;
76
+ path?: string;
77
+ }
74
78
  export interface BrowserInfo {
75
79
  sessionId: string;
76
80
  browserName: string;
@@ -114,7 +118,7 @@ export interface Page extends PageInfo {
114
118
  textContent(selector: string, options?: CommandOptions): Promise<TextResult>;
115
119
  innerText(selector: string, options?: CommandOptions): Promise<TextResult>;
116
120
  waitForSelector(selector: string, options?: WaitForSelectorOptions): Promise<WaitForSelectorResult>;
117
- screenshot(options?: CommandOptions): Promise<ScreenshotResult>;
121
+ screenshot(options?: ScreenshotOptions): Promise<ScreenshotResult>;
118
122
  close(): Promise<void>;
119
123
  ping(message?: string): Promise<string>;
120
124
  pageInfo(): PageInfo;
@@ -144,7 +148,7 @@ export interface MobileAndroidApp {
144
148
  locator(selector: string): MobileAndroidLocator;
145
149
  click(selector: string, options?: CommandOptions): Promise<ClickResult>;
146
150
  fill(selector: string, value: string, options?: CommandOptions): Promise<FillResult>;
147
- screenshot(options?: CommandOptions): Promise<ScreenshotResult>;
151
+ screenshot(options?: ScreenshotOptions): Promise<ScreenshotResult>;
148
152
  }
149
153
  export interface MobileAndroidDevice {
150
154
  readonly sessionId: string;
@@ -582,6 +586,7 @@ export interface ScreenshotRequest {
582
586
  retryOptions?: {
583
587
  timeoutMs?: number;
584
588
  };
589
+ fullPage?: boolean;
585
590
  };
586
591
  }
587
592
  export interface CloseContextRequest {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allwright.dev/core",
3
- "version": "0.0.54",
3
+ "version": "0.0.55",
4
4
  "description": "High-level TypeScript client for the allwright automation engine.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -135,6 +135,7 @@ message WaitForSelectorCommand {
135
135
 
136
136
  message ScreenshotCommand {
137
137
  optional CommandRetryOptions retry_options = 1;
138
+ optional bool full_page = 2;
138
139
  }
139
140
 
140
141
  message PageNavigatedEvent {