Compare commits
43
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06f93e61a8 | ||
|
|
7357038c42 | ||
|
|
04412d7cbc | ||
|
|
9204eb81be | ||
|
|
1fd65c6b86 | ||
|
|
396e9c0ee6 | ||
|
|
839dff9b78 | ||
|
|
2054bc0a75 | ||
|
|
73dde02792 | ||
|
|
197de51a74 | ||
|
|
d3276278a5 | ||
|
|
1ad6f2c011 | ||
|
|
7ad4f2b7ae | ||
|
|
02c46389b3 | ||
|
|
2df12062d0 | ||
|
|
045614379d | ||
|
|
642545595b | ||
|
|
1766f047a4 | ||
|
|
95352908f8 | ||
|
|
7a506a02e2 | ||
|
|
c94bab24f2 | ||
|
|
a0e8c0b461 | ||
|
|
0520b869db | ||
|
|
e412aff01b | ||
|
|
c52cd8b4c8 | ||
|
|
a9486db3f5 | ||
|
|
61929d7b48 | ||
|
|
d6e9c92d0a | ||
|
|
301ef4ac57 | ||
|
|
79011e0fd2 | ||
|
|
57b4f236ac | ||
|
|
558005d7b0 | ||
|
|
a03cc01aa0 | ||
|
|
bad4d532f6 | ||
|
|
234bcecc7b | ||
|
|
2b26dbffc0 | ||
|
|
88e40a4635 | ||
|
|
fa3b1b1b0b | ||
|
|
1880f28eb7 | ||
|
|
c021ef3c59 | ||
|
|
22945357fd | ||
|
|
17ef98cbd2 | ||
|
|
39ab22f9aa |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "rage-fw-cef",
|
||||
"version": "0.0.25-alpha.0",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/src/index.d.ts",
|
||||
"files": [
|
||||
"dist/**/*"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup"
|
||||
},
|
||||
"dependencies": {
|
||||
"rage-rpc": "^0.4.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@ragempcommunity/types-cef": "^2.1.8",
|
||||
"rage-fw-shared-types": "workspace:^"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "SashaGoncharov19",
|
||||
"license": "MIT",
|
||||
"description": "CEF side for rage-fw"
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
import rpc from 'rage-rpc'
|
||||
|
||||
import {
|
||||
_CefEventHasArgs,
|
||||
_ClientEventHasArgs,
|
||||
_ServerEventHasArgs,
|
||||
RageFW_CefArguments,
|
||||
RageFW_CefCallback,
|
||||
RageFW_CefReturn,
|
||||
RageFW_ClientArguments,
|
||||
RageFW_ClientReturn,
|
||||
RageFW_ICustomCefEvent,
|
||||
RageFW_ICustomClientEvent,
|
||||
RageFW_ICustomServerEvent,
|
||||
RageFW_ServerArguments,
|
||||
RageFW_ServerReturn,
|
||||
} from './types'
|
||||
|
||||
class Cef {
|
||||
public register<EventName extends keyof RageFW_ICustomCefEvent>(
|
||||
eventName: EventName,
|
||||
callback: RageFW_CefCallback<EventName>,
|
||||
): void {
|
||||
if ('mp' in window) {
|
||||
rpc.register(eventName, callback)
|
||||
}
|
||||
}
|
||||
|
||||
public trigger<EventName extends keyof RageFW_ICustomCefEvent>(
|
||||
eventName: EventName,
|
||||
...args: _CefEventHasArgs<EventName> extends true
|
||||
? [RageFW_CefArguments<EventName>]
|
||||
: []
|
||||
): Promise<RageFW_CefReturn<EventName>> {
|
||||
if ('mp' in window) {
|
||||
return rpc.call(eventName, args)
|
||||
}
|
||||
|
||||
return Promise.reject(
|
||||
'RageFW was started in window which not contain global variable MP!',
|
||||
)
|
||||
}
|
||||
|
||||
public triggerServer<EventName extends keyof RageFW_ICustomServerEvent>(
|
||||
eventName: EventName,
|
||||
...args: _ServerEventHasArgs<EventName> extends true
|
||||
? [RageFW_ServerArguments<EventName>]
|
||||
: []
|
||||
): Promise<RageFW_ServerReturn<EventName>> {
|
||||
if ('mp' in window) {
|
||||
return rpc.callServer(eventName, args)
|
||||
}
|
||||
|
||||
return Promise.reject(
|
||||
'RageFW was started in window which not contain global variable MP!',
|
||||
)
|
||||
}
|
||||
|
||||
public triggerClient<EventName extends keyof RageFW_ICustomClientEvent>(
|
||||
eventName: EventName,
|
||||
...args: _ClientEventHasArgs<EventName> extends true
|
||||
? [RageFW_ClientArguments<EventName>]
|
||||
: []
|
||||
): Promise<RageFW_ClientReturn<EventName>> {
|
||||
if ('mp' in window) {
|
||||
return rpc.callClient(eventName, args)
|
||||
}
|
||||
|
||||
return Promise.reject(
|
||||
'RageFW was started in window which not contain global variable MP!',
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export const fw = {
|
||||
event: new Cef(),
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import { RageFW_ICustomCefEvent } from 'rage-fw-shared-types'
|
||||
export { RageFW_ICustomCefEvent } from 'rage-fw-shared-types'
|
||||
|
||||
/**
|
||||
* Union of all available cef event names
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_CefEvent = keyof RageFW_ICustomCefEvent
|
||||
|
||||
/**
|
||||
* Array of arguments of an event you pass as a generic
|
||||
* These only include custom cef events
|
||||
*/
|
||||
export type RageFW_CefArguments<K extends RageFW_CefEvent> = Parameters<
|
||||
RageFW_ICustomCefEvent[K]
|
||||
>
|
||||
|
||||
/**
|
||||
* Return type of event you pass as a generic
|
||||
* These only include custom cef events
|
||||
*/
|
||||
export type RageFW_CefReturn<K extends RageFW_CefEvent> = ReturnType<
|
||||
RageFW_ICustomCefEvent[K]
|
||||
>
|
||||
|
||||
/**
|
||||
* Callback (function) of event you pass as a generic
|
||||
* These only include custom cef events
|
||||
*/
|
||||
export type RageFW_CefCallback<K extends keyof RageFW_ICustomCefEvent> = (
|
||||
args: RageFW_CefArguments<K>,
|
||||
) => RageFW_CefReturn<K>
|
||||
|
||||
export type _CefEventHasArgs<EventName extends keyof RageFW_ICustomCefEvent> =
|
||||
keyof RageFW_ICustomCefEvent extends never
|
||||
? false
|
||||
: Parameters<RageFW_ICustomCefEvent[EventName]>[0] extends undefined
|
||||
? false
|
||||
: true
|
||||
@@ -0,0 +1,32 @@
|
||||
import type { RageFW_ICustomClientEvent } from 'rage-fw-shared-types'
|
||||
export type { RageFW_ICustomClientEvent } from 'rage-fw-shared-types'
|
||||
|
||||
/**
|
||||
* Union of all available client event names
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ClientEvent = keyof RageFW_ICustomClientEvent
|
||||
|
||||
/**
|
||||
* Array of arguments of event you pass as a generic
|
||||
* These only include custom client events
|
||||
*/
|
||||
export type RageFW_ClientArguments<K extends RageFW_ClientEvent> = Parameters<
|
||||
RageFW_ICustomClientEvent[K]
|
||||
>
|
||||
|
||||
/**
|
||||
* Return type of event you pass as a generic
|
||||
* These only include custom client events
|
||||
*/
|
||||
export type RageFW_ClientReturn<K extends RageFW_ClientEvent> = ReturnType<
|
||||
RageFW_ICustomClientEvent[K]
|
||||
>
|
||||
|
||||
export type _ClientEventHasArgs<
|
||||
EventName extends keyof RageFW_ICustomClientEvent,
|
||||
> = keyof RageFW_ICustomClientEvent extends never
|
||||
? false
|
||||
: Parameters<RageFW_ICustomClientEvent[EventName]>[0] extends undefined
|
||||
? false
|
||||
: true
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './cef'
|
||||
export * from './client'
|
||||
export * from './server'
|
||||
@@ -0,0 +1,32 @@
|
||||
import type { RageFW_ICustomServerEvent } from 'rage-fw-shared-types'
|
||||
export type { RageFW_ICustomServerEvent } from 'rage-fw-shared-types'
|
||||
|
||||
/**
|
||||
* Union of all available server event names
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ServerEvent = keyof RageFW_ICustomServerEvent
|
||||
|
||||
/**
|
||||
* Array of arguments of event you pass as a generic
|
||||
* These only include custom server events
|
||||
*/
|
||||
export type RageFW_ServerArguments<K extends RageFW_ServerEvent> = Parameters<
|
||||
RageFW_ICustomServerEvent[K]
|
||||
>
|
||||
|
||||
/**
|
||||
* Return type of event you pass as a generic
|
||||
* These only include custom server events
|
||||
*/
|
||||
export type RageFW_ServerReturn<K extends RageFW_ServerEvent> = ReturnType<
|
||||
RageFW_ICustomServerEvent[K]
|
||||
>
|
||||
|
||||
export type _ServerEventHasArgs<
|
||||
EventName extends keyof RageFW_ICustomServerEvent,
|
||||
> = keyof RageFW_ICustomServerEvent extends never
|
||||
? false
|
||||
: Parameters<RageFW_ICustomServerEvent[EventName]>[0] extends undefined
|
||||
? false
|
||||
: true
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"display": "Base",
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"incremental": false,
|
||||
"composite": false,
|
||||
"target": "ES2022",
|
||||
"experimentalDecorators": true,
|
||||
"moduleDetection": "auto",
|
||||
"module": "CommonJS",
|
||||
"resolveJsonModule": true,
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
"sourceMap": false,
|
||||
"downlevelIteration": false,
|
||||
"inlineSourceMap": false,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { defineConfig } from 'tsup'
|
||||
|
||||
export default defineConfig({
|
||||
entry: ['src/index.ts'],
|
||||
outDir: './dist',
|
||||
format: ['cjs'],
|
||||
noExternal: ['rage-rpc'],
|
||||
experimentalDts: true,
|
||||
splitting: false,
|
||||
sourcemap: false,
|
||||
clean: true,
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
tabWidth: 4
|
||||
printWidth: 80
|
||||
singleQuote: true
|
||||
semi: false
|
||||
arrowParens: avoid
|
||||
endOfLine: auto
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "create-rage-fw",
|
||||
"version": "0.0.25-alpha.0",
|
||||
"bin": {
|
||||
"rage-fw": "dist/index.js"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"watch": "tsc -w",
|
||||
"build": "tsup",
|
||||
"start": "npx ./dist create"
|
||||
},
|
||||
"description": "CLI to scaffold a template project for RageFW",
|
||||
"keywords": [],
|
||||
"author": "rilaxik",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@inquirer/prompts": "^5.0.5",
|
||||
"axios": "^1.7.2",
|
||||
"chalk": "4.1.2",
|
||||
"git-clone": "^0.2.0",
|
||||
"yargs": "^17.7.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/git-clone": "^0.2.4",
|
||||
"@types/node": "^20.14.2",
|
||||
"@types/yargs": "^17.0.32",
|
||||
"prettier": "^3.3.2",
|
||||
"typescript": "^5.4.5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
import type { CommandModule, Argv, ArgumentsCamelCase } from 'yargs'
|
||||
import c from 'chalk'
|
||||
import { input, select } from '@inquirer/prompts'
|
||||
import clone from 'git-clone'
|
||||
import path from 'node:path'
|
||||
|
||||
import { checkForUpdate } from '../utils/update'
|
||||
|
||||
function builder(yargs: Argv) {
|
||||
return yargs
|
||||
.option('projectName', {
|
||||
alias: 'p',
|
||||
description: 'Name of the folder to scaffold a project to',
|
||||
type: 'string',
|
||||
demandOption: false,
|
||||
})
|
||||
.option('template', {
|
||||
alias: 't',
|
||||
description: 'Frontend framework to use for CEF',
|
||||
type: 'string',
|
||||
demandOption: false,
|
||||
})
|
||||
.middleware(async () => await checkForUpdate())
|
||||
}
|
||||
|
||||
async function handler(args: ArgumentsCamelCase) {
|
||||
let folder = (args.projectName as string) ?? args.p
|
||||
let framework = (args.template as string) ?? args.t
|
||||
|
||||
if (!folder) {
|
||||
folder = await input({
|
||||
message: c.gray('Enter project name:'),
|
||||
default: 'rage-fw',
|
||||
})
|
||||
} else {
|
||||
console.log(c.gray('Project name:'), folder)
|
||||
}
|
||||
|
||||
if (!framework) {
|
||||
framework = await select({
|
||||
message: c.gray('Select frontend:'),
|
||||
default: 'react',
|
||||
loop: true,
|
||||
choices: [
|
||||
{
|
||||
name: 'React + TypeScript (Vite)',
|
||||
value: 'react',
|
||||
description: 'React + TypeScript (Vite) as a frontend',
|
||||
},
|
||||
// {
|
||||
// name: 'vue',
|
||||
// value: 'vue',
|
||||
// description: 'npm is the most popular package manager',
|
||||
// },
|
||||
],
|
||||
})
|
||||
} else {
|
||||
console.log(c.gray('Frontend:'), framework)
|
||||
}
|
||||
|
||||
console.log(
|
||||
c.gray('\nScaffolding template project into'),
|
||||
folder,
|
||||
c.gray('with'),
|
||||
framework,
|
||||
c.gray('as a frontend..'),
|
||||
)
|
||||
|
||||
clone(
|
||||
'https://git.entityseven.com/entityseven/rage-framework-example',
|
||||
path.join(__dirname, folder),
|
||||
{},
|
||||
err => {
|
||||
if (err) {
|
||||
console.log(c.red('Error occured: \n', err))
|
||||
return
|
||||
}
|
||||
console.log(c.gray('Scaffolded project into'), folder)
|
||||
console.log(
|
||||
c.blueBright(
|
||||
'Working on Rage Framework. RageFW © Powered by Entity Seven Group',
|
||||
),
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
const init: CommandModule = {
|
||||
command: 'create [folderName] [template]',
|
||||
aliases: 'c',
|
||||
describe: 'Scaffold a template project using RageFW',
|
||||
builder,
|
||||
handler,
|
||||
}
|
||||
|
||||
export default init
|
||||
@@ -0,0 +1,11 @@
|
||||
import yargs from 'yargs'
|
||||
|
||||
import create from './commands/create'
|
||||
|
||||
yargs
|
||||
.usage('<cmd> [args]')
|
||||
// .scriptName('rage-fw')
|
||||
// .usage('$0 <cmd> [args]')
|
||||
// @ts-ignore
|
||||
.command(create)
|
||||
.help().argv
|
||||
@@ -0,0 +1,31 @@
|
||||
import axios from 'axios'
|
||||
import c from 'chalk'
|
||||
import yargs from 'yargs'
|
||||
|
||||
const latestVersionURL =
|
||||
'https://git.entityseven.com/api/v1/repos/entityseven/rage-framework/tags?page=1&limit=1'
|
||||
|
||||
type Version = {
|
||||
name: string
|
||||
message: string
|
||||
}
|
||||
|
||||
export async function checkForUpdate(): Promise<void> {
|
||||
return new Promise(res => {
|
||||
yargs.showVersion(version =>
|
||||
axios
|
||||
.get<Version[]>(latestVersionURL)
|
||||
.then(({ data }) => {
|
||||
const latestVersion = data[0].name
|
||||
|
||||
if (!(latestVersion === version))
|
||||
notifyUserAboutUpdate(latestVersion)
|
||||
})
|
||||
.then(() => res()),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
function notifyUserAboutUpdate(version: string) {
|
||||
console.log(c.green(`Update available. New version: ${version}`))
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"lib": ["DOM", "ES6"],
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"sourceMap": true,
|
||||
|
||||
"outDir": "bin",
|
||||
"esModuleInterop": true,
|
||||
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noImplicitAny": true
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { defineConfig } from 'tsup'
|
||||
|
||||
export default defineConfig({
|
||||
entry: ['src/index.ts'],
|
||||
outDir: './dist',
|
||||
bundle: true,
|
||||
splitting: false,
|
||||
sourcemap: false,
|
||||
clean: true,
|
||||
})
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rage-fw-client",
|
||||
"version": "0.0.16-alpha.0",
|
||||
"version": "0.0.25-alpha.0",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/src/index.d.ts",
|
||||
"files": [
|
||||
@@ -10,11 +10,11 @@
|
||||
"build": "tsup"
|
||||
},
|
||||
"dependencies": {
|
||||
"rage-fw-shared-types": "workspace:^",
|
||||
"rage-rpc": "^0.4.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@ragempcommunity/types-client": "^2.1.8"
|
||||
"@ragempcommunity/types-client": "^2.1.8",
|
||||
"rage-fw-shared-types": "workspace:^"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "SashaGoncharov19",
|
||||
|
||||
+56
-3
@@ -1,13 +1,25 @@
|
||||
import rpc from 'rage-rpc'
|
||||
|
||||
import type {
|
||||
RageFW_ClientEventCallback,
|
||||
import Logger from './logger'
|
||||
|
||||
import {
|
||||
_CefEventHasArgs,
|
||||
_ClientEventHasArgs,
|
||||
_ServerEventHasArgs,
|
||||
RageFW_CefArgs,
|
||||
RageFW_CefEvent,
|
||||
RageFW_CefReturn,
|
||||
RageFW_ClientEvent,
|
||||
RageFW_ClientEventArguments,
|
||||
RageFW_ClientEventCallback,
|
||||
RageFW_ClientEventReturn,
|
||||
RageFW_ClientServerEvent,
|
||||
RageFW_ClientServerEventArguments,
|
||||
RageFW_ClientServerEventReturn,
|
||||
} from './types'
|
||||
|
||||
import type { RageFW_ICustomClientEvent } from 'rage-fw-shared-types'
|
||||
|
||||
class Client {
|
||||
public register<EventName extends RageFW_ClientEvent>(
|
||||
eventName: EventName,
|
||||
@@ -17,18 +29,59 @@ class Client {
|
||||
return callback(data)
|
||||
})
|
||||
}
|
||||
|
||||
public unregister<EventName extends RageFW_ClientEvent>(
|
||||
eventName: EventName,
|
||||
): void {
|
||||
rpc.unregister(eventName)
|
||||
}
|
||||
}
|
||||
|
||||
class Player {
|
||||
public browser: BrowserMp | undefined
|
||||
|
||||
public trigger<EventName extends keyof RageFW_ICustomClientEvent>(
|
||||
eventName: EventName,
|
||||
...args: _ClientEventHasArgs<EventName> extends true
|
||||
? [RageFW_ClientEventArguments<EventName>]
|
||||
: []
|
||||
): Promise<RageFW_ClientEventReturn<EventName>> {
|
||||
return rpc.call<RageFW_ClientEventReturn<EventName>>(eventName, args)
|
||||
}
|
||||
|
||||
public triggerServer<EventName extends RageFW_ClientServerEvent>(
|
||||
eventName: EventName,
|
||||
args: RageFW_ClientServerEventArguments<EventName>,
|
||||
...args: _ServerEventHasArgs<EventName> extends true
|
||||
? [RageFW_ClientServerEventArguments<EventName>]
|
||||
: []
|
||||
): Promise<RageFW_ClientServerEventReturn<EventName>> {
|
||||
return rpc.callServer(eventName, args)
|
||||
}
|
||||
|
||||
public triggerBrowser<EventName extends RageFW_CefEvent>(
|
||||
eventName: EventName,
|
||||
...args: _CefEventHasArgs<EventName> extends true
|
||||
? [RageFW_CefArgs<EventName>]
|
||||
: []
|
||||
): Promise<RageFW_CefReturn<EventName>> {
|
||||
if (!this.browser)
|
||||
throw new Error('You need to initialize browser first!')
|
||||
return rpc.callBrowser(this.browser, eventName, args)
|
||||
}
|
||||
}
|
||||
|
||||
class Browser extends Player {
|
||||
public registerBrowser(browser: BrowserMp) {
|
||||
this.browser = browser
|
||||
return browser
|
||||
}
|
||||
}
|
||||
|
||||
export const fw = {
|
||||
event: new Client(),
|
||||
player: new Player(),
|
||||
browser: new Browser(),
|
||||
system: {
|
||||
log: new Logger(),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
export default class Logger {
|
||||
public error(message: unknown) {
|
||||
mp.console.logError(
|
||||
`[${new Date().toLocaleTimeString()}] [ERROR] ${message}`,
|
||||
)
|
||||
}
|
||||
|
||||
public warn(message: unknown) {
|
||||
mp.console.logWarning(
|
||||
`[${new Date().toLocaleTimeString()}] [WARN] ${message}`,
|
||||
)
|
||||
}
|
||||
|
||||
public info(message: unknown) {
|
||||
mp.console.logInfo(
|
||||
`[${new Date().toLocaleTimeString()}] [INFO] ${message}`,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/// <reference types="@ragempcommunity/types-client" />
|
||||
|
||||
import type { RageFW_ICustomCefEvent } from 'rage-fw-shared-types'
|
||||
|
||||
export type RageFW_CefEvent = keyof RageFW_ICustomCefEvent
|
||||
|
||||
export type RageFW_CefArgs<K extends RageFW_CefEvent> = Parameters<
|
||||
RageFW_ICustomCefEvent[K]
|
||||
>
|
||||
|
||||
export type RageFW_CefReturn<K extends RageFW_CefEvent> = ReturnType<
|
||||
RageFW_ICustomCefEvent[K]
|
||||
>
|
||||
|
||||
export type _CefEventHasArgs<EventName extends keyof RageFW_ICustomCefEvent> =
|
||||
keyof RageFW_ICustomCefEvent extends never
|
||||
? false
|
||||
: Parameters<RageFW_ICustomCefEvent[EventName]>[0] extends undefined
|
||||
? false
|
||||
: true
|
||||
@@ -2,13 +2,46 @@
|
||||
|
||||
import type { RageFW_ICustomClientEvent } from 'rage-fw-shared-types'
|
||||
|
||||
export type RageFW_ClientEvent = keyof RageFW_ICustomClientEvent
|
||||
/**
|
||||
* Union of all available client event names
|
||||
* These include custom and system events
|
||||
*/
|
||||
export type RageFW_ClientEvent =
|
||||
| keyof RageFW_ICustomClientEvent
|
||||
| keyof IClientEvents
|
||||
|
||||
/**
|
||||
* Array of arguments for an event, name of which you pass as a generic
|
||||
* These include custom and system events
|
||||
*/
|
||||
export type RageFW_ClientEventArguments<K extends RageFW_ClientEvent> =
|
||||
K extends keyof RageFW_ICustomClientEvent
|
||||
? Parameters<RageFW_ICustomClientEvent[K]>
|
||||
: K extends keyof IClientEvents
|
||||
? Parameters<IClientEvents[K]>
|
||||
: never
|
||||
|
||||
/**
|
||||
* Callback (function) for an event, name of which you pass as a generic
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ClientEventCallback<K extends RageFW_ClientEvent> = (
|
||||
args: Parameters<RageFW_ICustomClientEvent[K]>,
|
||||
args: RageFW_ClientEventArguments<K>,
|
||||
) => RageFW_ClientEventReturn<K>
|
||||
|
||||
/**
|
||||
* Return type for an event, name of which you pass as a generic
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ClientEventReturn<K extends RageFW_ClientEvent> =
|
||||
K extends keyof RageFW_ICustomClientEvent
|
||||
? ReturnType<RageFW_ICustomClientEvent[K]>
|
||||
: never
|
||||
|
||||
export type _ClientEventHasArgs<
|
||||
EventName extends keyof RageFW_ICustomClientEvent,
|
||||
> = keyof RageFW_ICustomClientEvent extends never
|
||||
? false
|
||||
: Parameters<RageFW_ICustomClientEvent[EventName]>[0] extends undefined
|
||||
? false
|
||||
: true
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from './client'
|
||||
export * from './server'
|
||||
export * from './browser'
|
||||
|
||||
@@ -1,16 +1,39 @@
|
||||
/// <reference types="@ragempcommunity/types-client" />
|
||||
|
||||
import type { RageFW_ICustomServerEvent } from 'rage-fw-shared-types'
|
||||
import type {
|
||||
RageFW_ICustomClientEvent,
|
||||
RageFW_ICustomServerEvent,
|
||||
} from 'rage-fw-shared-types'
|
||||
|
||||
/**
|
||||
* Union of all available server event names callable from client
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ClientServerEvent = keyof RageFW_ICustomServerEvent
|
||||
|
||||
/**
|
||||
* Array of arguments for an event, name of which you pass as a generic
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ClientServerEventArguments<
|
||||
K extends RageFW_ClientServerEvent,
|
||||
> = K extends keyof RageFW_ICustomServerEvent
|
||||
? Parameters<RageFW_ICustomServerEvent[K]>
|
||||
: never
|
||||
|
||||
/**
|
||||
* Return type for an event, name of which you pass as a generic
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ClientServerEventReturn<K extends RageFW_ClientServerEvent> =
|
||||
K extends keyof RageFW_ICustomServerEvent
|
||||
? ReturnType<RageFW_ICustomServerEvent[K]>
|
||||
: never
|
||||
|
||||
export type _ServerEventHasArgs<
|
||||
EventName extends keyof RageFW_ICustomServerEvent,
|
||||
> = keyof RageFW_ICustomClientEvent extends never
|
||||
? false
|
||||
: Parameters<RageFW_ICustomServerEvent[EventName]>[0] extends undefined
|
||||
? false
|
||||
: true
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
"composite": false,
|
||||
"target": "ES2022",
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"moduleDetection": "auto",
|
||||
"module": "CommonJS",
|
||||
"resolveJsonModule": true,
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
||||
"version": "0.0.16-alpha.0",
|
||||
"version": "0.0.25-alpha.0",
|
||||
"npmClient": "pnpm"
|
||||
}
|
||||
|
||||
Generated
+430
-91
@@ -9,7 +9,7 @@ importers:
|
||||
dependencies:
|
||||
'@microsoft/api-extractor':
|
||||
specifier: ^7.47.0
|
||||
version: 7.47.0
|
||||
version: 7.47.0(@types/[email protected])
|
||||
'@ragempcommunity/types-cef':
|
||||
specifier: ^2.1.8
|
||||
version: 2.1.8
|
||||
@@ -33,13 +33,13 @@ importers:
|
||||
version: 8.1.3([email protected])
|
||||
prettier:
|
||||
specifier: ^3.3.1
|
||||
version: 3.3.1
|
||||
version: 3.3.2
|
||||
rage-rpc:
|
||||
specifier: ^0.4.0
|
||||
version: 0.4.0
|
||||
tsup:
|
||||
specifier: ^8.1.0
|
||||
version: 8.1.0(@microsoft/[email protected])([email protected])
|
||||
version: 8.1.0(@microsoft/[email protected](@types/[email protected]))([email protected])
|
||||
typescript:
|
||||
specifier: ^5.4.5
|
||||
version: 5.4.5
|
||||
@@ -47,6 +47,52 @@ importers:
|
||||
specifier: ^3.13.0
|
||||
version: 3.13.0
|
||||
|
||||
cef:
|
||||
dependencies:
|
||||
'@ragempcommunity/types-cef':
|
||||
specifier: ^2.1.8
|
||||
version: 2.1.8
|
||||
rage-fw-shared-types:
|
||||
specifier: workspace:^
|
||||
version: link:../shared-types
|
||||
rage-rpc:
|
||||
specifier: ^0.4.0
|
||||
version: 0.4.0
|
||||
|
||||
cli:
|
||||
dependencies:
|
||||
'@inquirer/prompts':
|
||||
specifier: ^5.0.5
|
||||
version: 5.0.5
|
||||
axios:
|
||||
specifier: ^1.7.2
|
||||
version: 1.7.2
|
||||
chalk:
|
||||
specifier: 4.1.2
|
||||
version: 4.1.2
|
||||
git-clone:
|
||||
specifier: ^0.2.0
|
||||
version: 0.2.0
|
||||
yargs:
|
||||
specifier: ^17.7.2
|
||||
version: 17.7.2
|
||||
devDependencies:
|
||||
'@types/git-clone':
|
||||
specifier: ^0.2.4
|
||||
version: 0.2.4
|
||||
'@types/node':
|
||||
specifier: ^20.14.2
|
||||
version: 20.14.2
|
||||
'@types/yargs':
|
||||
specifier: ^17.0.32
|
||||
version: 17.0.32
|
||||
prettier:
|
||||
specifier: ^3.3.2
|
||||
version: 3.3.2
|
||||
typescript:
|
||||
specifier: ^5.4.5
|
||||
version: 5.4.5
|
||||
|
||||
client:
|
||||
dependencies:
|
||||
'@ragempcommunity/types-client':
|
||||
@@ -71,8 +117,6 @@ importers:
|
||||
specifier: ^0.4.0
|
||||
version: 0.4.0
|
||||
|
||||
shared: {}
|
||||
|
||||
shared-types: {}
|
||||
|
||||
packages:
|
||||
@@ -376,6 +420,90 @@ packages:
|
||||
}
|
||||
engines: { node: '>=6.9.0' }
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-3V0OSykTkE/38GG1DhxRGLBmqefgzRg2EK5A375zz+XEvIWfAHcac31e+zlBDPypRHxhmXc/Oh6v9eOPbH3nAg==,
|
||||
}
|
||||
engines: { node: '>=18' }
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-UF09aejxCi4Xqm6N/jJAiFXArXfi9al52AFaSD+2uIHnhZGtd1d6lIGTRMPouVSJxbGEi+HkOWSYaiEY/+szUw==,
|
||||
}
|
||||
engines: { node: '>=18' }
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-K8SuNX45jEFlX3EBJpu9B+S2TISzMPGXZIuJ9ME924SqbdW6Pt6fIkKvXg7mOEOKJ4WxpQsxj0UTfcL/A434Ww==,
|
||||
}
|
||||
engines: { node: '>=18' }
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-5xCD7CoCh993YqXcsZPt45qkE3gl+03Yfv9vmAkptRi4nrzaUDmyhgBzndKdRG8SrKbQLBmOtztnRLGxvG/ahg==,
|
||||
}
|
||||
engines: { node: '>=18' }
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-ymnR8qu2ie/3JpOeyZ3QSGJ+ai8qqtjBwopxLjzIZm7mZVKT6SV1sURzijkOLRgGUHwPemOfYX5biqXuqhpoBg==,
|
||||
}
|
||||
engines: { node: '>=18' }
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-ErXXzENMH5pJt5/ssXV0DfWUZqly8nGzf0UcBV9xTnP+KyffE2mqyxIMBrZ8ijQck2nU0TQm40EQB53YreyWHw==,
|
||||
}
|
||||
engines: { node: '>=18' }
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-1xTCHmIe48x9CG1+8glAHrVVdH+QfYhzgBUbgyoVpp5NovnXgRcjSn/SNulepxf9Ol8HDq3gzw3ZCAUr+h1Eyg==,
|
||||
}
|
||||
engines: { node: '>=18' }
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-QPtVcT12Fkn0TyuZJelR7QOtc5l1d/6pB5EfkHOivTzC6QTFxRCHl+Gx7Q3E2U/kgJeCCmDov6itDFggk9nkgA==,
|
||||
}
|
||||
engines: { node: '>=18' }
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-LV2XZzc8ls4zhUzYNSpsXcnA8djOptY4G01lFzp3Bey6E1oiZMzIU25N9cb5AOwNz6pqDXpjLwRFQmLQ8h6PaQ==,
|
||||
}
|
||||
engines: { node: '>=18' }
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-GuMmfa/v1ZJqEWSkUx1hMxzs5/0DCUP0S8IicV/wu8QrbjfBOh+7mIQgtsvh8IJ3sRkRcQ+9wh9CE9jiYqyMgw==,
|
||||
}
|
||||
engines: { node: '>=18' }
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-IyBj8oEtmdF2Gx4FJTPtEya37MD6s0KATKsHqgmls0lK7EQbhYSq9GQlcFq6cBsYe/cgQ0Fg2cCqYYPi/d/fxQ==,
|
||||
}
|
||||
engines: { node: '>=18' }
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-xTUt0NulylX27/zMx04ZYar/kr1raaiFTVvQ5feljQsiAgdm0WPj4S73/ye0fbslh+15QrIuDvfCXTek7pMY5A==,
|
||||
}
|
||||
engines: { node: '>=18' }
|
||||
|
||||
'@isaacs/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
@@ -533,112 +661,112 @@ packages:
|
||||
}
|
||||
engines: { node: ^16.14.0 || >=18.0.0 }
|
||||
|
||||
'@nrwl/[email protected].2':
|
||||
'@nrwl/[email protected].3':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-NWB3OAm6/oHaF2h7isUXpK9J2XF097mfaiENHj1GzH9JwjB2YoFaD7v033er6+Hb6FEZtOPZpVH1kEQjVaYJLA==,
|
||||
integrity: sha512-OL6sc70gR/USasvbYzyYY44Hd5ZCde2UfiA5h8VeAYAJbq+JmtscpvjcnZ7OIsXyYEOxe1rypULElqu/8qpKzQ==,
|
||||
}
|
||||
|
||||
'@nrwl/[email protected].2':
|
||||
'@nrwl/[email protected].3':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-G/m3EGXf3m9rM2sQQGpRPD40gfaWR6jFVCsZW66/6FXDo1dMUH5/U5JOBnD6vBdug8txKA1ceWHM74NkAB1QEg==,
|
||||
integrity: sha512-vwo6ogcy6A9vJggDOsHGi1F0cTRqSqRypbgq/EdNuZqL7rGyZB/ctId69/i8dV6cLkl8BJG/4WpEe5BIrMTsjA==,
|
||||
}
|
||||
hasBin: true
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-6y+th5m1qVc+B0lXmKb3WRcfwNYD2B/bqGn1HiKLu8g6DDVJFn0mT+a872e4OtvgHyubZQm3HnPfjXobChpRuw==,
|
||||
integrity: sha512-if1WwRVexrQBBADObEcxVIivq4QRZWY/nYRhCQy/qfFI6Cu2jBSI6ZQ1uy7to2L2sQPLgn8v2beQZiAeZdIktg==,
|
||||
}
|
||||
peerDependencies:
|
||||
nx: '>= 17 <= 20'
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-AgvsZ0iDA0rklH0TqOIiTrbJysn7WfFFzhLYd1JnxS2Z3GAFPRoE6TxRSSqpTBmFqskrZhZyrjHllOoBD5odFQ==,
|
||||
integrity: sha512-1beJscdMraGgLHpvjyC5FXUzpdQYW8JwnPK0Yj9iti9Vnahtx3PLQHCFOFwoE0KZF9VEL1KsZSSVPljMgW/j+g==,
|
||||
}
|
||||
engines: { node: '>= 10' }
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-YPd9Kmn5/YPYolBVYoficQmp8LFTe/PAI3dQ3NebOGFYw49PFmV0cdB8+4m0q70WCBMwyqo1x6a6MO9CvENkTg==,
|
||||
integrity: sha512-wCpIRThGKL/FebPe+WaFk/V6nk31mMc83APoEyhyS5kAodqeKjb6iPud+QNydtUJ/jsF9aQ/DaHIioKC9wbg8A==,
|
||||
}
|
||||
engines: { node: '>= 10' }
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-43hMzFmYyi0aEiGa/VNXChzotL6nFG9hLSZhtpXAO6qyibSqKwlU5PjNyly/7y5gUGl7YfmdpwWwlOIYPSQoVw==,
|
||||
integrity: sha512-ytY18USCyf83wqyUgFaeRO/3zvysJXPJf1Di8czBhiUSroSMB6088OaeqW7SnzdcYNdACZUv0Q6PupXpx3w2Ng==,
|
||||
}
|
||||
engines: { node: '>= 10' }
|
||||
cpu: [x64]
|
||||
os: [freebsd]
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-locP8QQWI4NFb7kVe8Fflkpdnf9kw5o/WMROILJLFWlTy59K+NBQkpxRIhoUghJ6yckDxk1Kf2kmvV+xuX4f8Q==,
|
||||
integrity: sha512-FPtqIMzdOzYSSDnLXUpcrflqEsNe6UgpAgYoHLVbWiR47O3qJnpQRDfYUsP7Lv+2C0CBKNXgwPEvmDLXKHcfYg==,
|
||||
}
|
||||
engines: { node: '>= 10' }
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-uQUZs+56yplEjokgCC3Pv/nUr4v+/bCurc1v/juUH4byqCdvi+Cny7jqws49UELS+QkcTkWGBtajvf8U3JZEbQ==,
|
||||
integrity: sha512-VOuzPD5FBPZmctvXqdB9K1MYVzkV8TgOZFS7Md6ClH7UwJTEOjnMoomYCMM1VlOZV4P0S5E0u/Zere5YWh+ZWw==,
|
||||
}
|
||||
engines: { node: '>= 10' }
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-rU6l18ubh0Chv7lkxshgm6o4IKduB+jztUBRR4SuOuTOLJ6okm51AqzdY+vy7esicEL3HnHWSJP/U5PwoAaNsA==,
|
||||
integrity: sha512-qd6QZysktt0D7rNCOlBaV3ME0/J0VwvC1cmdjtZoljwtsX6Zc56AEdfwsgGzsZNU4w+N+BtXxowan3D44iiSzQ==,
|
||||
}
|
||||
engines: { node: '>= 10' }
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-rvGP3p0qmzHJu8cUcYnRDyJ1BkVExgmsWmtzyQrHl48+hvNrq805NrP3gTreOxqymRlBEXg7c22fRECI1CV1lA==,
|
||||
integrity: sha512-wE08BstTD65dt6c+9L9bEp98PxFwc7CuaUVX2cZTDFAERBXCMhu7y6Gb1JbiAvfVci4+yLrm+h0E1ieY1wMTXw==,
|
||||
}
|
||||
engines: { node: '>= 10' }
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-86pfT+z6SWKlJUoRy7MOMjRhrCPgSnAxbcH7jYCkqhokbCIDIv2IFWqMf0zdUqa8HqjRo13X6Jd6PhNYzWwJzw==,
|
||||
integrity: sha512-IA09+NZ0kKPSfK/dXsyjZ8TN+hN/1PcnbdNuUCn1Opmbrdda9GBfzHSDFKXxoA6TVB/j/qnXHKgKxhhVH05TGg==,
|
||||
}
|
||||
engines: { node: '>= 10' }
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-kJ3G0+nyAgBr5RTkNceC9zl2pekFEu0ec6ceLJ0tfcTwil76Ce3Xnlr0CFFNsre4T1v2RfFIDJL3EaRUXYep0w==,
|
||||
integrity: sha512-fkbcTp+XuxGaL5e4Ve8AjxNEim5Ifdn61ofaxEDMoGjauKvKZBejbLhBFOonCKDqntXsY8D2nDXjhcsdNYxzMg==,
|
||||
}
|
||||
engines: { node: '>= 10' }
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-9KKGYFgWfc4jHzHjnIp+DJt750NyG1kA4Q+DWf/UcFA5917UWuAw9rribFPRsqYkcwbu++Uajw5bI5yMLP7ThA==,
|
||||
integrity: sha512-E2q3c504xjFXTY+/iq57DOZmS6CPA8RbFwLf6bCG5wo2BDajxmvU3VCeCSkxqXEwCY7NJSI3PT1V/3vRDzJ3lQ==,
|
||||
}
|
||||
engines: { node: '>= 10' }
|
||||
cpu: [x64]
|
||||
@@ -1059,6 +1187,12 @@ packages:
|
||||
integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==,
|
||||
}
|
||||
|
||||
'@types/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-1ybApDpKU12dychtOp2zBe93ZwAsxVSjOqKUqH7NCDm4GXuPnjmcz2P9K2S1z+BCX2AnLmFFuB6pI6CMZ3j9sQ==,
|
||||
}
|
||||
|
||||
'@types/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
@@ -1071,6 +1205,18 @@ packages:
|
||||
integrity: sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==,
|
||||
}
|
||||
|
||||
'@types/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==,
|
||||
}
|
||||
|
||||
'@types/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==,
|
||||
}
|
||||
|
||||
'@types/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
@@ -1083,6 +1229,24 @@ packages:
|
||||
integrity: sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==,
|
||||
}
|
||||
|
||||
'@types/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==,
|
||||
}
|
||||
|
||||
'@types/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==,
|
||||
}
|
||||
|
||||
'@types/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==,
|
||||
}
|
||||
|
||||
'@typescript-eslint/[email protected]':
|
||||
resolution:
|
||||
{
|
||||
@@ -1657,6 +1821,13 @@ packages:
|
||||
}
|
||||
engines: { node: '>= 10' }
|
||||
|
||||
[email protected]:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==,
|
||||
}
|
||||
engines: { node: '>= 12' }
|
||||
|
||||
[email protected]:
|
||||
resolution:
|
||||
{
|
||||
@@ -2187,6 +2358,13 @@ packages:
|
||||
}
|
||||
engines: { node: '>=10' }
|
||||
|
||||
[email protected]:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==,
|
||||
}
|
||||
engines: { node: '>=10' }
|
||||
|
||||
[email protected]:
|
||||
resolution:
|
||||
{
|
||||
@@ -2323,10 +2501,10 @@ packages:
|
||||
debug:
|
||||
optional: true
|
||||
|
||||
foreground-child@3.1.1:
|
||||
foreground-child@3.2.0:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==,
|
||||
integrity: sha512-CrWQNaEl1/6WeZoarcM9LHupTo3RpZO2Pdk1vktwzPiQTsJnAKJmm3TACKeG5UZbWDfaH2AbvYxzP96y0MT7fA==,
|
||||
}
|
||||
engines: { node: '>=14' }
|
||||
|
||||
@@ -2434,6 +2612,19 @@ packages:
|
||||
}
|
||||
engines: { node: '>=10' }
|
||||
|
||||
[email protected]:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==,
|
||||
}
|
||||
engines: { node: '>=10' }
|
||||
|
||||
[email protected]:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-1UAkEPIFbyjHaddljUKvPhhLRnrKaImT71T7rdvSvWLXw95nLdhdi6Qmlx0KOWoV1qqvHGLq5lMLJEZM0JXk8A==,
|
||||
}
|
||||
|
||||
[email protected]:
|
||||
resolution:
|
||||
{
|
||||
@@ -2914,6 +3105,13 @@ packages:
|
||||
}
|
||||
engines: { node: '>=8' }
|
||||
|
||||
[email protected]:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==,
|
||||
}
|
||||
engines: { node: '>=8' }
|
||||
|
||||
[email protected]:
|
||||
resolution:
|
||||
{
|
||||
@@ -3383,6 +3581,12 @@ packages:
|
||||
integrity: sha512-tUpxzX0VAzJHjLu0xUfFv1gwVp9ba3IOuRAVH2EGuRW8a5emA2FlACLqiT/lDVtS1W+TGNwqz3sWaNyLgDJWuw==,
|
||||
}
|
||||
|
||||
[email protected]:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==,
|
||||
}
|
||||
|
||||
[email protected]:
|
||||
resolution:
|
||||
{
|
||||
@@ -3758,10 +3962,10 @@ packages:
|
||||
engines: { node: ^12.13.0 || ^14.15.0 || >=16.0.0 }
|
||||
deprecated: This package is no longer supported.
|
||||
|
||||
[email protected].2:
|
||||
[email protected].3:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-Tg3REVykwKmVBCsroeCE/KhHAJx3e/m0FgNZWXJhn3EEh01qhdsVfWpM/ecawin73or7YcvB/99S8vVPU1nczg==,
|
||||
integrity: sha512-SvxFgk9PD2m6tXEaqB6DENOpe4jhov/Ili/2JmOnPAAIGUR6H9WajCzVuHfq3bvQxmGRvkQQRv/rfvAuLTme3g==,
|
||||
}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
@@ -4119,10 +4323,10 @@ packages:
|
||||
}
|
||||
engines: { node: '>= 0.8.0' }
|
||||
|
||||
[email protected].1:
|
||||
[email protected].2:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-7CAwy5dRsxs8PHXT3twixW9/OEll8MLE0VRPCJyl7CkS6VHGPSlsVaWTiASPTyGyYRyApxlaWTzwUxVNrhcwDg==,
|
||||
integrity: sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==,
|
||||
}
|
||||
engines: { node: '>=14' }
|
||||
hasBin: true
|
||||
@@ -5049,6 +5253,12 @@ packages:
|
||||
engines: { node: '>=0.8.0' }
|
||||
hasBin: true
|
||||
|
||||
[email protected]:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==,
|
||||
}
|
||||
|
||||
[email protected]:
|
||||
resolution:
|
||||
{
|
||||
@@ -5453,6 +5663,87 @@ snapshots:
|
||||
|
||||
'@hutson/[email protected]': {}
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
dependencies:
|
||||
'@inquirer/core': 8.2.2
|
||||
'@inquirer/figures': 1.0.3
|
||||
'@inquirer/type': 1.3.3
|
||||
ansi-escapes: 4.3.2
|
||||
chalk: 4.1.2
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
dependencies:
|
||||
'@inquirer/core': 8.2.2
|
||||
'@inquirer/type': 1.3.3
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
dependencies:
|
||||
'@inquirer/figures': 1.0.3
|
||||
'@inquirer/type': 1.3.3
|
||||
'@types/mute-stream': 0.0.4
|
||||
'@types/node': 20.14.2
|
||||
'@types/wrap-ansi': 3.0.0
|
||||
ansi-escapes: 4.3.2
|
||||
chalk: 4.1.2
|
||||
cli-spinners: 2.9.2
|
||||
cli-width: 4.1.0
|
||||
mute-stream: 1.0.0
|
||||
signal-exit: 4.1.0
|
||||
strip-ansi: 6.0.1
|
||||
wrap-ansi: 6.2.0
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
dependencies:
|
||||
'@inquirer/core': 8.2.2
|
||||
'@inquirer/type': 1.3.3
|
||||
external-editor: 3.1.0
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
dependencies:
|
||||
'@inquirer/core': 8.2.2
|
||||
'@inquirer/type': 1.3.3
|
||||
chalk: 4.1.2
|
||||
|
||||
'@inquirer/[email protected]': {}
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
dependencies:
|
||||
'@inquirer/core': 8.2.2
|
||||
'@inquirer/type': 1.3.3
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
dependencies:
|
||||
'@inquirer/core': 8.2.2
|
||||
'@inquirer/type': 1.3.3
|
||||
ansi-escapes: 4.3.2
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
dependencies:
|
||||
'@inquirer/checkbox': 2.3.5
|
||||
'@inquirer/confirm': 3.1.9
|
||||
'@inquirer/editor': 2.1.9
|
||||
'@inquirer/expand': 2.1.9
|
||||
'@inquirer/input': 2.1.9
|
||||
'@inquirer/password': 2.1.9
|
||||
'@inquirer/rawlist': 2.1.9
|
||||
'@inquirer/select': 2.3.5
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
dependencies:
|
||||
'@inquirer/core': 8.2.2
|
||||
'@inquirer/type': 1.3.3
|
||||
chalk: 4.1.2
|
||||
|
||||
'@inquirer/[email protected]':
|
||||
dependencies:
|
||||
'@inquirer/core': 8.2.2
|
||||
'@inquirer/figures': 1.0.3
|
||||
'@inquirer/type': 1.3.3
|
||||
ansi-escapes: 4.3.2
|
||||
chalk: 4.1.2
|
||||
|
||||
'@inquirer/[email protected]': {}
|
||||
|
||||
'@isaacs/[email protected]':
|
||||
dependencies:
|
||||
string-width: 5.1.2
|
||||
@@ -5486,7 +5777,7 @@ snapshots:
|
||||
'@lerna/[email protected]([email protected])([email protected])':
|
||||
dependencies:
|
||||
'@npmcli/run-script': 7.0.2
|
||||
'@nx/devkit': 19.2.2([email protected].2)
|
||||
'@nx/devkit': 19.2.3([email protected].3)
|
||||
'@octokit/plugin-enterprise-rest': 6.0.1
|
||||
'@octokit/rest': 19.0.11([email protected])
|
||||
byte-size: 8.1.1
|
||||
@@ -5523,7 +5814,7 @@ snapshots:
|
||||
npm-packlist: 5.1.1
|
||||
npm-registry-fetch: 14.0.5
|
||||
npmlog: 6.0.2
|
||||
nx: 19.2.2
|
||||
nx: 19.2.3
|
||||
p-map: 4.0.0
|
||||
p-map-series: 2.1.0
|
||||
p-queue: 6.6.2
|
||||
@@ -5558,25 +5849,25 @@ snapshots:
|
||||
- supports-color
|
||||
- typescript
|
||||
|
||||
'@microsoft/[email protected]':
|
||||
'@microsoft/[email protected](@types/[email protected])':
|
||||
dependencies:
|
||||
'@microsoft/tsdoc': 0.15.0
|
||||
'@microsoft/tsdoc-config': 0.17.0
|
||||
'@rushstack/node-core-library': 5.4.1
|
||||
'@rushstack/node-core-library': 5.4.1(@types/[email protected])
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
|
||||
'@microsoft/[email protected]':
|
||||
'@microsoft/[email protected](@types/[email protected])':
|
||||
dependencies:
|
||||
'@microsoft/api-extractor-model': 7.29.2
|
||||
'@microsoft/api-extractor-model': 7.29.2(@types/[email protected])
|
||||
'@microsoft/tsdoc': 0.15.0
|
||||
'@microsoft/tsdoc-config': 0.17.0
|
||||
'@rushstack/node-core-library': 5.4.1
|
||||
'@rushstack/node-core-library': 5.4.1(@types/[email protected])
|
||||
'@rushstack/rig-package': 0.5.2
|
||||
'@rushstack/terminal': 0.13.0
|
||||
'@rushstack/ts-command-line': 4.22.0
|
||||
'@rushstack/terminal': 0.13.0(@types/[email protected])
|
||||
'@rushstack/ts-command-line': 4.22.0(@types/[email protected])
|
||||
lodash: 4.17.21
|
||||
minimatch: 3.0.5
|
||||
minimatch: 3.0.8
|
||||
resolve: 1.22.8
|
||||
semver: 7.5.4
|
||||
source-map: 0.6.1
|
||||
@@ -5655,62 +5946,62 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@nrwl/[email protected].2([email protected].2)':
|
||||
'@nrwl/[email protected].3([email protected].3)':
|
||||
dependencies:
|
||||
'@nx/devkit': 19.2.2([email protected].2)
|
||||
'@nx/devkit': 19.2.3([email protected].3)
|
||||
transitivePeerDependencies:
|
||||
- nx
|
||||
|
||||
'@nrwl/[email protected].2':
|
||||
'@nrwl/[email protected].3':
|
||||
dependencies:
|
||||
nx: 19.2.2
|
||||
nx: 19.2.3
|
||||
tslib: 2.6.3
|
||||
transitivePeerDependencies:
|
||||
- '@swc-node/register'
|
||||
- '@swc/core'
|
||||
- debug
|
||||
|
||||
'@nx/[email protected].2([email protected].2)':
|
||||
'@nx/[email protected].3([email protected].3)':
|
||||
dependencies:
|
||||
'@nrwl/devkit': 19.2.2([email protected].2)
|
||||
'@nrwl/devkit': 19.2.3([email protected].3)
|
||||
ejs: 3.1.10
|
||||
enquirer: 2.3.6
|
||||
ignore: 5.3.1
|
||||
minimatch: 9.0.3
|
||||
nx: 19.2.2
|
||||
nx: 19.2.3
|
||||
semver: 7.6.2
|
||||
tmp: 0.2.3
|
||||
tslib: 2.6.3
|
||||
yargs-parser: 21.1.1
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
optional: true
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
optional: true
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
optional: true
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
optional: true
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
optional: true
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
optional: true
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
optional: true
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
optional: true
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
optional: true
|
||||
|
||||
'@nx/[email protected].2':
|
||||
'@nx/[email protected].3':
|
||||
optional: true
|
||||
|
||||
'@octokit/[email protected]': {}
|
||||
@@ -5853,7 +6144,7 @@ snapshots:
|
||||
'@rollup/[email protected]':
|
||||
optional: true
|
||||
|
||||
'@rushstack/[email protected]':
|
||||
'@rushstack/[email protected](@types/[email protected])':
|
||||
dependencies:
|
||||
ajv: 8.13.0
|
||||
ajv-draft-04: 1.0.0([email protected])
|
||||
@@ -5863,20 +6154,24 @@ snapshots:
|
||||
jju: 1.4.0
|
||||
resolve: 1.22.8
|
||||
semver: 7.5.4
|
||||
optionalDependencies:
|
||||
'@types/node': 20.14.2
|
||||
|
||||
'@rushstack/[email protected]':
|
||||
dependencies:
|
||||
resolve: 1.22.8
|
||||
strip-json-comments: 3.1.1
|
||||
|
||||
'@rushstack/[email protected]':
|
||||
'@rushstack/[email protected](@types/[email protected])':
|
||||
dependencies:
|
||||
'@rushstack/node-core-library': 5.4.1
|
||||
'@rushstack/node-core-library': 5.4.1(@types/[email protected])
|
||||
supports-color: 8.1.1
|
||||
optionalDependencies:
|
||||
'@types/node': 20.14.2
|
||||
|
||||
'@rushstack/[email protected]':
|
||||
'@rushstack/[email protected](@types/[email protected])':
|
||||
dependencies:
|
||||
'@rushstack/terminal': 0.13.0
|
||||
'@rushstack/terminal': 0.13.0(@types/[email protected])
|
||||
'@types/argparse': 1.0.38
|
||||
argparse: 1.0.10
|
||||
string-argv: 0.3.2
|
||||
@@ -5958,14 +6253,32 @@ snapshots:
|
||||
|
||||
'@types/[email protected]': {}
|
||||
|
||||
'@types/[email protected]': {}
|
||||
|
||||
'@types/[email protected]': {}
|
||||
|
||||
'@types/[email protected]': {}
|
||||
|
||||
'@types/[email protected]':
|
||||
dependencies:
|
||||
'@types/node': 20.14.2
|
||||
|
||||
'@types/[email protected]':
|
||||
dependencies:
|
||||
undici-types: 5.26.5
|
||||
|
||||
'@types/[email protected]': {}
|
||||
|
||||
'@types/[email protected]': {}
|
||||
|
||||
'@types/[email protected]': {}
|
||||
|
||||
'@types/[email protected]': {}
|
||||
|
||||
'@types/[email protected]':
|
||||
dependencies:
|
||||
'@types/yargs-parser': 21.0.3
|
||||
|
||||
'@typescript-eslint/[email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])':
|
||||
dependencies:
|
||||
'@eslint-community/regexpp': 4.10.1
|
||||
@@ -6324,6 +6637,8 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
string-width: 4.2.3
|
||||
@@ -6675,6 +6990,18 @@ snapshots:
|
||||
signal-exit: 3.0.7
|
||||
strip-final-newline: 2.0.0
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
cross-spawn: 7.0.3
|
||||
get-stream: 6.0.1
|
||||
human-signals: 2.1.0
|
||||
is-stream: 2.0.1
|
||||
merge-stream: 2.0.0
|
||||
npm-run-path: 4.0.1
|
||||
onetime: 5.1.2
|
||||
signal-exit: 3.0.7
|
||||
strip-final-newline: 2.0.0
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
@@ -6747,7 +7074,7 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
foreground-child@3.1.1:
|
||||
foreground-child@3.2.0:
|
||||
dependencies:
|
||||
cross-spawn: 7.0.3
|
||||
signal-exit: 4.1.0
|
||||
@@ -6815,6 +7142,10 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
dargs: 7.0.0
|
||||
@@ -6854,7 +7185,7 @@ snapshots:
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
foreground-child: 3.1.1
|
||||
foreground-child: 3.2.0
|
||||
jackspeak: 3.4.0
|
||||
minimatch: 9.0.4
|
||||
minipass: 7.1.2
|
||||
@@ -7106,6 +7437,8 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
text-extensions: 1.9.0
|
||||
@@ -7207,7 +7540,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@lerna/create': 8.1.3([email protected])([email protected])
|
||||
'@npmcli/run-script': 7.0.2
|
||||
'@nx/devkit': 19.2.2([email protected].2)
|
||||
'@nx/devkit': 19.2.3([email protected].3)
|
||||
'@octokit/plugin-enterprise-rest': 6.0.1
|
||||
'@octokit/rest': 19.0.11([email protected])
|
||||
byte-size: 8.1.1
|
||||
@@ -7250,7 +7583,7 @@ snapshots:
|
||||
npm-packlist: 5.1.1
|
||||
npm-registry-fetch: 14.0.5
|
||||
npmlog: 6.0.2
|
||||
nx: 19.2.2
|
||||
nx: 19.2.3
|
||||
p-map: 4.0.0
|
||||
p-map-series: 2.1.0
|
||||
p-pipe: 3.1.0
|
||||
@@ -7464,6 +7797,10 @@ snapshots:
|
||||
dependencies:
|
||||
brace-expansion: 1.1.11
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
brace-expansion: 1.1.11
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
brace-expansion: 1.1.11
|
||||
@@ -7554,7 +7891,7 @@ snapshots:
|
||||
array-differ: 3.0.0
|
||||
array-union: 2.1.0
|
||||
arrify: 2.0.1
|
||||
minimatch: 3.1.2
|
||||
minimatch: 3.0.5
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
@@ -7719,9 +8056,9 @@ snapshots:
|
||||
gauge: 4.0.4
|
||||
set-blocking: 2.0.0
|
||||
|
||||
[email protected].2:
|
||||
[email protected].3:
|
||||
dependencies:
|
||||
'@nrwl/tao': 19.2.2
|
||||
'@nrwl/tao': 19.2.3
|
||||
'@yarnpkg/lockfile': 1.1.0
|
||||
'@yarnpkg/parsers': 3.0.0-rc.46
|
||||
'@zkochan/js-yaml': 0.0.7
|
||||
@@ -7756,16 +8093,16 @@ snapshots:
|
||||
yargs: 17.7.2
|
||||
yargs-parser: 21.1.1
|
||||
optionalDependencies:
|
||||
'@nx/nx-darwin-arm64': 19.2.2
|
||||
'@nx/nx-darwin-x64': 19.2.2
|
||||
'@nx/nx-freebsd-x64': 19.2.2
|
||||
'@nx/nx-linux-arm-gnueabihf': 19.2.2
|
||||
'@nx/nx-linux-arm64-gnu': 19.2.2
|
||||
'@nx/nx-linux-arm64-musl': 19.2.2
|
||||
'@nx/nx-linux-x64-gnu': 19.2.2
|
||||
'@nx/nx-linux-x64-musl': 19.2.2
|
||||
'@nx/nx-win32-arm64-msvc': 19.2.2
|
||||
'@nx/nx-win32-x64-msvc': 19.2.2
|
||||
'@nx/nx-darwin-arm64': 19.2.3
|
||||
'@nx/nx-darwin-x64': 19.2.3
|
||||
'@nx/nx-freebsd-x64': 19.2.3
|
||||
'@nx/nx-linux-arm-gnueabihf': 19.2.3
|
||||
'@nx/nx-linux-arm64-gnu': 19.2.3
|
||||
'@nx/nx-linux-arm64-musl': 19.2.3
|
||||
'@nx/nx-linux-x64-gnu': 19.2.3
|
||||
'@nx/nx-linux-x64-musl': 19.2.3
|
||||
'@nx/nx-win32-arm64-msvc': 19.2.3
|
||||
'@nx/nx-win32-x64-msvc': 19.2.3
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
|
||||
@@ -7970,7 +8307,7 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected].1: {}
|
||||
[email protected].2: {}
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
@@ -8430,14 +8767,14 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected](@microsoft/[email protected])([email protected]):
|
||||
[email protected](@microsoft/[email protected](@types/[email protected]))([email protected]):
|
||||
dependencies:
|
||||
bundle-require: 4.2.1([email protected])
|
||||
cac: 6.7.14
|
||||
chokidar: 3.6.0
|
||||
debug: 4.3.5
|
||||
esbuild: 0.21.5
|
||||
execa: 5.0.0
|
||||
execa: 5.1.1
|
||||
globby: 11.1.0
|
||||
joycon: 3.1.1
|
||||
postcss-load-config: 4.0.2
|
||||
@@ -8447,7 +8784,7 @@ snapshots:
|
||||
sucrase: 3.35.0
|
||||
tree-kill: 1.2.2
|
||||
optionalDependencies:
|
||||
'@microsoft/api-extractor': 7.47.0
|
||||
'@microsoft/api-extractor': 7.47.0(@types/[email protected])
|
||||
typescript: 5.4.5
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@@ -8494,6 +8831,8 @@ snapshots:
|
||||
[email protected]:
|
||||
optional: true
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
unique-slug: 4.0.0
|
||||
@@ -8573,7 +8912,7 @@ snapshots:
|
||||
'@colors/colors': 1.6.0
|
||||
'@dabh/diagnostics': 2.0.3
|
||||
async: 3.2.5
|
||||
is-stream: 2.0.0
|
||||
is-stream: 2.0.1
|
||||
logform: 2.6.0
|
||||
one-time: 1.0.0
|
||||
readable-stream: 3.6.2
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
packages:
|
||||
- "server"
|
||||
- "client"
|
||||
- "shared"
|
||||
- "cef"
|
||||
- "cli"
|
||||
- "shared-types"
|
||||
@@ -0,0 +1 @@
|
||||
Currently not maintained.
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "rage-fw-rpc",
|
||||
"version": "0.0.23-alpha.0",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/src/index.d.ts",
|
||||
"files": [
|
||||
"dist/**/*"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup"
|
||||
},
|
||||
"dependencies": {
|
||||
"rage-rpc": "^0.4.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@ragempcommunity/types-client": "^2.1.8",
|
||||
"rage-fw-shared-types": "workspace:^"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "SashaGoncharov19",
|
||||
"license": "MIT",
|
||||
"description": "Client side of rage-fw",
|
||||
"gitHead": "053e4fd12aa120d53e11e0d2009c0df78c1a2ad0"
|
||||
}
|
||||
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
declare var mp: any;
|
||||
declare var global: any;
|
||||
declare var window: any;
|
||||
|
||||
declare type ProcedureListener = (args: any, info: ProcedureListenerInfo) => any;
|
||||
|
||||
declare interface Player {
|
||||
call: (eventName: string, args?: any[]) => void;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
declare interface Browser {
|
||||
url: string;
|
||||
execute: (code: string) => void;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
declare interface ProcedureListenerInfo {
|
||||
environment: string;
|
||||
id?: string;
|
||||
player?: Player;
|
||||
browser?: Browser;
|
||||
}
|
||||
|
||||
declare interface CallOptions {
|
||||
timeout?: number;
|
||||
noRet?: boolean;
|
||||
}
|
||||
|
||||
declare interface Event {
|
||||
req?: number;
|
||||
ret?: number;
|
||||
b?: string;
|
||||
id: string;
|
||||
name?: string;
|
||||
args?: any;
|
||||
env: string;
|
||||
fenv?: string;
|
||||
res?: any;
|
||||
err?: any;
|
||||
noRet?: number;
|
||||
}
|
||||
@@ -0,0 +1,568 @@
|
||||
import * as util from './util';
|
||||
|
||||
const environment = util.getEnvironment();
|
||||
if(!environment) throw 'Unknown RAGE environment';
|
||||
|
||||
const ERR_NOT_FOUND = 'PROCEDURE_NOT_FOUND';
|
||||
|
||||
const IDENTIFIER = '__rpc:id';
|
||||
const PROCESS_EVENT = '__rpc:process';
|
||||
const BROWSER_REGISTER = '__rpc:browserRegister';
|
||||
const BROWSER_UNREGISTER = '__rpc:browserUnregister';
|
||||
const TRIGGER_EVENT = '__rpc:triggerEvent';
|
||||
const TRIGGER_EVENT_BROWSERS = '__rpc:triggerEventBrowsers';
|
||||
|
||||
const glob = environment === 'cef' ? window : global;
|
||||
|
||||
if(!glob[PROCESS_EVENT]){
|
||||
glob.__rpcListeners = {};
|
||||
glob.__rpcPending = {};
|
||||
glob.__rpcEvListeners = {};
|
||||
|
||||
glob[PROCESS_EVENT] = (player: Player | string, rawData?: string) => {
|
||||
if(environment !== "server") rawData = player as string;
|
||||
const data: Event = util.parseData(rawData);
|
||||
|
||||
if(data.req){ // someone is trying to remotely call a procedure
|
||||
const info: ProcedureListenerInfo = {
|
||||
id: data.id,
|
||||
environment: data.fenv || data.env
|
||||
};
|
||||
if(environment === "server") info.player = player as Player;
|
||||
const part = {
|
||||
ret: 1,
|
||||
id: data.id,
|
||||
env: environment
|
||||
};
|
||||
let ret: (ev: Event) => void;
|
||||
switch(environment){
|
||||
case "server":
|
||||
ret = ev => info.player.call(PROCESS_EVENT, [util.stringifyData(ev)]);
|
||||
break;
|
||||
case "client": {
|
||||
if(data.env === "server"){
|
||||
ret = ev => mp.events.callRemote(PROCESS_EVENT, util.stringifyData(ev));
|
||||
}else if(data.env === "cef"){
|
||||
const browser = data.b && glob.__rpcBrowsers[data.b];
|
||||
info.browser = browser;
|
||||
ret = ev => browser && util.isBrowserValid(browser) && passEventToBrowser(browser, ev, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "cef": {
|
||||
ret = ev => mp.trigger(PROCESS_EVENT, util.stringifyData(ev));
|
||||
}
|
||||
}
|
||||
if(ret){
|
||||
const promise = callProcedure(data.name, data.args, info);
|
||||
if(!data.noRet) promise.then(res => ret({ ...part, res })).catch(err => ret({ ...part, err: err ? err : null }));
|
||||
}
|
||||
}else if(data.ret){ // a previously called remote procedure has returned
|
||||
const info = glob.__rpcPending[data.id];
|
||||
if(environment === "server" && info.player !== player) return;
|
||||
if(info){
|
||||
info.resolve(data.hasOwnProperty('err') ? util.promiseReject(data.err) : util.promiseResolve(data.res));
|
||||
delete glob.__rpcPending[data.id];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if(environment !== "cef"){
|
||||
mp.events.add(PROCESS_EVENT, glob[PROCESS_EVENT]);
|
||||
|
||||
if(environment === "client"){
|
||||
// set up internal pass-through events
|
||||
register('__rpc:callServer', ([name, args, noRet], info) => _callServer(name, args, { fenv: info.environment, noRet }));
|
||||
register('__rpc:callBrowsers', ([name, args, noRet], info) => _callBrowsers(null, name, args, { fenv: info.environment, noRet }));
|
||||
|
||||
// set up browser identifiers
|
||||
glob.__rpcBrowsers = {};
|
||||
const initBrowser = (browser: Browser): void => {
|
||||
const id = util.uid();
|
||||
Object.keys(glob.__rpcBrowsers).forEach(key => {
|
||||
const b = glob.__rpcBrowsers[key];
|
||||
if(!b || !util.isBrowserValid(b) || b === browser) delete glob.__rpcBrowsers[key];
|
||||
});
|
||||
glob.__rpcBrowsers[id] = browser;
|
||||
browser.execute(`
|
||||
window.name = '${id}';
|
||||
if(typeof window['${IDENTIFIER}'] === 'undefined'){
|
||||
window['${IDENTIFIER}'] = Promise.resolve(window.name);
|
||||
}else{
|
||||
window['${IDENTIFIER}:resolve'](window.name);
|
||||
}
|
||||
`);
|
||||
};
|
||||
mp.browsers.forEach(initBrowser);
|
||||
mp.events.add('browserCreated', initBrowser);
|
||||
|
||||
// set up browser registration map
|
||||
glob.__rpcBrowserProcedures = {};
|
||||
mp.events.add(BROWSER_REGISTER, (data: string) => {
|
||||
const [browserId, name] = JSON.parse(data);
|
||||
glob.__rpcBrowserProcedures[name] = browserId;
|
||||
});
|
||||
mp.events.add(BROWSER_UNREGISTER, (data: string) => {
|
||||
const [browserId, name] = JSON.parse(data);
|
||||
if(glob.__rpcBrowserProcedures[name] === browserId) delete glob.__rpcBrowserProcedures[name];
|
||||
});
|
||||
|
||||
register(TRIGGER_EVENT_BROWSERS, ([name, args], info) => {
|
||||
Object.values(glob.__rpcBrowsers).forEach(browser => {
|
||||
_callBrowser(browser, TRIGGER_EVENT, [name, args], { fenv: info.environment, noRet: 1 });
|
||||
});
|
||||
});
|
||||
}
|
||||
}else{
|
||||
if(typeof glob[IDENTIFIER] === 'undefined'){
|
||||
glob[IDENTIFIER] = new Promise(resolve => {
|
||||
if (window.name) {
|
||||
resolve(window.name);
|
||||
}else{
|
||||
glob[IDENTIFIER+':resolve'] = resolve;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
register(TRIGGER_EVENT, ([name, args], info) => callEvent(name, args, info));
|
||||
}
|
||||
|
||||
function passEventToBrowser(browser: Browser, data: Event, ignoreNotFound: boolean): void {
|
||||
const raw = util.stringifyData(data);
|
||||
browser.execute(`var process = window["${PROCESS_EVENT}"]; if(process){ process(${JSON.stringify(raw)}); }else{ ${ignoreNotFound ? '' : `mp.trigger("${PROCESS_EVENT}", '{"ret":1,"id":"${data.id}","err":"${ERR_NOT_FOUND}","env":"cef"}');`} }`);
|
||||
}
|
||||
|
||||
function callProcedure(name: string, args: any, info: ProcedureListenerInfo): Promise<any> {
|
||||
const listener = glob.__rpcListeners[name];
|
||||
if(!listener) return util.promiseReject(ERR_NOT_FOUND);
|
||||
return util.promiseResolve(listener(args, info));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a procedure.
|
||||
* @param {string} name - The name of the procedure.
|
||||
* @param {function} cb - The procedure's callback. The return value will be sent back to the caller.
|
||||
* @returns {Function} The function, which unregister the event.
|
||||
*/
|
||||
export function register(name: string, cb: ProcedureListener): Function {
|
||||
if(arguments.length !== 2) throw 'register expects 2 arguments: "name" and "cb"';
|
||||
if(environment === "cef") glob[IDENTIFIER].then((id: string) => mp.trigger(BROWSER_REGISTER, JSON.stringify([id, name])));
|
||||
glob.__rpcListeners[name] = cb;
|
||||
|
||||
return () => unregister(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister a procedure.
|
||||
* @param {string} name - The name of the procedure.
|
||||
*/
|
||||
export function unregister(name: string): void {
|
||||
if(arguments.length !== 1) throw 'unregister expects 1 argument: "name"';
|
||||
if(environment === "cef") glob[IDENTIFIER].then((id: string) => mp.trigger(BROWSER_UNREGISTER, JSON.stringify([id, name])));
|
||||
glob.__rpcListeners[name] = undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls a local procedure. Only procedures registered in the same context will be resolved.
|
||||
*
|
||||
* Can be called from any environment.
|
||||
*
|
||||
* @param name - The name of the locally registered procedure.
|
||||
* @param args - Any parameters for the procedure.
|
||||
* @param options - Any options.
|
||||
* @returns The result from the procedure.
|
||||
*/
|
||||
export function call(name: string, args?: any, options: CallOptions = {}): Promise<any> {
|
||||
if(arguments.length < 1 || arguments.length > 3) return util.promiseReject('call expects 1 to 3 arguments: "name", optional "args", and optional "options"');
|
||||
return util.promiseTimeout(callProcedure(name, args, { environment }), options.timeout);
|
||||
}
|
||||
|
||||
function _callServer(name: string, args?: any, extraData: any = {}): Promise<any> {
|
||||
switch(environment){
|
||||
case "server": {
|
||||
return call(name, args);
|
||||
}
|
||||
case "client": {
|
||||
const id = util.uid();
|
||||
return new Promise(resolve => {
|
||||
if(!extraData.noRet){
|
||||
glob.__rpcPending[id] = {
|
||||
resolve
|
||||
};
|
||||
}
|
||||
const event: Event = {
|
||||
req: 1,
|
||||
id,
|
||||
name,
|
||||
env: environment,
|
||||
args,
|
||||
...extraData
|
||||
};
|
||||
mp.events.callRemote(PROCESS_EVENT, util.stringifyData(event));
|
||||
});
|
||||
}
|
||||
case "cef": {
|
||||
return callClient('__rpc:callServer', [name, args, +extraData.noRet]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls a remote procedure registered on the server.
|
||||
*
|
||||
* Can be called from any environment.
|
||||
*
|
||||
* @param name - The name of the registered procedure.
|
||||
* @param args - Any parameters for the procedure.
|
||||
* @param options - Any options.
|
||||
* @returns The result from the procedure.
|
||||
*/
|
||||
export function callServer(name: string, args?: any, options: CallOptions = {}): Promise<any> {
|
||||
if(arguments.length < 1 || arguments.length > 3) return util.promiseReject('callServer expects 1 to 3 arguments: "name", optional "args", and optional "options"');
|
||||
|
||||
let extraData: any = {};
|
||||
if(options.noRet) extraData.noRet = 1;
|
||||
|
||||
return util.promiseTimeout(_callServer(name, args, extraData), options.timeout);
|
||||
}
|
||||
|
||||
function _callClient(player: Player, name: string, args?: any, extraData: any = {}): Promise<any> {
|
||||
switch(environment){
|
||||
case 'client': {
|
||||
return call(name, args);
|
||||
}
|
||||
case 'server': {
|
||||
const id = util.uid();
|
||||
return new Promise(resolve => {
|
||||
if(!extraData.noRet){
|
||||
glob.__rpcPending[id] = {
|
||||
resolve,
|
||||
player
|
||||
};
|
||||
}
|
||||
const event: Event = {
|
||||
req: 1,
|
||||
id,
|
||||
name,
|
||||
env: environment,
|
||||
args,
|
||||
...extraData
|
||||
};
|
||||
player.call(PROCESS_EVENT, [util.stringifyData(event)]);
|
||||
});
|
||||
}
|
||||
case 'cef': {
|
||||
const id = util.uid();
|
||||
return glob[IDENTIFIER].then((browserId: string) => {
|
||||
return new Promise(resolve => {
|
||||
if(!extraData.noRet){
|
||||
glob.__rpcPending[id] = {
|
||||
resolve
|
||||
};
|
||||
}
|
||||
const event: Event = {
|
||||
b: browserId,
|
||||
req: 1,
|
||||
id,
|
||||
name,
|
||||
env: environment,
|
||||
args,
|
||||
...extraData
|
||||
};
|
||||
mp.trigger(PROCESS_EVENT, util.stringifyData(event));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls a remote procedure registered on the client.
|
||||
*
|
||||
* Can be called from any environment.
|
||||
*
|
||||
* @param player - The player to call the procedure on.
|
||||
* @param name - The name of the registered procedure.
|
||||
* @param args - Any parameters for the procedure.
|
||||
* @param options - Any options.
|
||||
* @returns The result from the procedure.
|
||||
*/
|
||||
export function callClient(player: Player | string, name?: string | any, args?: any, options: CallOptions = {}): Promise<any> {
|
||||
switch(environment){
|
||||
case 'client': {
|
||||
options = args || {};
|
||||
args = name;
|
||||
name = player;
|
||||
player = null;
|
||||
if((arguments.length < 1 || arguments.length > 3) || typeof name !== 'string') return util.promiseReject('callClient from the client expects 1 to 3 arguments: "name", optional "args", and optional "options"');
|
||||
break;
|
||||
}
|
||||
case 'server': {
|
||||
if((arguments.length < 2 || arguments.length > 4) || typeof player !== 'object') return util.promiseReject('callClient from the server expects 2 to 4 arguments: "player", "name", optional "args", and optional "options"');
|
||||
break;
|
||||
}
|
||||
case 'cef': {
|
||||
options = args || {};
|
||||
args = name;
|
||||
name = player;
|
||||
player = null;
|
||||
if((arguments.length < 1 || arguments.length > 3) || typeof name !== 'string') return util.promiseReject('callClient from the browser expects 1 to 3 arguments: "name", optional "args", and optional "options"');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let extraData: any = {};
|
||||
if(options.noRet) extraData.noRet = 1;
|
||||
|
||||
return util.promiseTimeout(_callClient(player as Player, name, args, extraData), options.timeout);
|
||||
}
|
||||
|
||||
function _callBrowser(browser: Browser, name: string, args?: any, extraData: any = {}): Promise<any> {
|
||||
return new Promise(resolve => {
|
||||
const id = util.uid();
|
||||
if(!extraData.noRet){
|
||||
glob.__rpcPending[id] = {
|
||||
resolve
|
||||
};
|
||||
}
|
||||
passEventToBrowser(browser, {
|
||||
req: 1,
|
||||
id,
|
||||
name,
|
||||
env: environment,
|
||||
args,
|
||||
...extraData
|
||||
}, false);
|
||||
});
|
||||
}
|
||||
|
||||
function _callBrowsers(player: Player, name: string, args?: any, extraData: any = {}): Promise<any> {
|
||||
switch(environment){
|
||||
case 'client':
|
||||
const browserId = glob.__rpcBrowserProcedures[name];
|
||||
if(!browserId) return util.promiseReject(ERR_NOT_FOUND);
|
||||
const browser = glob.__rpcBrowsers[browserId];
|
||||
if(!browser || !util.isBrowserValid(browser)) return util.promiseReject(ERR_NOT_FOUND);
|
||||
return _callBrowser(browser, name, args, extraData);
|
||||
case 'server':
|
||||
return _callClient(player, '__rpc:callBrowsers', [name, args, +extraData.noRet], extraData);
|
||||
case 'cef':
|
||||
return _callClient(null, '__rpc:callBrowsers', [name, args, +extraData.noRet], extraData);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls a remote procedure registered in any browser context.
|
||||
*
|
||||
* Can be called from any environment.
|
||||
*
|
||||
* @param player - The player to call the procedure on.
|
||||
* @param name - The name of the registered procedure.
|
||||
* @param args - Any parameters for the procedure.
|
||||
* @param options - Any options.
|
||||
* @returns The result from the procedure.
|
||||
*/
|
||||
export function callBrowsers(player: Player | string, name?: string | any, args?: any, options: CallOptions = {}): Promise<any> {
|
||||
let promise;
|
||||
let extraData: any = {};
|
||||
|
||||
switch(environment){
|
||||
case 'client':
|
||||
case 'cef':
|
||||
options = args || {};
|
||||
args = name;
|
||||
name = player;
|
||||
if(arguments.length < 1 || arguments.length > 3) return util.promiseReject('callBrowsers from the client or browser expects 1 to 3 arguments: "name", optional "args", and optional "options"');
|
||||
if(options.noRet) extraData.noRet = 1;
|
||||
promise = _callBrowsers(null, name, args, extraData);
|
||||
break;
|
||||
case 'server':
|
||||
if(arguments.length < 2 || arguments.length > 4) return util.promiseReject('callBrowsers from the server expects 2 to 4 arguments: "player", "name", optional "args", and optional "options"');
|
||||
if(options.noRet) extraData.noRet = 1;
|
||||
promise = _callBrowsers(player as Player, name, args, extraData);
|
||||
break;
|
||||
}
|
||||
|
||||
if(promise){
|
||||
return util.promiseTimeout(promise, options.timeout);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls a remote procedure registered in a specific browser instance.
|
||||
*
|
||||
* Client-side environment only.
|
||||
*
|
||||
* @param browser - The browser instance.
|
||||
* @param name - The name of the registered procedure.
|
||||
* @param args - Any parameters for the procedure.
|
||||
* @param options - Any options.
|
||||
* @returns The result from the procedure.
|
||||
*/
|
||||
export function callBrowser(browser: Browser, name: string, args?: any, options: CallOptions = {}): Promise<any> {
|
||||
if(environment !== 'client') return util.promiseReject('callBrowser can only be used in the client environment');
|
||||
if(arguments.length < 2 || arguments.length > 4) return util.promiseReject('callBrowser expects 2 to 4 arguments: "browser", "name", optional "args", and optional "options"');
|
||||
|
||||
let extraData: any = {};
|
||||
if(options.noRet) extraData.noRet = 1;
|
||||
|
||||
return util.promiseTimeout(_callBrowser(browser, name, args, extraData), options.timeout);
|
||||
}
|
||||
|
||||
function callEvent(name: string, args: any, info: ProcedureListenerInfo){
|
||||
const listeners = glob.__rpcEvListeners[name];
|
||||
if(listeners){
|
||||
listeners.forEach(listener => listener(args, info));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register an event handler.
|
||||
* @param {string} name - The name of the event.
|
||||
* @param cb - The callback for the event.
|
||||
* @returns {Function} The function, which off the event.
|
||||
*/
|
||||
export function on(name: string, cb: ProcedureListener): Function {
|
||||
if(arguments.length !== 2) throw 'on expects 2 arguments: "name" and "cb"';
|
||||
|
||||
const listeners = glob.__rpcEvListeners[name] || new Set();
|
||||
listeners.add(cb);
|
||||
glob.__rpcEvListeners[name] = listeners;
|
||||
|
||||
return () => off(name, cb);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister an event handler.
|
||||
* @param {string} name - The name of the event.
|
||||
* @param cb - The callback for the event.
|
||||
*/
|
||||
export function off(name: string, cb: ProcedureListener){
|
||||
if(arguments.length !== 2) throw 'off expects 2 arguments: "name" and "cb"';
|
||||
|
||||
const listeners = glob.__rpcEvListeners[name];
|
||||
if(listeners){
|
||||
listeners.delete(cb);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers a local event. Only events registered in the same context will be triggered.
|
||||
*
|
||||
* Can be called from any environment.
|
||||
*
|
||||
* @param name - The name of the locally registered event.
|
||||
* @param args - Any parameters for the event.
|
||||
*/
|
||||
export function trigger(name: string, args?: any){
|
||||
if(arguments.length < 1 || arguments.length > 2) throw 'trigger expects 1 or 2 arguments: "name", and optional "args"';
|
||||
callEvent(name, args, { environment });
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers an event registered on the client.
|
||||
*
|
||||
* Can be called from any environment.
|
||||
*
|
||||
* @param player - The player to call the procedure on.
|
||||
* @param name - The name of the event.
|
||||
* @param args - Any parameters for the event.
|
||||
*/
|
||||
export function triggerClient(player: Player | string, name?: string | any, args?: any){
|
||||
switch(environment){
|
||||
case 'client': {
|
||||
args = name;
|
||||
name = player;
|
||||
player = null;
|
||||
if((arguments.length < 1 || arguments.length > 2) || typeof name !== 'string') throw 'triggerClient from the client expects 1 or 2 arguments: "name", and optional "args"';
|
||||
break;
|
||||
}
|
||||
case 'server': {
|
||||
if((arguments.length < 2 || arguments.length > 3) || typeof player !== 'object') throw 'triggerClient from the server expects 2 or 3 arguments: "player", "name", and optional "args"';
|
||||
break;
|
||||
}
|
||||
case 'cef': {
|
||||
args = name;
|
||||
name = player;
|
||||
player = null;
|
||||
if((arguments.length < 1 || arguments.length > 2) || typeof name !== 'string') throw 'triggerClient from the browser expects 1 or 2 arguments: "name", and optional "args"';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_callClient(player as Player, TRIGGER_EVENT, [name, args], { noRet: 1 });
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers an event registered on the server.
|
||||
*
|
||||
* Can be called from any environment.
|
||||
*
|
||||
* @param name - The name of the event.
|
||||
* @param args - Any parameters for the event.
|
||||
*/
|
||||
export function triggerServer(name: string, args?: any){
|
||||
if(arguments.length < 1 || arguments.length > 2) throw 'triggerServer expects 1 or 2 arguments: "name", and optional "args"';
|
||||
|
||||
_callServer(TRIGGER_EVENT, [name, args], { noRet: 1 });
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers an event registered in any browser context.
|
||||
*
|
||||
* Can be called from any environment.
|
||||
*
|
||||
* @param player - The player to call the procedure on.
|
||||
* @param name - The name of the event.
|
||||
* @param args - Any parameters for the event.
|
||||
*/
|
||||
export function triggerBrowsers(player: Player | string, name?: string | any, args?: any){
|
||||
switch(environment){
|
||||
case 'client':
|
||||
case 'cef':
|
||||
args = name;
|
||||
name = player;
|
||||
player = null;
|
||||
if(arguments.length < 1 || arguments.length > 2) throw 'triggerBrowsers from the client or browser expects 1 or 2 arguments: "name", and optional "args"';
|
||||
break;
|
||||
case 'server':
|
||||
if(arguments.length < 2 || arguments.length > 3) throw 'triggerBrowsers from the server expects 2 or 3 arguments: "player", "name", and optional "args"';
|
||||
break;
|
||||
}
|
||||
|
||||
_callClient(player as Player, TRIGGER_EVENT_BROWSERS, [name, args], { noRet: 1 });
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers an event registered in a specific browser instance.
|
||||
*
|
||||
* Client-side environment only.
|
||||
*
|
||||
* @param browser - The browser instance.
|
||||
* @param name - The name of the event.
|
||||
* @param args - Any parameters for the event.
|
||||
*/
|
||||
export function triggerBrowser(browser: Browser, name: string, args?: any){
|
||||
if(environment !== 'client') throw 'callBrowser can only be used in the client environment';
|
||||
if(arguments.length < 2 || arguments.length > 4) throw 'callBrowser expects 2 or 3 arguments: "browser", "name", and optional "args"';
|
||||
|
||||
_callBrowser(browser, TRIGGER_EVENT, [name, args], { noRet: 1});
|
||||
}
|
||||
|
||||
export default {
|
||||
register,
|
||||
unregister,
|
||||
call,
|
||||
callServer,
|
||||
callClient,
|
||||
callBrowsers,
|
||||
callBrowser,
|
||||
on,
|
||||
off,
|
||||
trigger,
|
||||
triggerServer,
|
||||
triggerClient,
|
||||
triggerBrowsers,
|
||||
triggerBrowser
|
||||
};
|
||||
@@ -0,0 +1,122 @@
|
||||
enum MpTypes {
|
||||
Blip = 'b',
|
||||
Checkpoint = 'cp',
|
||||
Colshape = 'c',
|
||||
Label = 'l',
|
||||
Marker = 'm',
|
||||
Object = 'o',
|
||||
Pickup = 'p',
|
||||
Player = 'pl',
|
||||
Vehicle = 'v'
|
||||
}
|
||||
|
||||
function isObjectMpType(obj: any, type: MpTypes){
|
||||
const client = getEnvironment() === 'client';
|
||||
if(obj && typeof obj === 'object' && typeof obj.id !== 'undefined'){
|
||||
const test = (type, collection, mpType) => client ? obj.type === type && collection.at(obj.id) === obj : obj instanceof mpType;
|
||||
switch(type){
|
||||
case MpTypes.Blip: return test('blip', mp.blips, mp.Blip);
|
||||
case MpTypes.Checkpoint: return test('checkpoint', mp.checkpoints, mp.Checkpoint);
|
||||
case MpTypes.Colshape: return test('colshape', mp.colshapes, mp.Colshape);
|
||||
case MpTypes.Label: return test('textlabel', mp.labels, mp.TextLabel);
|
||||
case MpTypes.Marker: return test('marker', mp.markers, mp.Marker);
|
||||
case MpTypes.Object: return test('object', mp.objects, mp.Object);
|
||||
case MpTypes.Pickup: return test('pickup', mp.pickups, mp.Pickup);
|
||||
case MpTypes.Player: return test('player', mp.players, mp.Player);
|
||||
case MpTypes.Vehicle: return test('vehicle', mp.vehicles, mp.Vehicle);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function uid(): string {
|
||||
const first = (Math.random() * 46656) | 0;
|
||||
const second = (Math.random() * 46656) | 0;
|
||||
const firstPart = ('000' + first.toString(36)).slice(-3);
|
||||
const secondPart = ('000' + second.toString(36)).slice(-3);
|
||||
return firstPart + secondPart;
|
||||
}
|
||||
|
||||
export function getEnvironment(): string {
|
||||
if ('mp' in window) return 'cef';
|
||||
if (mp.joaat) return 'server';
|
||||
else if (mp.game && mp.game.joaat) return 'client';
|
||||
}
|
||||
|
||||
export function stringifyData(data: any): string {
|
||||
const env = getEnvironment();
|
||||
return JSON.stringify(data, (_, value) => {
|
||||
if(env === 'client' || env === 'server' && value && typeof value === 'object'){
|
||||
let type;
|
||||
|
||||
if(isObjectMpType(value, MpTypes.Blip)) type = MpTypes.Blip;
|
||||
else if(isObjectMpType(value, MpTypes.Checkpoint)) type = MpTypes.Checkpoint;
|
||||
else if(isObjectMpType(value, MpTypes.Colshape)) type = MpTypes.Colshape;
|
||||
else if(isObjectMpType(value, MpTypes.Marker)) type = MpTypes.Marker;
|
||||
else if(isObjectMpType(value, MpTypes.Object)) type = MpTypes.Object;
|
||||
else if(isObjectMpType(value, MpTypes.Pickup)) type = MpTypes.Pickup;
|
||||
else if(isObjectMpType(value, MpTypes.Player)) type = MpTypes.Player;
|
||||
else if(isObjectMpType(value, MpTypes.Vehicle)) type = MpTypes.Vehicle;
|
||||
|
||||
if(type) return {
|
||||
__t: type,
|
||||
i: typeof value.remoteId === 'number' ? value.remoteId : value.id
|
||||
};
|
||||
}
|
||||
|
||||
return value;
|
||||
});
|
||||
}
|
||||
|
||||
export function parseData(data: string): any {
|
||||
const env = getEnvironment();
|
||||
return JSON.parse(data, (_, value) => {
|
||||
if((env === 'client' || env === 'server') && value && typeof value === 'object' && typeof value['__t'] === 'string' && typeof value.i === 'number' && Object.keys(value).length === 2){
|
||||
const id = value.i;
|
||||
const type = value['__t'];
|
||||
let collection;
|
||||
|
||||
switch(type){
|
||||
case MpTypes.Blip: collection = mp.blips; break;
|
||||
case MpTypes.Checkpoint: collection = mp.checkpoints; break;
|
||||
case MpTypes.Colshape: collection = mp.colshapes; break;
|
||||
case MpTypes.Label: collection = mp.labels; break;
|
||||
case MpTypes.Marker: collection = mp.markers; break;
|
||||
case MpTypes.Object: collection = mp.objects; break;
|
||||
case MpTypes.Pickup: collection = mp.pickups; break;
|
||||
case MpTypes.Player: collection = mp.players; break;
|
||||
case MpTypes.Vehicle: collection = mp.vehicles; break;
|
||||
}
|
||||
|
||||
if(collection) return collection[env === 'client' ? 'atRemoteId' : 'at'](id);
|
||||
}
|
||||
|
||||
return value;
|
||||
});
|
||||
}
|
||||
|
||||
export function promiseResolve(result: any): Promise<any> {
|
||||
return new Promise(resolve => setTimeout(() => resolve(result), 0));
|
||||
}
|
||||
|
||||
export function promiseReject(error: any): Promise<any> {
|
||||
return new Promise((_, reject) => setTimeout(() => reject(error), 0));
|
||||
}
|
||||
|
||||
export function promiseTimeout(promise: Promise<any>, timeout?: number){
|
||||
if(typeof timeout === 'number'){
|
||||
return Promise.race([
|
||||
new Promise((_, reject) => {
|
||||
setTimeout(() => reject('TIMEOUT'), timeout);
|
||||
}),
|
||||
promise
|
||||
]);
|
||||
}else return promise;
|
||||
}
|
||||
|
||||
export function isBrowserValid(browser: Browser): boolean {
|
||||
try {
|
||||
browser.url;
|
||||
}catch(e){ return false; }
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"display": "Base",
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"incremental": false,
|
||||
"composite": false,
|
||||
"target": "ES2022",
|
||||
"experimentalDecorators": true,
|
||||
"moduleDetection": "auto",
|
||||
"module": "CommonJS",
|
||||
"resolveJsonModule": true,
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
"sourceMap": false,
|
||||
"downlevelIteration": false,
|
||||
"inlineSourceMap": false,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { defineConfig } from 'tsup'
|
||||
|
||||
export default defineConfig({
|
||||
entry: ['src/index.ts'],
|
||||
outDir: './dist',
|
||||
format: ['cjs'],
|
||||
noExternal: ['rage-rpc'],
|
||||
experimentalDts: true,
|
||||
splitting: false,
|
||||
sourcemap: false,
|
||||
clean: true,
|
||||
})
|
||||
@@ -0,0 +1,20 @@
|
||||
# Rage Framework (RageFW)
|
||||
RageFW is a type-safe framework for developing Rage:MP servers. Designed with developers in mind, RageFW brings structure and efficiency to your Rage:MP servers, ensuring robust and maintainable code
|
||||
|
||||
## Features
|
||||
- **Type-Safe Development:** Eliminate runtime errors and enhance code reliability with RageFW comprehensive type safety, making your RP server's development smoother than a Sunday drive through Los Santos
|
||||
|
||||
- **Wrapped RPC client:** Communicate effortlessly between server, client and cef with RPC system, wrapped in a cozy custom-typed blanket for your peace of mind
|
||||
|
||||
- **Logging System:** Keep track of server activities and debug like a pro with our built-in, feature-rich logging system. After all, even virtual cops need evidence
|
||||
|
||||
## Getting Started
|
||||
*soon*
|
||||
|
||||
## Contributing
|
||||
Join our community of developers and contribute to the ongoing development of RageFW. At the moment the only way to contribute is opening issues
|
||||
|
||||
## Support
|
||||
Need help? Reach out via our community forums or contact us directly through our support channels. We're committed to help you as we can
|
||||
|
||||
> *RageFW - because in the world of GTA:RP, nobody has time for type errors*
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rage-fw-server",
|
||||
"version": "0.0.16-alpha.0",
|
||||
"version": "0.0.25-alpha.0",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/src/index.d.ts",
|
||||
"files": [
|
||||
@@ -10,11 +10,11 @@
|
||||
"build": "tsup"
|
||||
},
|
||||
"dependencies": {
|
||||
"rage-fw-shared-types": "workspace:^",
|
||||
"rage-rpc": "^0.4.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@ragempcommunity/types-server": "^2.1.8"
|
||||
"@ragempcommunity/types-server": "^2.1.8",
|
||||
"rage-fw-shared-types": "workspace:^"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "SashaGoncharov19",
|
||||
|
||||
+67
-11
@@ -2,15 +2,23 @@ import rpc from 'rage-rpc'
|
||||
|
||||
import Logger from './logger'
|
||||
|
||||
import type {
|
||||
import {
|
||||
_CefEventHasArgs,
|
||||
_ClientEventHasArgs,
|
||||
_ServerEventHasArgs,
|
||||
RageFW_CefArgs,
|
||||
RageFW_CefEvent,
|
||||
RageFW_CefReturn,
|
||||
RageFW_ClientEvent,
|
||||
RageFW_ClientEventArguments,
|
||||
RageFW_ClientEventReturn,
|
||||
RageFW_ICustomServerEvent,
|
||||
RageFW_ServerClientEventArguments,
|
||||
RageFW_ServerClientEventReturn,
|
||||
RageFW_ServerEvent,
|
||||
RageFW_ServerEventArguments,
|
||||
RageFW_ServerEventCallback,
|
||||
RageFW_ServerEventCallbackCustom,
|
||||
RageFW_ServerEventCallbackNative,
|
||||
RageFW_ServerEventReturn,
|
||||
} from './types'
|
||||
import { nativeEvents } from './native.events'
|
||||
|
||||
@@ -25,11 +33,8 @@ class Server {
|
||||
): void {
|
||||
rpc.register(
|
||||
eventName,
|
||||
async (
|
||||
args: Parameters<RageFW_ICustomServerEvent[EventName]>,
|
||||
info,
|
||||
) => {
|
||||
callback(info.player as PlayerMp, args)
|
||||
async (args: RageFW_ServerEventArguments<EventName>, info) => {
|
||||
callback([info.player as PlayerMp, ...args])
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -38,7 +43,11 @@ class Server {
|
||||
eventName: EventName,
|
||||
callback: RageFW_ServerEventCallbackNative<EventName>,
|
||||
): void {
|
||||
mp.events.add(eventName, callback)
|
||||
mp.events.add(
|
||||
eventName,
|
||||
(...args: Parameters<IServerEvents[EventName]>) =>
|
||||
callback([...args]),
|
||||
)
|
||||
}
|
||||
|
||||
public register<EventName extends RageFW_ServerEvent>(
|
||||
@@ -77,16 +86,59 @@ class Server {
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
private unregisterCustom<EventName extends keyof RageFW_ICustomServerEvent>(
|
||||
eventName: EventName,
|
||||
): void {
|
||||
rpc.unregister(eventName)
|
||||
}
|
||||
|
||||
private unregisterNative<EventName extends keyof IServerEvents>(
|
||||
eventName: EventName,
|
||||
): void {
|
||||
mp.events.remove(eventName)
|
||||
}
|
||||
|
||||
public unregister<EventName extends RageFW_ServerEvent>(
|
||||
eventName: EventName,
|
||||
): void {
|
||||
if (this.isNativeEvent(eventName)) {
|
||||
this.unregisterNative(eventName)
|
||||
} else {
|
||||
this.unregisterCustom(eventName)
|
||||
}
|
||||
}
|
||||
|
||||
public trigger<EventName extends keyof RageFW_ICustomServerEvent>(
|
||||
eventName: EventName,
|
||||
...args: _ServerEventHasArgs<EventName> extends true
|
||||
? [RageFW_ServerEventArguments<EventName>]
|
||||
: []
|
||||
): Promise<RageFW_ServerEventReturn<EventName>> {
|
||||
return rpc.call<RageFW_ServerEventReturn<EventName>>(eventName, args)
|
||||
}
|
||||
}
|
||||
|
||||
class Player {
|
||||
public triggerClient<EventName extends RageFW_ClientEvent>(
|
||||
player: PlayerMp,
|
||||
eventName: EventName,
|
||||
args: RageFW_ClientEventArguments<EventName>,
|
||||
): Promise<RageFW_ClientEventReturn<EventName>> {
|
||||
...args: _ClientEventHasArgs<EventName> extends true
|
||||
? [RageFW_ServerClientEventArguments<EventName>]
|
||||
: []
|
||||
): Promise<RageFW_ServerClientEventReturn<EventName>> {
|
||||
return rpc.callClient(player, eventName, args)
|
||||
}
|
||||
|
||||
public triggerBrowser<EventName extends RageFW_CefEvent>(
|
||||
player: PlayerMp,
|
||||
eventName: EventName,
|
||||
...args: _CefEventHasArgs<EventName> extends true
|
||||
? [RageFW_CefArgs<EventName>]
|
||||
: []
|
||||
): Promise<RageFW_CefReturn<EventName>> {
|
||||
return rpc.callBrowsers(player, eventName, args)
|
||||
}
|
||||
}
|
||||
|
||||
export const fw = {
|
||||
@@ -96,3 +148,7 @@ export const fw = {
|
||||
log: new Logger(),
|
||||
},
|
||||
}
|
||||
|
||||
fw.system.log.info(
|
||||
'Working on Rage Framework. RageFW © Powered by Entity Seven Group',
|
||||
)
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { RageFW_ICustomCefEvent } from 'rage-fw-shared-types'
|
||||
|
||||
export type RageFW_CefEvent = keyof RageFW_ICustomCefEvent
|
||||
|
||||
export type RageFW_CefArgs<K extends RageFW_CefEvent> = Parameters<
|
||||
RageFW_ICustomCefEvent[K]
|
||||
>
|
||||
|
||||
export type RageFW_CefReturn<K extends RageFW_CefEvent> = ReturnType<
|
||||
RageFW_ICustomCefEvent[K]
|
||||
>
|
||||
|
||||
export type _CefEventHasArgs<EventName extends keyof RageFW_ICustomCefEvent> =
|
||||
keyof RageFW_ICustomCefEvent extends never
|
||||
? false
|
||||
: Parameters<RageFW_ICustomCefEvent[EventName]>[0] extends undefined
|
||||
? false
|
||||
: true
|
||||
@@ -2,14 +2,34 @@
|
||||
|
||||
import type { RageFW_ICustomClientEvent } from 'rage-fw-shared-types'
|
||||
|
||||
/**
|
||||
* Union of all available client event names
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ClientEvent = keyof RageFW_ICustomClientEvent
|
||||
|
||||
export type RageFW_ClientEventArguments<K extends RageFW_ClientEvent> =
|
||||
/**
|
||||
* Array of arguments of an event you pass as a generic
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ServerClientEventArguments<K extends RageFW_ClientEvent> =
|
||||
K extends RageFW_ClientEvent
|
||||
? Parameters<RageFW_ICustomClientEvent[K]>
|
||||
: never
|
||||
|
||||
export type RageFW_ClientEventReturn<K extends RageFW_ClientEvent> =
|
||||
/**
|
||||
* Return type of event you pass as a generic
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ServerClientEventReturn<K extends RageFW_ClientEvent> =
|
||||
K extends RageFW_ClientEvent
|
||||
? ReturnType<RageFW_ICustomClientEvent[K]>
|
||||
: never
|
||||
|
||||
export type _ClientEventHasArgs<
|
||||
EventName extends keyof RageFW_ICustomClientEvent,
|
||||
> = keyof RageFW_ICustomClientEvent extends never
|
||||
? false
|
||||
: Parameters<RageFW_ICustomClientEvent[EventName]>[0] extends undefined
|
||||
? false
|
||||
: true
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from './client'
|
||||
export * from './server'
|
||||
export * from './browser'
|
||||
|
||||
+59
-11
@@ -1,26 +1,74 @@
|
||||
/// <reference types="@ragempcommunity/types-server" />
|
||||
|
||||
import type { RageFW_ICustomServerEvent } from 'rage-fw-shared-types'
|
||||
import type {
|
||||
RageFW_ICustomClientEvent,
|
||||
RageFW_ICustomServerEvent,
|
||||
} from 'rage-fw-shared-types'
|
||||
export type { RageFW_ICustomServerEvent } from 'rage-fw-shared-types'
|
||||
|
||||
/**
|
||||
* Union of all available server event names
|
||||
* These also include system events
|
||||
*/
|
||||
export type RageFW_ServerEvent =
|
||||
| keyof RageFW_ICustomServerEvent
|
||||
| keyof IServerEvents
|
||||
|
||||
export type RageFW_ServerEventCallbackCustom<
|
||||
K extends keyof RageFW_ICustomServerEvent = keyof RageFW_ICustomServerEvent,
|
||||
> = (
|
||||
player: PlayerMp,
|
||||
args: Parameters<RageFW_ICustomServerEvent[K]>,
|
||||
) => ReturnType<RageFW_ICustomServerEvent[K]>
|
||||
|
||||
export type RageFW_ServerEventCallbackNative<
|
||||
K extends keyof IServerEvents = keyof IServerEvents,
|
||||
> = IServerEvents[K]
|
||||
/**
|
||||
* Array of arguments for an event, name of which you pass as a generic
|
||||
* These also include system events
|
||||
*/
|
||||
export type RageFW_ServerEventArguments<K extends RageFW_ServerEvent> =
|
||||
K extends keyof RageFW_ICustomServerEvent
|
||||
? Parameters<RageFW_ICustomServerEvent[K]>
|
||||
: K extends keyof IServerEvents
|
||||
? Parameters<IServerEvents[K]>
|
||||
: never
|
||||
|
||||
/**
|
||||
* Callback (function) for an event, name of which you pass as a generic
|
||||
* These include system and custom events
|
||||
*/
|
||||
export type RageFW_ServerEventCallback<K extends RageFW_ServerEvent> =
|
||||
K extends keyof RageFW_ICustomServerEvent
|
||||
? RageFW_ServerEventCallbackCustom<K>
|
||||
: K extends keyof IServerEvents
|
||||
? RageFW_ServerEventCallbackNative<K>
|
||||
: never
|
||||
|
||||
/**
|
||||
* Return type for an event, name of which you pass as a generic
|
||||
* These include system and custom events
|
||||
*/
|
||||
export type RageFW_ServerEventReturn<K extends RageFW_ServerEvent> =
|
||||
K extends keyof RageFW_ICustomServerEvent
|
||||
? ReturnType<RageFW_ICustomServerEvent[K]>
|
||||
: K extends keyof IServerEvents
|
||||
? ReturnType<IServerEvents[K]>
|
||||
: never
|
||||
|
||||
/**
|
||||
* Array of arguments for an event, name of which you pass as a generic
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ServerEventCallbackCustom<
|
||||
K extends keyof RageFW_ICustomServerEvent = keyof RageFW_ICustomServerEvent,
|
||||
> = (
|
||||
payload: [player: PlayerMp, ...args: RageFW_ServerEventArguments<K>],
|
||||
) => RageFW_ServerEventReturn<K>
|
||||
|
||||
/**
|
||||
* Array of arguments for an event, name of which you pass as a generic
|
||||
* These only include system events
|
||||
*/
|
||||
export type RageFW_ServerEventCallbackNative<
|
||||
K extends keyof IServerEvents = keyof IServerEvents,
|
||||
> = (payload: Parameters<IServerEvents[K]>) => ReturnType<IServerEvents[K]>
|
||||
|
||||
export type _ServerEventHasArgs<
|
||||
EventName extends keyof RageFW_ICustomServerEvent,
|
||||
> = keyof RageFW_ICustomClientEvent extends never
|
||||
? false
|
||||
: Parameters<RageFW_ICustomServerEvent[EventName]>[0] extends undefined
|
||||
? false
|
||||
: true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rage-fw-shared-types",
|
||||
"version": "0.0.16-alpha.0",
|
||||
"version": "0.0.25-alpha.0",
|
||||
"types": "types/types/index.d.ts",
|
||||
"files": [
|
||||
"types/**/*"
|
||||
|
||||
Vendored
+2
@@ -2,4 +2,6 @@ declare module 'rage-fw-shared-types' {
|
||||
export interface RageFW_ICustomServerEvent {}
|
||||
|
||||
export interface RageFW_ICustomClientEvent {}
|
||||
|
||||
export interface RageFW_ICustomCefEvent {}
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"name": "rage-fw-shared",
|
||||
"version": "0.0.16-alpha.0",
|
||||
"type": "module",
|
||||
"main": "index.d.ts",
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "tsup"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "SashaGoncharov19",
|
||||
"license": "MIT",
|
||||
"description": "Shared client types for rage-fw",
|
||||
"gitHead": "053e4fd12aa120d53e11e0d2009c0df78c1a2ad0"
|
||||
}
|
||||
+5
-1
@@ -1,7 +1,11 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"lib": ["ESNext","ES2019"],
|
||||
"lib": [
|
||||
"ESNext",
|
||||
"ES2019",
|
||||
"dom"
|
||||
],
|
||||
"moduleResolution": "node",
|
||||
"module": "ESNext",
|
||||
"esModuleInterop": true,
|
||||
|
||||
Reference in New Issue
Block a user