@open-core/framework 0.2.2-beta.1 → 0.2.5
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/LICENSE +373 -373
- package/README.md +217 -217
- package/dist/adapters/node/node-entity-server.js +3 -0
- package/dist/adapters/node/node-exports.d.ts +2 -2
- package/dist/kernel/utils/vector3.d.ts +1 -0
- package/dist/kernel/utils/vector3.js +1 -0
- package/dist/runtime/client/services/appearance.service.js +4 -0
- package/dist/runtime/server/bootstrap.js +1 -1
- package/dist/runtime/server/bootstrap.validation.js +2 -0
- package/dist/runtime/server/bus/internal-event.bus.d.ts +6 -0
- package/dist/runtime/server/bus/{core-event-bus.js → internal-event.bus.js} +5 -2
- package/dist/runtime/server/controllers/principal-export.controller.js +1 -1
- package/dist/runtime/server/controllers/session.controller.js +4 -4
- package/dist/runtime/server/decorators/onFrameworkEvent.d.ts +15 -6
- package/dist/runtime/server/decorators/onFrameworkEvent.js +9 -6
- package/dist/runtime/server/decorators/throttle.js +3 -1
- package/dist/runtime/server/entities/player.d.ts +6 -0
- package/dist/runtime/server/entities/player.js +12 -0
- package/dist/runtime/server/helpers/command-validation.helper.d.ts +1 -1
- package/dist/runtime/server/helpers/function-helper.d.ts +1 -1
- package/dist/runtime/server/index.d.ts +2 -1
- package/dist/runtime/server/index.js +3 -1
- package/dist/runtime/server/services/core/command.service.d.ts +1 -1
- package/dist/runtime/server/services/core/player.service.d.ts +0 -11
- package/dist/runtime/server/services/core/player.service.js +0 -15
- package/dist/runtime/server/services/parallel/worker-pool.js +4 -0
- package/dist/runtime/server/services/ports/command-execution.port.d.ts +1 -1
- package/dist/runtime/server/services/ports/player-session-lifecycle.port.d.ts +0 -12
- package/dist/runtime/server/services/remote/remote-command.service.d.ts +1 -1
- package/dist/runtime/server/services/services.register.js +2 -2
- package/dist/runtime/server/system/metadata-server.keys.d.ts +1 -1
- package/dist/runtime/server/system/metadata-server.keys.js +10 -10
- package/dist/runtime/server/system/processors/{coreEvent.processor.d.ts → internalEvent.processor.d.ts} +1 -1
- package/dist/runtime/server/system/processors/{coreEvent.processor.js → internalEvent.processor.js} +10 -10
- package/dist/runtime/server/system/processors.register.js +2 -2
- package/dist/runtime/server/types/index.d.ts +1 -1
- package/dist/runtime/server/types/index.js +1 -1
- package/dist/runtime/server/types/internal-events.d.ts +19 -0
- package/package.json +100 -99
- package/dist/kernel/di/tokens.d.ts +0 -30
- package/dist/kernel/di/tokens.js +0 -38
- package/dist/runtime/client/interfaces/appearance.interface.d.ts +0 -25
- package/dist/runtime/client/interfaces/appearance.interface.js +0 -2
- package/dist/runtime/server/bus/core-event-bus.d.ts +0 -6
- package/dist/runtime/server/controllers/command.controller.d.ts +0 -15
- package/dist/runtime/server/controllers/command.controller.js +0 -100
- package/dist/runtime/server/services/access-control.service.d.ts +0 -59
- package/dist/runtime/server/services/access-control.service.js +0 -127
- package/dist/runtime/server/services/core/vehicle-modification.service.d.ts +0 -104
- package/dist/runtime/server/services/core/vehicle-modification.service.js +0 -330
- package/dist/runtime/server/services/core/vehicle.service.d.ts +0 -128
- package/dist/runtime/server/services/core/vehicle.service.js +0 -391
- package/dist/runtime/server/services/remote/remote-principal.provider.d.ts +0 -55
- package/dist/runtime/server/services/remote/remote-principal.provider.js +0 -130
- package/dist/runtime/server/types/core-events.d.ts +0 -22
- /package/dist/runtime/server/types/{core-events.js → internal-events.js} +0 -0
|
@@ -43,6 +43,7 @@ const metadata_server_keys_1 = require("../system/metadata-server.keys");
|
|
|
43
43
|
*/
|
|
44
44
|
function Throttle(optionsOrLimit, windowMs) {
|
|
45
45
|
return (target, propertyKey, descriptor) => {
|
|
46
|
+
var _a;
|
|
46
47
|
if (!descriptor) {
|
|
47
48
|
// In benchmarks or edge cases, skip method wrapping
|
|
48
49
|
// This should NOT happen in production code with proper TypeScript compilation
|
|
@@ -57,6 +58,7 @@ function Throttle(optionsOrLimit, windowMs) {
|
|
|
57
58
|
else {
|
|
58
59
|
opts = Object.assign({ onExceed: 'LOG' }, optionsOrLimit);
|
|
59
60
|
}
|
|
61
|
+
const onExceed = (_a = opts.onExceed) !== null && _a !== void 0 ? _a : 'LOG';
|
|
60
62
|
// Store metadata for remote transmission
|
|
61
63
|
Reflect.defineMetadata(metadata_server_keys_1.METADATA_KEYS.THROTTLE, opts, target, propertyKey);
|
|
62
64
|
descriptor.value = async function (...args) {
|
|
@@ -65,7 +67,7 @@ function Throttle(optionsOrLimit, windowMs) {
|
|
|
65
67
|
const service = tsyringe_1.container.resolve(rate_limiter_service_1.RateLimiterService);
|
|
66
68
|
const key = `${player.clientID}:${target.constructor.name}:${propertyKey}`;
|
|
67
69
|
if (!service.checkLimit(key, opts.limit, opts.windowMs)) {
|
|
68
|
-
throw new security_error_1.SecurityError(
|
|
70
|
+
throw new security_error_1.SecurityError(onExceed, opts.message || `Rate limit exceeded on ${propertyKey}`, { limit: opts.limit, key });
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
return originalMethod.apply(this, args);
|
|
@@ -65,6 +65,11 @@ export declare class Player {
|
|
|
65
65
|
* @returns An array of identifier strings (e.g., `['steam:11000...', 'license:2332...']`).
|
|
66
66
|
*/
|
|
67
67
|
getIdentifiers(): string[];
|
|
68
|
+
/**
|
|
69
|
+
* FiveM license
|
|
70
|
+
*/
|
|
71
|
+
getLicense(): string | undefined;
|
|
72
|
+
getIdentifier(identifier: string): string | undefined;
|
|
68
73
|
/**
|
|
69
74
|
* Sends a network event exclusively to this specific player (Client-side).
|
|
70
75
|
* Wrapper for `emitNet` ensuring the correct target Source ID is used.
|
|
@@ -130,6 +135,7 @@ export declare class Player {
|
|
|
130
135
|
* @param accountID - The unique ID from the database.
|
|
131
136
|
*/
|
|
132
137
|
linkAccount(accountID: LinkedID): void;
|
|
138
|
+
unlinkAccount(): void;
|
|
133
139
|
/**
|
|
134
140
|
* Checks if the player currently possesses a specific state flag.
|
|
135
141
|
*
|
|
@@ -67,6 +67,15 @@ class Player {
|
|
|
67
67
|
getIdentifiers() {
|
|
68
68
|
return this.adapters.playerServer.getIdentifiers(this.clientIDStr);
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* FiveM license
|
|
72
|
+
*/
|
|
73
|
+
getLicense() {
|
|
74
|
+
return this.adapters.playerServer.getIdentifier(this.clientIDStr, 'license');
|
|
75
|
+
}
|
|
76
|
+
getIdentifier(identifier) {
|
|
77
|
+
return this.adapters.playerServer.getIdentifier(this.clientIDStr, identifier);
|
|
78
|
+
}
|
|
70
79
|
/**
|
|
71
80
|
* Sends a network event exclusively to this specific player (Client-side).
|
|
72
81
|
* Wrapper for `emitNet` ensuring the correct target Source ID is used.
|
|
@@ -153,6 +162,9 @@ class Player {
|
|
|
153
162
|
linkAccount(accountID) {
|
|
154
163
|
this.session.accountID = accountID;
|
|
155
164
|
}
|
|
165
|
+
unlinkAccount() {
|
|
166
|
+
this.session.accountID = undefined;
|
|
167
|
+
}
|
|
156
168
|
/**
|
|
157
169
|
* Checks if the player currently possesses a specific state flag.
|
|
158
170
|
*
|
|
@@ -3,4 +3,4 @@ import { Player } from '../entities';
|
|
|
3
3
|
/**
|
|
4
4
|
* Centraliza validación de argumentos de comandos.
|
|
5
5
|
*/
|
|
6
|
-
export declare function validateAndExecuteCommand(meta: CommandMetadata, player: Player, args: string[], handler:
|
|
6
|
+
export declare function validateAndExecuteCommand(meta: CommandMetadata, player: Player, args: string[], handler: (...args: any[]) => any): Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getParameterNames(func:
|
|
1
|
+
export declare function getParameterNames(func: (...args: any[]) => any): string[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './bootstrap.validation';
|
|
2
|
+
export { onFrameworkEvent } from './bus/internal-event.bus';
|
|
2
3
|
export * from './configs';
|
|
3
4
|
export * from './contracts/index';
|
|
4
5
|
export { init } from './core';
|
|
@@ -9,4 +10,4 @@ export * from './runtime';
|
|
|
9
10
|
export * from './services';
|
|
10
11
|
export * from './setup';
|
|
11
12
|
export * from './templates';
|
|
12
|
-
export type * from './types/
|
|
13
|
+
export type * from './types/internal-events';
|
|
@@ -15,8 +15,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.init = void 0;
|
|
18
|
+
exports.init = exports.onFrameworkEvent = void 0;
|
|
19
19
|
__exportStar(require("./bootstrap.validation"), exports);
|
|
20
|
+
var internal_event_bus_1 = require("./bus/internal-event.bus");
|
|
21
|
+
Object.defineProperty(exports, "onFrameworkEvent", { enumerable: true, get: function () { return internal_event_bus_1.onFrameworkEvent; } });
|
|
20
22
|
// Configs
|
|
21
23
|
__exportStar(require("./configs"), exports);
|
|
22
24
|
__exportStar(require("./contracts/index"), exports);
|
|
@@ -22,7 +22,7 @@ export declare class CommandService extends CommandExecutionPort {
|
|
|
22
22
|
* @param meta - Command metadata collected from the {@link Command} decorator.
|
|
23
23
|
* @param handler - The bound method to invoke.
|
|
24
24
|
*/
|
|
25
|
-
register(meta: CommandMetadata, handler:
|
|
25
|
+
register(meta: CommandMetadata, handler: (...args: any[]) => any): void;
|
|
26
26
|
/**
|
|
27
27
|
* Executes a registered command.
|
|
28
28
|
*
|
|
@@ -5,7 +5,6 @@ import { IPlayerServer } from '../../../../adapters/contracts/IPlayerServer';
|
|
|
5
5
|
import { Player } from '../../entities';
|
|
6
6
|
import { PlayerDirectoryPort } from '../ports/player-directory.port';
|
|
7
7
|
import { PlayerSessionLifecyclePort } from '../ports/player-session-lifecycle.port';
|
|
8
|
-
import { LinkedID } from '../types/linked-id';
|
|
9
8
|
import { PlayerSession } from '../types/player-session.object';
|
|
10
9
|
/**
|
|
11
10
|
* Service responsible for managing the lifecycle of player sessions.
|
|
@@ -41,16 +40,6 @@ export declare class PlayerService implements PlayerDirectoryPort, PlayerSession
|
|
|
41
40
|
* @returns The newly created `Player` instance.
|
|
42
41
|
*/
|
|
43
42
|
bind(clientID: number, identifiers?: PlayerSession['identifiers']): Player;
|
|
44
|
-
/**
|
|
45
|
-
* Associates an authenticated Account ID (database ID) with an active player session.
|
|
46
|
-
*
|
|
47
|
-
* Call this method once the player has successfully authenticated (e.g., after character selection
|
|
48
|
-
* or login) to link their session to their persistent data.
|
|
49
|
-
*
|
|
50
|
-
* @param clientID - The FiveM server ID of the player.
|
|
51
|
-
* @param accountID - The unique identifier from your database/persistence layer.
|
|
52
|
-
*/
|
|
53
|
-
linkAccount(clientID: number, accountID: LinkedID): void;
|
|
54
43
|
/**
|
|
55
44
|
* Terminates a player session and removes them from the registry.
|
|
56
45
|
*
|
|
@@ -70,21 +70,6 @@ let PlayerService = class PlayerService {
|
|
|
70
70
|
});
|
|
71
71
|
return player;
|
|
72
72
|
}
|
|
73
|
-
/**
|
|
74
|
-
* Associates an authenticated Account ID (database ID) with an active player session.
|
|
75
|
-
*
|
|
76
|
-
* Call this method once the player has successfully authenticated (e.g., after character selection
|
|
77
|
-
* or login) to link their session to their persistent data.
|
|
78
|
-
*
|
|
79
|
-
* @param clientID - The FiveM server ID of the player.
|
|
80
|
-
* @param accountID - The unique identifier from your database/persistence layer.
|
|
81
|
-
*/
|
|
82
|
-
linkAccount(clientID, accountID) {
|
|
83
|
-
const player = this.playersByClient.get(clientID);
|
|
84
|
-
if (!player)
|
|
85
|
-
return;
|
|
86
|
-
player.linkAccount(accountID);
|
|
87
|
-
}
|
|
88
73
|
/**
|
|
89
74
|
* Terminates a player session and removes them from the registry.
|
|
90
75
|
*
|
|
@@ -305,12 +305,16 @@ class WorkerPool extends SimpleEventEmitter {
|
|
|
305
305
|
const idleWorker = this.findIdleWorker();
|
|
306
306
|
if (idleWorker) {
|
|
307
307
|
const task = this.taskQueue.shift();
|
|
308
|
+
if (!task)
|
|
309
|
+
break;
|
|
308
310
|
this.assignTask(idleWorker, task);
|
|
309
311
|
}
|
|
310
312
|
else if (this.workers.size < this.config.maxWorkers) {
|
|
311
313
|
const newWorker = this.spawnWorker();
|
|
312
314
|
if (newWorker) {
|
|
313
315
|
const task = this.taskQueue.shift();
|
|
316
|
+
if (!task)
|
|
317
|
+
break;
|
|
314
318
|
this.assignTask(newWorker, task);
|
|
315
319
|
}
|
|
316
320
|
else {
|
|
@@ -25,7 +25,7 @@ export declare abstract class CommandExecutionPort {
|
|
|
25
25
|
* @param metadata - Command metadata from decorator
|
|
26
26
|
* @param handler - Bound method to invoke when command is executed
|
|
27
27
|
*/
|
|
28
|
-
abstract register(metadata: CommandMetadata, handler:
|
|
28
|
+
abstract register(metadata: CommandMetadata, handler: (...args: any[]) => any): void;
|
|
29
29
|
/**
|
|
30
30
|
* Executes a registered command.
|
|
31
31
|
*
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Player } from '../../entities';
|
|
2
|
-
import { LinkedID } from '../types/linked-id';
|
|
3
2
|
import { PlayerSession } from '../types/player-session.object';
|
|
4
3
|
/**
|
|
5
4
|
* Core port responsible for managing the lifecycle of player sessions.
|
|
@@ -35,15 +34,4 @@ export declare abstract class PlayerSessionLifecyclePort {
|
|
|
35
34
|
* @param clientID - The FiveM server client ID (`source`).
|
|
36
35
|
*/
|
|
37
36
|
abstract unbind(clientID: number): void;
|
|
38
|
-
/**
|
|
39
|
-
* Links an authenticated account to an existing player session.
|
|
40
|
-
*
|
|
41
|
-
* @remarks
|
|
42
|
-
* This method is typically invoked after successful authentication or
|
|
43
|
-
* character selection to associate persistent data with the active session.
|
|
44
|
-
*
|
|
45
|
-
* @param clientID - The FiveM server client ID (`source`).
|
|
46
|
-
* @param accountID - The persistent account identifier.
|
|
47
|
-
*/
|
|
48
|
-
abstract linkAccount(clientID: number, accountID: LinkedID): void;
|
|
49
37
|
}
|
|
@@ -36,7 +36,7 @@ export declare class RemoteCommandService extends CommandExecutionPort {
|
|
|
36
36
|
* The handler and full metadata are stored locally for schema validation.
|
|
37
37
|
* Only serializable metadata is sent to CORE for security validation.
|
|
38
38
|
*/
|
|
39
|
-
register(metadata: CommandMetadata, handler:
|
|
39
|
+
register(metadata: CommandMetadata, handler: (...args: any[]) => any): void;
|
|
40
40
|
/**
|
|
41
41
|
* Executes a command handler stored in this resource.
|
|
42
42
|
*
|
|
@@ -9,13 +9,13 @@ const player_service_1 = require("./core/player.service");
|
|
|
9
9
|
const principal_service_1 = require("./core/principal.service");
|
|
10
10
|
const http_service_1 = require("./http/http.service");
|
|
11
11
|
const persistence_service_1 = require("./persistence.service");
|
|
12
|
-
const
|
|
12
|
+
const command_execution_port_1 = require("./ports/command-execution.port");
|
|
13
13
|
const player_directory_port_1 = require("./ports/player-directory.port");
|
|
14
|
+
const player_session_lifecycle_port_1 = require("./ports/player-session-lifecycle.port");
|
|
14
15
|
const principal_port_1 = require("./ports/principal.port");
|
|
15
16
|
const remote_command_service_1 = require("./remote/remote-command.service");
|
|
16
17
|
const remote_player_service_1 = require("./remote/remote-player.service");
|
|
17
18
|
const remote_principal_service_1 = require("./remote/remote-principal.service");
|
|
18
|
-
const command_execution_port_1 = require("./ports/command-execution.port");
|
|
19
19
|
/**
|
|
20
20
|
* Registers server runtime services in the dependency injection container.
|
|
21
21
|
*
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.METADATA_KEYS = void 0;
|
|
4
4
|
exports.METADATA_KEYS = {
|
|
5
|
-
CONTROLLER: '
|
|
6
|
-
COMMAND: '
|
|
7
|
-
NET_EVENT: '
|
|
8
|
-
TICK: '
|
|
9
|
-
|
|
10
|
-
FIVEM_EVENT: '
|
|
11
|
-
EXPORT: '
|
|
12
|
-
PUBLIC: '
|
|
13
|
-
THROTTLE: '
|
|
14
|
-
REQUIRES_STATE: '
|
|
5
|
+
CONTROLLER: 'decorator:meta:controller',
|
|
6
|
+
COMMAND: 'decorator:meta:command',
|
|
7
|
+
NET_EVENT: 'decorator:meta:net_event',
|
|
8
|
+
TICK: 'decorator:meta:tick',
|
|
9
|
+
INTERNAL_EVENT: 'decorator:meta:internal_event',
|
|
10
|
+
FIVEM_EVENT: 'decorator:meta:fivem_event',
|
|
11
|
+
EXPORT: 'decorator:meta:export',
|
|
12
|
+
PUBLIC: 'decorator:meta:public',
|
|
13
|
+
THROTTLE: 'decorator:throttle',
|
|
14
|
+
REQUIRES_STATE: 'decorator:requires_state',
|
|
15
15
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DecoratorProcessor } from '../../../../kernel/di/decorator-processor';
|
|
2
|
-
export declare class
|
|
2
|
+
export declare class InternalEventProcessor implements DecoratorProcessor {
|
|
3
3
|
readonly metadataKey: string;
|
|
4
4
|
process(instance: any, methodName: string, metadata: {
|
|
5
5
|
event: string;
|
package/dist/runtime/server/system/processors/{coreEvent.processor.js → internalEvent.processor.js}
RENAMED
|
@@ -6,27 +6,27 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.InternalEventProcessor = void 0;
|
|
10
10
|
const tsyringe_1 = require("tsyringe");
|
|
11
11
|
const logger_1 = require("../../../../kernel/shared/logger");
|
|
12
|
-
const
|
|
12
|
+
const internal_event_bus_1 = require("../../bus/internal-event.bus");
|
|
13
13
|
const resolve_method_1 = require("../../helpers/resolve-method");
|
|
14
14
|
const metadata_server_keys_1 = require("../metadata-server.keys");
|
|
15
|
-
let
|
|
15
|
+
let InternalEventProcessor = class InternalEventProcessor {
|
|
16
16
|
constructor() {
|
|
17
|
-
this.metadataKey = metadata_server_keys_1.METADATA_KEYS.
|
|
17
|
+
this.metadataKey = metadata_server_keys_1.METADATA_KEYS.INTERNAL_EVENT;
|
|
18
18
|
}
|
|
19
19
|
process(instance, methodName, metadata) {
|
|
20
|
-
const result = (0, resolve_method_1.resolveMethod)(instance, methodName, `[
|
|
20
|
+
const result = (0, resolve_method_1.resolveMethod)(instance, methodName, `[InternalEventProcessor] Method "${methodName}" not found`);
|
|
21
21
|
if (!result)
|
|
22
22
|
return;
|
|
23
23
|
const { handler, handlerName } = result;
|
|
24
|
-
(0,
|
|
24
|
+
(0, internal_event_bus_1.onFrameworkEvent)(metadata.event, (payload) => {
|
|
25
25
|
try {
|
|
26
26
|
handler(payload);
|
|
27
27
|
}
|
|
28
28
|
catch (error) {
|
|
29
|
-
logger_1.loggers.eventBus.error(`Handler error in
|
|
29
|
+
logger_1.loggers.eventBus.error(`Handler error in InternalEvent`, {
|
|
30
30
|
event: metadata.event,
|
|
31
31
|
handler: handlerName,
|
|
32
32
|
}, error);
|
|
@@ -35,7 +35,7 @@ let CoreEventProcessor = class CoreEventProcessor {
|
|
|
35
35
|
logger_1.loggers.eventBus.debug(`Registered: ${metadata.event} -> ${handlerName}`);
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
38
|
+
exports.InternalEventProcessor = InternalEventProcessor;
|
|
39
|
+
exports.InternalEventProcessor = InternalEventProcessor = __decorate([
|
|
40
40
|
(0, tsyringe_1.injectable)()
|
|
41
|
-
],
|
|
41
|
+
], InternalEventProcessor);
|
|
@@ -7,9 +7,9 @@ const security_handler_contract_1 = require("../contracts/security/security-hand
|
|
|
7
7
|
const default_net_event_security_observer_1 = require("../services/default/default-net-event-security-observer");
|
|
8
8
|
const default_security_handler_1 = require("../services/default/default-security.handler");
|
|
9
9
|
const command_processor_1 = require("./processors/command.processor");
|
|
10
|
-
const coreEvent_processor_1 = require("./processors/coreEvent.processor");
|
|
11
10
|
const export_processor_1 = require("./processors/export.processor");
|
|
12
11
|
const fivemEvent_processor_1 = require("./processors/fivemEvent.processor");
|
|
12
|
+
const internalEvent_processor_1 = require("./processors/internalEvent.processor");
|
|
13
13
|
const netEvent_processor_1 = require("./processors/netEvent.processor");
|
|
14
14
|
const tick_processor_1 = require("./processors/tick.processor");
|
|
15
15
|
function registerSystemServer(ctx) {
|
|
@@ -27,7 +27,7 @@ function registerSystemServer(ctx) {
|
|
|
27
27
|
if (features.exports.enabled) {
|
|
28
28
|
index_1.di.register('DecoratorProcessor', { useClass: export_processor_1.ExportProcessor });
|
|
29
29
|
}
|
|
30
|
-
index_1.di.register('DecoratorProcessor', { useClass:
|
|
30
|
+
index_1.di.register('DecoratorProcessor', { useClass: internalEvent_processor_1.InternalEventProcessor });
|
|
31
31
|
if (features.commands.enabled) {
|
|
32
32
|
index_1.di.register('DecoratorProcessor', { useClass: command_processor_1.CommandProcessor });
|
|
33
33
|
}
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./core-events"), exports);
|
|
18
17
|
__exportStar(require("./core-exports"), exports);
|
|
18
|
+
__exportStar(require("./internal-events"), exports);
|
|
19
19
|
__exportStar(require("./security.types"), exports);
|
|
20
20
|
__exportStar(require("./vehicle.types"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Player } from '../entities';
|
|
2
|
+
export interface PlayerSessionCreatedPayload {
|
|
3
|
+
clientId: number;
|
|
4
|
+
license: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PlayerSessionDestroyedPayload {
|
|
7
|
+
clientId: number;
|
|
8
|
+
}
|
|
9
|
+
export interface TransferCompletedPayload {
|
|
10
|
+
playerId: number;
|
|
11
|
+
amount: number;
|
|
12
|
+
targetId: number;
|
|
13
|
+
}
|
|
14
|
+
export type InternalEventMap = {
|
|
15
|
+
'internal:playerSessionCreated': PlayerSessionCreatedPayload;
|
|
16
|
+
'internal:playerSessionDestroyed': PlayerSessionDestroyedPayload;
|
|
17
|
+
'internal:transfer:completed': TransferCompletedPayload;
|
|
18
|
+
'internal:playerFullyConnected': Player;
|
|
19
|
+
};
|
package/package.json
CHANGED
|
@@ -1,99 +1,100 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@open-core/framework",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Secure, Event-Driven, OOP Engine for FiveM. Stop scripting, start engineering.",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"type": "commonjs",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "https://github.com/newcore-network/opencore.git"
|
|
11
|
-
},
|
|
12
|
-
"homepage": "https://github.com/newcore-network/opencore",
|
|
13
|
-
"bugs": {
|
|
14
|
-
"url": "https://github.com/newcore-network/opencore/issues"
|
|
15
|
-
},
|
|
16
|
-
"files": [
|
|
17
|
-
"dist",
|
|
18
|
-
"README.md",
|
|
19
|
-
"LICENSE"
|
|
20
|
-
],
|
|
21
|
-
"exports": {
|
|
22
|
-
".": {
|
|
23
|
-
"types": "./dist/index.d.ts",
|
|
24
|
-
"import": "./dist/index.js",
|
|
25
|
-
"require": "./dist/index.js"
|
|
26
|
-
},
|
|
27
|
-
"./server": {
|
|
28
|
-
"types": "./dist/runtime/server/index.d.ts",
|
|
29
|
-
"import": "./dist/runtime/server/index.js",
|
|
30
|
-
"require": "./dist/runtime/server/index.js"
|
|
31
|
-
},
|
|
32
|
-
"./client": {
|
|
33
|
-
"types": "./dist/runtime/client/index.d.ts",
|
|
34
|
-
"import": "./dist/runtime/client/index.js",
|
|
35
|
-
"require": "./dist/runtime/client/index.js"
|
|
36
|
-
},
|
|
37
|
-
"./shared": {
|
|
38
|
-
"types": "./dist/kernel/shared/index.d.ts",
|
|
39
|
-
"import": "./dist/kernel/shared/index.js",
|
|
40
|
-
"require": "./dist/kernel/shared/index.js"
|
|
41
|
-
},
|
|
42
|
-
"./utils": {
|
|
43
|
-
"types": "./dist/kernel/utils/index.d.ts",
|
|
44
|
-
"import": "./dist/kernel/utils/index.js",
|
|
45
|
-
"require": "./dist/kernel/utils/index.js"
|
|
46
|
-
},
|
|
47
|
-
"./package.json": "./package.json"
|
|
48
|
-
},
|
|
49
|
-
"scripts": {
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"check": "biome check .",
|
|
54
|
-
"check:fix": "biome check --write
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"lint": "biome lint .",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"test": "npx vitest run --project unit --project integration
|
|
61
|
-
"test:watch": "npx vitest --project unit --project integration --project e2e",
|
|
62
|
-
"test:unit": "npx vitest run --project unit",
|
|
63
|
-
"test:integration": "npx vitest run --project integration",
|
|
64
|
-
"test:
|
|
65
|
-
"
|
|
66
|
-
"bench
|
|
67
|
-
"bench:
|
|
68
|
-
"bench:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"@
|
|
89
|
-
"@citizenfx/
|
|
90
|
-
"@
|
|
91
|
-
"@
|
|
92
|
-
"
|
|
93
|
-
"eslint-
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@open-core/framework",
|
|
3
|
+
"version": "0.2.5",
|
|
4
|
+
"description": "Secure, Event-Driven, OOP Engine for FiveM. Stop scripting, start engineering.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "commonjs",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/newcore-network/opencore.git"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/newcore-network/opencore",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/newcore-network/opencore/issues"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md",
|
|
19
|
+
"LICENSE"
|
|
20
|
+
],
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js",
|
|
25
|
+
"require": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./server": {
|
|
28
|
+
"types": "./dist/runtime/server/index.d.ts",
|
|
29
|
+
"import": "./dist/runtime/server/index.js",
|
|
30
|
+
"require": "./dist/runtime/server/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./client": {
|
|
33
|
+
"types": "./dist/runtime/client/index.d.ts",
|
|
34
|
+
"import": "./dist/runtime/client/index.js",
|
|
35
|
+
"require": "./dist/runtime/client/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./shared": {
|
|
38
|
+
"types": "./dist/kernel/shared/index.d.ts",
|
|
39
|
+
"import": "./dist/kernel/shared/index.js",
|
|
40
|
+
"require": "./dist/kernel/shared/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./utils": {
|
|
43
|
+
"types": "./dist/kernel/utils/index.d.ts",
|
|
44
|
+
"import": "./dist/kernel/utils/index.js",
|
|
45
|
+
"require": "./dist/kernel/utils/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./package.json": "./package.json"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsc -p tsconfig.build.json",
|
|
51
|
+
"watch": "tsc -p tsconfig.build.json --watch",
|
|
52
|
+
"check": "biome check .",
|
|
53
|
+
"check:fix": "biome check --write .",
|
|
54
|
+
"check:fix:unsafe": "biome check --write --unsafe",
|
|
55
|
+
"format": "biome format --write .",
|
|
56
|
+
"lint": "biome lint .",
|
|
57
|
+
"lint:fix": "biome lint --write .",
|
|
58
|
+
"typecheck": "tsc --noEmit",
|
|
59
|
+
"test": "npx vitest run --project unit --project integration --project e2e",
|
|
60
|
+
"test:ci": "npx vitest run --project unit --project integration",
|
|
61
|
+
"test:watch": "npx vitest --project unit --project integration --project e2e",
|
|
62
|
+
"test:unit": "npx vitest run --project unit",
|
|
63
|
+
"test:integration": "npx vitest run --project integration",
|
|
64
|
+
"test:e2e": "npx vitest run --project e2e",
|
|
65
|
+
"test:coverage": "npx vitest run --coverage",
|
|
66
|
+
"bench": "npx tsx benchmark/index.ts",
|
|
67
|
+
"bench:core": "npx tsx benchmark/index.ts --core",
|
|
68
|
+
"bench:load": "npx vitest run --project benchmark",
|
|
69
|
+
"bench:all": "npx tsx benchmark/index.ts --all"
|
|
70
|
+
},
|
|
71
|
+
"keywords": [
|
|
72
|
+
"framework",
|
|
73
|
+
"opencore",
|
|
74
|
+
"fivem",
|
|
75
|
+
"typescript",
|
|
76
|
+
"roleplay"
|
|
77
|
+
],
|
|
78
|
+
"author": "OpenCore Team",
|
|
79
|
+
"license": "MPL-2.0",
|
|
80
|
+
"packageManager": "pnpm@10.13.1",
|
|
81
|
+
"dependencies": {
|
|
82
|
+
"reflect-metadata": "^0.2.2",
|
|
83
|
+
"tsyringe": "^4.10.0",
|
|
84
|
+
"uuid": "^13.0.0",
|
|
85
|
+
"zod": "^4.1.13"
|
|
86
|
+
},
|
|
87
|
+
"devDependencies": {
|
|
88
|
+
"@biomejs/biome": "^2.3.10",
|
|
89
|
+
"@citizenfx/client": "2.0.22443-1",
|
|
90
|
+
"@citizenfx/server": "2.0.22443-1",
|
|
91
|
+
"@types/node": "^24.10.1",
|
|
92
|
+
"@vitest/coverage-v8": "^4.0.15",
|
|
93
|
+
"eslint-config-prettier": "^10.1.8",
|
|
94
|
+
"eslint-plugin-import": "^2.32.0",
|
|
95
|
+
"tinybench": "^2.7.0",
|
|
96
|
+
"tsx": "^4.19.2",
|
|
97
|
+
"typescript": "^5.9.3",
|
|
98
|
+
"vitest": "^4.0.15"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dependency Injection Tokens for OpenCore.
|
|
3
|
-
*
|
|
4
|
-
* Using string tokens instead of class references for injection
|
|
5
|
-
* avoids issues with circular dependencies and "TypeInfo not known"
|
|
6
|
-
* errors in certain build environments.
|
|
7
|
-
*/
|
|
8
|
-
export declare const DI_TOKENS: {
|
|
9
|
-
readonly CommandExecutionPort: symbol;
|
|
10
|
-
readonly PlayerDirectoryPort: symbol;
|
|
11
|
-
readonly PrincipalPort: symbol;
|
|
12
|
-
readonly DecoratorProcessor: "DecoratorProcessor";
|
|
13
|
-
readonly DatabaseService: symbol;
|
|
14
|
-
readonly HttpService: symbol;
|
|
15
|
-
readonly ChatService: symbol;
|
|
16
|
-
readonly RateLimiterService: symbol;
|
|
17
|
-
readonly PrincipalProvider: symbol;
|
|
18
|
-
readonly AuthProvider: symbol;
|
|
19
|
-
readonly Exports: symbol;
|
|
20
|
-
readonly EngineEvents: symbol;
|
|
21
|
-
readonly NetTransport: symbol;
|
|
22
|
-
readonly Tick: symbol;
|
|
23
|
-
readonly PlayerInfo: symbol;
|
|
24
|
-
readonly ResourceInfo: symbol;
|
|
25
|
-
readonly EntityServer: symbol;
|
|
26
|
-
readonly VehicleServer: symbol;
|
|
27
|
-
readonly PlayerServer: symbol;
|
|
28
|
-
readonly Hasher: symbol;
|
|
29
|
-
readonly PedAppearanceServer: symbol;
|
|
30
|
-
};
|