@vnejs/plugins.save.continue 0.1.3 → 0.1.4

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 @@
1
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { regPlugin } from "@vnejs/shared";
2
+ import { PLUGIN_NAME, SUBSCRIBE_EVENTS } from "@vnejs/plugins.save.continue.contract";
3
+ import { SaveContinue } from "./modules/continue.js";
4
+ regPlugin(PLUGIN_NAME, { events: SUBSCRIBE_EVENTS }, [SaveContinue]);
@@ -0,0 +1,11 @@
1
+ import "@vnejs/plugins.save.continue.contract";
2
+ import { Module } from "@vnejs/module";
3
+ import type { SaveContinuePluginConstants, SaveContinuePluginEvents, SaveContinuePluginParams, SaveContinuePluginSettings } from "../types.js";
4
+ export declare class SaveContinue extends Module<SaveContinuePluginEvents, SaveContinuePluginConstants, SaveContinuePluginSettings, SaveContinuePluginParams> {
5
+ name: string;
6
+ subscribe: () => void;
7
+ init: () => Promise<void>;
8
+ onMake: () => Promise<void>;
9
+ onLoad: () => Promise<unknown[]> | undefined;
10
+ onPreload: () => Promise<unknown[]> | undefined;
11
+ }
@@ -0,0 +1,20 @@
1
+ import "@vnejs/plugins.save.continue.contract";
2
+ import { Module } from "@vnejs/module";
3
+ export class SaveContinue extends Module {
4
+ name = "save.continue";
5
+ subscribe = () => {
6
+ this.on(this.EVENTS.SAVE_CONTINUE.MAKE, this.onMake);
7
+ this.on(this.EVENTS.SAVE_CONTINUE.LOAD, this.onLoad);
8
+ this.on(this.EVENTS.SAVE_CONTINUE.PRELOAD, this.onPreload);
9
+ };
10
+ init = async () => {
11
+ const save = (await this.emitOne(this.EVENTS.SAVE.GET, { key: this.name }));
12
+ this.shared.hasContinueSave = Boolean(save && save.migrateStatus === this.CONST.STATE.MIGRATE_STATUS.OK);
13
+ };
14
+ onMake = async () => {
15
+ await this.emit(this.EVENTS.SAVE.CREATE, { key: this.name, withScreenshot: false });
16
+ this.shared.hasContinueSave = true;
17
+ };
18
+ onLoad = () => this.emit(this.EVENTS.SAVE.LOAD, { key: this.name });
19
+ onPreload = () => this.emit(this.EVENTS.SAVE.PRELOAD, { key: this.name });
20
+ }
@@ -0,0 +1,8 @@
1
+ import type { VnePluginConstantsMapRegistry, VnePluginEventsMapRegistry, VnePluginParamsMapRegistry, VnePluginSettingsMapRegistry } from "@vnejs/shared";
2
+ import type { Constants as StateConstants, PluginName as StatePluginName, SubscribeEvents as StateSubscribeEvents } from "@vnejs/plugins.core.state.contract";
3
+ import type { PluginName as SavePluginName, SubscribeEvents as SaveSubscribeEvents } from "@vnejs/plugins.save.contract";
4
+ import type { PluginName, SubscribeEvents } from "@vnejs/plugins.save.continue.contract";
5
+ export type SaveContinuePluginEvents = VnePluginEventsMapRegistry & Record<PluginName, SubscribeEvents> & Record<SavePluginName, SaveSubscribeEvents> & Record<StatePluginName, StateSubscribeEvents>;
6
+ export type SaveContinuePluginConstants = VnePluginConstantsMapRegistry & Record<StatePluginName, StateConstants>;
7
+ export type SaveContinuePluginSettings = VnePluginSettingsMapRegistry;
8
+ export type SaveContinuePluginParams = VnePluginParamsMapRegistry;
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,17 +1,44 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.save.continue",
3
- "version": "0.1.3",
4
- "main": "index.js",
3
+ "version": "0.1.4",
4
+ "description": "",
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
+ ],
5
20
  "scripts": {
6
21
  "test": "echo \"Error: no test specified\" && exit 1",
22
+ "build": "npx @vnejs/monorepo package",
7
23
  "publish:major:plugin": "npm run publish:major",
8
24
  "publish:minor:plugin": "npm run publish:minor",
9
25
  "publish:patch:plugin": "npm run publish:patch",
10
- "publish:major": "npm version major && npm publish --access public",
11
- "publish:minor": "npm version minor && npm publish --access public",
12
- "publish:patch": "npm version patch && npm publish --access public"
26
+ "publish:major": "npx @vnejs/monorepo publish major --access public",
27
+ "publish:minor": "npx @vnejs/monorepo publish minor --access public",
28
+ "publish:patch": "npx @vnejs/monorepo publish patch --access public"
13
29
  },
14
30
  "author": "",
15
31
  "license": "ISC",
16
- "description": ""
32
+ "dependencies": {
33
+ "@vnejs/plugins.save.continue.contract": "~0.0.1"
34
+ },
35
+ "peerDependencies": {
36
+ "@vnejs/module": "~0.0.1",
37
+ "@vnejs/plugins.core.state.contract": "~0.0.1",
38
+ "@vnejs/plugins.save.contract": "~0.0.1",
39
+ "@vnejs/shared": "~0.0.9"
40
+ },
41
+ "devDependencies": {
42
+ "@vnejs/configs.ts-common": "~0.0.1"
43
+ }
17
44
  }
package/src/index.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { regPlugin } from "@vnejs/shared";
2
+ import { PLUGIN_NAME, SUBSCRIBE_EVENTS } from "@vnejs/plugins.save.continue.contract";
3
+
4
+ import { SaveContinue } from "./modules/continue.js";
5
+
6
+ regPlugin(PLUGIN_NAME, { events: SUBSCRIBE_EVENTS }, [SaveContinue]);
@@ -0,0 +1,32 @@
1
+ import "@vnejs/plugins.save.continue.contract";
2
+
3
+ import { Module } from "@vnejs/module";
4
+ import type { SaveCreatePayload, SaveKeyPayload, SaveRecord } from "@vnejs/plugins.save.contract";
5
+
6
+ import type { SaveContinuePluginConstants, SaveContinuePluginEvents, SaveContinuePluginParams, SaveContinuePluginSettings } from "../types.js";
7
+
8
+ export class SaveContinue extends Module<SaveContinuePluginEvents, SaveContinuePluginConstants, SaveContinuePluginSettings, SaveContinuePluginParams> {
9
+ name = "save.continue";
10
+
11
+ subscribe = () => {
12
+ this.on(this.EVENTS.SAVE_CONTINUE.MAKE, this.onMake);
13
+ this.on(this.EVENTS.SAVE_CONTINUE.LOAD, this.onLoad);
14
+ this.on(this.EVENTS.SAVE_CONTINUE.PRELOAD, this.onPreload);
15
+ };
16
+
17
+ init = async () => {
18
+ const save = (await this.emitOne(this.EVENTS.SAVE.GET, { key: this.name })) as SaveRecord | undefined;
19
+
20
+ this.shared.hasContinueSave = Boolean(save && save.migrateStatus === this.CONST.STATE.MIGRATE_STATUS.OK);
21
+ };
22
+
23
+ onMake = async () => {
24
+ await this.emit(this.EVENTS.SAVE.CREATE, { key: this.name, withScreenshot: false } satisfies SaveCreatePayload);
25
+
26
+ this.shared.hasContinueSave = true;
27
+ };
28
+
29
+ onLoad = () => this.emit(this.EVENTS.SAVE.LOAD, { key: this.name } satisfies SaveKeyPayload);
30
+
31
+ onPreload = () => this.emit(this.EVENTS.SAVE.PRELOAD, { key: this.name } satisfies SaveKeyPayload);
32
+ }
package/src/types.ts ADDED
@@ -0,0 +1,15 @@
1
+ import type { VnePluginConstantsMapRegistry, VnePluginEventsMapRegistry, VnePluginParamsMapRegistry, VnePluginSettingsMapRegistry } from "@vnejs/shared";
2
+ import type { Constants as StateConstants, PluginName as StatePluginName, SubscribeEvents as StateSubscribeEvents } from "@vnejs/plugins.core.state.contract";
3
+ import type { PluginName as SavePluginName, SubscribeEvents as SaveSubscribeEvents } from "@vnejs/plugins.save.contract";
4
+ import type { PluginName, SubscribeEvents } from "@vnejs/plugins.save.continue.contract";
5
+
6
+ export type SaveContinuePluginEvents = VnePluginEventsMapRegistry &
7
+ Record<PluginName, SubscribeEvents> &
8
+ Record<SavePluginName, SaveSubscribeEvents> &
9
+ Record<StatePluginName, StateSubscribeEvents>;
10
+
11
+ export type SaveContinuePluginConstants = VnePluginConstantsMapRegistry & Record<StatePluginName, StateConstants>;
12
+
13
+ export type SaveContinuePluginSettings = VnePluginSettingsMapRegistry;
14
+
15
+ export type SaveContinuePluginParams = VnePluginParamsMapRegistry;
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
+ }
package/const/events.js DELETED
@@ -1,5 +0,0 @@
1
- export const SUBSCRIBE_EVENTS = {
2
- MAKE: "vne:save_continue:make",
3
- LOAD: "vne:save_continue:load",
4
- PRELOAD: "vne:save_continue:preload",
5
- };
package/index.js DELETED
@@ -1,7 +0,0 @@
1
- import { regPlugin } from "@vnejs/shared";
2
-
3
- import { SUBSCRIBE_EVENTS } from "./const/events";
4
-
5
- import { SaveContinue } from "./modules/continue";
6
-
7
- regPlugin("SAVE_CONTINUE", { events: SUBSCRIBE_EVENTS }, [SaveContinue]);
@@ -1,25 +0,0 @@
1
- import { Module } from "@vnejs/module";
2
-
3
- export class SaveContinue extends Module {
4
- name = "save.continue";
5
-
6
- subscribe = () => {
7
- this.on(this.EVENTS.SAVE_CONTINUE.MAKE, this.onMake);
8
- this.on(this.EVENTS.SAVE_CONTINUE.LOAD, this.onLoad);
9
- this.on(this.EVENTS.SAVE_CONTINUE.PRELOAD, this.onPreload);
10
- };
11
-
12
- init = async () => {
13
- const save = await this.emitOne(this.EVENTS.SAVE.GET, { key: this.name });
14
-
15
- this.shared.hasContinueSave = save && save.migrateStatus === this.CONST.STATE.MIGRATE_STATUS.OK;
16
- };
17
-
18
- onMake = async () => {
19
- await this.emit(this.EVENTS.SAVE.CREATE, { key: this.name, withScreenshot: false });
20
-
21
- this.shared.hasContinueSave = true;
22
- };
23
- onLoad = () => this.emit(this.EVENTS.SAVE.LOAD, { key: this.name });
24
- onPreload = () => this.emit(this.EVENTS.SAVE.PRELOAD, { key: this.name });
25
- }