@lakutata/entrypoint 3.0.0-beta.0

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 (325) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +183 -0
  3. package/THIRD_PARTY_NOTICES.md +206 -0
  4. package/dist/cjs/Entrypoint.d.ts +868 -0
  5. package/dist/cjs/Entrypoint.js +998 -0
  6. package/dist/cjs/adapter/commander/CommanderCLIEntrypoint.d.ts +192 -0
  7. package/dist/cjs/adapter/commander/CommanderCLIEntrypoint.js +439 -0
  8. package/dist/cjs/adapter/commander/Prompt.d.ts +22 -0
  9. package/dist/cjs/adapter/commander/Prompt.js +164 -0
  10. package/dist/cjs/adapter/commander/Width.d.ts +12 -0
  11. package/dist/cjs/adapter/commander/Width.js +67 -0
  12. package/dist/cjs/adapter/electron/ElectronIPCServiceEntrypoint.d.ts +203 -0
  13. package/dist/cjs/adapter/electron/ElectronIPCServiceEntrypoint.js +249 -0
  14. package/dist/cjs/adapter/express/ExpressHTTPEntrypoint.d.ts +172 -0
  15. package/dist/cjs/adapter/express/ExpressHTTPEntrypoint.js +301 -0
  16. package/dist/cjs/adapter/express/Responders.d.ts +89 -0
  17. package/dist/cjs/adapter/express/Responders.js +71 -0
  18. package/dist/cjs/adapter/express/StaticUI.d.ts +83 -0
  19. package/dist/cjs/adapter/express/StaticUI.js +104 -0
  20. package/dist/cjs/adapter/fastify/FastifyHTTPEntrypoint.d.ts +156 -0
  21. package/dist/cjs/adapter/fastify/FastifyHTTPEntrypoint.js +339 -0
  22. package/dist/cjs/adapter/fastify/Responders.d.ts +88 -0
  23. package/dist/cjs/adapter/fastify/Responders.js +77 -0
  24. package/dist/cjs/adapter/http/HTTPServiceEntrypoint.d.ts +117 -0
  25. package/dist/cjs/adapter/http/HTTPServiceEntrypoint.js +257 -0
  26. package/dist/cjs/adapter/jsonrpc/JSONRPCProtocol.d.ts +194 -0
  27. package/dist/cjs/adapter/jsonrpc/JSONRPCProtocol.js +187 -0
  28. package/dist/cjs/adapter/jsonrpc/JSONRPCServiceEntrypoint.d.ts +154 -0
  29. package/dist/cjs/adapter/jsonrpc/JSONRPCServiceEntrypoint.js +397 -0
  30. package/dist/cjs/adapter/schedule/ScheduleEntrypoint.d.ts +86 -0
  31. package/dist/cjs/adapter/schedule/ScheduleEntrypoint.js +275 -0
  32. package/dist/cjs/adapter/socket.io/SocketIOServiceEntrypoint.d.ts +138 -0
  33. package/dist/cjs/adapter/socket.io/SocketIOServiceEntrypoint.js +216 -0
  34. package/dist/cjs/channel/BuiltinChannels.d.ts +18 -0
  35. package/dist/cjs/channel/BuiltinChannels.js +128 -0
  36. package/dist/cjs/channel/Channel.d.ts +196 -0
  37. package/dist/cjs/channel/Channel.js +106 -0
  38. package/dist/cjs/channel/EntrypointAdapter.d.ts +195 -0
  39. package/dist/cjs/channel/EntrypointAdapter.js +43 -0
  40. package/dist/cjs/context/BaseContext.d.ts +75 -0
  41. package/dist/cjs/context/BaseContext.js +90 -0
  42. package/dist/cjs/context/CLIContext.d.ts +38 -0
  43. package/dist/cjs/context/CLIContext.js +53 -0
  44. package/dist/cjs/context/HTTPContext.d.ts +52 -0
  45. package/dist/cjs/context/HTTPContext.js +78 -0
  46. package/dist/cjs/context/ScheduleContext.d.ts +47 -0
  47. package/dist/cjs/context/ScheduleContext.js +65 -0
  48. package/dist/cjs/context/ServiceContext.d.ts +47 -0
  49. package/dist/cjs/context/ServiceContext.js +62 -0
  50. package/dist/cjs/decorators/CLIAction.d.ts +120 -0
  51. package/dist/cjs/decorators/CLIAction.js +13 -0
  52. package/dist/cjs/decorators/HTTPAction.d.ts +178 -0
  53. package/dist/cjs/decorators/HTTPAction.js +14 -0
  54. package/dist/cjs/decorators/Prefix.d.ts +44 -0
  55. package/dist/cjs/decorators/Prefix.js +48 -0
  56. package/dist/cjs/decorators/Schedule.d.ts +120 -0
  57. package/dist/cjs/decorators/Schedule.js +64 -0
  58. package/dist/cjs/decorators/ServiceAction.d.ts +116 -0
  59. package/dist/cjs/decorators/ServiceAction.js +12 -0
  60. package/dist/cjs/decorators/UseMiddlewares.d.ts +52 -0
  61. package/dist/cjs/decorators/UseMiddlewares.js +58 -0
  62. package/dist/cjs/decorators/http/DELETE.d.ts +87 -0
  63. package/dist/cjs/decorators/http/DELETE.js +7 -0
  64. package/dist/cjs/decorators/http/GET.d.ts +89 -0
  65. package/dist/cjs/decorators/http/GET.js +7 -0
  66. package/dist/cjs/decorators/http/HEAD.d.ts +84 -0
  67. package/dist/cjs/decorators/http/HEAD.js +7 -0
  68. package/dist/cjs/decorators/http/OPTIONS.d.ts +80 -0
  69. package/dist/cjs/decorators/http/OPTIONS.js +7 -0
  70. package/dist/cjs/decorators/http/PATCH.d.ts +90 -0
  71. package/dist/cjs/decorators/http/PATCH.js +7 -0
  72. package/dist/cjs/decorators/http/POST.d.ts +91 -0
  73. package/dist/cjs/decorators/http/POST.js +7 -0
  74. package/dist/cjs/decorators/http/PUT.d.ts +92 -0
  75. package/dist/cjs/decorators/http/PUT.js +7 -0
  76. package/dist/cjs/exceptions/AccessDeniedException.d.ts +10 -0
  77. package/dist/cjs/exceptions/AccessDeniedException.js +17 -0
  78. package/dist/cjs/exceptions/ControllerActionNotFoundException.d.ts +9 -0
  79. package/dist/cjs/exceptions/ControllerActionNotFoundException.js +16 -0
  80. package/dist/cjs/exceptions/DuplicateActionNameException.d.ts +8 -0
  81. package/dist/cjs/exceptions/DuplicateActionNameException.js +15 -0
  82. package/dist/cjs/exceptions/EntrypointStoppedException.d.ts +9 -0
  83. package/dist/cjs/exceptions/EntrypointStoppedException.js +16 -0
  84. package/dist/cjs/exceptions/InvalidActionGroupException.d.ts +4 -0
  85. package/dist/cjs/exceptions/InvalidActionGroupException.js +11 -0
  86. package/dist/cjs/exceptions/InvalidChannelException.d.ts +8 -0
  87. package/dist/cjs/exceptions/InvalidChannelException.js +15 -0
  88. package/dist/cjs/exceptions/InvalidEntrypointAdapterException.d.ts +9 -0
  89. package/dist/cjs/exceptions/InvalidEntrypointAdapterException.js +16 -0
  90. package/dist/cjs/exceptions/InvalidMiddlewareException.d.ts +8 -0
  91. package/dist/cjs/exceptions/InvalidMiddlewareException.js +15 -0
  92. package/dist/cjs/exceptions/InvalidPrefixException.d.ts +8 -0
  93. package/dist/cjs/exceptions/InvalidPrefixException.js +15 -0
  94. package/dist/cjs/exceptions/MiddlewareNextCalledException.d.ts +8 -0
  95. package/dist/cjs/exceptions/MiddlewareNextCalledException.js +15 -0
  96. package/dist/cjs/exceptions/RouteNotFoundException.d.ts +9 -0
  97. package/dist/cjs/exceptions/RouteNotFoundException.js +16 -0
  98. package/dist/cjs/exceptions/ServiceInvokeException.d.ts +11 -0
  99. package/dist/cjs/exceptions/ServiceInvokeException.js +14 -0
  100. package/dist/cjs/exports/CTRLDecorators.d.ts +13 -0
  101. package/dist/cjs/exports/CTRLDecorators.js +38 -0
  102. package/dist/cjs/exports/Channel.d.ts +14 -0
  103. package/dist/cjs/exports/Channel.js +33 -0
  104. package/dist/cjs/exports/CommanderAdapter.d.ts +1 -0
  105. package/dist/cjs/exports/CommanderAdapter.js +8 -0
  106. package/dist/cjs/exports/ElectronAdapter.d.ts +1 -0
  107. package/dist/cjs/exports/ElectronAdapter.js +9 -0
  108. package/dist/cjs/exports/Entrypoint.d.ts +24 -0
  109. package/dist/cjs/exports/Entrypoint.js +55 -0
  110. package/dist/cjs/exports/ExpressAdapter.d.ts +4 -0
  111. package/dist/cjs/exports/ExpressAdapter.js +15 -0
  112. package/dist/cjs/exports/FastifyAdapter.d.ts +4 -0
  113. package/dist/cjs/exports/FastifyAdapter.js +14 -0
  114. package/dist/cjs/exports/JSONRPCAdapter.d.ts +2 -0
  115. package/dist/cjs/exports/JSONRPCAdapter.js +11 -0
  116. package/dist/cjs/exports/SocketIOAdapter.d.ts +1 -0
  117. package/dist/cjs/exports/SocketIOAdapter.js +9 -0
  118. package/dist/cjs/lib/AccessControl.d.ts +118 -0
  119. package/dist/cjs/lib/AccessControl.js +208 -0
  120. package/dist/cjs/lib/AccessControlRule.d.ts +91 -0
  121. package/dist/cjs/lib/AccessControlRule.js +76 -0
  122. package/dist/cjs/lib/ActionOptions.d.ts +67 -0
  123. package/dist/cjs/lib/ActionOptions.js +67 -0
  124. package/dist/cjs/lib/ActionResult.d.ts +28 -0
  125. package/dist/cjs/lib/ActionResult.js +28 -0
  126. package/dist/cjs/lib/ApplicationOf.d.ts +6 -0
  127. package/dist/cjs/lib/ApplicationOf.js +14 -0
  128. package/dist/cjs/lib/Controller.d.ts +59 -0
  129. package/dist/cjs/lib/Controller.js +64 -0
  130. package/dist/cjs/lib/ControllerEntrypoint.d.ts +168 -0
  131. package/dist/cjs/lib/ControllerEntrypoint.js +239 -0
  132. package/dist/cjs/lib/GetActionDTOAndOptions.d.ts +29 -0
  133. package/dist/cjs/lib/GetActionDTOAndOptions.js +49 -0
  134. package/dist/cjs/lib/HTTPErrors.d.ts +55 -0
  135. package/dist/cjs/lib/HTTPErrors.js +52 -0
  136. package/dist/cjs/lib/Middleware.d.ts +146 -0
  137. package/dist/cjs/lib/Middleware.js +144 -0
  138. package/dist/cjs/lib/Prefix.d.ts +98 -0
  139. package/dist/cjs/lib/Prefix.js +151 -0
  140. package/dist/cjs/lib/Result.d.ts +173 -0
  141. package/dist/cjs/lib/Result.js +153 -0
  142. package/dist/cjs/lib/ServiceResponseCodec.d.ts +82 -0
  143. package/dist/cjs/lib/ServiceResponseCodec.js +117 -0
  144. package/dist/cjs/lib/StringifyPattern.d.ts +7 -0
  145. package/dist/cjs/lib/StringifyPattern.js +58 -0
  146. package/dist/cjs/lib/UnsetValue.d.ts +12 -0
  147. package/dist/cjs/lib/UnsetValue.js +216 -0
  148. package/dist/cjs/lib/pattern/GlobPattern.d.ts +34 -0
  149. package/dist/cjs/lib/pattern/GlobPattern.js +68 -0
  150. package/dist/cjs/lib/pattern/PatternManager.d.ts +103 -0
  151. package/dist/cjs/lib/pattern/PatternManager.js +233 -0
  152. package/dist/cjs/lib/schedule/Cron.d.ts +56 -0
  153. package/dist/cjs/lib/schedule/Cron.js +282 -0
  154. package/dist/cjs/package.json +1 -0
  155. package/dist/cjs/types/CLIContextParams.d.ts +14 -0
  156. package/dist/cjs/types/CLIContextParams.js +2 -0
  157. package/dist/cjs/types/ErrorDescription.d.ts +14 -0
  158. package/dist/cjs/types/ErrorDescription.js +2 -0
  159. package/dist/cjs/types/HTTPContextParams.d.ts +27 -0
  160. package/dist/cjs/types/HTTPContextParams.js +2 -0
  161. package/dist/cjs/types/ScheduleContextParams.d.ts +21 -0
  162. package/dist/cjs/types/ScheduleContextParams.js +2 -0
  163. package/dist/cjs/types/ServiceContextParams.d.ts +16 -0
  164. package/dist/cjs/types/ServiceContextParams.js +2 -0
  165. package/dist/esm/Entrypoint.js +985 -0
  166. package/dist/esm/adapter/commander/CommanderCLIEntrypoint.js +433 -0
  167. package/dist/esm/adapter/commander/Prompt.js +127 -0
  168. package/dist/esm/adapter/commander/Width.js +63 -0
  169. package/dist/esm/adapter/electron/ElectronIPCServiceEntrypoint.js +212 -0
  170. package/dist/esm/adapter/express/ExpressHTTPEntrypoint.js +295 -0
  171. package/dist/esm/adapter/express/Responders.js +66 -0
  172. package/dist/esm/adapter/express/StaticUI.js +96 -0
  173. package/dist/esm/adapter/fastify/FastifyHTTPEntrypoint.js +333 -0
  174. package/dist/esm/adapter/fastify/Responders.js +73 -0
  175. package/dist/esm/adapter/http/HTTPServiceEntrypoint.js +253 -0
  176. package/dist/esm/adapter/jsonrpc/JSONRPCProtocol.js +182 -0
  177. package/dist/esm/adapter/jsonrpc/JSONRPCServiceEntrypoint.js +361 -0
  178. package/dist/esm/adapter/schedule/ScheduleEntrypoint.js +272 -0
  179. package/dist/esm/adapter/socket.io/SocketIOServiceEntrypoint.js +212 -0
  180. package/dist/esm/channel/BuiltinChannels.js +125 -0
  181. package/dist/esm/channel/Channel.js +100 -0
  182. package/dist/esm/channel/EntrypointAdapter.js +39 -0
  183. package/dist/esm/context/BaseContext.js +87 -0
  184. package/dist/esm/context/CLIContext.js +49 -0
  185. package/dist/esm/context/HTTPContext.js +74 -0
  186. package/dist/esm/context/ScheduleContext.js +61 -0
  187. package/dist/esm/context/ServiceContext.js +58 -0
  188. package/dist/esm/decorators/CLIAction.js +10 -0
  189. package/dist/esm/decorators/HTTPAction.js +11 -0
  190. package/dist/esm/decorators/Prefix.js +45 -0
  191. package/dist/esm/decorators/Schedule.js +61 -0
  192. package/dist/esm/decorators/ServiceAction.js +9 -0
  193. package/dist/esm/decorators/UseMiddlewares.js +55 -0
  194. package/dist/esm/decorators/http/DELETE.js +4 -0
  195. package/dist/esm/decorators/http/GET.js +4 -0
  196. package/dist/esm/decorators/http/HEAD.js +4 -0
  197. package/dist/esm/decorators/http/OPTIONS.js +4 -0
  198. package/dist/esm/decorators/http/PATCH.js +4 -0
  199. package/dist/esm/decorators/http/POST.js +4 -0
  200. package/dist/esm/decorators/http/PUT.js +4 -0
  201. package/dist/esm/exceptions/AccessDeniedException.js +13 -0
  202. package/dist/esm/exceptions/ControllerActionNotFoundException.js +12 -0
  203. package/dist/esm/exceptions/DuplicateActionNameException.js +11 -0
  204. package/dist/esm/exceptions/EntrypointStoppedException.js +12 -0
  205. package/dist/esm/exceptions/InvalidActionGroupException.js +7 -0
  206. package/dist/esm/exceptions/InvalidChannelException.js +11 -0
  207. package/dist/esm/exceptions/InvalidEntrypointAdapterException.js +12 -0
  208. package/dist/esm/exceptions/InvalidMiddlewareException.js +11 -0
  209. package/dist/esm/exceptions/InvalidPrefixException.js +11 -0
  210. package/dist/esm/exceptions/MiddlewareNextCalledException.js +11 -0
  211. package/dist/esm/exceptions/RouteNotFoundException.js +12 -0
  212. package/dist/esm/exceptions/ServiceInvokeException.js +10 -0
  213. package/dist/esm/exports/CTRLDecorators.js +19 -0
  214. package/dist/esm/exports/Channel.js +11 -0
  215. package/dist/esm/exports/CommanderAdapter.js +1 -0
  216. package/dist/esm/exports/ElectronAdapter.js +1 -0
  217. package/dist/esm/exports/Entrypoint.js +22 -0
  218. package/dist/esm/exports/ExpressAdapter.js +3 -0
  219. package/dist/esm/exports/FastifyAdapter.js +3 -0
  220. package/dist/esm/exports/JSONRPCAdapter.js +2 -0
  221. package/dist/esm/exports/SocketIOAdapter.js +1 -0
  222. package/dist/esm/lib/AccessControl.js +204 -0
  223. package/dist/esm/lib/AccessControlRule.js +72 -0
  224. package/dist/esm/lib/ActionOptions.js +63 -0
  225. package/dist/esm/lib/ActionResult.js +24 -0
  226. package/dist/esm/lib/ApplicationOf.js +11 -0
  227. package/dist/esm/lib/Controller.js +61 -0
  228. package/dist/esm/lib/ControllerEntrypoint.js +229 -0
  229. package/dist/esm/lib/GetActionDTOAndOptions.js +46 -0
  230. package/dist/esm/lib/HTTPErrors.js +48 -0
  231. package/dist/esm/lib/Middleware.js +134 -0
  232. package/dist/esm/lib/Prefix.js +143 -0
  233. package/dist/esm/lib/Result.js +147 -0
  234. package/dist/esm/lib/ServiceResponseCodec.js +113 -0
  235. package/dist/esm/lib/StringifyPattern.js +55 -0
  236. package/dist/esm/lib/UnsetValue.js +213 -0
  237. package/dist/esm/lib/pattern/GlobPattern.js +64 -0
  238. package/dist/esm/lib/pattern/PatternManager.js +229 -0
  239. package/dist/esm/lib/schedule/Cron.js +277 -0
  240. package/dist/esm/types/CLIContextParams.js +1 -0
  241. package/dist/esm/types/ErrorDescription.js +1 -0
  242. package/dist/esm/types/HTTPContextParams.js +1 -0
  243. package/dist/esm/types/ScheduleContextParams.js +1 -0
  244. package/dist/esm/types/ServiceContextParams.js +1 -0
  245. package/dist/types/Entrypoint.d.ts +868 -0
  246. package/dist/types/adapter/commander/CommanderCLIEntrypoint.d.ts +192 -0
  247. package/dist/types/adapter/commander/Prompt.d.ts +22 -0
  248. package/dist/types/adapter/commander/Width.d.ts +12 -0
  249. package/dist/types/adapter/electron/ElectronIPCServiceEntrypoint.d.ts +203 -0
  250. package/dist/types/adapter/express/ExpressHTTPEntrypoint.d.ts +172 -0
  251. package/dist/types/adapter/express/Responders.d.ts +89 -0
  252. package/dist/types/adapter/express/StaticUI.d.ts +83 -0
  253. package/dist/types/adapter/fastify/FastifyHTTPEntrypoint.d.ts +156 -0
  254. package/dist/types/adapter/fastify/Responders.d.ts +88 -0
  255. package/dist/types/adapter/http/HTTPServiceEntrypoint.d.ts +117 -0
  256. package/dist/types/adapter/jsonrpc/JSONRPCProtocol.d.ts +194 -0
  257. package/dist/types/adapter/jsonrpc/JSONRPCServiceEntrypoint.d.ts +154 -0
  258. package/dist/types/adapter/schedule/ScheduleEntrypoint.d.ts +86 -0
  259. package/dist/types/adapter/socket.io/SocketIOServiceEntrypoint.d.ts +138 -0
  260. package/dist/types/channel/BuiltinChannels.d.ts +18 -0
  261. package/dist/types/channel/Channel.d.ts +196 -0
  262. package/dist/types/channel/EntrypointAdapter.d.ts +195 -0
  263. package/dist/types/context/BaseContext.d.ts +75 -0
  264. package/dist/types/context/CLIContext.d.ts +38 -0
  265. package/dist/types/context/HTTPContext.d.ts +52 -0
  266. package/dist/types/context/ScheduleContext.d.ts +47 -0
  267. package/dist/types/context/ServiceContext.d.ts +47 -0
  268. package/dist/types/decorators/CLIAction.d.ts +120 -0
  269. package/dist/types/decorators/HTTPAction.d.ts +178 -0
  270. package/dist/types/decorators/Prefix.d.ts +44 -0
  271. package/dist/types/decorators/Schedule.d.ts +120 -0
  272. package/dist/types/decorators/ServiceAction.d.ts +116 -0
  273. package/dist/types/decorators/UseMiddlewares.d.ts +52 -0
  274. package/dist/types/decorators/http/DELETE.d.ts +87 -0
  275. package/dist/types/decorators/http/GET.d.ts +89 -0
  276. package/dist/types/decorators/http/HEAD.d.ts +84 -0
  277. package/dist/types/decorators/http/OPTIONS.d.ts +80 -0
  278. package/dist/types/decorators/http/PATCH.d.ts +90 -0
  279. package/dist/types/decorators/http/POST.d.ts +91 -0
  280. package/dist/types/decorators/http/PUT.d.ts +92 -0
  281. package/dist/types/exceptions/AccessDeniedException.d.ts +10 -0
  282. package/dist/types/exceptions/ControllerActionNotFoundException.d.ts +9 -0
  283. package/dist/types/exceptions/DuplicateActionNameException.d.ts +8 -0
  284. package/dist/types/exceptions/EntrypointStoppedException.d.ts +9 -0
  285. package/dist/types/exceptions/InvalidActionGroupException.d.ts +4 -0
  286. package/dist/types/exceptions/InvalidChannelException.d.ts +8 -0
  287. package/dist/types/exceptions/InvalidEntrypointAdapterException.d.ts +9 -0
  288. package/dist/types/exceptions/InvalidMiddlewareException.d.ts +8 -0
  289. package/dist/types/exceptions/InvalidPrefixException.d.ts +8 -0
  290. package/dist/types/exceptions/MiddlewareNextCalledException.d.ts +8 -0
  291. package/dist/types/exceptions/RouteNotFoundException.d.ts +9 -0
  292. package/dist/types/exceptions/ServiceInvokeException.d.ts +11 -0
  293. package/dist/types/exports/CTRLDecorators.d.ts +13 -0
  294. package/dist/types/exports/Channel.d.ts +14 -0
  295. package/dist/types/exports/CommanderAdapter.d.ts +1 -0
  296. package/dist/types/exports/ElectronAdapter.d.ts +1 -0
  297. package/dist/types/exports/Entrypoint.d.ts +24 -0
  298. package/dist/types/exports/ExpressAdapter.d.ts +4 -0
  299. package/dist/types/exports/FastifyAdapter.d.ts +4 -0
  300. package/dist/types/exports/JSONRPCAdapter.d.ts +2 -0
  301. package/dist/types/exports/SocketIOAdapter.d.ts +1 -0
  302. package/dist/types/lib/AccessControl.d.ts +118 -0
  303. package/dist/types/lib/AccessControlRule.d.ts +91 -0
  304. package/dist/types/lib/ActionOptions.d.ts +67 -0
  305. package/dist/types/lib/ActionResult.d.ts +28 -0
  306. package/dist/types/lib/ApplicationOf.d.ts +6 -0
  307. package/dist/types/lib/Controller.d.ts +59 -0
  308. package/dist/types/lib/ControllerEntrypoint.d.ts +168 -0
  309. package/dist/types/lib/GetActionDTOAndOptions.d.ts +29 -0
  310. package/dist/types/lib/HTTPErrors.d.ts +55 -0
  311. package/dist/types/lib/Middleware.d.ts +146 -0
  312. package/dist/types/lib/Prefix.d.ts +98 -0
  313. package/dist/types/lib/Result.d.ts +173 -0
  314. package/dist/types/lib/ServiceResponseCodec.d.ts +82 -0
  315. package/dist/types/lib/StringifyPattern.d.ts +7 -0
  316. package/dist/types/lib/UnsetValue.d.ts +12 -0
  317. package/dist/types/lib/pattern/GlobPattern.d.ts +34 -0
  318. package/dist/types/lib/pattern/PatternManager.d.ts +103 -0
  319. package/dist/types/lib/schedule/Cron.d.ts +56 -0
  320. package/dist/types/types/CLIContextParams.d.ts +14 -0
  321. package/dist/types/types/ErrorDescription.d.ts +14 -0
  322. package/dist/types/types/HTTPContextParams.d.ts +27 -0
  323. package/dist/types/types/ScheduleContextParams.d.ts +21 -0
  324. package/dist/types/types/ServiceContextParams.d.ts +16 -0
  325. package/package.json +152 -0
@@ -0,0 +1,173 @@
1
+ import type { Readable } from 'node:stream';
2
+ import { ActionResult } from './ActionResult.js';
3
+ /**
4
+ * A result with a status and headers: the HTTP adapters set them on the response and send the data with their
5
+ * responder; the CLI adapter outputs the data. Build it with `Result.status()`.
6
+ * @example
7
+ * ```typescript
8
+ * import {Controller, Result, type StatusResult} from 'lakutata/com/entrypoint'
9
+ * import {POST} from 'lakutata/decorator/ctrl'
10
+ *
11
+ * class OrderController extends Controller {
12
+ * //201 Created, with the location of the order
13
+ * @POST('/orders')
14
+ * public async create(): Promise<StatusResult> {
15
+ * return Result.status(201, {id: 42}, {Location: '/orders/42'})
16
+ * }
17
+ * }
18
+ * ```
19
+ */
20
+ export declare class StatusResult extends ActionResult {
21
+ readonly status: number;
22
+ protected readonly payload?: unknown | undefined;
23
+ readonly headers: Record<string, string>;
24
+ /**
25
+ * Create a result with a status and headers.
26
+ * @param status The HTTP status.
27
+ * @param payload The data sent.
28
+ * @param headers The response headers.
29
+ */
30
+ constructor(status: number, payload?: unknown | undefined, headers?: Record<string, string>);
31
+ /**
32
+ * The data sent with the status.
33
+ */
34
+ get data(): unknown;
35
+ }
36
+ /**
37
+ * How a {@link FileResult} is sent.
38
+ */
39
+ export type FileResultOptions = {
40
+ /**
41
+ * The content type, inferred from the file's or the attachment's name when omitted.
42
+ */
43
+ contentType?: string;
44
+ /**
45
+ * The name to send the file under, as an attachment (`Content-Disposition: attachment`); it is displayed inline
46
+ * when omitted.
47
+ */
48
+ filename?: string;
49
+ /**
50
+ * The content's entity tag, sent quoted in `ETag`: a request whose `If-None-Match` matches it gets a 304 response
51
+ * without content.
52
+ */
53
+ etag?: string;
54
+ /**
55
+ * Other response headers.
56
+ */
57
+ headers?: Record<string, string>;
58
+ };
59
+ /**
60
+ * A file: a path, a buffer or a stream. The HTTP adapters send it with its options; the CLI adapter writes its
61
+ * content to stdout. Build it with `Result.file()`.
62
+ * @example
63
+ * ```typescript
64
+ * import {Readable} from 'node:stream'
65
+ * import {Controller, Result, type FileResult} from 'lakutata/com/entrypoint'
66
+ * import {GET} from 'lakutata/decorator/ctrl'
67
+ *
68
+ * class ReportController extends Controller {
69
+ * //A file on disk, downloaded as report.pdf
70
+ * @GET('/report')
71
+ * public async report(): Promise<FileResult> {
72
+ * return Result.file('./reports/latest.pdf', {filename: 'report.pdf', etag: 'v1'})
73
+ * }
74
+ *
75
+ * //A stream, with its content type
76
+ * @GET('/export')
77
+ * public async export(): Promise<FileResult> {
78
+ * return Result.file(Readable.from(['id,name\n', '1,Ada\n']), {contentType: 'text/csv'})
79
+ * }
80
+ * }
81
+ * ```
82
+ */
83
+ export declare class FileResult extends ActionResult {
84
+ readonly source: string | Buffer | Readable;
85
+ readonly options: FileResultOptions;
86
+ /**
87
+ * Create a file result.
88
+ * @param source The file's path (resolved from the working directory), its content, or a stream of its content.
89
+ * @param options How the file is sent.
90
+ */
91
+ constructor(source: string | Buffer | Readable, options?: FileResultOptions);
92
+ /**
93
+ * The file's source.
94
+ */
95
+ get data(): unknown;
96
+ }
97
+ /**
98
+ * Send an event of a stream; nothing is sent once the client has left.
99
+ * @param data The event's data, serialized to JSON unless it is a string.
100
+ * @param event The event's name; the clients' default event (`message`) when omitted.
101
+ * @param id The event's id, which the client sends back as `Last-Event-ID` when it reconnects.
102
+ */
103
+ export type SendEvent = (data: unknown, event?: string, id?: string) => void;
104
+ /**
105
+ * Produce the events of a stream. The stream ends when the producer settles (an error ends it too, without other
106
+ * notice); when the client leaves, the signal aborts and the producer should return.
107
+ * @param send Sends an event.
108
+ * @param signal Aborts when the client leaves or the adapter stops.
109
+ */
110
+ export type EventsProducer = (send: SendEvent, signal: AbortSignal) => Promise<void> | void;
111
+ /**
112
+ * A stream of events: Server-Sent Events for the HTTP adapters, each event's data written as a line by the CLI
113
+ * adapter. Build it with `Result.events()`.
114
+ *
115
+ * The producer runs after the action returned, once the request's container is destroyed: it must only use objects
116
+ * living longer than the request (the components), not the controller's request-scoped dependencies.
117
+ * @example
118
+ * ```typescript
119
+ * import {Controller, Result, type EventsResult} from 'lakutata/com/entrypoint'
120
+ * import {GET} from 'lakutata/decorator/ctrl'
121
+ *
122
+ * class ClockController extends Controller {
123
+ * //The time every second until the client leaves
124
+ * @GET('/clock')
125
+ * public async clock(): Promise<EventsResult> {
126
+ * return Result.events(async (send, signal): Promise<void> => {
127
+ * while (!signal.aborted) {
128
+ * send({now: new Date().toISOString()}, 'tick')
129
+ * await new Promise((resolve): unknown => setTimeout(resolve, 1000))
130
+ * }
131
+ * })
132
+ * }
133
+ * }
134
+ * ```
135
+ */
136
+ export declare class EventsResult extends ActionResult {
137
+ readonly producer: EventsProducer;
138
+ /**
139
+ * Create an event stream result.
140
+ * @param producer Produces the events.
141
+ */
142
+ constructor(producer: EventsProducer);
143
+ /**
144
+ * Always `undefined`: an event stream has no data of its own.
145
+ */
146
+ get data(): unknown;
147
+ }
148
+ /**
149
+ * Build the results an action returns to describe its output beyond its data.
150
+ */
151
+ export declare const Result: {
152
+ /**
153
+ * Build a result with a status and headers.
154
+ * @param status The HTTP status.
155
+ * @param data The data sent.
156
+ * @param headers The response headers.
157
+ * @returns The {@link StatusResult}.
158
+ */
159
+ status: (status: number, data?: unknown, headers?: Record<string, string>) => StatusResult;
160
+ /**
161
+ * Build a file result.
162
+ * @param source The file's path (resolved from the working directory), its content, or a stream of its content.
163
+ * @param options How the file is sent.
164
+ * @returns The {@link FileResult}.
165
+ */
166
+ file: (source: string | Buffer | Readable, options?: FileResultOptions) => FileResult;
167
+ /**
168
+ * Build an event stream result (Server-Sent Events for HTTP).
169
+ * @param producer Produces the events, after the action returned.
170
+ * @returns The {@link EventsResult}.
171
+ */
172
+ events: (producer: EventsProducer) => EventsResult;
173
+ };
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Result = exports.EventsResult = exports.FileResult = exports.StatusResult = void 0;
4
+ const ActionResult_js_1 = require("./ActionResult.js");
5
+ /**
6
+ * A result with a status and headers: the HTTP adapters set them on the response and send the data with their
7
+ * responder; the CLI adapter outputs the data. Build it with `Result.status()`.
8
+ * @example
9
+ * ```typescript
10
+ * import {Controller, Result, type StatusResult} from 'lakutata/com/entrypoint'
11
+ * import {POST} from 'lakutata/decorator/ctrl'
12
+ *
13
+ * class OrderController extends Controller {
14
+ * //201 Created, with the location of the order
15
+ * @POST('/orders')
16
+ * public async create(): Promise<StatusResult> {
17
+ * return Result.status(201, {id: 42}, {Location: '/orders/42'})
18
+ * }
19
+ * }
20
+ * ```
21
+ */
22
+ class StatusResult extends ActionResult_js_1.ActionResult {
23
+ /**
24
+ * Create a result with a status and headers.
25
+ * @param status The HTTP status.
26
+ * @param payload The data sent.
27
+ * @param headers The response headers.
28
+ */
29
+ constructor(status, payload, headers = {}) {
30
+ super();
31
+ this.status = status;
32
+ this.payload = payload;
33
+ this.headers = headers;
34
+ }
35
+ /**
36
+ * The data sent with the status.
37
+ */
38
+ get data() {
39
+ return this.payload;
40
+ }
41
+ }
42
+ exports.StatusResult = StatusResult;
43
+ /**
44
+ * A file: a path, a buffer or a stream. The HTTP adapters send it with its options; the CLI adapter writes its
45
+ * content to stdout. Build it with `Result.file()`.
46
+ * @example
47
+ * ```typescript
48
+ * import {Readable} from 'node:stream'
49
+ * import {Controller, Result, type FileResult} from 'lakutata/com/entrypoint'
50
+ * import {GET} from 'lakutata/decorator/ctrl'
51
+ *
52
+ * class ReportController extends Controller {
53
+ * //A file on disk, downloaded as report.pdf
54
+ * @GET('/report')
55
+ * public async report(): Promise<FileResult> {
56
+ * return Result.file('./reports/latest.pdf', {filename: 'report.pdf', etag: 'v1'})
57
+ * }
58
+ *
59
+ * //A stream, with its content type
60
+ * @GET('/export')
61
+ * public async export(): Promise<FileResult> {
62
+ * return Result.file(Readable.from(['id,name\n', '1,Ada\n']), {contentType: 'text/csv'})
63
+ * }
64
+ * }
65
+ * ```
66
+ */
67
+ class FileResult extends ActionResult_js_1.ActionResult {
68
+ /**
69
+ * Create a file result.
70
+ * @param source The file's path (resolved from the working directory), its content, or a stream of its content.
71
+ * @param options How the file is sent.
72
+ */
73
+ constructor(source, options = {}) {
74
+ super();
75
+ this.source = source;
76
+ this.options = options;
77
+ }
78
+ /**
79
+ * The file's source.
80
+ */
81
+ get data() {
82
+ return this.source;
83
+ }
84
+ }
85
+ exports.FileResult = FileResult;
86
+ /**
87
+ * A stream of events: Server-Sent Events for the HTTP adapters, each event's data written as a line by the CLI
88
+ * adapter. Build it with `Result.events()`.
89
+ *
90
+ * The producer runs after the action returned, once the request's container is destroyed: it must only use objects
91
+ * living longer than the request (the components), not the controller's request-scoped dependencies.
92
+ * @example
93
+ * ```typescript
94
+ * import {Controller, Result, type EventsResult} from 'lakutata/com/entrypoint'
95
+ * import {GET} from 'lakutata/decorator/ctrl'
96
+ *
97
+ * class ClockController extends Controller {
98
+ * //The time every second until the client leaves
99
+ * @GET('/clock')
100
+ * public async clock(): Promise<EventsResult> {
101
+ * return Result.events(async (send, signal): Promise<void> => {
102
+ * while (!signal.aborted) {
103
+ * send({now: new Date().toISOString()}, 'tick')
104
+ * await new Promise((resolve): unknown => setTimeout(resolve, 1000))
105
+ * }
106
+ * })
107
+ * }
108
+ * }
109
+ * ```
110
+ */
111
+ class EventsResult extends ActionResult_js_1.ActionResult {
112
+ /**
113
+ * Create an event stream result.
114
+ * @param producer Produces the events.
115
+ */
116
+ constructor(producer) {
117
+ super();
118
+ this.producer = producer;
119
+ }
120
+ /**
121
+ * Always `undefined`: an event stream has no data of its own.
122
+ */
123
+ get data() {
124
+ return undefined;
125
+ }
126
+ }
127
+ exports.EventsResult = EventsResult;
128
+ /**
129
+ * Build the results an action returns to describe its output beyond its data.
130
+ */
131
+ exports.Result = {
132
+ /**
133
+ * Build a result with a status and headers.
134
+ * @param status The HTTP status.
135
+ * @param data The data sent.
136
+ * @param headers The response headers.
137
+ * @returns The {@link StatusResult}.
138
+ */
139
+ status: (status, data, headers) => new StatusResult(status, data, headers),
140
+ /**
141
+ * Build a file result.
142
+ * @param source The file's path (resolved from the working directory), its content, or a stream of its content.
143
+ * @param options How the file is sent.
144
+ * @returns The {@link FileResult}.
145
+ */
146
+ file: (source, options) => new FileResult(source, options),
147
+ /**
148
+ * Build an event stream result (Server-Sent Events for HTTP).
149
+ * @param producer Produces the events, after the action returned.
150
+ * @returns The {@link EventsResult}.
151
+ */
152
+ events: (producer) => new EventsResult(producer)
153
+ };
@@ -0,0 +1,82 @@
1
+ import { Exception } from '@lakutata/core';
2
+ /**
3
+ * The response of a service invocation, as the service transports (Socket.IO, Electron IPC, NATS…) send it.
4
+ */
5
+ export interface ServiceResponse {
6
+ /**
7
+ * Whether the invocation succeeded.
8
+ */
9
+ readonly success: boolean;
10
+ /**
11
+ * The failure: a serializable copy of the error's own properties (see {@link ServiceResponseCodec.errorObject});
12
+ * `null` on success.
13
+ */
14
+ readonly error: Error | Exception | null;
15
+ /**
16
+ * The action's result; `null` on failure.
17
+ */
18
+ readonly payload: any | null;
19
+ }
20
+ /**
21
+ * Encode the results and failures of service invocations as {@link ServiceResponse}s, and decode them on the
22
+ * caller's side. Used by the service adapters and the service clients; all its methods are static.
23
+ * @example
24
+ * ```typescript
25
+ * import {ServiceResponseCodec, type ServiceResponse} from '@lakutata/entrypoint/channel'
26
+ *
27
+ * //On the service side
28
+ * const ok: ServiceResponse = ServiceResponseCodec.encode({id: 1}, false)
29
+ * const failed: ServiceResponse = ServiceResponseCodec.encodeError(new Error('Not found'))
30
+ *
31
+ * //On the caller side
32
+ * console.log(ServiceResponseCodec.decode(ok)) //{id: 1}
33
+ * try {
34
+ * ServiceResponseCodec.decode(failed, 'order.service')
35
+ * } catch (error) {
36
+ * console.log((error as Error).message) //Not found (a ServiceInvokeException whose service is order.service)
37
+ * }
38
+ * ```
39
+ */
40
+ export declare class ServiceResponseCodec {
41
+ /**
42
+ * Copy an error into a serializable object: its own properties (message, stack, errno, errMsg, statusCode…). The
43
+ * values are copied as they are, not deeply.
44
+ * @param error The error; a value which is not an object gives `{message: String(error)}`.
45
+ * @returns The copy.
46
+ */
47
+ static errorObject(error: unknown): Record<string, unknown>;
48
+ /**
49
+ * Encode the failure of a service invocation.
50
+ * @param error The error, copied with {@link ServiceResponseCodec.errorObject}.
51
+ * @returns A failed response.
52
+ */
53
+ static encodeError(error: unknown): ServiceResponse;
54
+ /**
55
+ * The payload of an action's result for the service transports: the data of a `StatusResult` (its status and
56
+ * headers are HTTP's), the result itself otherwise.
57
+ * @param result The value the action returned.
58
+ * @returns The payload to send.
59
+ * @throws {TypeError} When it is a `FileResult` or an `EventsResult`, which only the HTTP adapters can send.
60
+ */
61
+ static payload(result: unknown): unknown;
62
+ /**
63
+ * Encode a service response.
64
+ * @param data The result (a `StatusResult` sent as its data, see {@link ServiceResponseCodec.payload}), or the
65
+ * error when `isError` is `true` (stored as it is: use {@link ServiceResponseCodec.encodeError} to make an error
66
+ * serializable).
67
+ * @param isError Whether `data` is an error.
68
+ * @returns The response.
69
+ * @throws {TypeError} When the result is a `FileResult` or an `EventsResult`.
70
+ */
71
+ static encode(data: any, isError: boolean): ServiceResponse;
72
+ /**
73
+ * Decode a service response: return its payload, or throw its error.
74
+ * @param response The response.
75
+ * @param serviceId The invoked service's id, set to the exception's `service`.
76
+ * @returns The payload of a successful response.
77
+ * @throws {ServiceInvokeException} When the response is a failure: its message is the remote error's message
78
+ * (`Unknown Error` without one), the remote error's enumerable properties (errno, statusCode…) are copied onto it,
79
+ * the read-only ones skipped.
80
+ */
81
+ static decode(response: ServiceResponse, serviceId?: string): any;
82
+ }
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ServiceResponseCodec = void 0;
4
+ const ServiceInvokeException_js_1 = require("../exceptions/ServiceInvokeException.js");
5
+ const ActionResult_js_1 = require("./ActionResult.js");
6
+ const Result_js_1 = require("./Result.js");
7
+ /**
8
+ * Encode the results and failures of service invocations as {@link ServiceResponse}s, and decode them on the
9
+ * caller's side. Used by the service adapters and the service clients; all its methods are static.
10
+ * @example
11
+ * ```typescript
12
+ * import {ServiceResponseCodec, type ServiceResponse} from '@lakutata/entrypoint/channel'
13
+ *
14
+ * //On the service side
15
+ * const ok: ServiceResponse = ServiceResponseCodec.encode({id: 1}, false)
16
+ * const failed: ServiceResponse = ServiceResponseCodec.encodeError(new Error('Not found'))
17
+ *
18
+ * //On the caller side
19
+ * console.log(ServiceResponseCodec.decode(ok)) //{id: 1}
20
+ * try {
21
+ * ServiceResponseCodec.decode(failed, 'order.service')
22
+ * } catch (error) {
23
+ * console.log((error as Error).message) //Not found (a ServiceInvokeException whose service is order.service)
24
+ * }
25
+ * ```
26
+ */
27
+ class ServiceResponseCodec {
28
+ /**
29
+ * Copy an error into a serializable object: its own properties (message, stack, errno, errMsg, statusCode…). The
30
+ * values are copied as they are, not deeply.
31
+ * @param error The error; a value which is not an object gives `{message: String(error)}`.
32
+ * @returns The copy.
33
+ */
34
+ static errorObject(error) {
35
+ if (!error || typeof error !== 'object')
36
+ return { message: String(error) };
37
+ const errorObject = {};
38
+ Object.getOwnPropertyNames(error).forEach((property) => errorObject[property] = error[property]);
39
+ return errorObject;
40
+ }
41
+ /**
42
+ * Encode the failure of a service invocation.
43
+ * @param error The error, copied with {@link ServiceResponseCodec.errorObject}.
44
+ * @returns A failed response.
45
+ */
46
+ static encodeError(error) {
47
+ return this.encode(this.errorObject(error), true);
48
+ }
49
+ /**
50
+ * The payload of an action's result for the service transports: the data of a `StatusResult` (its status and
51
+ * headers are HTTP's), the result itself otherwise.
52
+ * @param result The value the action returned.
53
+ * @returns The payload to send.
54
+ * @throws {TypeError} When it is a `FileResult` or an `EventsResult`, which only the HTTP adapters can send.
55
+ */
56
+ static payload(result) {
57
+ if (result instanceof Result_js_1.StatusResult)
58
+ return result.data;
59
+ if (result instanceof ActionResult_js_1.ActionResult)
60
+ throw new TypeError(`The service transports cannot send a ${result.constructor.name}: only the HTTP adapters send files and event streams`);
61
+ return result;
62
+ }
63
+ /**
64
+ * Encode a service response.
65
+ * @param data The result (a `StatusResult` sent as its data, see {@link ServiceResponseCodec.payload}), or the
66
+ * error when `isError` is `true` (stored as it is: use {@link ServiceResponseCodec.encodeError} to make an error
67
+ * serializable).
68
+ * @param isError Whether `data` is an error.
69
+ * @returns The response.
70
+ * @throws {TypeError} When the result is a `FileResult` or an `EventsResult`.
71
+ */
72
+ static encode(data, isError) {
73
+ if (!isError)
74
+ data = this.payload(data);
75
+ return isError ? {
76
+ success: false,
77
+ error: data,
78
+ payload: null
79
+ } : {
80
+ success: true,
81
+ error: null,
82
+ payload: data
83
+ };
84
+ }
85
+ /**
86
+ * Decode a service response: return its payload, or throw its error.
87
+ * @param response The response.
88
+ * @param serviceId The invoked service's id, set to the exception's `service`.
89
+ * @returns The payload of a successful response.
90
+ * @throws {ServiceInvokeException} When the response is a failure: its message is the remote error's message
91
+ * (`Unknown Error` without one), the remote error's enumerable properties (errno, statusCode…) are copied onto it,
92
+ * the read-only ones skipped.
93
+ */
94
+ static decode(response, serviceId) {
95
+ if (!response.success) {
96
+ const remoteError = response.error;
97
+ const serviceInvokeException = new ServiceInvokeException_js_1.ServiceInvokeException(remoteError?.message || 'Unknown Error');
98
+ //The properties of the remote error are copied one by one, the read-only ones (such as the name of a NatsError) are skipped
99
+ if (remoteError && typeof remoteError === 'object') {
100
+ for (const key of Object.keys(remoteError)) {
101
+ try {
102
+ serviceInvokeException[key] = remoteError[key];
103
+ }
104
+ catch {
105
+ //A read-only property
106
+ }
107
+ }
108
+ }
109
+ //The service invoked, whatever the remote error holds
110
+ if (serviceId)
111
+ serviceInvokeException.service = serviceId;
112
+ throw serviceInvokeException;
113
+ }
114
+ return response.payload;
115
+ }
116
+ }
117
+ exports.ServiceResponseCodec = ServiceResponseCodec;
@@ -0,0 +1,7 @@
1
+ import { ActionPattern } from '@lakutata/core';
2
+ /**
3
+ * Stringify pattern object
4
+ * @param pattern
5
+ * @constructor
6
+ */
7
+ export declare function stringifyPattern(pattern: ActionPattern): string;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stringifyPattern = stringifyPattern;
4
+ const utils_1 = require("@lakutata/utils");
5
+ function patternToArrayPair(pattern) {
6
+ switch (typeof pattern) {
7
+ case 'string':
8
+ return pattern;
9
+ case 'boolean':
10
+ return pattern ? 'true' : 'false';
11
+ case 'number':
12
+ return pattern.toString();
13
+ case 'bigint':
14
+ return undefined;
15
+ case 'symbol':
16
+ return undefined;
17
+ case 'function':
18
+ return undefined;
19
+ case 'undefined':
20
+ return undefined;
21
+ case 'object': {
22
+ if (Array.isArray(pattern)) {
23
+ const arrayData = [];
24
+ (0, utils_1.sortArray)(pattern, { order: 'asc' }).forEach((item) => {
25
+ const newItem = patternToArrayPair(item);
26
+ if (newItem === undefined)
27
+ return;
28
+ arrayData.push(newItem);
29
+ });
30
+ return arrayData;
31
+ }
32
+ else {
33
+ const keys = (0, utils_1.sortArray)(Object.keys(pattern), { order: 'asc' });
34
+ const data = [];
35
+ keys.forEach((key) => {
36
+ const item = patternToArrayPair(pattern[key]);
37
+ if (item === undefined)
38
+ return;
39
+ data.push([key, item]);
40
+ });
41
+ return data;
42
+ }
43
+ }
44
+ default:
45
+ return undefined;
46
+ }
47
+ }
48
+ /**
49
+ * Stringify pattern object
50
+ * @param pattern
51
+ * @constructor
52
+ */
53
+ function stringifyPattern(pattern) {
54
+ let pairArr = patternToArrayPair(pattern);
55
+ while (pairArr.find((value) => Array.isArray(value)))
56
+ pairArr = pairArr.flat();
57
+ return pairArr.join(':');
58
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Derived from index.js of unset-value 2.0.1, has-value 2.0.2, get-value 3.0.1, has-values 2.0.1, kind-of 6.0.3 and
3
+ * isobject 4.1.1 (MIT, see THIRD_PARTY_NOTICES.md): the removal of the properties of the patterns from the inputs of
4
+ * the actions, as 2.x
5
+ */
6
+ /**
7
+ * Remove a property of an object by its path (unset-value): a key holding the whole path first, the keys escaping
8
+ * their dots ("a\.b"); a property without value (has-value) is kept
9
+ * @param obj
10
+ * @param prop
11
+ */
12
+ export declare function unsetValue(obj: any, prop: string | string[]): boolean;