@vnejs/plugins.vars.counters 0.1.16 → 0.1.18

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,9 +1,9 @@
1
- import { Module } from "@vnejs/module";
1
+ import { ModuleCore } from "@vnejs/module.core";
2
2
  import type { CountersPluginConstants, CountersPluginEvents, CountersPluginParams, CountersPluginSettings } from "../types.js";
3
3
  import type { CountersChangePayload, CountersComparePayload, CountersExecCheckPayload, CountersExecInfoPayload, CountersExecInfoResult, CountersGetPayload, CountersSetPayload } from "../utils/counters.js";
4
4
  type ChangeHandler = (oldValue?: number, value?: number) => number;
5
5
  type CompareHandler = (oldValue?: number, value?: number) => boolean;
6
- export declare class Counters extends Module<CountersPluginEvents, CountersPluginConstants, CountersPluginSettings, CountersPluginParams> {
6
+ export declare class Counters extends ModuleCore<CountersPluginEvents, CountersPluginConstants, CountersPluginSettings, CountersPluginParams> {
7
7
  name: string;
8
8
  varsChangeHandlers: Record<string, ChangeHandler>;
9
9
  varsCompareHandlers: Record<string, CompareHandler>;
@@ -1,6 +1,6 @@
1
- import { Module } from "@vnejs/module";
1
+ import { ModuleCore } from "@vnejs/module.core";
2
2
  import { tokenizeExecLine } from "@vnejs/helpers";
3
- export class Counters extends Module {
3
+ export class Counters extends ModuleCore {
4
4
  name = "vars.counters";
5
5
  varsChangeHandlers = {
6
6
  [this.CONST.VARS_COUNTERS.CHANGE_ACTIONS.SET]: (oldValue = 0, value = 0) => value,
@@ -1,7 +1,7 @@
1
- import { Module } from "@vnejs/module";
2
- import type { LineExecHandlerArg } from "@vnejs/plugins.core.scenario.contract";
1
+ import { ModuleCore } from "@vnejs/module.core";
2
+ import type { LineExecHandlerArg } from "@vnejs/module.core";
3
3
  import type { CountersPluginConstants, CountersPluginEvents, CountersPluginParams, CountersPluginSettings } from "../types.js";
4
- export declare class CountersExec extends Module<CountersPluginEvents, CountersPluginConstants, CountersPluginSettings, CountersPluginParams> {
4
+ export declare class CountersExec extends ModuleCore<CountersPluginEvents, CountersPluginConstants, CountersPluginSettings, CountersPluginParams> {
5
5
  name: string;
6
6
  init: () => Promise<[unknown[] | undefined, unknown[] | undefined]>;
7
7
  onLineExecModule: ({ line, keywords }?: LineExecHandlerArg) => Promise<void>;
@@ -1,5 +1,5 @@
1
- import { Module } from "@vnejs/module";
2
- export class CountersExec extends Module {
1
+ import { ModuleCore } from "@vnejs/module.core";
2
+ export class CountersExec extends ModuleCore {
3
3
  name = "vars.counters.exec";
4
4
  init = () => Promise.all([
5
5
  this.emit(this.EVENTS.SCENARIO.LINE_EXEC_REG, { block: this.CONST.VARS_COUNTERS.EXEC_NAME, handler: this.onLineExecBlock }),
@@ -10,12 +10,12 @@ export class CountersExec extends Module {
10
10
  const { name = "", action = "", execValue = 0, value = 0, isGlobal = false } = execInfo;
11
11
  const newValue = Number(await this.emitOne(this.EVENTS.VARS_COUNTERS.CHANGE, { value, execValue, action }));
12
12
  await this.emit(this.EVENTS.VARS_COUNTERS.SET, { name, isGlobal, value: newValue });
13
- this.emit(this.EVENTS.SCENARIO.NEXT, { module: this.name });
13
+ this.emitNext();
14
14
  };
15
15
  onLineExecBlock = async ({ line = "", keywords = [] } = {}) => {
16
16
  const { action = "", execValue = 0, value = 0 } = (await this.emitOne(this.EVENTS.VARS_COUNTERS.EXEC_INFO, { line, keywords }));
17
17
  const shouldGoInside = Boolean(await this.emitOne(this.EVENTS.VARS_COUNTERS.COMPARE, { value, execValue, action }));
18
18
  await this.emit(this.EVENTS.VARS.SCENARIO, { shouldGoInside });
19
- this.emit(this.EVENTS.SCENARIO.NEXT, { module: this.name });
19
+ this.emitNext();
20
20
  };
21
21
  }
package/dist/types.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- import type { VnePluginConstantsMapRegistry, VnePluginEventsMapRegistry, VnePluginParamsMapRegistry, VnePluginSettingsMapRegistry } from "@vnejs/shared";
2
- import type { Constants as ScenarioConstants, PluginName as ScenarioPluginName, SubscribeEvents as ScenarioSubscribeEvents } from "@vnejs/plugins.core.scenario.contract";
1
+ import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
3
2
  import type { PluginName as VarsPluginName, SubscribeEvents as VarsSubscribeEvents } from "@vnejs/plugins.vars.contract";
4
3
  import type { Constants, PluginName, SubscribeEvents } from "@vnejs/plugins.vars.counters.contract";
5
- export type CountersPluginEvents = VnePluginEventsMapRegistry & Record<PluginName, SubscribeEvents> & Record<VarsPluginName, VarsSubscribeEvents> & Record<ScenarioPluginName, ScenarioSubscribeEvents>;
6
- export type CountersPluginConstants = VnePluginConstantsMapRegistry & Record<PluginName, Constants> & Record<ScenarioPluginName, ScenarioConstants> & Record<VarsPluginName, VnePluginConstantsMapRegistry[VarsPluginName]>;
7
- export type CountersPluginSettings = VnePluginSettingsMapRegistry;
8
- export type CountersPluginParams = VnePluginParamsMapRegistry;
4
+ export type CountersPluginEvents = ModuleCoreEvents & Record<PluginName, SubscribeEvents> & Record<VarsPluginName, VarsSubscribeEvents>;
5
+ export type CountersPluginConstants = ModuleCoreConstants & Record<PluginName, Constants>;
6
+ export type CountersPluginSettings = ModuleCoreSettings;
7
+ export type CountersPluginParams = ModuleCoreParams;
@@ -1,4 +1,4 @@
1
- import type { ModuleGlobalStateRegistry } from "@vnejs/module";
1
+ import type { ModuleGlobalStateRegistry } from "@vnejs/module.core";
2
2
  import type { VarValue, VarsGetPayload } from "@vnejs/plugins.vars.contract";
3
3
  export type CountersSetPayload = {
4
4
  name?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.vars.counters",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -34,8 +34,7 @@
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@vnejs/helpers": "~0.1.0",
37
- "@vnejs/module": "~0.1.0",
38
- "@vnejs/plugins.core.scenario.contract": "~0.1.0",
37
+ "@vnejs/module.core": "~0.1.0",
39
38
  "@vnejs/plugins.vars.contract": "~0.1.0",
40
39
  "@vnejs/shared": "~0.1.0"
41
40
  },
@@ -1,4 +1,4 @@
1
- import { Module } from "@vnejs/module";
1
+ import { ModuleCore } from "@vnejs/module.core";
2
2
  import { tokenizeExecLine } from "@vnejs/helpers";
3
3
 
4
4
  import type { CountersPluginConstants, CountersPluginEvents, CountersPluginParams, CountersPluginSettings } from "../types.js";
@@ -16,7 +16,7 @@ import type {
16
16
  type ChangeHandler = (oldValue?: number, value?: number) => number;
17
17
  type CompareHandler = (oldValue?: number, value?: number) => boolean;
18
18
 
19
- export class Counters extends Module<CountersPluginEvents, CountersPluginConstants, CountersPluginSettings, CountersPluginParams> {
19
+ export class Counters extends ModuleCore<CountersPluginEvents, CountersPluginConstants, CountersPluginSettings, CountersPluginParams> {
20
20
  name = "vars.counters";
21
21
 
22
22
  varsChangeHandlers: Record<string, ChangeHandler> = {
@@ -1,11 +1,11 @@
1
- import { Module } from "@vnejs/module";
1
+ import { ModuleCore } from "@vnejs/module.core";
2
2
 
3
- import type { LineExecHandlerArg } from "@vnejs/plugins.core.scenario.contract";
3
+ import type { LineExecHandlerArg } from "@vnejs/module.core";
4
4
 
5
5
  import type { CountersPluginConstants, CountersPluginEvents, CountersPluginParams, CountersPluginSettings } from "../types.js";
6
6
  import type { CountersExecInfoResult, CountersSetPayload } from "../utils/counters.js";
7
7
 
8
- export class CountersExec extends Module<CountersPluginEvents, CountersPluginConstants, CountersPluginSettings, CountersPluginParams> {
8
+ export class CountersExec extends ModuleCore<CountersPluginEvents, CountersPluginConstants, CountersPluginSettings, CountersPluginParams> {
9
9
  name = "vars.counters.exec";
10
10
 
11
11
  init = () =>
@@ -22,7 +22,7 @@ export class CountersExec extends Module<CountersPluginEvents, CountersPluginCon
22
22
 
23
23
  await this.emit(this.EVENTS.VARS_COUNTERS.SET, { name, isGlobal, value: newValue } satisfies CountersSetPayload);
24
24
 
25
- this.emit(this.EVENTS.SCENARIO.NEXT, { module: this.name });
25
+ this.emitNext();
26
26
  };
27
27
 
28
28
  onLineExecBlock = async ({ line = "", keywords = [] }: LineExecHandlerArg = {}) => {
@@ -32,6 +32,6 @@ export class CountersExec extends Module<CountersPluginEvents, CountersPluginCon
32
32
 
33
33
  await this.emit(this.EVENTS.VARS.SCENARIO, { shouldGoInside });
34
34
 
35
- this.emit(this.EVENTS.SCENARIO.NEXT, { module: this.name });
35
+ this.emitNext();
36
36
  };
37
37
  }
package/src/types.ts CHANGED
@@ -1,18 +1,11 @@
1
- import type { VnePluginConstantsMapRegistry, VnePluginEventsMapRegistry, VnePluginParamsMapRegistry, VnePluginSettingsMapRegistry } from "@vnejs/shared";
2
- import type { Constants as ScenarioConstants, PluginName as ScenarioPluginName, SubscribeEvents as ScenarioSubscribeEvents } from "@vnejs/plugins.core.scenario.contract";
1
+ import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
3
2
  import type { PluginName as VarsPluginName, SubscribeEvents as VarsSubscribeEvents } from "@vnejs/plugins.vars.contract";
4
3
  import type { Constants, PluginName, SubscribeEvents } from "@vnejs/plugins.vars.counters.contract";
5
4
 
6
- export type CountersPluginEvents = VnePluginEventsMapRegistry &
7
- Record<PluginName, SubscribeEvents> &
8
- Record<VarsPluginName, VarsSubscribeEvents> &
9
- Record<ScenarioPluginName, ScenarioSubscribeEvents>;
5
+ export type CountersPluginEvents = ModuleCoreEvents & Record<PluginName, SubscribeEvents> & Record<VarsPluginName, VarsSubscribeEvents>;
10
6
 
11
- export type CountersPluginConstants = VnePluginConstantsMapRegistry &
12
- Record<PluginName, Constants> &
13
- Record<ScenarioPluginName, ScenarioConstants> &
14
- Record<VarsPluginName, VnePluginConstantsMapRegistry[VarsPluginName]>;
7
+ export type CountersPluginConstants = ModuleCoreConstants & Record<PluginName, Constants>;
15
8
 
16
- export type CountersPluginSettings = VnePluginSettingsMapRegistry;
9
+ export type CountersPluginSettings = ModuleCoreSettings;
17
10
 
18
- export type CountersPluginParams = VnePluginParamsMapRegistry;
11
+ export type CountersPluginParams = ModuleCoreParams;
@@ -1,4 +1,4 @@
1
- import type { ModuleGlobalStateRegistry } from "@vnejs/module";
1
+ import type { ModuleGlobalStateRegistry } from "@vnejs/module.core";
2
2
  import type { VarValue, VarsGetPayload } from "@vnejs/plugins.vars.contract";
3
3
 
4
4
  export type CountersSetPayload = {