@isdk/web-fetcher 0.2.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.
Files changed (66) hide show
  1. package/README.action.cn.md +469 -0
  2. package/README.action.md +452 -0
  3. package/README.cn.md +147 -0
  4. package/README.engine.cn.md +262 -0
  5. package/README.engine.md +262 -0
  6. package/README.md +147 -0
  7. package/dist/index.d.mts +1603 -0
  8. package/dist/index.d.ts +1603 -0
  9. package/dist/index.js +1 -0
  10. package/dist/index.mjs +1 -0
  11. package/docs/README.md +151 -0
  12. package/docs/_media/LICENSE-MIT +22 -0
  13. package/docs/_media/README.action.md +452 -0
  14. package/docs/_media/README.cn.md +147 -0
  15. package/docs/_media/README.engine.md +262 -0
  16. package/docs/classes/CheerioFetchEngine.md +1447 -0
  17. package/docs/classes/ClickAction.md +533 -0
  18. package/docs/classes/ExtractAction.md +533 -0
  19. package/docs/classes/FetchAction.md +444 -0
  20. package/docs/classes/FetchEngine.md +1230 -0
  21. package/docs/classes/FetchSession.md +111 -0
  22. package/docs/classes/FillAction.md +533 -0
  23. package/docs/classes/GetContentAction.md +533 -0
  24. package/docs/classes/GotoAction.md +537 -0
  25. package/docs/classes/PauseAction.md +533 -0
  26. package/docs/classes/PlaywrightFetchEngine.md +1437 -0
  27. package/docs/classes/SubmitAction.md +533 -0
  28. package/docs/classes/WaitForAction.md +533 -0
  29. package/docs/classes/WebFetcher.md +85 -0
  30. package/docs/enumerations/FetchActionResultStatus.md +40 -0
  31. package/docs/functions/fetchWeb.md +43 -0
  32. package/docs/globals.md +72 -0
  33. package/docs/interfaces/BaseFetchActionProperties.md +83 -0
  34. package/docs/interfaces/BaseFetchCollectorActionProperties.md +145 -0
  35. package/docs/interfaces/BaseFetcherProperties.md +206 -0
  36. package/docs/interfaces/Cookie.md +142 -0
  37. package/docs/interfaces/DispatchedEngineAction.md +60 -0
  38. package/docs/interfaces/ExtractActionProperties.md +113 -0
  39. package/docs/interfaces/FetchActionInContext.md +149 -0
  40. package/docs/interfaces/FetchActionProperties.md +125 -0
  41. package/docs/interfaces/FetchActionResult.md +55 -0
  42. package/docs/interfaces/FetchContext.md +424 -0
  43. package/docs/interfaces/FetchEngineContext.md +328 -0
  44. package/docs/interfaces/FetchMetadata.md +73 -0
  45. package/docs/interfaces/FetchResponse.md +105 -0
  46. package/docs/interfaces/FetchReturnTypeRegistry.md +57 -0
  47. package/docs/interfaces/FetchSite.md +320 -0
  48. package/docs/interfaces/FetcherOptions.md +300 -0
  49. package/docs/interfaces/GotoActionOptions.md +66 -0
  50. package/docs/interfaces/PendingEngineRequest.md +51 -0
  51. package/docs/interfaces/SubmitActionOptions.md +23 -0
  52. package/docs/interfaces/WaitForActionOptions.md +39 -0
  53. package/docs/type-aliases/BaseFetchActionOptions.md +11 -0
  54. package/docs/type-aliases/BaseFetchCollectorOptions.md +11 -0
  55. package/docs/type-aliases/BrowserEngine.md +11 -0
  56. package/docs/type-aliases/FetchActionCapabilities.md +11 -0
  57. package/docs/type-aliases/FetchActionCapabilityMode.md +11 -0
  58. package/docs/type-aliases/FetchActionOptions.md +11 -0
  59. package/docs/type-aliases/FetchEngineAction.md +18 -0
  60. package/docs/type-aliases/FetchEngineType.md +11 -0
  61. package/docs/type-aliases/FetchReturnType.md +11 -0
  62. package/docs/type-aliases/FetchReturnTypeFor.md +17 -0
  63. package/docs/type-aliases/OnFetchPauseCallback.md +23 -0
  64. package/docs/type-aliases/ResourceType.md +11 -0
  65. package/docs/variables/DefaultFetcherProperties.md +11 -0
  66. package/package.json +90 -0
@@ -0,0 +1,51 @@
1
+ [**@isdk/web-fetcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-fetcher](../globals.md) / PendingEngineRequest
6
+
7
+ # Interface: PendingEngineRequest
8
+
9
+ Defined in: [packages/web-fetcher/src/engine/base.ts:108](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/engine/base.ts#L108)
10
+
11
+ Represents a pending navigation request awaiting resolution.
12
+
13
+ ## Remarks
14
+
15
+ Tracks navigation requests that have been queued but not yet processed by the request handler.
16
+
17
+ ## Properties
18
+
19
+ ### reject()
20
+
21
+ > **reject**: (`reason?`) => `void`
22
+
23
+ Defined in: [packages/web-fetcher/src/engine/base.ts:110](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/engine/base.ts#L110)
24
+
25
+ #### Parameters
26
+
27
+ ##### reason?
28
+
29
+ `any`
30
+
31
+ #### Returns
32
+
33
+ `void`
34
+
35
+ ***
36
+
37
+ ### resolve()
38
+
39
+ > **resolve**: (`value`) => `void`
40
+
41
+ Defined in: [packages/web-fetcher/src/engine/base.ts:109](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/engine/base.ts#L109)
42
+
43
+ #### Parameters
44
+
45
+ ##### value
46
+
47
+ `any`
48
+
49
+ #### Returns
50
+
51
+ `void`
@@ -0,0 +1,23 @@
1
+ [**@isdk/web-fetcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-fetcher](../globals.md) / SubmitActionOptions
6
+
7
+ # Interface: SubmitActionOptions
8
+
9
+ Defined in: [packages/web-fetcher/src/engine/base.ts:67](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/engine/base.ts#L67)
10
+
11
+ Options for the [FetchEngine.submit](../classes/FetchEngine.md#submit) action, configuring form submission behavior.
12
+
13
+ ## Remarks
14
+
15
+ Specifies encoding type for form submissions, particularly relevant for JSON-based APIs.
16
+
17
+ ## Properties
18
+
19
+ ### enctype?
20
+
21
+ > `optional` **enctype**: `"application/x-www-form-urlencoded"` \| `"application/json"` \| `"multipart/form-data"`
22
+
23
+ Defined in: [packages/web-fetcher/src/engine/base.ts:68](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/engine/base.ts#L68)
@@ -0,0 +1,39 @@
1
+ [**@isdk/web-fetcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-fetcher](../globals.md) / WaitForActionOptions
6
+
7
+ # Interface: WaitForActionOptions
8
+
9
+ Defined in: [packages/web-fetcher/src/engine/base.ts:55](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/engine/base.ts#L55)
10
+
11
+ Options for the [FetchEngine.waitFor](../classes/FetchEngine.md#waitfor) action, specifying conditions to wait for before continuing.
12
+
13
+ ## Remarks
14
+
15
+ Controls timing behavior for interactions, allowing waiting for elements, time intervals, or network conditions.
16
+
17
+ ## Properties
18
+
19
+ ### ms?
20
+
21
+ > `optional` **ms**: `number`
22
+
23
+ Defined in: [packages/web-fetcher/src/engine/base.ts:56](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/engine/base.ts#L56)
24
+
25
+ ***
26
+
27
+ ### networkIdle?
28
+
29
+ > `optional` **networkIdle**: `boolean`
30
+
31
+ Defined in: [packages/web-fetcher/src/engine/base.ts:58](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/engine/base.ts#L58)
32
+
33
+ ***
34
+
35
+ ### selector?
36
+
37
+ > `optional` **selector**: `string`
38
+
39
+ Defined in: [packages/web-fetcher/src/engine/base.ts:57](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/engine/base.ts#L57)
@@ -0,0 +1,11 @@
1
+ [**@isdk/web-fetcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-fetcher](../globals.md) / BaseFetchActionOptions
6
+
7
+ # Type Alias: BaseFetchActionOptions
8
+
9
+ > **BaseFetchActionOptions** = `RequireAtLeastOne`\<[`BaseFetchActionProperties`](../interfaces/BaseFetchActionProperties.md), `"id"` \| `"name"`\>
10
+
11
+ Defined in: [packages/web-fetcher/src/action/fetch-action.ts:59](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/action/fetch-action.ts#L59)
@@ -0,0 +1,11 @@
1
+ [**@isdk/web-fetcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-fetcher](../globals.md) / BaseFetchCollectorOptions
6
+
7
+ # Type Alias: BaseFetchCollectorOptions
8
+
9
+ > **BaseFetchCollectorOptions** = `RequireAtLeastOne`\<[`BaseFetchCollectorActionProperties`](../interfaces/BaseFetchCollectorActionProperties.md), `"id"` \| `"name"`\>
10
+
11
+ Defined in: [packages/web-fetcher/src/action/fetch-action.ts:72](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/action/fetch-action.ts#L72)
@@ -0,0 +1,11 @@
1
+ [**@isdk/web-fetcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-fetcher](../globals.md) / BrowserEngine
6
+
7
+ # Type Alias: BrowserEngine
8
+
9
+ > **BrowserEngine** = `"playwright"` \| `"puppeteer"`
10
+
11
+ Defined in: [packages/web-fetcher/src/core/types.ts:21](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/core/types.ts#L21)
@@ -0,0 +1,11 @@
1
+ [**@isdk/web-fetcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-fetcher](../globals.md) / FetchActionCapabilities
6
+
7
+ # Type Alias: FetchActionCapabilities
8
+
9
+ > **FetchActionCapabilities** = `{ [mode in FetchEngineType]?: FetchActionCapabilityMode }`
10
+
11
+ Defined in: [packages/web-fetcher/src/action/fetch-action.ts:80](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/action/fetch-action.ts#L80)
@@ -0,0 +1,11 @@
1
+ [**@isdk/web-fetcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-fetcher](../globals.md) / FetchActionCapabilityMode
6
+
7
+ # Type Alias: FetchActionCapabilityMode
8
+
9
+ > **FetchActionCapabilityMode** = `"native"` \| `"simulate"` \| `"noop"`
10
+
11
+ Defined in: [packages/web-fetcher/src/action/fetch-action.ts:23](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/action/fetch-action.ts#L23)
@@ -0,0 +1,11 @@
1
+ [**@isdk/web-fetcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-fetcher](../globals.md) / FetchActionOptions
6
+
7
+ # Type Alias: FetchActionOptions
8
+
9
+ > **FetchActionOptions** = `RequireAtLeastOne`\<[`FetchActionProperties`](../interfaces/FetchActionProperties.md), `"id"` \| `"name"`\>
10
+
11
+ Defined in: [packages/web-fetcher/src/action/fetch-action.ts:78](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/action/fetch-action.ts#L78)
@@ -0,0 +1,18 @@
1
+ [**@isdk/web-fetcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-fetcher](../globals.md) / FetchEngineAction
6
+
7
+ # Type Alias: FetchEngineAction
8
+
9
+ > **FetchEngineAction** = \{ `selector`: `string`; `type`: `"click"`; \} \| \{ `selector`: `string`; `type`: `"fill"`; `value`: `string`; \} \| \{ `options?`: [`WaitForActionOptions`](../interfaces/WaitForActionOptions.md); `type`: `"waitFor"`; \} \| \{ `options?`: [`SubmitActionOptions`](../interfaces/SubmitActionOptions.md); `selector?`: `any`; `type`: `"submit"`; \} \| \{ `type`: `"getContent"`; \} \| \{ `opts?`: [`GotoActionOptions`](../interfaces/GotoActionOptions.md); `type`: `"navigate"`; `url`: `string`; \} \| \{ `schema`: `ExtractSchema`; `type`: `"extract"`; \} \| \{ `message?`: `string`; `type`: `"pause"`; \} \| \{ `type`: `"dispose"`; \}
10
+
11
+ Defined in: [packages/web-fetcher/src/engine/base.ts:78](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/engine/base.ts#L78)
12
+
13
+ Union type representing all possible engine actions that can be dispatched.
14
+
15
+ ## Remarks
16
+
17
+ Defines the command structure processed during page interactions. Each action type corresponds to
18
+ a specific user interaction or navigation command within the action loop architecture.
@@ -0,0 +1,11 @@
1
+ [**@isdk/web-fetcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-fetcher](../globals.md) / FetchEngineType
6
+
7
+ # Type Alias: FetchEngineType
8
+
9
+ > **FetchEngineType** = `"http"` \| `"browser"`
10
+
11
+ Defined in: [packages/web-fetcher/src/core/types.ts:20](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/core/types.ts#L20)
@@ -0,0 +1,11 @@
1
+ [**@isdk/web-fetcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-fetcher](../globals.md) / FetchReturnType
6
+
7
+ # Type Alias: FetchReturnType
8
+
9
+ > **FetchReturnType** = `"response"` \| `"context"` \| `"outputs"` \| `"any"` \| `"none"`
10
+
11
+ Defined in: [packages/web-fetcher/src/core/fetch-return-type.ts:5](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/core/fetch-return-type.ts#L5)
@@ -0,0 +1,17 @@
1
+ [**@isdk/web-fetcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-fetcher](../globals.md) / FetchReturnTypeFor
6
+
7
+ # Type Alias: FetchReturnTypeFor\<R\>
8
+
9
+ > **FetchReturnTypeFor**\<`R`\> = `R` *extends* keyof [`FetchReturnTypeRegistry`](../interfaces/FetchReturnTypeRegistry.md) ? [`FetchReturnTypeRegistry`](../interfaces/FetchReturnTypeRegistry.md)\[`R`\] : `never`
10
+
11
+ Defined in: [packages/web-fetcher/src/core/fetch-return-type.ts:22](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/core/fetch-return-type.ts#L22)
12
+
13
+ ## Type Parameters
14
+
15
+ ### R
16
+
17
+ `R` *extends* [`FetchReturnType`](FetchReturnType.md)
@@ -0,0 +1,23 @@
1
+ [**@isdk/web-fetcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-fetcher](../globals.md) / OnFetchPauseCallback
6
+
7
+ # Type Alias: OnFetchPauseCallback()
8
+
9
+ > **OnFetchPauseCallback** = (`options`) => `Promise`\<`void`\>
10
+
11
+ Defined in: [packages/web-fetcher/src/core/types.ts:90](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/core/types.ts#L90)
12
+
13
+ ## Parameters
14
+
15
+ ### options
16
+
17
+ #### message?
18
+
19
+ `string`
20
+
21
+ ## Returns
22
+
23
+ `Promise`\<`void`\>
@@ -0,0 +1,11 @@
1
+ [**@isdk/web-fetcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-fetcher](../globals.md) / ResourceType
6
+
7
+ # Type Alias: ResourceType
8
+
9
+ > **ResourceType** = `"image"` \| `"stylesheet"` \| `"font"` \| `"script"` \| `"media"` \| `string`
10
+
11
+ Defined in: [packages/web-fetcher/src/core/types.ts:24](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/core/types.ts#L24)
@@ -0,0 +1,11 @@
1
+ [**@isdk/web-fetcher**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/web-fetcher](../globals.md) / DefaultFetcherProperties
6
+
7
+ # Variable: DefaultFetcherProperties
8
+
9
+ > `const` **DefaultFetcherProperties**: [`BaseFetcherProperties`](../interfaces/BaseFetcherProperties.md)
10
+
11
+ Defined in: [packages/web-fetcher/src/core/types.ts:131](https://github.com/isdk/web-fetcher.js/blob/ef3a4e527bf3ca75213d55b02c017b9a30a036fd/src/core/types.ts#L131)
package/package.json ADDED
@@ -0,0 +1,90 @@
1
+ {
2
+ "name": "@isdk/web-fetcher",
3
+ "version": "0.2.0",
4
+ "author": "Riceball LEE <snowyu.lee@gmail.com>",
5
+ "homepage": "https://github.com/isdk/web-fetcher.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git://github.com/isdk/web-fetcher.js.git"
9
+ },
10
+ "main": "./dist/index.js",
11
+ "module": "./dist/index.mjs",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "require": "./dist/index.js",
16
+ "import": "./dist/index.mjs"
17
+ }
18
+ },
19
+ "dependencies": {
20
+ "@isdk/common-error": "^0.2.0",
21
+ "camoufox-js": "^0.7.0",
22
+ "cheerio": "^1.1.2",
23
+ "crawlee": "^3.15.1",
24
+ "events-ex": "^2.1.1",
25
+ "jsdom": "^27.0.0",
26
+ "lodash-es": "^4.17.21",
27
+ "playwright": "^1.56.0",
28
+ "util-ex": "^2.4.0"
29
+ },
30
+ "devDependencies": {
31
+ "@antfu/eslint-config": "^4.10.1",
32
+ "@fastify/formbody": "^8.0.2",
33
+ "@types/jest": "^29.5.14",
34
+ "@types/jsdom": "^27.0.0",
35
+ "@types/lodash-es": "^4.17.12",
36
+ "@typescript-eslint/eslint-plugin": "~8.41.0",
37
+ "eslint": "^9.34.0",
38
+ "eslint-config-prettier": "^10.1.8",
39
+ "eslint-plugin-tsdoc": "^0.4.0",
40
+ "fastify": "^5.6.1",
41
+ "prettier": "^3.6.2",
42
+ "terser": "^5.44.0",
43
+ "tsup": "^8.5.0",
44
+ "tsx": "^4.20.5",
45
+ "type-fest": "^4.41.0",
46
+ "typedoc": "^0.28.13",
47
+ "typedoc-plugin-markdown": "^4.8.1",
48
+ "typescript": "~5.7.3",
49
+ "vite": "^7.1.4",
50
+ "vite-tsconfig-paths": "^5.1.4",
51
+ "vitest": "^3.2.4",
52
+ "vitest-fetch-mock": "^0.4.5"
53
+ },
54
+ "files": [
55
+ "docs",
56
+ "dist"
57
+ ],
58
+ "keywords": [
59
+ "web",
60
+ "fetch",
61
+ "crawler",
62
+ "spiler",
63
+ "structure",
64
+ "data"
65
+ ],
66
+ "maintainers": [
67
+ "Riceball LEE <snowyu.lee@gmail.com>"
68
+ ],
69
+ "engines": {
70
+ "node": ">=20.11.1"
71
+ },
72
+ "types": "./dist/index.d.ts",
73
+ "scripts": {
74
+ "build-fast": "tsup",
75
+ "build": "pnpm run build-fast --dts-resolve --dts && pnpm run doc:md",
76
+ "clean": "rm -fr web docs dist",
77
+ "doc": "typedoc --plugin none --out web",
78
+ "doc:md": "typedoc --plugin typedoc-plugin-markdown --out docs",
79
+ "style": "pnpm run format:base -c && pnpm run lint",
80
+ "style:fix": "pnpm run format:fix && npm run lint:fix",
81
+ "format": "pnpm run format:base -c",
82
+ "format:base": "prettier \"src/**/*.{ts,tsx,js,jsx,css,scss,sass,less,md}\"",
83
+ "format:fix": "pnpm run format:base --write",
84
+ "lint": "eslint .",
85
+ "lint:fix": "pnpm run lint --fix",
86
+ "test": "vitest run",
87
+ "release": "pnpm run clean && pnpm run build && git add -f docs && git ci -m 'docs: update API docs' && pnpm dlx commit-and-tag-version -s",
88
+ "release.alpha": "pnpm run release -- --prerelease alpha"
89
+ }
90
+ }