@vnejs/plugins.vars.counters 0.1.10 → 0.1.11

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.
@@ -1,6 +1,6 @@
1
1
  import { Module } from "@vnejs/module";
2
- import type { CountersPluginConstants, CountersPluginEvents, CountersPluginParams, CountersPluginSettings } from "../types.js";
3
2
  import type { LineExecHandlerArg } from "@vnejs/plugins.core.scenario.contract";
3
+ import type { CountersPluginConstants, CountersPluginEvents, CountersPluginParams, CountersPluginSettings } from "../types.js";
4
4
  export declare class CountersExec extends Module<CountersPluginEvents, CountersPluginConstants, CountersPluginSettings, CountersPluginParams> {
5
5
  name: string;
6
6
  init: () => Promise<[unknown[] | undefined, unknown[] | undefined]>;
@@ -6,7 +6,8 @@ export class CountersExec extends Module {
6
6
  this.emit(this.EVENTS.SCENARIO.LINE_EXEC_REG, { module: this.CONST.VARS_COUNTERS.EXEC_NAME, handler: this.onLineExecModule }),
7
7
  ]);
8
8
  onLineExecModule = async ({ line = "", keywords = [] } = {}) => {
9
- const { name = "", action = "", execValue = 0, value = 0, isGlobal = false } = (await this.emitOne(this.EVENTS.VARS_COUNTERS.EXEC_INFO, { line, keywords }));
9
+ const execInfo = (await this.emitOne(this.EVENTS.VARS_COUNTERS.EXEC_INFO, { line, keywords }));
10
+ const { name = "", action = "", execValue = 0, value = 0, isGlobal = false } = execInfo;
10
11
  const newValue = Number(await this.emitOne(this.EVENTS.VARS_COUNTERS.CHANGE, { value, execValue, action }));
11
12
  await this.emit(this.EVENTS.VARS_COUNTERS.SET, { name, isGlobal, value: newValue });
12
13
  this.emit(this.EVENTS.SCENARIO.NEXT, { module: this.name });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.vars.counters",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,8 +1,9 @@
1
1
  import { Module } from "@vnejs/module";
2
2
 
3
+ import type { LineExecHandlerArg } from "@vnejs/plugins.core.scenario.contract";
4
+
3
5
  import type { CountersPluginConstants, CountersPluginEvents, CountersPluginParams, CountersPluginSettings } from "../types.js";
4
6
  import type { CountersExecInfoResult, CountersSetPayload } from "../utils/counters.js";
5
- import type { LineExecHandlerArg } from "@vnejs/plugins.core.scenario.contract";
6
7
 
7
8
  export class CountersExec extends Module<CountersPluginEvents, CountersPluginConstants, CountersPluginSettings, CountersPluginParams> {
8
9
  name = "vars.counters.exec";
@@ -14,7 +15,8 @@ export class CountersExec extends Module<CountersPluginEvents, CountersPluginCon
14
15
  ]);
15
16
 
16
17
  onLineExecModule = async ({ line = "", keywords = [] }: LineExecHandlerArg = {}) => {
17
- const { name = "", action = "", execValue = 0, value = 0, isGlobal = false } = (await this.emitOne(this.EVENTS.VARS_COUNTERS.EXEC_INFO, { line, keywords })) as CountersExecInfoResult;
18
+ const execInfo = (await this.emitOne(this.EVENTS.VARS_COUNTERS.EXEC_INFO, { line, keywords })) as CountersExecInfoResult;
19
+ const { name = "", action = "", execValue = 0, value = 0, isGlobal = false } = execInfo;
18
20
 
19
21
  const newValue = Number(await this.emitOne(this.EVENTS.VARS_COUNTERS.CHANGE, { value, execValue, action }));
20
22