@hyperbrowser/sdk 0.11.0 → 0.12.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.
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { CreateExtensionResponse, ListExtensionsResponse } from "../types/extension";
|
|
1
|
+
import { CreateExtensionParams, CreateExtensionResponse, ListExtensionsResponse } from "../types/extension";
|
|
2
2
|
import { BaseService } from "./base";
|
|
3
3
|
export declare class ExtensionService extends BaseService {
|
|
4
4
|
/**
|
|
5
5
|
* Upload an extension to hyperbrowser
|
|
6
|
-
* @param
|
|
7
|
-
* @param {string} [fileName] Name to give to the extension.
|
|
6
|
+
* @param params Configuration parameters for the new extension
|
|
8
7
|
*/
|
|
9
|
-
create(
|
|
8
|
+
create(params: CreateExtensionParams): Promise<CreateExtensionResponse>;
|
|
10
9
|
/**
|
|
11
10
|
* List all uploaded extensions for the account
|
|
12
11
|
*/
|
|
@@ -27,19 +27,18 @@ async function checkFileExists(filePath) {
|
|
|
27
27
|
class ExtensionService extends base_1.BaseService {
|
|
28
28
|
/**
|
|
29
29
|
* Upload an extension to hyperbrowser
|
|
30
|
-
* @param
|
|
31
|
-
* @param {string} [fileName] Name to give to the extension.
|
|
30
|
+
* @param params Configuration parameters for the new extension
|
|
32
31
|
*/
|
|
33
|
-
async create(
|
|
32
|
+
async create(params) {
|
|
34
33
|
try {
|
|
35
|
-
await checkFileExists(filePath);
|
|
34
|
+
await checkFileExists(params.filePath);
|
|
36
35
|
const form = new form_data_1.default();
|
|
37
|
-
form.append("file", await promises_1.default.readFile(filePath), {
|
|
38
|
-
filename: node_path_1.default.basename(filePath),
|
|
36
|
+
form.append("file", await promises_1.default.readFile(params.filePath), {
|
|
37
|
+
filename: node_path_1.default.basename(params.filePath),
|
|
39
38
|
contentType: "application/zip",
|
|
40
39
|
});
|
|
41
|
-
if (
|
|
42
|
-
form.append("name",
|
|
40
|
+
if (params.name) {
|
|
41
|
+
form.append("name", params.name);
|
|
43
42
|
}
|
|
44
43
|
const response = await this.request("/extensions/add", {
|
|
45
44
|
method: "POST",
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export { StartCrawlJobParams, StartCrawlJobResponse, CrawledPage, CrawlJobRespon
|
|
|
3
3
|
export { StartScrapeJobParams, StartScrapeJobResponse, ScrapeJobData, ScrapeJobResponse, } from "./scrape";
|
|
4
4
|
export { BasicResponse, SessionStatus, Session, SessionDetail, SessionListParams, SessionListResponse, ScreenConfig, CreateSessionParams, } from "./session";
|
|
5
5
|
export { ProfileResponse, CreateProfileResponse } from "./profile";
|
|
6
|
+
export { CreateExtensionParams, CreateExtensionResponse, ListExtensionsResponse, } from "./extension";
|
|
6
7
|
export { ScrapeJobStatus, CrawlJobStatus, Country, ISO639_1, OperatingSystem, Platform, } from "./constants";
|