@morghulis/core 0.0.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,2 @@
1
+ import { Core, Options } from "./types";
2
+ export declare function useMorghulisCore(options: Options): Core;
@@ -0,0 +1,9 @@
1
+ import { App } from "vue";
2
+ import 'nprogress/nprogress.css';
3
+ import { useRequest } from "./use-request";
4
+ import { IOptions } from "./types";
5
+ import { createChannel, useChannel } from "./use-channel";
6
+ declare const createMorghulisCore: (options?: IOptions) => {
7
+ install(app: App): void;
8
+ };
9
+ export { createMorghulisCore, useRequest, createChannel, useChannel, };
@@ -0,0 +1,17 @@
1
+ import { Ref } from "vue";
2
+ import ChannelHub from "./use-channel/ChannelHub";
3
+ export type IOptions = {
4
+ baseURL?: string;
5
+ minioURL?: string;
6
+ $$message?: (msg: string, type: string) => void;
7
+ };
8
+ export type Options = {
9
+ baseURL: string;
10
+ minioURL: string;
11
+ $$message: (type: string, msg: string) => void;
12
+ };
13
+ export type Core = {
14
+ status: Ref<string>;
15
+ open: () => void;
16
+ hub: ChannelHub;
17
+ };
@@ -0,0 +1,17 @@
1
+ import { Reactive } from "vue";
2
+ import { ChannelConfig, ChannelStatus } from "./types";
3
+ import { AxiosInstance } from "axios";
4
+ export default class Channel {
5
+ private config;
6
+ status: Reactive<ChannelStatus>;
7
+ handlerKey: string;
8
+ channelKey: string;
9
+ url: string;
10
+ request: AxiosInstance;
11
+ constructor(config: ChannelConfig);
12
+ execute(data?: any): void;
13
+ ready(): void;
14
+ start(): void;
15
+ proceed(data: any): void;
16
+ stop(): void;
17
+ }
@@ -0,0 +1,9 @@
1
+ import { ChannelConfig, ChannelContainer } from "./types";
2
+ import Channel from "./Channel";
3
+ export default class ChannelHub {
4
+ container: ChannelContainer;
5
+ constructor();
6
+ loadChannel(handlerKey: string, channelKey: string): Promise<Channel>;
7
+ destroy(handlerKey: string, channelKey: string): void;
8
+ register(config: ChannelConfig): Channel;
9
+ }
@@ -0,0 +1,5 @@
1
+ import { IChannelConfig } from "./types";
2
+ import { Ref } from "vue";
3
+ import Channel from "./Channel";
4
+ export declare function createChannel(config: IChannelConfig): Channel;
5
+ export declare function useChannel(config: Ref<IChannelConfig>): Channel;
@@ -0,0 +1,28 @@
1
+ import Channel from "./Channel";
2
+ export type IChannelConfig = {
3
+ handlerKey: string;
4
+ channelKey?: string;
5
+ url?: string;
6
+ auth?: boolean;
7
+ onStart?(): void;
8
+ onStop?(): void;
9
+ onProceed?(payload: any): void;
10
+ };
11
+ export type ChannelConfig = {
12
+ handlerKey: string;
13
+ channelKey: string;
14
+ url: string;
15
+ auth?: boolean;
16
+ onStart(): void;
17
+ onStop(): void;
18
+ onProceed?(payload: any): void;
19
+ };
20
+ export type ChannelContainer = {
21
+ [handlerKey: string]: {
22
+ [channelKey: string]: Channel;
23
+ };
24
+ };
25
+ export type ChannelStatus = {
26
+ loading: boolean;
27
+ payload: any;
28
+ };
@@ -0,0 +1,15 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import 'nprogress/nprogress.css';
3
+ export declare function useRequest(): {
4
+ getHttpRequest: (auth?: boolean) => AxiosInstance;
5
+ download: (path: string) => void;
6
+ all: (mapping: {
7
+ [key: string]: Promise<any>;
8
+ }) => Promise<{
9
+ [key: string]: any;
10
+ }>;
11
+ read: (path: string) => Promise<{
12
+ blob: Blob;
13
+ fileName: string;
14
+ }>;
15
+ };
@@ -0,0 +1,5 @@
1
+ export declare function useSocket(baseURL: string): {
2
+ data: import("vue").Ref<any, any>;
3
+ open: import("@vueuse/shared").Fn;
4
+ status: import("vue").Ref<string, string>;
5
+ };
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@morghulis/core",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "main": "./dist/morghulis-core.umd.js",
12
+ "module": "./dist/morghulis-core.es.js",
13
+ "types": "./dist/types/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/types/index.d.ts",
17
+ "import": "./dist/morghulis-core.es.js",
18
+ "require": "./dist/morghulis-core.umd.js"
19
+ }
20
+ },
21
+ "scripts": {
22
+ "dev": "vite",
23
+ "build": "vite build && vue-tsc --emitDeclarationOnly",
24
+ "preview": "vite preview"
25
+ },
26
+ "peerDependencies": {
27
+ "vue": "^3.5.13"
28
+ },
29
+ "dependencies": {
30
+ "@morghulis/utils": "^0.0.8",
31
+ "@vueuse/core": "^13.1.0",
32
+ "axios": "^1.8.1",
33
+ "nprogress": "^0.2.0"
34
+ },
35
+ "devDependencies": {
36
+ "@types/nprogress": "^0.2.3",
37
+ "@types/node": "^22.14.0",
38
+ "@vitejs/plugin-vue": "^5.2.3",
39
+ "typescript": "~5.8.0",
40
+ "vite": "^6.2.4",
41
+ "vite-plugin-vue-devtools": "^7.7.2",
42
+ "vue-tsc": "^2.2.8"
43
+ }
44
+ }