@gent-js/gent 0.1.4

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 (336) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +136 -0
  3. package/dist/generated/packageEnv.d.ts +5 -0
  4. package/dist/generated/packageEnv.js +7 -0
  5. package/dist/generated/packageEnv.js.map +1 -0
  6. package/dist/src/buildDocumentFromJsonTemplate.d.ts +3 -0
  7. package/dist/src/buildDocumentFromJsonTemplate.js +27 -0
  8. package/dist/src/buildDocumentFromJsonTemplate.js.map +1 -0
  9. package/dist/src/buildDocumentFromTextTemplate.d.ts +3 -0
  10. package/dist/src/buildDocumentFromTextTemplate.js +27 -0
  11. package/dist/src/buildDocumentFromTextTemplate.js.map +1 -0
  12. package/dist/src/cli.d.ts +2 -0
  13. package/dist/src/cli.js +103 -0
  14. package/dist/src/cli.js.map +1 -0
  15. package/dist/src/cliConsts.d.ts +3 -0
  16. package/dist/src/cliConsts.js +3 -0
  17. package/dist/src/cliConsts.js.map +1 -0
  18. package/dist/src/cliTypes.d.ts +7 -0
  19. package/dist/src/cliTypes.js +2 -0
  20. package/dist/src/cliTypes.js.map +1 -0
  21. package/dist/src/command/commandManager/commandManager.d.ts +7 -0
  22. package/dist/src/command/commandManager/commandManager.js +83 -0
  23. package/dist/src/command/commandManager/commandManager.js.map +1 -0
  24. package/dist/src/command/commandParser/commandParser.d.ts +11 -0
  25. package/dist/src/command/commandParser/commandParser.js +90 -0
  26. package/dist/src/command/commandParser/commandParser.js.map +1 -0
  27. package/dist/src/command/commandParser/parseCommand.d.ts +2 -0
  28. package/dist/src/command/commandParser/parseCommand.js +19 -0
  29. package/dist/src/command/commandParser/parseCommand.js.map +1 -0
  30. package/dist/src/command/commandParser/types.d.ts +33 -0
  31. package/dist/src/command/commandParser/types.js +2 -0
  32. package/dist/src/command/commandParser/types.js.map +1 -0
  33. package/dist/src/command/commandParser/visitor.d.ts +2 -0
  34. package/dist/src/command/commandParser/visitor.js +160 -0
  35. package/dist/src/command/commandParser/visitor.js.map +1 -0
  36. package/dist/src/command/commands/date/anytime.d.ts +2 -0
  37. package/dist/src/command/commands/date/anytime.js +8 -0
  38. package/dist/src/command/commands/date/anytime.js.map +1 -0
  39. package/dist/src/command/commands/date/timestamp.d.ts +2 -0
  40. package/dist/src/command/commands/date/timestamp.js +71 -0
  41. package/dist/src/command/commands/date/timestamp.js.map +1 -0
  42. package/dist/src/command/commands/finance/creditCardCVV.d.ts +2 -0
  43. package/dist/src/command/commands/finance/creditCardCVV.js +8 -0
  44. package/dist/src/command/commands/finance/creditCardCVV.js.map +1 -0
  45. package/dist/src/command/commands/finance/creditCardIssuer.d.ts +2 -0
  46. package/dist/src/command/commands/finance/creditCardIssuer.js +8 -0
  47. package/dist/src/command/commands/finance/creditCardIssuer.js.map +1 -0
  48. package/dist/src/command/commands/finance/creditCardNumber.d.ts +6 -0
  49. package/dist/src/command/commands/finance/creditCardNumber.js +12 -0
  50. package/dist/src/command/commands/finance/creditCardNumber.js.map +1 -0
  51. package/dist/src/command/commands/hacker/hacker.noun.d.ts +2 -0
  52. package/dist/src/command/commands/hacker/hacker.noun.js +8 -0
  53. package/dist/src/command/commands/hacker/hacker.noun.js.map +1 -0
  54. package/dist/src/command/commands/index.d.ts +1 -0
  55. package/dist/src/command/commands/index.js +95 -0
  56. package/dist/src/command/commands/index.js.map +1 -0
  57. package/dist/src/command/commands/internet/domainName.d.ts +2 -0
  58. package/dist/src/command/commands/internet/domainName.js +8 -0
  59. package/dist/src/command/commands/internet/domainName.js.map +1 -0
  60. package/dist/src/command/commands/internet/email.d.ts +2 -0
  61. package/dist/src/command/commands/internet/email.js +8 -0
  62. package/dist/src/command/commands/internet/email.js.map +1 -0
  63. package/dist/src/command/commands/internet/httpMethod.d.ts +2 -0
  64. package/dist/src/command/commands/internet/httpMethod.js +8 -0
  65. package/dist/src/command/commands/internet/httpMethod.js.map +1 -0
  66. package/dist/src/command/commands/internet/httpStatusCode.d.ts +2 -0
  67. package/dist/src/command/commands/internet/httpStatusCode.js +8 -0
  68. package/dist/src/command/commands/internet/httpStatusCode.js.map +1 -0
  69. package/dist/src/command/commands/internet/ip.d.ts +2 -0
  70. package/dist/src/command/commands/internet/ip.js +8 -0
  71. package/dist/src/command/commands/internet/ip.js.map +1 -0
  72. package/dist/src/command/commands/internet/ipv4.d.ts +2 -0
  73. package/dist/src/command/commands/internet/ipv4.js +8 -0
  74. package/dist/src/command/commands/internet/ipv4.js.map +1 -0
  75. package/dist/src/command/commands/internet/ipv6.d.ts +2 -0
  76. package/dist/src/command/commands/internet/ipv6.js +8 -0
  77. package/dist/src/command/commands/internet/ipv6.js.map +1 -0
  78. package/dist/src/command/commands/internet/mac.d.ts +2 -0
  79. package/dist/src/command/commands/internet/mac.js +8 -0
  80. package/dist/src/command/commands/internet/mac.js.map +1 -0
  81. package/dist/src/command/commands/internet/password.d.ts +6 -0
  82. package/dist/src/command/commands/internet/password.js +12 -0
  83. package/dist/src/command/commands/internet/password.js.map +1 -0
  84. package/dist/src/command/commands/internet/pri.d.ts +2 -0
  85. package/dist/src/command/commands/internet/pri.js +13 -0
  86. package/dist/src/command/commands/internet/pri.js.map +1 -0
  87. package/dist/src/command/commands/internet/url.d.ts +2 -0
  88. package/dist/src/command/commands/internet/url.js +8 -0
  89. package/dist/src/command/commands/internet/url.js.map +1 -0
  90. package/dist/src/command/commands/internet/userAgent.d.ts +2 -0
  91. package/dist/src/command/commands/internet/userAgent.js +8 -0
  92. package/dist/src/command/commands/internet/userAgent.js.map +1 -0
  93. package/dist/src/command/commands/internet/username.d.ts +2 -0
  94. package/dist/src/command/commands/internet/username.js +8 -0
  95. package/dist/src/command/commands/internet/username.js.map +1 -0
  96. package/dist/src/command/commands/location/country.d.ts +2 -0
  97. package/dist/src/command/commands/location/country.js +8 -0
  98. package/dist/src/command/commands/location/country.js.map +1 -0
  99. package/dist/src/command/commands/location/countryCode.d.ts +7 -0
  100. package/dist/src/command/commands/location/countryCode.js +13 -0
  101. package/dist/src/command/commands/location/countryCode.js.map +1 -0
  102. package/dist/src/command/commands/location/timeZone.d.ts +2 -0
  103. package/dist/src/command/commands/location/timeZone.js +8 -0
  104. package/dist/src/command/commands/location/timeZone.js.map +1 -0
  105. package/dist/src/command/commands/lorem/lorem.sentences.d.ts +7 -0
  106. package/dist/src/command/commands/lorem/lorem.sentences.js +14 -0
  107. package/dist/src/command/commands/lorem/lorem.sentences.js.map +1 -0
  108. package/dist/src/command/commands/number/int.d.ts +7 -0
  109. package/dist/src/command/commands/number/int.js +13 -0
  110. package/dist/src/command/commands/number/int.js.map +1 -0
  111. package/dist/src/command/commands/number/pid.d.ts +2 -0
  112. package/dist/src/command/commands/number/pid.js +14 -0
  113. package/dist/src/command/commands/number/pid.js.map +1 -0
  114. package/dist/src/command/commands/others/length.d.ts +7 -0
  115. package/dist/src/command/commands/others/length.js +13 -0
  116. package/dist/src/command/commands/others/length.js.map +1 -0
  117. package/dist/src/command/commands/phone/imei.d.ts +2 -0
  118. package/dist/src/command/commands/phone/imei.js +8 -0
  119. package/dist/src/command/commands/phone/imei.js.map +1 -0
  120. package/dist/src/command/commands/phone/phone.number.d.ts +6 -0
  121. package/dist/src/command/commands/phone/phone.number.js +12 -0
  122. package/dist/src/command/commands/phone/phone.number.js.map +1 -0
  123. package/dist/src/command/commands/string/alpha.d.ts +7 -0
  124. package/dist/src/command/commands/string/alpha.js +13 -0
  125. package/dist/src/command/commands/string/alpha.js.map +1 -0
  126. package/dist/src/command/commands/string/alphanumeric.d.ts +7 -0
  127. package/dist/src/command/commands/string/alphanumeric.js +13 -0
  128. package/dist/src/command/commands/string/alphanumeric.js.map +1 -0
  129. package/dist/src/command/commands/string/binary.d.ts +7 -0
  130. package/dist/src/command/commands/string/binary.js +13 -0
  131. package/dist/src/command/commands/string/binary.js.map +1 -0
  132. package/dist/src/command/commands/string/hexadecimal.d.ts +7 -0
  133. package/dist/src/command/commands/string/hexadecimal.js +13 -0
  134. package/dist/src/command/commands/string/hexadecimal.js.map +1 -0
  135. package/dist/src/command/commands/string/numeric.d.ts +6 -0
  136. package/dist/src/command/commands/string/numeric.js +12 -0
  137. package/dist/src/command/commands/string/numeric.js.map +1 -0
  138. package/dist/src/command/commands/string/octal.d.ts +7 -0
  139. package/dist/src/command/commands/string/octal.js +13 -0
  140. package/dist/src/command/commands/string/octal.js.map +1 -0
  141. package/dist/src/command/commands/string/ulid.d.ts +2 -0
  142. package/dist/src/command/commands/string/ulid.js +8 -0
  143. package/dist/src/command/commands/string/ulid.js.map +1 -0
  144. package/dist/src/command/commands/string/uuid.d.ts +2 -0
  145. package/dist/src/command/commands/string/uuid.js +8 -0
  146. package/dist/src/command/commands/string/uuid.js.map +1 -0
  147. package/dist/src/command/commands/system/directoryPath.d.ts +2 -0
  148. package/dist/src/command/commands/system/directoryPath.js +8 -0
  149. package/dist/src/command/commands/system/directoryPath.js.map +1 -0
  150. package/dist/src/command/commands/system/filePath.d.ts +2 -0
  151. package/dist/src/command/commands/system/filePath.js +8 -0
  152. package/dist/src/command/commands/system/filePath.js.map +1 -0
  153. package/dist/src/command/commands/system/mimeType.d.ts +2 -0
  154. package/dist/src/command/commands/system/mimeType.js +8 -0
  155. package/dist/src/command/commands/system/mimeType.js.map +1 -0
  156. package/dist/src/command/commands/system/networkInterface.d.ts +2 -0
  157. package/dist/src/command/commands/system/networkInterface.js +8 -0
  158. package/dist/src/command/commands/system/networkInterface.js.map +1 -0
  159. package/dist/src/command/commands/system/semver.d.ts +2 -0
  160. package/dist/src/command/commands/system/semver.js +8 -0
  161. package/dist/src/command/commands/system/semver.js.map +1 -0
  162. package/dist/src/command/consts.d.ts +3 -0
  163. package/dist/src/command/consts.js +4 -0
  164. package/dist/src/command/consts.js.map +1 -0
  165. package/dist/src/command/index.d.ts +4 -0
  166. package/dist/src/command/index.js +3 -0
  167. package/dist/src/command/index.js.map +1 -0
  168. package/dist/src/command/type.d.ts +22 -0
  169. package/dist/src/command/type.js +2 -0
  170. package/dist/src/command/type.js.map +1 -0
  171. package/dist/src/command/utils.d.ts +2 -0
  172. package/dist/src/command/utils.js +9 -0
  173. package/dist/src/command/utils.js.map +1 -0
  174. package/dist/src/commandDocument/buildCommandDocumentFragments.d.ts +4 -0
  175. package/dist/src/commandDocument/buildCommandDocumentFragments.js +12 -0
  176. package/dist/src/commandDocument/buildCommandDocumentFragments.js.map +1 -0
  177. package/dist/src/commandDocument/createCommandDocumentFragment.d.ts +3 -0
  178. package/dist/src/commandDocument/createCommandDocumentFragment.js +14 -0
  179. package/dist/src/commandDocument/createCommandDocumentFragment.js.map +1 -0
  180. package/dist/src/commandDocument/index.d.ts +1 -0
  181. package/dist/src/commandDocument/index.js +2 -0
  182. package/dist/src/commandDocument/index.js.map +1 -0
  183. package/dist/src/commandTemplate/index.d.ts +2 -0
  184. package/dist/src/commandTemplate/index.js +3 -0
  185. package/dist/src/commandTemplate/index.js.map +1 -0
  186. package/dist/src/commandTemplate/parseAndEmbedCommandExpression.d.ts +3 -0
  187. package/dist/src/commandTemplate/parseAndEmbedCommandExpression.js +12 -0
  188. package/dist/src/commandTemplate/parseAndEmbedCommandExpression.js.map +1 -0
  189. package/dist/src/commandTemplate/types.d.ts +3 -0
  190. package/dist/src/commandTemplate/types.js +2 -0
  191. package/dist/src/commandTemplate/types.js.map +1 -0
  192. package/dist/src/common/weightedItemFeeder.d.ts +15 -0
  193. package/dist/src/common/weightedItemFeeder.js +67 -0
  194. package/dist/src/common/weightedItemFeeder.js.map +1 -0
  195. package/dist/src/consts.d.ts +14 -0
  196. package/dist/src/consts.js +17 -0
  197. package/dist/src/consts.js.map +1 -0
  198. package/dist/src/createDocumentFeeder.d.ts +5 -0
  199. package/dist/src/createDocumentFeeder.js +64 -0
  200. package/dist/src/createDocumentFeeder.js.map +1 -0
  201. package/dist/src/createGeneratingDocumentStream.d.ts +4 -0
  202. package/dist/src/createGeneratingDocumentStream.js +33 -0
  203. package/dist/src/createGeneratingDocumentStream.js.map +1 -0
  204. package/dist/src/createGeneratingLogStream.d.ts +4 -0
  205. package/dist/src/createGeneratingLogStream.js +21 -0
  206. package/dist/src/createGeneratingLogStream.js.map +1 -0
  207. package/dist/src/debugFileWriter.d.ts +5 -0
  208. package/dist/src/debugFileWriter.js +33 -0
  209. package/dist/src/debugFileWriter.js.map +1 -0
  210. package/dist/src/document/createDocumentContextIterator.d.ts +2 -0
  211. package/dist/src/document/createDocumentContextIterator.js +15 -0
  212. package/dist/src/document/createDocumentContextIterator.js.map +1 -0
  213. package/dist/src/document/generatingDocument.d.ts +7 -0
  214. package/dist/src/document/generatingDocument.js +13 -0
  215. package/dist/src/document/generatingDocument.js.map +1 -0
  216. package/dist/src/document/index.d.ts +4 -0
  217. package/dist/src/document/index.js +4 -0
  218. package/dist/src/document/index.js.map +1 -0
  219. package/dist/src/document/types.d.ts +20 -0
  220. package/dist/src/document/types.js +2 -0
  221. package/dist/src/document/types.js.map +1 -0
  222. package/dist/src/document/utils.d.ts +2 -0
  223. package/dist/src/document/utils.js +9 -0
  224. package/dist/src/document/utils.js.map +1 -0
  225. package/dist/src/index.d.ts +1 -0
  226. package/dist/src/index.js +2 -0
  227. package/dist/src/index.js.map +1 -0
  228. package/dist/src/json/abstractJsonable.d.ts +12 -0
  229. package/dist/src/json/abstractJsonable.js +33 -0
  230. package/dist/src/json/abstractJsonable.js.map +1 -0
  231. package/dist/src/json/createJsonable.d.ts +3 -0
  232. package/dist/src/json/createJsonable.js +31 -0
  233. package/dist/src/json/createJsonable.js.map +1 -0
  234. package/dist/src/json/createJsonableTransformer.d.ts +4 -0
  235. package/dist/src/json/createJsonableTransformer.js +251 -0
  236. package/dist/src/json/createJsonableTransformer.js.map +1 -0
  237. package/dist/src/json/index.d.ts +6 -0
  238. package/dist/src/json/index.js +4 -0
  239. package/dist/src/json/index.js.map +1 -0
  240. package/dist/src/json/jsonConsts.d.ts +1 -0
  241. package/dist/src/json/jsonConsts.js +9 -0
  242. package/dist/src/json/jsonConsts.js.map +1 -0
  243. package/dist/src/json/jsonTypes.d.ts +8 -0
  244. package/dist/src/json/jsonTypes.js +2 -0
  245. package/dist/src/json/jsonTypes.js.map +1 -0
  246. package/dist/src/json/jsonableClasses/arrayJsonable.d.ts +11 -0
  247. package/dist/src/json/jsonableClasses/arrayJsonable.js +40 -0
  248. package/dist/src/json/jsonableClasses/arrayJsonable.js.map +1 -0
  249. package/dist/src/json/jsonableClasses/booleanJsonable.d.ts +8 -0
  250. package/dist/src/json/jsonableClasses/booleanJsonable.js +15 -0
  251. package/dist/src/json/jsonableClasses/booleanJsonable.js.map +1 -0
  252. package/dist/src/json/jsonableClasses/nullJsonable.d.ts +8 -0
  253. package/dist/src/json/jsonableClasses/nullJsonable.js +11 -0
  254. package/dist/src/json/jsonableClasses/nullJsonable.js.map +1 -0
  255. package/dist/src/json/jsonableClasses/numberJsonable.d.ts +9 -0
  256. package/dist/src/json/jsonableClasses/numberJsonable.js +18 -0
  257. package/dist/src/json/jsonableClasses/numberJsonable.js.map +1 -0
  258. package/dist/src/json/jsonableClasses/objectJsonable.d.ts +10 -0
  259. package/dist/src/json/jsonableClasses/objectJsonable.js +14 -0
  260. package/dist/src/json/jsonableClasses/objectJsonable.js.map +1 -0
  261. package/dist/src/json/jsonableClasses/stringJsonable.d.ts +9 -0
  262. package/dist/src/json/jsonableClasses/stringJsonable.js +15 -0
  263. package/dist/src/json/jsonableClasses/stringJsonable.js.map +1 -0
  264. package/dist/src/json/jsonableParametersConsts.d.ts +7 -0
  265. package/dist/src/json/jsonableParametersConsts.js +8 -0
  266. package/dist/src/json/jsonableParametersConsts.js.map +1 -0
  267. package/dist/src/json/jsonableParametersTypes.d.ts +32 -0
  268. package/dist/src/json/jsonableParametersTypes.js +2 -0
  269. package/dist/src/json/jsonableParametersTypes.js.map +1 -0
  270. package/dist/src/json/jsonableTypes.d.ts +11 -0
  271. package/dist/src/json/jsonableTypes.js +2 -0
  272. package/dist/src/json/jsonableTypes.js.map +1 -0
  273. package/dist/src/json/parseJsonable.d.ts +2 -0
  274. package/dist/src/json/parseJsonable.js +19 -0
  275. package/dist/src/json/parseJsonable.js.map +1 -0
  276. package/dist/src/json/stringifyJsonable.d.ts +6 -0
  277. package/dist/src/json/stringifyJsonable.js +43 -0
  278. package/dist/src/json/stringifyJsonable.js.map +1 -0
  279. package/dist/src/json/utils.d.ts +2 -0
  280. package/dist/src/json/utils.js +9 -0
  281. package/dist/src/json/utils.js.map +1 -0
  282. package/dist/src/output/createFileOutput.d.ts +2 -0
  283. package/dist/src/output/createFileOutput.js +28 -0
  284. package/dist/src/output/createFileOutput.js.map +1 -0
  285. package/dist/src/output/createTcpOutput.d.ts +3 -0
  286. package/dist/src/output/createTcpOutput.js +15 -0
  287. package/dist/src/output/createTcpOutput.js.map +1 -0
  288. package/dist/src/output/createUdpOutput.d.ts +3 -0
  289. package/dist/src/output/createUdpOutput.js +5 -0
  290. package/dist/src/output/createUdpOutput.js.map +1 -0
  291. package/dist/src/output/initializeOutput.d.ts +3 -0
  292. package/dist/src/output/initializeOutput.js +38 -0
  293. package/dist/src/output/initializeOutput.js.map +1 -0
  294. package/dist/src/output/tcpDocumentStream.d.ts +16 -0
  295. package/dist/src/output/tcpDocumentStream.js +107 -0
  296. package/dist/src/output/tcpDocumentStream.js.map +1 -0
  297. package/dist/src/output/throttlingDocumentStream.d.ts +21 -0
  298. package/dist/src/output/throttlingDocumentStream.js +69 -0
  299. package/dist/src/output/throttlingDocumentStream.js.map +1 -0
  300. package/dist/src/output/udpDocumentStream.d.ts +13 -0
  301. package/dist/src/output/udpDocumentStream.js +47 -0
  302. package/dist/src/output/udpDocumentStream.js.map +1 -0
  303. package/dist/src/output/updStream.d.ts +17 -0
  304. package/dist/src/output/updStream.js +78 -0
  305. package/dist/src/output/updStream.js.map +1 -0
  306. package/dist/src/run.d.ts +4 -0
  307. package/dist/src/run.js +55 -0
  308. package/dist/src/run.js.map +1 -0
  309. package/dist/src/template/consts.d.ts +2 -0
  310. package/dist/src/template/consts.js +3 -0
  311. package/dist/src/template/consts.js.map +1 -0
  312. package/dist/src/template/index.d.ts +4 -0
  313. package/dist/src/template/index.js +4 -0
  314. package/dist/src/template/index.js.map +1 -0
  315. package/dist/src/template/templateParser/parseTemplate.d.ts +2 -0
  316. package/dist/src/template/templateParser/parseTemplate.js +11 -0
  317. package/dist/src/template/templateParser/parseTemplate.js.map +1 -0
  318. package/dist/src/template/templateParser/templateParser.d.ts +11 -0
  319. package/dist/src/template/templateParser/templateParser.js +87 -0
  320. package/dist/src/template/templateParser/templateParser.js.map +1 -0
  321. package/dist/src/template/templateParser/visitor.d.ts +4 -0
  322. package/dist/src/template/templateParser/visitor.js +60 -0
  323. package/dist/src/template/templateParser/visitor.js.map +1 -0
  324. package/dist/src/template/types.d.ts +5 -0
  325. package/dist/src/template/types.js +2 -0
  326. package/dist/src/template/types.js.map +1 -0
  327. package/dist/src/template/utils.d.ts +2 -0
  328. package/dist/src/template/utils.js +4 -0
  329. package/dist/src/template/utils.js.map +1 -0
  330. package/dist/src/types.d.ts +68 -0
  331. package/dist/src/types.js +3 -0
  332. package/dist/src/types.js.map +1 -0
  333. package/dist/src/utils.d.ts +18 -0
  334. package/dist/src/utils.js +321 -0
  335. package/dist/src/utils.js.map +1 -0
  336. package/package.json +47 -0
@@ -0,0 +1,10 @@
1
+ import { type DocumentContext } from "../../document/index.js";
2
+ import { AbstractJsonable } from "../abstractJsonable.js";
3
+ import type { JsonableObject } from "../jsonableTypes.js";
4
+ import type { JsonObject } from "../jsonTypes.js";
5
+ export declare class ObjectJsonable extends AbstractJsonable {
6
+ private readonly content;
7
+ readonly type: "object";
8
+ constructor(content: JsonableObject, probability: number | undefined, weight: number | undefined);
9
+ protected toJSONImpl(keyOrIndex: string | number, context: DocumentContext): JsonObject | undefined;
10
+ }
@@ -0,0 +1,14 @@
1
+ import { AbstractJsonable } from "../abstractJsonable.js";
2
+ import { transformJsonableObjectIntoJsonObject } from "../stringifyJsonable.js";
3
+ export class ObjectJsonable extends AbstractJsonable {
4
+ content;
5
+ type = "object";
6
+ constructor(content, probability, weight) {
7
+ super(probability, weight);
8
+ this.content = content;
9
+ }
10
+ toJSONImpl(keyOrIndex, context) {
11
+ return transformJsonableObjectIntoJsonObject(this.content, keyOrIndex, context);
12
+ }
13
+ }
14
+ //# sourceMappingURL=objectJsonable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objectJsonable.js","sourceRoot":"","sources":["../../../../src/json/jsonableClasses/objectJsonable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,qCAAqC,EAAE,MAAM,yBAAyB,CAAC;AAEhF,MAAM,OAAO,cAAe,SAAQ,gBAAgB;IAI/B;IAHH,IAAI,GAAG,QAAiB,CAAC;IAEzC,YACmB,OAAuB,EACxC,WAA+B,EAC/B,MAA0B;QAE1B,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QAJV,YAAO,GAAP,OAAO,CAAgB;IAK1C,CAAC;IAES,UAAU,CAClB,UAA2B,EAC3B,OAAwB;QAExB,OAAO,qCAAqC,CAC1C,IAAI,CAAC,OAAO,EACZ,UAAU,EACV,OAAO,CACR,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import { type DocumentContent, type DocumentContext } from "../../document/index.js";
2
+ import { AbstractJsonable } from "../abstractJsonable.js";
3
+ import type { JsonString } from "../jsonTypes.js";
4
+ export declare class StringJsonable extends AbstractJsonable {
5
+ private readonly content;
6
+ readonly type: "string";
7
+ constructor(content: DocumentContent, probability: number | undefined, weight: number | undefined);
8
+ protected toJSONImpl(keyOrIndex: string | number, context: DocumentContext): JsonString | undefined;
9
+ }
@@ -0,0 +1,15 @@
1
+ import { stampDocument, } from "../../document/index.js";
2
+ import { AbstractJsonable } from "../abstractJsonable.js";
3
+ export class StringJsonable extends AbstractJsonable {
4
+ content;
5
+ type = "string";
6
+ constructor(content, probability, weight) {
7
+ super(probability, weight);
8
+ this.content = content;
9
+ }
10
+ toJSONImpl(keyOrIndex, context) {
11
+ const output = stampDocument(this.content, context);
12
+ return output;
13
+ }
14
+ }
15
+ //# sourceMappingURL=stringJsonable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringJsonable.js","sourceRoot":"","sources":["../../../../src/json/jsonableClasses/stringJsonable.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,GACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,MAAM,OAAO,cAAe,SAAQ,gBAAgB;IAI/B;IAHH,IAAI,GAAG,QAAiB,CAAC;IAEzC,YACmB,OAAwB,EACzC,WAA+B,EAC/B,MAA0B;QAE1B,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QAJV,YAAO,GAAP,OAAO,CAAiB;IAK3C,CAAC;IAES,UAAU,CAClB,UAA2B,EAC3B,OAAwB;QAExB,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ export declare const JsonableTypeParameterName: "type";
2
+ export declare const JsonableContentParameterName: "content";
3
+ export declare const JsonableProbabilityParameterName: "probability";
4
+ export declare const JsonableLengthParameterName: "length";
5
+ export declare const JsonableWeightParameterName: "weight";
6
+ export declare const MIN_PROBABILITY = 0;
7
+ export declare const MAX_PROBABILITY = 100;
@@ -0,0 +1,8 @@
1
+ export const JsonableTypeParameterName = "type";
2
+ export const JsonableContentParameterName = "content";
3
+ export const JsonableProbabilityParameterName = "probability";
4
+ export const JsonableLengthParameterName = "length";
5
+ export const JsonableWeightParameterName = "weight";
6
+ export const MIN_PROBABILITY = 0;
7
+ export const MAX_PROBABILITY = 100;
8
+ //# sourceMappingURL=jsonableParametersConsts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonableParametersConsts.js","sourceRoot":"","sources":["../../../src/json/jsonableParametersConsts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAe,CAAC;AACzD,MAAM,CAAC,MAAM,4BAA4B,GAAG,SAAkB,CAAC;AAC/D,MAAM,CAAC,MAAM,gCAAgC,GAAG,aAAsB,CAAC;AACvE,MAAM,CAAC,MAAM,2BAA2B,GAAG,QAAiB,CAAC;AAC7D,MAAM,CAAC,MAAM,2BAA2B,GAAG,QAAiB,CAAC;AAE7D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { DocumentContent } from "../document/index.js";
2
+ import type { JsonableObject, JsonableValue, JsonValueType } from "./jsonableTypes.js";
3
+ export interface PrimitiveJsonableParameters {
4
+ readonly type: JsonValueType;
5
+ readonly probability: number | undefined;
6
+ readonly weight: number | undefined;
7
+ }
8
+ export interface ObjectJsonableParameters extends PrimitiveJsonableParameters {
9
+ readonly type: "object";
10
+ readonly content: JsonableObject;
11
+ }
12
+ export interface ArrayJsonableParameters extends PrimitiveJsonableParameters {
13
+ readonly type: "array";
14
+ readonly content: readonly JsonableValue[];
15
+ readonly length: DocumentContent;
16
+ }
17
+ export interface StringJsonableParameters extends PrimitiveJsonableParameters {
18
+ readonly type: "string";
19
+ readonly content: DocumentContent;
20
+ }
21
+ export interface NumberJsonableParameters extends PrimitiveJsonableParameters {
22
+ readonly type: "number";
23
+ readonly content: DocumentContent;
24
+ }
25
+ export interface BooleanJsonableParameters extends PrimitiveJsonableParameters {
26
+ readonly type: "boolean";
27
+ readonly content: DocumentContent;
28
+ }
29
+ export interface NullJsonableParameters extends PrimitiveJsonableParameters {
30
+ readonly type: "null";
31
+ }
32
+ export type JsonableValueParameters = ObjectJsonableParameters | ArrayJsonableParameters | StringJsonableParameters | NumberJsonableParameters | BooleanJsonableParameters | NullJsonableParameters;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=jsonableParametersTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonableParametersTypes.js","sourceRoot":"","sources":["../../../src/json/jsonableParametersTypes.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import type { AbstractJsonable } from "./abstractJsonable.js";
2
+ import type { JsonValueTypes } from "./jsonConsts.js";
3
+ import type { JsonBoolean, JsonNull, JsonNumber, JsonString, JsonValue } from "./jsonTypes.js";
4
+ export type JsonValueType = (typeof JsonValueTypes)[number];
5
+ export type JsonableValue = AbstractJsonable | JsonableObject | JsonableValue[] | JsonString | JsonNumber | JsonBoolean | JsonNull;
6
+ export type JsonableObject = {
7
+ [key: string]: JsonableValue;
8
+ };
9
+ export interface JsonableTransformer {
10
+ (value: JsonValue): JsonableValue | undefined;
11
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=jsonableTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonableTypes.js","sourceRoot":"","sources":["../../../src/json/jsonableTypes.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import type { JsonableTransformer, JsonableValue } from "./jsonableTypes.js";
2
+ export declare function parseJsonable(input: string, jsonableTransformer: JsonableTransformer): JsonableValue | undefined;
@@ -0,0 +1,19 @@
1
+ export function parseJsonable(input, jsonableTransformer) {
2
+ let jsonValue;
3
+ try {
4
+ jsonValue = JSON.parse(input);
5
+ }
6
+ catch (error) {
7
+ console.error(error);
8
+ jsonValue = undefined;
9
+ }
10
+ if (jsonValue === undefined) {
11
+ return undefined;
12
+ }
13
+ const jsonableValue = jsonableTransformer(jsonValue);
14
+ if (jsonableValue === undefined) {
15
+ return undefined;
16
+ }
17
+ return jsonableValue;
18
+ }
19
+ //# sourceMappingURL=parseJsonable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseJsonable.js","sourceRoot":"","sources":["../../../src/json/parseJsonable.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,aAAa,CAC3B,KAAa,EACb,mBAAwC;IAExC,IAAI,SAAgC,CAAC;IACrC,IAAI,CAAC;QACH,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,SAAS,GAAG,SAAS,CAAC;IACxB,CAAC;IAED,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,aAAa,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACrD,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { DocumentContext } from "../document/index.js";
2
+ import type { JsonableObject, JsonableValue } from "./jsonableTypes.js";
3
+ import type { JsonObject, JsonValue } from "./jsonTypes.js";
4
+ export declare function stringifyJsonable(value: JsonableValue, keyOrIndex: string | number, context: DocumentContext): string | undefined;
5
+ export declare function transformJsonableIntoJsonValue(value: JsonableValue, keyOrIndex: string | number, context: DocumentContext): JsonValue | undefined;
6
+ export declare function transformJsonableObjectIntoJsonObject(jsonableObject: JsonableObject, keyOrIndex: string | number, context: DocumentContext): JsonObject | undefined;
@@ -0,0 +1,43 @@
1
+ import { AbstractJsonable } from "./abstractJsonable.js";
2
+ export function stringifyJsonable(value, keyOrIndex, context) {
3
+ const jsonValue = transformJsonableIntoJsonValue(value, keyOrIndex, context);
4
+ if (jsonValue === undefined) {
5
+ return "";
6
+ }
7
+ return JSON.stringify(jsonValue);
8
+ }
9
+ export function transformJsonableIntoJsonValue(value, keyOrIndex, context) {
10
+ if (value instanceof AbstractJsonable) {
11
+ return value.toJSON(keyOrIndex, context);
12
+ }
13
+ else if (value === null ||
14
+ typeof value === "boolean" ||
15
+ typeof value === "number" ||
16
+ typeof value === "string") {
17
+ return value;
18
+ }
19
+ else if (Array.isArray(value)) {
20
+ return value
21
+ .map((item) => transformJsonableIntoJsonValue(item, keyOrIndex, context))
22
+ .filter((jsonValue) => jsonValue !== undefined);
23
+ }
24
+ else {
25
+ return transformJsonableObjectIntoJsonObject(value, keyOrIndex, context);
26
+ }
27
+ }
28
+ export function transformJsonableObjectIntoJsonObject(jsonableObject, keyOrIndex, context) {
29
+ let jsonObject = {};
30
+ Object.keys(jsonableObject).forEach((memberKey) => {
31
+ const memberValue = jsonableObject[memberKey];
32
+ if (memberValue === undefined) {
33
+ return;
34
+ }
35
+ const memberJsonValue = transformJsonableIntoJsonValue(memberValue, memberKey, context);
36
+ if (memberJsonValue === undefined) {
37
+ return;
38
+ }
39
+ jsonObject[memberKey] = memberJsonValue;
40
+ });
41
+ return jsonObject;
42
+ }
43
+ //# sourceMappingURL=stringifyJsonable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringifyJsonable.js","sourceRoot":"","sources":["../../../src/json/stringifyJsonable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAIzD,MAAM,UAAU,iBAAiB,CAC/B,KAAoB,EACpB,UAA2B,EAC3B,OAAwB;IAExB,MAAM,SAAS,GAAG,8BAA8B,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAC7E,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,8BAA8B,CAC5C,KAAoB,EACpB,UAA2B,EAC3B,OAAwB;IAExB,IAAI,KAAK,YAAY,gBAAgB,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;SAAM,IACL,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,SAAS;QAC1B,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,QAAQ,EACzB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,OAAO,KAAK;aACT,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,8BAA8B,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;aACxE,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;IACpD,CAAC;SAAM,CAAC;QACN,OAAO,qCAAqC,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC;AAED,MAAM,UAAU,qCAAqC,CACnD,cAA8B,EAC9B,UAA2B,EAC3B,OAAwB;IAExB,IAAI,UAAU,GAAe,EAAE,CAAC;IAChC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;QAChD,MAAM,WAAW,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,OAAO;QACT,CAAC;QACD,MAAM,eAAe,GAAG,8BAA8B,CACpD,WAAW,EACX,SAAS,EACT,OAAO,CACR,CAAC;QACF,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;YAClC,OAAO;QACT,CAAC;QACD,UAAU,CAAC,SAAS,CAAC,GAAG,eAAe,CAAC;IAC1C,CAAC,CAAC,CAAC;IACH,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { JsonValueType } from "./jsonableTypes.js";
2
+ export declare function isJsonValueType(value: unknown): value is JsonValueType;
@@ -0,0 +1,9 @@
1
+ import { JsonValueTypes } from "./jsonConsts.js";
2
+ export function isJsonValueType(value) {
3
+ if (typeof value !== "string") {
4
+ return false;
5
+ }
6
+ const candidates = JsonValueTypes;
7
+ return candidates.includes(value);
8
+ }
9
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/json/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,UAAU,GAAsB,cAAc,CAAC;IACrD,OAAO,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import * as stream from "node:stream";
2
+ export declare function createFileOutput(nonRotateOutputPath: string, rotateSize: string | undefined, rotateOutputPathGenerator: (additionalPhrase: string) => string): Promise<stream.Writable>;
@@ -0,0 +1,28 @@
1
+ import * as fs from "node:fs";
2
+ import * as rfs from "rotating-file-stream";
3
+ export async function createFileOutput(nonRotateOutputPath, rotateSize, rotateOutputPathGenerator) {
4
+ if (rotateSize === undefined) {
5
+ // no file rotation
6
+ return fs.createWriteStream(nonRotateOutputPath);
7
+ }
8
+ else {
9
+ // rotate file by size
10
+ return rfs.createStream((indexOrDate, indexOrUndefined) => {
11
+ if (indexOrDate === null) {
12
+ return nonRotateOutputPath;
13
+ }
14
+ let index;
15
+ if (typeof indexOrDate === "number") {
16
+ index = indexOrDate;
17
+ }
18
+ else if (typeof indexOrUndefined === "number") {
19
+ index = indexOrUndefined;
20
+ }
21
+ else {
22
+ index = 0;
23
+ }
24
+ return rotateOutputPathGenerator(index.toString());
25
+ }, { size: rotateSize });
26
+ }
27
+ }
28
+ //# sourceMappingURL=createFileOutput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createFileOutput.js","sourceRoot":"","sources":["../../../src/output/createFileOutput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,KAAK,GAAG,MAAM,sBAAsB,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,mBAA2B,EAC3B,UAA8B,EAC9B,yBAA+D;IAE/D,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,mBAAmB;QACnB,OAAO,EAAE,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;IACnD,CAAC;SAAM,CAAC;QACN,sBAAsB;QACtB,OAAO,GAAG,CAAC,YAAY,CACrB,CAAC,WAAW,EAAE,gBAAgB,EAAE,EAAE;YAChC,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;gBACzB,OAAO,mBAAmB,CAAC;YAC7B,CAAC;YACD,IAAI,KAAa,CAAC;YAClB,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;gBACpC,KAAK,GAAG,WAAW,CAAC;YACtB,CAAC;iBAAM,IAAI,OAAO,gBAAgB,KAAK,QAAQ,EAAE,CAAC;gBAChD,KAAK,GAAG,gBAAgB,CAAC;YAC3B,CAAC;iBAAM,CAAC;gBACN,KAAK,GAAG,CAAC,CAAC;YACZ,CAAC;YACD,OAAO,yBAAyB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrD,CAAC,EACD,EAAE,IAAI,EAAE,UAAU,EAAE,CACrB,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import * as stream from "node:stream";
2
+ import type { TcpOutputOptions } from "../types.js";
3
+ export declare function createTcpOutput(outputOptions: TcpOutputOptions): Promise<stream.Writable>;
@@ -0,0 +1,15 @@
1
+ import * as dnsPromises from "node:dns/promises";
2
+ import * as net from "node:net";
3
+ export async function createTcpOutput(outputOptions) {
4
+ const lookupAddress = await dnsPromises.lookup(outputOptions.address, {
5
+ verbatim: true,
6
+ });
7
+ const tcpOptions = {
8
+ host: outputOptions.address,
9
+ port: outputOptions.port,
10
+ family: lookupAddress.family,
11
+ };
12
+ const client = net.connect(tcpOptions);
13
+ return client;
14
+ }
15
+ //# sourceMappingURL=createTcpOutput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTcpOutput.js","sourceRoot":"","sources":["../../../src/output/createTcpOutput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAIhC,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,aAA+B;IAE/B,MAAM,aAAa,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE;QACpE,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IACH,MAAM,UAAU,GAA0B;QACxC,IAAI,EAAE,aAAa,CAAC,OAAO;QAC3B,IAAI,EAAE,aAAa,CAAC,IAAI;QACxB,MAAM,EAAE,aAAa,CAAC,MAAM;KAC7B,CAAC;IACF,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import * as stream from "node:stream";
2
+ import type { UdpOutputOptions } from "../types.js";
3
+ export declare function createUdpOutput(outputOptions: UdpOutputOptions): Promise<stream.Writable>;
@@ -0,0 +1,5 @@
1
+ import { UpdStream } from "./updStream.js";
2
+ export async function createUdpOutput(outputOptions) {
3
+ return new UpdStream(outputOptions);
4
+ }
5
+ //# sourceMappingURL=createUdpOutput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createUdpOutput.js","sourceRoot":"","sources":["../../../src/output/createUdpOutput.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,aAA+B;IAE/B,OAAO,IAAI,SAAS,CAAC,aAAa,CAAC,CAAC;AACtC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import * as stream from "node:stream";
2
+ import type { OutputOptions } from "../types.js";
3
+ export declare function initializeOutput(outputOptions: OutputOptions): Promise<stream.Writable>;
@@ -0,0 +1,38 @@
1
+ import { globIterate } from "glob";
2
+ import * as fsPromises from "node:fs/promises";
3
+ import * as nodePath from "node:path";
4
+ import { assertNever } from "../utils.js";
5
+ import { createFileOutput } from "./createFileOutput.js";
6
+ import { TcpDocumentStream } from "./tcpDocumentStream.js";
7
+ import { UdpDocumentStream } from "./udpDocumentStream.js";
8
+ export async function initializeOutput(outputOptions) {
9
+ // region clean dir
10
+ const nonRotateOutputPath = outputOptions.path;
11
+ const parsed = nodePath.parse(outputOptions.path);
12
+ const rotateOutputPathGenerator = (additionalPhrase) => {
13
+ const filename = `${parsed.name}.${additionalPhrase}${parsed.ext}`;
14
+ return nodePath.join(parsed.dir, filename);
15
+ };
16
+ const nonRotateOutputGlobPath = nonRotateOutputPath.replaceAll("\\", "/");
17
+ const rotateOutputGlobPath = rotateOutputPathGenerator("*").replaceAll("\\", "/");
18
+ await cleanOutputDir(nonRotateOutputGlobPath, rotateOutputGlobPath);
19
+ // endregion
20
+ if (outputOptions.type === "file") {
21
+ return createFileOutput(nonRotateOutputPath, outputOptions.size, rotateOutputPathGenerator);
22
+ }
23
+ else if (outputOptions.type === "udp") {
24
+ return new UdpDocumentStream(outputOptions);
25
+ }
26
+ else if (outputOptions.type === "tcp") {
27
+ return new TcpDocumentStream(outputOptions);
28
+ }
29
+ else {
30
+ return assertNever(outputOptions);
31
+ }
32
+ }
33
+ async function cleanOutputDir(...globPaths) {
34
+ for await (const path of globIterate(globPaths)) {
35
+ await fsPromises.rm(path);
36
+ }
37
+ }
38
+ //# sourceMappingURL=initializeOutput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initializeOutput.js","sourceRoot":"","sources":["../../../src/output/initializeOutput.ts"],"names":[],"mappings":"A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AAC,IAAI,KAAK,KAAK,EAAE,CAAC;QACxC,OAAO,IAAI,iBAAiB,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;SAAM,IAAI,aAAa,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QACxC,OAAO,IAAI,iBAAiB,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;SAAM,CAAC;QACN,OAAO,WAAW,CAAC,aAAa,CAAC,CAAC;IACpC,CAAC;AACH,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,GAAG,SAAmB;IAClD,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;QAChD,MAAM,UAAU,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { GeneratingDocument } from "../document/index.js";
2
+ import type { TcpOutputOptions } from "../types.js";
3
+ import { ThrottlingDocumentStream } from "./throttlingDocumentStream.js";
4
+ export declare class TcpDocumentStream extends ThrottlingDocumentStream {
5
+ private readonly address;
6
+ private readonly port;
7
+ private readonly framing;
8
+ private readonly trailerReplacer;
9
+ private family;
10
+ private client;
11
+ constructor(options: TcpOutputOptions);
12
+ _construct(callback: (error?: Error | null) => void): void;
13
+ _throttledWrite(chunk: GeneratingDocument, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
14
+ protected _throttledFinal(callback: (error?: Error | null) => void): void;
15
+ protected _throttledDestroy(error: Error | null, callback: (error?: Error | null) => void): void;
16
+ }
@@ -0,0 +1,107 @@
1
+ import { Buffer } from "node:buffer";
2
+ import * as dnsPromises from "node:dns/promises";
3
+ import * as net from "node:net";
4
+ import { TrailerMap } from "../consts.js";
5
+ import { ThrottlingDocumentStream } from "./throttlingDocumentStream.js";
6
+ const SP = " ";
7
+ export class TcpDocumentStream extends ThrottlingDocumentStream {
8
+ address;
9
+ port;
10
+ framing;
11
+ trailerReplacer;
12
+ family;
13
+ client;
14
+ constructor(options) {
15
+ super(options.eps);
16
+ this.address = options.address;
17
+ this.port = options.port;
18
+ if (options.framing === "octet-counting") {
19
+ this.framing = options.framing;
20
+ }
21
+ else {
22
+ this.framing = options.framing;
23
+ this.trailerReplacer = options.trailerReplacer;
24
+ }
25
+ }
26
+ _construct(callback) {
27
+ dnsPromises
28
+ .lookup(this.address, {
29
+ verbatim: true,
30
+ })
31
+ .then((lookupAddress) => {
32
+ this.family = lookupAddress.family;
33
+ callback();
34
+ })
35
+ .catch((reason) => callback(reason));
36
+ }
37
+ _throttledWrite(chunk, encoding, callback) {
38
+ const family = this.family;
39
+ if (family === undefined) {
40
+ callback(new Error("called write before family has not been determined."));
41
+ return;
42
+ }
43
+ let client = this.client;
44
+ if (client === undefined) {
45
+ const tcpOptions = {
46
+ host: this.address,
47
+ port: this.port,
48
+ family: this.family,
49
+ };
50
+ client = net.connect(tcpOptions);
51
+ this.client = client;
52
+ }
53
+ const outputString = chunk.stamp();
54
+ let output;
55
+ if (this.framing === "lf") {
56
+ const trailerReplacer = this.trailerReplacer;
57
+ if (trailerReplacer !== undefined) {
58
+ const trailer = TrailerMap[this.framing];
59
+ output = outputString.replaceAll(trailer, trailerReplacer) + trailer;
60
+ }
61
+ else {
62
+ const trailer = TrailerMap[this.framing];
63
+ output = outputString + trailer;
64
+ }
65
+ }
66
+ else if (this.framing === "octet-counting") {
67
+ const messageBuf8 = Buffer.from(outputString, "utf-8");
68
+ const lengthCount = messageBuf8.length.toString();
69
+ const lengthBuf8 = Buffer.from(lengthCount + SP, "utf-8");
70
+ output = Buffer.concat([lengthBuf8, messageBuf8]);
71
+ }
72
+ else {
73
+ callback(new Error(`unexpected framing type ${this.framing}`));
74
+ return;
75
+ }
76
+ client.write(output, (error) => {
77
+ if (error !== null) {
78
+ callback(error);
79
+ return;
80
+ }
81
+ callback();
82
+ });
83
+ }
84
+ _throttledFinal(callback) {
85
+ const client = this.client;
86
+ if (client === undefined) {
87
+ callback();
88
+ return;
89
+ }
90
+ client.end(callback);
91
+ }
92
+ _throttledDestroy(error, callback) {
93
+ const client = this.client;
94
+ if (client === undefined) {
95
+ callback(error);
96
+ return;
97
+ }
98
+ if (error !== null) {
99
+ client.destroy(error);
100
+ }
101
+ else {
102
+ client.destroy();
103
+ }
104
+ callback(error);
105
+ }
106
+ }
107
+ //# sourceMappingURL=tcpDocumentStream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tcpDocumentStream.js","sourceRoot":"","sources":["../../../src/output/tcpDocumentStream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,MAAM,EAAE,GAAG,GAAY,CAAC;AAExB,MAAM,OAAO,iBAAkB,SAAQ,wBAAwB;IAC5C,OAAO,CAAS;IAChB,IAAI,CAAS;IACb,OAAO,CAAiB;IACxB,eAAe,CAAqB;IAE7C,MAAM,CAAqB;IAC3B,MAAM,CAAyB;IAEvC,YAAY,OAAyB;QACnC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAEnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,OAAO,CAAC,OAAO,KAAK,gBAAgB,EAAE,CAAC;YACzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;YAC/B,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QACjD,CAAC;IACH,CAAC;IAEe,UAAU,CAAC,QAAwC;QAC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IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,QAAQ,CAAC,KAAK,CAAC,CAAC;YAChB,OAAO;QACT,CAAC;QACD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC;QACD,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC;CACF"}
@@ -0,0 +1,21 @@
1
+ import * as stream from "node:stream";
2
+ import { GeneratingDocument } from "../document/index.js";
3
+ export declare abstract class ThrottlingDocumentStream extends stream.Writable {
4
+ private readonly window;
5
+ private readonly eventPerWindow;
6
+ private readonly windowInternalTimeout;
7
+ private eventInCurrentWindow;
8
+ private pendingWriteTasks;
9
+ private nThWindow;
10
+ private totalNumOfEvent;
11
+ protected constructor(eps: number, debug?: boolean);
12
+ private debugReport;
13
+ _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
14
+ protected abstract _throttledWrite(chunk: GeneratingDocument, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
15
+ private _flushPendingWriteTasks;
16
+ private _clearWindowInternal;
17
+ _final(callback: (error?: Error | null) => void): void;
18
+ protected abstract _throttledFinal(callback: (error?: Error | null) => void): void;
19
+ _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
20
+ protected abstract _throttledDestroy(error: Error | null, callback: (error?: Error | null) => void): void;
21
+ }
@@ -0,0 +1,69 @@
1
+ import * as stream from "node:stream";
2
+ import { GeneratingDocument } from "../document/index.js";
3
+ const Per1000Window = 1000;
4
+ const Per100Window = 100;
5
+ export class ThrottlingDocumentStream extends stream.Writable {
6
+ window;
7
+ eventPerWindow;
8
+ windowInternalTimeout;
9
+ eventInCurrentWindow;
10
+ pendingWriteTasks = [];
11
+ nThWindow = 0;
12
+ totalNumOfEvent = 0;
13
+ constructor(eps, debug = false) {
14
+ super({
15
+ objectMode: true,
16
+ });
17
+ if (eps < Per100Window) {
18
+ this.window = Per1000Window;
19
+ }
20
+ else {
21
+ this.window = Per100Window;
22
+ }
23
+ this.eventPerWindow = Math.ceil(eps * (this.window / 1000));
24
+ this.eventInCurrentWindow = 0;
25
+ this.windowInternalTimeout = setInterval(() => {
26
+ this._flushPendingWriteTasks();
27
+ if (debug) {
28
+ this.debugReport();
29
+ }
30
+ this.eventInCurrentWindow = 0;
31
+ }, this.window);
32
+ }
33
+ debugReport() {
34
+ this.totalNumOfEvent = this.totalNumOfEvent + this.eventInCurrentWindow;
35
+ this.nThWindow = this.nThWindow + 1;
36
+ console.log(`[${this.nThWindow}] => ${this.eventInCurrentWindow}/${this.totalNumOfEvent}`);
37
+ }
38
+ _write(chunk, encoding, callback) {
39
+ if (!(chunk instanceof GeneratingDocument)) {
40
+ callback(new Error(`Unexpected chunk type(${typeof chunk}). Cannot process any chunk type except Document.`));
41
+ return;
42
+ }
43
+ if (this.eventInCurrentWindow < this.eventPerWindow) {
44
+ this._throttledWrite(chunk, encoding, callback);
45
+ this.eventInCurrentWindow = this.eventInCurrentWindow + 1;
46
+ return;
47
+ }
48
+ this.pendingWriteTasks.push([chunk, encoding, callback]);
49
+ }
50
+ _flushPendingWriteTasks() {
51
+ const tasks = this.pendingWriteTasks;
52
+ this.pendingWriteTasks = [];
53
+ tasks.forEach(([chunk, encoding, callback]) => this._throttledWrite(chunk, encoding, callback));
54
+ }
55
+ _clearWindowInternal() {
56
+ clearInterval(this.windowInternalTimeout);
57
+ }
58
+ _final(callback) {
59
+ this._flushPendingWriteTasks();
60
+ this._clearWindowInternal();
61
+ this._throttledFinal(callback);
62
+ }
63
+ _destroy(error, callback) {
64
+ this._flushPendingWriteTasks();
65
+ this._clearWindowInternal();
66
+ this._throttledDestroy(error, callback);
67
+ }
68
+ }
69
+ //# sourceMappingURL=throttlingDocumentStream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thro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B,EAAE,CAAC;QAC/B,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;IAMe,QAAQ,CACtB,KAAmB,EACnB,QAAwC;QAExC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC/B,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;CAMF"}
@@ -0,0 +1,13 @@
1
+ import { GeneratingDocument } from "../document/index.js";
2
+ import type { UdpOutputOptions } from "../types.js";
3
+ import { ThrottlingDocumentStream } from "./throttlingDocumentStream.js";
4
+ export declare class UdpDocumentStream extends ThrottlingDocumentStream {
5
+ private readonly address;
6
+ private readonly port;
7
+ private socketType;
8
+ constructor(options: UdpOutputOptions);
9
+ _construct(callback: (error?: Error | null) => void): void;
10
+ _throttledWrite(chunk: GeneratingDocument, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
11
+ protected _throttledFinal(callback: (error?: Error | null) => void): void;
12
+ protected _throttledDestroy(error: Error | null, callback: (error?: Error | null) => void): void;
13
+ }