@based/server 4.0.1 → 4.0.3

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 (438) hide show
  1. package/dist/auth/defaultConfig.d.ts +3 -0
  2. package/dist/auth/defaultConfig.js +12 -0
  3. package/dist/auth/defaultConfig.js.map +1 -0
  4. package/dist/auth/index.d.ts +12 -6
  5. package/dist/auth/index.js +31 -20
  6. package/dist/auth/index.js.map +1 -1
  7. package/dist/auth/parseAuthState.d.ts +2 -1
  8. package/dist/auth/parseAuthState.js +28 -6
  9. package/dist/auth/parseAuthState.js.map +1 -1
  10. package/dist/authorize.d.ts +9 -0
  11. package/dist/authorize.js +59 -0
  12. package/dist/authorize.js.map +1 -0
  13. package/dist/compress.js +3 -0
  14. package/dist/compress.js.map +1 -1
  15. package/dist/createSimpleServer.d.ts +20 -10
  16. package/dist/createSimpleServer.js +64 -53
  17. package/dist/createSimpleServer.js.map +1 -1
  18. package/dist/error/errorTypeHandlers.js +31 -12
  19. package/dist/error/errorTypeHandlers.js.map +1 -1
  20. package/dist/error/index.d.ts +11 -1
  21. package/dist/error/index.js +9 -10
  22. package/dist/error/index.js.map +1 -1
  23. package/dist/error/types.d.ts +41 -45
  24. package/dist/error/types.js +3 -1
  25. package/dist/error/types.js.map +1 -1
  26. package/dist/functionApi/callFunction copy.d.ts +3 -0
  27. package/dist/functionApi/callFunction copy.js +29 -0
  28. package/dist/functionApi/callFunction copy.js.map +1 -0
  29. package/dist/functionApi/callFunction.d.ts +3 -0
  30. package/dist/functionApi/callFunction.js +29 -0
  31. package/dist/functionApi/callFunction.js.map +1 -0
  32. package/dist/functionApi/client/index.d.ts +17 -0
  33. package/dist/functionApi/client/index.js +54 -0
  34. package/dist/functionApi/client/index.js.map +1 -0
  35. package/dist/functionApi/client/query.d.ts +11 -0
  36. package/dist/functionApi/client/query.js +32 -0
  37. package/dist/functionApi/client/query.js.map +1 -0
  38. package/dist/functionApi/get.d.ts +3 -0
  39. package/dist/functionApi/get.js +71 -0
  40. package/dist/functionApi/get.js.map +1 -0
  41. package/dist/functionApi/index.d.ts +5 -0
  42. package/dist/functionApi/index.js +25 -0
  43. package/dist/functionApi/index.js.map +1 -0
  44. package/dist/functionApi/observe.d.ts +4 -0
  45. package/dist/functionApi/observe.js +44 -0
  46. package/dist/functionApi/observe.js.map +1 -0
  47. package/dist/functionApi/stream.d.ts +3 -0
  48. package/dist/functionApi/stream.js +30 -0
  49. package/dist/functionApi/stream.js.map +1 -0
  50. package/dist/functions/index.d.ts +16 -8
  51. package/dist/functions/index.js +39 -10
  52. package/dist/functions/index.js.map +1 -1
  53. package/dist/functions/timeout.d.ts +3 -3
  54. package/dist/functions/timeout.js.map +1 -1
  55. package/dist/functions/types.d.ts +45 -31
  56. package/dist/functions/types.js +40 -12
  57. package/dist/functions/types.js.map +1 -1
  58. package/dist/incoming/http/function.d.ts +3 -4
  59. package/dist/incoming/http/function.js +29 -35
  60. package/dist/incoming/http/function.js.map +1 -1
  61. package/dist/incoming/http/get.d.ts +3 -3
  62. package/dist/incoming/http/get.js +44 -43
  63. package/dist/incoming/http/get.js.map +1 -1
  64. package/dist/incoming/http/index.js +50 -31
  65. package/dist/incoming/http/index.js.map +1 -1
  66. package/dist/incoming/http/parseQuery.d.ts +1 -1
  67. package/dist/incoming/http/parseQuery.js +3 -1
  68. package/dist/incoming/http/parseQuery.js.map +1 -1
  69. package/dist/incoming/http/query.d.ts +4 -0
  70. package/dist/incoming/http/query.js +165 -0
  71. package/dist/incoming/http/query.js.map +1 -0
  72. package/dist/incoming/http/readBody.d.ts +4 -3
  73. package/dist/incoming/http/readBody.js +32 -8
  74. package/dist/incoming/http/readBody.js.map +1 -1
  75. package/dist/incoming/http/streamFunction/DataStream.d.ts +8 -0
  76. package/dist/incoming/http/streamFunction/DataStream.js +42 -3
  77. package/dist/incoming/http/streamFunction/DataStream.js.map +1 -1
  78. package/dist/incoming/http/streamFunction/getExtension.d.ts +1 -1
  79. package/dist/incoming/http/streamFunction/index.d.ts +3 -3
  80. package/dist/incoming/http/streamFunction/index.js +6 -87
  81. package/dist/incoming/http/streamFunction/index.js.map +1 -1
  82. package/dist/incoming/http/streamFunction/multiPart/index.d.ts +4 -0
  83. package/dist/incoming/http/streamFunction/multiPart/index.js +66 -0
  84. package/dist/incoming/http/streamFunction/multiPart/index.js.map +1 -0
  85. package/dist/incoming/http/streamFunction/multiPart/readFormData.d.ts +12 -0
  86. package/dist/incoming/http/streamFunction/{multipartStream.js → multiPart/readFormData.js} +80 -86
  87. package/dist/incoming/http/streamFunction/multiPart/readFormData.js.map +1 -0
  88. package/dist/incoming/http/streamFunction/stream/createStream.d.ts +6 -0
  89. package/dist/incoming/http/streamFunction/{stream.js → stream/createStream.js} +5 -38
  90. package/dist/incoming/http/streamFunction/stream/createStream.js.map +1 -0
  91. package/dist/incoming/http/streamFunction/stream/index.d.ts +4 -0
  92. package/dist/incoming/http/streamFunction/stream/index.js +70 -0
  93. package/dist/incoming/http/streamFunction/stream/index.js.map +1 -0
  94. package/dist/incoming/index.d.ts +1 -1
  95. package/dist/incoming/index.js +13 -11
  96. package/dist/incoming/index.js.map +1 -1
  97. package/dist/incoming/upgrade.js +18 -9
  98. package/dist/incoming/upgrade.js.map +1 -1
  99. package/dist/incoming/ws/auth.d.ts +4 -4
  100. package/dist/incoming/ws/auth.js +37 -19
  101. package/dist/incoming/ws/auth.js.map +1 -1
  102. package/dist/incoming/ws/function.d.ts +2 -3
  103. package/dist/incoming/ws/function.js +21 -73
  104. package/dist/incoming/ws/function.js.map +1 -1
  105. package/dist/incoming/ws/get.d.ts +2 -3
  106. package/dist/incoming/ws/get.js +33 -54
  107. package/dist/incoming/ws/get.js.map +1 -1
  108. package/dist/incoming/ws/index.d.ts +1 -1
  109. package/dist/incoming/ws/index.js +2 -1
  110. package/dist/incoming/ws/index.js.map +1 -1
  111. package/dist/incoming/ws/observable.d.ts +7 -6
  112. package/dist/incoming/ws/observable.js +25 -49
  113. package/dist/incoming/ws/observable.js.map +1 -1
  114. package/dist/incoming/ws/types.d.ts +3 -0
  115. package/dist/{auth → incoming/ws}/types.js +0 -0
  116. package/dist/{auth → incoming/ws}/types.js.map +1 -1
  117. package/dist/index.d.ts +2 -2
  118. package/dist/index.js +2 -2
  119. package/dist/index.js.map +1 -1
  120. package/dist/installFn.d.ts +4 -0
  121. package/dist/installFn.js +94 -0
  122. package/dist/installFn.js.map +1 -0
  123. package/dist/observable/create.d.ts +1 -1
  124. package/dist/observable/create.js +5 -1
  125. package/dist/observable/create.js.map +1 -1
  126. package/dist/observable/destroy.js +1 -1
  127. package/dist/observable/destroy.js.map +1 -1
  128. package/dist/observable/index.d.ts +0 -1
  129. package/dist/observable/index.js +0 -1
  130. package/dist/observable/index.js.map +1 -1
  131. package/dist/observable/send.d.ts +3 -3
  132. package/dist/observable/send.js +2 -8
  133. package/dist/observable/send.js.map +1 -1
  134. package/dist/observable/start/error.d.ts +2 -1
  135. package/dist/observable/start/error.js +13 -11
  136. package/dist/observable/start/error.js.map +1 -1
  137. package/dist/observable/start/index.js +17 -8
  138. package/dist/observable/start/index.js.map +1 -1
  139. package/dist/observable/subscribe.d.ts +3 -3
  140. package/dist/observable/subscribe.js +6 -12
  141. package/dist/observable/subscribe.js.map +1 -1
  142. package/dist/observable/types.d.ts +6 -5
  143. package/dist/observable/unsub.d.ts +1 -1
  144. package/dist/observable/unsub.js.map +1 -1
  145. package/dist/protocol.d.ts +1 -0
  146. package/dist/protocol.js +11 -1
  147. package/dist/protocol.js.map +1 -1
  148. package/dist/security.d.ts +1 -1
  149. package/dist/security.js +1 -1
  150. package/dist/security.js.map +1 -1
  151. package/dist/sendError.d.ts +3 -2
  152. package/dist/sendError.js +30 -16
  153. package/dist/sendError.js.map +1 -1
  154. package/dist/sendHttpResponse.d.ts +3 -2
  155. package/dist/sendHttpResponse.js +62 -10
  156. package/dist/sendHttpResponse.js.map +1 -1
  157. package/dist/server.d.ts +10 -3
  158. package/dist/server.js +16 -4
  159. package/dist/server.js.map +1 -1
  160. package/dist/verifyRoute.d.ts +14 -0
  161. package/dist/verifyRoute.js +99 -0
  162. package/dist/verifyRoute.js.map +1 -0
  163. package/package.json +4 -2
  164. package/dist/BasedServerClient.d.ts +0 -71
  165. package/dist/BasedServerClient.js +0 -390
  166. package/dist/BasedServerClient.js.map +0 -1
  167. package/dist/Client.d.ts +0 -75
  168. package/dist/Client.js +0 -277
  169. package/dist/Client.js.map +0 -1
  170. package/dist/Params.d.ts +0 -20
  171. package/dist/Params.js +0 -48
  172. package/dist/Params.js.map +0 -1
  173. package/dist/api/index.d.ts +0 -7
  174. package/dist/api/index.js +0 -173
  175. package/dist/api/index.js.map +0 -1
  176. package/dist/auth/authorize.d.ts +0 -2
  177. package/dist/auth/authorize.js +0 -8
  178. package/dist/auth/authorize.js.map +0 -1
  179. package/dist/auth/dummyAuth.d.ts +0 -2
  180. package/dist/auth/dummyAuth.js +0 -8
  181. package/dist/auth/dummyAuth.js.map +0 -1
  182. package/dist/auth/types.d.ts +0 -10
  183. package/dist/clientContext.d.ts +0 -0
  184. package/dist/clientContext.js +0 -83
  185. package/dist/clientContext.js.map +0 -1
  186. package/dist/closeListener.d.ts +0 -4
  187. package/dist/closeListener.js +0 -13
  188. package/dist/closeListener.js.map +0 -1
  189. package/dist/context.d.ts +0 -54
  190. package/dist/context.js +0 -18
  191. package/dist/context.js.map +0 -1
  192. package/dist/error.d.ts +0 -66
  193. package/dist/error.js +0 -149
  194. package/dist/error.js.map +0 -1
  195. package/dist/findPrefix.d.ts +0 -3
  196. package/dist/findPrefix.js +0 -20
  197. package/dist/findPrefix.js.map +0 -1
  198. package/dist/functions/workerPool.d.ts +0 -0
  199. package/dist/functions/workerPool.js +0 -5
  200. package/dist/functions/workerPool.js.map +0 -1
  201. package/dist/getFromConfig.d.ts +0 -3
  202. package/dist/getFromConfig.js +0 -50
  203. package/dist/getFromConfig.js.map +0 -1
  204. package/dist/handlers/authorize.d.ts +0 -5
  205. package/dist/handlers/authorize.js +0 -196
  206. package/dist/handlers/authorize.js.map +0 -1
  207. package/dist/handlers/bulkUpdate/index.d.ts +0 -5
  208. package/dist/handlers/bulkUpdate/index.js +0 -26
  209. package/dist/handlers/bulkUpdate/index.js.map +0 -1
  210. package/dist/handlers/configuration/index.d.ts +0 -10
  211. package/dist/handlers/configuration/index.js +0 -74
  212. package/dist/handlers/configuration/index.js.map +0 -1
  213. package/dist/handlers/configuration/observable/index.d.ts +0 -46
  214. package/dist/handlers/configuration/observable/index.js +0 -277
  215. package/dist/handlers/configuration/observable/index.js.map +0 -1
  216. package/dist/handlers/configure/index.d.ts +0 -5
  217. package/dist/handlers/configure/index.js +0 -44
  218. package/dist/handlers/configure/index.js.map +0 -1
  219. package/dist/handlers/copy/index.d.ts +0 -8
  220. package/dist/handlers/copy/index.js +0 -135
  221. package/dist/handlers/copy/index.js.map +0 -1
  222. package/dist/handlers/delete/index.d.ts +0 -5
  223. package/dist/handlers/delete/index.js +0 -34
  224. package/dist/handlers/delete/index.js.map +0 -1
  225. package/dist/handlers/digest/index.d.ts +0 -5
  226. package/dist/handlers/digest/index.js +0 -23
  227. package/dist/handlers/digest/index.js.map +0 -1
  228. package/dist/handlers/functions/call.d.ts +0 -6
  229. package/dist/handlers/functions/call.js +0 -54
  230. package/dist/handlers/functions/call.js.map +0 -1
  231. package/dist/handlers/functions/observable/Observable.d.ts +0 -49
  232. package/dist/handlers/functions/observable/Observable.js +0 -290
  233. package/dist/handlers/functions/observable/Observable.js.map +0 -1
  234. package/dist/handlers/functions/observable/SharedObservable.d.ts +0 -45
  235. package/dist/handlers/functions/observable/SharedObservable.js +0 -291
  236. package/dist/handlers/functions/observable/SharedObservable.js.map +0 -1
  237. package/dist/handlers/functions/observable/index.d.ts +0 -14
  238. package/dist/handlers/functions/observable/index.js +0 -130
  239. package/dist/handlers/functions/observable/index.js.map +0 -1
  240. package/dist/handlers/get/index.d.ts +0 -5
  241. package/dist/handlers/get/index.js +0 -23
  242. package/dist/handlers/get/index.js.map +0 -1
  243. package/dist/handlers/getConfig/index.d.ts +0 -5
  244. package/dist/handlers/getConfig/index.js +0 -38
  245. package/dist/handlers/getConfig/index.js.map +0 -1
  246. package/dist/handlers/handleRequests.d.ts +0 -5
  247. package/dist/handlers/handleRequests.js +0 -78
  248. package/dist/handlers/handleRequests.js.map +0 -1
  249. package/dist/handlers/index.d.ts +0 -4
  250. package/dist/handlers/index.js +0 -49
  251. package/dist/handlers/index.js.map +0 -1
  252. package/dist/handlers/messageParser.d.ts +0 -5
  253. package/dist/handlers/messageParser.js +0 -122
  254. package/dist/handlers/messageParser.js.map +0 -1
  255. package/dist/handlers/removeField/index.d.ts +0 -5
  256. package/dist/handlers/removeField/index.js +0 -42
  257. package/dist/handlers/removeField/index.js.map +0 -1
  258. package/dist/handlers/removeType/index.d.ts +0 -5
  259. package/dist/handlers/removeType/index.js +0 -30
  260. package/dist/handlers/removeType/index.js.map +0 -1
  261. package/dist/handlers/rest/file/DataStream.d.ts +0 -7
  262. package/dist/handlers/rest/file/DataStream.js +0 -17
  263. package/dist/handlers/rest/file/DataStream.js.map +0 -1
  264. package/dist/handlers/rest/file/formStream.d.ts +0 -4
  265. package/dist/handlers/rest/file/formStream.js +0 -188
  266. package/dist/handlers/rest/file/formStream.js.map +0 -1
  267. package/dist/handlers/rest/file/getExtenstion.d.ts +0 -2
  268. package/dist/handlers/rest/file/getExtenstion.js +0 -22
  269. package/dist/handlers/rest/file/getExtenstion.js.map +0 -1
  270. package/dist/handlers/rest/file/index.d.ts +0 -4
  271. package/dist/handlers/rest/file/index.js +0 -53
  272. package/dist/handlers/rest/file/index.js.map +0 -1
  273. package/dist/handlers/rest/file/storeFile.d.ts +0 -6
  274. package/dist/handlers/rest/file/storeFile.js +0 -44
  275. package/dist/handlers/rest/file/storeFile.js.map +0 -1
  276. package/dist/handlers/rest/file/stream.d.ts +0 -5
  277. package/dist/handlers/rest/file/stream.js +0 -104
  278. package/dist/handlers/rest/file/stream.js.map +0 -1
  279. package/dist/handlers/rest/file/types.d.ts +0 -9
  280. package/dist/handlers/rest/file/types.js +0 -3
  281. package/dist/handlers/rest/file/types.js.map +0 -1
  282. package/dist/handlers/rest/getReqMessage.d.ts +0 -3
  283. package/dist/handlers/rest/getReqMessage.js +0 -92
  284. package/dist/handlers/rest/getReqMessage.js.map +0 -1
  285. package/dist/handlers/rest/index.d.ts +0 -4
  286. package/dist/handlers/rest/index.js +0 -121
  287. package/dist/handlers/rest/index.js.map +0 -1
  288. package/dist/handlers/rest/invalidReq.d.ts +0 -4
  289. package/dist/handlers/rest/invalidReq.js +0 -20
  290. package/dist/handlers/rest/invalidReq.js.map +0 -1
  291. package/dist/handlers/rest/parseResponse.d.ts +0 -6
  292. package/dist/handlers/rest/parseResponse.js +0 -230
  293. package/dist/handlers/rest/parseResponse.js.map +0 -1
  294. package/dist/handlers/rest/playground/index.d.ts +0 -5
  295. package/dist/handlers/rest/playground/index.js +0 -308
  296. package/dist/handlers/rest/playground/index.js.map +0 -1
  297. package/dist/handlers/rest/readBody.d.ts +0 -3
  298. package/dist/handlers/rest/readBody.js +0 -45
  299. package/dist/handlers/rest/readBody.js.map +0 -1
  300. package/dist/handlers/set/index.d.ts +0 -5
  301. package/dist/handlers/set/index.js +0 -20
  302. package/dist/handlers/set/index.js.map +0 -1
  303. package/dist/handlers/subscription/index.d.ts +0 -32
  304. package/dist/handlers/subscription/index.js +0 -223
  305. package/dist/handlers/subscription/index.js.map +0 -1
  306. package/dist/handlers/token.d.ts +0 -5
  307. package/dist/handlers/token.js +0 -122
  308. package/dist/handlers/token.js.map +0 -1
  309. package/dist/handlers/track/index.d.ts +0 -7
  310. package/dist/handlers/track/index.js +0 -102
  311. package/dist/handlers/track/index.js.map +0 -1
  312. package/dist/handlers/userAuth/index.d.ts +0 -5
  313. package/dist/handlers/userAuth/index.js +0 -78
  314. package/dist/handlers/userAuth/index.js.map +0 -1
  315. package/dist/incoming/http/authorize.d.ts +0 -4
  316. package/dist/incoming/http/authorize.js +0 -37
  317. package/dist/incoming/http/authorize.js.map +0 -1
  318. package/dist/incoming/http/streamFunction/multipartStream.d.ts +0 -13
  319. package/dist/incoming/http/streamFunction/multipartStream.js.map +0 -1
  320. package/dist/incoming/http/streamFunction/stream.d.ts +0 -6
  321. package/dist/incoming/http/streamFunction/stream.js.map +0 -1
  322. package/dist/network/http/authorize.d.ts +0 -3
  323. package/dist/network/http/authorize.js +0 -28
  324. package/dist/network/http/authorize.js.map +0 -1
  325. package/dist/network/http/compress.d.ts +0 -6
  326. package/dist/network/http/compress.js +0 -56
  327. package/dist/network/http/compress.js.map +0 -1
  328. package/dist/network/http/end.d.ts +0 -4
  329. package/dist/network/http/end.js +0 -19
  330. package/dist/network/http/end.js.map +0 -1
  331. package/dist/network/http/function.d.ts +0 -3
  332. package/dist/network/http/function.js +0 -47
  333. package/dist/network/http/function.js.map +0 -1
  334. package/dist/network/http/get.d.ts +0 -3
  335. package/dist/network/http/get.js +0 -129
  336. package/dist/network/http/get.js.map +0 -1
  337. package/dist/network/http/index.d.ts +0 -3
  338. package/dist/network/http/index.js +0 -122
  339. package/dist/network/http/index.js.map +0 -1
  340. package/dist/network/http/readBody.d.ts +0 -3
  341. package/dist/network/http/readBody.js +0 -112
  342. package/dist/network/http/readBody.js.map +0 -1
  343. package/dist/network/http/send.d.ts +0 -5
  344. package/dist/network/http/send.js +0 -60
  345. package/dist/network/http/send.js.map +0 -1
  346. package/dist/network/http/streamFunction/DataStream.d.ts +0 -7
  347. package/dist/network/http/streamFunction/DataStream.js +0 -19
  348. package/dist/network/http/streamFunction/DataStream.js.map +0 -1
  349. package/dist/network/http/streamFunction/getExtension.d.ts +0 -2
  350. package/dist/network/http/streamFunction/getExtension.js +0 -29
  351. package/dist/network/http/streamFunction/getExtension.js.map +0 -1
  352. package/dist/network/http/streamFunction/index.d.ts +0 -3
  353. package/dist/network/http/streamFunction/index.js +0 -81
  354. package/dist/network/http/streamFunction/index.js.map +0 -1
  355. package/dist/network/http/streamFunction/multipartStream.d.ts +0 -12
  356. package/dist/network/http/streamFunction/multipartStream.js +0 -208
  357. package/dist/network/http/streamFunction/multipartStream.js.map +0 -1
  358. package/dist/network/http/streamFunction/stream.d.ts +0 -5
  359. package/dist/network/http/streamFunction/stream.js +0 -103
  360. package/dist/network/http/streamFunction/stream.js.map +0 -1
  361. package/dist/network/index.d.ts +0 -4
  362. package/dist/network/index.js +0 -84
  363. package/dist/network/index.js.map +0 -1
  364. package/dist/network/message/auth.d.ts +0 -4
  365. package/dist/network/message/auth.js +0 -32
  366. package/dist/network/message/auth.js.map +0 -1
  367. package/dist/network/message/function.d.ts +0 -3
  368. package/dist/network/message/function.js +0 -67
  369. package/dist/network/message/function.js.map +0 -1
  370. package/dist/network/message/get.d.ts +0 -3
  371. package/dist/network/message/get.js +0 -109
  372. package/dist/network/message/get.js.map +0 -1
  373. package/dist/network/message/index.d.ts +0 -3
  374. package/dist/network/message/index.js +0 -62
  375. package/dist/network/message/index.js.map +0 -1
  376. package/dist/network/message/observable.d.ts +0 -5
  377. package/dist/network/message/observable.js +0 -103
  378. package/dist/network/message/observable.js.map +0 -1
  379. package/dist/network/message/send.d.ts +0 -4
  380. package/dist/network/message/send.js +0 -11
  381. package/dist/network/message/send.js.map +0 -1
  382. package/dist/network/upgrade.d.ts +0 -4
  383. package/dist/network/upgrade.js +0 -49
  384. package/dist/network/upgrade.js.map +0 -1
  385. package/dist/network/worker/get.d.ts +0 -0
  386. package/dist/network/worker/get.js +0 -122
  387. package/dist/network/worker/get.js.map +0 -1
  388. package/dist/network/worker/observable.d.ts +0 -0
  389. package/dist/network/worker/observable.js +0 -120
  390. package/dist/network/worker/observable.js.map +0 -1
  391. package/dist/observable/error.d.ts +0 -4
  392. package/dist/observable/error.js +0 -17
  393. package/dist/observable/error.js.map +0 -1
  394. package/dist/observable/verify.d.ts +0 -4
  395. package/dist/observable/verify.js +0 -18
  396. package/dist/observable/verify.js.map +0 -1
  397. package/dist/openListener.d.ts +0 -4
  398. package/dist/openListener.js +0 -13
  399. package/dist/openListener.js.map +0 -1
  400. package/dist/secrets.d.ts +0 -9
  401. package/dist/secrets.js +0 -150
  402. package/dist/secrets.js.map +0 -1
  403. package/dist/security/index.d.ts +0 -3
  404. package/dist/security/index.js +0 -66
  405. package/dist/security/index.js.map +0 -1
  406. package/dist/types.d.ts +0 -129
  407. package/dist/types.js +0 -17
  408. package/dist/types.js.map +0 -1
  409. package/dist/upgradeListener.d.ts +0 -4
  410. package/dist/upgradeListener.js +0 -47
  411. package/dist/upgradeListener.js.map +0 -1
  412. package/dist/worker/authorize.d.ts +0 -5
  413. package/dist/worker/authorize.js +0 -15
  414. package/dist/worker/authorize.js.map +0 -1
  415. package/dist/worker/fnMap.d.ts +0 -2
  416. package/dist/worker/fnMap.js +0 -5
  417. package/dist/worker/fnMap.js.map +0 -1
  418. package/dist/worker/functions.d.ts +0 -3
  419. package/dist/worker/functions.js +0 -8
  420. package/dist/worker/functions.js.map +0 -1
  421. package/dist/worker/http/function.d.ts +0 -4
  422. package/dist/worker/http/function.js +0 -75
  423. package/dist/worker/http/function.js.map +0 -1
  424. package/dist/worker/index.d.ts +0 -1
  425. package/dist/worker/index.js +0 -101
  426. package/dist/worker/index.js.map +0 -1
  427. package/dist/worker/observable.d.ts +0 -15
  428. package/dist/worker/observable.js +0 -110
  429. package/dist/worker/observable.js.map +0 -1
  430. package/dist/worker/ws/function.d.ts +0 -3
  431. package/dist/worker/ws/function.js +0 -42
  432. package/dist/worker/ws/function.js.map +0 -1
  433. package/dist/workers/index.d.ts +0 -0
  434. package/dist/workers/index.js +0 -20
  435. package/dist/workers/index.js.map +0 -1
  436. package/dist/workers/workerCode.d.ts +0 -12
  437. package/dist/workers/workerCode.js +0 -46
  438. package/dist/workers/workerCode.js.map +0 -1
package/dist/Client.js DELETED
@@ -1,277 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Client = void 0;
7
- const secrets_1 = require("./secrets");
8
- const utils_1 = require("@saulx/utils");
9
- const parseResponse_1 = __importDefault(require("./handlers/rest/parseResponse"));
10
- const ua_parser_js_1 = __importDefault(require("ua-parser-js"));
11
- let clientId = 0;
12
- let totalBp = 0;
13
- // make abstract class (rest client)
14
- // why not make this user less new things that need to be made
15
- class Client {
16
- constructor(server, socket, res, type = 0) {
17
- this.isBasedUser = false;
18
- this.isApiKey = false;
19
- this.id = ++clientId;
20
- this._server = server;
21
- if (socket) {
22
- this.socket = socket;
23
- socket.client = this;
24
- }
25
- this.type = type;
26
- if (res) {
27
- this.res = res;
28
- }
29
- }
30
- params(name) {
31
- if (this._params) {
32
- if (name) {
33
- return this._params[name] || null;
34
- }
35
- return this._params;
36
- }
37
- const s = this.socket;
38
- if (s) {
39
- const params = {};
40
- this._params = params;
41
- try {
42
- const arr = s.query.split(/\?|&/g);
43
- for (const pair of arr) {
44
- const [k, v = true] = pair.split('=');
45
- params[k] = v;
46
- }
47
- }
48
- catch (err) { }
49
- if (name) {
50
- return this._params[name] || null;
51
- }
52
- return this._params;
53
- }
54
- else {
55
- return name ? null : {};
56
- }
57
- }
58
- session(obj) {
59
- if (!this._session) {
60
- this._session = {};
61
- }
62
- if (obj) {
63
- if (!obj || typeof obj !== 'object') {
64
- console.error('Cannot set a non object on session');
65
- return this._session;
66
- }
67
- (0, utils_1.deepMerge)(this._session, obj);
68
- }
69
- return this._session;
70
- }
71
- get ip() {
72
- if (this._ip) {
73
- return this._ip;
74
- }
75
- if (this.socket) {
76
- return (this._ip = Buffer.from(this.socket.getRemoteAddressAsText()).toString());
77
- }
78
- if (this.res) {
79
- return (this._ip = Buffer.from(this.res.getRemoteAddressAsText()).toString());
80
- }
81
- return '::1';
82
- }
83
- get ua() {
84
- if (this._ua) {
85
- return this._ua;
86
- }
87
- // UA Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36
88
- // fix the tablet etc
89
- const ua = (this._ua = new ua_parser_js_1.default((this.socket ? this.socket.ua : this.res.ua) || '').getResult());
90
- return ua;
91
- }
92
- setToken(token, opts) {
93
- if (token) {
94
- if (this._unpackedToken && this._token !== token) {
95
- delete this._unpackedToken;
96
- }
97
- if (opts?.isApiKey) {
98
- this.isApiKey = true;
99
- }
100
- else if (opts?.isBasedUser) {
101
- this.isBasedUser = true;
102
- }
103
- else {
104
- this.isBasedUser = false;
105
- }
106
- this._token = token;
107
- if (opts?.refreshToken) {
108
- this._refreshToken = opts.refreshToken;
109
- }
110
- }
111
- else {
112
- this.isApiKey = false;
113
- this.isBasedUser = false;
114
- if (this._unpackedToken) {
115
- delete this._unpackedToken;
116
- }
117
- if (this._token) {
118
- delete this._token;
119
- }
120
- if (this._refreshToken) {
121
- delete this._refreshToken;
122
- }
123
- }
124
- }
125
- get geo() {
126
- if (this._geo) {
127
- return this._geo;
128
- }
129
- const getGeo = this._server.config?.getGeo;
130
- if (this._server.config?.getGeo) {
131
- return (this._geo = getGeo(this.ip));
132
- }
133
- else {
134
- return {
135
- iso: 'unkown',
136
- regions: [],
137
- long: 0,
138
- lat: 0,
139
- };
140
- }
141
- }
142
- async token(secret, type = 'jwt') {
143
- if (this._unpackedToken) {
144
- return this._unpackedToken;
145
- }
146
- if (this._token) {
147
- if (this.isApiKey) {
148
- const getApiKeysPublicKey = this._server?.config?.getApiKeysPublicKey;
149
- if (getApiKeysPublicKey) {
150
- const apiTokensPublicKey = await getApiKeysPublicKey();
151
- this._unpackedToken = await (0, secrets_1.decodeToken)(this._token, apiTokensPublicKey);
152
- }
153
- }
154
- else if (this.isBasedUser) {
155
- if (secret) {
156
- throw new Error('Cannot validate based user with a custom secret');
157
- }
158
- const getBasedKey = this._server?.config?.getBasedKey;
159
- if (getBasedKey) {
160
- this._unpackedToken = await (0, secrets_1.decodeToken)(this._token, await getBasedKey());
161
- }
162
- else {
163
- console.warn('No getBasedKey defined');
164
- }
165
- }
166
- else if (typeof secret === 'string') {
167
- if (!secret) {
168
- return this._token;
169
- }
170
- this._unpackedToken = await (0, secrets_1.decodeValueBySecret)(this._server, this._token, secret, type);
171
- }
172
- else if (typeof secret === 'object' && secret.publicKey) {
173
- this._unpackedToken = await (0, secrets_1.decodeToken)(this._token, secret.publicKey);
174
- }
175
- else {
176
- return this._token;
177
- }
178
- }
179
- return this._unpackedToken;
180
- }
181
- drain() {
182
- while (this.socket &&
183
- !this.closed &&
184
- !this.socket.getBufferedAmount() &&
185
- this.backpressureQueue?.length) {
186
- totalBp--;
187
- const [payload, time] = this.backpressureQueue.shift();
188
- if (Date.now() - time > 10e3) {
189
- this.backpressureQueue = [];
190
- console.info('last bp is larger then 10 seconds destroy client');
191
- this.destroy();
192
- return;
193
- }
194
- if (!this.socket.send(JSON.stringify(payload))) {
195
- console.info('drain build bp --- ', this.backpressureQueue.length, 'length in queue still');
196
- }
197
- }
198
- // totalBpQ
199
- if (this.backpressureQueue?.length === 0) {
200
- this.backpressureQueue = null;
201
- }
202
- }
203
- send(payload, headers) {
204
- // here we are going to add checksum ALLWAYS
205
- if (this.res) {
206
- (0, parseResponse_1.default)(this.res, payload, this.type, undefined, headers);
207
- this.destroy();
208
- }
209
- else if (!this.closed && this.socket) {
210
- if (this.socket.getBufferedAmount()) {
211
- if (!this.backpressureQueue) {
212
- this.backpressureQueue = [];
213
- }
214
- if (this.backpressureQueue.length) {
215
- const time = this.backpressureQueue[0][1];
216
- if (Date.now() - time > 10e3) {
217
- this.backpressureQueue = [];
218
- console.info('last bp is larger then 10 seconds destory');
219
- this.destroy();
220
- return;
221
- }
222
- }
223
- totalBp++;
224
- if (totalBp > 5e3) {
225
- console.info('Too much bp EXIT process');
226
- process.exit();
227
- }
228
- this.backpressureQueue.push([payload, Date.now()]);
229
- if (this.backpressureQueue.length > 50) {
230
- this.backpressureQueue = [];
231
- console.info('too large bp destroy client');
232
- this.destroy();
233
- return;
234
- }
235
- console.info('add to bp queue', this.backpressureQueue.length, this.socket.getBufferedAmount());
236
- }
237
- else {
238
- // lets do better with backpressure
239
- // buffer directly?
240
- if (typeof payload === 'string') {
241
- this.socket.send(payload);
242
- }
243
- else {
244
- this.socket.send(JSON.stringify(payload));
245
- }
246
- }
247
- }
248
- else {
249
- console.info('Not sending socket is closed ', !!this.socket, this.closed);
250
- }
251
- }
252
- destroy(socketClosed) {
253
- this.closed = true;
254
- if (this.backpressureQueue && this.backpressureQueue.length) {
255
- totalBp -= this.backpressureQueue.length;
256
- this.backpressureQueue = [];
257
- }
258
- if (this.subscriptions) {
259
- for (const id in this.subscriptions) {
260
- this.subscriptions[id].unsubscribe(this);
261
- }
262
- }
263
- if (this.socket) {
264
- this.socket.client = null;
265
- if (!socketClosed) {
266
- this.socket.end();
267
- }
268
- this.socket = null;
269
- }
270
- else {
271
- this.res = null;
272
- }
273
- }
274
- }
275
- exports.Client = Client;
276
- exports.default = Client;
277
- //# sourceMappingURL=Client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Client.js","sourceRoot":"","sources":["../src/Client.ts"],"names":[],"mappings":";;;;;;AAOA,uCAA4D;AAE5D,wCAAwC;AACxC,kFAAyD;AAGzD,gEAAmC;AAGnC,IAAI,QAAQ,GAAG,CAAC,CAAA;AAEhB,IAAI,OAAO,GAAG,CAAC,CAAA;AAWf,oCAAoC;AAEpC,8DAA8D;AAC9D,MAAa,MAAM;IA+FjB,YACE,MAAmB,EACnB,MAAsB,EACtB,GAAsB,EACtB,OAAc,CAAC;QA3DV,gBAAW,GAAY,KAAK,CAAA;QAE5B,aAAQ,GAAY,KAAK,CAAA;QA2D9B,IAAI,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAA;QACpB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QAErB,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;YACpB,MAAM,CAAC,MAAM,GAAG,IAAI,CAAA;SACrB;QAED,IAAI,CAAC,IA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@@
1
- /// <reference types="node" />
2
- import { BasedServer } from './';
3
- import BasedServerClient from './BasedServerClient';
4
- import { Client } from './Client';
5
- import { Readable } from 'stream';
6
- export declare class Params {
7
- constructor(server: BasedServer, payload?: any, user?: Client, callStack?: string[], update?: (value: any, checksum?: number) => void, name?: string, type?: string, useGlobalBased?: boolean, stream?: Readable);
8
- private useGlobalBased?;
9
- type?: string;
10
- name?: string;
11
- update: (value: any, checksum?: number) => void;
12
- callStack: string[];
13
- user: Client;
14
- payload?: any;
15
- fileStream?: Readable;
16
- private _based;
17
- server: BasedServer;
18
- path?: string;
19
- get based(): BasedServerClient;
20
- }
package/dist/Params.js DELETED
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Params = void 0;
7
- const BasedServerClient_1 = __importDefault(require("./BasedServerClient"));
8
- class Params {
9
- constructor(server, payload, user, callStack, update, name, type, useGlobalBased = false, stream = null) {
10
- this.update = (value, checksum) => {
11
- console.warn('cannot use update on a non-observable function', value, checksum);
12
- };
13
- this.server = server;
14
- if (callStack) {
15
- this.callStack = callStack;
16
- }
17
- if (user) {
18
- this.user = user;
19
- }
20
- if (stream) {
21
- this.fileStream = stream;
22
- }
23
- if (update) {
24
- this.update = update;
25
- }
26
- if (name) {
27
- this.name = name;
28
- }
29
- if (type) {
30
- this.type = type;
31
- }
32
- this.payload = payload;
33
- if (useGlobalBased) {
34
- this.useGlobalBased = true;
35
- }
36
- }
37
- get based() {
38
- if (this.useGlobalBased) {
39
- return this.server.based;
40
- }
41
- else {
42
- return this._based || (this._based = new BasedServerClient_1.default(this));
43
- }
44
- }
45
- }
46
- exports.Params = Params;
47
- Params.prototype.callStack = [];
48
- //# sourceMappingURL=Params.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Params.js","sourceRoot":"","sources":["../src/Params.ts"],"names":[],"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 +0,0 @@
1
- import { BasedServer } from '../server';
2
- import { Context } from '../context';
3
- import { ObservableUpdateFunction, ObserveErrorListener } from '../observable';
4
- export declare const callFunction: (server: BasedServer, name: string, ctx: Context, payload: any) => Promise<any>;
5
- export declare const get: (server: BasedServer, name: string, ctx: Context, payload: any) => Promise<any>;
6
- export declare const observe: (server: BasedServer, name: string, ctx: Context, payload: any, update: ObservableUpdateFunction, error: ObserveErrorListener) => (() => void);
7
- export { decode } from '../protocol';
package/dist/api/index.js DELETED
@@ -1,173 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decode = exports.observe = exports.get = exports.callFunction = void 0;
4
- const error_1 = require("../error");
5
- const functions_1 = require("../functions");
6
- const observable_1 = require("../observable");
7
- const callFunction = async (server, name, ctx, payload) => {
8
- const route = server.functions.route(name);
9
- if (!route) {
10
- throw (0, error_1.createError)(server, ctx, error_1.BasedErrorCode.FunctionNotFound, { name });
11
- }
12
- if (route.observable === true) {
13
- throw (0, error_1.createError)(server, ctx, error_1.BasedErrorCode.FunctionIsObservable, {
14
- name,
15
- });
16
- }
17
- const fn = await server.functions.install(name);
18
- if (!fn) {
19
- throw (0, error_1.createError)(server, ctx, error_1.BasedErrorCode.FunctionNotFound, { name });
20
- }
21
- if ((0, functions_1.isObservableFunctionSpec)(fn)) {
22
- throw (0, error_1.createError)(server, ctx, error_1.BasedErrorCode.FunctionIsObservable, {
23
- name,
24
- });
25
- }
26
- try {
27
- return fn.function(payload, ctx);
28
- }
29
- catch (err) {
30
- throw (0, error_1.createError)(server, ctx, error_1.BasedErrorCode.FunctionError, {
31
- route: { name },
32
- err,
33
- });
34
- }
35
- };
36
- exports.callFunction = callFunction;
37
- const getObsData = (resolve, reject, server, id, ctx, route) => {
38
- const obs = (0, observable_1.getObs)(server, id);
39
- if (obs.error) {
40
- reject((0, error_1.createError)(server, ctx, error_1.BasedErrorCode.ObservableFunctionError, {
41
- route,
42
- observableId: id,
43
- err: obs.error,
44
- }));
45
- return;
46
- }
47
- if (obs.cache) {
48
- resolve(obs.rawData || obs.cache);
49
- return;
50
- }
51
- (0, observable_1.subscribeNext)(obs, (err) => {
52
- if (err) {
53
- reject((0, error_1.createError)(server, ctx, error_1.BasedErrorCode.ObservableFunctionError, {
54
- observableId: id,
55
- route,
56
- err,
57
- }));
58
- }
59
- else {
60
- resolve(obs.rawData || obs.cache);
61
- }
62
- });
63
- };
64
- const get = (server, name, ctx, payload) => {
65
- return new Promise((resolve, reject) => {
66
- const route = server.functions.route(name);
67
- if (!route) {
68
- reject((0, error_1.createError)(server, ctx, error_1.BasedErrorCode.FunctionNotFound, { name }));
69
- return;
70
- }
71
- if (route.observable === false) {
72
- reject((0, error_1.createError)(server, ctx, error_1.BasedErrorCode.FunctionIsNotObservable, {
73
- name,
74
- }));
75
- return;
76
- }
77
- const id = (0, observable_1.genObservableId)(name, payload);
78
- if (!(0, observable_1.hasObs)(server, id)) {
79
- server.functions
80
- .install(name)
81
- .then((fn) => {
82
- if (!fn) {
83
- reject((0, error_1.createError)(server, ctx, error_1.BasedErrorCode.FunctionNotFound, {
84
- name,
85
- }));
86
- return;
87
- }
88
- if (!(0, functions_1.isObservableFunctionSpec)(fn)) {
89
- reject((0, error_1.createError)(server, ctx, error_1.BasedErrorCode.FunctionIsNotObservable, {
90
- name,
91
- }));
92
- return;
93
- }
94
- if (!(0, observable_1.hasObs)(server, id)) {
95
- (0, observable_1.createObs)(server, name, id, payload);
96
- }
97
- getObsData(resolve, reject, server, id, ctx, route);
98
- })
99
- .catch(() => reject((0, error_1.createError)(server, ctx, error_1.BasedErrorCode.FunctionNotFound, {
100
- name,
101
- })));
102
- }
103
- else {
104
- getObsData(resolve, reject, server, id, ctx, route);
105
- }
106
- });
107
- };
108
- exports.get = get;
109
- const observe = (server, name, ctx, payload, update, error) => {
110
- // TODO: Callstack
111
- const route = server.functions.route(name);
112
- if (!route) {
113
- throw (0, error_1.createError)(server, ctx, error_1.BasedErrorCode.FunctionNotFound, { name });
114
- }
115
- if (route.observable !== true) {
116
- throw (0, error_1.createError)(server, ctx, error_1.BasedErrorCode.FunctionIsNotObservable, {
117
- name,
118
- });
119
- }
120
- const id = (0, observable_1.genObservableId)(name, payload);
121
- let obs;
122
- let isClosed = false;
123
- const close = () => {
124
- if (isClosed) {
125
- return;
126
- }
127
- isClosed = true;
128
- if (obs) {
129
- (0, observable_1.unsubscribeFunction)(server, id, update);
130
- }
131
- };
132
- if ((0, observable_1.hasObs)(server, id)) {
133
- (0, observable_1.subscribeFunction)(server, id, update);
134
- return close;
135
- }
136
- server.functions
137
- .install(name)
138
- .then((spec) => {
139
- if (isClosed) {
140
- return;
141
- }
142
- if (spec === false) {
143
- error((0, error_1.createError)(server, ctx, error_1.BasedErrorCode.FunctionNotFound, {
144
- name,
145
- }));
146
- return;
147
- }
148
- if (!(0, functions_1.isObservableFunctionSpec)(spec)) {
149
- error((0, error_1.createError)(server, ctx, error_1.BasedErrorCode.FunctionIsNotObservable, {
150
- name,
151
- }));
152
- return;
153
- }
154
- if (!(0, observable_1.hasObs)(server, id)) {
155
- (0, observable_1.createObs)(server, name, id, payload);
156
- }
157
- (0, observable_1.subscribeFunction)(server, id, update);
158
- })
159
- .catch(() => {
160
- if (isClosed) {
161
- return;
162
- }
163
- error((0, error_1.createError)(server, ctx, error_1.BasedErrorCode.FunctionNotFound, {
164
- name,
165
- }));
166
- });
167
- return close;
168
- };
169
- exports.observe = observe;
170
- var protocol_1 = require("../protocol");
171
- Object.defineProperty(exports, "decode", { enumerable: true, get: function () { return protocol_1.decode; } });
172
- // TODO: nested stream function
173
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;AACA,oCAAsD;AAEtD,4CAA2E;AAC3E,8CAWsB;AAEf,MAAM,YAAY,GAAG,KAAK,EAC/B,MAAmB,EACnB,IAAY,EACZ,GAAY,EACZ,OAAY,EACE,EAAE;IA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AI,EAAE,EAAE;QACb,IAAI,QAAQ,EAAE;YACZ,OAAM;SACP;QACD,IAAI,IAAI,KAAK,KAAK,EAAE;YAClB,KAAK,CACH,IAAA,mBAAW,EAAC,MAAM,EAAE,GAAG,EAAE,sBAAc,CAAC,gBAAgB,EAAE;gBACxD,IAAI;aACL,CAAC,CACH,CAAA;YACD,OAAM;SACP;QAED,IAAI,CAAC,IAAA,oCAAwB,EAAC,IAAI,CAAC,EAAE;YACnC,KAAK,CACH,IAAA,mBAAW,EAAC,MAAM,EAAE,GAAG,EAAE,sBAAc,CAAC,uBAAuB,EAAE;gBAC/D,IAAI;aACL,CAAC,CACH,CAAA;YACD,OAAM;SACP;QAED,IAAI,CAAC,IAAA,mBAAM,EAAC,MAAM,EAAE,EAAE,CAAC,EAAE;YACvB,IAAA,sBAAS,EAAC,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;SACrC;QAED,IAAA,8BAAiB,EAAC,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;IACvC,CAAC,CAAC;SACD,KAAK,CAAC,GAAG,EAAE;QACV,IAAI,QAAQ,EAAE;YACZ,OAAM;SACP;QACD,KAAK,CACH,IAAA,mBAAW,EAAC,MAAM,EAAE,GAAG,EAAE,sBAAc,CAAC,gBAAgB,EAAE;YACxD,IAAI;SACL,CAAC,CACH,CAAA;IACH,CAAC,CAAC,CAAA;IAEJ,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAlFY,QAAA,OAAO,WAkFnB;AAED,wCAAoC;AAA3B,kGAAA,MAAM,OAAA;AAEf,+BAA+B"}
@@ -1,2 +0,0 @@
1
- import { Authorize } from '../types';
2
- export declare const authorize: Authorize;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.authorize = void 0;
4
- const authorize = async (_server, _ws, _name, _payload) => {
5
- return true;
6
- };
7
- exports.authorize = authorize;
8
- //# sourceMappingURL=authorize.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authorize.js","sourceRoot":"","sources":["../../src/auth/authorize.ts"],"names":[],"mappings":";;;AAEO,MAAM,SAAS,GAAc,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAC1E,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAFY,QAAA,SAAS,aAErB"}
@@ -1,2 +0,0 @@
1
- declare const _default: (_ctx: any, name: any, payload: any) => Promise<boolean>;
2
- export default _default;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // eslint-disable-next-line
4
- exports.default = async (_ctx, name, payload) => {
5
- // console.warn(' 🔓 Dummy auth', name, payload)
6
- return true;
7
- };
8
- //# sourceMappingURL=dummyAuth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dummyAuth.js","sourceRoot":"","sources":["../../src/auth/dummyAuth.ts"],"names":[],"mappings":";;AAAA,2BAA2B;AAC3B,kBAAe,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAC3C,gDAAgD;IAChD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
@@ -1,10 +0,0 @@
1
- import { BasedServer } from '../server';
2
- import { Context } from '../context';
3
- import uws from '@based/uws';
4
- export declare type AuthConfig = {
5
- authorize?: Authorize;
6
- authorizeConnection?: AuthorizeConnection;
7
- };
8
- export declare type Authorize = (context: Context, name: string, payload?: any) => Promise<boolean>;
9
- export declare type AuthorizeHandshake = (server: BasedServer, context: Context, payload?: any) => Promise<boolean>;
10
- export declare type AuthorizeConnection = (req: uws.HttpRequest) => Promise<boolean>;
File without changes