sonamu 0.4.14 → 0.5.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 (385) hide show
  1. package/.swcrc +15 -0
  2. package/dist/api/base-frame.d.ts +8 -0
  3. package/dist/api/base-frame.d.ts.map +1 -0
  4. package/dist/api/base-frame.js +2 -0
  5. package/dist/api/base-frame.js.map +1 -0
  6. package/dist/api/caster.d.ts +5 -0
  7. package/dist/api/caster.d.ts.map +1 -0
  8. package/dist/api/caster.js +2 -0
  9. package/dist/api/caster.js.map +1 -0
  10. package/dist/api/code-converters.d.ts +23 -0
  11. package/dist/api/code-converters.d.ts.map +1 -0
  12. package/dist/api/code-converters.js +2 -0
  13. package/dist/api/code-converters.js.map +1 -0
  14. package/dist/api/context.d.ts +19 -0
  15. package/dist/api/context.d.ts.map +1 -0
  16. package/dist/api/context.js +2 -0
  17. package/dist/api/context.js.map +1 -0
  18. package/dist/api/decorators.d.ts +50 -0
  19. package/dist/api/decorators.d.ts.map +1 -0
  20. package/dist/api/decorators.js +2 -0
  21. package/dist/api/decorators.js.map +1 -0
  22. package/dist/api/index.d.ts +8 -0
  23. package/dist/api/index.d.ts.map +1 -0
  24. package/dist/api/index.js +2 -0
  25. package/dist/api/index.js.map +1 -0
  26. package/dist/api/sonamu.d.ts +84 -0
  27. package/dist/api/sonamu.d.ts.map +1 -0
  28. package/dist/api/sonamu.js +2 -0
  29. package/dist/api/sonamu.js.map +1 -0
  30. package/dist/bin/build-config.d.ts +9 -0
  31. package/dist/bin/build-config.d.ts.map +1 -0
  32. package/dist/bin/build-config.js +2 -0
  33. package/dist/bin/build-config.js.map +1 -0
  34. package/dist/bin/cli-wrapper.d.ts +2 -0
  35. package/dist/bin/cli-wrapper.d.ts.map +1 -0
  36. package/dist/bin/cli-wrapper.js +1 -38
  37. package/dist/bin/cli-wrapper.js.map +1 -1
  38. package/dist/bin/cli.d.ts +2 -2
  39. package/dist/bin/cli.d.ts.map +1 -0
  40. package/dist/bin/cli.js +1 -903
  41. package/dist/bin/cli.js.map +1 -1
  42. package/dist/database/_batch_update.d.ts +15 -0
  43. package/dist/database/_batch_update.d.ts.map +1 -0
  44. package/dist/database/_batch_update.js +2 -0
  45. package/dist/database/_batch_update.js.map +1 -0
  46. package/dist/database/base-model.d.ts +48 -0
  47. package/dist/database/base-model.d.ts.map +1 -0
  48. package/dist/database/base-model.js +2 -0
  49. package/dist/database/base-model.js.map +1 -0
  50. package/dist/database/code-generator.d.ts +13 -0
  51. package/dist/database/code-generator.d.ts.map +1 -0
  52. package/dist/database/code-generator.js +2 -0
  53. package/dist/database/code-generator.js.map +1 -0
  54. package/dist/database/db.d.ts +40 -0
  55. package/dist/database/db.d.ts.map +1 -0
  56. package/dist/database/db.js +2 -0
  57. package/dist/database/db.js.map +1 -0
  58. package/dist/database/knex-plugins/knex-on-duplicate-update.d.ts +2 -0
  59. package/dist/database/knex-plugins/knex-on-duplicate-update.d.ts.map +1 -0
  60. package/dist/database/knex-plugins/knex-on-duplicate-update.js +2 -0
  61. package/dist/database/knex-plugins/knex-on-duplicate-update.js.map +1 -0
  62. package/dist/database/puri-wrapper.d.ts +34 -0
  63. package/dist/database/puri-wrapper.d.ts.map +1 -0
  64. package/dist/database/puri-wrapper.js +2 -0
  65. package/dist/database/puri-wrapper.js.map +1 -0
  66. package/dist/database/puri.d.ts +83 -0
  67. package/dist/database/puri.d.ts.map +1 -0
  68. package/dist/database/puri.js +2 -0
  69. package/dist/database/puri.js.map +1 -0
  70. package/dist/database/puri.types.d.ts +60 -0
  71. package/dist/database/puri.types.d.ts.map +1 -0
  72. package/dist/database/puri.types.js +2 -0
  73. package/dist/database/puri.types.js.map +1 -0
  74. package/dist/database/transaction-context.d.ts +9 -0
  75. package/dist/database/transaction-context.d.ts.map +1 -0
  76. package/dist/database/transaction-context.js +2 -0
  77. package/dist/database/transaction-context.js.map +1 -0
  78. package/dist/database/upsert-builder.d.ts +34 -0
  79. package/dist/database/upsert-builder.d.ts.map +1 -0
  80. package/dist/database/upsert-builder.js +2 -0
  81. package/dist/database/upsert-builder.js.map +1 -0
  82. package/dist/entity/entity-manager.d.ts +32 -0
  83. package/dist/entity/entity-manager.d.ts.map +1 -0
  84. package/dist/entity/entity-manager.js +2 -0
  85. package/dist/entity/entity-manager.js.map +1 -0
  86. package/dist/entity/entity-utils.d.ts +61 -0
  87. package/dist/entity/entity-utils.d.ts.map +1 -0
  88. package/dist/entity/entity-utils.js +2 -0
  89. package/dist/entity/entity-utils.js.map +1 -0
  90. package/dist/entity/entity.d.ts +62 -0
  91. package/dist/entity/entity.d.ts.map +1 -0
  92. package/dist/entity/entity.js +2 -0
  93. package/dist/entity/entity.js.map +1 -0
  94. package/dist/entity/migrator.d.ts +135 -0
  95. package/dist/entity/migrator.d.ts.map +1 -0
  96. package/dist/entity/migrator.js +2 -0
  97. package/dist/entity/migrator.js.map +1 -0
  98. package/dist/exceptions/error-handler.d.ts +3 -0
  99. package/dist/exceptions/error-handler.d.ts.map +1 -0
  100. package/dist/exceptions/error-handler.js +2 -0
  101. package/dist/exceptions/error-handler.js.map +1 -0
  102. package/dist/exceptions/so-exceptions.d.ts +48 -0
  103. package/dist/exceptions/so-exceptions.d.ts.map +1 -0
  104. package/dist/exceptions/so-exceptions.js +2 -0
  105. package/dist/exceptions/so-exceptions.js.map +1 -0
  106. package/dist/file-storage/driver.d.ts +48 -0
  107. package/dist/file-storage/driver.d.ts.map +1 -0
  108. package/dist/file-storage/driver.js +2 -0
  109. package/dist/file-storage/driver.js.map +1 -0
  110. package/dist/file-storage/file-storage.d.ts +50 -0
  111. package/dist/file-storage/file-storage.d.ts.map +1 -0
  112. package/dist/file-storage/file-storage.js +2 -0
  113. package/dist/file-storage/file-storage.js.map +1 -0
  114. package/dist/index.d.ts +23 -813
  115. package/dist/index.d.ts.map +1 -0
  116. package/dist/index.js +1 -433
  117. package/dist/index.js.map +1 -1
  118. package/dist/migration/code-generation.d.ts +15 -0
  119. package/dist/migration/code-generation.d.ts.map +1 -0
  120. package/dist/migration/code-generation.js +2 -0
  121. package/dist/migration/code-generation.js.map +1 -0
  122. package/dist/migration/migration-set.d.ts +17 -0
  123. package/dist/migration/migration-set.d.ts.map +1 -0
  124. package/dist/migration/migration-set.js +2 -0
  125. package/dist/migration/migration-set.js.map +1 -0
  126. package/dist/migration/migrator.d.ts +130 -0
  127. package/dist/migration/migrator.d.ts.map +1 -0
  128. package/dist/migration/migrator.js +2 -0
  129. package/dist/migration/migrator.js.map +1 -0
  130. package/dist/migration/types.d.ts +52 -0
  131. package/dist/migration/types.d.ts.map +1 -0
  132. package/dist/migration/types.js +2 -0
  133. package/dist/migration/types.js.map +1 -0
  134. package/dist/stream/index.d.ts +2 -0
  135. package/dist/stream/index.d.ts.map +1 -0
  136. package/dist/stream/index.js +2 -0
  137. package/dist/stream/index.js.map +1 -0
  138. package/dist/stream/sse.d.ts +13 -0
  139. package/dist/stream/sse.d.ts.map +1 -0
  140. package/dist/stream/sse.js +2 -0
  141. package/dist/stream/sse.js.map +1 -0
  142. package/dist/syncer/index.d.ts +2 -0
  143. package/dist/syncer/index.d.ts.map +1 -0
  144. package/dist/syncer/index.js +2 -0
  145. package/dist/syncer/index.js.map +1 -0
  146. package/dist/syncer/syncer.d.ts +127 -0
  147. package/dist/syncer/syncer.d.ts.map +1 -0
  148. package/dist/syncer/syncer.js +2 -0
  149. package/dist/syncer/syncer.js.map +1 -0
  150. package/dist/templates/base-template.d.ts +13 -0
  151. package/dist/templates/base-template.d.ts.map +1 -0
  152. package/dist/templates/base-template.js +2 -0
  153. package/dist/templates/base-template.js.map +1 -0
  154. package/dist/templates/entity.template.d.ts +17 -0
  155. package/dist/templates/entity.template.d.ts.map +1 -0
  156. package/dist/templates/entity.template.js +2 -0
  157. package/dist/templates/entity.template.js.map +1 -0
  158. package/dist/templates/generated.template.d.ts +27 -0
  159. package/dist/templates/generated.template.d.ts.map +1 -0
  160. package/dist/templates/generated.template.js +2 -0
  161. package/dist/templates/generated.template.js.map +1 -0
  162. package/dist/templates/generated_http.template.d.ts +24 -0
  163. package/dist/templates/generated_http.template.d.ts.map +1 -0
  164. package/dist/templates/generated_http.template.js +2 -0
  165. package/dist/templates/generated_http.template.js.map +1 -0
  166. package/dist/templates/generated_sso.template.d.ts +20 -0
  167. package/dist/templates/generated_sso.template.d.ts.map +1 -0
  168. package/dist/templates/generated_sso.template.js +2 -0
  169. package/dist/templates/generated_sso.template.js.map +1 -0
  170. package/dist/templates/index.d.ts +2 -0
  171. package/dist/templates/index.d.ts.map +1 -0
  172. package/dist/templates/index.js +2 -0
  173. package/dist/templates/index.js.map +1 -0
  174. package/dist/templates/init_types.template.d.ts +17 -0
  175. package/dist/templates/init_types.template.d.ts.map +1 -0
  176. package/dist/templates/init_types.template.js +2 -0
  177. package/dist/templates/init_types.template.js.map +1 -0
  178. package/dist/templates/model.template.d.ts +17 -0
  179. package/dist/templates/model.template.d.ts.map +1 -0
  180. package/dist/templates/model.template.js +2 -0
  181. package/dist/templates/model.template.js.map +1 -0
  182. package/dist/templates/model_test.template.d.ts +17 -0
  183. package/dist/templates/model_test.template.d.ts.map +1 -0
  184. package/dist/templates/model_test.template.js +2 -0
  185. package/dist/templates/model_test.template.js.map +1 -0
  186. package/dist/templates/service.template.d.ts +29 -0
  187. package/dist/templates/service.template.d.ts.map +1 -0
  188. package/dist/templates/service.template.js +2 -0
  189. package/dist/templates/service.template.js.map +1 -0
  190. package/dist/templates/view_enums_buttonset.template.d.ts +17 -0
  191. package/dist/templates/view_enums_buttonset.template.d.ts.map +1 -0
  192. package/dist/templates/view_enums_buttonset.template.js +2 -0
  193. package/dist/templates/view_enums_buttonset.template.js.map +1 -0
  194. package/dist/templates/view_enums_dropdown.template.d.ts +18 -0
  195. package/dist/templates/view_enums_dropdown.template.d.ts.map +1 -0
  196. package/dist/templates/view_enums_dropdown.template.js +2 -0
  197. package/dist/templates/view_enums_dropdown.template.js.map +1 -0
  198. package/dist/templates/view_enums_select.template.d.ts +17 -0
  199. package/dist/templates/view_enums_select.template.d.ts.map +1 -0
  200. package/dist/templates/view_enums_select.template.js +2 -0
  201. package/dist/templates/view_enums_select.template.js.map +1 -0
  202. package/dist/templates/view_form.template.d.ts +26 -0
  203. package/dist/templates/view_form.template.d.ts.map +1 -0
  204. package/dist/templates/view_form.template.js +2 -0
  205. package/dist/templates/view_form.template.js.map +1 -0
  206. package/dist/templates/view_id_all_select.template.d.ts +17 -0
  207. package/dist/templates/view_id_all_select.template.d.ts.map +1 -0
  208. package/dist/templates/view_id_all_select.template.js +2 -0
  209. package/dist/templates/view_id_all_select.template.js.map +1 -0
  210. package/dist/templates/view_id_async_select.template.d.ts +17 -0
  211. package/dist/templates/view_id_async_select.template.d.ts.map +1 -0
  212. package/dist/templates/view_id_async_select.template.js +2 -0
  213. package/dist/templates/view_id_async_select.template.js.map +1 -0
  214. package/dist/templates/view_list.template.d.ts +38 -0
  215. package/dist/templates/view_list.template.d.ts.map +1 -0
  216. package/dist/templates/view_list.template.js +2 -0
  217. package/dist/templates/view_list.template.js.map +1 -0
  218. package/dist/templates/view_list_columns.template.d.ts +17 -0
  219. package/dist/templates/view_list_columns.template.d.ts.map +1 -0
  220. package/dist/templates/view_list_columns.template.js +2 -0
  221. package/dist/templates/view_list_columns.template.js.map +1 -0
  222. package/dist/templates/view_search_input.template.d.ts +17 -0
  223. package/dist/templates/view_search_input.template.d.ts.map +1 -0
  224. package/dist/templates/view_search_input.template.js +2 -0
  225. package/dist/templates/view_search_input.template.js.map +1 -0
  226. package/dist/testing/_relation-graph.d.ts +7 -0
  227. package/dist/testing/_relation-graph.d.ts.map +1 -0
  228. package/dist/testing/_relation-graph.js +2 -0
  229. package/dist/testing/_relation-graph.js.map +1 -0
  230. package/dist/testing/fixture-manager.d.ts +35 -0
  231. package/dist/testing/fixture-manager.d.ts.map +1 -0
  232. package/dist/testing/fixture-manager.js +2 -0
  233. package/dist/testing/fixture-manager.js.map +1 -0
  234. package/dist/types/types.d.ts +611 -0
  235. package/dist/types/types.d.ts.map +1 -0
  236. package/dist/types/types.js +2 -0
  237. package/dist/types/types.js.map +1 -0
  238. package/dist/typings/knex.d.js +2 -0
  239. package/dist/typings/knex.d.js.map +1 -0
  240. package/dist/utils/async-utils.d.ts +25 -0
  241. package/dist/utils/async-utils.d.ts.map +1 -0
  242. package/dist/utils/async-utils.js +2 -0
  243. package/dist/utils/async-utils.js.map +1 -0
  244. package/dist/utils/controller.d.ts +9 -0
  245. package/dist/utils/controller.d.ts.map +1 -0
  246. package/dist/utils/controller.js +2 -0
  247. package/dist/utils/controller.js.map +1 -0
  248. package/dist/utils/fs-utils.d.ts +9 -0
  249. package/dist/utils/fs-utils.d.ts.map +1 -0
  250. package/dist/utils/fs-utils.js +2 -0
  251. package/dist/utils/fs-utils.js.map +1 -0
  252. package/dist/utils/lodash-able.d.ts +2 -0
  253. package/dist/utils/lodash-able.d.ts.map +1 -0
  254. package/dist/utils/lodash-able.js +2 -0
  255. package/dist/utils/lodash-able.js.map +1 -0
  256. package/dist/utils/model.d.ts +17 -0
  257. package/dist/utils/model.d.ts.map +1 -0
  258. package/dist/utils/model.js +2 -0
  259. package/dist/utils/model.js.map +1 -0
  260. package/dist/utils/sql-parser.d.ts +4 -0
  261. package/dist/utils/sql-parser.d.ts.map +1 -0
  262. package/dist/utils/sql-parser.js +2 -0
  263. package/dist/utils/sql-parser.js.map +1 -0
  264. package/dist/utils/utils.d.ts +9 -0
  265. package/dist/utils/utils.d.ts.map +1 -0
  266. package/dist/utils/utils.js +2 -0
  267. package/dist/utils/utils.js.map +1 -0
  268. package/dist/utils/zod-error.d.ts +8 -0
  269. package/dist/utils/zod-error.d.ts.map +1 -0
  270. package/dist/utils/zod-error.js +2 -0
  271. package/dist/utils/zod-error.js.map +1 -0
  272. package/nodemon.json +6 -0
  273. package/package.json +32 -45
  274. package/src/api/base-frame.ts +3 -4
  275. package/src/api/caster.ts +22 -23
  276. package/src/api/code-converters.ts +170 -134
  277. package/src/api/context.ts +15 -3
  278. package/src/api/decorators.ts +144 -20
  279. package/src/api/index.ts +2 -0
  280. package/src/api/sonamu.ts +408 -165
  281. package/src/bin/build-config.ts +10 -0
  282. package/src/bin/cli-wrapper.ts +35 -32
  283. package/src/bin/cli.ts +141 -204
  284. package/src/database/_batch_update.ts +10 -15
  285. package/src/database/base-model.ts +326 -216
  286. package/src/database/db.ts +191 -21
  287. package/src/database/{drivers/knex/plugins → knex-plugins}/knex-on-duplicate-update.ts +1 -1
  288. package/src/database/puri-wrapper.ts +129 -0
  289. package/src/database/puri.ts +808 -0
  290. package/src/database/puri.types.ts +222 -0
  291. package/src/database/transaction-context.ts +18 -0
  292. package/src/database/upsert-builder.ts +32 -35
  293. package/src/entity/entity-manager.ts +7 -15
  294. package/src/entity/entity.ts +9 -31
  295. package/src/entity/migrator-/354/235/264/354/202/254/352/260/224/354/226/264/354/232/224.md +1 -0
  296. package/src/file-storage/driver.ts +131 -0
  297. package/src/file-storage/file-storage.ts +100 -0
  298. package/src/index.ts +15 -11
  299. package/src/migration/code-generation.ts +777 -0
  300. package/src/migration/migration-set.ts +453 -0
  301. package/src/migration/migrator.ts +823 -0
  302. package/src/migration/types.ts +53 -0
  303. package/src/shared/web.shared.ts.txt +33 -2
  304. package/src/stream/index.ts +1 -0
  305. package/src/stream/sse.ts +49 -0
  306. package/src/syncer/syncer.ts +294 -127
  307. package/src/templates/generated.template.ts +13 -1
  308. package/src/templates/generated_http.template.ts +15 -12
  309. package/src/templates/generated_sso.template.ts +50 -2
  310. package/src/templates/model.template.ts +138 -2
  311. package/src/templates/service.template.ts +0 -1
  312. package/src/templates/view_form.template.ts +11 -7
  313. package/src/templates/view_list.template.ts +12 -4
  314. package/src/testing/fixture-manager.ts +229 -174
  315. package/src/types/types.ts +108 -14
  316. package/src/utils/async-utils.ts +64 -0
  317. package/src/utils/fs-utils.ts +17 -0
  318. package/src/utils/model.ts +0 -2
  319. package/src/utils/utils.ts +14 -58
  320. package/src/utils/zod-error.ts +12 -176
  321. package/tsconfig.json +6 -0
  322. package/tsup.config.js +4 -2
  323. package/.pnp.cjs +0 -14363
  324. package/.pnp.loader.mjs +0 -2047
  325. package/.vscode/extensions.json +0 -6
  326. package/.vscode/settings.json +0 -9
  327. package/.yarnrc.yml +0 -5
  328. package/dist/base-model-CEB0H0aO.d.mts +0 -43
  329. package/dist/base-model-CrqDMYhI.d.ts +0 -43
  330. package/dist/bin/cli-wrapper.d.mts +0 -1
  331. package/dist/bin/cli-wrapper.mjs +0 -43
  332. package/dist/bin/cli-wrapper.mjs.map +0 -1
  333. package/dist/bin/cli.d.mts +0 -2
  334. package/dist/bin/cli.mjs +0 -907
  335. package/dist/bin/cli.mjs.map +0 -1
  336. package/dist/chunk-2WAC2GER.js +0 -7625
  337. package/dist/chunk-2WAC2GER.js.map +0 -1
  338. package/dist/chunk-C3IPIF6O.mjs +0 -1581
  339. package/dist/chunk-C3IPIF6O.mjs.map +0 -1
  340. package/dist/chunk-EXHKSVTE.js +0 -280
  341. package/dist/chunk-EXHKSVTE.js.map +0 -1
  342. package/dist/chunk-FCERKIIF.mjs +0 -7623
  343. package/dist/chunk-FCERKIIF.mjs.map +0 -1
  344. package/dist/chunk-HGIBJYOU.mjs +0 -231
  345. package/dist/chunk-HGIBJYOU.mjs.map +0 -1
  346. package/dist/chunk-JKSOJRQA.mjs +0 -280
  347. package/dist/chunk-JKSOJRQA.mjs.map +0 -1
  348. package/dist/chunk-OTKKFP3Y.js +0 -1581
  349. package/dist/chunk-OTKKFP3Y.js.map +0 -1
  350. package/dist/chunk-PTFDTOJU.mjs +0 -19
  351. package/dist/chunk-PTFDTOJU.mjs.map +0 -1
  352. package/dist/chunk-UZ2IY5VE.js +0 -231
  353. package/dist/chunk-UZ2IY5VE.js.map +0 -1
  354. package/dist/database/drivers/knex/base-model.d.mts +0 -16
  355. package/dist/database/drivers/knex/base-model.d.ts +0 -16
  356. package/dist/database/drivers/knex/base-model.js +0 -55
  357. package/dist/database/drivers/knex/base-model.js.map +0 -1
  358. package/dist/database/drivers/knex/base-model.mjs +0 -56
  359. package/dist/database/drivers/knex/base-model.mjs.map +0 -1
  360. package/dist/database/drivers/kysely/base-model.d.mts +0 -22
  361. package/dist/database/drivers/kysely/base-model.d.ts +0 -22
  362. package/dist/database/drivers/kysely/base-model.js +0 -64
  363. package/dist/database/drivers/kysely/base-model.js.map +0 -1
  364. package/dist/database/drivers/kysely/base-model.mjs +0 -65
  365. package/dist/database/drivers/kysely/base-model.mjs.map +0 -1
  366. package/dist/index.d.mts +0 -813
  367. package/dist/index.mjs +0 -435
  368. package/dist/index.mjs.map +0 -1
  369. package/dist/model-aFgomcdc.d.mts +0 -1112
  370. package/dist/model-aFgomcdc.d.ts +0 -1112
  371. package/src/database/base-model.abstract.ts +0 -97
  372. package/src/database/db.abstract.ts +0 -75
  373. package/src/database/drivers/knex/base-model.ts +0 -55
  374. package/src/database/drivers/knex/client.ts +0 -209
  375. package/src/database/drivers/knex/db.ts +0 -232
  376. package/src/database/drivers/knex/generator.ts +0 -659
  377. package/src/database/drivers/kysely/base-model.ts +0 -89
  378. package/src/database/drivers/kysely/client.ts +0 -309
  379. package/src/database/drivers/kysely/db.ts +0 -238
  380. package/src/database/drivers/kysely/generator.ts +0 -714
  381. package/src/database/types.ts +0 -118
  382. package/src/entity/migrator.ts +0 -1400
  383. package/src/smd/smd-manager.ts +0 -139
  384. package/src/smd/smd.ts +0 -571
  385. package/src/templates/kysely_types.template.ts +0 -205
package/dist/index.d.ts CHANGED
@@ -1,813 +1,23 @@
1
- import { z } from 'zod';
2
- import { A as ApiParamType, e as ApiParam, E as EntityPropNode, T as TextProp, f as EntityProp, R as RelationProp, g as EntityIndex, h as EntityJson, S as SubsetQuery, i as EntitySubsetRow, j as TemplateKey, k as TemplateOptions, P as PathAndCode, G as GenerateOptions, l as RenderingNode, m as SonamuDBConfig, c as DatabaseDriver, D as DBPreset, U as UpsertBuilder, K as KnexClient, b as KyselyClient, a as Database, n as SonamuDBBaseConfig, o as KnexConfig, p as KyselyConfig, q as KnexGenerator, r as KnexBaseConfig, s as SonamuKnexDBConfig, C as CodeGenerator, M as MigrationColumn, t as MigrationIndex, u as GenMigrationCode, v as MigrationForeign, w as KyselyBaseConfig, x as SonamuKyselyDBConfig, y as DatabaseExtend, I as IntegerProp, z as BigIntegerProp, F as StringProp, H as FloatProp, J as DoubleProp, L as DecimalProp, N as BooleanProp, O as DateProp, Q as DateTimeProp, V as TimeProp, W as TimestampProp, X as JsonProp, Y as UuidProp, Z as EnumProp, _ as VirtualProp, $ as DistributiveOmit, a0 as OneToOneRelationProp, a1 as BelongsToOneRelationProp, a2 as HasManyRelationProp, a3 as ManyToManyRelationProp, a4 as MigrationSet, a5 as MigrationSetAndJoinTable, a6 as FixtureSearchOptions, a7 as FixtureRecord, a8 as FixtureImportResult } from './model-aFgomcdc.js';
3
- export { aS as ArrayOr, B as BaseListParams, aj as CommonProp, ac as DatabaseClient, d as DriverSpec, af as EnumsLabel, ag as EnumsLabelKo, ad as Environment, am as FlattenSubsetRow, aO as KnexColumnType, aL as KnexError, aR as ListResult, aP as MigrationJoinTable, aQ as RelationNode, al as RelationOn, ak as RelationType, an as SMDInput, ah as SQLDateTimeString, ae as SonamuDBFullConfig, aK as SonamuQueryMode, a9 as UBRef, ab as WhereClause, aT as asArray, aG as isBelongsToOneRelationProp, ap as isBigIntegerProp, aw as isBooleanProp, aJ as isCustomJoinClause, ax as isDateProp, ay as isDateTimeProp, av as isDecimalProp, au as isDoubleProp, as as isEnumProp, at as isFloatProp, aH as isHasManyRelationProp, ao as isIntegerProp, aB as isJsonProp, aM as isKnexError, aN as isKyselyError, aI as isManyToManyRelationProp, aF as isOneToOneRelationProp, aa as isRefField, aE as isRelationProp, ar as isStringProp, aq as isTextProp, az as isTimeProp, aA as isTimestampProp, aC as isUuidProp, aD as isVirtualProp, aU as objToMap, ai as zArrayable } from './model-aFgomcdc.js';
4
- import { HTTPMethods, FastifyReply, FastifyInstance, FastifyRequest } from 'fastify';
5
- import { RouteGenericInterface } from 'fastify/types/route';
6
- import { Server, IncomingMessage, ServerResponse, IncomingHttpHeaders } from 'http';
7
- import ts from 'typescript';
8
- import { AsyncLocalStorage } from 'async_hooks';
9
- import knex, { Knex } from 'knex';
10
- import * as kysely from 'kysely';
11
- import { Kysely } from 'kysely';
12
- import 'mysql2';
13
-
14
- type ServiceClient = "axios" | "axios-multipart" | "swr" | "window-fetch";
15
- type ApiDecoratorOptions = {
16
- httpMethod?: HTTPMethods;
17
- contentType?: "text/plain" | "text/html" | "text/xml" | "application/json" | "application/octet-stream";
18
- clients?: ServiceClient[];
19
- path?: string;
20
- resourceName?: string;
21
- guards?: string[];
22
- description?: string;
23
- };
24
- type StreamDecoratorOptions = {
25
- type: "sse";
26
- events: z.ZodObject<any>;
27
- path?: string;
28
- resourceName?: string;
29
- guards?: string[];
30
- description?: string;
31
- };
32
- declare const registeredApis: {
33
- modelName: string;
34
- methodName: string;
35
- path: string;
36
- options: ApiDecoratorOptions;
37
- streamOptions?: StreamDecoratorOptions;
38
- }[];
39
- type ExtendedApi = {
40
- modelName: string;
41
- methodName: string;
42
- path: string;
43
- options: ApiDecoratorOptions;
44
- streamOptions?: StreamDecoratorOptions;
45
- typeParameters: ApiParamType.TypeParam[];
46
- parameters: ApiParam[];
47
- returnType: ApiParamType;
48
- };
49
- declare function api(options?: ApiDecoratorOptions): (target: Object, propertyKey: string) => void;
50
- declare function stream(options: StreamDecoratorOptions): (target: Object, propertyKey: string) => void;
51
-
52
- declare function getZodObjectFromApi(api: ExtendedApi, references?: {
53
- [id: string]: z.ZodObject<any>;
54
- }): z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
55
- declare function getZodObjectFromApiParams(apiParams: ApiParam[], references?: {
56
- [id: string]: z.ZodObject<any>;
57
- }): z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
58
- declare function getZodTypeFromApiParamType(paramType: ApiParamType, references: {
59
- [id: string]: z.ZodObject<any>;
60
- }): z.ZodType<unknown>;
61
- declare function propNodeToZodTypeDef(propNode: EntityPropNode, injectImportKeys: string[]): string;
62
- declare function getTextTypeLength(textType: TextProp["textType"]): number;
63
- declare function propToZodTypeDef(prop: EntityProp, injectImportKeys: string[]): string;
64
- declare function zodTypeToZodCode(zt: z.ZodFirstPartySchemaTypes | z.ZodObject<any>): string;
65
- declare function apiParamToTsCode(params: ApiParam[], injectImportKeys: string[]): string;
66
- declare function apiParamToTsCodeAsObject(params: ApiParam[], injectImportKeys: string[]): string;
67
- declare function apiParamTypeToTsType(paramType: ApiParamType, injectImportKeys: string[]): string;
68
- declare function unwrapPromiseOnce(paramType: ApiParamType): ApiParamType;
69
- declare function serializeZodType(zt: z.ZodTypeAny): any;
70
- declare function zodTypeToTsTypeDef(zt: z.ZodFirstPartySchemaTypes | z.ZodObject<any>): string;
71
-
72
- interface ContextExtend {
73
- }
74
- type Context = {
75
- reply: FastifyReply<Server, IncomingMessage, ServerResponse, RouteGenericInterface, unknown>;
76
- headers: IncomingHttpHeaders;
77
- } & ContextExtend;
78
-
79
- declare class Entity {
80
- id: string;
81
- parentId?: string;
82
- table: string;
83
- title: string;
84
- names: {
85
- parentFs: string;
86
- fs: string;
87
- module: string;
88
- };
89
- props: EntityProp[];
90
- propsDict: {
91
- [key: string]: EntityProp;
92
- };
93
- relations: {
94
- [key: string]: RelationProp;
95
- };
96
- indexes: EntityIndex[];
97
- subsets: {
98
- [key: string]: string[];
99
- };
100
- types: {
101
- [name: string]: z.ZodTypeAny;
102
- };
103
- enums: {
104
- [enumId: string]: z.ZodEnum<any>;
105
- };
106
- enumLabels: {
107
- [enumId: string]: {
108
- [key: string]: string;
109
- };
110
- };
111
- constructor({ id, parentId, table, title, props, indexes, subsets, enums, }: EntityJson);
112
- getSubsetQuery(subsetKey: string): SubsetQuery;
113
- resolveSubsetQuery(prefix: string, fields: string[], isAlreadyOuterJoined?: boolean): SubsetQuery;
114
- fieldExprsToPropNodes(fieldExprs: string[], entity?: Entity): EntityPropNode[];
115
- getFieldExprs(prefix?: string, maxDepth?: number, froms?: string[]): string[];
116
- getTableColumns(): string[];
117
- registerModulePaths(): Promise<void>;
118
- registerTableSpecs(): void;
119
- toJson(): EntityJson;
120
- save(): Promise<void>;
121
- getSubsetRows(_subsets?: {
122
- [key: string]: string[];
123
- }, prefixes?: string[]): EntitySubsetRow[];
124
- subsetRowsToSubsetFields(subsetRows: EntitySubsetRow[], subsetKey: string): string[];
125
- createProp(prop: EntityProp, at?: number): Promise<void>;
126
- analyzeSubsetField(subsetField: string): {
127
- entityId: string;
128
- propName: string;
129
- }[];
130
- modifyProp(newProp: EntityProp, at: number): Promise<void>;
131
- delProp(at: number): Promise<void>;
132
- getEntityIdFromSubsetField(subsetField: string): string;
133
- moveProp(at: number, to: number): Promise<void>;
134
- }
135
-
136
- type EntityNamesRecord = Record<"fs" | "fsPlural" | "camel" | "camelPlural" | "capital" | "capitalPlural" | "upper" | "constant", string>;
137
- type TableSpec = {
138
- name: string;
139
- uniqueIndexes: {
140
- name?: string;
141
- columns: string[];
142
- }[];
143
- };
144
- declare class EntityManagerClass {
145
- private entities;
146
- modulePaths: Map<string, string>;
147
- private tableSpecs;
148
- isAutoloaded: boolean;
149
- autoload(doSilent?: boolean): Promise<unknown>;
150
- reload(doSilent?: boolean): Promise<unknown>;
151
- register(json: EntityJson): Promise<void>;
152
- get(entityId: string): Entity;
153
- exists(entityId: string): boolean;
154
- getAllIds(): string[];
155
- getAllParentIds(): string[];
156
- getChildrenIds(parentId: string): string[];
157
- setModulePath(key: string, modulePath: string): void;
158
- getModulePath(key: string): string;
159
- setTableSpec(tableSpec: TableSpec): void;
160
- getTableSpec(key: string): TableSpec;
161
- getNamesFromId(entityId: string): EntityNamesRecord;
162
- }
163
- declare const EntityManager: EntityManagerClass;
164
-
165
- declare abstract class Template {
166
- key: TemplateKey;
167
- constructor(key: TemplateKey);
168
- abstract render(options: TemplateOptions[TemplateKey], ...extra: unknown[]): RenderedTemplate | Promise<RenderedTemplate>;
169
- abstract getTargetAndPath(names?: EntityNamesRecord, ...extra: unknown[]): {
170
- target: string;
171
- path: string;
172
- };
173
- }
174
-
175
- type PathAndChecksum = {
176
- path: string;
177
- checksum: string;
178
- };
179
- type RenderedTemplate = {
180
- target: string;
181
- path: string;
182
- body: string;
183
- importKeys: string[];
184
- customHeaders?: string[];
185
- preTemplates?: {
186
- key: TemplateKey;
187
- options: TemplateOptions[TemplateKey];
188
- }[];
189
- };
190
- declare class Syncer {
191
- apis: {
192
- typeParameters: ApiParamType.TypeParam[];
193
- parameters: ApiParam[];
194
- returnType: ApiParamType;
195
- modelName: string;
196
- methodName: string;
197
- path: string;
198
- options: ApiDecoratorOptions;
199
- }[];
200
- types: {
201
- [typeName: string]: z.ZodObject<any>;
202
- };
203
- models: {
204
- [modelName: string]: unknown;
205
- };
206
- isSyncing: boolean;
207
- get checksumsPath(): string;
208
- constructor();
209
- sync(): Promise<void>;
210
- getEntityIdFromPath(filePaths: string[]): string[];
211
- actionGenerateSchemas(): Promise<string[]>;
212
- actionGenerateServices(paramsArray: {
213
- namesRecord: EntityNamesRecord;
214
- modelTsPath: string;
215
- }[]): Promise<string[]>;
216
- actionGenerateHttps(): Promise<string[]>;
217
- copyFileWithReplaceCoreToShared(fromPath: string, toPath: string): Promise<void>;
218
- actionSyncFilesToTargets(tsPaths: string[]): Promise<string[]>;
219
- getCurrentChecksums(): Promise<PathAndChecksum[]>;
220
- getPreviousChecksums(): Promise<PathAndChecksum[]>;
221
- saveChecksums(checksums: PathAndChecksum[]): Promise<void>;
222
- getChecksumOfFile(filePath: string): Promise<string>;
223
- readApisFromFile(filePath: string): Promise<{
224
- typeParameters: ApiParamType.TypeParam[];
225
- parameters: ApiParam[];
226
- returnType: ApiParamType;
227
- modelName: string;
228
- methodName: string;
229
- path: string;
230
- options: ApiDecoratorOptions;
231
- streamOptions?: StreamDecoratorOptions | undefined;
232
- }[]>;
233
- resolveTypeNode(typeNode: ts.TypeNode): ApiParamType;
234
- resolveParamDec: (paramDec: {
235
- name: ts.BindingName;
236
- type: ts.TypeNode;
237
- optional?: boolean;
238
- defaultDef?: string;
239
- }, index?: number) => ApiParam;
240
- printNode(node: ts.Node | undefined, sourceFile: ts.SourceFile): string | undefined;
241
- autoloadApis(): Promise<{
242
- typeParameters: ApiParamType.TypeParam[];
243
- parameters: ApiParam[];
244
- returnType: ApiParamType;
245
- modelName: string;
246
- methodName: string;
247
- path: string;
248
- options: ApiDecoratorOptions;
249
- }[]>;
250
- autoloadModels(): Promise<{
251
- [modelName: string]: unknown;
252
- }>;
253
- autoloadTypes(doRefresh?: boolean): Promise<{
254
- [typeName: string]: z.ZodObject<any>;
255
- }>;
256
- getTemplate(key: TemplateKey): Template;
257
- renderTemplate<T extends keyof TemplateOptions>(key: T, options: TemplateOptions[T]): Promise<PathAndCode[]>;
258
- resolveRenderedTemplate(key: TemplateKey, result: RenderedTemplate): Promise<PathAndCode>;
259
- writeCodeToPath(pathAndCode: PathAndCode): Promise<string[]>;
260
- generateTemplate(key: TemplateKey, templateOptions: any, _generateOptions?: GenerateOptions): Promise<string[][]>;
261
- checkExistsGenCode(entityId: string, templateKey: TemplateKey, enumId?: string): {
262
- subPath: string;
263
- fullPath: string;
264
- isExists: boolean;
265
- };
266
- checkExists(entityId: string, enums: {
267
- [name: string]: z.ZodEnum<any>;
268
- }): Record<`${TemplateKey}${string}`, boolean>;
269
- getZodTypeById(zodTypeId: string): Promise<z.ZodTypeAny>;
270
- propNodeToZodType(propNode: EntityPropNode): Promise<z.ZodTypeAny>;
271
- propToZodType(prop: EntityProp): Promise<z.ZodTypeAny>;
272
- resolveRenderType(key: string, zodType: z.ZodTypeAny): RenderingNode["renderType"];
273
- zodTypeToRenderingNode(zodType: z.ZodTypeAny, baseKey?: string): RenderingNode;
274
- getColumnsNode(entityId: string, subsetKey: string): Promise<RenderingNode>;
275
- createEntity(form: Omit<TemplateOptions["entity"], "title"> & {
276
- title?: string;
277
- }): Promise<void>;
278
- delEntity(entityId: string): Promise<{
279
- delPaths: string[];
280
- }>;
281
- }
282
-
283
- type SonamuConfig = {
284
- projectName?: string;
285
- api: {
286
- dir: string;
287
- };
288
- sync: {
289
- targets: string[];
290
- };
291
- route: {
292
- prefix: string;
293
- };
294
- };
295
- type SonamuSecrets = {
296
- [key: string]: string;
297
- };
298
- type SonamuFastifyConfig = {
299
- contextProvider: (defaultContext: Pick<Context, "headers" | "reply">, request: FastifyRequest, reply: FastifyReply) => Context;
300
- guardHandler: (guard: string, request: FastifyRequest, api: {
301
- typeParameters: ApiParamType.TypeParam[];
302
- parameters: ApiParam[];
303
- returnType: ApiParamType;
304
- modelName: string;
305
- methodName: string;
306
- path: string;
307
- options: ApiDecoratorOptions;
308
- }) => void;
309
- cache?: {
310
- get: (key: string) => Promise<unknown | null>;
311
- put: (key: string, value: unknown, ttl?: number) => Promise<void>;
312
- resolveKey: (path: string, reqBody: {
313
- [key: string]: unknown;
314
- }) => {
315
- cache: false;
316
- } | {
317
- cache: true;
318
- key: string;
319
- ttl?: number;
320
- };
321
- };
322
- };
323
- declare class SonamuClass {
324
- isInitialized: boolean;
325
- asyncLocalStorage: AsyncLocalStorage<{
326
- context: Context;
327
- }>;
328
- getContext(): Context;
329
- private _apiRootPath;
330
- set apiRootPath(apiRootPath: string);
331
- get apiRootPath(): string;
332
- get appRootPath(): string;
333
- private _dbConfig;
334
- set dbConfig(dbConfig: SonamuDBConfig);
335
- get dbConfig(): SonamuDBConfig;
336
- private _dbClient;
337
- set dbClient(_dbClient: DatabaseDriver);
338
- get dbClient(): DatabaseDriver;
339
- private _syncer;
340
- set syncer(syncer: Syncer);
341
- get syncer(): Syncer;
342
- private _config;
343
- set config(config: SonamuConfig);
344
- get config(): SonamuConfig;
345
- private _secrets;
346
- set secrets(secrets: SonamuSecrets);
347
- get secrets(): SonamuSecrets | null;
348
- initForTesting(): Promise<void>;
349
- init(doSilent?: boolean, enableSync?: boolean, apiRootPath?: string, forTesting?: boolean): Promise<void>;
350
- withFastify(server: FastifyInstance<Server, IncomingMessage, ServerResponse>, config: SonamuFastifyConfig, options?: {
351
- enableSync?: boolean;
352
- doSilent?: boolean;
353
- }): Promise<void>;
354
- destroy(): Promise<void>;
355
- }
356
- declare const Sonamu: SonamuClass;
357
-
358
- declare abstract class BaseFrameClass {
359
- getDB(which: DBPreset): Knex;
360
- getUpsertBuilder(): UpsertBuilder<"knex">;
361
- }
362
-
363
- declare abstract class DBClass {
364
- _fullConfig?: SonamuDBConfig;
365
- set fullConfig(config: SonamuDBConfig);
366
- get fullConfig(): SonamuDBConfig;
367
- abstract tdb: KnexClient | KyselyClient;
368
- abstract fdb: KnexClient | KyselyClient;
369
- abstract testInit(): Promise<void>;
370
- abstract getDB(which: DBPreset): Knex | Kysely<Database>;
371
- abstract destroy(): Promise<void>;
372
- abstract raw(db: Knex | Kysely<Database>, query: string): any;
373
- getBaseConfig(rootPath: string): Promise<SonamuDBBaseConfig>;
374
- getCurrentConfig(which?: DBPreset): KnexConfig | KyselyConfig;
375
- toClient(db: Knex | Kysely<Database>): KnexClient | KyselyClient;
376
- }
377
-
378
- declare class DBKnexClass extends DBClass {
379
- migrationTable: string;
380
- generator: KnexGenerator;
381
- baseConfig?: KnexBaseConfig;
382
- _fullConfig?: SonamuKnexDBConfig;
383
- set fullConfig(config: SonamuKnexDBConfig);
384
- get fullConfig(): SonamuKnexDBConfig;
385
- private wdb?;
386
- private rdb?;
387
- private _tdb;
388
- set tdb(tdb: KnexClient);
389
- get tdb(): KnexClient;
390
- private _fdb;
391
- set fdb(fdb: KnexClient);
392
- get fdb(): KnexClient;
393
- get connectionInfo(): {
394
- development_master: {
395
- host: string;
396
- port: number;
397
- database: string | undefined;
398
- user: string | undefined;
399
- password: string | ((() => string | Promise<string>) & string) | undefined;
400
- };
401
- development_slave: {
402
- host: string;
403
- port: number;
404
- database: string | undefined;
405
- user: string | undefined;
406
- password: string | ((() => string | Promise<string>) & string) | undefined;
407
- };
408
- test: {
409
- host: string;
410
- port: number;
411
- database: string | undefined;
412
- user: string | undefined;
413
- password: string | ((() => string | Promise<string>) & string) | undefined;
414
- };
415
- fixture_local: {
416
- host: string;
417
- port: number;
418
- database: string | undefined;
419
- user: string | undefined;
420
- password: string | ((() => string | Promise<string>) & string) | undefined;
421
- };
422
- fixture_remote: {
423
- host: string;
424
- port: number;
425
- database: string | undefined;
426
- user: string | undefined;
427
- password: string | ((() => string | Promise<string>) & string) | undefined;
428
- };
429
- production_master: {
430
- host: string;
431
- port: number;
432
- database: string | undefined;
433
- user: string | undefined;
434
- password: string | ((() => string | Promise<string>) & string) | undefined;
435
- };
436
- production_slave: {
437
- host: string;
438
- port: number;
439
- database: string | undefined;
440
- user: string | undefined;
441
- password: string | ((() => string | Promise<string>) & string) | undefined;
442
- };
443
- };
444
- constructor();
445
- init(config: KnexBaseConfig): void;
446
- testInit(): Promise<void>;
447
- getDB(which: DBPreset): knex.Knex<any, any[]>;
448
- getClient(mode: keyof SonamuKnexDBConfig): KnexClient;
449
- destroy(): Promise<void>;
450
- testDestroy(): Promise<void>;
451
- raw(db: Knex, query: string): Knex.Raw<any>;
452
- generateDBConfig(config: KnexBaseConfig): SonamuKnexDBConfig;
453
- /**
454
- * keys에 해당하는 설정들을 중복없이 가져옵니다. (host/port/database가 같은 설정은 중복으로 처리합니다.)
455
- */
456
- getUniqueConfigs(keys: (keyof SonamuKnexDBConfig)[]): {
457
- connKey: keyof SonamuKnexDBConfig;
458
- options: KnexConfig;
459
- }[];
460
- }
461
-
462
- declare class KyselyGenerator extends CodeGenerator {
463
- generateCreateCode_ColumnAndIndexes(table: string, columns: MigrationColumn[], indexes: MigrationIndex[]): Promise<GenMigrationCode>;
464
- generateCreateCode_Foreign(table: string, foreigns: MigrationForeign[]): Promise<GenMigrationCode[]>;
465
- generateAlterCode_ColumnAndIndexes(table: string, entityColumns: MigrationColumn[], entityIndexes: MigrationIndex[], dbColumns: MigrationColumn[], dbIndexes: MigrationIndex[]): Promise<GenMigrationCode[]>;
466
- generateAlterCode_Foreigns(table: string, entityForeigns: MigrationForeign[], dbForeigns: MigrationForeign[]): Promise<GenMigrationCode[]>;
467
- generateModelTemplate(entityId: string, def: {
468
- orderBy: string;
469
- search: string;
470
- }): string;
471
- private genColumnDefinitions;
472
- private genIndexDefinitions;
473
- private genForeignDefinitions;
474
- private getAlterColumnLinesTo;
475
- private getAlterIndexLinesTo;
476
- private createIndexName;
477
- }
478
-
479
- declare class DBKyselyClass extends DBClass {
480
- migrationTable: string;
481
- generator: KyselyGenerator;
482
- baseConfig?: KyselyBaseConfig;
483
- _fullConfig?: SonamuKyselyDBConfig;
484
- set fullConfig(config: SonamuKyselyDBConfig);
485
- get fullConfig(): SonamuKyselyDBConfig;
486
- private wdb?;
487
- private rdb?;
488
- private _tdb;
489
- set tdb(tdb: KyselyClient);
490
- get tdb(): KyselyClient;
491
- private _fdb;
492
- set fdb(fdb: KyselyClient);
493
- get fdb(): KyselyClient;
494
- get connectionInfo(): {
495
- development_master: {
496
- host: string;
497
- port: number;
498
- database: string | undefined;
499
- user: string | undefined;
500
- password: string | undefined;
501
- };
502
- development_slave: {
503
- host: string;
504
- port: number;
505
- database: string | undefined;
506
- user: string | undefined;
507
- password: string | undefined;
508
- };
509
- test: {
510
- host: string;
511
- port: number;
512
- database: string | undefined;
513
- user: string | undefined;
514
- password: string | undefined;
515
- };
516
- fixture_local: {
517
- host: string;
518
- port: number;
519
- database: string | undefined;
520
- user: string | undefined;
521
- password: string | undefined;
522
- };
523
- fixture_remote: {
524
- host: string;
525
- port: number;
526
- database: string | undefined;
527
- user: string | undefined;
528
- password: string | undefined;
529
- };
530
- production_master: {
531
- host: string;
532
- port: number;
533
- database: string | undefined;
534
- user: string | undefined;
535
- password: string | undefined;
536
- };
537
- production_slave: {
538
- host: string;
539
- port: number;
540
- database: string | undefined;
541
- user: string | undefined;
542
- password: string | undefined;
543
- };
544
- };
545
- constructor();
546
- init(config: KyselyBaseConfig): void;
547
- testInit(): Promise<void>;
548
- get config(): SonamuKyselyDBConfig;
549
- getDB(which: DBPreset): Kysely<DatabaseExtend>;
550
- getClient(mode: keyof SonamuKyselyDBConfig): KyselyClient;
551
- destroy(): Promise<void>;
552
- testDestroy(): Promise<void>;
553
- raw(db: Kysely<Database>, query: string): Promise<kysely.QueryResult<unknown>>;
554
- generateDBConfig(config: KyselyBaseConfig): SonamuKyselyDBConfig;
555
- /**
556
- * keys에 해당하는 설정들을 중복없이 가져옵니다. (host/port/database가 같은 설정은 중복으로 처리합니다.)
557
- */
558
- getUniqueConfigs(keys: (keyof SonamuKyselyDBConfig)[]): {
559
- connKey: keyof SonamuKyselyDBConfig;
560
- options: KyselyConfig;
561
- }[];
562
- }
563
-
564
- declare const DB: DBKnexClass | DBKyselyClass;
565
-
566
- declare function setupErrorHandler(server: FastifyInstance): void;
567
-
568
- declare abstract class SoException extends Error {
569
- readonly statusCode: number;
570
- message: string;
571
- payload?: unknown;
572
- constructor(statusCode: number, message: string, payload?: unknown);
573
- }
574
- declare function isSoException(err: any): err is SoException;
575
- declare class BadRequestException extends SoException {
576
- message: string;
577
- payload?: unknown;
578
- constructor(message?: string, payload?: unknown);
579
- }
580
- declare class UnauthorizedException extends SoException {
581
- message: string;
582
- payload?: unknown;
583
- constructor(message?: string, payload?: unknown);
584
- }
585
- declare class NotFoundException extends SoException {
586
- message: string;
587
- payload?: unknown;
588
- constructor(message?: string, payload?: unknown);
589
- }
590
- declare class ServiceUnavailableException extends SoException {
591
- message: string;
592
- payload?: unknown;
593
- constructor(message?: string, payload?: unknown);
594
- }
595
- declare class InternalServerErrorException extends SoException {
596
- message: string;
597
- payload?: unknown;
598
- constructor(message?: string, payload?: unknown);
599
- }
600
- declare class AlreadyProcessedException extends SoException {
601
- message: string;
602
- payload?: unknown;
603
- constructor(message?: string, payload?: unknown);
604
- }
605
- declare class DuplicateRowException extends SoException {
606
- message: string;
607
- payload?: unknown;
608
- constructor(message?: string, payload?: unknown);
609
- }
610
- declare class TargetNotFoundException extends SoException {
611
- message: string;
612
- payload?: unknown;
613
- constructor(message?: string, payload?: unknown);
614
- }
615
-
616
- declare const p: {
617
- integer: typeof integer;
618
- bigInteger: typeof bigInteger;
619
- text: typeof text;
620
- string: typeof string;
621
- float: typeof float;
622
- double: typeof double;
623
- decimal: typeof decimal;
624
- boolean: typeof boolean;
625
- date: typeof date;
626
- dateTime: typeof dateTime;
627
- time: typeof time;
628
- timestamp: typeof timestamp;
629
- json: typeof json;
630
- uuid: typeof uuid;
631
- enums: typeof enums;
632
- virtual: typeof virtual;
633
- relationOneToOne: typeof relationOneToOne;
634
- relationBelongsToOne: typeof relationBelongsToOne;
635
- relationHasMany: typeof relationHasMany;
636
- relationManyToMany: typeof relationManyToMany;
637
- };
638
- declare function integer(name: string, option?: Omit<IntegerProp, "name" | "type">): IntegerProp;
639
- declare function bigInteger(name: string, option?: Omit<BigIntegerProp, "name" | "type">): BigIntegerProp;
640
- declare function text(name: string, option: Omit<TextProp, "name" | "type">): TextProp;
641
- declare function string(name: string, option: Omit<StringProp, "name" | "type">): StringProp;
642
- declare function float(name: string, option?: Omit<FloatProp, "name" | "type">): FloatProp;
643
- declare function double(name: string, option?: Omit<DoubleProp, "name" | "type">): DoubleProp;
644
- declare function decimal(name: string, option?: Omit<DecimalProp, "name" | "type">): DecimalProp;
645
- declare function boolean(name: string, option?: Omit<BooleanProp, "name" | "type">): BooleanProp;
646
- declare function date(name: string, option?: Omit<DateProp, "name" | "type"> & {
647
- now?: true;
648
- }): DateProp;
649
- declare function dateTime(name: string, option?: Omit<DateTimeProp, "name" | "type"> & {
650
- now?: true;
651
- }): DateTimeProp;
652
- declare function time(name: string, option?: Omit<TimeProp, "name" | "type"> & {
653
- now?: true;
654
- }): TimeProp;
655
- declare function timestamp(name: string, option?: Omit<TimestampProp, "name" | "type"> & {
656
- now?: true;
657
- }): TimestampProp;
658
- declare function json(name: string, option: Omit<JsonProp, "name" | "type">): JsonProp;
659
- declare function uuid(name: string, option: Omit<UuidProp, "name" | "type">): UuidProp;
660
- declare function enums(name: string, option: Omit<EnumProp, "name" | "type" | "id"> & {
661
- id?: string;
662
- }): EnumProp;
663
- declare function virtual(name: string, option: Omit<VirtualProp, "name" | "type" | "dbDefault" | "toFilter">): VirtualProp;
664
- declare function relationOneToOne(name: string, option: DistributiveOmit<OneToOneRelationProp, "name" | "type" | "relationType">): OneToOneRelationProp;
665
- declare function relationBelongsToOne(name: string, option: Omit<BelongsToOneRelationProp, "name" | "type" | "relationType">): BelongsToOneRelationProp;
666
- declare function relationHasMany(name: string, option: Omit<HasManyRelationProp, "name" | "type" | "relationType">): HasManyRelationProp;
667
- declare function relationManyToMany(name: string, option: Omit<ManyToManyRelationProp, "name" | "type" | "relationType">): ManyToManyRelationProp;
668
- declare const i: {
669
- index: typeof index;
670
- unique: typeof unique;
671
- };
672
- declare function index(columns: string | string[]): EntityIndex;
673
- declare function unique(columns: string | string[]): EntityIndex;
674
-
675
- type MigratorMode = "dev" | "deploy";
676
- type MigratorOptions = {
677
- readonly mode: MigratorMode;
678
- };
679
- type MigrationCode = {
680
- name: string;
681
- path: string;
682
- };
683
- type ConnString = `${"mysql2"}://${string}@${string}:${number}/${string}`;
684
- type MigrationStatus = {
685
- codes: MigrationCode[];
686
- conns: {
687
- name: string;
688
- connKey: string;
689
- connString: ConnString;
690
- currentVersion: string;
691
- status: string | number;
692
- pending: string[];
693
- }[];
694
- preparedCodes: GenMigrationCode[];
695
- };
696
- declare class Migrator {
697
- readonly mode: MigratorMode;
698
- targets: {
699
- compare?: KnexClient | KyselyClient;
700
- pending: KnexClient | KyselyClient;
701
- shadow: KnexClient | KyselyClient;
702
- apply: (KnexClient | KyselyClient)[];
703
- };
704
- constructor(options: MigratorOptions);
705
- getMigrationCodes(): Promise<{
706
- normal: MigrationCode[];
707
- onlyTs: MigrationCode[];
708
- onlyJs: MigrationCode[];
709
- }>;
710
- getStatus(): Promise<MigrationStatus>;
711
- runAction(action: "latest" | "rollback", targets: string[]): Promise<{
712
- connKey: string;
713
- batchNo: number;
714
- applied: string[];
715
- }[]>;
716
- delCodes(codeNames: string[]): Promise<number>;
717
- generatePreparedCodes(): Promise<number>;
718
- clearPendingList(): Promise<void>;
719
- check(): Promise<void>;
720
- run(): Promise<void>;
721
- rollback(): Promise<void>;
722
- cleanUpDist(force?: boolean): Promise<void>;
723
- runShadowTest(): Promise<{
724
- connKey: string;
725
- batchNo: number;
726
- applied: string[];
727
- }[]>;
728
- resetAll(): Promise<void>;
729
- compareMigrations(compareDB: KnexClient | KyselyClient): Promise<GenMigrationCode[]>;
730
- getMigrationSetFromDB(compareDB: KnexClient | KyselyClient, table: string): Promise<MigrationSet | null>;
731
- resolveDBColType(colType: string, colField: string): Pick<MigrationColumn, "type" | "unsigned" | "length" | "precision" | "scale">;
732
- readTable(compareDB: KnexClient | KyselyClient, tableName: string): Promise<[DBColumn[], DBIndex[], DBForeign[]]>;
733
- getMigrationSetFromEntity(entity: Entity): MigrationSetAndJoinTable;
734
- showMigrationSet(which: "Entity" | "DB", migrationSet: MigrationSet): void;
735
- destroy(): Promise<void>;
736
- }
737
- type DBColumn = {
738
- Field: string;
739
- Type: string;
740
- Null: string;
741
- Key: string;
742
- Default: string | null;
743
- Extra: string;
744
- };
745
- type DBIndex = {
746
- Table: string;
747
- Non_unique: number;
748
- Key_name: string;
749
- Seq_in_index: number;
750
- Column_name: string;
751
- Collation: string | null;
752
- Cardinality: number | null;
753
- Sub_part: number | null;
754
- Packed: string | null;
755
- Null: string;
756
- Index_type: string;
757
- Comment: string;
758
- Index_comment: string;
759
- Visible: string;
760
- Expression: string | null;
761
- };
762
- type DBForeign = {
763
- keyName: string;
764
- from: string;
765
- referencesTable: string;
766
- referencesField: string;
767
- onDelete: string;
768
- onUpdate: string;
769
- };
770
-
771
- declare class FixtureManagerClass {
772
- private relationGraph;
773
- init(): void;
774
- cleanAndSeed(usingTables?: string[]): Promise<void>;
775
- getChecksum(db: KnexClient | KyselyClient, tableName: string): Promise<string>;
776
- sync(): Promise<void>;
777
- importFixture(entityId: string, ids: number[]): Promise<void>;
778
- getImportQueries(entityId: string, field: string, id: number): Promise<string[]>;
779
- destory(): Promise<void>;
780
- getFixtures(sourceDBName: keyof SonamuDBConfig, targetDBName: keyof SonamuDBConfig, searchOptions: FixtureSearchOptions): Promise<FixtureRecord[]>;
781
- createFixtureRecord(entity: Entity, row: any, options?: {
782
- singleRecord?: boolean;
783
- _db?: KnexClient | KyselyClient;
784
- }): Promise<FixtureRecord[]>;
785
- insertFixtures(dbName: keyof SonamuDBConfig, _fixtures: FixtureRecord[]): Promise<FixtureImportResult[]>;
786
- private prepareInsertData;
787
- private insertFixture;
788
- private handleManyToManyRelations;
789
- addFixtureLoader(code: string): Promise<void>;
790
- private checkUniqueViolation;
791
- }
792
- declare const FixtureManager: FixtureManagerClass;
793
-
794
- declare function isLocal(): boolean;
795
- declare function isRemote(): boolean;
796
- declare function isInDocker(): boolean;
797
- declare function isDaemonServer(): boolean;
798
- declare function isDevelopment(): boolean;
799
- declare function isStaging(): boolean;
800
- declare function isProduction(): boolean;
801
- declare function isTest(): boolean;
802
-
803
- declare function globAsync(pathPattern: string): Promise<string[]>;
804
- declare function importMultiple(filePaths: string[], doRefresh?: boolean): Promise<{
805
- filePath: string;
806
- imported: any;
807
- }[]>;
808
- declare function findAppRootPath(): Promise<string>;
809
- declare function findApiRootPath(): string;
810
- declare function nonNullable<T>(value: T): value is NonNullable<T>;
811
- declare function hydrate<T>(rows: T[]): T[];
812
-
813
- export { AlreadyProcessedException, type ApiDecoratorOptions, ApiParam, ApiParamType, BadRequestException, BaseFrameClass, BelongsToOneRelationProp, BigIntegerProp, BooleanProp, type Context, type ContextExtend, DB, DBKnexClass, DBKyselyClass, DBPreset, Database, DatabaseDriver, DatabaseExtend, DateProp, DateTimeProp, DecimalProp, DistributiveOmit, DoubleProp, DuplicateRowException, Entity, EntityIndex, EntityJson, EntityManager, type EntityNamesRecord, EntityProp, EntityPropNode, EntitySubsetRow, EnumProp, type ExtendedApi, FixtureImportResult, FixtureManager, FixtureManagerClass, FixtureRecord, FixtureSearchOptions, FloatProp, GenMigrationCode, GenerateOptions, HasManyRelationProp, IntegerProp, InternalServerErrorException, JsonProp, KnexBaseConfig, KnexConfig, KyselyBaseConfig, KyselyConfig, ManyToManyRelationProp, MigrationColumn, MigrationForeign, MigrationIndex, MigrationSet, MigrationSetAndJoinTable, type MigrationStatus, Migrator, type MigratorOptions, NotFoundException, OneToOneRelationProp, PathAndCode, RelationProp, type RenderedTemplate, RenderingNode, type ServiceClient, ServiceUnavailableException, SoException, Sonamu, type SonamuConfig, SonamuDBBaseConfig, SonamuDBConfig, SonamuKnexDBConfig, SonamuKyselyDBConfig, type SonamuSecrets, type StreamDecoratorOptions, StringProp, SubsetQuery, Syncer, TargetNotFoundException, TemplateKey, TemplateOptions, TextProp, TimeProp, TimestampProp, UnauthorizedException, UpsertBuilder, UuidProp, VirtualProp, api, apiParamToTsCode, apiParamToTsCodeAsObject, apiParamTypeToTsType, findApiRootPath, findAppRootPath, getTextTypeLength, getZodObjectFromApi, getZodObjectFromApiParams, getZodTypeFromApiParamType, globAsync, hydrate, i, importMultiple, isDaemonServer, isDevelopment, isInDocker, isLocal, isProduction, isRemote, isSoException, isStaging, isTest, nonNullable, p, propNodeToZodTypeDef, propToZodTypeDef, registeredApis, serializeZodType, setupErrorHandler, stream, unwrapPromiseOnce, zodTypeToTsTypeDef, zodTypeToZodCode };
1
+ export type * from "./api/context";
2
+ export * from "./api/decorators";
3
+ export * from "./api/sonamu";
4
+ export * from "./database/base-model";
5
+ export * from "./api/base-frame";
6
+ export * from "./database/db";
7
+ export * from "./database/upsert-builder";
8
+ export * from "./database/puri";
9
+ export * from "./database/puri-wrapper";
10
+ export * from "./database/puri.types";
11
+ export * from "./exceptions/error-handler";
12
+ export * from "./exceptions/so-exceptions";
13
+ export * from "./stream/sse";
14
+ export * from "./types/types";
15
+ export * from "./utils/controller";
16
+ export * from "./utils/model";
17
+ export * from "./utils/utils";
18
+ export * from "./testing/fixture-manager";
19
+ export * from "./migration/migrator";
20
+ export * from "./entity/entity-manager";
21
+ export * from "./entity/entity";
22
+ export * from "./file-storage/driver";
23
+ //# sourceMappingURL=index.d.ts.map