@hyperbrowser/sdk 0.56.0 → 0.57.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/dist/services/base.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export declare class BaseService {
|
|
|
4
4
|
protected readonly baseUrl: string;
|
|
5
5
|
protected readonly timeout: number;
|
|
6
6
|
constructor(apiKey: string, baseUrl: string, timeout?: number);
|
|
7
|
-
protected request<T>(path: string, init?: RequestInit, params?: Record<string, string | number | undefined>, fullUrl?: boolean): Promise<T>;
|
|
7
|
+
protected request<T>(path: string, init?: RequestInit, params?: Record<string, string | number | string[] | undefined>, fullUrl?: boolean): Promise<T>;
|
|
8
8
|
}
|
package/dist/services/base.js
CHANGED
|
@@ -18,7 +18,14 @@ class BaseService {
|
|
|
18
18
|
if (params) {
|
|
19
19
|
Object.entries(params).forEach(([key, value]) => {
|
|
20
20
|
if (value !== undefined) {
|
|
21
|
-
|
|
21
|
+
if (Array.isArray(value)) {
|
|
22
|
+
value.forEach((item) => {
|
|
23
|
+
url.searchParams.append(key, item.toString());
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
url.searchParams.append(key, value.toString());
|
|
28
|
+
}
|
|
22
29
|
}
|
|
23
30
|
});
|
|
24
31
|
}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
import { BasicResponse, CreateSessionParams, GetActiveSessionsCountResponse, GetSessionDownloadsUrlResponse, GetSessionRecordingUrlResponse, GetSessionVideoRecordingUrlResponse, SessionDetail, SessionListParams, SessionListResponse, SessionRecording, UploadFileOptions, UploadFileResponse } from "../types/session";
|
|
1
|
+
import { BasicResponse, CreateSessionParams, GetActiveSessionsCountResponse, GetSessionDownloadsUrlResponse, GetSessionRecordingUrlResponse, GetSessionVideoRecordingUrlResponse, SessionDetail, SessionListParams, SessionListResponse, SessionRecording, UploadFileOptions, UploadFileResponse, SessionEventLogListParams, SessionEventLogListResponse } from "../types/session";
|
|
2
2
|
import { BaseService } from "./base";
|
|
3
|
+
/**
|
|
4
|
+
* Service for managing session event logs
|
|
5
|
+
*/
|
|
6
|
+
declare class SessionEventLogsService extends BaseService {
|
|
7
|
+
/**
|
|
8
|
+
* List event logs for a session
|
|
9
|
+
* @param sessionId The ID of the session
|
|
10
|
+
* @param params Optional parameters to filter the event logs
|
|
11
|
+
*/
|
|
12
|
+
list(sessionId: string, params?: SessionEventLogListParams): Promise<SessionEventLogListResponse>;
|
|
13
|
+
}
|
|
3
14
|
export declare class SessionsService extends BaseService {
|
|
15
|
+
readonly eventLogs: SessionEventLogsService;
|
|
16
|
+
constructor(apiKey: string, baseUrl: string, timeout: number);
|
|
4
17
|
/**
|
|
5
18
|
* Create a new browser session
|
|
6
19
|
* @param params Configuration parameters for the new session
|
|
@@ -58,3 +71,4 @@ export declare class SessionsService extends BaseService {
|
|
|
58
71
|
*/
|
|
59
72
|
getActiveSessionsCount(): Promise<GetActiveSessionsCountResponse>;
|
|
60
73
|
}
|
|
74
|
+
export {};
|
|
@@ -32,7 +32,35 @@ const path = __importStar(require("path"));
|
|
|
32
32
|
const form_data_1 = __importDefault(require("form-data"));
|
|
33
33
|
const base_1 = require("./base");
|
|
34
34
|
const client_1 = require("../client");
|
|
35
|
+
/**
|
|
36
|
+
* Service for managing session event logs
|
|
37
|
+
*/
|
|
38
|
+
class SessionEventLogsService extends base_1.BaseService {
|
|
39
|
+
/**
|
|
40
|
+
* List event logs for a session
|
|
41
|
+
* @param sessionId The ID of the session
|
|
42
|
+
* @param params Optional parameters to filter the event logs
|
|
43
|
+
*/
|
|
44
|
+
async list(sessionId, params = {}) {
|
|
45
|
+
try {
|
|
46
|
+
return await this.request(`/session/${sessionId}/event-logs`, undefined, {
|
|
47
|
+
...params,
|
|
48
|
+
types: params.types,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if (error instanceof client_1.HyperbrowserError) {
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
throw new client_1.HyperbrowserError(`Failed to list event logs for session ${sessionId}`, undefined);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
35
59
|
class SessionsService extends base_1.BaseService {
|
|
60
|
+
constructor(apiKey, baseUrl, timeout) {
|
|
61
|
+
super(apiKey, baseUrl, timeout);
|
|
62
|
+
this.eventLogs = new SessionEventLogsService(apiKey, baseUrl, timeout);
|
|
63
|
+
}
|
|
36
64
|
/**
|
|
37
65
|
* Create a new browser session
|
|
38
66
|
* @param params Configuration parameters for the new session
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type SessionEventLogType = "captcha_detected" | "captcha_solved" | "captcha_error";
|
|
1
2
|
export type ScrapeFormat = "markdown" | "html" | "links" | "screenshot";
|
|
2
3
|
export type ScrapeJobStatus = "pending" | "running" | "completed" | "failed";
|
|
3
4
|
export type ExtractJobStatus = "pending" | "running" | "completed" | "failed";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -6,9 +6,9 @@ export { StartBrowserUseTaskParams, StartBrowserUseTaskResponse, BrowserUseTaskS
|
|
|
6
6
|
export { StartClaudeComputerUseTaskParams, StartClaudeComputerUseTaskResponse, ClaudeComputerUseTaskStatusResponse, ClaudeComputerUseTaskResponse, ClaudeComputerUseTaskData, ClaudeComputerUseStepResponse, ClaudeComputerUseApiKeys, } from "./agents/claude-computer-use";
|
|
7
7
|
export { StartCuaTaskParams, StartCuaTaskResponse, CuaTaskStatusResponse, CuaTaskResponse, CuaTaskData, CuaStepResponse, CuaApiKeys, } from "./agents/cua";
|
|
8
8
|
export { StartHyperAgentTaskParams, StartHyperAgentTaskResponse, HyperAgentTaskStatusResponse, HyperAgentTaskResponse, HyperAgentTaskData, HyperAgentStep, HyperAgentOutput, HyperAgentActionOutput, HyperAgentApiKeys, } from "./agents/hyper-agent";
|
|
9
|
-
export { BasicResponse, SessionStatus, Session, SessionDetail, SessionListParams, SessionListResponse, ScreenConfig, CreateSessionParams, GetSessionDownloadsUrlResponse, GetSessionVideoRecordingUrlResponse, GetSessionRecordingUrlResponse, ImageCaptchaParam, UploadFileResponse, UploadFileOptions, GetActiveSessionsCountResponse, } from "./session";
|
|
9
|
+
export { BasicResponse, SessionStatus, Session, SessionDetail, SessionListParams, SessionListResponse, ScreenConfig, CreateSessionParams, GetSessionDownloadsUrlResponse, GetSessionVideoRecordingUrlResponse, GetSessionRecordingUrlResponse, ImageCaptchaParam, UploadFileResponse, UploadFileOptions, GetActiveSessionsCountResponse, SessionEventLogListParams, SessionEventLogListResponse, SessionEventLog, } from "./session";
|
|
10
10
|
export { CreateProfileParams, ProfileResponse, CreateProfileResponse, ProfileListParams, ProfileListResponse, } from "./profile";
|
|
11
11
|
export { CreateExtensionParams, CreateExtensionResponse, ListExtensionsResponse, } from "./extension";
|
|
12
|
-
export { ExtractJobStatus, BrowserUseTaskStatus, BrowserUseLlm, ClaudeComputerUseLlm, ScrapeScreenshotFormat, ScrapeJobStatus, CrawlJobStatus, Country, State, ISO639_1, OperatingSystem, Platform, ScrapeFormat, ScrapeWaitUntil, ScrapePageStatus, CrawlPageStatus, RecordingStatus, DownloadsStatus, HyperAgentLlm, HyperAgentTaskStatus, ClaudeComputerUseTaskStatus, CuaTaskStatus, } from "./constants";
|
|
12
|
+
export { ExtractJobStatus, BrowserUseTaskStatus, BrowserUseLlm, ClaudeComputerUseLlm, ScrapeScreenshotFormat, ScrapeJobStatus, CrawlJobStatus, Country, State, ISO639_1, OperatingSystem, Platform, ScrapeFormat, ScrapeWaitUntil, ScrapePageStatus, CrawlPageStatus, RecordingStatus, DownloadsStatus, HyperAgentLlm, HyperAgentTaskStatus, ClaudeComputerUseTaskStatus, CuaTaskStatus, SessionEventLogType, } from "./constants";
|
|
13
13
|
export { TeamCreditInfo } from "./team";
|
|
14
14
|
export { ComputerAction, Coordinate, ClickActionParams, DragActionParams, PressKeysActionParams, MoveMouseActionParams, ScreenshotActionParams, ScrollActionParams, TypeTextActionParams, ComputerActionParams, ComputerActionResponse, } from "./computer-action";
|
package/dist/types/session.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
|
-
import { Country, DownloadsStatus, ISO639_1, OperatingSystem, Platform, RecordingStatus, State } from "./constants";
|
|
2
|
+
import { Country, DownloadsStatus, ISO639_1, OperatingSystem, Platform, RecordingStatus, SessionEventLogType, State } from "./constants";
|
|
3
3
|
export type SessionStatus = "active" | "closed" | "error";
|
|
4
4
|
export interface BasicResponse {
|
|
5
5
|
success: boolean;
|
|
@@ -73,6 +73,7 @@ export interface CreateSessionParams {
|
|
|
73
73
|
saveDownloads?: boolean;
|
|
74
74
|
imageCaptchaParams?: Array<ImageCaptchaParam>;
|
|
75
75
|
timeoutMinutes?: number;
|
|
76
|
+
enableWebglFingerprinting?: boolean;
|
|
76
77
|
}
|
|
77
78
|
export interface SessionRecording {
|
|
78
79
|
type: number;
|
|
@@ -105,3 +106,27 @@ export interface UploadFileOptions {
|
|
|
105
106
|
export interface GetActiveSessionsCountResponse {
|
|
106
107
|
activeSessionsCount: number;
|
|
107
108
|
}
|
|
109
|
+
export interface SessionEventLog {
|
|
110
|
+
id: string;
|
|
111
|
+
sessionId: string;
|
|
112
|
+
targetId: string;
|
|
113
|
+
pageUrl: string;
|
|
114
|
+
teamId: string;
|
|
115
|
+
type: SessionEventLogType;
|
|
116
|
+
metadata: Record<string, unknown>;
|
|
117
|
+
timestamp: number;
|
|
118
|
+
}
|
|
119
|
+
export interface SessionEventLogListParams {
|
|
120
|
+
page?: number;
|
|
121
|
+
limit?: number;
|
|
122
|
+
startTimestamp?: number;
|
|
123
|
+
endTimestamp?: number;
|
|
124
|
+
targetId?: string;
|
|
125
|
+
types?: SessionEventLogType[];
|
|
126
|
+
}
|
|
127
|
+
export interface SessionEventLogListResponse {
|
|
128
|
+
data: SessionEventLog[];
|
|
129
|
+
totalCount: number;
|
|
130
|
+
page: number;
|
|
131
|
+
perPage: number;
|
|
132
|
+
}
|