@codingfactory/messenger-client 0.1.0
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/README.md +38 -0
- package/dist/composables/useConversationChannel.d.ts +13 -0
- package/dist/composables/useGlobalMessaging.d.ts +12 -0
- package/dist/composables/useNotificationSound.d.ts +4 -0
- package/dist/configure.d.ts +16 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +1440 -0
- package/dist/services/api/messaging.d.ts +17 -0
- package/dist/services/auth.d.ts +17 -0
- package/dist/services/echo.d.ts +84 -0
- package/dist/services/mediaApi.d.ts +11 -0
- package/dist/stores/auth.d.ts +13 -0
- package/dist/stores/messaging.d.ts +3760 -0
- package/dist/types/messaging.d.ts +81 -0
- package/dist/utils/errorUtils.d.ts +23 -0
- package/dist/utils/logger.d.ts +10 -0
- package/package.json +48 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for messaging functionality
|
|
3
|
+
*/
|
|
4
|
+
export interface User {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
handle?: string;
|
|
8
|
+
avatar?: string;
|
|
9
|
+
avatar_url?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface Participant {
|
|
12
|
+
user_id: string;
|
|
13
|
+
user?: User;
|
|
14
|
+
joined_at: string;
|
|
15
|
+
role: 'owner' | 'admin' | 'member';
|
|
16
|
+
last_read_at?: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface ReplyToPreview {
|
|
19
|
+
id: string;
|
|
20
|
+
author_id: string;
|
|
21
|
+
body?: string | null;
|
|
22
|
+
}
|
|
23
|
+
export interface MessageAttachment {
|
|
24
|
+
id: string;
|
|
25
|
+
url: string;
|
|
26
|
+
type: string;
|
|
27
|
+
name?: string;
|
|
28
|
+
size?: number;
|
|
29
|
+
thumbnail?: string;
|
|
30
|
+
mime_type?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface Message {
|
|
33
|
+
id: string;
|
|
34
|
+
conversation_id: string;
|
|
35
|
+
author_id: string;
|
|
36
|
+
author?: User;
|
|
37
|
+
body?: string;
|
|
38
|
+
reply_to_id?: string | null;
|
|
39
|
+
reply_to?: ReplyToPreview | null;
|
|
40
|
+
attachments: MessageAttachment[];
|
|
41
|
+
meta: Record<string, unknown>;
|
|
42
|
+
edited_at?: string | null;
|
|
43
|
+
is_deleted: boolean;
|
|
44
|
+
created_at: string;
|
|
45
|
+
updated_at: string;
|
|
46
|
+
}
|
|
47
|
+
export interface Conversation {
|
|
48
|
+
id: string;
|
|
49
|
+
type: 'dm' | 'group';
|
|
50
|
+
title?: string | null;
|
|
51
|
+
description?: string | null;
|
|
52
|
+
folder_id?: string | null;
|
|
53
|
+
is_request?: boolean;
|
|
54
|
+
participants: Participant[];
|
|
55
|
+
last_message?: Message | null;
|
|
56
|
+
unread_count: number;
|
|
57
|
+
is_muted: boolean;
|
|
58
|
+
muted_until?: string | null;
|
|
59
|
+
is_pinned?: boolean;
|
|
60
|
+
is_archived?: boolean;
|
|
61
|
+
created_at: string;
|
|
62
|
+
updated_at: string;
|
|
63
|
+
}
|
|
64
|
+
export interface ConversationFolder {
|
|
65
|
+
id: string;
|
|
66
|
+
name: string;
|
|
67
|
+
color?: string | null;
|
|
68
|
+
icon?: string | null;
|
|
69
|
+
sort_order: number;
|
|
70
|
+
conversation_count: number;
|
|
71
|
+
unread_count: number;
|
|
72
|
+
created_at: string;
|
|
73
|
+
updated_at: string;
|
|
74
|
+
}
|
|
75
|
+
export interface MessageFilters {
|
|
76
|
+
search?: string;
|
|
77
|
+
before?: string;
|
|
78
|
+
after?: string;
|
|
79
|
+
}
|
|
80
|
+
export declare function isConversation(obj: unknown): obj is Conversation;
|
|
81
|
+
export declare function isMessage(obj: unknown): obj is Message;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isAxiosError as axiosIsAxiosError } from 'axios';
|
|
2
|
+
export { axiosIsAxiosError as isAxiosError };
|
|
3
|
+
/**
|
|
4
|
+
* Safely extracts an error message from an unknown error value
|
|
5
|
+
* @param error - The error value (can be anything)
|
|
6
|
+
* @returns A user-friendly error message string
|
|
7
|
+
*/
|
|
8
|
+
export declare function getErrorMessage(error: unknown): string;
|
|
9
|
+
/**
|
|
10
|
+
* Type guard to check if error is an Error instance
|
|
11
|
+
*/
|
|
12
|
+
export declare function isError(error: unknown): error is Error;
|
|
13
|
+
/**
|
|
14
|
+
* Type guard to check if error has a response property (axios-like)
|
|
15
|
+
*/
|
|
16
|
+
export declare function hasResponse(error: unknown): error is {
|
|
17
|
+
response: {
|
|
18
|
+
status?: number;
|
|
19
|
+
data?: {
|
|
20
|
+
message?: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface Logger {
|
|
2
|
+
debug(...args: unknown[]): void;
|
|
3
|
+
info(...args: unknown[]): void;
|
|
4
|
+
warn(...args: unknown[]): void;
|
|
5
|
+
error(...args: unknown[]): void;
|
|
6
|
+
}
|
|
7
|
+
export type CreateLogger = (context: string) => Logger;
|
|
8
|
+
export declare let createLogger: CreateLogger;
|
|
9
|
+
export declare function setLoggerFactory(factory: CreateLogger): void;
|
|
10
|
+
export declare function resetLoggerFactory(): void;
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@codingfactory/messenger-client",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared messaging frontend state, API helpers, and realtime composables.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "vite build && pnpm build:types",
|
|
20
|
+
"build:types": "tsc -p tsconfig.build.json",
|
|
21
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
22
|
+
"lint": "eslint src tests vite.config.ts",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"check": "pnpm lint && pnpm typecheck && pnpm test && pnpm build"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"axios": "^1.13.6"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"pinia": "^3.0.0",
|
|
31
|
+
"vue": "^3.5.0",
|
|
32
|
+
"vue-router": "^4.5.0 || ^5.0.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@eslint/js": "^10.0.1",
|
|
36
|
+
"@types/node": "^25.3.5",
|
|
37
|
+
"eslint": "^10.0.3",
|
|
38
|
+
"globals": "^17.4.0",
|
|
39
|
+
"jsdom": "^28.1.0",
|
|
40
|
+
"pinia": "^3.0.4",
|
|
41
|
+
"typescript": "^5.9.3",
|
|
42
|
+
"typescript-eslint": "^8.56.1",
|
|
43
|
+
"vite": "^7.3.1",
|
|
44
|
+
"vitest": "^4.0.18",
|
|
45
|
+
"vue": "^3.5.29",
|
|
46
|
+
"vue-router": "^5.0.3"
|
|
47
|
+
}
|
|
48
|
+
}
|