@open-core/framework 0.2.9 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. package/dist/adapters/contracts/IPlatformCapabilities.d.ts +79 -0
  2. package/dist/adapters/contracts/IPlatformCapabilities.js +31 -0
  3. package/dist/adapters/contracts/IPlayerInfo.d.ts +1 -1
  4. package/dist/adapters/contracts/{IPedAppearanceClient.d.ts → client/IPedAppearanceClient.d.ts} +1 -1
  5. package/dist/adapters/contracts/server/IEntityServer.d.ts +188 -0
  6. package/dist/adapters/contracts/server/IEntityServer.js +39 -0
  7. package/dist/adapters/contracts/{IPlayerServer.d.ts → server/IPlayerServer.d.ts} +52 -9
  8. package/dist/adapters/contracts/server/IPlayerServer.js +39 -0
  9. package/dist/adapters/contracts/types/identifier.d.ts +67 -0
  10. package/dist/adapters/contracts/types/identifier.js +64 -0
  11. package/dist/adapters/contracts/types/index.d.ts +1 -0
  12. package/dist/{kernel/shared/appearance → adapters/contracts/types}/index.js +1 -1
  13. package/dist/adapters/fivem/fivem-capabilities.d.ts +18 -0
  14. package/dist/adapters/fivem/fivem-capabilities.js +67 -0
  15. package/dist/adapters/fivem/fivem-engine-events.js +17 -4
  16. package/dist/adapters/fivem/fivem-entity-server.d.ts +6 -2
  17. package/dist/adapters/fivem/fivem-entity-server.js +14 -1
  18. package/dist/adapters/fivem/fivem-ped-appearance-client.d.ts +1 -1
  19. package/dist/adapters/fivem/fivem-ped-appearance-client.js +1 -1
  20. package/dist/adapters/fivem/fivem-ped-appearance-server.d.ts +1 -1
  21. package/dist/adapters/fivem/fivem-ped-appearance-server.js +1 -1
  22. package/dist/adapters/fivem/fivem-platform.d.ts +5 -0
  23. package/dist/adapters/fivem/fivem-platform.js +100 -0
  24. package/dist/adapters/fivem/fivem-player-server.d.ts +7 -1
  25. package/dist/adapters/fivem/fivem-player-server.js +19 -1
  26. package/dist/adapters/fivem/fivem-playerinfo.d.ts +1 -1
  27. package/dist/adapters/fivem/fivem-vehicle-server.d.ts +1 -1
  28. package/dist/adapters/fivem/fivem-vehicle-server.js +1 -1
  29. package/dist/adapters/fivem/index.d.ts +13 -0
  30. package/dist/adapters/fivem/index.js +31 -0
  31. package/dist/adapters/index.d.ts +8 -7
  32. package/dist/adapters/index.js +13 -12
  33. package/dist/adapters/node/index.d.ts +5 -0
  34. package/dist/adapters/node/index.js +13 -1
  35. package/dist/adapters/node/node-capabilities.d.ts +19 -0
  36. package/dist/adapters/node/node-capabilities.js +54 -0
  37. package/dist/adapters/node/node-entity-server.d.ts +17 -6
  38. package/dist/adapters/node/node-entity-server.js +41 -15
  39. package/dist/adapters/node/node-net-transport.js +2 -2
  40. package/dist/adapters/node/node-ped-appearance-client.d.ts +1 -1
  41. package/dist/adapters/node/node-ped-appearance-client.js +1 -1
  42. package/dist/adapters/node/node-ped-appearance-server.d.ts +1 -1
  43. package/dist/adapters/node/node-ped-appearance-server.js +1 -1
  44. package/dist/adapters/node/node-platform.d.ts +5 -0
  45. package/dist/adapters/node/node-platform.js +103 -0
  46. package/dist/adapters/node/node-player-server.d.ts +19 -3
  47. package/dist/adapters/node/node-player-server.js +43 -9
  48. package/dist/adapters/node/node-playerinfo.d.ts +2 -2
  49. package/dist/adapters/node/node-playerinfo.js +14 -3
  50. package/dist/adapters/node/node-vehicle-server.d.ts +1 -1
  51. package/dist/adapters/node/node-vehicle-server.js +1 -1
  52. package/dist/adapters/platform/index.d.ts +1 -0
  53. package/dist/{runtime/server/database.js → adapters/platform/index.js} +1 -7
  54. package/dist/adapters/platform/platform-registry.d.ts +101 -0
  55. package/dist/adapters/platform/platform-registry.js +122 -0
  56. package/dist/adapters/register-capabilities.d.ts +52 -2
  57. package/dist/adapters/register-capabilities.js +69 -130
  58. package/dist/adapters/register-client-capabilities.js +1 -1
  59. package/dist/index.d.ts +2 -5
  60. package/dist/index.js +5 -31
  61. package/dist/kernel/di/container.d.ts +4 -2
  62. package/dist/kernel/di/container.js +5 -3
  63. package/dist/kernel/di/metadata.scanner.d.ts +2 -1
  64. package/dist/kernel/di/metadata.scanner.js +3 -2
  65. package/dist/kernel/{utils/error → error}/app.error.d.ts +2 -2
  66. package/dist/kernel/error/common.error-codes.d.ts +1 -0
  67. package/dist/kernel/error/framework.error-codes.d.ts +12 -0
  68. package/dist/kernel/error/index.d.ts +4 -0
  69. package/dist/kernel/error/index.js +18 -0
  70. package/dist/kernel/{utils/error → error}/security.error.d.ts +1 -1
  71. package/dist/kernel/error/security.types.js +2 -0
  72. package/dist/kernel/index.d.ts +4 -5
  73. package/dist/kernel/index.js +6 -11
  74. package/dist/kernel/{shared/logger → logger}/core-logger.d.ts +0 -19
  75. package/dist/kernel/{shared/logger → logger}/core-logger.js +10 -24
  76. package/dist/kernel/{shared/logger → logger}/logger.env.d.ts +12 -5
  77. package/dist/kernel/{shared/logger → logger}/logger.env.js +29 -13
  78. package/dist/kernel/{shared/logger → logger}/logger.service.d.ts +14 -0
  79. package/dist/kernel/{shared/logger → logger}/logger.service.js +20 -2
  80. package/dist/kernel/logger/transports/transport.interface.js +2 -0
  81. package/dist/kernel/shared/index.d.ts +1 -2
  82. package/dist/kernel/shared/index.js +1 -2
  83. package/dist/kernel/utils/index.d.ts +0 -2
  84. package/dist/kernel/utils/index.js +0 -2
  85. package/dist/kernel/utils/result.d.ts +1 -1
  86. package/dist/runtime/client/api.d.ts +7 -0
  87. package/dist/runtime/client/api.js +23 -0
  88. package/dist/runtime/client/client-bootstrap.js +1 -1
  89. package/dist/runtime/client/controllers/spawner.controller.d.ts +1 -1
  90. package/dist/runtime/client/decorators/index.d.ts +2 -2
  91. package/dist/runtime/client/decorators/index.js +2 -2
  92. package/dist/runtime/client/decorators/key.d.ts +2 -2
  93. package/dist/runtime/client/decorators/key.js +3 -3
  94. package/dist/runtime/client/decorators/localEvent.d.ts +1 -1
  95. package/dist/runtime/client/decorators/localEvent.js +1 -1
  96. package/dist/runtime/client/decorators/{tick.d.ts → onTick.d.ts} +1 -1
  97. package/dist/runtime/client/decorators/{tick.js → onTick.js} +2 -2
  98. package/dist/runtime/client/decorators/{nui.d.ts → onView.d.ts} +4 -4
  99. package/dist/runtime/client/decorators/{nui.js → onView.js} +5 -5
  100. package/dist/runtime/client/index.d.ts +1 -7
  101. package/dist/runtime/client/index.js +26 -12
  102. package/dist/runtime/client/player/player.d.ts +1 -1
  103. package/dist/runtime/client/player/player.loader.js +3 -3
  104. package/dist/runtime/client/services/appearance.service.d.ts +1 -1
  105. package/dist/runtime/client/services/appearance.service.js +1 -1
  106. package/dist/runtime/client/services/blip.service.d.ts +1 -1
  107. package/dist/runtime/client/services/marker.service.d.ts +1 -1
  108. package/dist/runtime/client/services/ped.service.d.ts +1 -1
  109. package/dist/runtime/client/services/spawn.service.d.ts +2 -2
  110. package/dist/runtime/client/services/spawn.service.js +12 -12
  111. package/dist/runtime/client/services/textui.service.d.ts +1 -1
  112. package/dist/runtime/client/services/vehicle-client.service.d.ts +1 -1
  113. package/dist/runtime/client/services/vehicle.service.d.ts +1 -1
  114. package/dist/runtime/client/system/processors/export.processor.js +1 -1
  115. package/dist/runtime/client/system/processors/gameEvent.processor.js +1 -1
  116. package/dist/runtime/client/system/processors/interval.processor.js +1 -1
  117. package/dist/runtime/client/system/processors/localEvent.processor.js +1 -1
  118. package/dist/runtime/client/system/processors/netEvent.processor.js +1 -1
  119. package/dist/runtime/client/system/processors/nui.processor.js +1 -1
  120. package/dist/runtime/client/system/processors/resourceLifecycle.processor.js +1 -1
  121. package/dist/runtime/client/system/processors/tick.processor.js +1 -1
  122. package/dist/runtime/client/ui-bridge.js +1 -1
  123. package/dist/runtime/core/entity.d.ts +168 -0
  124. package/dist/runtime/core/entity.js +226 -0
  125. package/dist/runtime/core/index.d.ts +3 -0
  126. package/dist/runtime/core/index.js +19 -0
  127. package/dist/runtime/core/spatial.d.ts +5 -0
  128. package/dist/runtime/core/spatial.js +2 -0
  129. package/dist/runtime/core/world.d.ts +13 -0
  130. package/dist/runtime/core/world.js +64 -0
  131. package/dist/runtime/server/api.d.ts +12 -0
  132. package/dist/runtime/server/api.js +34 -0
  133. package/dist/runtime/server/bootstrap.js +84 -108
  134. package/dist/runtime/server/bus/internal-event.bus.js +1 -1
  135. package/dist/runtime/server/contracts/index.d.ts +1 -2
  136. package/dist/runtime/server/contracts/index.js +2 -3
  137. package/dist/runtime/server/contracts/player-persistence.contract.d.ts +16 -18
  138. package/dist/runtime/server/contracts/player-persistence.contract.js +16 -18
  139. package/dist/runtime/server/contracts/security/command-error-observer.contract.d.ts +73 -0
  140. package/dist/runtime/server/contracts/security/command-error-observer.contract.js +9 -0
  141. package/dist/runtime/server/contracts/security/permission.types.d.ts +2 -2
  142. package/dist/runtime/server/contracts/security/principal-provider.contract.d.ts +3 -3
  143. package/dist/runtime/server/contracts/security/principal-provider.contract.js +2 -2
  144. package/dist/runtime/server/contracts/security/security-handler.contract.d.ts +2 -2
  145. package/dist/runtime/server/controllers/chat.controller.d.ts +1 -1
  146. package/dist/runtime/server/controllers/chat.controller.js +5 -0
  147. package/dist/runtime/server/controllers/command-export.controller.d.ts +12 -3
  148. package/dist/runtime/server/controllers/command-export.controller.js +94 -28
  149. package/dist/runtime/server/controllers/player-export.controller.d.ts +2 -2
  150. package/dist/runtime/server/controllers/player-export.controller.js +5 -0
  151. package/dist/runtime/server/controllers/principal-export.controller.js +8 -7
  152. package/dist/runtime/server/controllers/ready.controller.d.ts +4 -0
  153. package/dist/runtime/server/controllers/ready.controller.js +32 -0
  154. package/dist/runtime/server/controllers/remote-command-execution.controller.d.ts +10 -1
  155. package/dist/runtime/server/controllers/remote-command-execution.controller.js +79 -13
  156. package/dist/runtime/server/controllers/session.controller.d.ts +2 -2
  157. package/dist/runtime/server/controllers/session.controller.js +25 -17
  158. package/dist/runtime/server/controllers/vehicle.controller.d.ts +3 -38
  159. package/dist/runtime/server/controllers/vehicle.controller.js +6 -152
  160. package/dist/runtime/server/decorators/guard.js +2 -2
  161. package/dist/runtime/server/decorators/index.d.ts +1 -1
  162. package/dist/runtime/server/decorators/index.js +1 -1
  163. package/dist/runtime/server/decorators/{onFiveMEvent.d.ts → onRuntimeEvent.d.ts} +5 -4
  164. package/dist/runtime/server/decorators/{onFiveMEvent.js → onRuntimeEvent.js} +7 -6
  165. package/dist/runtime/server/decorators/requiresState.js +3 -3
  166. package/dist/runtime/server/decorators/throttle.d.ts +1 -1
  167. package/dist/runtime/server/decorators/throttle.js +1 -1
  168. package/dist/runtime/server/decorators/utils.d.ts +1 -1
  169. package/dist/runtime/server/decorators/utils.js +1 -1
  170. package/dist/runtime/server/devmode/dev-mode.service.d.ts +7 -8
  171. package/dist/runtime/server/devmode/dev-mode.service.js +18 -46
  172. package/dist/runtime/server/devmode/index.d.ts +1 -3
  173. package/dist/runtime/server/devmode/index.js +1 -18
  174. package/dist/runtime/server/devmode/player-simulator.service.js +3 -3
  175. package/dist/runtime/server/devmode/state-inspector.service.js +2 -2
  176. package/dist/runtime/server/devmode/types.d.ts +67 -31
  177. package/dist/runtime/server/devmode/types.js +1 -4
  178. package/dist/runtime/server/entities/player.d.ts +80 -66
  179. package/dist/runtime/server/entities/player.js +137 -98
  180. package/dist/runtime/server/entities/vehicle.d.ts +3 -3
  181. package/dist/runtime/server/error-handler.js +5 -5
  182. package/dist/runtime/server/helpers/command-validation.helper.d.ts +0 -3
  183. package/dist/runtime/server/helpers/command-validation.helper.js +3 -7
  184. package/dist/runtime/server/helpers/normalize-app-error.d.ts +9 -0
  185. package/dist/runtime/server/helpers/normalize-app-error.js +20 -0
  186. package/dist/runtime/server/helpers/process-tuple-schema.d.ts +20 -0
  187. package/dist/runtime/server/helpers/process-tuple-schema.js +51 -0
  188. package/dist/runtime/server/helpers/resolve-method.js +3 -3
  189. package/dist/runtime/server/index.d.ts +1 -13
  190. package/dist/runtime/server/index.js +25 -23
  191. package/dist/runtime/server/runtime.d.ts +32 -281
  192. package/dist/runtime/server/runtime.js +46 -60
  193. package/dist/runtime/server/services/appearance.service.d.ts +5 -5
  194. package/dist/runtime/server/services/appearance.service.js +5 -5
  195. package/dist/runtime/server/services/chat.service.d.ts +5 -3
  196. package/dist/runtime/server/services/chat.service.js +17 -12
  197. package/dist/runtime/server/services/core/command.service.d.ts +9 -1
  198. package/dist/runtime/server/services/core/command.service.js +16 -7
  199. package/dist/runtime/server/services/core/player.service.d.ts +12 -16
  200. package/dist/runtime/server/services/core/player.service.js +42 -47
  201. package/dist/runtime/server/services/core/principal.service.js +5 -5
  202. package/dist/runtime/server/services/core/session-recovery.service.d.ts +1 -1
  203. package/dist/runtime/server/services/core/session-recovery.service.js +2 -2
  204. package/dist/runtime/server/services/default/default-command-error-observer.d.ts +14 -0
  205. package/dist/runtime/server/services/default/default-command-error-observer.js +43 -0
  206. package/dist/runtime/server/services/default/default-principal.provider.d.ts +13 -0
  207. package/dist/runtime/server/services/default/default-principal.provider.js +38 -0
  208. package/dist/runtime/server/services/default/default-security.handler.d.ts +1 -1
  209. package/dist/runtime/server/services/default/default-security.handler.js +1 -1
  210. package/dist/runtime/server/services/index.d.ts +0 -3
  211. package/dist/runtime/server/services/index.js +1 -6
  212. package/dist/runtime/server/services/persistence.service.js +3 -3
  213. package/dist/runtime/server/services/ports/command-execution.port.d.ts +7 -0
  214. package/dist/runtime/server/services/ports/principal.port.d.ts +1 -1
  215. package/dist/runtime/server/services/remote/remote-command.service.d.ts +1 -0
  216. package/dist/runtime/server/services/remote/remote-command.service.js +30 -11
  217. package/dist/runtime/server/services/remote/remote-player.service.d.ts +2 -2
  218. package/dist/runtime/server/services/remote/remote-player.service.js +3 -3
  219. package/dist/runtime/server/services/remote/server-bridge.js +2 -2
  220. package/dist/runtime/server/services/services.register.d.ts +2 -5
  221. package/dist/runtime/server/services/services.register.js +29 -41
  222. package/dist/runtime/server/services/vehicle-modification.service.js +1 -1
  223. package/dist/runtime/server/services/vehicle.service.d.ts +3 -3
  224. package/dist/runtime/server/services/vehicle.service.js +5 -5
  225. package/dist/runtime/server/setup.d.ts +2 -3
  226. package/dist/runtime/server/setup.js +10 -11
  227. package/dist/runtime/server/system/metadata-server.keys.d.ts +1 -1
  228. package/dist/runtime/server/system/metadata-server.keys.js +1 -1
  229. package/dist/runtime/server/system/processors/command.processor.js +4 -0
  230. package/dist/runtime/server/system/processors/export.processor.js +1 -1
  231. package/dist/runtime/server/system/processors/internalEvent.processor.js +1 -1
  232. package/dist/runtime/server/system/processors/netEvent.processor.js +11 -10
  233. package/dist/runtime/server/system/processors/{fivemEvent.processor.d.ts → runtimeEvent.processor.d.ts} +1 -1
  234. package/dist/runtime/server/system/processors/{fivemEvent.processor.js → runtimeEvent.processor.js} +8 -8
  235. package/dist/runtime/server/system/processors/tick.processor.js +1 -1
  236. package/dist/runtime/server/system/processors.register.js +16 -11
  237. package/dist/runtime/server/system/schema-generator.js +5 -3
  238. package/dist/runtime/server/types/core-exports.d.ts +6 -6
  239. package/dist/runtime/server/types/index.d.ts +1 -1
  240. package/dist/runtime/server/types/index.js +1 -1
  241. package/dist/runtime/server/types/internal-events.d.ts +1 -1
  242. package/dist/runtime/server/types/vehicle.types.d.ts +1 -1
  243. package/package.json +7 -15
  244. package/dist/adapters/contracts/IEntityServer.d.ts +0 -88
  245. package/dist/adapters/contracts/IEntityServer.js +0 -13
  246. package/dist/adapters/contracts/IPlayerServer.js +0 -13
  247. package/dist/adapters/database/oxmysql.adapter.d.ts +0 -89
  248. package/dist/adapters/database/oxmysql.adapter.js +0 -149
  249. package/dist/adapters/database/resource.adapter.d.ts +0 -12
  250. package/dist/adapters/database/resource.adapter.js +0 -68
  251. package/dist/kernel/shared/appearance/index.d.ts +0 -1
  252. package/dist/runtime/index.d.ts +0 -2
  253. package/dist/runtime/index.js +0 -39
  254. package/dist/runtime/server/bootstrap.validation.d.ts +0 -12
  255. package/dist/runtime/server/bootstrap.validation.js +0 -104
  256. package/dist/runtime/server/contracts/auth-provider.contract.d.ts +0 -58
  257. package/dist/runtime/server/contracts/auth-provider.contract.js +0 -23
  258. package/dist/runtime/server/contracts/repository/index.d.ts +0 -57
  259. package/dist/runtime/server/contracts/repository/index.js +0 -61
  260. package/dist/runtime/server/contracts/repository/repository.contract.d.ts +0 -224
  261. package/dist/runtime/server/contracts/repository/repository.contract.js +0 -341
  262. package/dist/runtime/server/contracts/repository/repository.types.d.ts +0 -51
  263. package/dist/runtime/server/contracts/repository/repository.types.js +0 -7
  264. package/dist/runtime/server/database/adapter.registry.d.ts +0 -4
  265. package/dist/runtime/server/database/adapter.registry.js +0 -14
  266. package/dist/runtime/server/database/database.contract.d.ts +0 -128
  267. package/dist/runtime/server/database/database.contract.js +0 -29
  268. package/dist/runtime/server/database/database.service.d.ts +0 -188
  269. package/dist/runtime/server/database/database.service.js +0 -287
  270. package/dist/runtime/server/database/index.d.ts +0 -5
  271. package/dist/runtime/server/database/index.js +0 -25
  272. package/dist/runtime/server/database/types.d.ts +0 -67
  273. package/dist/runtime/server/database/types.js +0 -7
  274. package/dist/runtime/server/database.d.ts +0 -7
  275. package/dist/runtime/server/devmode/hot-reload.server.d.ts +0 -74
  276. package/dist/runtime/server/devmode/hot-reload.server.js +0 -261
  277. package/dist/runtime/server/services/config.service.d.ts +0 -75
  278. package/dist/runtime/server/services/config.service.js +0 -116
  279. package/dist/runtime/server/services/http/http.service.d.ts +0 -50
  280. package/dist/runtime/server/services/http/http.service.js +0 -126
  281. /package/dist/adapters/contracts/{IPedAppearanceClient.js → client/IPedAppearanceClient.js} +0 -0
  282. /package/dist/adapters/contracts/{IPedAppearanceServer.d.ts → server/IPedAppearanceServer.d.ts} +0 -0
  283. /package/dist/adapters/contracts/{IPedAppearanceServer.js → server/IPedAppearanceServer.js} +0 -0
  284. /package/dist/adapters/contracts/{IVehicleServer.d.ts → server/IVehicleServer.d.ts} +0 -0
  285. /package/dist/adapters/contracts/{IVehicleServer.js → server/IVehicleServer.js} +0 -0
  286. /package/dist/kernel/{utils/error → error}/app.error.js +0 -0
  287. /package/dist/kernel/{shared/logger/transports/transport.interface.js → error/common.error-codes.js} +0 -0
  288. /package/dist/{runtime/server/types/security.types.js → kernel/error/framework.error-codes.js} +0 -0
  289. /package/dist/kernel/{utils/error → error}/security.error.js +0 -0
  290. /package/dist/{runtime/server/types → kernel/error}/security.types.d.ts +0 -0
  291. /package/dist/kernel/{shared/logger → logger}/index.d.ts +0 -0
  292. /package/dist/kernel/{shared/logger → logger}/index.js +0 -0
  293. /package/dist/kernel/{shared/logger → logger}/logger.config.d.ts +0 -0
  294. /package/dist/kernel/{shared/logger → logger}/logger.config.js +0 -0
  295. /package/dist/kernel/{shared/logger → logger}/logger.types.d.ts +0 -0
  296. /package/dist/kernel/{shared/logger → logger}/logger.types.js +0 -0
  297. /package/dist/kernel/{shared/logger → logger}/transports/buffered.transport.d.ts +0 -0
  298. /package/dist/kernel/{shared/logger → logger}/transports/buffered.transport.js +0 -0
  299. /package/dist/kernel/{shared/logger → logger}/transports/console.transport.d.ts +0 -0
  300. /package/dist/kernel/{shared/logger → logger}/transports/console.transport.js +0 -0
  301. /package/dist/kernel/{shared/logger → logger}/transports/dev-transport.factory.d.ts +0 -0
  302. /package/dist/kernel/{shared/logger → logger}/transports/dev-transport.factory.js +0 -0
  303. /package/dist/kernel/{shared/logger → logger}/transports/http.transport.d.ts +0 -0
  304. /package/dist/kernel/{shared/logger → logger}/transports/http.transport.js +0 -0
  305. /package/dist/kernel/{shared/logger → logger}/transports/index.d.ts +0 -0
  306. /package/dist/kernel/{shared/logger → logger}/transports/index.js +0 -0
  307. /package/dist/kernel/{shared/logger → logger}/transports/simple-console.transport.d.ts +0 -0
  308. /package/dist/kernel/{shared/logger → logger}/transports/simple-console.transport.js +0 -0
  309. /package/dist/kernel/{shared/logger → logger}/transports/transport.interface.d.ts +0 -0
  310. /package/dist/kernel/{shared/logger → logger}/transports/websocket.transport.d.ts +0 -0
  311. /package/dist/kernel/{shared/logger → logger}/transports/websocket.transport.js +0 -0
  312. /package/dist/kernel/shared/{appearance/appearance.interface.d.ts → player-appearance.types.d.ts} +0 -0
  313. /package/dist/kernel/shared/{appearance/appearance.interface.js → player-appearance.types.js} +0 -0
@@ -1,261 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HotReloadServer = void 0;
4
- const logger_1 = require("../../../kernel/shared/logger");
5
- // Lazy-loaded http module (only loaded at runtime, not bundled)
6
- let httpModule = null;
7
- // Use variable to prevent esbuild from statically analyzing the require
8
- const HTTP_MODULE = 'http';
9
- function getHttpSync() {
10
- if (!httpModule) {
11
- // eslint-disable-next-line @typescript-eslint/no-require-imports
12
- httpModule = require(HTTP_MODULE);
13
- }
14
- return httpModule;
15
- }
16
- // Safe wrappers for FiveM globals (no-op in Node.js)
17
- function safeGetCurrentResourceName() {
18
- if (typeof GetCurrentResourceName === 'function') {
19
- return GetCurrentResourceName();
20
- }
21
- return 'unknown';
22
- }
23
- function safeExecuteCommand(command) {
24
- if (typeof ExecuteCommand === 'function') {
25
- ExecuteCommand(command);
26
- }
27
- else {
28
- logger_1.loggers.bootstrap.warn('[DevMode] ExecuteCommand not available (not running in FiveM)');
29
- }
30
- }
31
- /**
32
- * HTTP server for handling hot reload requests from the CLI.
33
- *
34
- * Provides an endpoint that the CLI can call to restart resources
35
- * after file changes are detected.
36
- *
37
- * @example
38
- * ```typescript
39
- * const server = new HotReloadServer({ enabled: true, port: 3847 })
40
- * server.start()
41
- * // CLI calls POST /restart?resource=my-resource
42
- * ```
43
- */
44
- class HotReloadServer {
45
- constructor(options) {
46
- this.server = null;
47
- this.logBuffer = [];
48
- this.maxLogBuffer = 1000;
49
- this.logListeners = [];
50
- this.options = options;
51
- }
52
- /**
53
- * Adds logs to the buffer (called by HttpLogTransport).
54
- */
55
- addLogs(logs) {
56
- this.logBuffer.push(...logs);
57
- if (this.logBuffer.length > this.maxLogBuffer) {
58
- this.logBuffer = this.logBuffer.slice(-this.maxLogBuffer);
59
- }
60
- // Notify listeners
61
- for (const listener of this.logListeners) {
62
- listener(logs);
63
- }
64
- }
65
- /**
66
- * Gets and clears buffered logs.
67
- */
68
- consumeLogs() {
69
- const logs = this.logBuffer;
70
- this.logBuffer = [];
71
- return logs;
72
- }
73
- /**
74
- * Adds a listener for new logs.
75
- */
76
- onLogs(listener) {
77
- this.logListeners.push(listener);
78
- return () => {
79
- const idx = this.logListeners.indexOf(listener);
80
- if (idx !== -1)
81
- this.logListeners.splice(idx, 1);
82
- };
83
- }
84
- /**
85
- * Starts the hot reload HTTP server.
86
- */
87
- start() {
88
- if (!this.options.enabled)
89
- return;
90
- if (this.server)
91
- return;
92
- const http = getHttpSync();
93
- this.server = http.createServer((req, res) => {
94
- this.handleRequest(req, res);
95
- });
96
- this.server.listen(this.options.port, '127.0.0.1', () => {
97
- logger_1.loggers.bootstrap.info(`[DevMode] Hot reload server listening on port ${this.options.port}`);
98
- });
99
- this.server.on('error', (error) => {
100
- logger_1.loggers.bootstrap.error(`[DevMode] Hot reload server error`, {}, error);
101
- });
102
- }
103
- /**
104
- * Stops the hot reload server.
105
- */
106
- stop() {
107
- if (this.server) {
108
- this.server.close();
109
- this.server = null;
110
- logger_1.loggers.bootstrap.info('[DevMode] Hot reload server stopped');
111
- }
112
- }
113
- /**
114
- * Checks if the server is running.
115
- */
116
- isRunning() {
117
- return this.server !== null;
118
- }
119
- handleRequest(req, res) {
120
- var _a, _b;
121
- // CORS headers for CLI access
122
- res.setHeader('Access-Control-Allow-Origin', '*');
123
- res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
124
- res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
125
- if (req.method === 'OPTIONS') {
126
- res.writeHead(204);
127
- res.end();
128
- return;
129
- }
130
- if (req.method === 'POST' && ((_a = req.url) === null || _a === void 0 ? void 0 : _a.startsWith('/restart'))) {
131
- this.handleRestart(req, res);
132
- return;
133
- }
134
- if (req.method === 'POST' && ((_b = req.url) === null || _b === void 0 ? void 0 : _b.startsWith('/refresh'))) {
135
- this.handleRefresh(res);
136
- return;
137
- }
138
- if (req.method === 'GET' && req.url === '/health') {
139
- this.handleHealth(res);
140
- return;
141
- }
142
- // Log endpoints for CLI polling
143
- if (req.method === 'GET' && req.url === '/logs') {
144
- this.handleGetLogs(res);
145
- return;
146
- }
147
- if (req.method === 'POST' && req.url === '/logs') {
148
- this.handlePostLogs(req, res);
149
- return;
150
- }
151
- res.writeHead(404, { 'Content-Type': 'application/json' });
152
- res.end(JSON.stringify({ error: 'Not found' }));
153
- }
154
- handleRestart(req, res) {
155
- var _a;
156
- try {
157
- const url = new URL((_a = req.url) !== null && _a !== void 0 ? _a : '', `http://localhost:${this.options.port}`);
158
- const resource = url.searchParams.get('resource');
159
- if (!resource) {
160
- res.writeHead(400, { 'Content-Type': 'application/json' });
161
- res.end(JSON.stringify({ error: 'Missing resource parameter' }));
162
- return;
163
- }
164
- if (!this.isResourceAllowed(resource)) {
165
- res.writeHead(403, { 'Content-Type': 'application/json' });
166
- res.end(JSON.stringify({ error: 'Resource not allowed for hot reload' }));
167
- return;
168
- }
169
- // Don't restart ourselves
170
- const currentResource = safeGetCurrentResourceName();
171
- if (resource === currentResource) {
172
- res.writeHead(400, { 'Content-Type': 'application/json' });
173
- res.end(JSON.stringify({ error: 'Cannot restart the hot-reload resource itself' }));
174
- return;
175
- }
176
- logger_1.loggers.bootstrap.info(`[DevMode] Hot reloading resource: ${resource}`);
177
- // Execute the restart command
178
- safeExecuteCommand(`restart ${resource}`);
179
- res.writeHead(200, { 'Content-Type': 'application/json' });
180
- res.end(JSON.stringify({ success: true, resource }));
181
- }
182
- catch (error) {
183
- logger_1.loggers.bootstrap.error('[DevMode] Hot reload error', {}, error);
184
- res.writeHead(500, { 'Content-Type': 'application/json' });
185
- res.end(JSON.stringify({ error: 'Internal server error' }));
186
- }
187
- }
188
- handleRefresh(res) {
189
- try {
190
- logger_1.loggers.bootstrap.info('[DevMode] Refreshing resources');
191
- safeExecuteCommand('refresh');
192
- res.writeHead(200, { 'Content-Type': 'application/json' });
193
- res.end(JSON.stringify({ success: true }));
194
- }
195
- catch (error) {
196
- logger_1.loggers.bootstrap.error('[DevMode] Refresh error', {}, error);
197
- res.writeHead(500, { 'Content-Type': 'application/json' });
198
- res.end(JSON.stringify({ error: 'Internal server error' }));
199
- }
200
- }
201
- handleHealth(res) {
202
- res.writeHead(200, { 'Content-Type': 'application/json' });
203
- res.end(JSON.stringify({
204
- status: 'ok',
205
- resource: safeGetCurrentResourceName(),
206
- timestamp: Date.now(),
207
- }));
208
- }
209
- isResourceAllowed(resource) {
210
- if (!this.options.allowedResources || this.options.allowedResources.length === 0) {
211
- return true;
212
- }
213
- return this.options.allowedResources.includes(resource);
214
- }
215
- /**
216
- * Handles GET /logs - CLI polls for buffered logs.
217
- */
218
- handleGetLogs(res) {
219
- const logs = this.consumeLogs();
220
- res.writeHead(200, { 'Content-Type': 'application/json' });
221
- res.end(JSON.stringify({ logs, timestamp: Date.now() }));
222
- }
223
- /**
224
- * Handles POST /logs - Framework pushes logs to buffer.
225
- */
226
- handlePostLogs(req, res) {
227
- let body = '';
228
- req.on('data', (chunk) => {
229
- body += chunk.toString();
230
- // Limit body size to 1MB
231
- if (body.length > 1024 * 1024) {
232
- res.writeHead(413, { 'Content-Type': 'application/json' });
233
- res.end(JSON.stringify({ error: 'Payload too large' }));
234
- req.destroy();
235
- }
236
- });
237
- req.on('end', () => {
238
- try {
239
- const data = JSON.parse(body);
240
- if (data.type === 'logs' && Array.isArray(data.payload)) {
241
- this.addLogs(data.payload);
242
- res.writeHead(200, { 'Content-Type': 'application/json' });
243
- res.end(JSON.stringify({ success: true, received: data.payload.length }));
244
- }
245
- else {
246
- res.writeHead(400, { 'Content-Type': 'application/json' });
247
- res.end(JSON.stringify({ error: 'Invalid payload format' }));
248
- }
249
- }
250
- catch (_a) {
251
- res.writeHead(400, { 'Content-Type': 'application/json' });
252
- res.end(JSON.stringify({ error: 'Invalid JSON' }));
253
- }
254
- });
255
- req.on('error', () => {
256
- res.writeHead(500, { 'Content-Type': 'application/json' });
257
- res.end(JSON.stringify({ error: 'Request error' }));
258
- });
259
- }
260
- }
261
- exports.HotReloadServer = HotReloadServer;
@@ -1,75 +0,0 @@
1
- /**
2
- * Generic configuration service for accessing FiveM Convars.
3
- *
4
- * Provides type-safe access to configuration values with automatic
5
- * prefix handling and type conversion.
6
- *
7
- * All keys are automatically prefixed with `opencore_`.
8
- *
9
- * @example
10
- * ```ts
11
- * const config = di.resolve(ConfigService)
12
- *
13
- * // Get string value
14
- * const apiUrl = config.get('api_url', 'http://localhost:3000')
15
- *
16
- * // Get number value
17
- * const timeout = config.getNumber('timeout', 5000)
18
- *
19
- * // Get boolean value
20
- * const debug = config.getBoolean('debug', false)
21
- *
22
- * // Get required value (throws if not set)
23
- * const secretKey = config.getRequired('secret_key')
24
- *
25
- * // Get JSON value
26
- * const settings = config.getJson('settings', { enabled: true })
27
- * ```
28
- *
29
- * @scope Singleton
30
- */
31
- export declare class ConfigService {
32
- private readonly PREFIX;
33
- /**
34
- * Gets a string configuration value.
35
- *
36
- * @param key - The configuration key (without prefix)
37
- * @param defaultValue - Default value if not set
38
- * @returns The configuration value or default
39
- */
40
- get(key: string, defaultValue: string): string;
41
- /**
42
- * Gets a numeric configuration value.
43
- *
44
- * @param key - The configuration key (without prefix)
45
- * @param defaultValue - Default value if not set or invalid
46
- * @returns The configuration value as number
47
- */
48
- getNumber(key: string, defaultValue: number): number;
49
- /**
50
- * Gets a boolean configuration value.
51
- *
52
- * Recognizes 'true', '1' as true, everything else as false.
53
- *
54
- * @param key - The configuration key (without prefix)
55
- * @param defaultValue - Default value if not set
56
- * @returns The configuration value as boolean
57
- */
58
- getBoolean(key: string, defaultValue: boolean): boolean;
59
- /**
60
- * Gets a required configuration value.
61
- *
62
- * @param key - The configuration key (without prefix)
63
- * @returns The configuration value
64
- * @throws Error if the value is not set
65
- */
66
- getRequired(key: string): string;
67
- /**
68
- * Gets a JSON configuration value.
69
- *
70
- * @param key - The configuration key (without prefix)
71
- * @param defaultValue - Default value if not set or invalid JSON
72
- * @returns The parsed JSON value or default
73
- */
74
- getJson<T>(key: string, defaultValue: T): T;
75
- }
@@ -1,116 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.ConfigService = void 0;
10
- const decorators_1 = require("../decorators");
11
- /**
12
- * Generic configuration service for accessing FiveM Convars.
13
- *
14
- * Provides type-safe access to configuration values with automatic
15
- * prefix handling and type conversion.
16
- *
17
- * All keys are automatically prefixed with `opencore_`.
18
- *
19
- * @example
20
- * ```ts
21
- * const config = di.resolve(ConfigService)
22
- *
23
- * // Get string value
24
- * const apiUrl = config.get('api_url', 'http://localhost:3000')
25
- *
26
- * // Get number value
27
- * const timeout = config.getNumber('timeout', 5000)
28
- *
29
- * // Get boolean value
30
- * const debug = config.getBoolean('debug', false)
31
- *
32
- * // Get required value (throws if not set)
33
- * const secretKey = config.getRequired('secret_key')
34
- *
35
- * // Get JSON value
36
- * const settings = config.getJson('settings', { enabled: true })
37
- * ```
38
- *
39
- * @scope Singleton
40
- */
41
- let ConfigService = class ConfigService {
42
- constructor() {
43
- this.PREFIX = 'opencore_';
44
- }
45
- /**
46
- * Gets a string configuration value.
47
- *
48
- * @param key - The configuration key (without prefix)
49
- * @param defaultValue - Default value if not set
50
- * @returns The configuration value or default
51
- */
52
- get(key, defaultValue) {
53
- return GetConvar(this.PREFIX + key, defaultValue);
54
- }
55
- /**
56
- * Gets a numeric configuration value.
57
- *
58
- * @param key - The configuration key (without prefix)
59
- * @param defaultValue - Default value if not set or invalid
60
- * @returns The configuration value as number
61
- */
62
- getNumber(key, defaultValue) {
63
- const value = GetConvar(this.PREFIX + key, String(defaultValue));
64
- const parsed = Number(value);
65
- return Number.isNaN(parsed) ? defaultValue : parsed;
66
- }
67
- /**
68
- * Gets a boolean configuration value.
69
- *
70
- * Recognizes 'true', '1' as true, everything else as false.
71
- *
72
- * @param key - The configuration key (without prefix)
73
- * @param defaultValue - Default value if not set
74
- * @returns The configuration value as boolean
75
- */
76
- getBoolean(key, defaultValue) {
77
- const value = GetConvar(this.PREFIX + key, String(defaultValue));
78
- return value === 'true' || value === '1';
79
- }
80
- /**
81
- * Gets a required configuration value.
82
- *
83
- * @param key - The configuration key (without prefix)
84
- * @returns The configuration value
85
- * @throws Error if the value is not set
86
- */
87
- getRequired(key) {
88
- const value = GetConvar(this.PREFIX + key, '');
89
- if (!value) {
90
- throw new Error(`[OpenCore] Configuration '${this.PREFIX}${key}' is required but not set`);
91
- }
92
- return value;
93
- }
94
- /**
95
- * Gets a JSON configuration value.
96
- *
97
- * @param key - The configuration key (without prefix)
98
- * @param defaultValue - Default value if not set or invalid JSON
99
- * @returns The parsed JSON value or default
100
- */
101
- getJson(key, defaultValue) {
102
- const value = GetConvar(this.PREFIX + key, '');
103
- if (!value)
104
- return defaultValue;
105
- try {
106
- return JSON.parse(value);
107
- }
108
- catch (_a) {
109
- return defaultValue;
110
- }
111
- }
112
- };
113
- exports.ConfigService = ConfigService;
114
- exports.ConfigService = ConfigService = __decorate([
115
- (0, decorators_1.Bind)('singleton')
116
- ], ConfigService);
@@ -1,50 +0,0 @@
1
- export interface HttpOptions {
2
- headers?: Record<string, string>;
3
- timeoutMs?: number;
4
- }
5
- export declare class HttpService {
6
- /**
7
- * Performs an HTTP GET request to the specified URL.
8
- *
9
- * @template T - The expected return type of the response data.
10
- * @param url - The endpoint URL to fetch data from.
11
- * @param options - Optional configuration for the request (headers, timeout).
12
- * @returns A Promise that resolves to the response data of type T.
13
- * @throws {AppError} If the request fails, times out, or returns a non-2xx status code.
14
- */
15
- get<T = any>(url: string, options?: HttpOptions): Promise<T>;
16
- /**
17
- * Performs an HTTP POST request to the specified URL with a JSON payload.
18
- *
19
- * @template T - The expected return type of the response data.
20
- * @param url - The endpoint URL to send data to.
21
- * @param body - The data payload to be sent as the request body (will be stringified to JSON).
22
- * @param options - Optional configuration for the request (headers, timeout).
23
- * @returns A Promise that resolves to the response data of type T.
24
- * @throws {AppError} If the request fails, times out, or returns a non-2xx status code.
25
- */
26
- post<T = any>(url: string, body: any, options?: HttpOptions): Promise<T>;
27
- /**
28
- * Performs an HTTP PUT request to the specified URL to update a resource.
29
- *
30
- * @template T - The expected return type of the response data.
31
- * @param url - The endpoint URL to update.
32
- * @param body - The data payload to be sent as the request body (will be stringified to JSON).
33
- * @param options - Optional configuration for the request (headers, timeout).
34
- * @returns A Promise that resolves to the response data of type T.
35
- * @throws {AppError} If the request fails, times out, or returns a non-2xx status code.
36
- */
37
- put<T = any>(url: string, body: any, options?: HttpOptions): Promise<T>;
38
- /**
39
- * Performs an HTTP DELETE request to the specified URL.
40
- *
41
- * @template T - The expected return type of the response data (often void or the deleted entity).
42
- * @param url - The endpoint URL to delete the resource from.
43
- * @param options - Optional configuration for the request (headers, timeout).
44
- * @returns A Promise that resolves to the response data of type T.
45
- * @throws {AppError} If the request fails, times out, or returns a non-2xx status code.
46
- */
47
- delete<T = any>(url: string, options?: HttpOptions): Promise<T>;
48
- private request;
49
- private handleResponse;
50
- }
@@ -1,126 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.HttpService = void 0;
10
- const tsyringe_1 = require("tsyringe");
11
- const utils_1 = require("../../../../kernel/utils");
12
- let HttpService = class HttpService {
13
- /**
14
- * Performs an HTTP GET request to the specified URL.
15
- *
16
- * @template T - The expected return type of the response data.
17
- * @param url - The endpoint URL to fetch data from.
18
- * @param options - Optional configuration for the request (headers, timeout).
19
- * @returns A Promise that resolves to the response data of type T.
20
- * @throws {AppError} If the request fails, times out, or returns a non-2xx status code.
21
- */
22
- async get(url, options = {}) {
23
- return this.request(url, 'GET', undefined, options);
24
- }
25
- /**
26
- * Performs an HTTP POST request to the specified URL with a JSON payload.
27
- *
28
- * @template T - The expected return type of the response data.
29
- * @param url - The endpoint URL to send data to.
30
- * @param body - The data payload to be sent as the request body (will be stringified to JSON).
31
- * @param options - Optional configuration for the request (headers, timeout).
32
- * @returns A Promise that resolves to the response data of type T.
33
- * @throws {AppError} If the request fails, times out, or returns a non-2xx status code.
34
- */
35
- async post(url, body, options = {}) {
36
- return this.request(url, 'POST', body, options);
37
- }
38
- /**
39
- * Performs an HTTP PUT request to the specified URL to update a resource.
40
- *
41
- * @template T - The expected return type of the response data.
42
- * @param url - The endpoint URL to update.
43
- * @param body - The data payload to be sent as the request body (will be stringified to JSON).
44
- * @param options - Optional configuration for the request (headers, timeout).
45
- * @returns A Promise that resolves to the response data of type T.
46
- * @throws {AppError} If the request fails, times out, or returns a non-2xx status code.
47
- */
48
- async put(url, body, options = {}) {
49
- return this.request(url, 'PUT', body, options);
50
- }
51
- /**
52
- * Performs an HTTP DELETE request to the specified URL.
53
- *
54
- * @template T - The expected return type of the response data (often void or the deleted entity).
55
- * @param url - The endpoint URL to delete the resource from.
56
- * @param options - Optional configuration for the request (headers, timeout).
57
- * @returns A Promise that resolves to the response data of type T.
58
- * @throws {AppError} If the request fails, times out, or returns a non-2xx status code.
59
- */
60
- async delete(url, options = {}) {
61
- return this.request(url, 'DELETE', undefined, options);
62
- }
63
- async request(url, method, body, options) {
64
- const { headers = {}, timeoutMs = 5000 } = options;
65
- const finalHeaders = Object.assign({ 'Content-Type': 'application/json' }, headers);
66
- const controller = new AbortController();
67
- const id = setTimeout(() => controller.abort(), timeoutMs);
68
- try {
69
- const response = await fetch(url, {
70
- method,
71
- headers: finalHeaders,
72
- body: body ? JSON.stringify(body) : undefined,
73
- signal: controller.signal,
74
- });
75
- return await this.handleResponse(response, method, url);
76
- }
77
- catch (err) {
78
- if (err instanceof utils_1.AppError)
79
- throw err;
80
- if (err instanceof DOMException && err.name === 'AbortError') {
81
- throw new utils_1.AppError('NETWORK:ERROR', `${method} ${url} timed out after ${timeoutMs}ms`, 'external', { timeout: timeoutMs });
82
- }
83
- throw new utils_1.AppError('NETWORK:ERROR', `Network error calling ${method} ${url}`, 'external', {
84
- endpoint: url,
85
- method,
86
- cause: err instanceof Error ? err.message : String(err),
87
- });
88
- }
89
- finally {
90
- clearTimeout(id);
91
- }
92
- }
93
- async handleResponse(response, method, url) {
94
- if (!response.ok) {
95
- let code = 'API:ERROR';
96
- let errorBody = null;
97
- if (response.status === 401 || response.status === 403) {
98
- code = 'AUTH:UNAUTHORIZED';
99
- }
100
- try {
101
- errorBody = await response.json();
102
- }
103
- catch (_) { }
104
- throw new utils_1.AppError(code, `${method} ${url} failed with status ${response.status}`, 'external', {
105
- status: response.status,
106
- endpoint: url,
107
- method,
108
- body: errorBody,
109
- });
110
- }
111
- if (response.status === 204) {
112
- return undefined;
113
- }
114
- try {
115
- return (await response.json());
116
- }
117
- catch (_) {
118
- // TODO: define better behavior for non-JSON responses
119
- return undefined;
120
- }
121
- }
122
- };
123
- exports.HttpService = HttpService;
124
- exports.HttpService = HttpService = __decorate([
125
- (0, tsyringe_1.injectable)()
126
- ], HttpService);
File without changes
File without changes