@open-core/framework 0.2.6 → 0.2.7
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.
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { InternalEventMap } from '../types/internal-events';
|
|
2
|
-
/**
|
|
3
|
-
* Handler function type for framework events.
|
|
4
|
-
* Accepts the event payload and returns void or Promise<void>.
|
|
5
|
-
*/
|
|
6
|
-
type FrameworkEventHandler<K extends keyof InternalEventMap> = (payload: InternalEventMap[K]) => void | Promise<void>;
|
|
7
2
|
/**
|
|
8
3
|
* Registers a method as a listener for an internal OpenCore framework event.
|
|
9
4
|
*
|
|
@@ -11,21 +6,19 @@ type FrameworkEventHandler<K extends keyof InternalEventMap> = (payload: Interna
|
|
|
11
6
|
* This decorator only stores metadata. The framework binds listeners during bootstrap by scanning
|
|
12
7
|
* controller methods.
|
|
13
8
|
*
|
|
14
|
-
* The
|
|
15
|
-
* the handler parameter type doesn't match the expected payload for the specified event.
|
|
9
|
+
* The handler should accept the payload type corresponding to the event from {@link InternalEventMap}.
|
|
16
10
|
*
|
|
17
|
-
* @param event -
|
|
11
|
+
* @param event - Internal event name, strongly typed to {@link InternalEventMap}.
|
|
18
12
|
*
|
|
19
13
|
* @example
|
|
20
14
|
* ```ts
|
|
21
15
|
* @Server.Controller()
|
|
22
16
|
* export class SystemController {
|
|
23
|
-
* @Server.OnFrameworkEvent('
|
|
24
|
-
*
|
|
25
|
-
* console.log(`Player ${payload.clientId} connected`)
|
|
17
|
+
* @Server.OnFrameworkEvent('internal:playerFullyConnected')
|
|
18
|
+
* onPlayerConnected(payload: PlayerFullyConnectedPayload) {
|
|
19
|
+
* console.log(`Player ${payload.player.session.clientId} connected`)
|
|
26
20
|
* }
|
|
27
21
|
* }
|
|
28
22
|
* ```
|
|
29
23
|
*/
|
|
30
|
-
export declare function OnFrameworkEvent<K extends keyof InternalEventMap>(event: K): (target: object, propertyKey: string | symbol, _descriptor:
|
|
31
|
-
export {};
|
|
24
|
+
export declare function OnFrameworkEvent<K extends keyof InternalEventMap>(event: K): (target: object, propertyKey: string | symbol, _descriptor: PropertyDescriptor) => void;
|
|
@@ -9,18 +9,17 @@ const metadata_server_keys_1 = require("../system/metadata-server.keys");
|
|
|
9
9
|
* This decorator only stores metadata. The framework binds listeners during bootstrap by scanning
|
|
10
10
|
* controller methods.
|
|
11
11
|
*
|
|
12
|
-
* The
|
|
13
|
-
* the handler parameter type doesn't match the expected payload for the specified event.
|
|
12
|
+
* The handler should accept the payload type corresponding to the event from {@link InternalEventMap}.
|
|
14
13
|
*
|
|
15
|
-
* @param event -
|
|
14
|
+
* @param event - Internal event name, strongly typed to {@link InternalEventMap}.
|
|
16
15
|
*
|
|
17
16
|
* @example
|
|
18
17
|
* ```ts
|
|
19
18
|
* @Server.Controller()
|
|
20
19
|
* export class SystemController {
|
|
21
|
-
* @Server.OnFrameworkEvent('
|
|
22
|
-
*
|
|
23
|
-
* console.log(`Player ${payload.clientId} connected`)
|
|
20
|
+
* @Server.OnFrameworkEvent('internal:playerFullyConnected')
|
|
21
|
+
* onPlayerConnected(payload: PlayerFullyConnectedPayload) {
|
|
22
|
+
* console.log(`Player ${payload.player.session.clientId} connected`)
|
|
24
23
|
* }
|
|
25
24
|
* }
|
|
26
25
|
* ```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-core/framework",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Secure, Event-Driven, OOP Engine for FiveM. Stop scripting, start engineering.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -82,19 +82,19 @@
|
|
|
82
82
|
"reflect-metadata": "^0.2.2",
|
|
83
83
|
"tsyringe": "^4.10.0",
|
|
84
84
|
"uuid": "^13.0.0",
|
|
85
|
-
"zod": "^4.
|
|
85
|
+
"zod": "^4.3.5"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
|
-
"@biomejs/biome": "^2.3.
|
|
88
|
+
"@biomejs/biome": "^2.3.11",
|
|
89
89
|
"@citizenfx/client": "2.0.22443-1",
|
|
90
90
|
"@citizenfx/server": "2.0.22443-1",
|
|
91
|
-
"@types/node": "^
|
|
92
|
-
"@vitest/coverage-v8": "^4.0.
|
|
91
|
+
"@types/node": "^25.0.3",
|
|
92
|
+
"@vitest/coverage-v8": "^4.0.16",
|
|
93
93
|
"eslint-config-prettier": "^10.1.8",
|
|
94
94
|
"eslint-plugin-import": "^2.32.0",
|
|
95
|
-
"tinybench": "^2.
|
|
96
|
-
"tsx": "^4.
|
|
95
|
+
"tinybench": "^2.9.0",
|
|
96
|
+
"tsx": "^4.21.0",
|
|
97
97
|
"typescript": "^5.9.3",
|
|
98
|
-
"vitest": "^4.0.
|
|
98
|
+
"vitest": "^4.0.16"
|
|
99
99
|
}
|
|
100
100
|
}
|