@spotterjs/node 0.1.0 → 1.0.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/README.md +28 -50
- package/index.d.ts +13 -8
- package/index.js +2 -1
- package/package.json +5 -2
- package/index.win32-x64-msvc.node +0 -0
package/README.md
CHANGED
|
@@ -1,50 +1,28 @@
|
|
|
1
|
-
# @spotterjs/node
|
|
2
|
-
|
|
3
|
-
spotterjs
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
| Accessibility | `accessibilityEnable`, `accessibilityFind`, `accessibilityInvoke`, … |
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Platforms (prebuilt on publish): `x86_64-pc-windows-msvc`, `x86_64-unknown-linux-gnu`.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Prefer [`@spotterjs/core`](../../packages/core) (`screen`, `mouse`, `windowApi`, …) over calling this package directly.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
See [docs/MATCHING.md](../../docs/MATCHING.md) for template matching usage.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
## License
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
See [LICENSE](../../LICENSE).
|
|
50
|
-
|
|
1
|
+
# @spotterjs/node
|
|
2
|
+
|
|
3
|
+
Node.js native addon (napi-rs) for spotterjs. TypeScript definitions are auto-generated (`index.d.ts` via `npm run build`).
|
|
4
|
+
|
|
5
|
+
## Capabilities
|
|
6
|
+
|
|
7
|
+
| Area | N-API examples |
|
|
8
|
+
|------|----------------|
|
|
9
|
+
| Screen | `getScreenSize`, `captureScreen`, `captureWindow` |
|
|
10
|
+
| Match | `findTemplate(path, needleBuffer?, opts?)`, `findAllTemplates`, `waitForTemplate`, `findTemplateBuffers` |
|
|
11
|
+
| Window match | `findTemplateInWindow`, `findAllTemplatesInWindow` (optional `needleBuffer`) |
|
|
12
|
+
| Window | `listWindows`, `getActiveWindow`, `focusWindow`, `moveWindow`, `resizeWindow` |
|
|
13
|
+
| Desktop apps | `listDesktopApps`, `findDesktopApps`, `findWindowsByTitle`, `waitForWindowByTitle` |
|
|
14
|
+
| Input | `mouseMove`, `mouseClick`, `setMouseConfig`, `keyboardTypeText`, `clipboardGet` |
|
|
15
|
+
| Accessibility | `accessibilityEnable`, `accessibilityFind`, `accessibilityInvoke` |
|
|
16
|
+
|
|
17
|
+
Platform binaries are installed through optional npm packages:
|
|
18
|
+
|
|
19
|
+
- `@spotterjs/node-win32-x64-msvc`
|
|
20
|
+
- `@spotterjs/node-linux-x64-gnu`
|
|
21
|
+
|
|
22
|
+
Prefer [`@spotterjs/core`](../../packages/core) (`screen`, `mouse`, `windowApi`) over calling this package directly.
|
|
23
|
+
|
|
24
|
+
See [docs/MATCHING.md](../../docs/MATCHING.md) for template matching usage.
|
|
25
|
+
|
|
26
|
+
## License
|
|
27
|
+
|
|
28
|
+
See [LICENSE](../../LICENSE).
|
package/index.d.ts
CHANGED
|
@@ -9,6 +9,10 @@ export interface JsRegion {
|
|
|
9
9
|
width: number
|
|
10
10
|
height: number
|
|
11
11
|
}
|
|
12
|
+
export interface JsMatchResult {
|
|
13
|
+
region: JsRegion
|
|
14
|
+
score: number
|
|
15
|
+
}
|
|
12
16
|
export interface JsCaptureImage {
|
|
13
17
|
data: Buffer
|
|
14
18
|
width: number
|
|
@@ -66,6 +70,7 @@ export interface JsImageSize {
|
|
|
66
70
|
height: number
|
|
67
71
|
}
|
|
68
72
|
export declare function loadImageFromPath(path: string): JsCaptureImage
|
|
73
|
+
export declare function loadImageFromBuffer(bytes: Buffer): JsCaptureImage
|
|
69
74
|
export declare function getImageSize(path: string): JsImageSize
|
|
70
75
|
export declare function encodeCapturePng(capture: JsCaptureImage): Buffer
|
|
71
76
|
export declare function encodeCapturePngBase64(capture: JsCaptureImage): string
|
|
@@ -84,14 +89,14 @@ export declare function findDesktopApps(substring: string): Array<JsDesktopApp>
|
|
|
84
89
|
export declare function findWindowsByTitle(substring: string): Array<JsWindowInfo>
|
|
85
90
|
export declare function waitForWindowByTitle(substring: string, timeoutMs: number, pollMs?: number | undefined | null): JsWindowInfo
|
|
86
91
|
export declare function getForegroundApp(): JsDesktopApp
|
|
87
|
-
export declare function findTemplate(path: string, needleBuffer?: Buffer | undefined | null, opts?: JsMatchOptions | undefined | null):
|
|
88
|
-
export declare function findAllTemplates(path: string, needleBuffer?: Buffer | undefined | null, opts?: JsMatchOptions | undefined | null): Array<
|
|
89
|
-
export declare function findTemplateInWindow(id: string, path: string, needleBuffer?: Buffer | undefined | null, opts?: JsMatchOptions | undefined | null):
|
|
90
|
-
export declare function findAllTemplatesInWindow(id: string, path: string, needleBuffer?: Buffer | undefined | null, opts?: JsMatchOptions | undefined | null): Array<
|
|
91
|
-
export declare function waitForTemplate(path: string, needleBuffer: Buffer | undefined | null, timeoutMs: number, opts?: JsMatchOptions | undefined | null, intervalMs?: number | undefined | null):
|
|
92
|
-
export declare function findTemplateBuffers(haystack: JsCaptureImage, needle: JsCaptureImage, opts?: JsMatchOptions | undefined | null):
|
|
93
|
-
export declare function findAllTemplateBuffers(haystack: JsCaptureImage, needle: JsCaptureImage, opts?: JsMatchOptions | undefined | null): Array<
|
|
94
|
-
export declare function waitForTemplateBuffers(haystack: JsCaptureImage, needle: JsCaptureImage, timeoutMs: number, opts?: JsMatchOptions | undefined | null, intervalMs?: number | undefined | null):
|
|
92
|
+
export declare function findTemplate(path: string, needleBuffer?: Buffer | undefined | null, opts?: JsMatchOptions | undefined | null): JsMatchResult
|
|
93
|
+
export declare function findAllTemplates(path: string, needleBuffer?: Buffer | undefined | null, opts?: JsMatchOptions | undefined | null): Array<JsMatchResult>
|
|
94
|
+
export declare function findTemplateInWindow(id: string, path: string, needleBuffer?: Buffer | undefined | null, opts?: JsMatchOptions | undefined | null): JsMatchResult
|
|
95
|
+
export declare function findAllTemplatesInWindow(id: string, path: string, needleBuffer?: Buffer | undefined | null, opts?: JsMatchOptions | undefined | null): Array<JsMatchResult>
|
|
96
|
+
export declare function waitForTemplate(path: string, needleBuffer: Buffer | undefined | null, timeoutMs: number, opts?: JsMatchOptions | undefined | null, intervalMs?: number | undefined | null): JsMatchResult
|
|
97
|
+
export declare function findTemplateBuffers(haystack: JsCaptureImage, needle: JsCaptureImage, opts?: JsMatchOptions | undefined | null): JsMatchResult
|
|
98
|
+
export declare function findAllTemplateBuffers(haystack: JsCaptureImage, needle: JsCaptureImage, opts?: JsMatchOptions | undefined | null): Array<JsMatchResult>
|
|
99
|
+
export declare function waitForTemplateBuffers(haystack: JsCaptureImage, needle: JsCaptureImage, timeoutMs: number, opts?: JsMatchOptions | undefined | null, intervalMs?: number | undefined | null): JsMatchResult
|
|
95
100
|
export declare function setMouseConfig(config: JsMouseConfig): void
|
|
96
101
|
export declare function getPosition(): JsPoint
|
|
97
102
|
export declare function mouseMove(x: number, y: number): void
|
package/index.js
CHANGED
|
@@ -310,7 +310,7 @@ if (!nativeBinding) {
|
|
|
310
310
|
throw new Error(`Failed to load native binding`)
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
const { version, getScreenSize, getScreenWidth, getScreenHeight, captureScreen, captureWindow, loadImageFromPath, getImageSize, encodeCapturePng, encodeCapturePngBase64, listWindows, getActiveWindow, focusWindow, getWindowRegion, getWindowRegionClamped, getWindowClientOrigin, moveWindow, resizeWindow, minimizeWindow, restoreWindow, listDesktopApps, findDesktopApps, findWindowsByTitle, waitForWindowByTitle, getForegroundApp, findTemplate, findAllTemplates, findTemplateInWindow, findAllTemplatesInWindow, waitForTemplate, findTemplateBuffers, findAllTemplateBuffers, waitForTemplateBuffers, setMouseConfig, getPosition, mouseMove, mouseMovePath, mouseMoveStraight, mouseClick, mouseDoubleClick, mousePress, mouseRelease, mouseDrag, mouseScrollUp, mouseScrollDown, mouseScrollLeft, mouseScrollRight, tapAt, setKeyboardConfig, keyboardTypeText, keyboardPressKeys, keyboardReleaseKeys, keyboardTypeKey, keyboardShortcut, clipboardSet, clipboardGet, accessibilityEnable, accessibilityDisable, accessibilityIsEnabled, accessibilityAttachWindow, accessibilityAttachWindowReport, accessibilityAttachActive, accessibilityFind, accessibilityWaitFor, accessibilityGetBounds, accessibilityInvoke, accessibilitySetValue, accessibilityDumpTree, accessibilityDumpTreeObject, accessibilityGetElementInfo, accessibilityRefreshRoot, accessibilityTreeHealth, accessibilityCheckTreeHealth } = nativeBinding
|
|
313
|
+
const { version, getScreenSize, getScreenWidth, getScreenHeight, captureScreen, captureWindow, loadImageFromPath, loadImageFromBuffer, getImageSize, encodeCapturePng, encodeCapturePngBase64, listWindows, getActiveWindow, focusWindow, getWindowRegion, getWindowRegionClamped, getWindowClientOrigin, moveWindow, resizeWindow, minimizeWindow, restoreWindow, listDesktopApps, findDesktopApps, findWindowsByTitle, waitForWindowByTitle, getForegroundApp, findTemplate, findAllTemplates, findTemplateInWindow, findAllTemplatesInWindow, waitForTemplate, findTemplateBuffers, findAllTemplateBuffers, waitForTemplateBuffers, setMouseConfig, getPosition, mouseMove, mouseMovePath, mouseMoveStraight, mouseClick, mouseDoubleClick, mousePress, mouseRelease, mouseDrag, mouseScrollUp, mouseScrollDown, mouseScrollLeft, mouseScrollRight, tapAt, setKeyboardConfig, keyboardTypeText, keyboardPressKeys, keyboardReleaseKeys, keyboardTypeKey, keyboardShortcut, clipboardSet, clipboardGet, accessibilityEnable, accessibilityDisable, accessibilityIsEnabled, accessibilityAttachWindow, accessibilityAttachWindowReport, accessibilityAttachActive, accessibilityFind, accessibilityWaitFor, accessibilityGetBounds, accessibilityInvoke, accessibilitySetValue, accessibilityDumpTree, accessibilityDumpTreeObject, accessibilityGetElementInfo, accessibilityRefreshRoot, accessibilityTreeHealth, accessibilityCheckTreeHealth } = nativeBinding
|
|
314
314
|
|
|
315
315
|
module.exports.version = version
|
|
316
316
|
module.exports.getScreenSize = getScreenSize
|
|
@@ -319,6 +319,7 @@ module.exports.getScreenHeight = getScreenHeight
|
|
|
319
319
|
module.exports.captureScreen = captureScreen
|
|
320
320
|
module.exports.captureWindow = captureWindow
|
|
321
321
|
module.exports.loadImageFromPath = loadImageFromPath
|
|
322
|
+
module.exports.loadImageFromBuffer = loadImageFromBuffer
|
|
322
323
|
module.exports.getImageSize = getImageSize
|
|
323
324
|
module.exports.encodeCapturePng = encodeCapturePng
|
|
324
325
|
module.exports.encodeCapturePngBase64 = encodeCapturePngBase64
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spotterjs/node",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "spotterjs desktop automation for Node.js",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"files": [
|
|
22
22
|
"index.js",
|
|
23
23
|
"index.d.ts",
|
|
24
|
-
"index.*.node",
|
|
25
24
|
"LICENSE",
|
|
26
25
|
"README.md"
|
|
27
26
|
],
|
|
@@ -43,5 +42,9 @@
|
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
44
|
"@napi-rs/cli": "^2.18.0"
|
|
45
|
+
},
|
|
46
|
+
"optionalDependencies": {
|
|
47
|
+
"@spotterjs/node-win32-x64-msvc": "1.0.0",
|
|
48
|
+
"@spotterjs/node-linux-x64-gnu": "1.0.0"
|
|
46
49
|
}
|
|
47
50
|
}
|
|
Binary file
|