@netifyjs/protocol 0.0.0-stage → 1.0.0-alpha.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 (1099) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +38 -2
  3. package/package.json +56 -4
  4. package/src/codec/index.ts +193 -0
  5. package/src/dispatch/dispatcher/index.ts +200 -0
  6. package/src/dispatch/event/index.ts +49 -0
  7. package/src/dispatch/index.ts +11 -0
  8. package/src/dispatch/route/index.ts +141 -0
  9. package/src/dispatch/session/index.ts +60 -0
  10. package/src/format/index.ts +72 -0
  11. package/src/index.ts +59 -0
  12. package/src/names/index.ts +73 -0
  13. package/src/photon/application/index.ts +76 -0
  14. package/src/photon/authentication/admission/index.ts +47 -0
  15. package/src/photon/authentication/authenticator/index.ts +106 -0
  16. package/src/photon/authentication/failure/index.ts +15 -0
  17. package/src/photon/authentication/gate/index.ts +221 -0
  18. package/src/photon/authentication/http/index.ts +337 -0
  19. package/src/photon/authentication/index.ts +18 -0
  20. package/src/photon/authentication/keys/index.ts +67 -0
  21. package/src/photon/authentication/provider/index.ts +48 -0
  22. package/src/photon/authentication/queue/index.ts +284 -0
  23. package/src/photon/authentication/result/index.ts +191 -0
  24. package/src/photon/balancing/catalogue/events/index.ts +93 -0
  25. package/src/photon/balancing/catalogue/index.ts +148 -0
  26. package/src/photon/balancing/catalogue/requests/index.ts +104 -0
  27. package/src/photon/balancing/catalogue/responses/index.ts +106 -0
  28. package/src/photon/balancing/code/actor/index.ts +24 -0
  29. package/src/photon/balancing/code/authentication/index.ts +101 -0
  30. package/src/photon/balancing/code/caching/index.ts +69 -0
  31. package/src/photon/balancing/code/cause/index.ts +115 -0
  32. package/src/photon/balancing/code/error/index.ts +280 -0
  33. package/src/photon/balancing/code/event/index.ts +104 -0
  34. package/src/photon/balancing/code/friends/index.ts +35 -0
  35. package/src/photon/balancing/code/game/index.ts +69 -0
  36. package/src/photon/balancing/code/index.ts +52 -0
  37. package/src/photon/balancing/code/join/index.ts +29 -0
  38. package/src/photon/balancing/code/lobby/index.ts +29 -0
  39. package/src/photon/balancing/code/matchmaking/index.ts +25 -0
  40. package/src/photon/balancing/code/message/index.ts +507 -0
  41. package/src/photon/balancing/code/operation/index.ts +124 -0
  42. package/src/photon/balancing/code/parameter/index.ts +414 -0
  43. package/src/photon/balancing/code/ping/index.ts +29 -0
  44. package/src/photon/balancing/code/port/index.ts +89 -0
  45. package/src/photon/balancing/code/property/index.ts +30 -0
  46. package/src/photon/balancing/code/receiver/index.ts +24 -0
  47. package/src/photon/balancing/code/room/index.ts +45 -0
  48. package/src/photon/balancing/code/state/index.ts +109 -0
  49. package/src/photon/balancing/code/status/index.ts +89 -0
  50. package/src/photon/balancing/code/web/index.ts +29 -0
  51. package/src/photon/balancing/codec/index.ts +294 -0
  52. package/src/photon/balancing/dotnet/index.ts +55 -0
  53. package/src/photon/balancing/entity/authentication/index.ts +51 -0
  54. package/src/photon/balancing/entity/credentials/index.ts +77 -0
  55. package/src/photon/balancing/entity/entry/index.ts +77 -0
  56. package/src/photon/balancing/entity/grant/index.ts +192 -0
  57. package/src/photon/balancing/entity/index.ts +7 -0
  58. package/src/photon/balancing/entity/lobby/index.ts +35 -0
  59. package/src/photon/balancing/entity/options/index.ts +174 -0
  60. package/src/photon/balancing/entity/stat/index.ts +59 -0
  61. package/src/photon/balancing/format/authenticate/index.ts +2 -0
  62. package/src/photon/balancing/format/authenticate/request/index.ts +82 -0
  63. package/src/photon/balancing/format/authenticate/response/index.ts +61 -0
  64. package/src/photon/balancing/format/contract/index.ts +51 -0
  65. package/src/photon/balancing/format/event/auth/index.ts +49 -0
  66. package/src/photon/balancing/format/event/azure/index.ts +56 -0
  67. package/src/photon/balancing/format/event/custom/index.ts +55 -0
  68. package/src/photon/balancing/format/event/disconnect/index.ts +54 -0
  69. package/src/photon/balancing/format/event/error/index.ts +51 -0
  70. package/src/photon/balancing/format/event/index.ts +16 -0
  71. package/src/photon/balancing/format/event/join/index.ts +58 -0
  72. package/src/photon/balancing/format/event/leave/index.ts +60 -0
  73. package/src/photon/balancing/format/event/list/index.ts +53 -0
  74. package/src/photon/balancing/format/event/match/index.ts +55 -0
  75. package/src/photon/balancing/format/event/offline/index.ts +52 -0
  76. package/src/photon/balancing/format/event/properties/index.ts +60 -0
  77. package/src/photon/balancing/format/event/purged/index.ts +44 -0
  78. package/src/photon/balancing/format/event/queue/index.ts +51 -0
  79. package/src/photon/balancing/format/event/slice/index.ts +57 -0
  80. package/src/photon/balancing/format/event/stats/app/index.ts +60 -0
  81. package/src/photon/balancing/format/event/stats/index.ts +2 -0
  82. package/src/photon/balancing/format/event/stats/lobby/index.ts +54 -0
  83. package/src/photon/balancing/format/event/update/index.ts +53 -0
  84. package/src/photon/balancing/format/friends/index.ts +2 -0
  85. package/src/photon/balancing/format/friends/request/index.ts +56 -0
  86. package/src/photon/balancing/format/friends/response/index.ts +64 -0
  87. package/src/photon/balancing/format/game/create/index.ts +2 -0
  88. package/src/photon/balancing/format/game/create/request/index.ts +79 -0
  89. package/src/photon/balancing/format/game/create/response/index.ts +87 -0
  90. package/src/photon/balancing/format/game/debug/index.ts +2 -0
  91. package/src/photon/balancing/format/game/debug/request/index.ts +55 -0
  92. package/src/photon/balancing/format/game/debug/response/index.ts +60 -0
  93. package/src/photon/balancing/format/game/index.ts +17 -0
  94. package/src/photon/balancing/format/game/join/index.ts +2 -0
  95. package/src/photon/balancing/format/game/join/request/index.ts +93 -0
  96. package/src/photon/balancing/format/game/join/response/index.ts +87 -0
  97. package/src/photon/balancing/format/game/list/index.ts +2 -0
  98. package/src/photon/balancing/format/game/list/request/index.ts +59 -0
  99. package/src/photon/balancing/format/game/list/response/index.ts +57 -0
  100. package/src/photon/balancing/format/game/random/index.ts +2 -0
  101. package/src/photon/balancing/format/game/random/request/index.ts +87 -0
  102. package/src/photon/balancing/format/game/random/response/index.ts +66 -0
  103. package/src/photon/balancing/format/groups/index.ts +2 -0
  104. package/src/photon/balancing/format/groups/request/index.ts +54 -0
  105. package/src/photon/balancing/format/groups/response/index.ts +52 -0
  106. package/src/photon/balancing/format/index.ts +88 -0
  107. package/src/photon/balancing/format/leave/index.ts +2 -0
  108. package/src/photon/balancing/format/leave/request/index.ts +54 -0
  109. package/src/photon/balancing/format/leave/response/index.ts +49 -0
  110. package/src/photon/balancing/format/lobby/index.ts +12 -0
  111. package/src/photon/balancing/format/lobby/join/index.ts +2 -0
  112. package/src/photon/balancing/format/lobby/join/request/index.ts +63 -0
  113. package/src/photon/balancing/format/lobby/join/response/index.ts +45 -0
  114. package/src/photon/balancing/format/lobby/leave/index.ts +2 -0
  115. package/src/photon/balancing/format/lobby/leave/request/index.ts +43 -0
  116. package/src/photon/balancing/format/lobby/leave/response/index.ts +45 -0
  117. package/src/photon/balancing/format/lobby/stats/index.ts +2 -0
  118. package/src/photon/balancing/format/lobby/stats/request/index.ts +54 -0
  119. package/src/photon/balancing/format/lobby/stats/response/index.ts +62 -0
  120. package/src/photon/balancing/format/once/index.ts +2 -0
  121. package/src/photon/balancing/format/once/request/index.ts +72 -0
  122. package/src/photon/balancing/format/once/response/index.ts +65 -0
  123. package/src/photon/balancing/format/ping/index.ts +2 -0
  124. package/src/photon/balancing/format/ping/request/index.ts +43 -0
  125. package/src/photon/balancing/format/ping/response/index.ts +49 -0
  126. package/src/photon/balancing/format/properties/get/index.ts +2 -0
  127. package/src/photon/balancing/format/properties/get/request/index.ts +58 -0
  128. package/src/photon/balancing/format/properties/get/response/index.ts +62 -0
  129. package/src/photon/balancing/format/properties/index.ts +8 -0
  130. package/src/photon/balancing/format/properties/set/index.ts +2 -0
  131. package/src/photon/balancing/format/properties/set/request/index.ts +66 -0
  132. package/src/photon/balancing/format/properties/set/response/index.ts +53 -0
  133. package/src/photon/balancing/format/raise/index.ts +2 -0
  134. package/src/photon/balancing/format/raise/request/index.ts +93 -0
  135. package/src/photon/balancing/format/raise/response/index.ts +49 -0
  136. package/src/photon/balancing/format/reader/index.ts +362 -0
  137. package/src/photon/balancing/format/regions/index.ts +2 -0
  138. package/src/photon/balancing/format/regions/request/index.ts +49 -0
  139. package/src/photon/balancing/format/regions/response/index.ts +62 -0
  140. package/src/photon/balancing/format/rpc/index.ts +2 -0
  141. package/src/photon/balancing/format/rpc/request/index.ts +56 -0
  142. package/src/photon/balancing/format/rpc/response/index.ts +62 -0
  143. package/src/photon/balancing/format/settings/index.ts +2 -0
  144. package/src/photon/balancing/format/settings/request/index.ts +52 -0
  145. package/src/photon/balancing/format/settings/response/index.ts +49 -0
  146. package/src/photon/balancing/format/shared/credentials/index.ts +84 -0
  147. package/src/photon/balancing/format/shared/entry/index.ts +43 -0
  148. package/src/photon/balancing/format/shared/grant/index.ts +96 -0
  149. package/src/photon/balancing/format/shared/index.ts +6 -0
  150. package/src/photon/balancing/format/shared/lobby/index.ts +36 -0
  151. package/src/photon/balancing/format/shared/options/index.ts +68 -0
  152. package/src/photon/balancing/format/shared/stats/index.ts +55 -0
  153. package/src/photon/balancing/format/writer/index.ts +187 -0
  154. package/src/photon/balancing/index.ts +239 -0
  155. package/src/photon/balancing/packet/adapter/index.ts +39 -0
  156. package/src/photon/balancing/packet/authenticate/index.ts +2 -0
  157. package/src/photon/balancing/packet/authenticate/request/index.ts +105 -0
  158. package/src/photon/balancing/packet/authenticate/response/index.ts +49 -0
  159. package/src/photon/balancing/packet/event/auth/index.ts +30 -0
  160. package/src/photon/balancing/packet/event/azure/index.ts +54 -0
  161. package/src/photon/balancing/packet/event/custom/index.ts +50 -0
  162. package/src/photon/balancing/packet/event/disconnect/index.ts +30 -0
  163. package/src/photon/balancing/packet/event/error/index.ts +29 -0
  164. package/src/photon/balancing/packet/event/index.ts +16 -0
  165. package/src/photon/balancing/packet/event/join/index.ts +54 -0
  166. package/src/photon/balancing/packet/event/leave/index.ts +63 -0
  167. package/src/photon/balancing/packet/event/list/index.ts +30 -0
  168. package/src/photon/balancing/packet/event/match/index.ts +37 -0
  169. package/src/photon/balancing/packet/event/offline/index.ts +29 -0
  170. package/src/photon/balancing/packet/event/properties/index.ts +58 -0
  171. package/src/photon/balancing/packet/event/purged/index.ts +21 -0
  172. package/src/photon/balancing/packet/event/queue/index.ts +29 -0
  173. package/src/photon/balancing/packet/event/slice/index.ts +40 -0
  174. package/src/photon/balancing/packet/event/stats/app/index.ts +56 -0
  175. package/src/photon/balancing/packet/event/stats/index.ts +2 -0
  176. package/src/photon/balancing/packet/event/stats/lobby/index.ts +30 -0
  177. package/src/photon/balancing/packet/event/update/index.ts +30 -0
  178. package/src/photon/balancing/packet/friends/index.ts +2 -0
  179. package/src/photon/balancing/packet/friends/request/index.ts +40 -0
  180. package/src/photon/balancing/packet/friends/response/index.ts +60 -0
  181. package/src/photon/balancing/packet/game/create/index.ts +2 -0
  182. package/src/photon/balancing/packet/game/create/request/index.ts +160 -0
  183. package/src/photon/balancing/packet/game/create/response/index.ts +122 -0
  184. package/src/photon/balancing/packet/game/debug/index.ts +2 -0
  185. package/src/photon/balancing/packet/game/debug/request/index.ts +40 -0
  186. package/src/photon/balancing/packet/game/debug/response/index.ts +70 -0
  187. package/src/photon/balancing/packet/game/index.ts +8 -0
  188. package/src/photon/balancing/packet/game/join/index.ts +2 -0
  189. package/src/photon/balancing/packet/game/join/request/index.ts +218 -0
  190. package/src/photon/balancing/packet/game/join/response/index.ts +122 -0
  191. package/src/photon/balancing/packet/game/list/index.ts +2 -0
  192. package/src/photon/balancing/packet/game/list/request/index.ts +41 -0
  193. package/src/photon/balancing/packet/game/list/response/index.ts +49 -0
  194. package/src/photon/balancing/packet/game/random/index.ts +2 -0
  195. package/src/photon/balancing/packet/game/random/request/index.ts +172 -0
  196. package/src/photon/balancing/packet/game/random/response/index.ts +95 -0
  197. package/src/photon/balancing/packet/groups/index.ts +2 -0
  198. package/src/photon/balancing/packet/groups/request/index.ts +40 -0
  199. package/src/photon/balancing/packet/groups/response/index.ts +35 -0
  200. package/src/photon/balancing/packet/index.ts +69 -0
  201. package/src/photon/balancing/packet/leave/index.ts +2 -0
  202. package/src/photon/balancing/packet/leave/request/index.ts +40 -0
  203. package/src/photon/balancing/packet/leave/response/index.ts +35 -0
  204. package/src/photon/balancing/packet/lobby/index.ts +3 -0
  205. package/src/photon/balancing/packet/lobby/join/index.ts +2 -0
  206. package/src/photon/balancing/packet/lobby/join/request/index.ts +55 -0
  207. package/src/photon/balancing/packet/lobby/join/response/index.ts +35 -0
  208. package/src/photon/balancing/packet/lobby/leave/index.ts +2 -0
  209. package/src/photon/balancing/packet/lobby/leave/request/index.ts +21 -0
  210. package/src/photon/balancing/packet/lobby/leave/response/index.ts +43 -0
  211. package/src/photon/balancing/packet/lobby/stats/index.ts +2 -0
  212. package/src/photon/balancing/packet/lobby/stats/request/index.ts +43 -0
  213. package/src/photon/balancing/packet/lobby/stats/response/index.ts +49 -0
  214. package/src/photon/balancing/packet/once/index.ts +2 -0
  215. package/src/photon/balancing/packet/once/request/index.ts +70 -0
  216. package/src/photon/balancing/packet/once/response/index.ts +49 -0
  217. package/src/photon/balancing/packet/ping/index.ts +2 -0
  218. package/src/photon/balancing/packet/ping/request/index.ts +21 -0
  219. package/src/photon/balancing/packet/ping/response/index.ts +35 -0
  220. package/src/photon/balancing/packet/properties/get/index.ts +2 -0
  221. package/src/photon/balancing/packet/properties/get/request/index.ts +69 -0
  222. package/src/photon/balancing/packet/properties/get/response/index.ts +66 -0
  223. package/src/photon/balancing/packet/properties/index.ts +2 -0
  224. package/src/photon/balancing/packet/properties/set/index.ts +2 -0
  225. package/src/photon/balancing/packet/properties/set/request/index.ts +122 -0
  226. package/src/photon/balancing/packet/properties/set/response/index.ts +35 -0
  227. package/src/photon/balancing/packet/raise/index.ts +2 -0
  228. package/src/photon/balancing/packet/raise/request/index.ts +219 -0
  229. package/src/photon/balancing/packet/raise/response/index.ts +35 -0
  230. package/src/photon/balancing/packet/regions/index.ts +2 -0
  231. package/src/photon/balancing/packet/regions/request/index.ts +29 -0
  232. package/src/photon/balancing/packet/regions/response/index.ts +60 -0
  233. package/src/photon/balancing/packet/reply/index.ts +59 -0
  234. package/src/photon/balancing/packet/rpc/index.ts +2 -0
  235. package/src/photon/balancing/packet/rpc/request/index.ts +54 -0
  236. package/src/photon/balancing/packet/rpc/response/index.ts +88 -0
  237. package/src/photon/balancing/packet/settings/index.ts +2 -0
  238. package/src/photon/balancing/packet/settings/request/index.ts +29 -0
  239. package/src/photon/balancing/packet/settings/response/index.ts +35 -0
  240. package/src/photon/balancing/packet/unknown/index.ts +71 -0
  241. package/src/photon/balancing/pun/code/index.ts +376 -0
  242. package/src/photon/balancing/pun/destroy/index.ts +2 -0
  243. package/src/photon/balancing/pun/destroy/object/index.ts +48 -0
  244. package/src/photon/balancing/pun/destroy/player/index.ts +53 -0
  245. package/src/photon/balancing/pun/events/index.ts +283 -0
  246. package/src/photon/balancing/pun/filter/index.ts +45 -0
  247. package/src/photon/balancing/pun/index.ts +34 -0
  248. package/src/photon/balancing/pun/instantiation/index.ts +213 -0
  249. package/src/photon/balancing/pun/keys/index.ts +78 -0
  250. package/src/photon/balancing/pun/master/index.ts +48 -0
  251. package/src/photon/balancing/pun/ownership/index.ts +4 -0
  252. package/src/photon/balancing/pun/ownership/request/index.ts +55 -0
  253. package/src/photon/balancing/pun/ownership/transfer/index.ts +55 -0
  254. package/src/photon/balancing/pun/ownership/update/index.ts +57 -0
  255. package/src/photon/balancing/pun/rpc/index.ts +180 -0
  256. package/src/photon/balancing/pun/serialize/batch/index.ts +143 -0
  257. package/src/photon/balancing/pun/serialize/index.ts +2 -0
  258. package/src/photon/balancing/pun/serialize/view/index.ts +96 -0
  259. package/src/photon/balancing/pun/view/index.ts +41 -0
  260. package/src/photon/balancing/role/index.ts +24 -0
  261. package/src/photon/balancing/travel/index.ts +103 -0
  262. package/src/photon/binary/adapter/index.ts +619 -0
  263. package/src/photon/binary/custom/index.ts +148 -0
  264. package/src/photon/binary/dictionary/index.ts +110 -0
  265. package/src/photon/binary/disconnect/index.ts +51 -0
  266. package/src/photon/binary/event/index.ts +48 -0
  267. package/src/photon/binary/factory/index.ts +23 -0
  268. package/src/photon/binary/hashtable/index.ts +83 -0
  269. package/src/photon/binary/index.ts +25 -0
  270. package/src/photon/binary/kind/index.ts +104 -0
  271. package/src/photon/binary/parameters/index.ts +117 -0
  272. package/src/photon/binary/protocol/index.ts +122 -0
  273. package/src/photon/binary/request/index.ts +38 -0
  274. package/src/photon/binary/response/index.ts +92 -0
  275. package/src/photon/binary/shape/index.ts +260 -0
  276. package/src/photon/binary/v16/index.ts +834 -0
  277. package/src/photon/binary/v18/index.ts +1428 -0
  278. package/src/photon/binary/value/index.ts +362 -0
  279. package/src/photon/client/bot/index.ts +662 -0
  280. package/src/photon/client/connection/index.ts +420 -0
  281. package/src/photon/client/endpoint/index.ts +87 -0
  282. package/src/photon/client/failure/index.ts +37 -0
  283. package/src/photon/client/index.ts +5 -0
  284. package/src/photon/client/options/index.ts +78 -0
  285. package/src/photon/cluster/back/index.ts +186 -0
  286. package/src/photon/cluster/carriage/index.ts +334 -0
  287. package/src/photon/cluster/directory/index.ts +103 -0
  288. package/src/photon/cluster/dresser/index.ts +83 -0
  289. package/src/photon/cluster/feed/index.ts +267 -0
  290. package/src/photon/cluster/front/index.ts +205 -0
  291. package/src/photon/cluster/grid/index.ts +429 -0
  292. package/src/photon/cluster/hub/index.ts +434 -0
  293. package/src/photon/cluster/index.ts +18 -0
  294. package/src/photon/cluster/mover/index.ts +173 -0
  295. package/src/photon/cluster/parcel/index.ts +158 -0
  296. package/src/photon/cluster/pooled/index.ts +66 -0
  297. package/src/photon/cluster/press/index.ts +96 -0
  298. package/src/photon/cluster/route/game/index.ts +95 -0
  299. package/src/photon/cluster/route/index.ts +3 -0
  300. package/src/photon/cluster/route/master/index.ts +235 -0
  301. package/src/photon/cluster/route/name/index.ts +176 -0
  302. package/src/photon/cluster/seat/game/index.ts +113 -0
  303. package/src/photon/cluster/seat/index.ts +2 -0
  304. package/src/photon/cluster/seat/master/index.ts +97 -0
  305. package/src/photon/cluster/seed/index.ts +190 -0
  306. package/src/photon/cluster/sessions/index.ts +136 -0
  307. package/src/photon/cluster/spread/index.ts +236 -0
  308. package/src/photon/cluster/value/index.ts +46 -0
  309. package/src/photon/crypto/code/index.ts +149 -0
  310. package/src/photon/crypto/connection/index.ts +127 -0
  311. package/src/photon/crypto/data/index.ts +214 -0
  312. package/src/photon/crypto/datagram/index.ts +119 -0
  313. package/src/photon/crypto/error/index.ts +29 -0
  314. package/src/photon/crypto/exchange/index.ts +187 -0
  315. package/src/photon/crypto/index.ts +31 -0
  316. package/src/photon/crypto/init/binary/index.ts +249 -0
  317. package/src/photon/crypto/init/http/index.ts +222 -0
  318. package/src/photon/crypto/init/index.ts +6 -0
  319. package/src/photon/crypto/init/query/index.ts +85 -0
  320. package/src/photon/crypto/init/socket/index.ts +82 -0
  321. package/src/photon/crypto/method/index.ts +20 -0
  322. package/src/photon/crypto/mode/index.ts +35 -0
  323. package/src/photon/crypto/once/gate/index.ts +60 -0
  324. package/src/photon/crypto/once/index.ts +4 -0
  325. package/src/photon/crypto/once/reply/index.ts +96 -0
  326. package/src/photon/crypto/once/request/index.ts +14 -0
  327. package/src/photon/crypto/payload/index.ts +189 -0
  328. package/src/photon/crypto/protocol/index.ts +30 -0
  329. package/src/photon/crypto/refusal/index.ts +118 -0
  330. package/src/photon/crypto/sequence/index.ts +97 -0
  331. package/src/photon/crypto/token/authority/index.ts +158 -0
  332. package/src/photon/crypto/token/codec/index.ts +18 -0
  333. package/src/photon/crypto/token/index.ts +5 -0
  334. package/src/photon/crypto/token/record/index.ts +116 -0
  335. package/src/photon/crypto/token/sealed/index.ts +285 -0
  336. package/src/photon/crypto/token/verdict/index.ts +43 -0
  337. package/src/photon/enet/client/index.ts +204 -0
  338. package/src/photon/enet/closure/index.ts +90 -0
  339. package/src/photon/enet/command/index.ts +301 -0
  340. package/src/photon/enet/datagram/index.ts +289 -0
  341. package/src/photon/enet/flight/index.ts +93 -0
  342. package/src/photon/enet/gateway/index.ts +311 -0
  343. package/src/photon/enet/handler/index.ts +65 -0
  344. package/src/photon/enet/index.ts +21 -0
  345. package/src/photon/enet/lane/index.ts +403 -0
  346. package/src/photon/enet/link/index.ts +200 -0
  347. package/src/photon/enet/options/index.ts +283 -0
  348. package/src/photon/enet/peer/index.ts +1527 -0
  349. package/src/photon/enet/server/index.ts +107 -0
  350. package/src/photon/enet/transport/index.ts +83 -0
  351. package/src/photon/enet/window/index.ts +48 -0
  352. package/src/photon/envelope/index.ts +83 -0
  353. package/src/photon/family/index.ts +41 -0
  354. package/src/photon/frame/index.ts +88 -0
  355. package/src/photon/game/actor/index.ts +117 -0
  356. package/src/photon/game/authenticator/index.ts +139 -0
  357. package/src/photon/game/bag/index.ts +169 -0
  358. package/src/photon/game/cache/index.ts +456 -0
  359. package/src/photon/game/clock/index.ts +137 -0
  360. package/src/photon/game/compare/index.ts +162 -0
  361. package/src/photon/game/entry/index.ts +334 -0
  362. package/src/photon/game/fault/index.ts +77 -0
  363. package/src/photon/game/gate/index.ts +177 -0
  364. package/src/photon/game/groups/index.ts +115 -0
  365. package/src/photon/game/guard/index.ts +54 -0
  366. package/src/photon/game/handler/index.ts +456 -0
  367. package/src/photon/game/hooked/index.ts +873 -0
  368. package/src/photon/game/index.ts +41 -0
  369. package/src/photon/game/peer/index.ts +186 -0
  370. package/src/photon/game/report/index.ts +120 -0
  371. package/src/photon/game/room/index.ts +2271 -0
  372. package/src/photon/game/rooms/index.ts +149 -0
  373. package/src/photon/game/server/index.ts +503 -0
  374. package/src/photon/game/settings/index.ts +341 -0
  375. package/src/photon/game/shared/index.ts +54 -0
  376. package/src/photon/game/snapshot/index.ts +124 -0
  377. package/src/photon/game/stage/index.ts +74 -0
  378. package/src/photon/game/touch/index.ts +43 -0
  379. package/src/photon/game/wellknown/index.ts +353 -0
  380. package/src/photon/hooks/index.ts +9 -0
  381. package/src/photon/hooks/reason/index.ts +129 -0
  382. package/src/photon/hooks/reply/index.ts +239 -0
  383. package/src/photon/hooks/request/index.ts +383 -0
  384. package/src/photon/hooks/sender/index.ts +268 -0
  385. package/src/photon/hooks/settings/index.ts +383 -0
  386. package/src/photon/hooks/state/index.ts +545 -0
  387. package/src/photon/index.ts +31 -0
  388. package/src/photon/master/application/index.ts +446 -0
  389. package/src/photon/master/balancer/index.ts +170 -0
  390. package/src/photon/master/context/index.ts +127 -0
  391. package/src/photon/master/equality/index.ts +104 -0
  392. package/src/photon/master/fault/index.ts +86 -0
  393. package/src/photon/master/game/index.ts +847 -0
  394. package/src/photon/master/gate/index.ts +243 -0
  395. package/src/photon/master/handler/index.ts +1103 -0
  396. package/src/photon/master/index.ts +20 -0
  397. package/src/photon/master/list/channel/index.ts +417 -0
  398. package/src/photon/master/list/games/index.ts +419 -0
  399. package/src/photon/master/list/index.ts +6 -0
  400. package/src/photon/master/list/limited/index.ts +103 -0
  401. package/src/photon/master/list/plain/index.ts +47 -0
  402. package/src/photon/master/list/silent/index.ts +45 -0
  403. package/src/photon/master/list/sql/index.ts +280 -0
  404. package/src/photon/master/lobbies/index.ts +85 -0
  405. package/src/photon/master/lobby/index.ts +572 -0
  406. package/src/photon/master/peer/index.ts +168 -0
  407. package/src/photon/master/players/index.ts +177 -0
  408. package/src/photon/master/redirect/index.ts +90 -0
  409. package/src/photon/master/rpc/index.ts +2 -0
  410. package/src/photon/master/server/index.ts +212 -0
  411. package/src/photon/master/settings/index.ts +515 -0
  412. package/src/photon/master/sql/error/index.ts +92 -0
  413. package/src/photon/master/sql/host/index.ts +153 -0
  414. package/src/photon/master/sql/index.ts +9 -0
  415. package/src/photon/master/sql/relay/index.ts +141 -0
  416. package/src/photon/master/sql/remote/index.ts +257 -0
  417. package/src/photon/master/sql/store/index.ts +37 -0
  418. package/src/photon/master/sql/table/index.ts +219 -0
  419. package/src/photon/master/sql/value/index.ts +93 -0
  420. package/src/photon/master/sql/watch/index.ts +80 -0
  421. package/src/photon/master/sql/wire/index.ts +98 -0
  422. package/src/photon/master/stats/app/index.ts +122 -0
  423. package/src/photon/master/stats/index.ts +2 -0
  424. package/src/photon/master/stats/lobby/index.ts +180 -0
  425. package/src/photon/master/wellknown/index.ts +220 -0
  426. package/src/photon/message/binary/index.ts +289 -0
  427. package/src/photon/message/client/index.ts +110 -0
  428. package/src/photon/message/dialect/index.ts +61 -0
  429. package/src/photon/message/format/index.ts +21 -0
  430. package/src/photon/message/handler/index.ts +161 -0
  431. package/src/photon/message/index.ts +23 -0
  432. package/src/photon/message/init/classic/index.ts +204 -0
  433. package/src/photon/message/init/form/index.ts +29 -0
  434. package/src/photon/message/init/index.ts +6 -0
  435. package/src/photon/message/init/request/index.ts +388 -0
  436. package/src/photon/message/internal/index.ts +203 -0
  437. package/src/photon/message/json/format/index.ts +129 -0
  438. package/src/photon/message/json/index.ts +3 -0
  439. package/src/photon/message/json/keys/index.ts +44 -0
  440. package/src/photon/message/json/values/index.ts +323 -0
  441. package/src/photon/message/once/index.ts +69 -0
  442. package/src/photon/message/peer/index.ts +276 -0
  443. package/src/photon/message/pipeline/index.ts +350 -0
  444. package/src/photon/message/server/index.ts +208 -0
  445. package/src/photon/message/type/index.ts +59 -0
  446. package/src/photon/message/watch/index.ts +30 -0
  447. package/src/photon/message/wire/index.ts +215 -0
  448. package/src/photon/name/config/index.ts +133 -0
  449. package/src/photon/name/handler/index.ts +816 -0
  450. package/src/photon/name/index.ts +12 -0
  451. package/src/photon/name/node/index.ts +181 -0
  452. package/src/photon/name/peer/index.ts +23 -0
  453. package/src/photon/name/regions/index.ts +110 -0
  454. package/src/photon/name/server/index.ts +207 -0
  455. package/src/photon/registry/index.ts +244 -0
  456. package/src/photon/rpc/fault/index.ts +60 -0
  457. package/src/photon/rpc/http/index.ts +508 -0
  458. package/src/photon/rpc/index.ts +10 -0
  459. package/src/photon/rpc/meter/index.ts +47 -0
  460. package/src/photon/rpc/relay/index.ts +112 -0
  461. package/src/photon/rpc/service/index.ts +67 -0
  462. package/src/photon/seal/index.ts +17 -0
  463. package/src/photon/server/config/index.ts +241 -0
  464. package/src/photon/server/gatekeeper/index.ts +99 -0
  465. package/src/photon/server/host/index.ts +581 -0
  466. package/src/photon/server/index.ts +5 -0
  467. package/src/photon/server/listeners/index.ts +250 -0
  468. package/src/photon/server/ports/index.ts +156 -0
  469. package/src/photon/tcp/client/index.ts +64 -0
  470. package/src/photon/tcp/clock/index.ts +12 -0
  471. package/src/photon/tcp/codec/index.ts +175 -0
  472. package/src/photon/tcp/framing/index.ts +131 -0
  473. package/src/photon/tcp/index.ts +8 -0
  474. package/src/photon/tcp/ping/index.ts +43 -0
  475. package/src/photon/tcp/pong/index.ts +53 -0
  476. package/src/photon/tcp/server/index.ts +81 -0
  477. package/src/photon/timers/index.ts +68 -0
  478. package/src/photon/websocket/binary/index.ts +71 -0
  479. package/src/photon/websocket/bridge/index.ts +301 -0
  480. package/src/photon/websocket/framing/index.ts +45 -0
  481. package/src/photon/websocket/index.ts +14 -0
  482. package/src/photon/websocket/json/index.ts +49 -0
  483. package/src/photon/websocket/message/index.ts +176 -0
  484. package/src/photon/websocket/negotiation/index.ts +99 -0
  485. package/src/photon/websocket/path/index.ts +52 -0
  486. package/src/photon/websocket/plain/index.ts +25 -0
  487. package/src/photon/websocket/query/index.ts +99 -0
  488. package/src/photon/websocket/reassembly/index.ts +75 -0
  489. package/src/photon/websocket/subprotocol/index.ts +24 -0
  490. package/src/photon/websocket/text/index.ts +80 -0
  491. package/src/protocol/index.ts +61 -0
  492. package/src/scale/courier/index.ts +703 -0
  493. package/src/scale/datagram/index.ts +337 -0
  494. package/src/scale/fanout/index.ts +653 -0
  495. package/src/scale/handoff/index.ts +271 -0
  496. package/src/scale/hosted/index.ts +62 -0
  497. package/src/scale/index.ts +36 -0
  498. package/src/scale/layout/index.ts +29 -0
  499. package/src/scale/mesh/index.ts +211 -0
  500. package/src/scale/outlet/index.ts +58 -0
  501. package/src/scale/placement/index.ts +89 -0
  502. package/src/scale/portable/index.ts +42 -0
  503. package/src/scale/relay/index.ts +125 -0
  504. package/src/scale/sink/index.ts +51 -0
  505. package/src/scale/switchboard/index.ts +91 -0
  506. package/src/scale/transport/index.ts +112 -0
  507. package/src/scale/tunnel/index.ts +677 -0
  508. package/src/smartfox/index.ts +2 -0
  509. package/src/smartfox/pro/bans/index.ts +3 -0
  510. package/src/smartfox/pro/bans/list/index.ts +101 -0
  511. package/src/smartfox/pro/bans/memory/index.ts +57 -0
  512. package/src/smartfox/pro/bans/store/index.ts +43 -0
  513. package/src/smartfox/pro/bluebox/gateway/index.ts +310 -0
  514. package/src/smartfox/pro/bluebox/index.ts +4 -0
  515. package/src/smartfox/pro/bluebox/session/index.ts +63 -0
  516. package/src/smartfox/pro/bluebox/transport/index.ts +104 -0
  517. package/src/smartfox/pro/buddies/index.ts +4 -0
  518. package/src/smartfox/pro/buddies/memory/index.ts +38 -0
  519. package/src/smartfox/pro/buddies/roster/index.ts +411 -0
  520. package/src/smartfox/pro/buddies/store/index.ts +37 -0
  521. package/src/smartfox/pro/buddy/index.ts +65 -0
  522. package/src/smartfox/pro/catalogue/index.ts +141 -0
  523. package/src/smartfox/pro/claims/index.ts +110 -0
  524. package/src/smartfox/pro/codec/index.ts +87 -0
  525. package/src/smartfox/pro/counters/index.ts +3 -0
  526. package/src/smartfox/pro/counters/memory/index.ts +90 -0
  527. package/src/smartfox/pro/counters/offender/index.ts +47 -0
  528. package/src/smartfox/pro/counters/store/index.ts +17 -0
  529. package/src/smartfox/pro/entity/index.ts +111 -0
  530. package/src/smartfox/pro/escalation/index.ts +194 -0
  531. package/src/smartfox/pro/filter/index.ts +226 -0
  532. package/src/smartfox/pro/flood/index.ts +190 -0
  533. package/src/smartfox/pro/format/buddy/add/index.ts +2 -0
  534. package/src/smartfox/pro/format/buddy/add/notice/index.ts +44 -0
  535. package/src/smartfox/pro/format/buddy/add/request/index.ts +37 -0
  536. package/src/smartfox/pro/format/buddy/block/index.ts +44 -0
  537. package/src/smartfox/pro/format/buddy/clear/index.ts +37 -0
  538. package/src/smartfox/pro/format/buddy/index.ts +13 -0
  539. package/src/smartfox/pro/format/buddy/list/index.ts +59 -0
  540. package/src/smartfox/pro/format/buddy/load/index.ts +37 -0
  541. package/src/smartfox/pro/format/buddy/permission/index.ts +2 -0
  542. package/src/smartfox/pro/format/buddy/permission/notice/index.ts +43 -0
  543. package/src/smartfox/pro/format/buddy/permission/request/index.ts +48 -0
  544. package/src/smartfox/pro/format/buddy/remove/index.ts +2 -0
  545. package/src/smartfox/pro/format/buddy/remove/notice/index.ts +37 -0
  546. package/src/smartfox/pro/format/buddy/remove/request/index.ts +37 -0
  547. package/src/smartfox/pro/format/buddy/room/index.ts +2 -0
  548. package/src/smartfox/pro/format/buddy/room/reply/index.ts +50 -0
  549. package/src/smartfox/pro/format/buddy/room/request/index.ts +37 -0
  550. package/src/smartfox/pro/format/buddy/update/index.ts +54 -0
  551. package/src/smartfox/pro/format/buddy/variables/index.ts +48 -0
  552. package/src/smartfox/pro/format/chat/admin/index.ts +48 -0
  553. package/src/smartfox/pro/format/chat/index.ts +13 -0
  554. package/src/smartfox/pro/format/chat/moderator/index.ts +2 -0
  555. package/src/smartfox/pro/format/chat/moderator/message/index.ts +48 -0
  556. package/src/smartfox/pro/format/chat/moderator/request/index.ts +52 -0
  557. package/src/smartfox/pro/format/chat/private/index.ts +2 -0
  558. package/src/smartfox/pro/format/chat/private/message/index.ts +48 -0
  559. package/src/smartfox/pro/format/chat/private/request/index.ts +49 -0
  560. package/src/smartfox/pro/format/chat/public/index.ts +2 -0
  561. package/src/smartfox/pro/format/chat/public/message/index.ts +48 -0
  562. package/src/smartfox/pro/format/chat/public/request/index.ts +40 -0
  563. package/src/smartfox/pro/format/create/added/index.ts +76 -0
  564. package/src/smartfox/pro/format/create/deleted/index.ts +37 -0
  565. package/src/smartfox/pro/format/create/index.ts +4 -0
  566. package/src/smartfox/pro/format/create/refused/index.ts +37 -0
  567. package/src/smartfox/pro/format/create/request/index.ts +95 -0
  568. package/src/smartfox/pro/format/data/group/index.ts +62 -0
  569. package/src/smartfox/pro/format/data/index.ts +3 -0
  570. package/src/smartfox/pro/format/data/message/index.ts +54 -0
  571. package/src/smartfox/pro/format/data/request/index.ts +46 -0
  572. package/src/smartfox/pro/format/entry/buddy/index.ts +62 -0
  573. package/src/smartfox/pro/format/entry/index.ts +5 -0
  574. package/src/smartfox/pro/format/entry/object/index.ts +171 -0
  575. package/src/smartfox/pro/format/entry/room/index.ts +70 -0
  576. package/src/smartfox/pro/format/entry/user/index.ts +60 -0
  577. package/src/smartfox/pro/format/entry/variables/index.ts +148 -0
  578. package/src/smartfox/pro/format/extension/index.ts +3 -0
  579. package/src/smartfox/pro/format/extension/json/index.ts +99 -0
  580. package/src/smartfox/pro/format/extension/object/index.ts +95 -0
  581. package/src/smartfox/pro/format/extension/raw/index.ts +139 -0
  582. package/src/smartfox/pro/format/index.ts +86 -0
  583. package/src/smartfox/pro/format/join/accepted/index.ts +72 -0
  584. package/src/smartfox/pro/format/join/index.ts +3 -0
  585. package/src/smartfox/pro/format/join/refused/index.ts +37 -0
  586. package/src/smartfox/pro/format/join/request/index.ts +54 -0
  587. package/src/smartfox/pro/format/key/index.ts +2 -0
  588. package/src/smartfox/pro/format/key/reply/index.ts +37 -0
  589. package/src/smartfox/pro/format/key/request/index.ts +37 -0
  590. package/src/smartfox/pro/format/leave/index.ts +2 -0
  591. package/src/smartfox/pro/format/leave/notice/index.ts +41 -0
  592. package/src/smartfox/pro/format/leave/request/index.ts +41 -0
  593. package/src/smartfox/pro/format/login/accepted/index.ts +49 -0
  594. package/src/smartfox/pro/format/login/index.ts +3 -0
  595. package/src/smartfox/pro/format/login/refused/index.ts +37 -0
  596. package/src/smartfox/pro/format/login/request/index.ts +53 -0
  597. package/src/smartfox/pro/format/logout/index.ts +2 -0
  598. package/src/smartfox/pro/format/logout/notice/index.ts +37 -0
  599. package/src/smartfox/pro/format/logout/request/index.ts +37 -0
  600. package/src/smartfox/pro/format/ping/index.ts +2 -0
  601. package/src/smartfox/pro/format/ping/reply/index.ts +37 -0
  602. package/src/smartfox/pro/format/ping/request/index.ts +37 -0
  603. package/src/smartfox/pro/format/presence/count/index.ts +44 -0
  604. package/src/smartfox/pro/format/presence/entered/index.ts +47 -0
  605. package/src/smartfox/pro/format/presence/index.ts +3 -0
  606. package/src/smartfox/pro/format/presence/left/index.ts +44 -0
  607. package/src/smartfox/pro/format/rooms/auto/index.ts +37 -0
  608. package/src/smartfox/pro/format/rooms/index.ts +3 -0
  609. package/src/smartfox/pro/format/rooms/list/index.ts +54 -0
  610. package/src/smartfox/pro/format/rooms/request/index.ts +37 -0
  611. package/src/smartfox/pro/format/seat/index.ts +8 -0
  612. package/src/smartfox/pro/format/seat/player/index.ts +2 -0
  613. package/src/smartfox/pro/format/seat/player/notice/index.ts +49 -0
  614. package/src/smartfox/pro/format/seat/player/request/index.ts +37 -0
  615. package/src/smartfox/pro/format/seat/spectator/index.ts +2 -0
  616. package/src/smartfox/pro/format/seat/spectator/notice/index.ts +49 -0
  617. package/src/smartfox/pro/format/seat/spectator/request/index.ts +38 -0
  618. package/src/smartfox/pro/format/system/index.ts +19 -0
  619. package/src/smartfox/pro/format/variables/index.ts +8 -0
  620. package/src/smartfox/pro/format/variables/room/index.ts +2 -0
  621. package/src/smartfox/pro/format/variables/room/request/index.ts +50 -0
  622. package/src/smartfox/pro/format/variables/room/update/index.ts +52 -0
  623. package/src/smartfox/pro/format/variables/user/index.ts +2 -0
  624. package/src/smartfox/pro/format/variables/user/request/index.ts +47 -0
  625. package/src/smartfox/pro/format/variables/user/update/index.ts +52 -0
  626. package/src/smartfox/pro/format/version/accepted/index.ts +37 -0
  627. package/src/smartfox/pro/format/version/index.ts +3 -0
  628. package/src/smartfox/pro/format/version/refused/index.ts +37 -0
  629. package/src/smartfox/pro/format/version/request/index.ts +37 -0
  630. package/src/smartfox/pro/handler/buddy/index.ts +138 -0
  631. package/src/smartfox/pro/handler/chat/index.ts +221 -0
  632. package/src/smartfox/pro/handler/index.ts +7 -0
  633. package/src/smartfox/pro/handler/login/index.ts +175 -0
  634. package/src/smartfox/pro/handler/room/index.ts +121 -0
  635. package/src/smartfox/pro/handler/seat/index.ts +75 -0
  636. package/src/smartfox/pro/handler/shared/index.ts +29 -0
  637. package/src/smartfox/pro/handler/variable/index.ts +77 -0
  638. package/src/smartfox/pro/index.ts +60 -0
  639. package/src/smartfox/pro/login/attempt/index.ts +83 -0
  640. package/src/smartfox/pro/login/authenticator/index.ts +9 -0
  641. package/src/smartfox/pro/login/index.ts +3 -0
  642. package/src/smartfox/pro/login/verdict/index.ts +48 -0
  643. package/src/smartfox/pro/messages/index.ts +136 -0
  644. package/src/smartfox/pro/object/index.ts +12 -0
  645. package/src/smartfox/pro/options/index.ts +189 -0
  646. package/src/smartfox/pro/packet/buddy/add/index.ts +2 -0
  647. package/src/smartfox/pro/packet/buddy/add/notice/index.ts +27 -0
  648. package/src/smartfox/pro/packet/buddy/add/request/index.ts +25 -0
  649. package/src/smartfox/pro/packet/buddy/block/index.ts +33 -0
  650. package/src/smartfox/pro/packet/buddy/clear/index.ts +25 -0
  651. package/src/smartfox/pro/packet/buddy/index.ts +10 -0
  652. package/src/smartfox/pro/packet/buddy/list/index.ts +41 -0
  653. package/src/smartfox/pro/packet/buddy/load/index.ts +25 -0
  654. package/src/smartfox/pro/packet/buddy/permission/index.ts +2 -0
  655. package/src/smartfox/pro/packet/buddy/permission/notice/index.ts +33 -0
  656. package/src/smartfox/pro/packet/buddy/permission/request/index.ts +33 -0
  657. package/src/smartfox/pro/packet/buddy/remove/index.ts +2 -0
  658. package/src/smartfox/pro/packet/buddy/remove/notice/index.ts +25 -0
  659. package/src/smartfox/pro/packet/buddy/remove/request/index.ts +25 -0
  660. package/src/smartfox/pro/packet/buddy/room/index.ts +2 -0
  661. package/src/smartfox/pro/packet/buddy/room/reply/index.ts +25 -0
  662. package/src/smartfox/pro/packet/buddy/room/request/index.ts +25 -0
  663. package/src/smartfox/pro/packet/buddy/update/index.ts +35 -0
  664. package/src/smartfox/pro/packet/buddy/variables/index.ts +27 -0
  665. package/src/smartfox/pro/packet/chat/admin/index.ts +41 -0
  666. package/src/smartfox/pro/packet/chat/index.ts +5 -0
  667. package/src/smartfox/pro/packet/chat/moderator/index.ts +3 -0
  668. package/src/smartfox/pro/packet/chat/moderator/message/index.ts +41 -0
  669. package/src/smartfox/pro/packet/chat/moderator/request/index.ts +64 -0
  670. package/src/smartfox/pro/packet/chat/private/index.ts +2 -0
  671. package/src/smartfox/pro/packet/chat/private/message/index.ts +41 -0
  672. package/src/smartfox/pro/packet/chat/private/request/index.ts +45 -0
  673. package/src/smartfox/pro/packet/chat/public/index.ts +2 -0
  674. package/src/smartfox/pro/packet/chat/public/message/index.ts +41 -0
  675. package/src/smartfox/pro/packet/chat/public/request/index.ts +33 -0
  676. package/src/smartfox/pro/packet/create/added/index.ts +27 -0
  677. package/src/smartfox/pro/packet/create/deleted/index.ts +25 -0
  678. package/src/smartfox/pro/packet/create/index.ts +5 -0
  679. package/src/smartfox/pro/packet/create/refused/index.ts +25 -0
  680. package/src/smartfox/pro/packet/create/request/index.ts +105 -0
  681. package/src/smartfox/pro/packet/data/group/index.ts +51 -0
  682. package/src/smartfox/pro/packet/data/index.ts +3 -0
  683. package/src/smartfox/pro/packet/data/message/index.ts +43 -0
  684. package/src/smartfox/pro/packet/data/request/index.ts +35 -0
  685. package/src/smartfox/pro/packet/extension/index.ts +3 -0
  686. package/src/smartfox/pro/packet/extension/json/index.ts +2 -0
  687. package/src/smartfox/pro/packet/extension/json/reply/index.ts +33 -0
  688. package/src/smartfox/pro/packet/extension/json/request/index.ts +66 -0
  689. package/src/smartfox/pro/packet/extension/object/index.ts +2 -0
  690. package/src/smartfox/pro/packet/extension/object/reply/index.ts +35 -0
  691. package/src/smartfox/pro/packet/extension/object/request/index.ts +68 -0
  692. package/src/smartfox/pro/packet/extension/raw/index.ts +2 -0
  693. package/src/smartfox/pro/packet/extension/raw/reply/index.ts +25 -0
  694. package/src/smartfox/pro/packet/extension/raw/request/index.ts +66 -0
  695. package/src/smartfox/pro/packet/frame/index.ts +2 -0
  696. package/src/smartfox/pro/packet/frame/policy/file/index.ts +25 -0
  697. package/src/smartfox/pro/packet/frame/policy/index.ts +2 -0
  698. package/src/smartfox/pro/packet/frame/policy/request/index.ts +25 -0
  699. package/src/smartfox/pro/packet/frame/unknown/index.ts +25 -0
  700. package/src/smartfox/pro/packet/index.ts +72 -0
  701. package/src/smartfox/pro/packet/join/accepted/index.ts +74 -0
  702. package/src/smartfox/pro/packet/join/index.ts +3 -0
  703. package/src/smartfox/pro/packet/join/refused/index.ts +25 -0
  704. package/src/smartfox/pro/packet/join/request/index.ts +79 -0
  705. package/src/smartfox/pro/packet/key/index.ts +2 -0
  706. package/src/smartfox/pro/packet/key/reply/index.ts +25 -0
  707. package/src/smartfox/pro/packet/key/request/index.ts +25 -0
  708. package/src/smartfox/pro/packet/leave/index.ts +2 -0
  709. package/src/smartfox/pro/packet/leave/notice/index.ts +25 -0
  710. package/src/smartfox/pro/packet/leave/request/index.ts +25 -0
  711. package/src/smartfox/pro/packet/login/accepted/index.ts +45 -0
  712. package/src/smartfox/pro/packet/login/index.ts +3 -0
  713. package/src/smartfox/pro/packet/login/refused/index.ts +25 -0
  714. package/src/smartfox/pro/packet/login/request/index.ts +41 -0
  715. package/src/smartfox/pro/packet/logout/index.ts +2 -0
  716. package/src/smartfox/pro/packet/logout/notice/index.ts +25 -0
  717. package/src/smartfox/pro/packet/logout/request/index.ts +25 -0
  718. package/src/smartfox/pro/packet/ping/index.ts +2 -0
  719. package/src/smartfox/pro/packet/ping/reply/index.ts +25 -0
  720. package/src/smartfox/pro/packet/ping/request/index.ts +25 -0
  721. package/src/smartfox/pro/packet/presence/count/index.ts +41 -0
  722. package/src/smartfox/pro/packet/presence/entered/index.ts +35 -0
  723. package/src/smartfox/pro/packet/presence/index.ts +3 -0
  724. package/src/smartfox/pro/packet/presence/left/index.ts +33 -0
  725. package/src/smartfox/pro/packet/rooms/auto/index.ts +25 -0
  726. package/src/smartfox/pro/packet/rooms/index.ts +3 -0
  727. package/src/smartfox/pro/packet/rooms/list/index.ts +27 -0
  728. package/src/smartfox/pro/packet/rooms/request/index.ts +25 -0
  729. package/src/smartfox/pro/packet/seat/index.ts +2 -0
  730. package/src/smartfox/pro/packet/seat/player/index.ts +2 -0
  731. package/src/smartfox/pro/packet/seat/player/notice/index.ts +45 -0
  732. package/src/smartfox/pro/packet/seat/player/request/index.ts +25 -0
  733. package/src/smartfox/pro/packet/seat/spectator/index.ts +2 -0
  734. package/src/smartfox/pro/packet/seat/spectator/notice/index.ts +45 -0
  735. package/src/smartfox/pro/packet/seat/spectator/request/index.ts +25 -0
  736. package/src/smartfox/pro/packet/variables/index.ts +2 -0
  737. package/src/smartfox/pro/packet/variables/room/index.ts +2 -0
  738. package/src/smartfox/pro/packet/variables/room/request/index.ts +51 -0
  739. package/src/smartfox/pro/packet/variables/room/update/index.ts +47 -0
  740. package/src/smartfox/pro/packet/variables/user/index.ts +2 -0
  741. package/src/smartfox/pro/packet/variables/user/request/index.ts +35 -0
  742. package/src/smartfox/pro/packet/variables/user/update/index.ts +47 -0
  743. package/src/smartfox/pro/packet/version/accepted/index.ts +25 -0
  744. package/src/smartfox/pro/packet/version/index.ts +3 -0
  745. package/src/smartfox/pro/packet/version/refused/index.ts +25 -0
  746. package/src/smartfox/pro/packet/version/request/index.ts +25 -0
  747. package/src/smartfox/pro/penalty/index.ts +65 -0
  748. package/src/smartfox/pro/protocol/index.ts +395 -0
  749. package/src/smartfox/pro/room/index.ts +155 -0
  750. package/src/smartfox/pro/route/index.ts +25 -0
  751. package/src/smartfox/pro/sequence/index.ts +35 -0
  752. package/src/smartfox/pro/user/index.ts +80 -0
  753. package/src/smartfox/pro/variable/index.ts +34 -0
  754. package/src/smartfox/pro/web/index.ts +155 -0
  755. package/src/smartfox/pro/xml/index.ts +2 -0
  756. package/src/smartfox/pro/xml/reader/index.ts +228 -0
  757. package/src/smartfox/pro/xml/templates/index.ts +169 -0
  758. package/src/smartfox/pro/xml/writer/index.ts +147 -0
  759. package/src/smartfox/pro/zone/index.ts +874 -0
  760. package/src/smartfox/pro/zones/index.ts +324 -0
  761. package/src/smartfox/x2/balancer/index.ts +193 -0
  762. package/src/smartfox/x2/ban/index.ts +4 -0
  763. package/src/smartfox/x2/ban/list/index.ts +136 -0
  764. package/src/smartfox/x2/ban/memory/index.ts +71 -0
  765. package/src/smartfox/x2/ban/record/index.ts +36 -0
  766. package/src/smartfox/x2/ban/store/index.ts +28 -0
  767. package/src/smartfox/x2/bluebox/gateway/index.ts +315 -0
  768. package/src/smartfox/x2/bluebox/index.ts +4 -0
  769. package/src/smartfox/x2/bluebox/session/index.ts +63 -0
  770. package/src/smartfox/x2/bluebox/transport/index.ts +125 -0
  771. package/src/smartfox/x2/buddies/index.ts +608 -0
  772. package/src/smartfox/x2/catalogue/index.ts +23 -0
  773. package/src/smartfox/x2/catalogue/requests/index.ts +91 -0
  774. package/src/smartfox/x2/catalogue/responses/index.ts +93 -0
  775. package/src/smartfox/x2/chat/index.ts +383 -0
  776. package/src/smartfox/x2/cipher/index.ts +88 -0
  777. package/src/smartfox/x2/codec/index.ts +201 -0
  778. package/src/smartfox/x2/config/index.ts +383 -0
  779. package/src/smartfox/x2/data/array/index.ts +467 -0
  780. package/src/smartfox/x2/data/entry/index.ts +35 -0
  781. package/src/smartfox/x2/data/index.ts +6 -0
  782. package/src/smartfox/x2/data/object/index.ts +597 -0
  783. package/src/smartfox/x2/data/serializer/index.ts +393 -0
  784. package/src/smartfox/x2/data/type/index.ts +94 -0
  785. package/src/smartfox/x2/entity/buddy/index.ts +114 -0
  786. package/src/smartfox/x2/entity/index.ts +38 -0
  787. package/src/smartfox/x2/entity/invitation/index.ts +90 -0
  788. package/src/smartfox/x2/entity/item/index.ts +74 -0
  789. package/src/smartfox/x2/entity/match/index.ts +269 -0
  790. package/src/smartfox/x2/entity/privilege/index.ts +26 -0
  791. package/src/smartfox/x2/entity/room/index.ts +334 -0
  792. package/src/smartfox/x2/entity/settings/index.ts +239 -0
  793. package/src/smartfox/x2/entity/user/index.ts +118 -0
  794. package/src/smartfox/x2/entity/variable/buddy/index.ts +114 -0
  795. package/src/smartfox/x2/entity/variable/index.ts +16 -0
  796. package/src/smartfox/x2/entity/variable/item/index.ts +114 -0
  797. package/src/smartfox/x2/entity/variable/room/index.ts +153 -0
  798. package/src/smartfox/x2/entity/variable/type/index.ts +166 -0
  799. package/src/smartfox/x2/entity/variable/user/index.ts +134 -0
  800. package/src/smartfox/x2/entity/vector/index.ts +127 -0
  801. package/src/smartfox/x2/flood/gate/index.ts +78 -0
  802. package/src/smartfox/x2/flood/index.ts +162 -0
  803. package/src/smartfox/x2/flood/shared/index.ts +113 -0
  804. package/src/smartfox/x2/format/buddy/add/index.ts +2 -0
  805. package/src/smartfox/x2/format/buddy/add/request/index.ts +42 -0
  806. package/src/smartfox/x2/format/buddy/add/response/index.ts +55 -0
  807. package/src/smartfox/x2/format/buddy/block/index.ts +2 -0
  808. package/src/smartfox/x2/format/buddy/block/request/index.ts +45 -0
  809. package/src/smartfox/x2/format/buddy/block/response/index.ts +60 -0
  810. package/src/smartfox/x2/format/buddy/index.ts +21 -0
  811. package/src/smartfox/x2/format/buddy/init/index.ts +2 -0
  812. package/src/smartfox/x2/format/buddy/init/request/index.ts +38 -0
  813. package/src/smartfox/x2/format/buddy/init/response/index.ts +92 -0
  814. package/src/smartfox/x2/format/buddy/online/index.ts +2 -0
  815. package/src/smartfox/x2/format/buddy/online/request/index.ts +42 -0
  816. package/src/smartfox/x2/format/buddy/online/response/index.ts +61 -0
  817. package/src/smartfox/x2/format/buddy/remove/index.ts +2 -0
  818. package/src/smartfox/x2/format/buddy/remove/request/index.ts +42 -0
  819. package/src/smartfox/x2/format/buddy/remove/response/index.ts +51 -0
  820. package/src/smartfox/x2/format/buddy/variables/index.ts +2 -0
  821. package/src/smartfox/x2/format/buddy/variables/request/index.ts +46 -0
  822. package/src/smartfox/x2/format/buddy/variables/response/index.ts +58 -0
  823. package/src/smartfox/x2/format/cluster/connection/index.ts +1 -0
  824. package/src/smartfox/x2/format/cluster/connection/response/index.ts +52 -0
  825. package/src/smartfox/x2/format/cluster/error/index.ts +1 -0
  826. package/src/smartfox/x2/format/cluster/error/response/index.ts +38 -0
  827. package/src/smartfox/x2/format/cluster/index.ts +4 -0
  828. package/src/smartfox/x2/format/cluster/invite/index.ts +1 -0
  829. package/src/smartfox/x2/format/cluster/invite/request/index.ts +55 -0
  830. package/src/smartfox/x2/format/cluster/join/index.ts +1 -0
  831. package/src/smartfox/x2/format/cluster/join/request/index.ts +107 -0
  832. package/src/smartfox/x2/format/contract/index.ts +37 -0
  833. package/src/smartfox/x2/format/disconnect/index.ts +1 -0
  834. package/src/smartfox/x2/format/disconnect/request/index.ts +39 -0
  835. package/src/smartfox/x2/format/event/count/index.ts +49 -0
  836. package/src/smartfox/x2/format/event/disconnection/index.ts +48 -0
  837. package/src/smartfox/x2/format/event/enter/index.ts +53 -0
  838. package/src/smartfox/x2/format/event/exit/index.ts +45 -0
  839. package/src/smartfox/x2/format/event/index.ts +7 -0
  840. package/src/smartfox/x2/format/event/item/index.ts +51 -0
  841. package/src/smartfox/x2/format/event/lost/index.ts +2 -0
  842. package/src/smartfox/x2/format/event/lost/room/index.ts +42 -0
  843. package/src/smartfox/x2/format/event/lost/user/index.ts +42 -0
  844. package/src/smartfox/x2/format/event/reconnection/index.ts +39 -0
  845. package/src/smartfox/x2/format/extension/index.ts +2 -0
  846. package/src/smartfox/x2/format/extension/request/index.ts +49 -0
  847. package/src/smartfox/x2/format/extension/response/index.ts +47 -0
  848. package/src/smartfox/x2/format/find/index.ts +8 -0
  849. package/src/smartfox/x2/format/find/rooms/index.ts +2 -0
  850. package/src/smartfox/x2/format/find/rooms/request/index.ts +51 -0
  851. package/src/smartfox/x2/format/find/rooms/response/index.ts +74 -0
  852. package/src/smartfox/x2/format/find/users/index.ts +2 -0
  853. package/src/smartfox/x2/format/find/users/request/index.ts +54 -0
  854. package/src/smartfox/x2/format/find/users/response/index.ts +74 -0
  855. package/src/smartfox/x2/format/game/create/index.ts +1 -0
  856. package/src/smartfox/x2/format/game/create/request/index.ts +61 -0
  857. package/src/smartfox/x2/format/game/index.ts +14 -0
  858. package/src/smartfox/x2/format/game/invite/index.ts +2 -0
  859. package/src/smartfox/x2/format/game/invite/request/index.ts +50 -0
  860. package/src/smartfox/x2/format/game/invite/response/index.ts +61 -0
  861. package/src/smartfox/x2/format/game/join/index.ts +1 -0
  862. package/src/smartfox/x2/format/game/join/request/index.ts +55 -0
  863. package/src/smartfox/x2/format/game/quick/index.ts +2 -0
  864. package/src/smartfox/x2/format/game/quick/request/index.ts +56 -0
  865. package/src/smartfox/x2/format/game/quick/response/index.ts +48 -0
  866. package/src/smartfox/x2/format/game/reply/index.ts +2 -0
  867. package/src/smartfox/x2/format/game/reply/request/index.ts +50 -0
  868. package/src/smartfox/x2/format/game/reply/response/index.ts +70 -0
  869. package/src/smartfox/x2/format/group/index.ts +8 -0
  870. package/src/smartfox/x2/format/group/subscribe/index.ts +2 -0
  871. package/src/smartfox/x2/format/group/subscribe/request/index.ts +43 -0
  872. package/src/smartfox/x2/format/group/subscribe/response/index.ts +89 -0
  873. package/src/smartfox/x2/format/group/unsubscribe/index.ts +2 -0
  874. package/src/smartfox/x2/format/group/unsubscribe/request/index.ts +43 -0
  875. package/src/smartfox/x2/format/group/unsubscribe/response/index.ts +52 -0
  876. package/src/smartfox/x2/format/handshake/index.ts +2 -0
  877. package/src/smartfox/x2/format/handshake/request/index.ts +52 -0
  878. package/src/smartfox/x2/format/handshake/response/index.ts +62 -0
  879. package/src/smartfox/x2/format/index.ts +105 -0
  880. package/src/smartfox/x2/format/login/index.ts +2 -0
  881. package/src/smartfox/x2/format/login/request/index.ts +52 -0
  882. package/src/smartfox/x2/format/login/response/index.ts +99 -0
  883. package/src/smartfox/x2/format/logout/index.ts +2 -0
  884. package/src/smartfox/x2/format/logout/request/index.ts +38 -0
  885. package/src/smartfox/x2/format/logout/response/index.ts +42 -0
  886. package/src/smartfox/x2/format/message/index.ts +2 -0
  887. package/src/smartfox/x2/format/message/request/index.ts +126 -0
  888. package/src/smartfox/x2/format/message/response/index.ts +68 -0
  889. package/src/smartfox/x2/format/mmo/index.ts +4 -0
  890. package/src/smartfox/x2/format/mmo/position/index.ts +2 -0
  891. package/src/smartfox/x2/format/mmo/position/request/index.ts +49 -0
  892. package/src/smartfox/x2/format/mmo/position/response/index.ts +107 -0
  893. package/src/smartfox/x2/format/moderation/ban/index.ts +1 -0
  894. package/src/smartfox/x2/format/moderation/ban/request/index.ts +57 -0
  895. package/src/smartfox/x2/format/moderation/index.ts +2 -0
  896. package/src/smartfox/x2/format/moderation/kick/index.ts +1 -0
  897. package/src/smartfox/x2/format/moderation/kick/request/index.ts +48 -0
  898. package/src/smartfox/x2/format/ping/index.ts +2 -0
  899. package/src/smartfox/x2/format/ping/request/index.ts +38 -0
  900. package/src/smartfox/x2/format/ping/response/index.ts +38 -0
  901. package/src/smartfox/x2/format/room/capacity/index.ts +2 -0
  902. package/src/smartfox/x2/format/room/capacity/request/index.ts +50 -0
  903. package/src/smartfox/x2/format/room/capacity/response/index.ts +59 -0
  904. package/src/smartfox/x2/format/room/create/index.ts +2 -0
  905. package/src/smartfox/x2/format/room/create/request/index.ts +55 -0
  906. package/src/smartfox/x2/format/room/create/response/index.ts +55 -0
  907. package/src/smartfox/x2/format/room/index.ts +23 -0
  908. package/src/smartfox/x2/format/room/join/index.ts +2 -0
  909. package/src/smartfox/x2/format/room/join/request/index.ts +53 -0
  910. package/src/smartfox/x2/format/room/join/response/index.ts +84 -0
  911. package/src/smartfox/x2/format/room/leave/index.ts +1 -0
  912. package/src/smartfox/x2/format/room/leave/request/index.ts +42 -0
  913. package/src/smartfox/x2/format/room/password/index.ts +2 -0
  914. package/src/smartfox/x2/format/room/password/request/index.ts +46 -0
  915. package/src/smartfox/x2/format/room/password/response/index.ts +55 -0
  916. package/src/smartfox/x2/format/room/quick/index.ts +1 -0
  917. package/src/smartfox/x2/format/room/quick/request/index.ts +68 -0
  918. package/src/smartfox/x2/format/room/rename/index.ts +2 -0
  919. package/src/smartfox/x2/format/room/rename/request/index.ts +46 -0
  920. package/src/smartfox/x2/format/room/rename/response/index.ts +55 -0
  921. package/src/smartfox/x2/format/room/variables/index.ts +2 -0
  922. package/src/smartfox/x2/format/room/variables/request/index.ts +49 -0
  923. package/src/smartfox/x2/format/room/variables/response/index.ts +49 -0
  924. package/src/smartfox/x2/format/seat/index.ts +8 -0
  925. package/src/smartfox/x2/format/seat/player/index.ts +2 -0
  926. package/src/smartfox/x2/format/seat/player/request/index.ts +43 -0
  927. package/src/smartfox/x2/format/seat/player/response/index.ts +59 -0
  928. package/src/smartfox/x2/format/seat/spectator/index.ts +2 -0
  929. package/src/smartfox/x2/format/seat/spectator/request/index.ts +43 -0
  930. package/src/smartfox/x2/format/seat/spectator/response/index.ts +55 -0
  931. package/src/smartfox/x2/format/settings/index.ts +276 -0
  932. package/src/smartfox/x2/format/user/index.ts +4 -0
  933. package/src/smartfox/x2/format/user/variables/index.ts +2 -0
  934. package/src/smartfox/x2/format/user/variables/request/index.ts +46 -0
  935. package/src/smartfox/x2/format/user/variables/response/index.ts +49 -0
  936. package/src/smartfox/x2/games/index.ts +484 -0
  937. package/src/smartfox/x2/hall/index.ts +240 -0
  938. package/src/smartfox/x2/handler/buddy/index.ts +120 -0
  939. package/src/smartfox/x2/handler/chat/index.ts +213 -0
  940. package/src/smartfox/x2/handler/extension/index.ts +33 -0
  941. package/src/smartfox/x2/handler/game/index.ts +171 -0
  942. package/src/smartfox/x2/handler/index.ts +6 -0
  943. package/src/smartfox/x2/handler/room/index.ts +466 -0
  944. package/src/smartfox/x2/handler/session/index.ts +201 -0
  945. package/src/smartfox/x2/header/index.ts +25 -0
  946. package/src/smartfox/x2/index.ts +275 -0
  947. package/src/smartfox/x2/login/attempt/index.ts +102 -0
  948. package/src/smartfox/x2/login/index.ts +2 -0
  949. package/src/smartfox/x2/login/verdict/index.ts +81 -0
  950. package/src/smartfox/x2/member/index.ts +260 -0
  951. package/src/smartfox/x2/packet/buddy/add/index.ts +2 -0
  952. package/src/smartfox/x2/packet/buddy/add/request/index.ts +25 -0
  953. package/src/smartfox/x2/packet/buddy/add/response/index.ts +43 -0
  954. package/src/smartfox/x2/packet/buddy/block/index.ts +2 -0
  955. package/src/smartfox/x2/packet/buddy/block/request/index.ts +33 -0
  956. package/src/smartfox/x2/packet/buddy/block/response/index.ts +68 -0
  957. package/src/smartfox/x2/packet/buddy/index.ts +13 -0
  958. package/src/smartfox/x2/packet/buddy/init/index.ts +2 -0
  959. package/src/smartfox/x2/packet/buddy/init/request/index.ts +14 -0
  960. package/src/smartfox/x2/packet/buddy/init/response/index.ts +69 -0
  961. package/src/smartfox/x2/packet/buddy/online/index.ts +2 -0
  962. package/src/smartfox/x2/packet/buddy/online/request/index.ts +25 -0
  963. package/src/smartfox/x2/packet/buddy/online/response/index.ts +85 -0
  964. package/src/smartfox/x2/packet/buddy/remove/index.ts +2 -0
  965. package/src/smartfox/x2/packet/buddy/remove/request/index.ts +25 -0
  966. package/src/smartfox/x2/packet/buddy/remove/response/index.ts +42 -0
  967. package/src/smartfox/x2/packet/buddy/variables/index.ts +2 -0
  968. package/src/smartfox/x2/packet/buddy/variables/request/index.ts +29 -0
  969. package/src/smartfox/x2/packet/buddy/variables/response/index.ts +58 -0
  970. package/src/smartfox/x2/packet/cluster/connection/index.ts +1 -0
  971. package/src/smartfox/x2/packet/cluster/connection/response/index.ts +54 -0
  972. package/src/smartfox/x2/packet/cluster/error/index.ts +1 -0
  973. package/src/smartfox/x2/packet/cluster/error/response/index.ts +14 -0
  974. package/src/smartfox/x2/packet/cluster/index.ts +4 -0
  975. package/src/smartfox/x2/packet/cluster/invite/index.ts +1 -0
  976. package/src/smartfox/x2/packet/cluster/invite/request/index.ts +77 -0
  977. package/src/smartfox/x2/packet/cluster/join/index.ts +1 -0
  978. package/src/smartfox/x2/packet/cluster/join/request/index.ts +52 -0
  979. package/src/smartfox/x2/packet/disconnect/index.ts +1 -0
  980. package/src/smartfox/x2/packet/disconnect/request/index.ts +14 -0
  981. package/src/smartfox/x2/packet/error/codes/index.ts +231 -0
  982. package/src/smartfox/x2/packet/error/index.ts +69 -0
  983. package/src/smartfox/x2/packet/event/count/index.ts +45 -0
  984. package/src/smartfox/x2/packet/event/disconnection/index.ts +72 -0
  985. package/src/smartfox/x2/packet/event/enter/index.ts +47 -0
  986. package/src/smartfox/x2/packet/event/exit/index.ts +33 -0
  987. package/src/smartfox/x2/packet/event/index.ts +10 -0
  988. package/src/smartfox/x2/packet/event/item/index.ts +51 -0
  989. package/src/smartfox/x2/packet/event/lost/index.ts +2 -0
  990. package/src/smartfox/x2/packet/event/lost/room/index.ts +25 -0
  991. package/src/smartfox/x2/packet/event/lost/user/index.ts +25 -0
  992. package/src/smartfox/x2/packet/event/reconnection/index.ts +14 -0
  993. package/src/smartfox/x2/packet/extension/index.ts +2 -0
  994. package/src/smartfox/x2/packet/extension/request/index.ts +74 -0
  995. package/src/smartfox/x2/packet/extension/response/index.ts +54 -0
  996. package/src/smartfox/x2/packet/find/index.ts +2 -0
  997. package/src/smartfox/x2/packet/find/rooms/index.ts +2 -0
  998. package/src/smartfox/x2/packet/find/rooms/request/index.ts +51 -0
  999. package/src/smartfox/x2/packet/find/rooms/response/index.ts +27 -0
  1000. package/src/smartfox/x2/packet/find/users/index.ts +2 -0
  1001. package/src/smartfox/x2/packet/find/users/request/index.ts +89 -0
  1002. package/src/smartfox/x2/packet/find/users/response/index.ts +27 -0
  1003. package/src/smartfox/x2/packet/game/create/index.ts +1 -0
  1004. package/src/smartfox/x2/packet/game/create/request/index.ts +27 -0
  1005. package/src/smartfox/x2/packet/game/index.ts +8 -0
  1006. package/src/smartfox/x2/packet/game/invite/index.ts +2 -0
  1007. package/src/smartfox/x2/packet/game/invite/request/index.ts +51 -0
  1008. package/src/smartfox/x2/packet/game/invite/response/index.ts +92 -0
  1009. package/src/smartfox/x2/packet/game/join/index.ts +1 -0
  1010. package/src/smartfox/x2/packet/game/join/request/index.ts +77 -0
  1011. package/src/smartfox/x2/packet/game/quick/index.ts +2 -0
  1012. package/src/smartfox/x2/packet/game/quick/request/index.ts +89 -0
  1013. package/src/smartfox/x2/packet/game/quick/response/index.ts +34 -0
  1014. package/src/smartfox/x2/packet/game/reply/index.ts +2 -0
  1015. package/src/smartfox/x2/packet/game/reply/request/index.ts +51 -0
  1016. package/src/smartfox/x2/packet/game/reply/response/index.ts +91 -0
  1017. package/src/smartfox/x2/packet/group/index.ts +8 -0
  1018. package/src/smartfox/x2/packet/group/subscribe/index.ts +2 -0
  1019. package/src/smartfox/x2/packet/group/subscribe/request/index.ts +25 -0
  1020. package/src/smartfox/x2/packet/group/subscribe/response/index.ts +58 -0
  1021. package/src/smartfox/x2/packet/group/unsubscribe/index.ts +2 -0
  1022. package/src/smartfox/x2/packet/group/unsubscribe/request/index.ts +25 -0
  1023. package/src/smartfox/x2/packet/group/unsubscribe/response/index.ts +42 -0
  1024. package/src/smartfox/x2/packet/handshake/index.ts +2 -0
  1025. package/src/smartfox/x2/packet/handshake/request/index.ts +49 -0
  1026. package/src/smartfox/x2/packet/handshake/response/index.ts +83 -0
  1027. package/src/smartfox/x2/packet/index.ts +99 -0
  1028. package/src/smartfox/x2/packet/login/index.ts +2 -0
  1029. package/src/smartfox/x2/packet/login/request/index.ts +95 -0
  1030. package/src/smartfox/x2/packet/login/response/index.ts +131 -0
  1031. package/src/smartfox/x2/packet/logout/index.ts +2 -0
  1032. package/src/smartfox/x2/packet/logout/request/index.ts +14 -0
  1033. package/src/smartfox/x2/packet/logout/response/index.ts +25 -0
  1034. package/src/smartfox/x2/packet/message/index.ts +4 -0
  1035. package/src/smartfox/x2/packet/message/request/index.ts +241 -0
  1036. package/src/smartfox/x2/packet/message/response/index.ts +216 -0
  1037. package/src/smartfox/x2/packet/message/type/index.ts +56 -0
  1038. package/src/smartfox/x2/packet/mmo/index.ts +5 -0
  1039. package/src/smartfox/x2/packet/mmo/position/index.ts +3 -0
  1040. package/src/smartfox/x2/packet/mmo/position/request/index.ts +38 -0
  1041. package/src/smartfox/x2/packet/mmo/position/response/index.ts +114 -0
  1042. package/src/smartfox/x2/packet/moderation/ban/index.ts +1 -0
  1043. package/src/smartfox/x2/packet/moderation/ban/request/index.ts +83 -0
  1044. package/src/smartfox/x2/packet/moderation/index.ts +2 -0
  1045. package/src/smartfox/x2/packet/moderation/kick/index.ts +1 -0
  1046. package/src/smartfox/x2/packet/moderation/kick/request/index.ts +45 -0
  1047. package/src/smartfox/x2/packet/ping/index.ts +2 -0
  1048. package/src/smartfox/x2/packet/ping/request/index.ts +14 -0
  1049. package/src/smartfox/x2/packet/ping/response/index.ts +14 -0
  1050. package/src/smartfox/x2/packet/room/capacity/index.ts +2 -0
  1051. package/src/smartfox/x2/packet/room/capacity/request/index.ts +45 -0
  1052. package/src/smartfox/x2/packet/room/capacity/response/index.ts +67 -0
  1053. package/src/smartfox/x2/packet/room/create/index.ts +2 -0
  1054. package/src/smartfox/x2/packet/room/create/request/index.ts +51 -0
  1055. package/src/smartfox/x2/packet/room/create/response/index.ts +43 -0
  1056. package/src/smartfox/x2/packet/room/index.ts +21 -0
  1057. package/src/smartfox/x2/packet/room/join/index.ts +3 -0
  1058. package/src/smartfox/x2/packet/room/join/request/index.ts +101 -0
  1059. package/src/smartfox/x2/packet/room/join/response/index.ts +74 -0
  1060. package/src/smartfox/x2/packet/room/leave/index.ts +1 -0
  1061. package/src/smartfox/x2/packet/room/leave/request/index.ts +25 -0
  1062. package/src/smartfox/x2/packet/room/password/index.ts +2 -0
  1063. package/src/smartfox/x2/packet/room/password/request/index.ts +33 -0
  1064. package/src/smartfox/x2/packet/room/password/response/index.ts +57 -0
  1065. package/src/smartfox/x2/packet/room/quick/index.ts +1 -0
  1066. package/src/smartfox/x2/packet/room/quick/request/index.ts +67 -0
  1067. package/src/smartfox/x2/packet/room/rename/index.ts +2 -0
  1068. package/src/smartfox/x2/packet/room/rename/request/index.ts +33 -0
  1069. package/src/smartfox/x2/packet/room/rename/response/index.ts +50 -0
  1070. package/src/smartfox/x2/packet/room/variables/index.ts +2 -0
  1071. package/src/smartfox/x2/packet/room/variables/request/index.ts +38 -0
  1072. package/src/smartfox/x2/packet/room/variables/response/index.ts +38 -0
  1073. package/src/smartfox/x2/packet/seat/index.ts +8 -0
  1074. package/src/smartfox/x2/packet/seat/player/index.ts +2 -0
  1075. package/src/smartfox/x2/packet/seat/player/request/index.ts +25 -0
  1076. package/src/smartfox/x2/packet/seat/player/response/index.ts +67 -0
  1077. package/src/smartfox/x2/packet/seat/spectator/index.ts +2 -0
  1078. package/src/smartfox/x2/packet/seat/spectator/request/index.ts +25 -0
  1079. package/src/smartfox/x2/packet/seat/spectator/response/index.ts +50 -0
  1080. package/src/smartfox/x2/packet/unknown/index.ts +47 -0
  1081. package/src/smartfox/x2/packet/user/index.ts +4 -0
  1082. package/src/smartfox/x2/packet/user/variables/index.ts +2 -0
  1083. package/src/smartfox/x2/packet/user/variables/request/index.ts +29 -0
  1084. package/src/smartfox/x2/packet/user/variables/response/index.ts +38 -0
  1085. package/src/smartfox/x2/protocol/index.ts +495 -0
  1086. package/src/smartfox/x2/proximity/index.ts +353 -0
  1087. package/src/smartfox/x2/rooms/index.ts +981 -0
  1088. package/src/smartfox/x2/roster/index.ts +3 -0
  1089. package/src/smartfox/x2/roster/memory/index.ts +41 -0
  1090. package/src/smartfox/x2/roster/record/index.ts +31 -0
  1091. package/src/smartfox/x2/roster/store/index.ts +21 -0
  1092. package/src/smartfox/x2/route/index.ts +17 -0
  1093. package/src/smartfox/x2/sessions/index.ts +18 -0
  1094. package/src/smartfox/x2/udp/index.ts +392 -0
  1095. package/src/smartfox/x2/web/index.ts +183 -0
  1096. package/src/smartfox/x2/websocket/index.ts +119 -0
  1097. package/src/smartfox/x2/words/index.ts +265 -0
  1098. package/src/smartfox/x2/zone/index.ts +1163 -0
  1099. package/src/smartfox/x2/zones/index.ts +608 -0
@@ -0,0 +1,221 @@
1
+ import { AttributeKey, type Channel } from '@netifyjs/netify'
2
+
3
+ import { CustomAuthenticationType } from '../../balancing/code/authentication/index.ts'
4
+ import { ErrorCode } from '../../balancing/code/error/index.ts'
5
+ import { ErrorMessage } from '../../balancing/code/message/index.ts'
6
+ import { Grant } from '../../balancing/entity/grant/index.ts'
7
+ import type { AuthenticateRequest } from '../../balancing/packet/authenticate/request/index.ts'
8
+ import { AuthenticateResponse } from '../../balancing/packet/authenticate/response/index.ts'
9
+ import { AuthEvent } from '../../balancing/packet/event/auth/index.ts'
10
+ import { PhotonValue } from '../../binary/value/index.ts'
11
+ import { ConnectionEncryption } from '../../crypto/connection/index.ts'
12
+ import { Refusal } from '../../crypto/refusal/index.ts'
13
+ import type { TokenAuthority } from '../../crypto/token/authority/index.ts'
14
+ import type { AuthToken } from '../../crypto/token/record/index.ts'
15
+ import { TokenVerdict } from '../../crypto/token/verdict/index.ts'
16
+ import type { InitRequest } from '../../message/init/request/index.ts'
17
+ import type { PhotonPeer } from '../../message/peer/index.ts'
18
+ import type { InitGate } from '../../message/server/index.ts'
19
+ import { Admission } from '../admission/index.ts'
20
+
21
+ /**
22
+ * A token pushed out before it runs out
23
+ */
24
+ export type Renewal = {
25
+ /**
26
+ * The token with its new expiry
27
+ */
28
+ readonly token: AuthToken
29
+
30
+ /**
31
+ * Event that carries it to the client
32
+ */
33
+ readonly event: AuthEvent
34
+ }
35
+
36
+ /**
37
+ * Checks the tokens clients bring to a Master or a Game Server
38
+ * @class
39
+ */
40
+ export class TokenGate {
41
+ /**
42
+ * Where a connection keeps the token of its init request
43
+ */
44
+ private static readonly key: AttributeKey<AuthToken> =
45
+ new AttributeKey<AuthToken>('netify:protocol:photon:authentication:token')
46
+
47
+ /**
48
+ * Reads the token of an init request for the message layer
49
+ */
50
+ public readonly init: InitGate
51
+
52
+ /**
53
+ * Issues and opens tokens, or null
54
+ */
55
+ private readonly authority: TokenAuthority | null
56
+
57
+ /**
58
+ * Whether the server also runs custom authentication
59
+ */
60
+ private readonly credentials: boolean
61
+
62
+ /**
63
+ * @param authority issues and opens tokens, or null
64
+ * @param credentials whether the server also runs custom authentication
65
+ */
66
+ public constructor(authority: TokenAuthority | null, credentials = false) {
67
+ this.authority = authority
68
+ this.credentials = credentials
69
+ this.init = (
70
+ init: InitRequest,
71
+ peer: PhotonPeer,
72
+ ): ConnectionEncryption | null => this.admit(init, peer)
73
+ }
74
+
75
+ /**
76
+ * The token a connection's init request brought, or null
77
+ * @param channel the connection
78
+ */
79
+ public static admitted(channel: Channel): AuthToken | null {
80
+ return channel.attributes.get<AuthToken>(TokenGate.key)
81
+ }
82
+
83
+ /**
84
+ * A token value as the text it was sealed to, or null
85
+ * @param value what the client sent, or null
86
+ */
87
+ private static text(value: PhotonValue | null): string | null {
88
+ if (value === null) return null
89
+
90
+ const raw = value.raw()
91
+ return raw === null ? value.text() : Buffer.from(raw).toString('base64')
92
+ }
93
+
94
+ /**
95
+ * Checks the token of an authenticate operation
96
+ * @param value what the client sent, or null
97
+ */
98
+ public verify(value: PhotonValue | null): TokenVerdict {
99
+ if (this.authority === null) {
100
+ return TokenVerdict.refused(Refusal.unreadableToken())
101
+ }
102
+
103
+ return this.authority.verify(TokenGate.text(value))
104
+ }
105
+
106
+ /**
107
+ * The text a client gets for a token, renewed
108
+ * @param token what to seal
109
+ */
110
+ public seal(token: AuthToken): string {
111
+ if (this.authority === null) throw new Error('Token keys are missing')
112
+
113
+ return this.authority.seal(token, true)
114
+ }
115
+
116
+ /**
117
+ * A renewed token for a client whose token runs out soon, or null
118
+ * @param token what the client holds
119
+ */
120
+ public renewal(token: AuthToken): Renewal | null {
121
+ const authority = this.authority
122
+ if (!authority?.stale(token)) return null
123
+
124
+ return this.renew(token)
125
+ }
126
+
127
+ /**
128
+ * A renewed token and the event that carries it
129
+ * @param token what the client holds
130
+ */
131
+ public renew(token: AuthToken): Renewal {
132
+ if (this.authority === null) throw new Error('Token keys are missing')
133
+
134
+ const renewed = this.authority.renew(token)
135
+ return {
136
+ token: renewed,
137
+ event: AuthEvent.of(
138
+ PhotonValue.string(this.authority.seal(renewed, false)),
139
+ ),
140
+ }
141
+ }
142
+
143
+ /**
144
+ * Answers an authenticate operation the way a Game Server does
145
+ * @param request what the client sent
146
+ * @param authenticated whether the connection is in already
147
+ */
148
+ public game(request: AuthenticateRequest, authenticated: boolean): Admission {
149
+ if (authenticated) {
150
+ return Admission.denied(
151
+ AuthenticateResponse.failure(
152
+ ErrorCode.OPERATION_DENIED,
153
+ ErrorMessage.ALREADY_AUTHENTICATED,
154
+ ).to(request),
155
+ )
156
+ }
157
+
158
+ const verdict =
159
+ this.credentials || this.tokened(request)
160
+ ? this.verify(request.token)
161
+ : TokenVerdict.refused(Refusal.tokenOnly())
162
+ if (verdict.token === null) {
163
+ return Admission.denied(
164
+ AuthenticateResponse.failure(
165
+ verdict.refusal?.code ?? ErrorCode.INVALID_AUTHENTICATION,
166
+ verdict.refusal?.message ?? null,
167
+ ).to(request),
168
+ )
169
+ }
170
+
171
+ return Admission.granted(
172
+ verdict.token,
173
+ AuthenticateResponse.success(Grant.game()).to(request),
174
+ )
175
+ }
176
+
177
+ /**
178
+ * Whether a request authenticates by token
179
+ * @param request what the client sent
180
+ */
181
+ public tokened(request: AuthenticateRequest): boolean {
182
+ const type = request.credentials?.authentication?.type ?? null
183
+ const text = TokenGate.text(request.token)
184
+
185
+ return (
186
+ type === CustomAuthenticationType.NONE || (text !== null && text !== '')
187
+ )
188
+ }
189
+
190
+ /**
191
+ * What the token of an init request sets up, or null
192
+ * @param init how the client introduced itself
193
+ * @param peer the connection
194
+ */
195
+ private admit(
196
+ init: InitRequest,
197
+ peer: PhotonPeer,
198
+ ): ConnectionEncryption | null {
199
+ const value = init.token
200
+ if (value === null) return null
201
+ if (value.text() === null && value.raw() === null) return null
202
+
203
+ if (this.authority === null) {
204
+ return ConnectionEncryption.refused(Refusal.unreadableToken())
205
+ }
206
+
207
+ const verdict = this.authority.admit(TokenGate.text(value))
208
+ if (verdict.token === null) {
209
+ return ConnectionEncryption.refused(
210
+ verdict.refusal ?? Refusal.unreadableToken(),
211
+ )
212
+ }
213
+
214
+ const encryption = peer.encryption(verdict.token.encryptionData)
215
+ if (encryption.refusal === null) {
216
+ peer.channel.attributes.set<AuthToken>(TokenGate.key, verdict.token)
217
+ }
218
+
219
+ return encryption
220
+ }
221
+ }
@@ -0,0 +1,337 @@
1
+ import {
2
+ ErrorMessage,
3
+ ErrorMessages,
4
+ } from '../../balancing/code/message/index.ts'
5
+ import { Kind } from '../../binary/kind/index.ts'
6
+ import type { PhotonValue } from '../../binary/value/index.ts'
7
+ import { JsonValues } from '../../message/json/values/index.ts'
8
+ import { AuthenticationFailure } from '../failure/index.ts'
9
+ import type {
10
+ AuthenticationAttempt,
11
+ AuthenticationProvider,
12
+ } from '../provider/index.ts'
13
+ import {
14
+ QueueStatus,
15
+ type QueueStatusName,
16
+ RequestQueue,
17
+ type RequestQueueOptions,
18
+ } from '../queue/index.ts'
19
+ import { AuthenticationResult } from '../result/index.ts'
20
+
21
+ /**
22
+ * Sends one HTTP request
23
+ */
24
+ export type HttpCall = (url: string, init: RequestInit) => Promise<Response>
25
+
26
+ /**
27
+ * How an authentication service is reached
28
+ */
29
+ export type HttpAuthenticationOptions = {
30
+ /**
31
+ * Address of the service
32
+ */
33
+ readonly url: string
34
+
35
+ /**
36
+ * Query pairs sent with every request
37
+ */
38
+ readonly pairs?: Readonly<Record<string, string>>
39
+
40
+ /**
41
+ * Whether an unreachable service turns players away, true by default
42
+ */
43
+ readonly rejectIfUnavailable?: boolean
44
+
45
+ /**
46
+ * Whether everything goes out as one JSON body, false by default
47
+ */
48
+ readonly forwardAsJson?: boolean
49
+
50
+ /**
51
+ * Longest wait for an answer in ms, 30000 by default
52
+ */
53
+ readonly timeout?: number
54
+
55
+ /**
56
+ * Limits of the request queue
57
+ */
58
+ readonly queue?: RequestQueueOptions
59
+
60
+ /**
61
+ * Sends the requests, fetch by default
62
+ */
63
+ readonly call?: HttpCall
64
+ }
65
+
66
+ /**
67
+ * A request ready to send
68
+ */
69
+ type Prepared = {
70
+ /**
71
+ * Address with its query string
72
+ */
73
+ readonly url: string
74
+
75
+ /**
76
+ * Method, headers and body
77
+ */
78
+ readonly init: RequestInit
79
+ }
80
+
81
+ /**
82
+ * Asks a web service whether a player may log in
83
+ * @class
84
+ */
85
+ export class HttpAuthenticationProvider implements AuthenticationProvider {
86
+ /**
87
+ * Address of the service
88
+ */
89
+ private readonly url: string
90
+
91
+ /**
92
+ * Query pairs sent with every request
93
+ */
94
+ private readonly pairs: ReadonlyMap<string, string>
95
+
96
+ /**
97
+ * Whether an unreachable service turns players away
98
+ */
99
+ private readonly rejectIfUnavailable: boolean
100
+
101
+ /**
102
+ * Whether everything goes out as one JSON body
103
+ */
104
+ private readonly forwardAsJson: boolean
105
+
106
+ /**
107
+ * Longest wait for an answer in ms
108
+ */
109
+ private readonly timeout: number
110
+
111
+ /**
112
+ * Limits how hard the service is hit
113
+ */
114
+ private readonly queue: RequestQueue
115
+
116
+ /**
117
+ * Sends the requests
118
+ */
119
+ private readonly call: HttpCall
120
+
121
+ /**
122
+ * @param options address, fixed pairs and limits
123
+ */
124
+ public constructor(options: HttpAuthenticationOptions) {
125
+ this.url = options.url
126
+ this.pairs = new Map<string, string>(
127
+ Object.entries<string>(options.pairs ?? {}),
128
+ )
129
+ this.rejectIfUnavailable = options.rejectIfUnavailable ?? true
130
+ this.forwardAsJson = options.forwardAsJson ?? false
131
+ this.timeout = options.timeout ?? 30_000
132
+ this.queue = new RequestQueue(options.queue)
133
+ this.call =
134
+ options.call ??
135
+ ((url: string, init: RequestInit): Promise<Response> => fetch(url, init))
136
+ }
137
+
138
+ /**
139
+ * Asks the service about one login
140
+ * @param attempt type, query string and body
141
+ */
142
+ public async authenticate(
143
+ attempt: AuthenticationAttempt,
144
+ ): Promise<AuthenticationResult> {
145
+ const request = this.forwardAsJson
146
+ ? this.merged(attempt)
147
+ : this.plain(attempt)
148
+
149
+ const status = await this.queue.enter()
150
+ if (status !== null) return this.unavailable(status)
151
+
152
+ let answer: Response
153
+ try {
154
+ answer = await this.call(request.url, {
155
+ ...request.init,
156
+ /**
157
+ * Cuts a slow service off
158
+ */
159
+ signal: AbortSignal.timeout(this.timeout),
160
+ })
161
+ } catch (cause) {
162
+ const failed = HttpAuthenticationProvider.timedOut(cause)
163
+ ? QueueStatus.REQUEST_TIMEOUT
164
+ : QueueStatus.ERROR
165
+
166
+ this.queue.leave(failed)
167
+ return this.unavailable(failed)
168
+ }
169
+
170
+ const body = new Uint8Array(await answer.arrayBuffer())
171
+ if (!answer.ok && body.length === 0) {
172
+ this.queue.leave(QueueStatus.ERROR)
173
+ return this.unavailable(QueueStatus.ERROR)
174
+ }
175
+
176
+ this.queue.leave(null)
177
+ return HttpAuthenticationProvider.read(body)
178
+ }
179
+
180
+ /**
181
+ * Whether a failed call ran out of time
182
+ * @param cause what the call threw
183
+ */
184
+ private static timedOut(cause: unknown): boolean {
185
+ return cause instanceof Error && cause.name === 'TimeoutError'
186
+ }
187
+
188
+ /**
189
+ * The result in a service's answer
190
+ * @param body bytes of the answer
191
+ */
192
+ private static read(body: Uint8Array): AuthenticationResult {
193
+ if (body.length === 0) {
194
+ throw new AuthenticationFailure(
195
+ ErrorMessage.CUSTOM_AUTHENTICATION_NO_RESPONSE_DATA,
196
+ )
197
+ }
198
+
199
+ const text = new TextDecoder()
200
+ .decode(body)
201
+ .replace(/^[\u{feff}\u{200b}]+/u, '')
202
+ .trim()
203
+ if (text === '') {
204
+ throw new AuthenticationFailure(
205
+ ErrorMessage.CUSTOM_AUTHENTICATION_EMPTY_RESPONSE,
206
+ )
207
+ }
208
+
209
+ try {
210
+ return AuthenticationResult.parse(text)
211
+ } catch (cause) {
212
+ throw new AuthenticationFailure(
213
+ ErrorMessages.format(
214
+ ErrorMessage.CUSTOM_AUTHENTICATION_DESERIALIZATION_FAILED,
215
+ cause instanceof Error ? cause.message : String(cause),
216
+ ),
217
+ { cause },
218
+ )
219
+ }
220
+ }
221
+
222
+ /**
223
+ * The pairs of a query string
224
+ * @param query text after the question mark, or null
225
+ */
226
+ private static parse(query: string | null): [string, string][] {
227
+ return [...new URLSearchParams(query ?? '').entries()]
228
+ }
229
+
230
+ /**
231
+ * A dictionary with text keys as a JSON object, or null
232
+ * @param data body from the client
233
+ */
234
+ private static object(data: PhotonValue): Record<string, unknown> | null {
235
+ if (data.kind !== Kind.DICTIONARY && data.kind !== Kind.HASHTABLE) {
236
+ return null
237
+ }
238
+
239
+ const json = JsonValues.write(data)
240
+ if (typeof json !== 'object' || json === null || Array.isArray(json)) {
241
+ return null
242
+ }
243
+
244
+ return json as Record<string, unknown>
245
+ }
246
+
247
+ /**
248
+ * What a service that can't be reached counts as
249
+ * @param status why there's no answer
250
+ */
251
+ private unavailable(status: QueueStatusName): AuthenticationResult {
252
+ if (!this.rejectIfUnavailable) return AuthenticationResult.ok()
253
+
254
+ throw new AuthenticationFailure(
255
+ ErrorMessages.format(
256
+ ErrorMessage.CUSTOM_AUTHENTICATION_SERVICE_ERROR,
257
+ status,
258
+ ),
259
+ )
260
+ }
261
+
262
+ /**
263
+ * A request with the client's values in the query string and body
264
+ * @param attempt type, query string and body
265
+ */
266
+ private plain(attempt: AuthenticationAttempt): Prepared {
267
+ const query = new URLSearchParams([...this.pairs.entries()])
268
+ for (const [name, value] of HttpAuthenticationProvider.parse(
269
+ attempt.parameters,
270
+ )) {
271
+ if (!this.pairs.has(name)) query.append(name, value)
272
+ }
273
+
274
+ const text = query.toString()
275
+ const joint = this.url.includes('?') ? '&' : '?'
276
+ const url = text === '' ? this.url : `${this.url}${joint}${text}`
277
+
278
+ const data = attempt.data
279
+ if (data === null) return { url, init: { method: 'GET' } }
280
+
281
+ const raw = data.raw()
282
+ if (raw !== null) return { url, init: { method: 'POST', body: raw } }
283
+
284
+ const string = data.text()
285
+ if (string !== null) return { url, init: { method: 'POST', body: string } }
286
+
287
+ const object = HttpAuthenticationProvider.object(data)
288
+ if (object === null) {
289
+ throw new AuthenticationFailure(
290
+ ErrorMessage.AUTHENTICATION_DATA_TYPE_NOT_SUPPORTED,
291
+ )
292
+ }
293
+
294
+ return { url, init: HttpAuthenticationProvider.json(object) }
295
+ }
296
+
297
+ /**
298
+ * A request with everything in one JSON body
299
+ * @param attempt type, query string and body
300
+ */
301
+ private merged(attempt: AuthenticationAttempt): Prepared {
302
+ const object =
303
+ attempt.data === null
304
+ ? {}
305
+ : HttpAuthenticationProvider.object(attempt.data)
306
+ if (object === null) {
307
+ throw new AuthenticationFailure(
308
+ ErrorMessage.JSON_MODE_AUTHENTICATION_DATA,
309
+ )
310
+ }
311
+
312
+ const body: Record<string, unknown> = { ...object }
313
+ for (const [name, value] of HttpAuthenticationProvider.parse(
314
+ attempt.parameters,
315
+ )) {
316
+ body[name] = value
317
+ }
318
+
319
+ for (const [name, value] of this.pairs) {
320
+ body[name] = value
321
+ }
322
+
323
+ return { url: this.url, init: HttpAuthenticationProvider.json(body) }
324
+ }
325
+
326
+ /**
327
+ * A POST with a JSON body
328
+ * @param body what to send
329
+ */
330
+ private static json(body: Record<string, unknown>): RequestInit {
331
+ return {
332
+ method: 'POST',
333
+ headers: { 'Content-Type': 'application/json' },
334
+ body: JSON.stringify(body),
335
+ }
336
+ }
337
+ }
@@ -0,0 +1,18 @@
1
+ export { Admission } from './admission/index.ts'
2
+ export { CustomAuthenticator } from './authenticator/index.ts'
3
+ export type { AuthenticationSettings } from './authenticator/index.ts'
4
+ export { AuthenticationFailure } from './failure/index.ts'
5
+ export { TokenGate } from './gate/index.ts'
6
+ export type { Renewal } from './gate/index.ts'
7
+ export { HttpAuthenticationProvider } from './http/index.ts'
8
+ export type { HttpAuthenticationOptions, HttpCall } from './http/index.ts'
9
+ export type {
10
+ AuthenticationAttempt,
11
+ AuthenticationProvider,
12
+ } from './provider/index.ts'
13
+ export { TokenKeys } from './keys/index.ts'
14
+ export type { TokenSettings } from './keys/index.ts'
15
+ export { QueueStatus, RequestQueue } from './queue/index.ts'
16
+ export type { QueueStatusName, RequestQueueOptions } from './queue/index.ts'
17
+ export { AuthenticationResult } from './result/index.ts'
18
+ export type { AuthenticatedFields } from './result/index.ts'
@@ -0,0 +1,67 @@
1
+ /* eslint-disable @typescript-eslint/no-extraneous-class */
2
+ import { hostname } from 'node:os'
3
+
4
+ import { TokenAuthority } from '../../crypto/token/authority/index.ts'
5
+ import { SealedTokenCodec } from '../../crypto/token/sealed/index.ts'
6
+
7
+ /**
8
+ * Keys and lifetime of the tokens a server deals in
9
+ */
10
+ export type TokenSettings = {
11
+ /**
12
+ * Key the tokens are encrypted with, shared by every server
13
+ */
14
+ readonly tokenKey: string
15
+
16
+ /**
17
+ * Key the tokens are signed with, shared by every server
18
+ */
19
+ readonly hmacKey: string
20
+
21
+ /**
22
+ * Seconds a token lasts, 1800 by default
23
+ */
24
+ readonly lifetime?: number
25
+ }
26
+
27
+ /**
28
+ * Builds the token authority of one server
29
+ * @class
30
+ */
31
+ export class TokenKeys {
32
+ /**
33
+ * Prefix of a Name Server's issuer name
34
+ */
35
+ public static readonly NAME: string = 'NS'
36
+
37
+ /**
38
+ * Prefix of a Master's issuer name
39
+ */
40
+ public static readonly MASTER: string = 'MS'
41
+
42
+ /**
43
+ * Prefix of a Game Server's issuer name
44
+ */
45
+ public static readonly GAME: string = 'GS'
46
+
47
+ /**
48
+ * The authority behind a server's settings, or null
49
+ * @param settings keys and lifetime, or null
50
+ * @param role prefix of the issuer name
51
+ * @param clock reads the clock in ms
52
+ */
53
+ public static authority(
54
+ settings: TokenSettings | null,
55
+ role: string,
56
+ clock: () => number = Date.now,
57
+ ): TokenAuthority | null {
58
+ if (settings === null || settings.tokenKey === '') return null
59
+
60
+ return new TokenAuthority(
61
+ new SealedTokenCodec(settings.tokenKey, settings.hmacKey),
62
+ `${role}:${hostname()}`,
63
+ settings.lifetime ?? TokenAuthority.LIFETIME,
64
+ clock,
65
+ )
66
+ }
67
+ }
@@ -0,0 +1,48 @@
1
+ import type { PhotonValue } from '../../binary/value/index.ts'
2
+ import type { AuthenticationResult } from '../result/index.ts'
3
+
4
+ /**
5
+ * What a client hands over to prove who it is
6
+ */
7
+ export type AuthenticationAttempt = {
8
+ /**
9
+ * Provider type the client picked
10
+ */
11
+ readonly type: number
12
+
13
+ /**
14
+ * Query string from the client, or null
15
+ */
16
+ readonly parameters: string | null
17
+
18
+ /**
19
+ * Body from the client, or null
20
+ */
21
+ readonly data: PhotonValue | null
22
+
23
+ /**
24
+ * App id the client sent, or null
25
+ */
26
+ readonly applicationId: string | null
27
+
28
+ /**
29
+ * Version the client sent, or null
30
+ */
31
+ readonly applicationVersion: string | null
32
+
33
+ /**
34
+ * User id the client asked for, or null
35
+ */
36
+ readonly userId: string | null
37
+ }
38
+
39
+ /**
40
+ * Decides whether a player is who they say
41
+ */
42
+ export type AuthenticationProvider = {
43
+ /**
44
+ * Checks what a client handed over
45
+ * @param attempt type, query string and body
46
+ */
47
+ authenticate(attempt: AuthenticationAttempt): Promise<AuthenticationResult>
48
+ }