@vnejs/contracts.core.scenario 0.1.1

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.
@@ -0,0 +1,25 @@
1
+ export declare const OTHER_MODULE: "other";
2
+ export declare const LINE_KEYWORDS: {
3
+ readonly GLOBAL: "global";
4
+ readonly SKIP_IF_POSSIBLE: "skip-if-possible";
5
+ readonly ASYNC: "async";
6
+ readonly EXTEND: "extend";
7
+ };
8
+ export declare const LINE_PREFIXES: {
9
+ readonly MODULE: "$";
10
+ readonly BLOCK: "%";
11
+ };
12
+ export declare const CONSTANTS: {
13
+ readonly OTHER_MODULE: "other";
14
+ readonly LINE_KEYWORDS: {
15
+ readonly GLOBAL: "global";
16
+ readonly SKIP_IF_POSSIBLE: "skip-if-possible";
17
+ readonly ASYNC: "async";
18
+ readonly EXTEND: "extend";
19
+ };
20
+ readonly LINE_PREFIXES: {
21
+ readonly MODULE: "$";
22
+ readonly BLOCK: "%";
23
+ };
24
+ };
25
+ export type Constants = typeof CONSTANTS;
package/dist/const.js ADDED
@@ -0,0 +1,16 @@
1
+ export const OTHER_MODULE = "other";
2
+ export const LINE_KEYWORDS = {
3
+ GLOBAL: "global",
4
+ SKIP_IF_POSSIBLE: "skip-if-possible",
5
+ ASYNC: "async",
6
+ EXTEND: "extend",
7
+ };
8
+ export const LINE_PREFIXES = {
9
+ MODULE: "$",
10
+ BLOCK: "%",
11
+ };
12
+ export const CONSTANTS = {
13
+ OTHER_MODULE,
14
+ LINE_KEYWORDS,
15
+ LINE_PREFIXES,
16
+ };
@@ -0,0 +1,16 @@
1
+ export declare const SUBSCRIBE_EVENTS: {
2
+ readonly EXEC: "vne:scenario:exec";
3
+ readonly EXEC_REG: "vne:scenario:exec_reg";
4
+ readonly EXEC_DELAY: "vne:scenario:exec_delay";
5
+ readonly EXEC_AWAIT: "vne:scenario:exec_await";
6
+ readonly NEXT: "vne:scenario:next";
7
+ readonly LABEL_GET: "vne:scenario:label_get";
8
+ readonly LINE_LOAD: "vne:scenario:line_load";
9
+ readonly LINE_GET: "vne:scenario:line_get";
10
+ readonly LINE_REG: "vne:scenario:line_reg";
11
+ readonly LINE_LOAD_REG: "vne:scenario:line_load_reg";
12
+ readonly LINE_EXEC_REG: "vne:scenario:line_exec_reg";
13
+ readonly LINE_NEXT_REG: "vne:scenario:line_next_reg";
14
+ readonly LINES_GET: "vne:scenario:lines_get";
15
+ };
16
+ export type SubscribeEvents = typeof SUBSCRIBE_EVENTS;
package/dist/events.js ADDED
@@ -0,0 +1,15 @@
1
+ export const SUBSCRIBE_EVENTS = {
2
+ EXEC: "vne:scenario:exec",
3
+ EXEC_REG: "vne:scenario:exec_reg",
4
+ EXEC_DELAY: "vne:scenario:exec_delay",
5
+ EXEC_AWAIT: "vne:scenario:exec_await",
6
+ NEXT: "vne:scenario:next",
7
+ LABEL_GET: "vne:scenario:label_get",
8
+ LINE_LOAD: "vne:scenario:line_load",
9
+ LINE_GET: "vne:scenario:line_get",
10
+ LINE_REG: "vne:scenario:line_reg",
11
+ LINE_LOAD_REG: "vne:scenario:line_load_reg",
12
+ LINE_EXEC_REG: "vne:scenario:line_exec_reg",
13
+ LINE_NEXT_REG: "vne:scenario:line_next_reg",
14
+ LINES_GET: "vne:scenario:lines_get",
15
+ };
@@ -0,0 +1,12 @@
1
+ export type LineLoadHandlerArg = {
2
+ line?: string;
3
+ args?: Record<string, unknown>;
4
+ label?: string;
5
+ deep?: number;
6
+ priority?: number;
7
+ };
8
+ export type LineExecHandlerArg = {
9
+ line?: string;
10
+ args?: Record<string, unknown>;
11
+ keywords?: string[];
12
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ import "@vnejs/module";
2
+ import "@vnejs/shared";
3
+ import { CONSTANTS } from "./const.js";
4
+ import { SUBSCRIBE_EVENTS } from "./events.js";
5
+ import type { ModuleGlobalStateScenario } from "./module-global-state.js";
6
+ import { DEFAULT_MODULE_GLOBAL_STATE_SCENARIO } from "./module-global-state.js";
7
+ import { PARAMS } from "./params.js";
8
+ export type { ModuleGlobalStateScenario } from "./module-global-state.js";
9
+ export { DEFAULT_MODULE_GLOBAL_STATE_SCENARIO };
10
+ export declare const PLUGIN_NAME: "SCENARIO";
11
+ export type PluginName = typeof PLUGIN_NAME;
12
+ export { CONSTANTS };
13
+ export type { Constants } from "./const.js";
14
+ export { SUBSCRIBE_EVENTS };
15
+ export type { SubscribeEvents } from "./events.js";
16
+ export { PARAMS };
17
+ export type { Params } from "./params.js";
18
+ export type { LineLoadHandlerArg, LineExecHandlerArg } from "./handlers.js";
19
+ declare module "@vnejs/module" {
20
+ interface ModuleGlobalState {
21
+ scenario: ModuleGlobalStateScenario;
22
+ }
23
+ }
24
+ declare module "@vnejs/shared" {
25
+ interface VnePluginEventsMap extends Record<typeof PLUGIN_NAME, typeof SUBSCRIBE_EVENTS> {
26
+ }
27
+ interface VnePluginConstantsMap extends Record<typeof PLUGIN_NAME, typeof CONSTANTS> {
28
+ }
29
+ interface VnePluginParamsMap extends Record<typeof PLUGIN_NAME, typeof PARAMS> {
30
+ }
31
+ }
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ import "@vnejs/module";
2
+ import "@vnejs/shared";
3
+ import { CONSTANTS } from "./const.js";
4
+ import { SUBSCRIBE_EVENTS } from "./events.js";
5
+ import { DEFAULT_MODULE_GLOBAL_STATE_SCENARIO } from "./module-global-state.js";
6
+ import { PARAMS } from "./params.js";
7
+ export { DEFAULT_MODULE_GLOBAL_STATE_SCENARIO };
8
+ export const PLUGIN_NAME = "SCENARIO";
9
+ export { CONSTANTS };
10
+ export { SUBSCRIBE_EVENTS };
11
+ export { PARAMS };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Extend in other contracts via module augmentation:
3
+ *
4
+ * @example
5
+ * declare module "@vnejs/module" {
6
+ * interface ModuleGlobalState {
7
+ * "my-module": MyModuleGlobalState;
8
+ * }
9
+ * }
10
+ */
11
+ export interface ModuleGlobalStateScenario {
12
+ label: string;
13
+ curLine: number;
14
+ hash?: string;
15
+ }
16
+ export declare const DEFAULT_MODULE_GLOBAL_STATE_SCENARIO: ModuleGlobalStateScenario;
@@ -0,0 +1,5 @@
1
+ import { PARAMS } from "./params.js";
2
+ export const DEFAULT_MODULE_GLOBAL_STATE_SCENARIO = {
3
+ label: PARAMS.INIT_LABEL_NAME,
4
+ curLine: 0,
5
+ };
@@ -0,0 +1,7 @@
1
+ import type { Widen } from "@vnejs/shared";
2
+ declare const PARAMS_DEFAULT: {
3
+ INIT_LABEL_NAME: string;
4
+ };
5
+ export type Params = Widen<typeof PARAMS_DEFAULT>;
6
+ export declare const PARAMS: Params;
7
+ export {};
package/dist/params.js ADDED
@@ -0,0 +1,4 @@
1
+ const PARAMS_DEFAULT = {
2
+ INIT_LABEL_NAME: "init",
3
+ };
4
+ export const PARAMS = PARAMS_DEFAULT;
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@vnejs/contracts.core.scenario",
3
+ "version": "0.1.1",
4
+ "description": "Contracts for @vnejs/plugins.core.scenario",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "src",
18
+ "tsconfig.json"
19
+ ],
20
+ "scripts": {
21
+ "build": "npx @vnejs/monorepo package",
22
+ "publish:major": "npx @vnejs/monorepo publish major --access public",
23
+ "publish:minor": "npx @vnejs/monorepo publish minor --access public",
24
+ "publish:patch": "npx @vnejs/monorepo publish patch --access public"
25
+ },
26
+ "author": "",
27
+ "license": "ISC",
28
+ "peerDependencies": {
29
+ "@vnejs/module": "~0.1.0",
30
+ "@vnejs/shared": "~0.1.0"
31
+ },
32
+ "devDependencies": {
33
+ "@vnejs/configs.ts-common": "~0.1.0"
34
+ }
35
+ }
package/src/const.ts ADDED
@@ -0,0 +1,21 @@
1
+ export const OTHER_MODULE = "other" as const;
2
+
3
+ export const LINE_KEYWORDS = {
4
+ GLOBAL: "global",
5
+ SKIP_IF_POSSIBLE: "skip-if-possible",
6
+ ASYNC: "async",
7
+ EXTEND: "extend",
8
+ } as const;
9
+
10
+ export const LINE_PREFIXES = {
11
+ MODULE: "$",
12
+ BLOCK: "%",
13
+ } as const;
14
+
15
+ export const CONSTANTS = {
16
+ OTHER_MODULE,
17
+ LINE_KEYWORDS,
18
+ LINE_PREFIXES,
19
+ } as const;
20
+
21
+ export type Constants = typeof CONSTANTS;
package/src/events.ts ADDED
@@ -0,0 +1,17 @@
1
+ export const SUBSCRIBE_EVENTS = {
2
+ EXEC: "vne:scenario:exec",
3
+ EXEC_REG: "vne:scenario:exec_reg",
4
+ EXEC_DELAY: "vne:scenario:exec_delay",
5
+ EXEC_AWAIT: "vne:scenario:exec_await",
6
+ NEXT: "vne:scenario:next",
7
+ LABEL_GET: "vne:scenario:label_get",
8
+ LINE_LOAD: "vne:scenario:line_load",
9
+ LINE_GET: "vne:scenario:line_get",
10
+ LINE_REG: "vne:scenario:line_reg",
11
+ LINE_LOAD_REG: "vne:scenario:line_load_reg",
12
+ LINE_EXEC_REG: "vne:scenario:line_exec_reg",
13
+ LINE_NEXT_REG: "vne:scenario:line_next_reg",
14
+ LINES_GET: "vne:scenario:lines_get",
15
+ } as const;
16
+
17
+ export type SubscribeEvents = typeof SUBSCRIBE_EVENTS;
@@ -0,0 +1,13 @@
1
+ export type LineLoadHandlerArg = {
2
+ line?: string;
3
+ args?: Record<string, unknown>;
4
+ label?: string;
5
+ deep?: number;
6
+ priority?: number;
7
+ };
8
+
9
+ export type LineExecHandlerArg = {
10
+ line?: string;
11
+ args?: Record<string, unknown>;
12
+ keywords?: string[];
13
+ };
package/src/index.ts ADDED
@@ -0,0 +1,36 @@
1
+ import "@vnejs/module";
2
+ import "@vnejs/shared";
3
+
4
+ import { CONSTANTS } from "./const.js";
5
+ import { SUBSCRIBE_EVENTS } from "./events.js";
6
+ import type { ModuleGlobalStateScenario } from "./module-global-state.js";
7
+ import { DEFAULT_MODULE_GLOBAL_STATE_SCENARIO } from "./module-global-state.js";
8
+ import { PARAMS } from "./params.js";
9
+
10
+ export type { ModuleGlobalStateScenario } from "./module-global-state.js";
11
+ export { DEFAULT_MODULE_GLOBAL_STATE_SCENARIO };
12
+
13
+ export const PLUGIN_NAME = "SCENARIO" as const;
14
+ export type PluginName = typeof PLUGIN_NAME;
15
+
16
+ export { CONSTANTS };
17
+ export type { Constants } from "./const.js";
18
+ export { SUBSCRIBE_EVENTS };
19
+ export type { SubscribeEvents } from "./events.js";
20
+ export { PARAMS };
21
+ export type { Params } from "./params.js";
22
+ export type { LineLoadHandlerArg, LineExecHandlerArg } from "./handlers.js";
23
+
24
+ declare module "@vnejs/module" {
25
+ interface ModuleGlobalState {
26
+ scenario: ModuleGlobalStateScenario;
27
+ }
28
+ }
29
+
30
+ declare module "@vnejs/shared" {
31
+ interface VnePluginEventsMap extends Record<typeof PLUGIN_NAME, typeof SUBSCRIBE_EVENTS> {}
32
+
33
+ interface VnePluginConstantsMap extends Record<typeof PLUGIN_NAME, typeof CONSTANTS> {}
34
+
35
+ interface VnePluginParamsMap extends Record<typeof PLUGIN_NAME, typeof PARAMS> {}
36
+ }
@@ -0,0 +1,22 @@
1
+ import { PARAMS } from "./params.js";
2
+
3
+ /**
4
+ * Extend in other contracts via module augmentation:
5
+ *
6
+ * @example
7
+ * declare module "@vnejs/module" {
8
+ * interface ModuleGlobalState {
9
+ * "my-module": MyModuleGlobalState;
10
+ * }
11
+ * }
12
+ */
13
+ export interface ModuleGlobalStateScenario {
14
+ label: string;
15
+ curLine: number;
16
+ hash?: string;
17
+ }
18
+
19
+ export const DEFAULT_MODULE_GLOBAL_STATE_SCENARIO: ModuleGlobalStateScenario = {
20
+ label: PARAMS.INIT_LABEL_NAME,
21
+ curLine: 0,
22
+ };
package/src/params.ts ADDED
@@ -0,0 +1,8 @@
1
+ import type { Widen } from "@vnejs/shared";
2
+
3
+ const PARAMS_DEFAULT = {
4
+ INIT_LABEL_NAME: "init",
5
+ };
6
+
7
+ export type Params = Widen<typeof PARAMS_DEFAULT>;
8
+ export const PARAMS: Params = PARAMS_DEFAULT;
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@vnejs/configs.ts-common/tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": "src",
5
+ "outDir": "dist"
6
+ },
7
+ "include": ["src/**/*.ts"],
8
+ "exclude": ["dist", "node_modules"]
9
+ }