sonamu 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (406) hide show
  1. package/.swcrc.project-default +18 -0
  2. package/bin/cli.js +24 -0
  3. package/dist/ai/agents/agent.d.ts +11 -0
  4. package/dist/ai/agents/agent.d.ts.map +1 -0
  5. package/dist/ai/agents/agent.js +65 -0
  6. package/dist/ai/agents/index.d.ts +3 -0
  7. package/dist/ai/agents/index.d.ts.map +1 -0
  8. package/dist/ai/agents/index.js +4 -0
  9. package/dist/ai/agents/types.d.ts +43 -0
  10. package/dist/ai/agents/types.d.ts.map +1 -0
  11. package/dist/ai/agents/types.js +3 -0
  12. package/dist/ai/index.d.ts +2 -0
  13. package/dist/ai/index.d.ts.map +1 -0
  14. package/dist/ai/index.js +3 -0
  15. package/dist/ai/providers/rtzr/api.d.ts +22 -0
  16. package/dist/ai/providers/rtzr/api.d.ts.map +1 -0
  17. package/dist/ai/providers/rtzr/api.js +28 -0
  18. package/dist/ai/providers/rtzr/error.d.ts +18 -0
  19. package/dist/ai/providers/rtzr/error.d.ts.map +1 -0
  20. package/dist/ai/providers/rtzr/error.js +29 -0
  21. package/dist/ai/providers/rtzr/index.d.ts +5 -0
  22. package/dist/ai/providers/rtzr/index.d.ts.map +1 -0
  23. package/dist/ai/providers/rtzr/index.js +6 -0
  24. package/dist/ai/providers/rtzr/model.d.ts +52 -0
  25. package/dist/ai/providers/rtzr/model.d.ts.map +1 -0
  26. package/dist/ai/providers/rtzr/model.js +137 -0
  27. package/dist/ai/providers/rtzr/options.d.ts +7 -0
  28. package/dist/ai/providers/rtzr/options.d.ts.map +1 -0
  29. package/dist/ai/providers/rtzr/options.js +47 -0
  30. package/dist/ai/providers/rtzr/provider.d.ts +18 -0
  31. package/dist/ai/providers/rtzr/provider.d.ts.map +1 -0
  32. package/dist/ai/providers/rtzr/provider.js +54 -0
  33. package/dist/ai/providers/rtzr/utils.d.ts +19 -0
  34. package/dist/ai/providers/rtzr/utils.d.ts.map +1 -0
  35. package/dist/ai/providers/rtzr/utils.js +88 -0
  36. package/dist/api/base-frame.d.ts +2 -2
  37. package/dist/api/base-frame.d.ts.map +1 -1
  38. package/dist/api/base-frame.js +2 -1
  39. package/dist/api/caster.d.ts.map +1 -1
  40. package/dist/api/caster.js +6 -1
  41. package/dist/api/code-converters.d.ts +58 -14
  42. package/dist/api/code-converters.d.ts.map +1 -1
  43. package/dist/api/code-converters.js +178 -409
  44. package/dist/api/config.d.ts +27 -13
  45. package/dist/api/config.d.ts.map +1 -1
  46. package/dist/api/config.js +19 -26
  47. package/dist/api/context.d.ts +4 -3
  48. package/dist/api/context.d.ts.map +1 -1
  49. package/dist/api/context.js +1 -1
  50. package/dist/api/decorators.d.ts +20 -6
  51. package/dist/api/decorators.d.ts.map +1 -1
  52. package/dist/api/decorators.js +111 -18
  53. package/dist/api/index.d.ts +2 -2
  54. package/dist/api/index.d.ts.map +1 -1
  55. package/dist/api/index.js +3 -3
  56. package/dist/api/sonamu.d.ts +7 -7
  57. package/dist/api/sonamu.d.ts.map +1 -1
  58. package/dist/api/sonamu.js +83 -51
  59. package/dist/api/validator.d.ts +6 -0
  60. package/dist/api/validator.d.ts.map +1 -0
  61. package/dist/api/validator.js +81 -0
  62. package/dist/bin/build-config.d.ts +5 -1
  63. package/dist/bin/build-config.d.ts.map +1 -1
  64. package/dist/bin/build-config.js +5 -2
  65. package/dist/bin/cli.js +165 -64
  66. package/dist/bin/loader-register.d.ts +2 -0
  67. package/dist/bin/loader-register.d.ts.map +1 -0
  68. package/dist/bin/loader-register.js +34 -0
  69. package/dist/database/_batch_update.d.ts +5 -3
  70. package/dist/database/_batch_update.d.ts.map +1 -1
  71. package/dist/database/_batch_update.js +30 -13
  72. package/dist/database/base-model.d.ts +96 -10
  73. package/dist/database/base-model.d.ts.map +1 -1
  74. package/dist/database/base-model.js +232 -89
  75. package/dist/database/base-model.types.d.ts +93 -0
  76. package/dist/database/base-model.types.d.ts.map +1 -0
  77. package/dist/database/base-model.types.js +10 -0
  78. package/dist/database/code-generator.d.ts +1 -1
  79. package/dist/database/code-generator.d.ts.map +1 -1
  80. package/dist/database/code-generator.js +11 -10
  81. package/dist/database/db.d.ts +5 -6
  82. package/dist/database/db.d.ts.map +1 -1
  83. package/dist/database/db.js +22 -25
  84. package/dist/database/puri-subset.test-d.js +81 -0
  85. package/dist/database/puri-subset.types.d.ts +123 -0
  86. package/dist/database/puri-subset.types.d.ts.map +1 -0
  87. package/dist/database/puri-subset.types.js +16 -0
  88. package/dist/database/puri-wrapper.d.ts +13 -11
  89. package/dist/database/puri-wrapper.d.ts.map +1 -1
  90. package/dist/database/puri-wrapper.js +2 -2
  91. package/dist/database/puri.d.ts +25 -14
  92. package/dist/database/puri.d.ts.map +1 -1
  93. package/dist/database/puri.js +83 -21
  94. package/dist/database/puri.types.d.ts +21 -7
  95. package/dist/database/puri.types.d.ts.map +1 -1
  96. package/dist/database/puri.types.js +4 -1
  97. package/dist/database/transaction-context.d.ts +1 -1
  98. package/dist/database/transaction-context.d.ts.map +1 -1
  99. package/dist/database/transaction-context.js +1 -1
  100. package/dist/database/upsert-builder.d.ts +9 -3
  101. package/dist/database/upsert-builder.d.ts.map +1 -1
  102. package/dist/database/upsert-builder.js +227 -78
  103. package/dist/entity/entity-manager.d.ts +165 -2
  104. package/dist/entity/entity-manager.d.ts.map +1 -1
  105. package/dist/entity/entity-manager.js +26 -10
  106. package/dist/entity/entity.d.ts +5 -3
  107. package/dist/entity/entity.d.ts.map +1 -1
  108. package/dist/entity/entity.js +153 -54
  109. package/dist/exceptions/error-handler.d.ts +1 -1
  110. package/dist/exceptions/error-handler.d.ts.map +1 -1
  111. package/dist/exceptions/error-handler.js +1 -1
  112. package/dist/exceptions/so-exceptions.d.ts +1 -1
  113. package/dist/exceptions/so-exceptions.d.ts.map +1 -1
  114. package/dist/exceptions/so-exceptions.js +1 -1
  115. package/dist/file-storage/driver.d.ts +1 -1
  116. package/dist/file-storage/driver.d.ts.map +1 -1
  117. package/dist/file-storage/driver.js +1 -1
  118. package/dist/file-storage/file-storage.js +2 -2
  119. package/dist/index.d.ts +18 -11
  120. package/dist/index.d.ts.map +1 -1
  121. package/dist/index.js +19 -13
  122. package/dist/migration/code-generation.d.ts +1 -1
  123. package/dist/migration/code-generation.d.ts.map +1 -1
  124. package/dist/migration/code-generation.js +123 -67
  125. package/dist/migration/migration-set.d.ts +2 -10
  126. package/dist/migration/migration-set.d.ts.map +1 -1
  127. package/dist/migration/migration-set.js +67 -218
  128. package/dist/migration/migrator.d.ts +24 -73
  129. package/dist/migration/migrator.d.ts.map +1 -1
  130. package/dist/migration/migrator.js +121 -301
  131. package/dist/migration/postgresql-schema-reader.d.ts +51 -0
  132. package/dist/migration/postgresql-schema-reader.d.ts.map +1 -0
  133. package/dist/migration/postgresql-schema-reader.js +245 -0
  134. package/dist/migration/types.d.ts +6 -38
  135. package/dist/migration/types.d.ts.map +1 -1
  136. package/dist/migration/types.js +1 -1
  137. package/dist/naite/messaging-types.d.ts +43 -0
  138. package/dist/naite/messaging-types.d.ts.map +1 -0
  139. package/dist/naite/messaging-types.js +7 -0
  140. package/dist/naite/naite-reporter.d.ts +41 -0
  141. package/dist/naite/naite-reporter.d.ts.map +1 -0
  142. package/dist/naite/naite-reporter.js +102 -0
  143. package/dist/naite/naite.d.ts +91 -8
  144. package/dist/naite/naite.d.ts.map +1 -1
  145. package/dist/naite/naite.js +285 -41
  146. package/dist/stream/sse.d.ts +2 -2
  147. package/dist/stream/sse.d.ts.map +1 -1
  148. package/dist/stream/sse.js +1 -1
  149. package/dist/syncer/api-parser.d.ts +3 -13
  150. package/dist/syncer/api-parser.d.ts.map +1 -1
  151. package/dist/syncer/api-parser.js +67 -56
  152. package/dist/syncer/checksum.d.ts +2 -2
  153. package/dist/syncer/checksum.d.ts.map +1 -1
  154. package/dist/syncer/checksum.js +11 -11
  155. package/dist/syncer/code-generator.d.ts +3 -3
  156. package/dist/syncer/code-generator.d.ts.map +1 -1
  157. package/dist/syncer/code-generator.js +37 -17
  158. package/dist/syncer/entity-operations.d.ts +2 -2
  159. package/dist/syncer/entity-operations.d.ts.map +1 -1
  160. package/dist/syncer/entity-operations.js +9 -8
  161. package/dist/syncer/file-patterns.d.ts +1 -1
  162. package/dist/syncer/file-patterns.d.ts.map +1 -1
  163. package/dist/syncer/file-patterns.js +1 -1
  164. package/dist/syncer/index.d.ts +4 -4
  165. package/dist/syncer/index.d.ts.map +1 -1
  166. package/dist/syncer/index.js +5 -5
  167. package/dist/syncer/module-loader.d.ts +4 -4
  168. package/dist/syncer/module-loader.d.ts.map +1 -1
  169. package/dist/syncer/module-loader.js +17 -12
  170. package/dist/syncer/syncer.d.ts +31 -24
  171. package/dist/syncer/syncer.d.ts.map +1 -1
  172. package/dist/syncer/syncer.js +92 -45
  173. package/dist/template/entity-converter.d.ts +1 -1
  174. package/dist/template/entity-converter.d.ts.map +1 -1
  175. package/dist/template/entity-converter.js +15 -8
  176. package/dist/template/helpers.d.ts +2 -2
  177. package/dist/template/helpers.d.ts.map +1 -1
  178. package/dist/template/helpers.js +3 -3
  179. package/dist/template/implementations/entity.template.d.ts +2 -2
  180. package/dist/template/implementations/entity.template.d.ts.map +1 -1
  181. package/dist/template/implementations/entity.template.js +4 -5
  182. package/dist/template/implementations/generated.template.d.ts +2 -3
  183. package/dist/template/implementations/generated.template.d.ts.map +1 -1
  184. package/dist/template/implementations/generated.template.js +46 -29
  185. package/dist/template/implementations/generated_http.template.d.ts +2 -3
  186. package/dist/template/implementations/generated_http.template.d.ts.map +1 -1
  187. package/dist/template/implementations/generated_http.template.js +9 -9
  188. package/dist/template/implementations/generated_sso.template.d.ts +3 -4
  189. package/dist/template/implementations/generated_sso.template.d.ts.map +1 -1
  190. package/dist/template/implementations/generated_sso.template.js +54 -25
  191. package/dist/template/implementations/init_types.template.d.ts +2 -2
  192. package/dist/template/implementations/init_types.template.d.ts.map +1 -1
  193. package/dist/template/implementations/init_types.template.js +2 -2
  194. package/dist/template/implementations/model.template.d.ts +2 -2
  195. package/dist/template/implementations/model.template.d.ts.map +1 -1
  196. package/dist/template/implementations/model.template.js +47 -37
  197. package/dist/template/implementations/model_test.template.d.ts +2 -2
  198. package/dist/template/implementations/model_test.template.d.ts.map +1 -1
  199. package/dist/template/implementations/model_test.template.js +2 -2
  200. package/dist/template/implementations/service.template.d.ts +4 -4
  201. package/dist/template/implementations/service.template.d.ts.map +1 -1
  202. package/dist/template/implementations/service.template.js +24 -16
  203. package/dist/template/implementations/view_enums_buttonset.template.d.ts +2 -2
  204. package/dist/template/implementations/view_enums_buttonset.template.d.ts.map +1 -1
  205. package/dist/template/implementations/view_enums_buttonset.template.js +1 -1
  206. package/dist/template/implementations/view_enums_dropdown.template.d.ts +2 -2
  207. package/dist/template/implementations/view_enums_dropdown.template.d.ts.map +1 -1
  208. package/dist/template/implementations/view_enums_dropdown.template.js +2 -2
  209. package/dist/template/implementations/view_enums_select.template.d.ts +2 -2
  210. package/dist/template/implementations/view_enums_select.template.d.ts.map +1 -1
  211. package/dist/template/implementations/view_enums_select.template.js +2 -2
  212. package/dist/template/implementations/view_form.template.d.ts +2 -2
  213. package/dist/template/implementations/view_form.template.d.ts.map +1 -1
  214. package/dist/template/implementations/view_form.template.js +4 -4
  215. package/dist/template/implementations/view_id_all_select.template.d.ts +2 -2
  216. package/dist/template/implementations/view_id_all_select.template.d.ts.map +1 -1
  217. package/dist/template/implementations/view_id_all_select.template.js +1 -1
  218. package/dist/template/implementations/view_id_async_select.template.d.ts +2 -2
  219. package/dist/template/implementations/view_id_async_select.template.d.ts.map +1 -1
  220. package/dist/template/implementations/view_id_async_select.template.js +1 -1
  221. package/dist/template/implementations/view_list.template.d.ts +2 -2
  222. package/dist/template/implementations/view_list.template.d.ts.map +1 -1
  223. package/dist/template/implementations/view_list.template.js +29 -19
  224. package/dist/template/implementations/view_list_columns.template.d.ts +3 -3
  225. package/dist/template/implementations/view_list_columns.template.d.ts.map +1 -1
  226. package/dist/template/implementations/view_list_columns.template.js +1 -1
  227. package/dist/template/implementations/view_search_input.template.d.ts +2 -2
  228. package/dist/template/implementations/view_search_input.template.d.ts.map +1 -1
  229. package/dist/template/implementations/view_search_input.template.js +1 -1
  230. package/dist/template/index.d.ts +4 -2
  231. package/dist/template/index.d.ts.map +1 -1
  232. package/dist/template/index.js +5 -3
  233. package/dist/template/template-manager.d.ts +56 -0
  234. package/dist/template/template-manager.d.ts.map +1 -0
  235. package/dist/template/template-manager.js +125 -0
  236. package/dist/template/template-types.d.ts +16 -0
  237. package/dist/template/template-types.d.ts.map +1 -0
  238. package/dist/template/template-types.js +7 -0
  239. package/dist/template/template.d.ts +12 -2
  240. package/dist/template/template.d.ts.map +1 -1
  241. package/dist/template/template.js +19 -6
  242. package/dist/template/zod-converter.d.ts +40 -7
  243. package/dist/template/zod-converter.d.ts.map +1 -1
  244. package/dist/template/zod-converter.js +386 -58
  245. package/dist/testing/_relation-graph.d.ts +1 -1
  246. package/dist/testing/_relation-graph.d.ts.map +1 -1
  247. package/dist/testing/_relation-graph.js +12 -3
  248. package/dist/testing/fixture-manager.d.ts +42 -11
  249. package/dist/testing/fixture-manager.d.ts.map +1 -1
  250. package/dist/testing/fixture-manager.js +338 -236
  251. package/dist/types/types.d.ts +709 -104
  252. package/dist/types/types.d.ts.map +1 -1
  253. package/dist/types/types.js +309 -52
  254. package/dist/typings/knex.d.js +2 -2
  255. package/dist/utils/async-utils.d.ts.map +1 -1
  256. package/dist/utils/async-utils.js +3 -3
  257. package/dist/utils/console-util.js +1 -1
  258. package/dist/utils/controller.d.ts +1 -0
  259. package/dist/utils/controller.d.ts.map +1 -1
  260. package/dist/utils/controller.js +4 -1
  261. package/dist/utils/esm-utils.d.ts +0 -6
  262. package/dist/utils/esm-utils.d.ts.map +1 -1
  263. package/dist/utils/esm-utils.js +2 -9
  264. package/dist/utils/formatter.d.ts +3 -0
  265. package/dist/utils/formatter.d.ts.map +1 -0
  266. package/dist/utils/formatter.js +110 -0
  267. package/dist/utils/fs-utils.d.ts +1 -1
  268. package/dist/utils/fs-utils.d.ts.map +1 -1
  269. package/dist/utils/fs-utils.js +1 -1
  270. package/dist/utils/lodash-able.d.ts.map +1 -1
  271. package/dist/utils/lodash-able.js +1 -1
  272. package/dist/utils/object-utils.d.ts +44 -0
  273. package/dist/utils/object-utils.d.ts.map +1 -0
  274. package/dist/utils/object-utils.js +191 -0
  275. package/dist/utils/path-utils.d.ts +1 -1
  276. package/dist/utils/path-utils.d.ts.map +1 -1
  277. package/dist/utils/path-utils.js +3 -3
  278. package/dist/utils/process-utils.js +1 -1
  279. package/dist/utils/sql-parser.d.ts +5 -1
  280. package/dist/utils/sql-parser.d.ts.map +1 -1
  281. package/dist/utils/sql-parser.js +14 -3
  282. package/dist/utils/type-utils.d.ts +23 -0
  283. package/dist/utils/type-utils.d.ts.map +1 -0
  284. package/dist/utils/type-utils.js +45 -0
  285. package/dist/utils/utils.d.ts +7 -1
  286. package/dist/utils/utils.d.ts.map +1 -1
  287. package/dist/utils/utils.js +44 -5
  288. package/dist/utils/zod-error.d.ts +1 -1
  289. package/dist/utils/zod-error.d.ts.map +1 -1
  290. package/dist/utils/zod-error.js +1 -1
  291. package/package.json +55 -30
  292. package/src/ai/agents/agent.ts +87 -0
  293. package/src/ai/agents/index.ts +2 -0
  294. package/src/ai/agents/types.ts +47 -0
  295. package/src/ai/index.ts +1 -0
  296. package/src/ai/providers/rtzr/api.ts +37 -0
  297. package/src/ai/providers/rtzr/error.ts +34 -0
  298. package/src/ai/providers/rtzr/index.ts +4 -0
  299. package/src/ai/providers/rtzr/model.ts +201 -0
  300. package/src/ai/providers/rtzr/options.ts +49 -0
  301. package/src/ai/providers/rtzr/provider.ts +91 -0
  302. package/src/ai/providers/rtzr/utils.ts +127 -0
  303. package/src/api/base-frame.ts +4 -2
  304. package/src/api/caster.ts +17 -23
  305. package/src/api/code-converters.ts +176 -533
  306. package/src/api/config.ts +39 -56
  307. package/src/api/context.ts +7 -18
  308. package/src/api/decorators.ts +175 -46
  309. package/src/api/index.ts +2 -2
  310. package/src/api/sonamu.ts +133 -124
  311. package/src/api/validator.ts +83 -0
  312. package/src/bin/build-config.ts +7 -1
  313. package/src/bin/cli.ts +192 -110
  314. package/src/bin/loader-register.ts +38 -0
  315. package/src/database/_batch_update.ts +46 -31
  316. package/src/database/base-model.ts +390 -182
  317. package/src/database/base-model.types.ts +155 -0
  318. package/src/database/code-generator.ts +13 -32
  319. package/src/database/db.ts +36 -50
  320. package/src/database/puri-subset.test-d.ts +471 -0
  321. package/src/database/puri-subset.types.ts +195 -0
  322. package/src/database/puri-wrapper.ts +58 -67
  323. package/src/database/puri.ts +182 -126
  324. package/src/database/puri.types.ts +64 -31
  325. package/src/database/transaction-context.ts +1 -1
  326. package/src/database/upsert-builder.ts +261 -132
  327. package/src/entity/entity-manager.ts +36 -28
  328. package/src/entity/entity.ts +330 -249
  329. package/src/exceptions/error-handler.ts +3 -3
  330. package/src/exceptions/so-exceptions.ts +11 -11
  331. package/src/file-storage/driver.ts +5 -5
  332. package/src/file-storage/file-storage.ts +2 -2
  333. package/src/index.ts +18 -12
  334. package/src/migration/code-generation.ts +185 -172
  335. package/src/migration/migration-set.ts +80 -293
  336. package/src/migration/migrator.ts +182 -425
  337. package/src/migration/mysql-schema-reader.ts.txt +272 -0
  338. package/src/migration/postgresql-schema-reader.ts +310 -0
  339. package/src/migration/types.ts +6 -39
  340. package/src/naite/messaging-types.ts +51 -0
  341. package/src/naite/naite-reporter.ts +128 -0
  342. package/src/naite/naite.ts +378 -33
  343. package/src/shared/web.shared.ts.txt +20 -24
  344. package/src/stream/sse.ts +5 -5
  345. package/src/syncer/api-parser.ts +52 -69
  346. package/src/syncer/checksum.ts +25 -37
  347. package/src/syncer/code-generator.ts +58 -62
  348. package/src/syncer/entity-operations.ts +12 -15
  349. package/src/syncer/file-patterns.ts +2 -2
  350. package/src/syncer/index.ts +4 -4
  351. package/src/syncer/module-loader.ts +28 -25
  352. package/src/syncer/syncer.ts +155 -162
  353. package/src/template/entity-converter.ts +18 -27
  354. package/src/template/helpers.ts +8 -11
  355. package/src/template/implementations/entity.template.ts +6 -6
  356. package/src/template/implementations/generated.template.ts +99 -99
  357. package/src/template/implementations/generated_http.template.ts +21 -54
  358. package/src/template/implementations/generated_sso.template.ts +78 -65
  359. package/src/template/implementations/init_types.template.ts +4 -6
  360. package/src/template/implementations/model.template.ts +47 -38
  361. package/src/template/implementations/model_test.template.ts +3 -3
  362. package/src/template/implementations/service.template.ts +56 -80
  363. package/src/template/implementations/view_enums_buttonset.template.ts +2 -2
  364. package/src/template/implementations/view_enums_dropdown.template.ts +4 -4
  365. package/src/template/implementations/view_enums_select.template.ts +3 -3
  366. package/src/template/implementations/view_form.template.ts +34 -75
  367. package/src/template/implementations/view_id_all_select.template.ts +2 -2
  368. package/src/template/implementations/view_id_async_select.template.ts +9 -23
  369. package/src/template/implementations/view_list.template.ts +54 -95
  370. package/src/template/implementations/view_list_columns.template.ts +4 -10
  371. package/src/template/implementations/view_search_input.template.ts +2 -2
  372. package/src/template/index.ts +4 -2
  373. package/src/template/template-manager.ts +166 -0
  374. package/src/template/template-types.ts +16 -0
  375. package/src/template/template.ts +29 -10
  376. package/src/template/zod-converter.ts +459 -101
  377. package/src/testing/_relation-graph.ts +18 -11
  378. package/src/testing/fixture-manager.ts +468 -362
  379. package/src/types/types.ts +516 -248
  380. package/src/typings/knex.d.ts +7 -9
  381. package/src/utils/async-utils.ts +8 -12
  382. package/src/utils/console-util.ts +1 -1
  383. package/src/utils/controller.ts +3 -0
  384. package/src/utils/esm-utils.ts +8 -18
  385. package/src/utils/formatter.ts +109 -0
  386. package/src/utils/fs-utils.ts +1 -1
  387. package/src/utils/lodash-able.ts +1 -4
  388. package/src/utils/object-utils.ts +217 -0
  389. package/src/utils/path-utils.ts +3 -6
  390. package/src/utils/process-utils.ts +1 -1
  391. package/src/utils/sql-parser.ts +23 -5
  392. package/src/utils/type-utils.ts +83 -0
  393. package/src/utils/utils.ts +58 -9
  394. package/src/utils/zod-error.ts +3 -3
  395. package/dist/bin/cli-wrapper.d.ts +0 -3
  396. package/dist/bin/cli-wrapper.d.ts.map +0 -1
  397. package/dist/bin/cli-wrapper.js +0 -72
  398. package/dist/database/knex-plugins/knex-on-duplicate-update.d.ts +0 -2
  399. package/dist/database/knex-plugins/knex-on-duplicate-update.d.ts.map +0 -1
  400. package/dist/database/knex-plugins/knex-on-duplicate-update.js +0 -39
  401. package/dist/entity/entity-utils.d.ts +0 -61
  402. package/dist/entity/entity-utils.d.ts.map +0 -1
  403. package/dist/entity/entity-utils.js +0 -210
  404. package/src/bin/cli-wrapper.ts +0 -82
  405. package/src/database/knex-plugins/knex-on-duplicate-update.ts +0 -45
  406. package/src/entity/entity-utils.ts +0 -291
@@ -1,23 +1,27 @@
1
+ /** biome-ignore-all lint/correctness/useExhaustiveDependencies: shared */
2
+ /** biome-ignore-all lint/suspicious/noExplicitAny: shared */
3
+
1
4
  /*
2
5
  fetch
3
6
  */
4
7
  import type { AxiosRequestConfig } from "axios";
5
8
  import axios from "axios";
6
- import { z, ZodIssue } from "zod";
7
9
  import qs from "qs";
10
+ import { type ZodIssue, z } from "zod";
8
11
 
9
12
  // ISO 8601 및 타임존 포맷의 날짜 문자열을 Date 객체로 변환하는 reviver
10
- function dateReviver(key: string, value: any): any {
13
+ function dateReviver(_key: string, value: any): any {
11
14
  if (typeof value === "string") {
12
15
  // ISO 8601 형식: 2024-01-15T09:30:00.000Z 또는 2024-01-15T09:30:00+09:00
13
- const isoRegex =
14
- /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d{1,3})?)?(Z|[+-]\d{2}:\d{2})?$/;
16
+ const isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d{1,3})?)?(Z|[+-]\d{2}:\d{2})?$/;
15
17
 
16
18
  // Timezone 포맷: 2024-01-15 09:30:00+09:00
17
19
  const timezoneRegex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}[+-]\d{2}:\d{2}$/;
18
20
 
19
- if ((isoRegex.test(value) || timezoneRegex.test(value)) &&
20
- new Date(value).toString() !== "Invalid Date") {
21
+ if (
22
+ (isoRegex.test(value) || timezoneRegex.test(value)) &&
23
+ new Date(value).toString() !== "Invalid Date"
24
+ ) {
21
25
  return new Date(value);
22
26
  }
23
27
  }
@@ -29,7 +33,7 @@ axios.defaults.transformResponse = [
29
33
  if (typeof data === "string") {
30
34
  try {
31
35
  return JSON.parse(data, dateReviver);
32
- } catch (e) {
36
+ } catch {
33
37
  return data;
34
38
  }
35
39
  }
@@ -61,7 +65,7 @@ export class SonamuError extends Error {
61
65
  constructor(
62
66
  public code: number,
63
67
  public message: string,
64
- public issues: z.ZodIssue[]
68
+ public issues: z.ZodIssue[],
65
69
  ) {
66
70
  super(message);
67
71
  this.isSonamuError = true;
@@ -106,9 +110,7 @@ export async function swrFetcher(args: [string, object]): Promise<any> {
106
110
  const res = await axios.get(`${url}?${qs.stringify(params)}`);
107
111
  return res.data;
108
112
  } catch (e: any) {
109
- const error: any = new Error(
110
- e.response.data.message ?? e.response.message ?? "Unknown"
111
- );
113
+ const error: any = new Error(e.response.data.message ?? e.response.message ?? "Unknown");
112
114
  error.statusCode = e.response?.data.statusCode ?? e.response.status;
113
115
  throw error;
114
116
  }
@@ -119,16 +121,14 @@ export async function swrPostFetcher(args: [string, object]): Promise<any> {
119
121
  const res = await axios.post(url, params);
120
122
  return res.data;
121
123
  } catch (e: any) {
122
- const error: any = new Error(
123
- e.response.data.message ?? e.response.message ?? "Unknown"
124
- );
124
+ const error: any = new Error(e.response.data.message ?? e.response.message ?? "Unknown");
125
125
  error.statusCode = e.response?.data.statusCode ?? e.response.status;
126
126
  throw error;
127
127
  }
128
128
  }
129
129
  export function handleConditional(
130
130
  args: [string, object],
131
- conditional?: () => boolean
131
+ conditional?: () => boolean,
132
132
  ): [string, object] | null {
133
133
  if (conditional) {
134
134
  return conditional() ? args : null;
@@ -139,9 +139,7 @@ export function handleConditional(
139
139
  /*
140
140
  Utils
141
141
  */
142
- export function zArrayable<T extends z.ZodTypeAny>(
143
- shape: T
144
- ): z.ZodUnion<[T, z.ZodArray<T>]> {
142
+ export function zArrayable<T extends z.ZodTypeAny>(shape: T): z.ZodUnion<[T, z.ZodArray<T>]> {
145
143
  return z.union([shape, shape.array()]);
146
144
  }
147
145
 
@@ -175,6 +173,7 @@ export type SSEStreamState = {
175
173
  export type EventHandlers<T> = {
176
174
  [K in keyof T]: (data: T[K]) => void;
177
175
  };
176
+
178
177
  import { useEffect, useRef, useState } from "react";
179
178
 
180
179
  export function useSSEStream<T extends Record<string, any>>(
@@ -183,7 +182,7 @@ export function useSSEStream<T extends Record<string, any>>(
183
182
  handlers: {
184
183
  [K in keyof T]?: (data: T[K]) => void;
185
184
  },
186
- options: SSEStreamOptions = {}
185
+ options: SSEStreamOptions = {},
187
186
  ): SSEStreamState {
188
187
  const { enabled = true, retry = 3, retryInterval = 3000 } = options;
189
188
 
@@ -245,7 +244,7 @@ export function useSSEStream<T extends Record<string, any>>(
245
244
  }));
246
245
  };
247
246
 
248
- eventSource.onerror = (event) => {
247
+ eventSource.onerror = (_event) => {
249
248
  // 이미 다른 연결로 교체되었는지 확인
250
249
  if (eventSourceRef.current !== eventSource) {
251
250
  return; // 이미 새로운 연결이 있으면 무시
@@ -313,10 +312,7 @@ export function useSSEStream<T extends Record<string, any>>(
313
312
  const data = JSON.parse(event.data);
314
313
  handler(data);
315
314
  } catch (error) {
316
- console.error(
317
- `Failed to parse SSE data for event ${eventType}:`,
318
- error
319
- );
315
+ console.error(`Failed to parse SSE data for event ${eventType}:`, error);
320
316
  }
321
317
  setState((prev) => ({
322
318
  ...prev,
package/src/stream/sse.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { z } from "zod";
2
- import type { FastifyRequest, FastifyReply } from "fastify";
1
+ import type { FastifyReply, FastifyRequest } from "fastify";
2
+ import type { z } from "zod";
3
3
 
4
4
  // NOTE(Haze, 251106): context provider에서 인자를 채워주면 createSSE(events)만으로 사용 가능
5
5
  export function createSSEFactory<T extends z.ZodObject>(
6
6
  socket: FastifyRequest["socket"],
7
7
  reply: FastifyReply,
8
- _events: T
8
+ _events: T,
9
9
  ) {
10
10
  return new SSEConnection<T>(socket, reply);
11
11
  }
@@ -15,7 +15,7 @@ class SSEConnection<T extends z.ZodObject> {
15
15
 
16
16
  constructor(
17
17
  private readonly socket: FastifyRequest["socket"],
18
- private readonly reply: FastifyReply
18
+ private readonly reply: FastifyReply,
19
19
  ) {
20
20
  this.socket.on("close", () => {
21
21
  this._closed = true;
@@ -42,7 +42,7 @@ class SSEConnection<T extends z.ZodObject> {
42
42
  event: "end",
43
43
  data: "END",
44
44
  });
45
-
45
+
46
46
  await new Promise((resolve) => setTimeout(resolve, 200));
47
47
  this.reply.raw.end();
48
48
  }
@@ -1,11 +1,11 @@
1
- import { ApiParam, ApiParamType } from "../types/types";
1
+ import assert from "assert";
2
2
  import { readFile } from "fs/promises";
3
- import * as _ from "lodash-es";
4
- import ts from "typescript";
5
- import { ExtendedApi, registeredApis } from "../api/decorators";
6
3
  import inflection from "inflection";
7
- import assert from "assert";
8
- import { AbsolutePath } from "../utils/path-utils";
4
+ import ts from "typescript";
5
+ import { type ExtendedApi, registeredApis } from "../api/decorators";
6
+ import { validateMethodName } from "../api/validator";
7
+ import type { ApiParam, ApiParamType } from "../types/types";
8
+ import type { AbsolutePath } from "../utils/path-utils";
9
9
 
10
10
  /**
11
11
  * TypeScript 파일을 파싱하여 API 메소드 정보를 추출합니다.
@@ -13,15 +13,17 @@ import { AbsolutePath } from "../utils/path-utils";
13
13
  * @param filePath - 파싱할 TypeScript 파일의 절대 경로
14
14
  * @returns API 메소드 정보 배열 (타입 파라미터, 파라미터, 리턴 타입 등)
15
15
  */
16
- export async function readApisFromFile(filePath: AbsolutePath) {
17
- if (!filePath.endsWith(".ts")) {
18
- throw new Error(`${filePath} does not seem to be a TypeScript file. Please check the file path. We only support parsing TypeScript files.`);
16
+ export async function readApisFromFile(filePath: AbsolutePath): Promise<ExtendedApi[]> {
17
+ if (!filePath.endsWith(".ts")) {
18
+ throw new Error(
19
+ `${filePath} does not seem to be a TypeScript file. Please check the file path. We only support parsing TypeScript files.`,
20
+ );
19
21
  }
20
-
22
+
21
23
  const sourceFile = ts.createSourceFile(
22
24
  filePath,
23
25
  (await readFile(filePath)).toString(),
24
- ts.ScriptTarget.Latest
26
+ ts.ScriptTarget.Latest,
25
27
  );
26
28
 
27
29
  const methods: Omit<ExtendedApi, "path" | "options">[] = [];
@@ -36,21 +38,20 @@ export async function readApisFromFile(filePath: AbsolutePath) {
36
38
  if (ts.isMethodDeclaration(node)) {
37
39
  if (ts.isIdentifier(node.name)) {
38
40
  methodName = node.name.escapedText.toString();
41
+ validateMethodName(methodName);
39
42
  }
40
43
 
41
- const typeParameters: ApiParamType.TypeParam[] = (
42
- node.typeParameters ?? []
43
- ).map((typeParam) => {
44
- const tp = typeParam as ts.TypeParameterDeclaration;
44
+ const typeParameters: ApiParamType.TypeParam[] = (node.typeParameters ?? []).map(
45
+ (typeParam) => {
46
+ const tp = typeParam as ts.TypeParameterDeclaration;
45
47
 
46
- return {
47
- t: "type-param",
48
- id: tp.name.escapedText.toString(),
49
- constraint: tp.constraint
50
- ? resolveTypeNode(tp.constraint)
51
- : undefined,
52
- };
53
- });
48
+ return {
49
+ t: "type-param",
50
+ id: tp.name.escapedText.toString(),
51
+ constraint: tp.constraint ? resolveTypeNode(tp.constraint) : undefined,
52
+ };
53
+ },
54
+ );
54
55
  const parameters: ApiParam[] = node.parameters.map((paramDec, index) => {
55
56
  const defaultDef = printNode(paramDec.initializer, sourceFile);
56
57
 
@@ -60,20 +61,16 @@ export async function readApisFromFile(filePath: AbsolutePath) {
60
61
  {
61
62
  name: paramDec.name,
62
63
  type: paramDec.type as ts.TypeNode,
63
- optional:
64
- paramDec.questionToken !== undefined ||
65
- paramDec.initializer !== undefined,
64
+ optional: paramDec.questionToken !== undefined || paramDec.initializer !== undefined,
66
65
  defaultDef,
67
66
  },
68
- index
67
+ index,
69
68
  );
70
69
  });
71
70
  if (node.type === undefined) {
72
- throw new Error(
73
- `리턴 타입이 기재되지 않은 메소드 ${modelName}.${methodName}`
74
- );
71
+ throw new Error(`리턴 타입이 기재되지 않은 메소드 ${modelName}.${methodName}`);
75
72
  }
76
- const returnType = resolveTypeNode(node.type!);
73
+ const returnType = resolveTypeNode(node.type);
77
74
 
78
75
  methods.push({
79
76
  modelName,
@@ -94,9 +91,7 @@ export async function readApisFromFile(filePath: AbsolutePath) {
94
91
  // 현재 파일의 등록된 API 필터
95
92
  const currentModelApis = registeredApis.filter((api) => {
96
93
  return methods.find(
97
- (method) =>
98
- method.modelName === api.modelName &&
99
- method.methodName === api.methodName
94
+ (method) => method.modelName === api.modelName && method.methodName === api.methodName,
100
95
  );
101
96
  });
102
97
  if (currentModelApis.length === 0) {
@@ -109,15 +104,16 @@ export async function readApisFromFile(filePath: AbsolutePath) {
109
104
  // 등록된 API에 현재 메소드 타입 정보 확장
110
105
  const extendedApis = currentModelApis.map((api) => {
111
106
  const foundMethod = methods.find(
112
- (method) =>
113
- method.modelName === api.modelName &&
114
- method.methodName === api.methodName
107
+ (method) => method.modelName === api.modelName && method.methodName === api.methodName,
115
108
  );
109
+ if (!foundMethod) {
110
+ throw new Error(`API ${api.modelName}.${api.methodName} not found in ${filePath}`);
111
+ }
116
112
  return {
117
113
  ...api,
118
- typeParameters: foundMethod!.typeParameters,
119
- parameters: foundMethod!.parameters,
120
- returnType: foundMethod!.returnType,
114
+ typeParameters: foundMethod?.typeParameters,
115
+ parameters: foundMethod?.parameters,
116
+ returnType: foundMethod?.returnType,
121
117
  };
122
118
  });
123
119
  return extendedApis;
@@ -141,7 +137,7 @@ function resolveTypeNode(typeNode: ts.TypeNode): ApiParamType {
141
137
  return "null";
142
138
  case ts.SyntaxKind.VoidKeyword:
143
139
  return "void";
144
- case ts.SyntaxKind.LiteralType:
140
+ case ts.SyntaxKind.LiteralType: {
145
141
  const literal = (typeNode as ts.LiteralTypeNode).literal;
146
142
  if (ts.isStringLiteral(literal)) {
147
143
  return {
@@ -165,13 +161,15 @@ function resolveTypeNode(typeNode: ts.TypeNode): ApiParamType {
165
161
  }
166
162
  throw new Error("알 수 없는 리터럴");
167
163
  }
168
- case ts.SyntaxKind.ArrayType:
164
+ }
165
+ case ts.SyntaxKind.ArrayType: {
169
166
  const arrNode = typeNode as ts.ArrayTypeNode;
170
167
  return {
171
168
  t: "array",
172
169
  elementsType: resolveTypeNode(arrNode.elementType),
173
170
  };
174
- case ts.SyntaxKind.TypeLiteral:
171
+ }
172
+ case ts.SyntaxKind.TypeLiteral: {
175
173
  const literalNode = typeNode as ts.TypeLiteralNode;
176
174
  return {
177
175
  t: "object",
@@ -185,9 +183,7 @@ function resolveTypeNode(typeNode: ts.TypeNode): ApiParamType {
185
183
 
186
184
  return resolveParamDec({
187
185
  name: {
188
- escapedText: `[${res.name}${res.optional ? "?" : ""}: ${
189
- res.type
190
- }]`,
186
+ escapedText: `[${res.name}${res.optional ? "?" : ""}: ${res.type}]`,
191
187
  } as ts.Identifier,
192
188
  type: member.type as ts.TypeNode,
193
189
  });
@@ -195,45 +191,35 @@ function resolveTypeNode(typeNode: ts.TypeNode): ApiParamType {
195
191
  return resolveParamDec({
196
192
  name: (member as ts.PropertySignature).name as ts.Identifier,
197
193
  type: (member as ts.PropertySignature).type as ts.TypeNode,
198
- optional:
199
- (member as ts.PropertySignature).questionToken !== undefined,
194
+ optional: (member as ts.PropertySignature).questionToken !== undefined,
200
195
  });
201
196
  }
202
197
  }),
203
198
  };
199
+ }
204
200
  case ts.SyntaxKind.TypeReference:
205
201
  return {
206
202
  t: "ref",
207
- id: (
208
- (typeNode as ts.TypeReferenceNode).typeName as ts.Identifier
209
- ).escapedText.toString(),
203
+ id: ((typeNode as ts.TypeReferenceNode).typeName as ts.Identifier).escapedText.toString(),
210
204
  args: (typeNode as ts.TypeReferenceNode).typeArguments?.map((typeArg) =>
211
- resolveTypeNode(typeArg)
205
+ resolveTypeNode(typeArg),
212
206
  ),
213
207
  };
214
208
  case ts.SyntaxKind.UnionType:
215
209
  return {
216
210
  t: "union",
217
- types: (typeNode as ts.UnionTypeNode).types.map((type) =>
218
- resolveTypeNode(type)
219
- ),
211
+ types: (typeNode as ts.UnionTypeNode).types.map((type) => resolveTypeNode(type)),
220
212
  };
221
213
  case ts.SyntaxKind.IntersectionType:
222
214
  return {
223
215
  t: "intersection",
224
- types: (typeNode as ts.IntersectionTypeNode).types.map((type) =>
225
- resolveTypeNode(type)
226
- ),
216
+ types: (typeNode as ts.IntersectionTypeNode).types.map((type) => resolveTypeNode(type)),
227
217
  };
228
218
  case ts.SyntaxKind.IndexedAccessType:
229
219
  return {
230
220
  t: "indexed-access",
231
- object: resolveTypeNode(
232
- (typeNode as ts.IndexedAccessTypeNode).objectType
233
- ),
234
- index: resolveTypeNode(
235
- (typeNode as ts.IndexedAccessTypeNode).indexType
236
- ),
221
+ object: resolveTypeNode((typeNode as ts.IndexedAccessTypeNode).objectType),
222
+ index: resolveTypeNode((typeNode as ts.IndexedAccessTypeNode).indexType),
237
223
  };
238
224
  case ts.SyntaxKind.TupleType:
239
225
  if (ts.isTupleTypeNode(typeNode)) {
@@ -258,7 +244,7 @@ function resolveParamDec(
258
244
  optional?: boolean;
259
245
  defaultDef?: string;
260
246
  },
261
- index: number = 0
247
+ index: number = 0,
262
248
  ): ApiParam {
263
249
  const name = paramDec.name as ts.Identifier;
264
250
  const type = resolveTypeNode(paramDec.type);
@@ -286,10 +272,7 @@ function resolveParamDec(
286
272
  return result;
287
273
  }
288
274
 
289
- function printNode(
290
- node: ts.Node | undefined,
291
- sourceFile: ts.SourceFile
292
- ): string | undefined {
275
+ function printNode(node: ts.Node | undefined, sourceFile: ts.SourceFile): string | undefined {
293
276
  if (node === undefined) {
294
277
  return undefined;
295
278
  }
@@ -1,17 +1,14 @@
1
+ import crypto, { type BinaryLike } from "crypto";
2
+ import equal from "fast-deep-equal";
3
+ import { createReadStream, type PathLike } from "fs";
4
+ import { readFile, writeFile } from "fs/promises";
1
5
  import path from "path";
6
+ import { isEqual } from "radashi";
7
+ import { Sonamu } from "../api/sonamu";
2
8
  import { globAsync } from "../utils/async-utils";
3
- import { createReadStream, PathLike } from "fs";
4
- import { readFile, writeFile } from "fs/promises";
5
9
  import { exists } from "../utils/fs-utils";
6
-
7
- import crypto from "crypto";
8
- import equal from "fast-deep-equal";
9
- import * as _ from "lodash-es";
10
- import { Sonamu } from "../api/sonamu";
11
- import {
12
- AbsolutePath,
13
- ApiRelativePath,
14
- } from "../utils/path-utils";
10
+ import type { AbsolutePath, ApiRelativePath } from "../utils/path-utils";
11
+ import { differenceWith } from "../utils/utils";
15
12
  import { getChecksumPatternGroupInAbsolutePath } from "./file-patterns";
16
13
 
17
14
  type PathAndChecksum = {
@@ -23,9 +20,7 @@ type PathAndChecksum = {
23
20
  * 체크섬 파일에 저장된 내용과 현재 실제 파일의 체크섬을 비교하여 변경된 파일을 찾습니다.
24
21
  * @returns 변경된 파일 경로 배열. 프로젝트 루트부터 슬래시로 시작합니다. 예시: "/src/application/user/user.model.ts"
25
22
  */
26
- export async function findChangedFilesUsingChecksums(): Promise<
27
- AbsolutePath[]
28
- > {
23
+ export async function findChangedFilesUsingChecksums(): Promise<AbsolutePath[]> {
29
24
  const calculatedChecksums = await getCurrentChecksums();
30
25
  const savedChecksums = await getPreviousChecksums();
31
26
 
@@ -34,9 +29,7 @@ export async function findChangedFilesUsingChecksums(): Promise<
34
29
  return [];
35
30
  }
36
31
 
37
- const diff = _.differenceWith(calculatedChecksums, savedChecksums, _.isEqual);
38
-
39
- return diff.map((r) => r.path);
32
+ return differenceWith(calculatedChecksums, savedChecksums, isEqual).map((r) => r.path);
40
33
  }
41
34
 
42
35
  /**
@@ -62,10 +55,7 @@ export async function renewChecksums(): Promise<void> {
62
55
  * @param two 파일 경로
63
56
  * @returns boolean
64
57
  */
65
- export async function areFilesSame(
66
- one: PathLike,
67
- two: PathLike
68
- ): Promise<boolean> {
58
+ export async function areFilesSame(one: PathLike, two: PathLike): Promise<boolean> {
69
59
  if (!(await exists(one)) || !(await exists(two))) {
70
60
  return false;
71
61
  }
@@ -79,11 +69,9 @@ export async function areFilesSame(
79
69
  async function getCurrentChecksums(): Promise<PathAndChecksum[]> {
80
70
  const filePaths = (
81
71
  await Promise.all(
82
- Object.entries(getChecksumPatternGroupInAbsolutePath()).map(
83
- async ([_fileType, pattern]) => {
84
- return globAsync(pattern) as Promise<AbsolutePath[]>;
85
- }
86
- )
72
+ Object.entries(getChecksumPatternGroupInAbsolutePath()).map(async ([_fileType, pattern]) => {
73
+ return globAsync(pattern) as Promise<AbsolutePath[]>;
74
+ }),
87
75
  )
88
76
  )
89
77
  .flat()
@@ -95,7 +83,7 @@ async function getCurrentChecksums(): Promise<PathAndChecksum[]> {
95
83
  path: filePath,
96
84
  checksum: await getChecksumOfFile(filePath),
97
85
  };
98
- })
86
+ }),
99
87
  );
100
88
 
101
89
  return fileChecksums;
@@ -107,12 +95,12 @@ async function getPreviousChecksums(): Promise<PathAndChecksum[]> {
107
95
  return [];
108
96
  }
109
97
 
110
- const previousChecksums = JSON.parse(
111
- await readFile(checksumFilePath, "utf-8")
112
- ).map((r: { path: ApiRelativePath; checksum: string }) => ({
113
- path: path.join(Sonamu.apiRootPath, r.path), // 체크섬 파일에서 읽을 때: API 상대 경로 → 절대 경로
114
- checksum: r.checksum,
115
- })) as PathAndChecksum[];
98
+ const previousChecksums = JSON.parse(await readFile(checksumFilePath, "utf-8")).map(
99
+ (r: { path: ApiRelativePath; checksum: string }) => ({
100
+ path: path.join(Sonamu.apiRootPath, r.path), // 체크섬 파일에서 읽을 때: API 상대 경로 → 절대 경로
101
+ checksum: r.checksum,
102
+ }),
103
+ ) as PathAndChecksum[];
116
104
  return previousChecksums;
117
105
  }
118
106
 
@@ -130,9 +118,9 @@ async function saveChecksums(checksums: PathAndChecksum[]): Promise<void> {
130
118
  checksum: r.checksum,
131
119
  })),
132
120
  null,
133
- 2
121
+ 2,
134
122
  ),
135
- "utf-8"
123
+ "utf-8",
136
124
  );
137
125
  console.log("checksum saved", checksumFilePath);
138
126
  }
@@ -142,10 +130,10 @@ async function getChecksumOfFile(filePath: PathLike): Promise<string> {
142
130
  const hash = crypto.createHash("sha1");
143
131
  const input = createReadStream(filePath);
144
132
  input.on("error", reject);
145
- input.on("data", function (chunk: any) {
133
+ input.on("data", (chunk: BinaryLike) => {
146
134
  hash.update(chunk);
147
135
  });
148
- input.on("close", function () {
136
+ input.on("close", () => {
149
137
  resolve(hash.digest("hex"));
150
138
  });
151
139
  });