sonamu 0.5.7 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (529) 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 +13 -2
  39. package/dist/api/caster.d.ts.map +1 -1
  40. package/dist/api/caster.js +71 -2
  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 +258 -2
  44. package/dist/api/config.d.ts +90 -0
  45. package/dist/api/config.d.ts.map +1 -0
  46. package/dist/api/config.js +25 -0
  47. package/dist/api/context.d.ts +4 -2
  48. package/dist/api/context.d.ts.map +1 -1
  49. package/dist/api/context.js +3 -2
  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 +235 -2
  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 +9 -2
  56. package/dist/api/sonamu.d.ts +10 -24
  57. package/dist/api/sonamu.d.ts.map +1 -1
  58. package/dist/api/sonamu.js +514 -2
  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 +6 -1
  63. package/dist/bin/build-config.d.ts.map +1 -1
  64. package/dist/bin/build-config.js +15 -2
  65. package/dist/bin/cli.js +519 -2
  66. package/dist/bin/hot-hook-register.d.ts +11 -0
  67. package/dist/bin/hot-hook-register.d.ts.map +1 -0
  68. package/dist/bin/hot-hook-register.js +21 -0
  69. package/dist/bin/loader-register.d.ts +2 -0
  70. package/dist/bin/loader-register.d.ts.map +1 -0
  71. package/dist/bin/loader-register.js +34 -0
  72. package/dist/database/_batch_update.d.ts +5 -3
  73. package/dist/database/_batch_update.d.ts.map +1 -1
  74. package/dist/database/_batch_update.js +95 -2
  75. package/dist/database/base-model.d.ts +96 -10
  76. package/dist/database/base-model.d.ts.map +1 -1
  77. package/dist/database/base-model.js +390 -2
  78. package/dist/database/base-model.types.d.ts +93 -0
  79. package/dist/database/base-model.types.d.ts.map +1 -0
  80. package/dist/database/base-model.types.js +10 -0
  81. package/dist/database/code-generator.d.ts +1 -1
  82. package/dist/database/code-generator.d.ts.map +1 -1
  83. package/dist/database/code-generator.js +54 -2
  84. package/dist/database/db.d.ts +6 -21
  85. package/dist/database/db.d.ts.map +1 -1
  86. package/dist/database/db.js +129 -2
  87. package/dist/database/puri-subset.test-d.js +81 -0
  88. package/dist/database/puri-subset.types.d.ts +123 -0
  89. package/dist/database/puri-subset.types.d.ts.map +1 -0
  90. package/dist/database/puri-subset.types.js +16 -0
  91. package/dist/database/puri-wrapper.d.ts +13 -11
  92. package/dist/database/puri-wrapper.d.ts.map +1 -1
  93. package/dist/database/puri-wrapper.js +109 -2
  94. package/dist/database/puri.d.ts +41 -23
  95. package/dist/database/puri.d.ts.map +1 -1
  96. package/dist/database/puri.js +601 -2
  97. package/dist/database/puri.types.d.ts +25 -6
  98. package/dist/database/puri.types.d.ts.map +1 -1
  99. package/dist/database/puri.types.js +6 -2
  100. package/dist/database/transaction-context.d.ts +1 -1
  101. package/dist/database/transaction-context.d.ts.map +1 -1
  102. package/dist/database/transaction-context.js +14 -2
  103. package/dist/database/upsert-builder.d.ts +9 -3
  104. package/dist/database/upsert-builder.d.ts.map +1 -1
  105. package/dist/database/upsert-builder.js +365 -2
  106. package/dist/entity/entity-manager.d.ts +167 -2
  107. package/dist/entity/entity-manager.d.ts.map +1 -1
  108. package/dist/entity/entity-manager.js +130 -2
  109. package/dist/entity/entity.d.ts +5 -3
  110. package/dist/entity/entity.d.ts.map +1 -1
  111. package/dist/entity/entity.js +750 -2
  112. package/dist/exceptions/error-handler.d.ts +1 -1
  113. package/dist/exceptions/error-handler.d.ts.map +1 -1
  114. package/dist/exceptions/error-handler.js +29 -2
  115. package/dist/exceptions/so-exceptions.d.ts +1 -1
  116. package/dist/exceptions/so-exceptions.d.ts.map +1 -1
  117. package/dist/exceptions/so-exceptions.js +85 -2
  118. package/dist/file-storage/driver.d.ts +1 -1
  119. package/dist/file-storage/driver.d.ts.map +1 -1
  120. package/dist/file-storage/driver.js +79 -2
  121. package/dist/file-storage/file-storage.js +75 -2
  122. package/dist/index.d.ts +18 -9
  123. package/dist/index.d.ts.map +1 -1
  124. package/dist/index.js +34 -2
  125. package/dist/migration/code-generation.d.ts +1 -1
  126. package/dist/migration/code-generation.d.ts.map +1 -1
  127. package/dist/migration/code-generation.js +614 -2
  128. package/dist/migration/migration-set.d.ts +2 -10
  129. package/dist/migration/migration-set.d.ts.map +1 -1
  130. package/dist/migration/migration-set.js +213 -2
  131. package/dist/migration/migrator.d.ts +24 -82
  132. package/dist/migration/migrator.d.ts.map +1 -1
  133. package/dist/migration/migrator.js +330 -2
  134. package/dist/migration/postgresql-schema-reader.d.ts +51 -0
  135. package/dist/migration/postgresql-schema-reader.d.ts.map +1 -0
  136. package/dist/migration/postgresql-schema-reader.js +245 -0
  137. package/dist/migration/types.d.ts +6 -38
  138. package/dist/migration/types.d.ts.map +1 -1
  139. package/dist/migration/types.js +3 -2
  140. package/dist/naite/messaging-types.d.ts +43 -0
  141. package/dist/naite/messaging-types.d.ts.map +1 -0
  142. package/dist/naite/messaging-types.js +7 -0
  143. package/dist/naite/naite-reporter.d.ts +41 -0
  144. package/dist/naite/naite-reporter.d.ts.map +1 -0
  145. package/dist/naite/naite-reporter.js +102 -0
  146. package/dist/naite/naite.d.ts +95 -0
  147. package/dist/naite/naite.d.ts.map +1 -0
  148. package/dist/naite/naite.js +316 -0
  149. package/dist/stream/index.js +3 -2
  150. package/dist/stream/sse.d.ts +2 -2
  151. package/dist/stream/sse.d.ts.map +1 -1
  152. package/dist/stream/sse.js +38 -2
  153. package/dist/syncer/api-parser.d.ts +10 -0
  154. package/dist/syncer/api-parser.d.ts.map +1 -0
  155. package/dist/syncer/api-parser.js +240 -0
  156. package/dist/syncer/checksum.d.ts +21 -0
  157. package/dist/syncer/checksum.d.ts.map +1 -0
  158. package/dist/syncer/checksum.js +98 -0
  159. package/dist/syncer/code-generator.d.ts +20 -0
  160. package/dist/syncer/code-generator.d.ts.map +1 -0
  161. package/dist/syncer/code-generator.js +161 -0
  162. package/dist/syncer/entity-operations.d.ts +17 -0
  163. package/dist/syncer/entity-operations.d.ts.map +1 -0
  164. package/dist/syncer/entity-operations.js +59 -0
  165. package/dist/syncer/file-patterns.d.ts +29 -0
  166. package/dist/syncer/file-patterns.d.ts.map +1 -0
  167. package/dist/syncer/file-patterns.js +38 -0
  168. package/dist/syncer/index.d.ts +6 -0
  169. package/dist/syncer/index.d.ts.map +1 -1
  170. package/dist/syncer/index.js +9 -2
  171. package/dist/syncer/module-loader.d.ts +35 -0
  172. package/dist/syncer/module-loader.d.ts.map +1 -0
  173. package/dist/syncer/module-loader.js +87 -0
  174. package/dist/syncer/syncer.d.ts +98 -106
  175. package/dist/syncer/syncer.d.ts.map +1 -1
  176. package/dist/syncer/syncer.js +422 -2
  177. package/dist/template/entity-converter.d.ts +14 -0
  178. package/dist/template/entity-converter.d.ts.map +1 -0
  179. package/dist/template/entity-converter.js +108 -0
  180. package/dist/template/helpers.d.ts +23 -0
  181. package/dist/template/helpers.d.ts.map +1 -0
  182. package/dist/template/helpers.js +64 -0
  183. package/dist/{templates → template/implementations}/entity.template.d.ts +3 -3
  184. package/dist/template/implementations/entity.template.d.ts.map +1 -0
  185. package/dist/template/implementations/entity.template.js +86 -0
  186. package/dist/{templates → template/implementations}/generated.template.d.ts +3 -4
  187. package/dist/template/implementations/generated.template.d.ts.map +1 -0
  188. package/dist/template/implementations/generated.template.js +249 -0
  189. package/dist/{templates → template/implementations}/generated_http.template.d.ts +3 -4
  190. package/dist/template/implementations/generated_http.template.d.ts.map +1 -0
  191. package/dist/template/implementations/generated_http.template.js +131 -0
  192. package/dist/{templates → template/implementations}/generated_sso.template.d.ts +4 -5
  193. package/dist/template/implementations/generated_sso.template.d.ts.map +1 -0
  194. package/dist/template/implementations/generated_sso.template.js +134 -0
  195. package/dist/{templates → template/implementations}/init_types.template.d.ts +3 -3
  196. package/dist/template/implementations/init_types.template.d.ts.map +1 -0
  197. package/dist/template/implementations/init_types.template.js +38 -0
  198. package/dist/template/implementations/model.template.d.ts +17 -0
  199. package/dist/template/implementations/model.template.d.ts.map +1 -0
  200. package/dist/template/implementations/model.template.js +181 -0
  201. package/dist/{templates → template/implementations}/model_test.template.d.ts +3 -3
  202. package/dist/template/implementations/model_test.template.d.ts.map +1 -0
  203. package/dist/template/implementations/model_test.template.js +35 -0
  204. package/dist/{templates → template/implementations}/service.template.d.ts +6 -6
  205. package/dist/template/implementations/service.template.d.ts.map +1 -0
  206. package/dist/template/implementations/service.template.js +201 -0
  207. package/dist/{templates → template/implementations}/view_enums_buttonset.template.d.ts +3 -3
  208. package/dist/template/implementations/view_enums_buttonset.template.d.ts.map +1 -0
  209. package/dist/template/implementations/view_enums_buttonset.template.js +31 -0
  210. package/dist/{templates → template/implementations}/view_enums_dropdown.template.d.ts +3 -4
  211. package/dist/template/implementations/view_enums_dropdown.template.d.ts.map +1 -0
  212. package/dist/template/implementations/view_enums_dropdown.template.js +50 -0
  213. package/dist/{templates → template/implementations}/view_enums_select.template.d.ts +3 -3
  214. package/dist/template/implementations/view_enums_select.template.d.ts.map +1 -0
  215. package/dist/template/implementations/view_enums_select.template.js +55 -0
  216. package/dist/{templates → template/implementations}/view_form.template.d.ts +5 -5
  217. package/dist/template/implementations/view_form.template.d.ts.map +1 -0
  218. package/dist/template/implementations/view_form.template.js +337 -0
  219. package/dist/{templates → template/implementations}/view_id_all_select.template.d.ts +3 -3
  220. package/dist/template/implementations/view_id_all_select.template.d.ts.map +1 -0
  221. package/dist/template/implementations/view_id_all_select.template.js +31 -0
  222. package/dist/{templates → template/implementations}/view_id_async_select.template.d.ts +3 -3
  223. package/dist/template/implementations/view_id_async_select.template.d.ts.map +1 -0
  224. package/dist/template/implementations/view_id_async_select.template.js +105 -0
  225. package/dist/{templates → template/implementations}/view_list.template.d.ts +5 -13
  226. package/dist/template/implementations/view_list.template.d.ts.map +1 -0
  227. package/dist/template/implementations/view_list.template.js +475 -0
  228. package/dist/template/implementations/view_list_columns.template.d.ts +17 -0
  229. package/dist/template/implementations/view_list_columns.template.d.ts.map +1 -0
  230. package/dist/template/implementations/view_list_columns.template.js +49 -0
  231. package/dist/{templates → template/implementations}/view_search_input.template.d.ts +3 -3
  232. package/dist/template/implementations/view_search_input.template.d.ts.map +1 -0
  233. package/dist/template/implementations/view_search_input.template.js +64 -0
  234. package/dist/template/index.d.ts +7 -0
  235. package/dist/template/index.d.ts.map +1 -0
  236. package/dist/template/index.js +8 -0
  237. package/dist/template/template-manager.d.ts +56 -0
  238. package/dist/template/template-manager.d.ts.map +1 -0
  239. package/dist/template/template-manager.js +125 -0
  240. package/dist/template/template-types.d.ts +16 -0
  241. package/dist/template/template-types.d.ts.map +1 -0
  242. package/dist/template/template-types.js +7 -0
  243. package/dist/template/template.d.ts +49 -0
  244. package/dist/template/template.d.ts.map +1 -0
  245. package/dist/template/template.js +60 -0
  246. package/dist/template/zod-converter.d.ts +51 -0
  247. package/dist/template/zod-converter.d.ts.map +1 -0
  248. package/dist/template/zod-converter.js +449 -0
  249. package/dist/testing/_relation-graph.d.ts +1 -1
  250. package/dist/testing/_relation-graph.d.ts.map +1 -1
  251. package/dist/testing/_relation-graph.js +89 -2
  252. package/dist/testing/fixture-manager.d.ts +42 -11
  253. package/dist/testing/fixture-manager.d.ts.map +1 -1
  254. package/dist/testing/fixture-manager.js +623 -2
  255. package/dist/types/types.d.ts +747 -143
  256. package/dist/types/types.d.ts.map +1 -1
  257. package/dist/types/types.js +546 -2
  258. package/dist/typings/knex.d.js +3 -2
  259. package/dist/utils/async-utils.d.ts +7 -0
  260. package/dist/utils/async-utils.d.ts.map +1 -1
  261. package/dist/utils/async-utils.js +57 -2
  262. package/dist/utils/console-util.d.ts +2 -0
  263. package/dist/utils/console-util.d.ts.map +1 -0
  264. package/dist/utils/console-util.js +6 -0
  265. package/dist/utils/controller.d.ts +1 -0
  266. package/dist/utils/controller.d.ts.map +1 -1
  267. package/dist/utils/controller.js +29 -2
  268. package/dist/utils/esm-utils.d.ts +39 -0
  269. package/dist/utils/esm-utils.d.ts.map +1 -0
  270. package/dist/utils/esm-utils.js +49 -0
  271. package/dist/utils/formatter.d.ts +3 -0
  272. package/dist/utils/formatter.d.ts.map +1 -0
  273. package/dist/utils/formatter.js +110 -0
  274. package/dist/utils/fs-utils.d.ts +1 -1
  275. package/dist/utils/fs-utils.d.ts.map +1 -1
  276. package/dist/utils/fs-utils.js +17 -2
  277. package/dist/utils/lodash-able.d.ts.map +1 -1
  278. package/dist/utils/lodash-able.js +6 -2
  279. package/dist/utils/model.js +22 -2
  280. package/dist/utils/object-utils.d.ts +44 -0
  281. package/dist/utils/object-utils.d.ts.map +1 -0
  282. package/dist/utils/object-utils.js +191 -0
  283. package/dist/utils/path-utils.d.ts +89 -0
  284. package/dist/utils/path-utils.d.ts.map +1 -0
  285. package/dist/utils/path-utils.js +60 -0
  286. package/dist/utils/process-utils.d.ts +13 -0
  287. package/dist/utils/process-utils.d.ts.map +1 -0
  288. package/dist/utils/process-utils.js +36 -0
  289. package/dist/utils/sql-parser.d.ts +5 -1
  290. package/dist/utils/sql-parser.d.ts.map +1 -1
  291. package/dist/utils/sql-parser.js +46 -2
  292. package/dist/utils/type-utils.d.ts +23 -0
  293. package/dist/utils/type-utils.d.ts.map +1 -0
  294. package/dist/utils/type-utils.js +45 -0
  295. package/dist/utils/utils.d.ts +10 -7
  296. package/dist/utils/utils.d.ts.map +1 -1
  297. package/dist/utils/utils.js +72 -2
  298. package/dist/utils/zod-error.d.ts +1 -1
  299. package/dist/utils/zod-error.d.ts.map +1 -1
  300. package/dist/utils/zod-error.js +19 -2
  301. package/package.json +65 -27
  302. package/src/ai/agents/agent.ts +87 -0
  303. package/src/ai/agents/index.ts +2 -0
  304. package/src/ai/agents/types.ts +47 -0
  305. package/src/ai/index.ts +1 -0
  306. package/src/ai/providers/rtzr/api.ts +37 -0
  307. package/src/ai/providers/rtzr/error.ts +34 -0
  308. package/src/ai/providers/rtzr/index.ts +4 -0
  309. package/src/ai/providers/rtzr/model.ts +201 -0
  310. package/src/ai/providers/rtzr/options.ts +49 -0
  311. package/src/ai/providers/rtzr/provider.ts +91 -0
  312. package/src/ai/providers/rtzr/utils.ts +127 -0
  313. package/src/api/base-frame.ts +4 -2
  314. package/src/api/caster.ts +17 -23
  315. package/src/api/code-converters.ts +178 -535
  316. package/src/api/config.ts +125 -0
  317. package/src/api/context.ts +7 -17
  318. package/src/api/decorators.ts +176 -46
  319. package/src/api/index.ts +2 -2
  320. package/src/api/sonamu.ts +190 -167
  321. package/src/api/validator.ts +83 -0
  322. package/src/bin/build-config.ts +8 -1
  323. package/src/bin/cli.ts +258 -124
  324. package/src/bin/hot-hook-register.ts +22 -0
  325. package/src/bin/loader-register.ts +38 -0
  326. package/src/database/_batch_update.ts +46 -31
  327. package/src/database/base-model.ts +390 -182
  328. package/src/database/base-model.types.ts +155 -0
  329. package/src/database/code-generator.ts +13 -32
  330. package/src/database/db.ts +40 -96
  331. package/src/database/puri-subset.test-d.ts +471 -0
  332. package/src/database/puri-subset.types.ts +195 -0
  333. package/src/database/puri-wrapper.ts +58 -67
  334. package/src/database/puri.ts +229 -148
  335. package/src/database/puri.types.ts +76 -30
  336. package/src/database/transaction-context.ts +1 -1
  337. package/src/database/upsert-builder.ts +262 -132
  338. package/src/entity/entity-manager.ts +48 -36
  339. package/src/entity/entity.ts +330 -248
  340. package/src/exceptions/error-handler.ts +3 -3
  341. package/src/exceptions/so-exceptions.ts +11 -11
  342. package/src/file-storage/driver.ts +5 -5
  343. package/src/file-storage/file-storage.ts +2 -2
  344. package/src/index.ts +18 -10
  345. package/src/migration/code-generation.ts +185 -172
  346. package/src/migration/migration-set.ts +80 -293
  347. package/src/migration/migrator.ts +199 -571
  348. package/src/migration/mysql-schema-reader.ts.txt +272 -0
  349. package/src/migration/postgresql-schema-reader.ts +310 -0
  350. package/src/migration/types.ts +6 -39
  351. package/src/naite/messaging-types.ts +51 -0
  352. package/src/naite/naite-reporter.ts +128 -0
  353. package/src/naite/naite.ts +415 -0
  354. package/src/shared/web.shared.ts.txt +20 -24
  355. package/src/stream/sse.ts +5 -5
  356. package/src/syncer/api-parser.ts +282 -0
  357. package/src/syncer/checksum.ts +140 -0
  358. package/src/syncer/code-generator.ts +198 -0
  359. package/src/syncer/entity-operations.ts +65 -0
  360. package/src/syncer/file-patterns.ts +56 -0
  361. package/src/syncer/index.ts +6 -0
  362. package/src/syncer/module-loader.ts +128 -0
  363. package/src/syncer/syncer.ts +389 -1453
  364. package/src/template/entity-converter.ts +114 -0
  365. package/src/template/helpers.ts +81 -0
  366. package/src/{templates → template/implementations}/entity.template.ts +7 -7
  367. package/src/{templates → template/implementations}/generated.template.ts +101 -101
  368. package/src/{templates → template/implementations}/generated_http.template.ts +27 -57
  369. package/src/template/implementations/generated_sso.template.ts +151 -0
  370. package/src/{templates → template/implementations}/init_types.template.ts +5 -7
  371. package/src/{templates → template/implementations}/model.template.ts +52 -43
  372. package/src/{templates → template/implementations}/model_test.template.ts +5 -5
  373. package/src/{templates → template/implementations}/service.template.ts +66 -82
  374. package/src/{templates → template/implementations}/view_enums_buttonset.template.ts +3 -3
  375. package/src/{templates → template/implementations}/view_enums_dropdown.template.ts +4 -20
  376. package/src/{templates → template/implementations}/view_enums_select.template.ts +4 -4
  377. package/src/{templates → template/implementations}/view_form.template.ts +40 -83
  378. package/src/{templates → template/implementations}/view_id_all_select.template.ts +3 -3
  379. package/src/{templates → template/implementations}/view_id_async_select.template.ts +10 -24
  380. package/src/{templates → template/implementations}/view_list.template.ts +60 -152
  381. package/src/{templates → template/implementations}/view_list_columns.template.ts +5 -11
  382. package/src/{templates → template/implementations}/view_search_input.template.ts +3 -3
  383. package/src/template/index.ts +6 -0
  384. package/src/template/template-manager.ts +166 -0
  385. package/src/template/template-types.ts +16 -0
  386. package/src/template/template.ts +105 -0
  387. package/src/template/zod-converter.ts +525 -0
  388. package/src/testing/_relation-graph.ts +18 -11
  389. package/src/testing/fixture-manager.ts +472 -359
  390. package/src/types/types.ts +553 -308
  391. package/src/typings/knex.d.ts +7 -9
  392. package/src/utils/async-utils.ts +23 -10
  393. package/src/utils/console-util.ts +4 -0
  394. package/src/utils/controller.ts +3 -0
  395. package/src/utils/esm-utils.ts +59 -0
  396. package/src/utils/formatter.ts +109 -0
  397. package/src/utils/fs-utils.ts +1 -1
  398. package/src/utils/lodash-able.ts +1 -4
  399. package/src/utils/object-utils.ts +217 -0
  400. package/src/utils/path-utils.ts +99 -0
  401. package/src/utils/process-utils.ts +46 -0
  402. package/src/utils/sql-parser.ts +23 -5
  403. package/src/utils/type-utils.ts +83 -0
  404. package/src/utils/utils.ts +66 -43
  405. package/src/utils/zod-error.ts +3 -4
  406. package/dist/api/base-frame.js.map +0 -1
  407. package/dist/api/caster.js.map +0 -1
  408. package/dist/api/code-converters.js.map +0 -1
  409. package/dist/api/context.js.map +0 -1
  410. package/dist/api/decorators.js.map +0 -1
  411. package/dist/api/index.js.map +0 -1
  412. package/dist/api/sonamu.js.map +0 -1
  413. package/dist/bin/build-config.js.map +0 -1
  414. package/dist/bin/cli-wrapper.d.ts +0 -3
  415. package/dist/bin/cli-wrapper.d.ts.map +0 -1
  416. package/dist/bin/cli-wrapper.js +0 -3
  417. package/dist/bin/cli-wrapper.js.map +0 -1
  418. package/dist/bin/cli.js.map +0 -1
  419. package/dist/database/_batch_update.js.map +0 -1
  420. package/dist/database/base-model.js.map +0 -1
  421. package/dist/database/code-generator.js.map +0 -1
  422. package/dist/database/db.js.map +0 -1
  423. package/dist/database/knex-plugins/knex-on-duplicate-update.d.ts +0 -2
  424. package/dist/database/knex-plugins/knex-on-duplicate-update.d.ts.map +0 -1
  425. package/dist/database/knex-plugins/knex-on-duplicate-update.js +0 -2
  426. package/dist/database/knex-plugins/knex-on-duplicate-update.js.map +0 -1
  427. package/dist/database/puri-wrapper.js.map +0 -1
  428. package/dist/database/puri.js.map +0 -1
  429. package/dist/database/puri.types.js.map +0 -1
  430. package/dist/database/transaction-context.js.map +0 -1
  431. package/dist/database/upsert-builder.js.map +0 -1
  432. package/dist/entity/entity-manager.js.map +0 -1
  433. package/dist/entity/entity-utils.d.ts +0 -61
  434. package/dist/entity/entity-utils.d.ts.map +0 -1
  435. package/dist/entity/entity-utils.js +0 -2
  436. package/dist/entity/entity-utils.js.map +0 -1
  437. package/dist/entity/entity.js.map +0 -1
  438. package/dist/exceptions/error-handler.js.map +0 -1
  439. package/dist/exceptions/so-exceptions.js.map +0 -1
  440. package/dist/file-storage/driver.js.map +0 -1
  441. package/dist/file-storage/file-storage.js.map +0 -1
  442. package/dist/index.js.map +0 -1
  443. package/dist/migration/code-generation.js.map +0 -1
  444. package/dist/migration/migration-set.js.map +0 -1
  445. package/dist/migration/migrator.js.map +0 -1
  446. package/dist/migration/types.js.map +0 -1
  447. package/dist/stream/index.js.map +0 -1
  448. package/dist/stream/sse.js.map +0 -1
  449. package/dist/syncer/index.js.map +0 -1
  450. package/dist/syncer/syncer.js.map +0 -1
  451. package/dist/templates/base-template.d.ts +0 -13
  452. package/dist/templates/base-template.d.ts.map +0 -1
  453. package/dist/templates/base-template.js +0 -2
  454. package/dist/templates/base-template.js.map +0 -1
  455. package/dist/templates/entity.template.d.ts.map +0 -1
  456. package/dist/templates/entity.template.js +0 -2
  457. package/dist/templates/entity.template.js.map +0 -1
  458. package/dist/templates/generated.template.d.ts.map +0 -1
  459. package/dist/templates/generated.template.js +0 -2
  460. package/dist/templates/generated.template.js.map +0 -1
  461. package/dist/templates/generated_http.template.d.ts.map +0 -1
  462. package/dist/templates/generated_http.template.js +0 -2
  463. package/dist/templates/generated_http.template.js.map +0 -1
  464. package/dist/templates/generated_sso.template.d.ts.map +0 -1
  465. package/dist/templates/generated_sso.template.js +0 -2
  466. package/dist/templates/generated_sso.template.js.map +0 -1
  467. package/dist/templates/index.d.ts +0 -2
  468. package/dist/templates/index.d.ts.map +0 -1
  469. package/dist/templates/index.js +0 -2
  470. package/dist/templates/index.js.map +0 -1
  471. package/dist/templates/init_types.template.d.ts.map +0 -1
  472. package/dist/templates/init_types.template.js +0 -2
  473. package/dist/templates/init_types.template.js.map +0 -1
  474. package/dist/templates/model.template.d.ts +0 -17
  475. package/dist/templates/model.template.d.ts.map +0 -1
  476. package/dist/templates/model.template.js +0 -2
  477. package/dist/templates/model.template.js.map +0 -1
  478. package/dist/templates/model_test.template.d.ts.map +0 -1
  479. package/dist/templates/model_test.template.js +0 -2
  480. package/dist/templates/model_test.template.js.map +0 -1
  481. package/dist/templates/service.template.d.ts.map +0 -1
  482. package/dist/templates/service.template.js +0 -2
  483. package/dist/templates/service.template.js.map +0 -1
  484. package/dist/templates/view_enums_buttonset.template.d.ts.map +0 -1
  485. package/dist/templates/view_enums_buttonset.template.js +0 -2
  486. package/dist/templates/view_enums_buttonset.template.js.map +0 -1
  487. package/dist/templates/view_enums_dropdown.template.d.ts.map +0 -1
  488. package/dist/templates/view_enums_dropdown.template.js +0 -2
  489. package/dist/templates/view_enums_dropdown.template.js.map +0 -1
  490. package/dist/templates/view_enums_select.template.d.ts.map +0 -1
  491. package/dist/templates/view_enums_select.template.js +0 -2
  492. package/dist/templates/view_enums_select.template.js.map +0 -1
  493. package/dist/templates/view_form.template.d.ts.map +0 -1
  494. package/dist/templates/view_form.template.js +0 -2
  495. package/dist/templates/view_form.template.js.map +0 -1
  496. package/dist/templates/view_id_all_select.template.d.ts.map +0 -1
  497. package/dist/templates/view_id_all_select.template.js +0 -2
  498. package/dist/templates/view_id_all_select.template.js.map +0 -1
  499. package/dist/templates/view_id_async_select.template.d.ts.map +0 -1
  500. package/dist/templates/view_id_async_select.template.js +0 -2
  501. package/dist/templates/view_id_async_select.template.js.map +0 -1
  502. package/dist/templates/view_list.template.d.ts.map +0 -1
  503. package/dist/templates/view_list.template.js +0 -2
  504. package/dist/templates/view_list.template.js.map +0 -1
  505. package/dist/templates/view_list_columns.template.d.ts +0 -17
  506. package/dist/templates/view_list_columns.template.d.ts.map +0 -1
  507. package/dist/templates/view_list_columns.template.js +0 -2
  508. package/dist/templates/view_list_columns.template.js.map +0 -1
  509. package/dist/templates/view_search_input.template.d.ts.map +0 -1
  510. package/dist/templates/view_search_input.template.js +0 -2
  511. package/dist/templates/view_search_input.template.js.map +0 -1
  512. package/dist/testing/_relation-graph.js.map +0 -1
  513. package/dist/testing/fixture-manager.js.map +0 -1
  514. package/dist/types/types.js.map +0 -1
  515. package/dist/typings/knex.d.js.map +0 -1
  516. package/dist/utils/async-utils.js.map +0 -1
  517. package/dist/utils/controller.js.map +0 -1
  518. package/dist/utils/fs-utils.js.map +0 -1
  519. package/dist/utils/lodash-able.js.map +0 -1
  520. package/dist/utils/model.js.map +0 -1
  521. package/dist/utils/sql-parser.js.map +0 -1
  522. package/dist/utils/utils.js.map +0 -1
  523. package/dist/utils/zod-error.js.map +0 -1
  524. package/src/bin/cli-wrapper.ts +0 -75
  525. package/src/database/knex-plugins/knex-on-duplicate-update.ts +0 -45
  526. package/src/entity/entity-utils.ts +0 -291
  527. package/src/templates/base-template.ts +0 -19
  528. package/src/templates/generated_sso.template.ts +0 -138
  529. package/src/templates/index.ts +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAIA,wBAAsB,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAMtE;AACD,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EAAE,EACnB,SAAS,GAAE,OAAe,GACzB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,GAAG,CAAA;CAAE,EAAE,CAAC,CAsBhD;AACD,wBAAsB,eAAe,oBAGpC;AAED,wBAAgB,eAAe,WAmB9B;AAED,wBAAgB,WA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E,SAAS,CAAC,EAAE,EAClB,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GAClC,CAAC,EAAE,CAEL"}
@@ -1,2 +1,72 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:Object.getOwnPropertyDescriptor(all,name).get})}_export(exports,{get findApiRootPath(){return findApiRootPath},get findAppRootPath(){return findAppRootPath},get globAsync(){return globAsync},get importMultiple(){return importMultiple},get nonNullable(){return nonNullable}});var _path=/*#__PURE__*/_interop_require_default(require("path"));var _promises=require("fs/promises");var _fs=/*#__PURE__*/_interop_require_default(require("fs"));function _async_iterator(iterable){var method,async,sync,retry=2;for("undefined"!=typeof Symbol&&(async=Symbol.asyncIterator,sync=Symbol.iterator);retry--;){if(async&&null!=(method=iterable[async]))return method.call(iterable);if(sync&&null!=(method=iterable[sync]))return new AsyncFromSyncIterator(method.call(iterable));async="@@asyncIterator",sync="@@iterator"}throw new TypeError("Object is not async iterable")}function AsyncFromSyncIterator(s){function AsyncFromSyncIteratorContinuation(r){if(Object(r)!==r)return Promise.reject(new TypeError(r+" is not an object."));var done=r.done;return Promise.resolve(r.value).then(function(value){return{value:value,done:done}})}return AsyncFromSyncIterator=function(s){this.s=s,this.n=s.next},AsyncFromSyncIterator.prototype={s:null,n:null,next:function(){return AsyncFromSyncIteratorContinuation(this.n.apply(this.s,arguments))},return:function(value){var ret=this.s.return;return void 0===ret?Promise.resolve({value:value,done:!0}):AsyncFromSyncIteratorContinuation(ret.apply(this.s,arguments))},throw:function(value){var thr=this.s.return;return void 0===thr?Promise.reject(value):AsyncFromSyncIteratorContinuation(thr.apply(this.s,arguments))}},new AsyncFromSyncIterator(s)}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _async_to_generator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}function _interop_require_default(obj){return obj&&obj.__esModule?obj:{default:obj}}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interop_require_wildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={__proto__:null};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}function _ts_generator(thisArg,body){var f,y,t,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},g=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return g.next=verb(0),g["throw"]=verb(1),g["return"]=verb(2),typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(g&&(g=0,op[0]&&(_=0)),_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}}function globAsync(pathPattern){return _async_to_generator(function(){var files,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_iterator,_step,_value,file,err;return _ts_generator(this,function(_state){switch(_state.label){case 0:files=[];_iteratorAbruptCompletion=false,_didIteratorError=false;_state.label=1;case 1:_state.trys.push([1,6,7,12]);_iterator=_async_iterator((0,_promises.glob)(_path.default.resolve(pathPattern)));_state.label=2;case 2:return[4,_iterator.next()];case 3:if(!(_iteratorAbruptCompletion=!(_step=_state.sent()).done))return[3,5];_value=_step.value;file=_value;files.push(file);_state.label=4;case 4:_iteratorAbruptCompletion=false;return[3,2];case 5:return[3,12];case 6:err=_state.sent();_didIteratorError=true;_iteratorError=err;return[3,12];case 7:_state.trys.push([7,,10,11]);if(!(_iteratorAbruptCompletion&&_iterator.return!=null))return[3,9];return[4,_iterator.return()];case 8:_state.sent();_state.label=9;case 9:return[3,11];case 10:if(_didIteratorError){throw _iteratorError}return[7];case 11:return[7];case 12:return[2,files]}})})()}function importMultiple(filePaths){var doRefresh=arguments.length>1&&arguments[1]!==void 0?arguments[1]:false;return _async_to_generator(function(){var results,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step,filePath,importPath,imported,err;return _ts_generator(this,function(_state){switch(_state.label){case 0:results=[];_iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;_state.label=1;case 1:_state.trys.push([1,6,7,8]);_iterator=filePaths[Symbol.iterator]();_state.label=2;case 2:if(!!(_iteratorNormalCompletion=(_step=_iterator.next()).done))return[3,5];filePath=_step.value;importPath="./"+_path.default.relative(__dirname,filePath);if(doRefresh){if(require.resolve){delete require.cache[require.resolve(importPath)]}else{importPath+="?t=".concat(Date.now())}}return[4,Promise.resolve(importPath).then(function(p){return /*#__PURE__*/_interop_require_wildcard(require(p))})];case 3:imported=_state.sent();results.push({filePath:filePath,imported:imported});_state.label=4;case 4:_iteratorNormalCompletion=true;return[3,2];case 5:return[3,8];case 6:err=_state.sent();_didIteratorError=true;_iteratorError=err;return[3,8];case 7:try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}return[7];case 8:return[2,results]}})})()}function findAppRootPath(){return _async_to_generator(function(){var apiRootPath;return _ts_generator(this,function(_state){apiRootPath=findApiRootPath();return[2,apiRootPath.split(_path.default.sep).slice(0,-1).join(_path.default.sep)]})})()}function findApiRootPath(){var _require_main;var workspacePath=process.env["INIT_CWD"];if(workspacePath&&workspacePath.length!==0){return workspacePath}var _require_main_path;var basePath=(_require_main_path=(_require_main=require.main)===null||_require_main===void 0?void 0:_require_main.path)!==null&&_require_main_path!==void 0?_require_main_path:__dirname;var dir=_path.default.dirname(basePath);if(dir.includes("/.yarn/")){dir=dir.split("/.yarn/")[0]}do{if(_fs.default.existsSync(_path.default.join(dir,"/package.json"))){return dir.split(_path.default.sep).join(_path.default.sep)}dir=dir.split(_path.default.sep).slice(0,-1).join(_path.default.sep)}while(dir.split(_path.default.sep).length>1);throw new Error("Cannot find AppRoot using Sonamu -2")}function nonNullable(value){return value!==null&&value!==undefined}
2
- //# sourceMappingURL=utils.js.map
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { cluster } from "radashi";
4
+ export async function findAppRootPath() {
5
+ const apiRootPath = findApiRootPath();
6
+ return apiRootPath.split(path.sep).slice(0, -1).join(path.sep);
7
+ }
8
+ export function findApiRootPath() {
9
+ // NOTE: for support npm / yarn / pnpm workspaces
10
+ // 하지만 workspace 쓰면 process.cwd() 하면 되는데... 이건 나중에 협의 후 수정하는걸로
11
+ const workspacePath = process.env.PNPM_SCRIPT_SRC_DIR ?? process.env.INIT_CWD;
12
+ if (nonNullable(workspacePath)) {
13
+ return workspacePath;
14
+ }
15
+ if (nonNullable(process.env.PNPM_PACKAGE_NAME)) {
16
+ return process.cwd().split(path.sep).join(path.sep);
17
+ }
18
+ const basePath = import.meta.filename;
19
+ let dir = path.dirname(basePath);
20
+ if (dir.includes("/.yarn/")) {
21
+ dir = dir.split("/.yarn/")[0];
22
+ }
23
+ do {
24
+ if (fs.existsSync(path.join(dir, "/package.json"))) {
25
+ return dir.split(path.sep).join(path.sep);
26
+ }
27
+ dir = dir.split(path.sep).slice(0, -1).join(path.sep);
28
+ }while (dir.split(path.sep).length > 1)
29
+ throw new Error("Cannot find AppRoot using Sonamu -2");
30
+ }
31
+ export function nonNullable(value) {
32
+ return value !== null && value !== undefined;
33
+ }
34
+ export function exhaustive(_param) {
35
+ throw new Error(`exhaustive`);
36
+ }
37
+ // 일반 버전
38
+ export function assertExists(value, message) {
39
+ if (value === null || value === undefined) {
40
+ throw new Error(message ?? "Value must exist");
41
+ }
42
+ return value;
43
+ }
44
+ // null만 체크
45
+ export function assertNotNull(value, message) {
46
+ if (value === null) {
47
+ throw new Error(message ?? "Value must not be null");
48
+ }
49
+ return value;
50
+ }
51
+ // undefined만 체크
52
+ export function assertDefined(value, message) {
53
+ if (value === undefined) {
54
+ throw new Error(message ?? "Value must be defined");
55
+ }
56
+ return value;
57
+ }
58
+ // lodash chunk 대체 (radash cluster 사용)
59
+ export function chunk(array, size) {
60
+ return cluster(array, Math.ceil(array.length / size));
61
+ }
62
+ // lodash intersectionBy 대체
63
+ export function intersectionBy(arr1, arr2, iteratee) {
64
+ const arr2Keys = new Set(arr2.map(iteratee));
65
+ return arr1.filter((item)=>arr2Keys.has(iteratee(item)));
66
+ }
67
+ // lodash differenceWith 대체
68
+ export function differenceWith(arr1, arr2, comparator) {
69
+ return arr1.filter((itemA)=>!arr2.some((itemB)=>comparator(itemA, itemB)));
70
+ }
71
+
72
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy91dGlscy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgZnMgZnJvbSBcImZzXCI7XG5pbXBvcnQgcGF0aCBmcm9tIFwicGF0aFwiO1xuaW1wb3J0IHsgY2x1c3RlciB9IGZyb20gXCJyYWRhc2hpXCI7XG5pbXBvcnQgdHlwZSB7IEFic29sdXRlUGF0aCB9IGZyb20gXCIuL3BhdGgtdXRpbHNcIjtcblxuZXhwb3J0IGFzeW5jIGZ1bmN0aW9uIGZpbmRBcHBSb290UGF0aCgpOiBQcm9taXNlPEFic29sdXRlUGF0aD4ge1xuICBjb25zdCBhcGlSb290UGF0aCA9IGZpbmRBcGlSb290UGF0aCgpO1xuICByZXR1cm4gYXBpUm9vdFBhdGguc3BsaXQocGF0aC5zZXApLnNsaWNlKDAsIC0xKS5qb2luKHBhdGguc2VwKSBhcyBBYnNvbHV0ZVBhdGg7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBmaW5kQXBpUm9vdFBhdGgoKTogQWJzb2x1dGVQYXRoIHtcbiAgLy8gTk9URTogZm9yIHN1cHBvcnQgbnBtIC8geWFybiAvIHBucG0gd29ya3NwYWNlc1xuICAvLyDtlZjsp4Drp4wgd29ya3NwYWNlIOyTsOuptCBwcm9jZXNzLmN3ZCgpIO2VmOuptCDrkJjripTrjbAuLi4g7J206rG0IOuCmOykkeyXkCDtmJHsnZgg7ZuEIOyImOygle2VmOuKlOqxuOuhnFxuICBjb25zdCB3b3Jrc3BhY2VQYXRoID0gcHJvY2Vzcy5lbnYuUE5QTV9TQ1JJUFRfU1JDX0RJUiA/PyBwcm9jZXN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0MsUUFBVUgsV0FBV0MsT0FBT0U7QUFDeEUifQ==
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import type { z } from "zod";
2
2
  type ValidationError = {
3
3
  path: string[];
4
4
  message: string;
@@ -1 +1 @@
1
- {"version":3,"file":"zod-error.d.ts","sourceRoot":"","sources":["../../src/utils/zod-error.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,GAAG,eAAe,EAAE,CAgBrE"}
1
+ {"version":3,"file":"zod-error.d.ts","sourceRoot":"","sources":["../../src/utils/zod-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,GAAG,eAAe,EAAE,CAgBrE"}
@@ -1,2 +1,19 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"humanizeZodError",{enumerable:true,get:function(){return humanizeZodError}});function _type_of(obj){"@swc/helpers - typeof";return obj&&typeof Symbol!=="undefined"&&obj.constructor===Symbol?"symbol":typeof obj}function humanizeZodError(error){return error.issues.map(function(param){var originPath=param.path,message=param.message;var path=originPath.map(function(item){if((typeof item==="undefined"?"undefined":_type_of(item))==="symbol"){var _item_description;return(_item_description=item.description)!==null&&_item_description!==void 0?_item_description:item.toString()}if(typeof item==="number"){return"[".concat(item,"]")}return item});return{path:path,message:message}})}
2
- //# sourceMappingURL=zod-error.js.map
1
+ export function humanizeZodError(error) {
2
+ return error.issues.map(({ path: originPath, message })=>{
3
+ const path = originPath.map((item)=>{
4
+ if (typeof item === "symbol") {
5
+ return item.description ?? item.toString();
6
+ }
7
+ if (typeof item === "number") {
8
+ return `[${item}]`;
9
+ }
10
+ return item;
11
+ });
12
+ return {
13
+ path,
14
+ message: message
15
+ };
16
+ });
17
+ }
18
+
19
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy96b2QtZXJyb3IudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyB6IH0gZnJvbSBcInpvZFwiO1xuXG50eXBlIFZhbGlkYXRpb25FcnJvciA9IHtcbiAgcGF0aDogc3RyaW5nW107XG4gIG1lc3NhZ2U6IHN0cmluZztcbn07XG5cbmV4cG9ydCBmdW5jdGlvbiBodW1hbml6ZVpvZEVycm9yKGVycm9yOiB6LlpvZEVycm9yKTogVmFsaWRhdGlvbkVycm9yW10ge1xuICByZXR1cm4gZXJyb3IuaXNzdWVzLm1hcCgoeyBwYXRoOiBvcmlnaW5QYXRoLCBtZXNzYWdlIH0pID0+IHtcbiAgICBjb25zdCBwYXRoID0gb3JpZ2luUGF0aC5tYXAoKGl0ZW0pID0+IHtcbiAgICAgIGlmICh0eXBlb2YgaXRlbSA9PT0gXCJzeW1ib2xcIikge1xuICAgICAgICByZXR1cm4gaXRlbS5kZXNjcmlwdGlvbiA/PyBpdGVtLnRvU3RyaW5nKCk7XG4gICAgICB9XG5cbiAgICAgIGlmICh0eXBlb2YgaXRlbSA9PT0gXCJudW1iZXJcIikge1xuICAgICAgICByZXR1cm4gYFske2l0ZW19XWA7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBpdGVtO1xuICAgIH0pO1xuXG4gICAgcmV0dXJuIHsgcGF0aCwgbWVzc2FnZTogbWVzc2FnZSB9O1xuICB9KTtcbn1cbiJdLCJuYW1lcyI6WyJodW1hbml6ZVpvZEVycm9yIiwiZXJyb3IiLCJpc3N1ZXMiLCJtYXAiLCJwYXRoIiwib3JpZ2luUGF0aCIsIm1lc3NhZ2UiLCJpdGVtIiwiZGVzY3JpcHRpb24iLCJ0b1N0cmluZyJdLCJtYXBwaW5ncyI6IkFBT0EsT0FBTyxTQUFTQSxpQkFBaUJDLEtBQWlCO0lBQ2hELE9BQU9BLE1BQU1DLE1BQU0sQ0FBQ0MsR0FBRyxDQUFDLENBQUMsRUFBRUMsTUFBTUMsVUFBVSxFQUFFQyxPQUFPLEVBQUU7UUFDcEQsTUFBTUYsT0FBT0MsV0FBV0YsR0FBRyxDQUFDLENBQUNJO1lBQzNCLElBQUksT0FBT0EsU0FBUyxVQUFVO2dCQUM1QixPQUFPQSxLQUFLQyxXQUFXLElBQUlELEtBQUtFLFFBQVE7WUFDMUM7WUFFQSxJQUFJLE9BQU9GLFNBQVMsVUFBVTtnQkFDNUIsT0FBTyxDQUFDLENBQUMsRUFBRUEsS0FBSyxDQUFDLENBQUM7WUFDcEI7WUFFQSxPQUFPQTtRQUNUO1FBRUEsT0FBTztZQUFFSDtZQUFNRSxTQUFTQTtRQUFRO0lBQ2xDO0FBQ0YifQ==
package/package.json CHANGED
@@ -1,18 +1,32 @@
1
1
  {
2
2
  "name": "sonamu",
3
- "version": "0.5.7",
3
+ "version": "0.7.0",
4
4
  "description": "Sonamu — TypeScript Fullstack API Framework",
5
5
  "keywords": [
6
6
  "typescript",
7
7
  "framework",
8
8
  "orm"
9
9
  ],
10
- "main": "./dist/index.js",
11
- "exports": "./dist/index.js",
12
- "scripts": {
13
- "dev": "nodemon exec",
14
- "build": "swc src --config-file .swcrc -d dist --strip-leading-paths && tsc --emitDeclarationOnly",
15
- "publish": "yarn build && yarn npm publish"
10
+ "type": "module",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.js",
14
+ "types": "./dist/index.d.ts"
15
+ },
16
+ "./ai": {
17
+ "import": "./dist/ai/index.js",
18
+ "types": "./dist/ai/index.d.ts"
19
+ },
20
+ "./ai/providers/rtzr": {
21
+ "import": "./dist/ai/providers/rtzr/index.js",
22
+ "types": "./dist/ai/providers/rtzr/index.d.ts"
23
+ },
24
+ "./loader-register": {
25
+ "default": "./dist/bin/loader-register.js"
26
+ },
27
+ "./hot-hook-register": {
28
+ "default": "./dist/bin/hot-hook-register.js"
29
+ }
16
30
  },
17
31
  "license": "MIT",
18
32
  "author": {
@@ -24,66 +38,90 @@
24
38
  "type": "git",
25
39
  "url": "https://github.com/ping-alive/sonamu.git"
26
40
  },
27
- "bin": "./dist/bin/cli-wrapper.js",
41
+ "bin": "./bin/cli.js",
28
42
  "files": [
29
43
  "dist",
30
- "src"
44
+ "src",
45
+ "bin",
46
+ ".swcrc.project-default"
31
47
  ],
32
48
  "dependencies": {
33
49
  "@aws-sdk/client-s3": "^3.921.0",
34
50
  "@aws-sdk/s3-request-presigner": "^3.921.0",
51
+ "@biomejs/js-api": "^4.0.0",
52
+ "@biomejs/wasm-nodejs": "^2.3.7",
35
53
  "@fastify/cors": "^8.1.0",
36
54
  "@fastify/formbody": "^7.1.0",
37
55
  "@fastify/multipart": "^8",
38
56
  "@fastify/passport": "^2.2.0",
39
- "@fastify/secure-session": "^5.2.0",
57
+ "@fastify/secure-session": "^7",
40
58
  "@fastify/static": "^7",
41
59
  "@swc/core": "^1.13.19",
42
60
  "chalk": "^4.1.2",
43
61
  "chokidar": "^4.0.3",
44
- "date-fns": "^4.1.0",
45
62
  "date-fns-tz": "^3.2.0",
46
63
  "dotenv": "^16.0.2",
47
64
  "fast-deep-equal": "^3.1.3",
48
65
  "fastify": "^4.23.2",
49
66
  "fastify-qs": "^4.0.0",
50
67
  "fastify-sse-v2": "^4.2.1",
51
- "flydrive": "^1.3.0",
52
68
  "inflection": "^1.13.2",
53
69
  "knex": "^3.1.0",
54
- "lodash": "^4.17.21",
55
- "luxon": "^3.0.3",
56
70
  "mime-types": "^3.0.1",
57
71
  "minimatch": "^10.0.3",
58
- "mysql2": "^3.6.1",
59
72
  "node-sql-parser": "^5.2.0",
60
- "nodemon": "^3.1.10",
73
+ "pg": "^8.16.3",
61
74
  "prompts": "^2.4.2",
62
75
  "qs": "^6.11.0",
63
- "source-map-support": "^0.5.21",
76
+ "radashi": "^12.2.0",
64
77
  "tsicli": "^1.0.5",
65
- "zod": "^4.1.12"
78
+ "vitest": "^4.0.10",
79
+ "zod": "^4.1.12",
80
+ "@sonamu-kit/hot-runner": "^0.1.1",
81
+ "@sonamu-kit/loader": "^2.1.3",
82
+ "@sonamu-kit/hot-hook": "^0.4.1"
66
83
  },
67
84
  "devDependencies": {
68
- "@sonamu-kit/ui": "^0.5.1",
85
+ "@biomejs/biome": "^2.3.7",
69
86
  "@swc/cli": "^0.7.8",
70
87
  "@types/inflection": "^1.13.0",
71
- "@types/lodash": "^4.14.198",
72
- "@types/luxon": "^3.0.1",
73
88
  "@types/mime-types": "^3.0.1",
74
89
  "@types/node": "^22",
75
- "@types/prettier": "^3.0.0",
90
+ "@types/pg": "^8.15.6",
76
91
  "@types/prompts": "^2.0.14",
77
92
  "@types/qs": "^6.9.7",
78
- "prettier": "^3.2.5",
93
+ "nodemon": "3.1.10",
79
94
  "tsup": "^8.1.0",
80
- "typescript": "^5.2.2"
95
+ "typescript": "^5.9.3"
81
96
  },
82
97
  "peerDependencies": {
98
+ "@swc/cli": "^0.7.8",
99
+ "@swc/core": "^1.13.5",
83
100
  "fastify": "^4.23.2",
84
101
  "knex": "^3.1.0",
85
- "mysql2": "^3.6.1",
86
- "nodemon": "3.1.10",
87
- "source-map-support": "^0.5.21"
102
+ "typescript": "^5.9.3",
103
+ "@ai-sdk/openai": "3.0.0-beta.75",
104
+ "@ai-sdk/provider": "3.0.0-beta.22",
105
+ "@ai-sdk/provider-utils": "4.0.0-beta.40",
106
+ "ai": "^6.0.0-beta.99"
107
+ },
108
+ "peerDependenciesMeta": {
109
+ "@ai-sdk/openai": {
110
+ "optional": true
111
+ },
112
+ "@ai-sdk/provider": {
113
+ "optional": true
114
+ },
115
+ "@ai-sdk/provider-utils": {
116
+ "optional": true
117
+ },
118
+ "ai": {
119
+ "optional": true
120
+ }
121
+ },
122
+ "scripts": {
123
+ "dev": "nodemon exec",
124
+ "build": "rm -rf dist && swc src -d dist --strip-leading-paths && tsc --emitDeclarationOnly",
125
+ "test:type": "vitest --typecheck test-d.ts"
88
126
  }
89
127
  }
@@ -0,0 +1,87 @@
1
+ import type { Tool, ToolCallOptions } from "@ai-sdk/provider-utils";
2
+ import { tool } from "@ai-sdk/provider-utils";
3
+ import type { Agent, ToolSet } from "ai";
4
+ import { ToolLoopAgent } from "ai";
5
+ import { AsyncLocalStorage } from "async_hooks";
6
+ import inflection from "inflection";
7
+ import type { AgentConfig, RegisteredToolDefinition, ToolDecoratorOptions } from "./types";
8
+
9
+ const toolDefinitions: RegisteredToolDefinition[] = [];
10
+
11
+ // TODO(Haze, 251205): 텍스트가 아닌 structured output일 경우에 대한 지원이 필요
12
+ export class BaseAgentClass<TStore> {
13
+ private _als = new AsyncLocalStorage<TStore>();
14
+
15
+ public get store() {
16
+ return this._als.getStore();
17
+ }
18
+
19
+ // NOTE: [schemaSymbol] 추론 불가로 인해 캐스팅
20
+ protected get toolSet() {
21
+ const targeted = toolDefinitions.filter((def) => def.from === this.constructor.name);
22
+ return targeted.reduce<Record<string, Tool>>((acc, def) => {
23
+ acc[def.name] = tool({
24
+ description: def.description,
25
+ inputSchema: def.schema.input,
26
+ outputSchema: def.schema.output,
27
+ needsApproval: def.needsApproval ?? false,
28
+ toModelOutput: def.toModelOutput,
29
+ providerOptions: def.providerOptions,
30
+ execute: (input: unknown, options: ToolCallOptions) => {
31
+ const bound = def.method.bind(this);
32
+ return bound.length >= 2 ? bound(input, options) : bound(input);
33
+ },
34
+ });
35
+ return acc;
36
+ }, {}) as ToolSet;
37
+ }
38
+
39
+ public get tools(): ToolSet {
40
+ return this.toolSet;
41
+ }
42
+
43
+ public use<TReturn>(
44
+ config: AgentConfig,
45
+ initialStatus: TStore,
46
+ callback: (agent: Agent<never, ToolSet>) => Promise<TReturn>,
47
+ ) {
48
+ const agent = new ToolLoopAgent({
49
+ ...config,
50
+ tools: this.tools,
51
+ });
52
+
53
+ return this._als.run(initialStatus, () => callback(agent));
54
+ }
55
+ }
56
+
57
+ export function tools<INPUT, OUTPUT = unknown>(options: ToolDecoratorOptions<INPUT, OUTPUT>) {
58
+ const { name, description, schema, needsApproval, toModelOutput, providerOptions } = options;
59
+ return (target: BaseAgentClass<unknown>, propertyKey: string, descriptor: PropertyDescriptor) => {
60
+ if (!(target instanceof BaseAgentClass)) {
61
+ throw new Error("Target must be a subclass of BaseAgentClass");
62
+ }
63
+
64
+ const method = descriptor.value;
65
+ const modelName = target.constructor.name.match(/(.+)Class$/)?.[1];
66
+ const methodName = propertyKey;
67
+
68
+ const defaultPath =
69
+ modelName !== undefined
70
+ ? `${inflection.camelize(
71
+ (modelName ?? "").replace(/Model$/, "").replace(/Frame$/, ""),
72
+ true,
73
+ )}.${inflection.camelize(methodName, true)}`
74
+ : inflection.camelize(methodName, true);
75
+
76
+ toolDefinitions.push({
77
+ name: name ?? defaultPath,
78
+ description,
79
+ schema,
80
+ needsApproval,
81
+ toModelOutput,
82
+ providerOptions,
83
+ method,
84
+ from: target.constructor.name,
85
+ });
86
+ };
87
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./agent";
2
+ export * from "./types";
@@ -0,0 +1,47 @@
1
+ import type { ProviderOptions, Schema, Tool } from "@ai-sdk/provider-utils";
2
+ import type { LanguageModel, StopCondition, ToolSet } from "ai";
3
+
4
+ export type ToolChoiceLimited = "auto" | "none" | "required";
5
+
6
+ export interface ToolDecoratorSchema<INPUT, OUTPUT = unknown> {
7
+ input: Schema<INPUT>;
8
+ output?: Schema<OUTPUT>;
9
+ }
10
+
11
+ export interface ToolDecoratorOptions<INPUT, OUTPUT = unknown> {
12
+ name?: string;
13
+ description?: string;
14
+ schema: ToolDecoratorSchema<INPUT, OUTPUT>;
15
+ needsApproval?: Tool<INPUT, OUTPUT>["needsApproval"];
16
+ toModelOutput?: Tool<INPUT, OUTPUT>["toModelOutput"];
17
+ providerOptions?: ProviderOptions;
18
+ }
19
+
20
+ export type RegisteredToolDefinition = {
21
+ name: string;
22
+ description?: string;
23
+ schema: ToolDecoratorSchema<unknown, unknown>;
24
+ needsApproval?: Tool["needsApproval"];
25
+ toModelOutput?: Tool["toModelOutput"];
26
+ providerOptions?: ProviderOptions;
27
+ method: (...args: unknown[]) => unknown;
28
+ from: string;
29
+ };
30
+
31
+ export interface AgentConfig {
32
+ model: LanguageModel;
33
+ instructions?: string;
34
+ toolChoice?: ToolChoiceLimited;
35
+ providerOptions?: ProviderOptions;
36
+ stopWhen?: StopCondition<ToolSet> | Array<StopCondition<ToolSet>>;
37
+ activeTools?: Array<string>;
38
+ maxOutputTokens?: number;
39
+ temperature?: number;
40
+ topP?: number;
41
+ topK?: number;
42
+ presencePenalty?: number;
43
+ frequencyPenalty?: number;
44
+ stopSequences?: string[];
45
+ seed?: number;
46
+ headers?: Record<string, string | undefined>;
47
+ }
@@ -0,0 +1 @@
1
+ export * from "./agents";
@@ -0,0 +1,37 @@
1
+ import { lazySchema, zodSchema } from "@ai-sdk/provider-utils";
2
+ import { z } from "zod";
3
+
4
+ export const rtzrAuthResponseSchema = z.object({
5
+ access_token: z.string(),
6
+ expire_at: z.number(),
7
+ });
8
+
9
+ export const rtzrTranscriptionResponseSchema = lazySchema(() =>
10
+ zodSchema(
11
+ z.object({
12
+ id: z.string(),
13
+ }),
14
+ ),
15
+ );
16
+
17
+ export const rtzrTranscriptionResultResponseSchema = lazySchema(() =>
18
+ zodSchema(
19
+ z.object({
20
+ id: z.string(),
21
+ status: z.enum(["transcribing", "completed", "failed"]),
22
+ results: z
23
+ .object({
24
+ utterances: z.array(
25
+ z.object({
26
+ start_at: z.number(),
27
+ duration: z.number(),
28
+ msg: z.string(),
29
+ spk: z.number(),
30
+ lang: z.string().optional(),
31
+ }),
32
+ ),
33
+ })
34
+ .nullish(),
35
+ }),
36
+ ),
37
+ );
@@ -0,0 +1,34 @@
1
+ import { AISDKError } from "@ai-sdk/provider";
2
+ import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
3
+ import { z } from "zod";
4
+
5
+ export const rtzrErrorDataSchema = z.object({
6
+ error: z.object({
7
+ msg: z.string(),
8
+ type: z.string().nullish(),
9
+ param: z.any().nullish(),
10
+ code: z.union([z.string(), z.number()]).nullish(),
11
+ }),
12
+ });
13
+
14
+ export type RtzrErrorData = z.infer<typeof rtzrErrorDataSchema>;
15
+
16
+ export const rtzrFailedResponseHandler = createJsonErrorResponseHandler({
17
+ errorSchema: rtzrErrorDataSchema,
18
+ errorToMessage: (data) => data.error.msg,
19
+ });
20
+
21
+ export class RtzrClientError extends AISDKError {
22
+ constructor(
23
+ message: string,
24
+ options?: {
25
+ cause?: Error;
26
+ },
27
+ ) {
28
+ super({
29
+ name: "RtzrClientError",
30
+ message,
31
+ cause: options?.cause,
32
+ });
33
+ }
34
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./error";
2
+ export * from "./model";
3
+ export * from "./options";
4
+ export * from "./provider";