assistsx-js 0.0.2041 → 0.0.2043

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/dist/Step.d.ts CHANGED
@@ -23,7 +23,8 @@ export declare class Step {
23
23
  * @param data 步骤数据
24
24
  * @param delayMs 步骤延迟时间(毫秒)
25
25
  */
26
- static run(impl: StepImpl, { tag, data, delayMs, }?: {
26
+ static run(impl: StepImpl, { stepId, tag, data, delayMs, }?: {
27
+ stepId?: string | undefined;
27
28
  tag?: string | undefined;
28
29
  data?: any | undefined;
29
30
  delayMs?: number;
@@ -113,7 +114,7 @@ export declare class Step {
113
114
  /**
114
115
  * 步骤实现函数
115
116
  */
116
- impl: StepImpl;
117
+ impl: StepImpl | undefined;
117
118
  /**
118
119
  * 构造函数
119
120
  * @param stepId 步骤ID
@@ -124,7 +125,7 @@ export declare class Step {
124
125
  */
125
126
  constructor({ stepId, impl, tag, data, delayMs, repeatCountMax, isEnd, }: {
126
127
  stepId: string;
127
- impl: StepImpl;
128
+ impl: StepImpl | undefined;
128
129
  tag?: string | undefined;
129
130
  data?: any | undefined;
130
131
  delayMs?: number;
@@ -146,7 +147,7 @@ export declare class Step {
146
147
  delayMs?: number;
147
148
  repeatCountMax?: number;
148
149
  }): Step;
149
- end(impl: StepImpl, { tag, data, delayMs, repeatCountMax, }?: {
150
+ end({ tag, data, delayMs, repeatCountMax, }?: {
150
151
  tag?: string | undefined;
151
152
  data?: any | undefined;
152
153
  delayMs?: number;
package/dist/Step.js CHANGED
@@ -15,15 +15,15 @@ export class Step {
15
15
  * @param data 步骤数据
16
16
  * @param delayMs 步骤延迟时间(毫秒)
17
17
  */
18
- static async run(impl, { tag, data, delayMs = Step.delayMsDefault, } = {}) {
19
- var _a;
18
+ static async run(impl, { stepId, tag, data, delayMs = Step.delayMsDefault, } = {}) {
19
+ var _a, _b, _c, _d, _e, _f;
20
20
  const stepStore = useStepStore();
21
21
  let implnName = impl.name;
22
22
  let currentStep;
23
23
  let nextStep;
24
24
  try {
25
25
  //步骤开始
26
- this._stepId = generateUUID();
26
+ this._stepId = stepId !== null && stepId !== void 0 ? stepId : generateUUID();
27
27
  stepStore.startStep(this._stepId, tag, data);
28
28
  currentStep = new Step({
29
29
  stepId: this._stepId,
@@ -41,7 +41,7 @@ export class Step {
41
41
  Step.assert(currentStep.stepId);
42
42
  }
43
43
  //执行步骤
44
- implnName = currentStep.impl.name;
44
+ implnName = (_b = (_a = currentStep.impl) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "undefined";
45
45
  if (Step.showLog) {
46
46
  console.log(`执行步骤${implnName},重复次数${currentStep.repeatCount}`);
47
47
  }
@@ -78,15 +78,15 @@ export class Step {
78
78
  Step.assert(stepToExecute.stepId);
79
79
  }
80
80
  // 打印拦截步骤的执行信息
81
- const interceptedImplName = stepToExecute.impl.name;
81
+ const interceptedImplName = (_c = stepToExecute.impl) === null || _c === void 0 ? void 0 : _c.name;
82
82
  if (Step.showLog) {
83
83
  console.log(`执行拦截步骤${interceptedImplName},重复次数${stepToExecute.repeatCount}`);
84
84
  }
85
85
  // 执行拦截后的步骤
86
- nextStep = await stepToExecute.impl(stepToExecute);
86
+ nextStep = await ((_d = stepToExecute.impl) === null || _d === void 0 ? void 0 : _d.call(stepToExecute, stepToExecute));
87
87
  }
88
88
  else {
89
- nextStep = await currentStep.impl(currentStep);
89
+ nextStep = await ((_e = currentStep.impl) === null || _e === void 0 ? void 0 : _e.call(currentStep, currentStep));
90
90
  }
91
91
  if (currentStep.repeatCountMax > Step.repeatCountInfinite &&
92
92
  currentStep.repeatCount > currentStep.repeatCountMax) {
@@ -117,7 +117,7 @@ export class Step {
117
117
  impl: implnName,
118
118
  tag: tag,
119
119
  data: data,
120
- error: (_a = e === null || e === void 0 ? void 0 : e.message) !== null && _a !== void 0 ? _a : String(e),
120
+ error: (_f = e === null || e === void 0 ? void 0 : e.message) !== null && _f !== void 0 ? _f : String(e),
121
121
  });
122
122
  stepStore.setError(errorMsg);
123
123
  throw new StepError(errorMsg, implnName, tag, data, e, currentStep || undefined);
@@ -293,11 +293,11 @@ export class Step {
293
293
  repeatCountMax,
294
294
  });
295
295
  }
296
- end(impl, { tag, data, delayMs = Step.delayMsDefault, repeatCountMax = Step.repeatCountMaxDefault, } = {}) {
296
+ end({ tag, data, delayMs = Step.delayMsDefault, repeatCountMax = Step.repeatCountMaxDefault, } = {}) {
297
297
  Step.assert(this.stepId);
298
298
  return new Step({
299
299
  stepId: this.stepId,
300
- impl,
300
+ impl: undefined,
301
301
  tag,
302
302
  data: data !== null && data !== void 0 ? data : this.data,
303
303
  delayMs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistsx-js",
3
- "version": "0.0.2041",
3
+ "version": "0.0.2043",
4
4
  "description": "assistsx-js自动化开发SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/src/Step.ts CHANGED
@@ -45,10 +45,12 @@ export class Step {
45
45
  static async run(
46
46
  impl: StepImpl,
47
47
  {
48
+ stepId,
48
49
  tag,
49
50
  data,
50
51
  delayMs = Step.delayMsDefault,
51
52
  }: {
53
+ stepId?: string | undefined;
52
54
  tag?: string | undefined;
53
55
  data?: any | undefined;
54
56
  delayMs?: number;
@@ -60,7 +62,7 @@ export class Step {
60
62
  let nextStep: Step | undefined;
61
63
  try {
62
64
  //步骤开始
63
- this._stepId = generateUUID();
65
+ this._stepId = stepId ?? generateUUID();
64
66
 
65
67
  stepStore.startStep(this._stepId, tag, data);
66
68
  currentStep = new Step({
@@ -79,7 +81,7 @@ export class Step {
79
81
  Step.assert(currentStep.stepId);
80
82
  }
81
83
  //执行步骤
82
- implnName = currentStep.impl.name;
84
+ implnName = currentStep.impl?.name ?? "undefined";
83
85
  if (Step.showLog) {
84
86
  console.log(
85
87
  `执行步骤${implnName},重复次数${currentStep.repeatCount}`
@@ -121,7 +123,7 @@ export class Step {
121
123
  }
122
124
 
123
125
  // 打印拦截步骤的执行信息
124
- const interceptedImplName = stepToExecute.impl.name;
126
+ const interceptedImplName = stepToExecute.impl?.name;
125
127
  if (Step.showLog) {
126
128
  console.log(
127
129
  `执行拦截步骤${interceptedImplName},重复次数${stepToExecute.repeatCount}`
@@ -129,9 +131,9 @@ export class Step {
129
131
  }
130
132
 
131
133
  // 执行拦截后的步骤
132
- nextStep = await stepToExecute.impl(stepToExecute);
134
+ nextStep = await stepToExecute.impl?.(stepToExecute);
133
135
  } else {
134
- nextStep = await currentStep.impl(currentStep);
136
+ nextStep = await currentStep.impl?.(currentStep);
135
137
  }
136
138
  if (
137
139
  currentStep.repeatCountMax > Step.repeatCountInfinite &&
@@ -340,7 +342,7 @@ export class Step {
340
342
  /**
341
343
  * 步骤实现函数
342
344
  */
343
- impl: StepImpl;
345
+ impl: StepImpl | undefined;
344
346
 
345
347
  /**
346
348
  * 构造函数
@@ -360,7 +362,7 @@ export class Step {
360
362
  isEnd = false,
361
363
  }: {
362
364
  stepId: string;
363
- impl: StepImpl;
365
+ impl: StepImpl | undefined;
364
366
  tag?: string | undefined;
365
367
  data?: any | undefined;
366
368
  delayMs?: number;
@@ -412,7 +414,6 @@ export class Step {
412
414
  });
413
415
  }
414
416
  end(
415
- impl: StepImpl,
416
417
  {
417
418
  tag,
418
419
  data,
@@ -428,7 +429,7 @@ export class Step {
428
429
  Step.assert(this.stepId);
429
430
  return new Step({
430
431
  stepId: this.stepId,
431
- impl,
432
+ impl: undefined,
432
433
  tag,
433
434
  data: data ?? this.data,
434
435
  delayMs,