@open-core/framework 1.0.1-beta.1 → 1.0.2-beta.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 +10 -0
- package/dist/server/bootstrap.js +2 -2
- package/dist/server/controllers/command.controller.d.ts +1 -1
- package/dist/server/controllers/command.controller.js +6 -6
- package/dist/server/decorators/command.d.ts +34 -4
- package/dist/server/decorators/command.js +11 -6
- package/dist/server/decorators/controller.d.ts +22 -0
- package/dist/server/decorators/controller.js +22 -0
- package/dist/server/decorators/coreEvent.d.ts +20 -0
- package/dist/server/decorators/coreEvent.js +20 -0
- package/dist/server/decorators/export.d.ts +38 -0
- package/dist/server/decorators/export.js +38 -0
- package/dist/server/decorators/guard.d.ts +51 -0
- package/dist/server/decorators/guard.js +43 -0
- package/dist/server/decorators/index.d.ts +3 -3
- package/dist/server/decorators/index.js +6 -3
- package/dist/server/decorators/onNet.d.ts +58 -0
- package/dist/server/decorators/onNet.js +57 -0
- package/dist/server/decorators/onTick.d.ts +31 -0
- package/dist/server/decorators/onTick.js +31 -0
- package/dist/server/decorators/public.d.ts +19 -8
- package/dist/server/decorators/public.js +19 -8
- package/dist/server/decorators/requiresState.d.ts +18 -17
- package/dist/server/decorators/requiresState.js +18 -17
- package/dist/server/decorators/throttle.d.ts +39 -0
- package/dist/server/decorators/throttle.js +27 -0
- package/dist/server/decorators/utils.d.ts +50 -0
- package/dist/server/decorators/utils.js +50 -0
- package/dist/server/error-handler.js +2 -2
- package/dist/server/services/command.service.d.ts +1 -1
- package/dist/server/services/command.service.js +9 -6
- package/dist/server/system/processors/command.processor.d.ts +2 -2
- package/dist/server/system/processors/command.processor.js +1 -2
- package/dist/server/system/processors/netEvent.processor.js +5 -4
- package/dist/server/system/schema-generator.d.ts +2 -0
- package/dist/server/system/schema-generator.js +28 -0
- package/dist/server/templates/admin/admin.controller-template.d.ts +7 -5
- package/package.json +19 -1
- package/dist/server/decorators/netEvent.d.ts +0 -36
- package/dist/server/decorators/netEvent.js +0 -40
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { z } from 'zod';
|
|
2
|
-
export interface NetEventOptions {
|
|
3
|
-
eventName: string;
|
|
4
|
-
schema?: z.ZodType;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Decorator used to register a server-side NetEvent handler.
|
|
8
|
-
*
|
|
9
|
-
* ## Player Injection
|
|
10
|
-
* The handler method will **always receive a `ServerPlayer` instance as its
|
|
11
|
-
* first argument**, automatically resolved by the Core based on the client
|
|
12
|
-
* that triggered the event.
|
|
13
|
-
*
|
|
14
|
-
* This means you do NOT need to read `source`, `global.source` or call
|
|
15
|
-
* `GetPlayerIdentifier()`: the Core resolves the player for you.
|
|
16
|
-
*
|
|
17
|
-
* ## Example
|
|
18
|
-
* ```ts
|
|
19
|
-
* export class AuthServerController {
|
|
20
|
-
* @OnNet('auth:loginAttempt')
|
|
21
|
-
* handleLogin(player: ServerPlayer, username: string, password: string) {
|
|
22
|
-
* console.log(player.name, 'is trying to log in');
|
|
23
|
-
* }
|
|
24
|
-
* }
|
|
25
|
-
* ```
|
|
26
|
-
*
|
|
27
|
-
* ## Event Arguments
|
|
28
|
-
* Any arguments sent from the client will be passed **after** the `ServerPlayer`
|
|
29
|
-
* instance:
|
|
30
|
-
*
|
|
31
|
-
* client → emitNet("auth:loginAttempt", username, password)
|
|
32
|
-
* server → handler(player, username, password)
|
|
33
|
-
*
|
|
34
|
-
* @param eventName - The name of the network event to listen for.
|
|
35
|
-
*/
|
|
36
|
-
export declare function OnNet(eventName: string, schema?: z.ZodType): (target: any, propertyKey: string) => void;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OnNet = OnNet;
|
|
4
|
-
const metadata_server_keys_1 = require("../system/metadata-server.keys");
|
|
5
|
-
/**
|
|
6
|
-
* Decorator used to register a server-side NetEvent handler.
|
|
7
|
-
*
|
|
8
|
-
* ## Player Injection
|
|
9
|
-
* The handler method will **always receive a `ServerPlayer` instance as its
|
|
10
|
-
* first argument**, automatically resolved by the Core based on the client
|
|
11
|
-
* that triggered the event.
|
|
12
|
-
*
|
|
13
|
-
* This means you do NOT need to read `source`, `global.source` or call
|
|
14
|
-
* `GetPlayerIdentifier()`: the Core resolves the player for you.
|
|
15
|
-
*
|
|
16
|
-
* ## Example
|
|
17
|
-
* ```ts
|
|
18
|
-
* export class AuthServerController {
|
|
19
|
-
* @OnNet('auth:loginAttempt')
|
|
20
|
-
* handleLogin(player: ServerPlayer, username: string, password: string) {
|
|
21
|
-
* console.log(player.name, 'is trying to log in');
|
|
22
|
-
* }
|
|
23
|
-
* }
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* ## Event Arguments
|
|
27
|
-
* Any arguments sent from the client will be passed **after** the `ServerPlayer`
|
|
28
|
-
* instance:
|
|
29
|
-
*
|
|
30
|
-
* client → emitNet("auth:loginAttempt", username, password)
|
|
31
|
-
* server → handler(player, username, password)
|
|
32
|
-
*
|
|
33
|
-
* @param eventName - The name of the network event to listen for.
|
|
34
|
-
*/
|
|
35
|
-
function OnNet(eventName, schema) {
|
|
36
|
-
return (target, propertyKey) => {
|
|
37
|
-
const metadata = { eventName, schema };
|
|
38
|
-
Reflect.defineMetadata(metadata_server_keys_1.METADATA_KEYS.NET_EVENT, metadata, target, propertyKey);
|
|
39
|
-
};
|
|
40
|
-
}
|