@airtop/plugin-puppeteer 1.0.0-alpha2.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/LICENSE +21 -0
- package/dist/index.cjs +23 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +32 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Airtop
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/index.ts
|
|
2
|
+
var _sdk = require('@airtop/sdk');
|
|
3
|
+
var plugin = {
|
|
4
|
+
augmentationType: _sdk.AirtopPluginAugmentationType.AirtopSessionClient,
|
|
5
|
+
augment: (prototype) => {
|
|
6
|
+
prototype.getWindowForPuppeteerPage = async function(page, options, requestOptions) {
|
|
7
|
+
const frameId = page.mainFrame()._id;
|
|
8
|
+
if (!frameId) {
|
|
9
|
+
throw new Error("Could not get frame ID from Puppeteer page");
|
|
10
|
+
}
|
|
11
|
+
return this.withWindowId(frameId).getWindowInfo(options, requestOptions);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
function puppeteerPlugin() {
|
|
16
|
+
return {
|
|
17
|
+
pluginsToAdd: [plugin]
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exports.puppeteerPlugin = puppeteerPlugin;
|
|
23
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/theo/projects/monarch/sdk-v2/wrapper-sdks/typescript/packages/plugins/puppeteer/dist/index.cjs","../src/index.ts"],"names":[],"mappings":"AAAA;ACAA,kCAA6C;AA4C7C,IAAM,OAAA,EAAoC;AAAA,EACxC,gBAAA,EAAkB,iCAAA,CAA6B,mBAAA;AAAA,EAC/C,OAAA,EAAS,CAAC,SAAA,EAAA,GAAoD;AAC5D,IAAA,SAAA,CAAU,0BAAA,EAA4B,MAAA,QAAA,CACpC,IAAA,EACA,OAAA,EACA,cAAA,EACA;AACA,MAAA,MAAM,QAAA,EAAW,IAAA,CAAK,SAAA,CAAU,CAAA,CAAU,GAAA;AAE1C,MAAA,GAAA,CAAI,CAAC,OAAA,EAAS;AACZ,QAAA,MAAM,IAAI,KAAA,CAAM,4CAA4C,CAAA;AAAA,MAC9D;AAEA,MAAA,OAAO,IAAA,CAAK,YAAA,CAAa,OAAO,CAAA,CAAE,aAAA,CAAc,OAAA,EAAS,cAAc,CAAA;AAAA,IACzE,CAAA;AAAA,EACF;AACF,CAAA;AAKO,SAAS,eAAA,CAAA,EAA4C;AAC1D,EAAA,OAAO;AAAA,IACL,YAAA,EAAc,CAAC,MAAM;AAAA,EACvB,CAAA;AACF;ADnDA;AACE;AACF,0CAAC","file":"/Users/theo/projects/monarch/sdk-v2/wrapper-sdks/typescript/packages/plugins/puppeteer/dist/index.cjs","sourcesContent":[null,"import { AirtopPluginAugmentationType } from \"@airtop/sdk\";\nimport type { AirtopSessionClient, AirtopSessionClientPlugin } from \"@airtop/sdk\";\nimport type { AirtopRequestOptions } from \"@airtop/sdk\";\nimport type { AirtopWindow } from \"@airtop/sdk\";\nimport type { WindowGetConfig } from \"@airtop/sdk\";\nimport type { AirtopPluginRegistration } from \"@airtop/sdk\";\nimport type { AirtopWindowGetInfoResponse } from \"@airtop/sdk\";\nimport type { Page } from \"puppeteer\";\n\n// This is exported so the docs can expose it as we can't generate docs against the\n// module declaration\n/**\n * The methods provided by the Puppeteer plugin.\n */\nexport interface PuppeteerPluginMethods {\n /**\n * Get the window information for a Puppeteer Page instance.\n * @param page The Puppeteer Page instance to get window information for.\n * @param options Configuration options for the window info request.\n * @param requestOptions Additional options to customize the request behavior.\n */\n getWindowForPuppeteerPage(\n page: Page,\n options?: WindowGetConfig,\n requestOptions?: AirtopRequestOptions,\n ): Promise<AirtopWindow<AirtopWindowGetInfoResponse>>;\n}\n\ndeclare module \"@airtop/sdk\" {\n interface AirtopSessionClient {\n /**\n * Get the window information for a Puppeteer Page instance.\n * @param page The Puppeteer Page instance to get window information for.\n * @param options Configuration options for the window info request.\n * @param requestOptions Additional options to customize the request behavior.\n */\n getWindowForPuppeteerPage(\n page: Page,\n options?: WindowGetConfig,\n requestOptions?: AirtopRequestOptions,\n ): Promise<AirtopWindow<AirtopWindowGetInfoResponse>>;\n }\n}\n\nconst plugin: AirtopSessionClientPlugin = {\n augmentationType: AirtopPluginAugmentationType.AirtopSessionClient,\n augment: (prototype: typeof AirtopSessionClient.prototype) => {\n prototype.getWindowForPuppeteerPage = async function (\n page: Page,\n options?: WindowGetConfig,\n requestOptions?: AirtopRequestOptions,\n ) {\n const frameId = (page.mainFrame() as any)._id;\n\n if (!frameId) {\n throw new Error(\"Could not get frame ID from Puppeteer page\");\n }\n\n return this.withWindowId(frameId).getWindowInfo(options, requestOptions);\n };\n },\n};\n\n/**\n * Use with registerAirtopPlugin() from the Airtop SDK to add the Puppeteer plugin.\n */\nexport function puppeteerPlugin(): AirtopPluginRegistration {\n return {\n pluginsToAdd: [plugin],\n };\n}\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { WindowGetConfig, AirtopRequestOptions, AirtopWindow, AirtopWindowGetInfoResponse, AirtopPluginRegistration } from '@airtop/sdk';
|
|
2
|
+
import { Page } from 'puppeteer';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The methods provided by the Puppeteer plugin.
|
|
6
|
+
*/
|
|
7
|
+
interface PuppeteerPluginMethods {
|
|
8
|
+
/**
|
|
9
|
+
* Get the window information for a Puppeteer Page instance.
|
|
10
|
+
* @param page The Puppeteer Page instance to get window information for.
|
|
11
|
+
* @param options Configuration options for the window info request.
|
|
12
|
+
* @param requestOptions Additional options to customize the request behavior.
|
|
13
|
+
*/
|
|
14
|
+
getWindowForPuppeteerPage(page: Page, options?: WindowGetConfig, requestOptions?: AirtopRequestOptions): Promise<AirtopWindow<AirtopWindowGetInfoResponse>>;
|
|
15
|
+
}
|
|
16
|
+
declare module "@airtop/sdk" {
|
|
17
|
+
interface AirtopSessionClient {
|
|
18
|
+
/**
|
|
19
|
+
* Get the window information for a Puppeteer Page instance.
|
|
20
|
+
* @param page The Puppeteer Page instance to get window information for.
|
|
21
|
+
* @param options Configuration options for the window info request.
|
|
22
|
+
* @param requestOptions Additional options to customize the request behavior.
|
|
23
|
+
*/
|
|
24
|
+
getWindowForPuppeteerPage(page: Page, options?: WindowGetConfig, requestOptions?: AirtopRequestOptions): Promise<AirtopWindow<AirtopWindowGetInfoResponse>>;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Use with registerAirtopPlugin() from the Airtop SDK to add the Puppeteer plugin.
|
|
29
|
+
*/
|
|
30
|
+
declare function puppeteerPlugin(): AirtopPluginRegistration;
|
|
31
|
+
|
|
32
|
+
export { type PuppeteerPluginMethods, puppeteerPlugin };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { WindowGetConfig, AirtopRequestOptions, AirtopWindow, AirtopWindowGetInfoResponse, AirtopPluginRegistration } from '@airtop/sdk';
|
|
2
|
+
import { Page } from 'puppeteer';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The methods provided by the Puppeteer plugin.
|
|
6
|
+
*/
|
|
7
|
+
interface PuppeteerPluginMethods {
|
|
8
|
+
/**
|
|
9
|
+
* Get the window information for a Puppeteer Page instance.
|
|
10
|
+
* @param page The Puppeteer Page instance to get window information for.
|
|
11
|
+
* @param options Configuration options for the window info request.
|
|
12
|
+
* @param requestOptions Additional options to customize the request behavior.
|
|
13
|
+
*/
|
|
14
|
+
getWindowForPuppeteerPage(page: Page, options?: WindowGetConfig, requestOptions?: AirtopRequestOptions): Promise<AirtopWindow<AirtopWindowGetInfoResponse>>;
|
|
15
|
+
}
|
|
16
|
+
declare module "@airtop/sdk" {
|
|
17
|
+
interface AirtopSessionClient {
|
|
18
|
+
/**
|
|
19
|
+
* Get the window information for a Puppeteer Page instance.
|
|
20
|
+
* @param page The Puppeteer Page instance to get window information for.
|
|
21
|
+
* @param options Configuration options for the window info request.
|
|
22
|
+
* @param requestOptions Additional options to customize the request behavior.
|
|
23
|
+
*/
|
|
24
|
+
getWindowForPuppeteerPage(page: Page, options?: WindowGetConfig, requestOptions?: AirtopRequestOptions): Promise<AirtopWindow<AirtopWindowGetInfoResponse>>;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Use with registerAirtopPlugin() from the Airtop SDK to add the Puppeteer plugin.
|
|
29
|
+
*/
|
|
30
|
+
declare function puppeteerPlugin(): AirtopPluginRegistration;
|
|
31
|
+
|
|
32
|
+
export { type PuppeteerPluginMethods, puppeteerPlugin };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { AirtopPluginAugmentationType } from "@airtop/sdk";
|
|
3
|
+
var plugin = {
|
|
4
|
+
augmentationType: AirtopPluginAugmentationType.AirtopSessionClient,
|
|
5
|
+
augment: (prototype) => {
|
|
6
|
+
prototype.getWindowForPuppeteerPage = async function(page, options, requestOptions) {
|
|
7
|
+
const frameId = page.mainFrame()._id;
|
|
8
|
+
if (!frameId) {
|
|
9
|
+
throw new Error("Could not get frame ID from Puppeteer page");
|
|
10
|
+
}
|
|
11
|
+
return this.withWindowId(frameId).getWindowInfo(options, requestOptions);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
function puppeteerPlugin() {
|
|
16
|
+
return {
|
|
17
|
+
pluginsToAdd: [plugin]
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
puppeteerPlugin
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { AirtopPluginAugmentationType } from \"@airtop/sdk\";\nimport type { AirtopSessionClient, AirtopSessionClientPlugin } from \"@airtop/sdk\";\nimport type { AirtopRequestOptions } from \"@airtop/sdk\";\nimport type { AirtopWindow } from \"@airtop/sdk\";\nimport type { WindowGetConfig } from \"@airtop/sdk\";\nimport type { AirtopPluginRegistration } from \"@airtop/sdk\";\nimport type { AirtopWindowGetInfoResponse } from \"@airtop/sdk\";\nimport type { Page } from \"puppeteer\";\n\n// This is exported so the docs can expose it as we can't generate docs against the\n// module declaration\n/**\n * The methods provided by the Puppeteer plugin.\n */\nexport interface PuppeteerPluginMethods {\n /**\n * Get the window information for a Puppeteer Page instance.\n * @param page The Puppeteer Page instance to get window information for.\n * @param options Configuration options for the window info request.\n * @param requestOptions Additional options to customize the request behavior.\n */\n getWindowForPuppeteerPage(\n page: Page,\n options?: WindowGetConfig,\n requestOptions?: AirtopRequestOptions,\n ): Promise<AirtopWindow<AirtopWindowGetInfoResponse>>;\n}\n\ndeclare module \"@airtop/sdk\" {\n interface AirtopSessionClient {\n /**\n * Get the window information for a Puppeteer Page instance.\n * @param page The Puppeteer Page instance to get window information for.\n * @param options Configuration options for the window info request.\n * @param requestOptions Additional options to customize the request behavior.\n */\n getWindowForPuppeteerPage(\n page: Page,\n options?: WindowGetConfig,\n requestOptions?: AirtopRequestOptions,\n ): Promise<AirtopWindow<AirtopWindowGetInfoResponse>>;\n }\n}\n\nconst plugin: AirtopSessionClientPlugin = {\n augmentationType: AirtopPluginAugmentationType.AirtopSessionClient,\n augment: (prototype: typeof AirtopSessionClient.prototype) => {\n prototype.getWindowForPuppeteerPage = async function (\n page: Page,\n options?: WindowGetConfig,\n requestOptions?: AirtopRequestOptions,\n ) {\n const frameId = (page.mainFrame() as any)._id;\n\n if (!frameId) {\n throw new Error(\"Could not get frame ID from Puppeteer page\");\n }\n\n return this.withWindowId(frameId).getWindowInfo(options, requestOptions);\n };\n },\n};\n\n/**\n * Use with registerAirtopPlugin() from the Airtop SDK to add the Puppeteer plugin.\n */\nexport function puppeteerPlugin(): AirtopPluginRegistration {\n return {\n pluginsToAdd: [plugin],\n };\n}\n"],"mappings":";AAAA,SAAS,oCAAoC;AA4C7C,IAAM,SAAoC;AAAA,EACxC,kBAAkB,6BAA6B;AAAA,EAC/C,SAAS,CAAC,cAAoD;AAC5D,cAAU,4BAA4B,eACpC,MACA,SACA,gBACA;AACA,YAAM,UAAW,KAAK,UAAU,EAAU;AAE1C,UAAI,CAAC,SAAS;AACZ,cAAM,IAAI,MAAM,4CAA4C;AAAA,MAC9D;AAEA,aAAO,KAAK,aAAa,OAAO,EAAE,cAAc,SAAS,cAAc;AAAA,IACzE;AAAA,EACF;AACF;AAKO,SAAS,kBAA4C;AAC1D,SAAO;AAAA,IACL,cAAc,CAAC,MAAM;AAAA,EACvB;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@airtop/plugin-puppeteer",
|
|
3
|
+
"description": "Adds puppeteer support to the Airtop SDK",
|
|
4
|
+
"version": "1.0.0-alpha2.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
"import": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"require": {
|
|
14
|
+
"types": "./dist/index.d.cts",
|
|
15
|
+
"require": "./dist/index.cjs"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"repository": "airtop-ai/airtop-sdk.git",
|
|
21
|
+
"author": "Theo Gravity <theo@airtop.ai>",
|
|
22
|
+
"keywords": [
|
|
23
|
+
"airtop",
|
|
24
|
+
"puppeteer",
|
|
25
|
+
"plugin"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsup src/index.ts",
|
|
29
|
+
"test": "vitest --run",
|
|
30
|
+
"build:dev": "node_modules/.bin/hash-runner",
|
|
31
|
+
"clean": "rm -rf .turbo node_modules dist",
|
|
32
|
+
"lint": "biome check --write --unsafe src && biome format src --write && biome lint src --fix",
|
|
33
|
+
"verify-types": "tsc --noEmit"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@biomejs/biome": "1.9.4",
|
|
37
|
+
"@internal/tsconfig": "workspace:*",
|
|
38
|
+
"hash-runner": "2.0.1",
|
|
39
|
+
"tsup": "8.4.0",
|
|
40
|
+
"typescript": "5.8.2",
|
|
41
|
+
"vitest": "3.1.1"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@airtop/sdk": "workspace:*",
|
|
45
|
+
"puppeteer": ">=22.14.0"
|
|
46
|
+
},
|
|
47
|
+
"bugs": "https://github.com/airtop-ai/airtop-sdk/issues",
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=18"
|
|
50
|
+
},
|
|
51
|
+
"files": [
|
|
52
|
+
"dist"
|
|
53
|
+
],
|
|
54
|
+
"homepage": "https://airtop.ai",
|
|
55
|
+
"packageManager": "pnpm@10.5.0"
|
|
56
|
+
}
|