Compare commits

..

2 Commits

Author SHA1 Message Date
563ef864b7 linter + configs 2025-07-08 22:48:53 +01:00
43b7d16f9a extracted declarations from @citizenfx packages 2025-07-08 22:48:39 +01:00
5 changed files with 47 additions and 11 deletions

View File

@ -6,7 +6,8 @@
"useIgnoreFile": false "useIgnoreFile": false
}, },
"files": { "files": {
"ignoreUnknown": false "ignoreUnknown": false,
"includes": ["**", "!dist/*"]
}, },
"formatter": { "formatter": {
"enabled": true "enabled": true
@ -14,7 +15,13 @@
"linter": { "linter": {
"enabled": true, "enabled": true,
"rules": { "rules": {
"recommended": true "recommended": true,
"complexity": {
"noBannedTypes": "info"
},
"suspicious": {
"noExplicitAny": "info"
}
} }
}, },
"javascript": { "javascript": {

View File

@ -1,11 +1,11 @@
{ {
"name": "@entityseven/fivem-rpc", "name": "@entityseven/fivem-rpc",
"description": "FiveM RPC is an abstraction for events in GTA V FiveM servers in JS/TS", "description": "FiveM RPC is an abstraction for handling events in GTA V FiveM servers in JS/TS",
"version": "0.1.0", "version": "0.1.0",
"main": "", "main": "dist/index.js",
"types": "", "types": "dist/index.d.ts",
"files": [ "files": [
"types/**/*", "dist/**/*",
"readme.md", "readme.md",
"license.md" "license.md"
], ],
@ -15,7 +15,6 @@
"fivem", "fivem",
"gta" "gta"
], ],
"type": "module",
"author": "Entity Seven Group", "author": "Entity Seven Group",
"contributors": [ "contributors": [
{ {
@ -25,6 +24,13 @@
} }
], ],
"license": "Custom-Attribution-NoDerivs", "license": "Custom-Attribution-NoDerivs",
"repository": {
"type": "git",
"url": "https://github.com/rilaxik/fivem-rpc.git"
},
"scripts": {
"build": "tsup"
},
"devDependencies": { "devDependencies": {
"@microsoft/api-extractor": "^7.47.9", "@microsoft/api-extractor": "^7.47.9",
"@citizenfx/client": "^2.0.15015-1", "@citizenfx/client": "^2.0.15015-1",

View File

@ -1,5 +1,3 @@
/// <reference types="@citizenfx/client" />
import type * as s from '@entityseven/fivem-rpc-shared-types' import type * as s from '@entityseven/fivem-rpc-shared-types'
import { Emitter } from '../utils/emitter' import { Emitter } from '../utils/emitter'
import { generateUUID, parse, stringify, stringifyWeb } from '../utils/funcs' import { generateUUID, parse, stringify, stringifyWeb } from '../utils/funcs'
@ -19,6 +17,20 @@ import {
} from '../utils/types' } from '../utils/types'
import { Wrapper } from './wrapper' import { Wrapper } from './wrapper'
declare function onNet(eventName: string, callback: Function): void
declare function emitNet(eventName: string, ...args: unknown[]): void
declare function on(eventName: string, callback: Function): void
declare function RegisterNuiCallbackType(callbackType: string): void
declare function GetPlayerServerId(player: number): number
declare function PlayerId(): number
declare function SetNuiFocus(hasFocus: boolean, hasCursor: boolean): void
declare function RegisterCommand(
commandName: string,
handler: Function,
restricted: boolean,
): void
declare function SendNuiMessage(jsonString: string): boolean
export class RPCInstanceClient extends Wrapper { export class RPCInstanceClient extends Wrapper {
private readonly _emitterServer: Emitter private readonly _emitterServer: Emitter
private readonly _pendingServer: Emitter private readonly _pendingServer: Emitter

View File

@ -1,5 +1,3 @@
/// <reference types="@citizenfx/server" />
import type * as s from '@entityseven/fivem-rpc-shared-types' import type * as s from '@entityseven/fivem-rpc-shared-types'
import { Emitter } from '../utils/emitter' import { Emitter } from '../utils/emitter'
import { generateUUID, parse, stringify } from '../utils/funcs' import { generateUUID, parse, stringify } from '../utils/funcs'
@ -14,6 +12,15 @@ import {
} from '../utils/types' } from '../utils/types'
import { Wrapper } from './wrapper' import { Wrapper } from './wrapper'
declare function onNet(eventName: string, callback: Function): void
declare function emitNet(eventName: string, ...args: unknown[]): void
declare function on(eventName: string, callback: Function): void
declare function RegisterCommand(
commandName: string,
handler: Function,
restricted: boolean,
): void
export class RPCInstanceServer extends Wrapper { export class RPCInstanceServer extends Wrapper {
private readonly _emitterClient: Emitter private readonly _emitterClient: Emitter
private readonly _pendingClient: Emitter private readonly _pendingClient: Emitter

View File

@ -24,6 +24,10 @@
} }
], ],
"license": "Custom-Attribution-NoDerivs", "license": "Custom-Attribution-NoDerivs",
"repository": {
"type": "git",
"url": "https://github.com/rilaxik/fivem-rpc.git"
},
"peerDependencies": { "peerDependencies": {
"typescript": "^5" "typescript": "^5"
} }