@vnejs/plugins.scenario.random 0.1.11 → 0.1.13

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
- import { Module } from "@vnejs/module";
1
+ import { ModuleCore } from "@vnejs/module.core";
2
2
  import type { RandomPluginConstants, RandomPluginEvents, RandomPluginParams, RandomPluginSettings } from "../types.js";
3
- export declare class Random extends Module<RandomPluginEvents, RandomPluginConstants, RandomPluginSettings, RandomPluginParams> {
3
+ export declare class Random extends ModuleCore<RandomPluginEvents, RandomPluginConstants, RandomPluginSettings, RandomPluginParams> {
4
4
  name: string;
5
5
  init: () => Promise<unknown[]> | undefined;
6
6
  onLineExec: () => Promise<void>;
@@ -1,5 +1,5 @@
1
- import { Module } from "@vnejs/module";
2
- export class Random extends Module {
1
+ import { ModuleCore } from "@vnejs/module.core";
2
+ export class Random extends ModuleCore {
3
3
  name = "random";
4
4
  init = () => this.emit(this.EVENTS.SCENARIO.LINE_EXEC_REG, { block: this.name, handler: this.onLineExec });
5
5
  onLineExec = async () => {
@@ -17,6 +17,6 @@ export class Random extends Module {
17
17
  const index = Math.floor(Math.random() * options.length);
18
18
  this.emit(this.EVENTS.LOGS.EMIT, { module: this.name, value: { type: "option", index, curLine: options[index] + 1 } });
19
19
  this.globalState.scenario.curLine = options[index] + 1;
20
- this.emit(this.EVENTS.SCENARIO.NEXT, { module: this.name });
20
+ this.emitNext();
21
21
  };
22
22
  }
package/dist/types.d.ts CHANGED
@@ -1,7 +1,5 @@
1
- import type { VnePluginConstantsMapRegistry, VnePluginEventsMapRegistry, VnePluginParamsMapRegistry, VnePluginSettingsMapRegistry } from "@vnejs/shared";
2
- import type { PluginName as LogsPluginName, SubscribeEvents as LogsSubscribeEvents } from "@vnejs/plugins.core.logs.contract";
3
- import type { PluginName as ScenarioPluginName, SubscribeEvents as ScenarioSubscribeEvents } from "@vnejs/plugins.core.scenario.contract";
4
- export type RandomPluginEvents = VnePluginEventsMapRegistry & Record<LogsPluginName, LogsSubscribeEvents> & Record<ScenarioPluginName, ScenarioSubscribeEvents>;
5
- export type RandomPluginConstants = VnePluginConstantsMapRegistry;
6
- export type RandomPluginSettings = VnePluginSettingsMapRegistry;
7
- export type RandomPluginParams = VnePluginParamsMapRegistry;
1
+ import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
2
+ export type RandomPluginEvents = ModuleCoreEvents;
3
+ export type RandomPluginConstants = ModuleCoreConstants;
4
+ export type RandomPluginSettings = ModuleCoreSettings;
5
+ export type RandomPluginParams = ModuleCoreParams;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.scenario.random",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -33,9 +33,7 @@
33
33
  "@vnejs/plugins.scenario.random.contract": "~0.1.0"
34
34
  },
35
35
  "peerDependencies": {
36
- "@vnejs/module": "~0.1.0",
37
- "@vnejs/plugins.core.logs.contract": "~0.1.0",
38
- "@vnejs/plugins.core.scenario.contract": "~0.1.0",
36
+ "@vnejs/module.core": "~0.1.0",
39
37
  "@vnejs/shared": "~0.1.0"
40
38
  },
41
39
  "devDependencies": {
@@ -1,9 +1,9 @@
1
- import { Module } from "@vnejs/module";
1
+ import { ModuleCore } from "@vnejs/module.core";
2
2
 
3
3
  import type { RandomPluginConstants, RandomPluginEvents, RandomPluginParams, RandomPluginSettings } from "../types.js";
4
4
  import type { ScenarioLine } from "../utils/random.js";
5
5
 
6
- export class Random extends Module<RandomPluginEvents, RandomPluginConstants, RandomPluginSettings, RandomPluginParams> {
6
+ export class Random extends ModuleCore<RandomPluginEvents, RandomPluginConstants, RandomPluginSettings, RandomPluginParams> {
7
7
  name = "random";
8
8
 
9
9
  init = () => this.emit(this.EVENTS.SCENARIO.LINE_EXEC_REG, { block: this.name, handler: this.onLineExec });
@@ -28,6 +28,7 @@ export class Random extends Module<RandomPluginEvents, RandomPluginConstants, Ra
28
28
  this.emit(this.EVENTS.LOGS.EMIT, { module: this.name, value: { type: "option", index, curLine: options[index] + 1 } });
29
29
 
30
30
  this.globalState.scenario.curLine = options[index] + 1;
31
- this.emit(this.EVENTS.SCENARIO.NEXT, { module: this.name });
31
+
32
+ this.emitNext();
32
33
  };
33
34
  }
package/src/types.ts CHANGED
@@ -1,11 +1,9 @@
1
- import type { VnePluginConstantsMapRegistry, VnePluginEventsMapRegistry, VnePluginParamsMapRegistry, VnePluginSettingsMapRegistry } from "@vnejs/shared";
2
- import type { PluginName as LogsPluginName, SubscribeEvents as LogsSubscribeEvents } from "@vnejs/plugins.core.logs.contract";
3
- import type { PluginName as ScenarioPluginName, SubscribeEvents as ScenarioSubscribeEvents } from "@vnejs/plugins.core.scenario.contract";
1
+ import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
4
2
 
5
- export type RandomPluginEvents = VnePluginEventsMapRegistry & Record<LogsPluginName, LogsSubscribeEvents> & Record<ScenarioPluginName, ScenarioSubscribeEvents>;
3
+ export type RandomPluginEvents = ModuleCoreEvents;
6
4
 
7
- export type RandomPluginConstants = VnePluginConstantsMapRegistry;
5
+ export type RandomPluginConstants = ModuleCoreConstants;
8
6
 
9
- export type RandomPluginSettings = VnePluginSettingsMapRegistry;
7
+ export type RandomPluginSettings = ModuleCoreSettings;
10
8
 
11
- export type RandomPluginParams = VnePluginParamsMapRegistry;
9
+ export type RandomPluginParams = ModuleCoreParams;