assistsx-js 0.2.3 → 0.2.4
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 +14 -51
- package/dist/index.cjs +679 -145
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2001 -611
- package/dist/index.d.ts +2001 -611
- package/dist/index.global.js +2 -2
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +672 -145
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/assistsx-async.ts +33 -0
- package/src/assistsx.ts +33 -0
- package/src/call-method.ts +1 -0
- package/src/db/db-call-method.ts +11 -0
- package/src/db/db.ts +254 -0
- package/src/global.d.ts +8 -0
- package/src/index.ts +5 -0
- package/src/log/log-call-method.ts +3 -0
- package/src/log/log.ts +108 -23
- package/src/plugin-info.ts +70 -0
- package/src/screenshot/screenshot-call-method.ts +16 -0
- package/src/screenshot/screenshot.ts +200 -0
- package/src/window-flags.ts +21 -0
- package/dist/step-DnFA4DEb.d.mts +0 -1196
- package/dist/step-DnFA4DEb.d.ts +0 -1196
- package/dist/step-flow/index.cjs +0 -4367
- package/dist/step-flow/index.cjs.map +0 -1
- package/dist/step-flow/index.d.mts +0 -83
- package/dist/step-flow/index.d.ts +0 -83
- package/dist/step-flow/index.js +0 -4331
- package/dist/step-flow/index.js.map +0 -1
- package/src/step-flow/index.ts +0 -5
- package/src/step-flow/types.ts +0 -41
package/README.md
CHANGED
|
@@ -69,15 +69,20 @@
|
|
|
69
69
|
}
|
|
70
70
|
```
|
|
71
71
|
## 3. 编写脚本插件
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
|
|
73
|
+
简单点击(同步 API):
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
import { AssistsX } from "assistsx-js";
|
|
77
|
+
|
|
74
78
|
const handleClick = () => {
|
|
75
|
-
AssistsX.findById("com.tencent.mm:id/jha")[0]
|
|
76
|
-
}
|
|
79
|
+
AssistsX.findById("com.tencent.mm:id/jha")[0]?.click();
|
|
80
|
+
};
|
|
77
81
|
```
|
|
78
82
|
|
|
79
|
-
|
|
80
|
-
|
|
83
|
+
多步骤自动化(推荐)见 [step-basics.md](./docs/02-step-engine/step-basics.md)。
|
|
84
|
+
|
|
85
|
+
```vue
|
|
81
86
|
<button type="button" @click="handleClick">测试按钮</button>
|
|
82
87
|
```
|
|
83
88
|
|
|
@@ -108,53 +113,11 @@ export default defineConfig({
|
|
|
108
113
|
<br/>
|
|
109
114
|
|
|
110
115
|
|
|
111
|
-
**[
|
|
112
|
-
|
|
113
|
-
## StepFlow(流程编排,`assistsx-js/step-flow`)
|
|
114
|
-
|
|
115
|
-
在保留原有 `Step.run` / `StepImpl` 的前提下,提供基于**状态 + 事件 + on 转移表**的流程编排,适合非线性跳转、多流程共用同一步骤实现。
|
|
116
|
-
|
|
117
|
-
```ts
|
|
118
|
-
import { Step } from "assistsx-js";
|
|
119
|
-
import {
|
|
120
|
-
StepFlow,
|
|
121
|
-
flowEvent,
|
|
122
|
-
flowRepeat,
|
|
123
|
-
flowEnd,
|
|
124
|
-
createFlowDispatcher,
|
|
125
|
-
buildFlowInitialData,
|
|
126
|
-
createLaunchState,
|
|
127
|
-
} from "assistsx-js/step-flow";
|
|
128
|
-
|
|
129
|
-
// 1. 定义流程(launch 可衔接 legacy finishMethod)
|
|
130
|
-
const config = {
|
|
131
|
-
id: "my.flow",
|
|
132
|
-
initial: "launch",
|
|
133
|
-
states: {} as Record<string, import("assistsx-js/step-flow").FlowStateDef>,
|
|
134
|
-
data: { appName: "抖音", packageName: "com.ss.android.ugc.aweme" },
|
|
135
|
-
};
|
|
136
|
-
const dispatcher = createFlowDispatcher(config);
|
|
137
|
-
config.states = {
|
|
138
|
-
launch: createLaunchState(dispatcher, appLaunch.launch, "mainPage"),
|
|
139
|
-
mainPage: {
|
|
140
|
-
run: async (step) => (isHome(step) ? flowEvent("home") : flowRepeat()),
|
|
141
|
-
on: { home: "next", retry: "mainPage" },
|
|
142
|
-
},
|
|
143
|
-
next: { run: async () => flowEnd(), on: {} },
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
await Step.run(dispatcher, { data: buildFlowInitialData(config) });
|
|
147
|
-
// 或使用:await StepFlow.run(config); // 需在 config.states 填充后再 run,见 createLaunchState 文档
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
要点:
|
|
116
|
+
**[完整开发文档](./docs/README.md)**(推荐,含 Step、子模块、生产模式与 AI 协作指南)
|
|
151
117
|
|
|
152
|
-
-
|
|
153
|
-
- **跳转**由当前状态的 `on` 表决定;同一 `run` 可在不同 Flow 中配置不同的 `on`。
|
|
154
|
-
- **业务数据**建议放在 `step.data.payload`;`getFlowPayload` / `assignFlowPayload` 可读写。
|
|
155
|
-
- **与 legacy 共存**:`import { Step } from "assistsx-js"` 不变;StepFlow 从 `assistsx-js/step-flow` 单独导入。
|
|
118
|
+
**[API开发文档(兼容)](https://github.com/ven-coder/assistsx-js/blob/main/README-DEV.md)**
|
|
156
119
|
|
|
157
|
-
|
|
120
|
+
> 复杂自动化请使用 `Step.run` + `StepImpl` 链,详见 [docs/02-step-engine/step-basics.md](./docs/02-step-engine/step-basics.md)。
|
|
158
121
|
|
|
159
122
|
## 示例
|
|
160
123
|
|