assistsx-js 0.0.2041 → 0.0.2042
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 +3 -3
- package/dist/Step.js +8 -8
- package/package.json +1 -1
- package/src/Step.ts +7 -8
package/dist/Step.d.ts
CHANGED
|
@@ -113,7 +113,7 @@ export declare class Step {
|
|
|
113
113
|
/**
|
|
114
114
|
* 步骤实现函数
|
|
115
115
|
*/
|
|
116
|
-
impl: StepImpl;
|
|
116
|
+
impl: StepImpl | undefined;
|
|
117
117
|
/**
|
|
118
118
|
* 构造函数
|
|
119
119
|
* @param stepId 步骤ID
|
|
@@ -124,7 +124,7 @@ export declare class Step {
|
|
|
124
124
|
*/
|
|
125
125
|
constructor({ stepId, impl, tag, data, delayMs, repeatCountMax, isEnd, }: {
|
|
126
126
|
stepId: string;
|
|
127
|
-
impl: StepImpl;
|
|
127
|
+
impl: StepImpl | undefined;
|
|
128
128
|
tag?: string | undefined;
|
|
129
129
|
data?: any | undefined;
|
|
130
130
|
delayMs?: number;
|
|
@@ -146,7 +146,7 @@ export declare class Step {
|
|
|
146
146
|
delayMs?: number;
|
|
147
147
|
repeatCountMax?: number;
|
|
148
148
|
}): Step;
|
|
149
|
-
end(
|
|
149
|
+
end({ tag, data, delayMs, repeatCountMax, }?: {
|
|
150
150
|
tag?: string | undefined;
|
|
151
151
|
data?: any | undefined;
|
|
152
152
|
delayMs?: number;
|
package/dist/Step.js
CHANGED
|
@@ -16,7 +16,7 @@ export class Step {
|
|
|
16
16
|
* @param delayMs 步骤延迟时间(毫秒)
|
|
17
17
|
*/
|
|
18
18
|
static async run(impl, { tag, data, delayMs = Step.delayMsDefault, } = {}) {
|
|
19
|
-
var _a;
|
|
19
|
+
var _a, _b, _c, _d, _e, _f;
|
|
20
20
|
const stepStore = useStepStore();
|
|
21
21
|
let implnName = impl.name;
|
|
22
22
|
let currentStep;
|
|
@@ -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: (
|
|
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(
|
|
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
package/src/Step.ts
CHANGED
|
@@ -79,7 +79,7 @@ export class Step {
|
|
|
79
79
|
Step.assert(currentStep.stepId);
|
|
80
80
|
}
|
|
81
81
|
//执行步骤
|
|
82
|
-
implnName = currentStep.impl
|
|
82
|
+
implnName = currentStep.impl?.name ?? "undefined";
|
|
83
83
|
if (Step.showLog) {
|
|
84
84
|
console.log(
|
|
85
85
|
`执行步骤${implnName},重复次数${currentStep.repeatCount}`
|
|
@@ -121,7 +121,7 @@ export class Step {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
// 打印拦截步骤的执行信息
|
|
124
|
-
const interceptedImplName = stepToExecute.impl
|
|
124
|
+
const interceptedImplName = stepToExecute.impl?.name;
|
|
125
125
|
if (Step.showLog) {
|
|
126
126
|
console.log(
|
|
127
127
|
`执行拦截步骤${interceptedImplName},重复次数${stepToExecute.repeatCount}`
|
|
@@ -129,9 +129,9 @@ export class Step {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
// 执行拦截后的步骤
|
|
132
|
-
nextStep = await stepToExecute.impl(stepToExecute);
|
|
132
|
+
nextStep = await stepToExecute.impl?.(stepToExecute);
|
|
133
133
|
} else {
|
|
134
|
-
nextStep = await currentStep.impl(currentStep);
|
|
134
|
+
nextStep = await currentStep.impl?.(currentStep);
|
|
135
135
|
}
|
|
136
136
|
if (
|
|
137
137
|
currentStep.repeatCountMax > Step.repeatCountInfinite &&
|
|
@@ -340,7 +340,7 @@ export class Step {
|
|
|
340
340
|
/**
|
|
341
341
|
* 步骤实现函数
|
|
342
342
|
*/
|
|
343
|
-
impl: StepImpl;
|
|
343
|
+
impl: StepImpl | undefined;
|
|
344
344
|
|
|
345
345
|
/**
|
|
346
346
|
* 构造函数
|
|
@@ -360,7 +360,7 @@ export class Step {
|
|
|
360
360
|
isEnd = false,
|
|
361
361
|
}: {
|
|
362
362
|
stepId: string;
|
|
363
|
-
impl: StepImpl;
|
|
363
|
+
impl: StepImpl | undefined;
|
|
364
364
|
tag?: string | undefined;
|
|
365
365
|
data?: any | undefined;
|
|
366
366
|
delayMs?: number;
|
|
@@ -412,7 +412,6 @@ export class Step {
|
|
|
412
412
|
});
|
|
413
413
|
}
|
|
414
414
|
end(
|
|
415
|
-
impl: StepImpl,
|
|
416
415
|
{
|
|
417
416
|
tag,
|
|
418
417
|
data,
|
|
@@ -428,7 +427,7 @@ export class Step {
|
|
|
428
427
|
Step.assert(this.stepId);
|
|
429
428
|
return new Step({
|
|
430
429
|
stepId: this.stepId,
|
|
431
|
-
impl,
|
|
430
|
+
impl: undefined,
|
|
432
431
|
tag,
|
|
433
432
|
data: data ?? this.data,
|
|
434
433
|
delayMs,
|