@vnejs/bridge.plugins.scenario.choose.plugins.scenario.qte 0.2.7 → 0.2.8

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/index.d.ts CHANGED
@@ -1 +1 @@
1
- import "@vnejs/contracts.scenario.choose";
1
+ import "@vnejs/contracts.bridge.plugins.scenario.choose.plugins.scenario.qte";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import "@vnejs/contracts.scenario.choose";
1
+ import "@vnejs/contracts.bridge.plugins.scenario.choose.plugins.scenario.qte";
2
+ import { CONSTANTS, PLUGIN_NAME } from "@vnejs/contracts.bridge.plugins.scenario.choose.plugins.scenario.qte";
2
3
  import { regPlugin } from "@vnejs/registry";
3
4
  import { BridgePluginChoosePluginQte } from "./modules/bridge_plugin_choose_plugin_qte.js";
4
- const PLUGIN_NAME = "BRIDGE_PLUGIN_CHOOSE_PLUGIN_QTE";
5
- regPlugin(PLUGIN_NAME, {}, [BridgePluginChoosePluginQte]);
5
+ regPlugin(PLUGIN_NAME, { constants: CONSTANTS }, [BridgePluginChoosePluginQte]);
@@ -2,11 +2,6 @@ import { ModuleCore } from "@vnejs/module.core";
2
2
  import type { ChooseOption, ChooseOptionReplaceHandler } from "@vnejs/contracts.scenario.choose";
3
3
  import type { QteResultPayload } from "@vnejs/contracts.scenario.qte";
4
4
  import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "../types.js";
5
- declare module "@vnejs/contracts.scenario.choose" {
6
- interface ChooseOption {
7
- qte?: string;
8
- }
9
- }
10
5
  export declare class BridgePluginChoosePluginQte extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
11
6
  name: string;
12
7
  pendingResolve: ((success: boolean) => void) | null;
@@ -1,8 +1,4 @@
1
1
  import { ModuleCore } from "@vnejs/module.core";
2
- const LOGS_ACTIONS = {
3
- MISSING: "missing",
4
- MISSING_FALLBACK: "missing_fallback",
5
- };
6
2
  export class BridgePluginChoosePluginQte extends ModuleCore {
7
3
  name = "bridge_plugin_choose_plugin_qte";
8
4
  pendingResolve = null;
@@ -17,7 +13,7 @@ export class BridgePluginChoosePluginQte extends ModuleCore {
17
13
  return index;
18
14
  const item = this.PARAMS.QTE.ITEMS[qteId];
19
15
  if (!item) {
20
- this.emit(this.EVENTS.LOGS.EMIT, { action: LOGS_ACTIONS.MISSING, id: qteId });
16
+ this.emit(this.EVENTS.LOGS.EMIT, { action: this.CONST.BRIDGE_PLUGIN_CHOOSE_PLUGIN_QTE.LOGS_ACTIONS.MISSING, id: qteId });
21
17
  return this.resolveFailIndex(index, options);
22
18
  }
23
19
  const success = await new Promise((resolve) => {
@@ -38,7 +34,7 @@ export class BridgePluginChoosePluginQte extends ModuleCore {
38
34
  resolveFailIndex = (index, options) => {
39
35
  const fallbackIndex = options.findIndex((option) => option.keywords?.includes(this.CONST.QTE.LINE_KEYWORDS.QTE_FALLBACK));
40
36
  if (fallbackIndex < 0) {
41
- this.emit(this.EVENTS.LOGS.EMIT, { action: LOGS_ACTIONS.MISSING_FALLBACK, index });
37
+ this.emit(this.EVENTS.LOGS.EMIT, { action: this.CONST.BRIDGE_PLUGIN_CHOOSE_PLUGIN_QTE.LOGS_ACTIONS.MISSING_FALLBACK, index });
42
38
  return index;
43
39
  }
44
40
  return fallbackIndex;
package/dist/types.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
2
+ import type { Constants as BridgeConstants, PluginName as BridgePluginName } from "@vnejs/contracts.bridge.plugins.scenario.choose.plugins.scenario.qte";
2
3
  import type { PluginName as ChoosePluginName, SubscribeEvents as ChooseSubscribeEvents } from "@vnejs/contracts.scenario.choose";
3
4
  import type { Constants as QteConstants, Params as QteParams, PluginName as QtePluginName, SubscribeEvents as QteSubscribeEvents } from "@vnejs/contracts.scenario.qte";
4
5
  export type PluginEvents = ModuleCoreEvents & Record<ChoosePluginName, ChooseSubscribeEvents> & Record<QtePluginName, QteSubscribeEvents>;
5
- export type PluginConstants = ModuleCoreConstants & Record<QtePluginName, QteConstants>;
6
+ export type PluginConstants = ModuleCoreConstants & Record<BridgePluginName, BridgeConstants> & Record<QtePluginName, QteConstants>;
6
7
  export type PluginSettings = ModuleCoreSettings;
7
8
  export type PluginParams = ModuleCoreParams & Record<QtePluginName, QteParams>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/bridge.plugins.scenario.choose.plugins.scenario.qte",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,6 +31,7 @@
31
31
  "license": "ISC",
32
32
  "peerDependencies": {
33
33
  "@vnejs/module.core": "~0.2.0",
34
+ "@vnejs/contracts.bridge.plugins.scenario.choose.plugins.scenario.qte": "~0.2.0",
34
35
  "@vnejs/contracts.scenario.choose": "~0.2.0",
35
36
  "@vnejs/contracts.scenario.qte": "~0.2.0",
36
37
  "@vnejs/registry": "~0.2.0"
@@ -39,6 +40,7 @@
39
40
  "@vnejs/configs.ts-common": "~0.2.0",
40
41
  "@vnejs/configs.vitest": "~0.2.0",
41
42
  "@vnejs/test-utils": "~0.2.0",
43
+ "@vnejs/contracts.bridge.plugins.scenario.choose.plugins.scenario.qte": "~0.2.0",
42
44
  "@vnejs/contracts.scenario.choose": "~0.2.0",
43
45
  "@vnejs/contracts.scenario.qte": "~0.2.0",
44
46
  "@vnejs/module.core": "~0.2.0",
package/src/index.ts CHANGED
@@ -1,9 +1,8 @@
1
- import "@vnejs/contracts.scenario.choose";
1
+ import "@vnejs/contracts.bridge.plugins.scenario.choose.plugins.scenario.qte";
2
2
 
3
+ import { CONSTANTS, PLUGIN_NAME } from "@vnejs/contracts.bridge.plugins.scenario.choose.plugins.scenario.qte";
3
4
  import { regPlugin } from "@vnejs/registry";
4
5
 
5
6
  import { BridgePluginChoosePluginQte } from "./modules/bridge_plugin_choose_plugin_qte.js";
6
7
 
7
- const PLUGIN_NAME = "BRIDGE_PLUGIN_CHOOSE_PLUGIN_QTE";
8
-
9
- regPlugin(PLUGIN_NAME, {}, [BridgePluginChoosePluginQte]);
8
+ regPlugin(PLUGIN_NAME, { constants: CONSTANTS }, [BridgePluginChoosePluginQte]);
@@ -4,17 +4,6 @@ import type { QteResultPayload } from "@vnejs/contracts.scenario.qte";
4
4
 
5
5
  import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "../types.js";
6
6
 
7
- const LOGS_ACTIONS = {
8
- MISSING: "missing",
9
- MISSING_FALLBACK: "missing_fallback",
10
- } as const;
11
-
12
- declare module "@vnejs/contracts.scenario.choose" {
13
- interface ChooseOption {
14
- qte?: string;
15
- }
16
- }
17
-
18
7
  export class BridgePluginChoosePluginQte extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
19
8
  name = "bridge_plugin_choose_plugin_qte";
20
9
 
@@ -35,7 +24,7 @@ export class BridgePluginChoosePluginQte extends ModuleCore<PluginEvents, Plugin
35
24
  const item = this.PARAMS.QTE.ITEMS[qteId];
36
25
 
37
26
  if (!item) {
38
- this.emit(this.EVENTS.LOGS.EMIT, { action: LOGS_ACTIONS.MISSING, id: qteId });
27
+ this.emit(this.EVENTS.LOGS.EMIT, { action: this.CONST.BRIDGE_PLUGIN_CHOOSE_PLUGIN_QTE.LOGS_ACTIONS.MISSING, id: qteId });
39
28
  return this.resolveFailIndex(index, options);
40
29
  }
41
30
 
@@ -61,7 +50,7 @@ export class BridgePluginChoosePluginQte extends ModuleCore<PluginEvents, Plugin
61
50
  const fallbackIndex = options.findIndex((option) => option.keywords?.includes(this.CONST.QTE.LINE_KEYWORDS.QTE_FALLBACK));
62
51
 
63
52
  if (fallbackIndex < 0) {
64
- this.emit(this.EVENTS.LOGS.EMIT, { action: LOGS_ACTIONS.MISSING_FALLBACK, index });
53
+ this.emit(this.EVENTS.LOGS.EMIT, { action: this.CONST.BRIDGE_PLUGIN_CHOOSE_PLUGIN_QTE.LOGS_ACTIONS.MISSING_FALLBACK, index });
65
54
  return index;
66
55
  }
67
56
 
@@ -1,3 +1,4 @@
1
+ import { CONSTANTS as BRIDGE_CONSTANTS, PLUGIN_NAME as BRIDGE } from "@vnejs/contracts.bridge.plugins.scenario.choose.plugins.scenario.qte";
1
2
  import { PARAMS as CHOOSE_PARAMS, PLUGIN_NAME as CHOOSE, SUBSCRIBE_EVENTS as CHOOSE_EVENTS } from "@vnejs/contracts.scenario.choose";
2
3
  import {
3
4
  CONSTANTS as QTE_CONSTANTS,
@@ -12,6 +13,7 @@ export const registerCompatibilityVne = () => {
12
13
  registerCoreVne();
13
14
  registerVnePlugin(CHOOSE, { events: CHOOSE_EVENTS, params: CHOOSE_PARAMS });
14
15
  registerVnePlugin(QTE, { events: QTE_EVENTS, params: QTE_PARAMS, constants: QTE_CONSTANTS });
16
+ registerVnePlugin(BRIDGE, { constants: BRIDGE_CONSTANTS });
15
17
  };
16
18
 
17
19
  export const createCompatibilityTestModule = <T extends Parameters<typeof baseCreateTestModule>[0]>(
package/src/types.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
2
+ import type { Constants as BridgeConstants, PluginName as BridgePluginName } from "@vnejs/contracts.bridge.plugins.scenario.choose.plugins.scenario.qte";
2
3
  import type { PluginName as ChoosePluginName, SubscribeEvents as ChooseSubscribeEvents } from "@vnejs/contracts.scenario.choose";
3
4
  import type {
4
5
  Constants as QteConstants,
@@ -9,7 +10,7 @@ import type {
9
10
 
10
11
  export type PluginEvents = ModuleCoreEvents & Record<ChoosePluginName, ChooseSubscribeEvents> & Record<QtePluginName, QteSubscribeEvents>;
11
12
 
12
- export type PluginConstants = ModuleCoreConstants & Record<QtePluginName, QteConstants>;
13
+ export type PluginConstants = ModuleCoreConstants & Record<BridgePluginName, BridgeConstants> & Record<QtePluginName, QteConstants>;
13
14
 
14
15
  export type PluginSettings = ModuleCoreSettings;
15
16