@jomkv/keybud-v2-contracts 1.0.0 → 1.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.
- package/README.md +4 -98
- package/package.json +5 -6
- package/src/ws/auth/events.ts +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# KeyBud V2 Contracts
|
|
2
2
|
|
|
3
|
-
Shared TypeScript contracts and type definitions for KeyBud V2
|
|
3
|
+
Shared TypeScript contracts and type definitions for KeyBud V2.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
This package contains shared contracts for WebSocket events, payloads, and other common types used across the KeyBud V2 ecosystem. It ensures type safety and consistency between the
|
|
7
|
+
This package contains shared contracts for WebSocket events, payloads, and other common types used across the KeyBud V2 ecosystem. It ensures type safety and consistency between the
|
|
8
|
+
two repositories.
|
|
8
9
|
|
|
9
10
|
## Installation
|
|
10
11
|
|
|
@@ -39,102 +40,7 @@ Handles authentication-related WebSocket events:
|
|
|
39
40
|
|
|
40
41
|
- **Events**:
|
|
41
42
|
- `AuthClientToServerEvents` - Client-to-server event types
|
|
42
|
-
- `
|
|
43
|
-
|
|
44
|
-
- **Payloads**: `AuthSubscribePayload`, `AuthSubscribeSuccessPayload`
|
|
45
|
-
|
|
46
|
-
#### Messages (`ws/messages`)
|
|
47
|
-
|
|
48
|
-
Handles messaging-related WebSocket events:
|
|
49
|
-
|
|
50
|
-
- **Event Names**: `MESSAGE_EVENT_NAMES`
|
|
51
|
-
- `SUBSCRIBE` - Client subscribes to messages
|
|
52
|
-
- `NEW_MESSAGE` - Server sends new message
|
|
53
|
-
|
|
54
|
-
- **Events**:
|
|
55
|
-
- `MessageClientToServerEvents` - Client-to-server event types
|
|
56
|
-
- `MessageServerToClientEvents` - Server-to-client event types
|
|
57
|
-
|
|
58
|
-
- **Payloads**: `MessageSubscribePayload`, `NewMessagePayload`
|
|
59
|
-
|
|
60
|
-
## Development
|
|
61
|
-
|
|
62
|
-
### Prerequisites
|
|
63
|
-
|
|
64
|
-
- Node.js >= 14.17
|
|
65
|
-
- pnpm 10.17.0
|
|
66
|
-
|
|
67
|
-
### Scripts
|
|
68
|
-
|
|
69
|
-
```sh
|
|
70
|
-
# Run tests (not yet implemented)
|
|
71
|
-
pnpm test
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Project Configuration
|
|
75
|
-
|
|
76
|
-
- **TypeScript**: Strict mode enabled with modern module resolution
|
|
77
|
-
- **Package Manager**: pnpm with workspace support
|
|
78
|
-
- **Module System**: ES Modules
|
|
79
|
-
|
|
80
|
-
## Contributing
|
|
81
|
-
|
|
82
|
-
1. Fork the repository
|
|
83
|
-
2. Create your feature branch
|
|
84
|
-
3. Add your contracts to the appropriate directory under `src/`
|
|
85
|
-
4. Export new contracts from `src/index.ts`
|
|
86
|
-
5. Submit a pull request
|
|
87
|
-
|
|
88
|
-
## License
|
|
89
|
-
|
|
90
|
-
MIT © Jom Karlo Verzosa
|
|
91
|
-
|
|
92
|
-
## Repository
|
|
93
|
-
|
|
94
|
-
[https://github.com/jomkv/keybud-v2-contracts](https://github.com/jomkv/keybud-v2-contracts)
|
|
95
|
-
|
|
96
|
-
````# KeyBud V2 Contracts
|
|
97
|
-
|
|
98
|
-
Shared TypeScript contracts and type definitions for KeyBud V2, providing type-safe communication between frontend and backend applications.
|
|
99
|
-
|
|
100
|
-
## Overview
|
|
101
|
-
|
|
102
|
-
This package contains shared contracts for WebSocket events, payloads, and other common types used across the KeyBud V2 ecosystem. It ensures type safety and consistency between the frontend and backend implementations.
|
|
103
|
-
|
|
104
|
-
## Installation
|
|
105
|
-
|
|
106
|
-
```sh
|
|
107
|
-
pnpm add @jomkv/keybud-v2-contracts
|
|
108
|
-
````
|
|
109
|
-
|
|
110
|
-
## Usage
|
|
111
|
-
|
|
112
|
-
```typescript
|
|
113
|
-
import {
|
|
114
|
-
AUTH_EVENT_NAMES,
|
|
115
|
-
MESSAGE_EVENT_NAMES,
|
|
116
|
-
type AuthClientToServerEvents,
|
|
117
|
-
type MessageServerToClientEvents,
|
|
118
|
-
type NewMessagePayload,
|
|
119
|
-
} from "@jomkv/keybud-v2-contracts";
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
## Structure
|
|
123
|
-
|
|
124
|
-
### WebSocket Contracts
|
|
125
|
-
|
|
126
|
-
#### Authentication (`ws/auth`)
|
|
127
|
-
|
|
128
|
-
Handles authentication-related WebSocket events:
|
|
129
|
-
|
|
130
|
-
- **Event Names**: `AUTH_EVENT_NAMES`
|
|
131
|
-
- `SUBSCRIBE` - Client subscribes to auth events
|
|
132
|
-
- `SUBSCRIBE_SUCCESS` - Server confirms subscription
|
|
133
|
-
- `COMPLETE` - Client completes login
|
|
134
|
-
|
|
135
|
-
- **Events**:
|
|
136
|
-
- `AuthClientToServerEvents` - Client-to-server event types
|
|
137
|
-
- `ServerToClientEvents` - Server-to-client event types
|
|
43
|
+
- `AuthServerToClientEvents` - Server-to-client event types
|
|
138
44
|
|
|
139
45
|
- **Payloads**: `AuthSubscribePayload`, `AuthSubscribeSuccessPayload`
|
|
140
46
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jomkv/keybud-v2-contracts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/jomkv/keybud-v2-contracts#readme",
|
|
@@ -15,13 +15,12 @@
|
|
|
15
15
|
"author": "Jom Karlo Verzosa",
|
|
16
16
|
"type": "module",
|
|
17
17
|
"main": "index.js",
|
|
18
|
-
"scripts": {
|
|
19
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
20
|
-
},
|
|
21
18
|
"devDependencies": {
|
|
22
19
|
"@types/node": "^25.0.8",
|
|
23
20
|
"ts-node": "^10.9.2",
|
|
24
21
|
"typescript": "^5.9.3"
|
|
25
22
|
},
|
|
26
|
-
"
|
|
27
|
-
|
|
23
|
+
"scripts": {
|
|
24
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
25
|
+
}
|
|
26
|
+
}
|
package/src/ws/auth/events.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface AuthClientToServerEvents {
|
|
|
8
8
|
[AUTH_EVENT_NAMES.SUBSCRIBE]: AuthSubscribePayload;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export interface
|
|
11
|
+
export interface AuthServerToClientEvents {
|
|
12
12
|
[AUTH_EVENT_NAMES.SUBSCRIBE_SUCCESS]: AuthSubscribeSuccessPayload;
|
|
13
13
|
[AUTH_EVENT_NAMES.COMPLETE]: {};
|
|
14
14
|
}
|