@simplysm/sd-cli 10.0.4 → 10.0.22

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 (286) hide show
  1. package/.eslintrc.cjs +1 -1
  2. package/dist/SdLinter.d.ts +5 -0
  3. package/dist/SdLinter.js.map +1 -0
  4. package/dist/SdLinter.mjs +37 -0
  5. package/dist/SdTsIncrementalBuilder.d.ts +16 -0
  6. package/dist/SdTsIncrementalBuilder.js.map +1 -0
  7. package/dist/SdTsIncrementalBuilder.mjs +54 -0
  8. package/dist/build-cluster.js.map +1 -1
  9. package/dist/build-cluster.mjs +124 -0
  10. package/dist/builders/SdCliClientBuilder.d.ts +13 -0
  11. package/dist/builders/SdCliClientBuilder.js.map +1 -0
  12. package/dist/builders/SdCliClientBuilder.mjs +167 -0
  13. package/dist/builders/SdCliJsLibLinter.d.ts +3 -7
  14. package/dist/builders/SdCliJsLibLinter.js.map +1 -1
  15. package/dist/builders/{SdCliJsLibLinter.js → SdCliJsLibLinter.mjs} +8 -17
  16. package/dist/builders/SdCliServerBuilder.d.ts +14 -0
  17. package/dist/builders/SdCliServerBuilder.js.map +1 -0
  18. package/dist/builders/SdCliServerBuilder.mjs +171 -0
  19. package/dist/builders/SdCliTsLibBuilder.d.ts +3 -10
  20. package/dist/builders/SdCliTsLibBuilder.js.map +1 -1
  21. package/dist/builders/SdCliTsLibBuilder.mjs +75 -0
  22. package/dist/commons.d.ts +28 -2
  23. package/dist/entry/SdCliLocalUpdate.d.ts +7 -0
  24. package/dist/entry/SdCliLocalUpdate.js.map +1 -0
  25. package/dist/entry/SdCliLocalUpdate.mjs +55 -0
  26. package/dist/entry/SdCliProject.d.ts +1 -0
  27. package/dist/entry/SdCliProject.js.map +1 -1
  28. package/dist/entry/{SdCliProject.js → SdCliProject.mjs} +94 -10
  29. package/dist/sd-cli.js.map +1 -1
  30. package/dist/{sd-cli.js → sd-cli.mjs} +16 -0
  31. package/dist/sd-core-common/src/decorators/NotifyPropertyChange.d.ts +20 -0
  32. package/dist/sd-core-common/src/decorators/NotifyPropertyChange.js.map +1 -0
  33. package/dist/sd-core-common/src/decorators/NotifyPropertyChange.mjs +12 -0
  34. package/dist/sd-core-common/src/decorators/PropertyGetSetDecoratorBase.d.ts +43 -0
  35. package/dist/sd-core-common/src/decorators/PropertyGetSetDecoratorBase.js.map +1 -0
  36. package/dist/sd-core-common/src/decorators/PropertyGetSetDecoratorBase.mjs +54 -0
  37. package/dist/sd-core-common/src/decorators/PropertyValidate.d.ts +16 -0
  38. package/dist/sd-core-common/src/decorators/PropertyValidate.js.map +1 -0
  39. package/dist/sd-core-common/src/decorators/PropertyValidate.mjs +26 -0
  40. package/dist/sd-core-common/src/decorators/decorator-return-types.d.ts +14 -0
  41. package/dist/sd-core-common/src/decorators/decorator-return-types.js.map +1 -0
  42. package/dist/sd-core-common/src/decorators/decorator-return-types.mjs +2 -0
  43. package/dist/sd-core-common/src/errors/ArgumentError.d.ts +10 -0
  44. package/dist/sd-core-common/src/errors/ArgumentError.js.map +1 -0
  45. package/dist/sd-core-common/src/errors/ArgumentError.mjs +13 -0
  46. package/dist/sd-core-common/src/errors/NeverEntryError.d.ts +10 -0
  47. package/dist/sd-core-common/src/errors/NeverEntryError.js.map +1 -0
  48. package/dist/sd-core-common/src/errors/NeverEntryError.mjs +13 -0
  49. package/dist/sd-core-common/src/errors/NotImplementError.d.ts +10 -0
  50. package/dist/sd-core-common/src/errors/NotImplementError.js.map +1 -0
  51. package/dist/sd-core-common/src/errors/NotImplementError.mjs +13 -0
  52. package/dist/sd-core-common/src/errors/SdError.d.ts +23 -0
  53. package/dist/sd-core-common/src/errors/SdError.js.map +1 -0
  54. package/dist/sd-core-common/src/errors/SdError.mjs +40 -0
  55. package/dist/sd-core-common/src/errors/TimeoutError.d.ts +11 -0
  56. package/dist/sd-core-common/src/errors/TimeoutError.js.map +1 -0
  57. package/dist/sd-core-common/src/errors/TimeoutError.mjs +16 -0
  58. package/dist/sd-core-common/src/extensions/ArrayExtension.d.ts +147 -0
  59. package/dist/sd-core-common/src/extensions/ArrayExtension.js.map +1 -0
  60. package/dist/sd-core-common/src/extensions/ArrayExtension.mjs +448 -0
  61. package/dist/sd-core-common/src/extensions/MapExtension.d.ts +4 -0
  62. package/dist/sd-core-common/src/extensions/MapExtension.js.map +1 -0
  63. package/dist/sd-core-common/src/extensions/MapExtension.mjs +15 -0
  64. package/dist/sd-core-common/src/extensions/SetExtension.d.ts +3 -0
  65. package/dist/sd-core-common/src/extensions/SetExtension.js.map +1 -0
  66. package/dist/sd-core-common/src/extensions/SetExtension.mjs +10 -0
  67. package/dist/sd-core-common/src/index.d.ts +32 -0
  68. package/dist/sd-core-common/src/index.js.map +1 -0
  69. package/dist/sd-core-common/src/index.mjs +33 -0
  70. package/dist/sd-core-common/src/types/DateOnly.d.ts +135 -0
  71. package/dist/sd-core-common/src/types/DateOnly.js.map +1 -0
  72. package/dist/sd-core-common/src/types/DateOnly.mjs +220 -0
  73. package/dist/sd-core-common/src/types/DateTime.d.ts +42 -0
  74. package/dist/sd-core-common/src/types/DateTime.js.map +1 -0
  75. package/dist/sd-core-common/src/types/DateTime.mjs +156 -0
  76. package/dist/sd-core-common/src/types/DeepPartial.d.ts +3 -0
  77. package/dist/sd-core-common/src/types/DeepPartial.js.map +1 -0
  78. package/dist/sd-core-common/src/types/DeepPartial.mjs +2 -0
  79. package/dist/sd-core-common/src/types/ObjectSet.d.ts +4 -0
  80. package/dist/sd-core-common/src/types/ObjectSet.js.map +1 -0
  81. package/dist/sd-core-common/src/types/ObjectSet.mjs +18 -0
  82. package/dist/sd-core-common/src/types/Time.d.ts +27 -0
  83. package/dist/sd-core-common/src/types/Time.js.map +1 -0
  84. package/dist/sd-core-common/src/types/Time.mjs +108 -0
  85. package/dist/sd-core-common/src/types/Type.d.ts +7 -0
  86. package/dist/sd-core-common/src/types/Type.js.map +1 -0
  87. package/dist/sd-core-common/src/types/Type.mjs +2 -0
  88. package/dist/sd-core-common/src/types/UnwrappedType.d.ts +1 -0
  89. package/dist/sd-core-common/src/types/UnwrappedType.js.map +1 -0
  90. package/dist/sd-core-common/src/types/UnwrappedType.mjs +2 -0
  91. package/dist/sd-core-common/src/types/Uuid.d.ts +8 -0
  92. package/dist/sd-core-common/src/types/Uuid.js.map +1 -0
  93. package/dist/sd-core-common/src/types/Uuid.mjs +26 -0
  94. package/dist/sd-core-common/src/types/WrappedType.d.ts +1 -0
  95. package/dist/sd-core-common/src/types/WrappedType.js.map +1 -0
  96. package/dist/sd-core-common/src/types/WrappedType.mjs +2 -0
  97. package/dist/sd-core-common/src/utils/DateTimeFormatUtil.d.ts +12 -0
  98. package/dist/sd-core-common/src/utils/DateTimeFormatUtil.js.map +1 -0
  99. package/dist/sd-core-common/src/utils/DateTimeFormatUtil.mjs +67 -0
  100. package/dist/sd-core-common/src/utils/FunctionQueue.d.ts +8 -0
  101. package/dist/sd-core-common/src/utils/FunctionQueue.js.map +1 -0
  102. package/dist/sd-core-common/src/utils/FunctionQueue.mjs +46 -0
  103. package/dist/sd-core-common/src/utils/FunctionUtil.d.ts +6 -0
  104. package/dist/sd-core-common/src/utils/FunctionUtil.js.map +1 -0
  105. package/dist/sd-core-common/src/utils/FunctionUtil.mjs +31 -0
  106. package/dist/sd-core-common/src/utils/JsonConvert.d.ts +8 -0
  107. package/dist/sd-core-common/src/utils/JsonConvert.js.map +1 -0
  108. package/dist/sd-core-common/src/utils/JsonConvert.mjs +78 -0
  109. package/dist/sd-core-common/src/utils/MathUtil.d.ts +3 -0
  110. package/dist/sd-core-common/src/utils/MathUtil.js.map +1 -0
  111. package/dist/sd-core-common/src/utils/MathUtil.mjs +6 -0
  112. package/dist/sd-core-common/src/utils/NumberUtil.d.ts +6 -0
  113. package/dist/sd-core-common/src/utils/NumberUtil.js.map +1 -0
  114. package/dist/sd-core-common/src/utils/NumberUtil.mjs +32 -0
  115. package/dist/sd-core-common/src/utils/ObjectUtil.d.ts +80 -0
  116. package/dist/sd-core-common/src/utils/ObjectUtil.js.map +1 -0
  117. package/dist/sd-core-common/src/utils/ObjectUtil.mjs +452 -0
  118. package/dist/sd-core-common/src/utils/SdSyncEventEmitter.d.ts +6 -0
  119. package/dist/sd-core-common/src/utils/SdSyncEventEmitter.js.map +1 -0
  120. package/dist/sd-core-common/src/utils/SdSyncEventEmitter.mjs +27 -0
  121. package/dist/sd-core-common/src/utils/StringUtil.d.ts +8 -0
  122. package/dist/sd-core-common/src/utils/StringUtil.js.map +1 -0
  123. package/dist/sd-core-common/src/utils/StringUtil.mjs +77 -0
  124. package/dist/sd-core-common/src/utils/Wait.d.ts +4 -0
  125. package/dist/sd-core-common/src/utils/Wait.js.map +1 -0
  126. package/dist/sd-core-common/src/utils/Wait.mjs +23 -0
  127. package/dist/sd-core-node/src/index.d.ts +6 -0
  128. package/dist/sd-core-node/src/index.js.map +1 -0
  129. package/dist/sd-core-node/src/index.mjs +7 -0
  130. package/dist/sd-core-node/src/utils/FsUtil.d.ts +44 -0
  131. package/dist/sd-core-node/src/utils/FsUtil.js.map +1 -0
  132. package/dist/sd-core-node/src/utils/FsUtil.mjs +493 -0
  133. package/dist/sd-core-node/src/utils/Logger.d.ts +91 -0
  134. package/dist/sd-core-node/src/utils/Logger.js.map +1 -0
  135. package/dist/sd-core-node/src/utils/Logger.mjs +185 -0
  136. package/dist/sd-core-node/src/utils/PathUtil.d.ts +6 -0
  137. package/dist/sd-core-node/src/utils/PathUtil.js.map +1 -0
  138. package/dist/sd-core-node/src/utils/PathUtil.mjs +24 -0
  139. package/dist/sd-core-node/src/utils/SdFsWatcher.d.ts +15 -0
  140. package/dist/sd-core-node/src/utils/SdFsWatcher.js.map +1 -0
  141. package/dist/sd-core-node/src/utils/SdFsWatcher.mjs +43 -0
  142. package/dist/sd-core-node/src/utils/SdProcess.d.ts +5 -0
  143. package/dist/sd-core-node/src/utils/SdProcess.js.map +1 -0
  144. package/dist/sd-core-node/src/utils/SdProcess.mjs +36 -0
  145. package/dist/sd-orm-common/src/CaseQueryHelper.d.ts +12 -0
  146. package/dist/sd-orm-common/src/CaseQueryHelper.js.map +1 -0
  147. package/dist/sd-orm-common/src/CaseQueryHelper.mjs +19 -0
  148. package/dist/sd-orm-common/src/CaseWhenQueryHelper.d.ts +12 -0
  149. package/dist/sd-orm-common/src/CaseWhenQueryHelper.js.map +1 -0
  150. package/dist/sd-orm-common/src/CaseWhenQueryHelper.mjs +20 -0
  151. package/dist/sd-orm-common/src/DbContext.d.ts +81 -0
  152. package/dist/sd-orm-common/src/DbContext.js.map +1 -0
  153. package/dist/sd-orm-common/src/DbContext.mjs +635 -0
  154. package/dist/sd-orm-common/src/IDbConnection.d.ts +15 -0
  155. package/dist/sd-orm-common/src/IDbConnection.js.map +1 -0
  156. package/dist/sd-orm-common/src/IDbConnection.mjs +2 -0
  157. package/dist/sd-orm-common/src/IDbContextExecutor.d.ts +17 -0
  158. package/dist/sd-orm-common/src/IDbContextExecutor.js.map +1 -0
  159. package/dist/sd-orm-common/src/IDbContextExecutor.mjs +2 -0
  160. package/dist/sd-orm-common/src/IDbMigration.d.ts +4 -0
  161. package/dist/sd-orm-common/src/IDbMigration.js.map +1 -0
  162. package/dist/sd-orm-common/src/IDbMigration.mjs +2 -0
  163. package/dist/sd-orm-common/src/QueryBuilder.d.ts +48 -0
  164. package/dist/sd-orm-common/src/QueryBuilder.js.map +1 -0
  165. package/dist/sd-orm-common/src/QueryBuilder.mjs +1022 -0
  166. package/dist/sd-orm-common/src/QueryHelper.d.ts +75 -0
  167. package/dist/sd-orm-common/src/QueryHelper.js.map +1 -0
  168. package/dist/sd-orm-common/src/QueryHelper.mjs +627 -0
  169. package/dist/sd-orm-common/src/QueryUnit.d.ts +10 -0
  170. package/dist/sd-orm-common/src/QueryUnit.js.map +1 -0
  171. package/dist/sd-orm-common/src/QueryUnit.mjs +16 -0
  172. package/dist/sd-orm-common/src/Queryable.d.ts +105 -0
  173. package/dist/sd-orm-common/src/Queryable.js.map +1 -0
  174. package/dist/sd-orm-common/src/Queryable.mjs +1375 -0
  175. package/dist/sd-orm-common/src/SdOrmDataType.d.ts +21 -0
  176. package/dist/sd-orm-common/src/SdOrmDataType.js.map +1 -0
  177. package/dist/sd-orm-common/src/SdOrmDataType.mjs +2 -0
  178. package/dist/sd-orm-common/src/commons.d.ts +400 -0
  179. package/dist/sd-orm-common/src/commons.js.map +1 -0
  180. package/dist/sd-orm-common/src/commons.mjs +8 -0
  181. package/dist/sd-orm-common/src/decorators.d.ts +29 -0
  182. package/dist/sd-orm-common/src/decorators.js.map +1 -0
  183. package/dist/sd-orm-common/src/decorators.mjs +89 -0
  184. package/dist/sd-orm-common/src/index.d.ts +17 -0
  185. package/dist/sd-orm-common/src/index.js.map +1 -0
  186. package/dist/sd-orm-common/src/index.mjs +18 -0
  187. package/dist/sd-orm-common/src/models/SystemMigration.d.ts +3 -0
  188. package/dist/sd-orm-common/src/models/SystemMigration.js.map +1 -0
  189. package/dist/sd-orm-common/src/models/SystemMigration.mjs +13 -0
  190. package/dist/sd-orm-common/src/utils/DbDefinitionUtil.d.ts +14 -0
  191. package/dist/sd-orm-common/src/utils/DbDefinitionUtil.js.map +1 -0
  192. package/dist/sd-orm-common/src/utils/DbDefinitionUtil.mjs +66 -0
  193. package/dist/sd-orm-common/src/utils/SdOrmUtil.d.ts +8 -0
  194. package/dist/sd-orm-common/src/utils/SdOrmUtil.js.map +1 -0
  195. package/dist/sd-orm-common/src/utils/SdOrmUtil.mjs +248 -0
  196. package/dist/sd-orm-node/src/DbConnectionFactory.d.ts +4 -0
  197. package/dist/sd-orm-node/src/DbConnectionFactory.js.map +1 -0
  198. package/dist/sd-orm-node/src/DbConnectionFactory.mjs +17 -0
  199. package/dist/sd-orm-node/src/NodeDbContextExecutor.d.ts +19 -0
  200. package/dist/sd-orm-node/src/NodeDbContextExecutor.js.map +1 -0
  201. package/dist/sd-orm-node/src/NodeDbContextExecutor.mjs +71 -0
  202. package/dist/sd-orm-node/src/SdOrm.d.ts +10 -0
  203. package/dist/sd-orm-node/src/SdOrm.js.map +1 -0
  204. package/dist/sd-orm-node/src/SdOrm.mjs +25 -0
  205. package/dist/sd-orm-node/src/index.d.ts +4 -0
  206. package/dist/sd-orm-node/src/index.js.map +1 -0
  207. package/dist/sd-orm-node/src/index.mjs +5 -0
  208. package/dist/sd-orm-node-mssql/src/MssqlDbConnection.d.ts +25 -0
  209. package/dist/sd-orm-node-mssql/src/MssqlDbConnection.js.map +1 -0
  210. package/dist/sd-orm-node-mssql/src/MssqlDbConnection.mjs +321 -0
  211. package/dist/sd-orm-node-mssql/src/index.d.ts +2 -0
  212. package/dist/sd-orm-node-mssql/src/index.js.map +1 -0
  213. package/dist/sd-orm-node-mssql/src/index.mjs +3 -0
  214. package/dist/sd-orm-node-mysql/src/MysqlDbConnection.d.ts +22 -0
  215. package/dist/sd-orm-node-mysql/src/MysqlDbConnection.js.map +1 -0
  216. package/dist/sd-orm-node-mysql/src/MysqlDbConnection.mjs +200 -0
  217. package/dist/sd-orm-node-mysql/src/index.d.ts +2 -0
  218. package/dist/sd-orm-node-mysql/src/index.js.map +1 -0
  219. package/dist/sd-orm-node-mysql/src/index.mjs +3 -0
  220. package/dist/sd-orm-node-sqlite/src/SqliteDbConnection.d.ts +22 -0
  221. package/dist/sd-orm-node-sqlite/src/SqliteDbConnection.js.map +1 -0
  222. package/dist/sd-orm-node-sqlite/src/SqliteDbConnection.mjs +172 -0
  223. package/dist/sd-orm-node-sqlite/src/index.d.ts +2 -0
  224. package/dist/sd-orm-node-sqlite/src/index.js.map +1 -0
  225. package/dist/sd-orm-node-sqlite/src/index.mjs +3 -0
  226. package/dist/sd-service-common/src/commons-orm.d.ts +4 -0
  227. package/dist/sd-service-common/src/commons-orm.js.map +1 -0
  228. package/dist/sd-service-common/src/commons-orm.mjs +2 -0
  229. package/dist/sd-service-common/src/commons-smtp.d.ts +29 -0
  230. package/dist/sd-service-common/src/commons-smtp.js.map +1 -0
  231. package/dist/sd-service-common/src/commons-smtp.mjs +2 -0
  232. package/dist/sd-service-common/src/commons.d.ts +57 -0
  233. package/dist/sd-service-common/src/commons.js.map +1 -0
  234. package/dist/sd-service-common/src/commons.mjs +3 -0
  235. package/dist/sd-service-common/src/index.d.ts +3 -0
  236. package/dist/sd-service-common/src/index.js.map +1 -0
  237. package/dist/sd-service-common/src/index.mjs +4 -0
  238. package/dist/sd-service-server/src/ApiServiceError.d.ts +12 -0
  239. package/dist/sd-service-server/src/ApiServiceError.js.map +1 -0
  240. package/dist/sd-service-server/src/ApiServiceError.mjs +15 -0
  241. package/dist/sd-service-server/src/SdServiceServer.d.ts +39 -0
  242. package/dist/sd-service-server/src/SdServiceServer.js.map +1 -0
  243. package/dist/sd-service-server/src/SdServiceServer.mjs +513 -0
  244. package/dist/sd-service-server/src/commons.d.ts +23 -0
  245. package/dist/sd-service-server/src/commons.js.map +1 -0
  246. package/dist/sd-service-server/src/commons.mjs +3 -0
  247. package/dist/sd-service-server/src/index.d.ts +8 -0
  248. package/dist/sd-service-server/src/index.js.map +1 -0
  249. package/dist/sd-service-server/src/index.mjs +9 -0
  250. package/dist/sd-service-server/src/services/SdAutoUpdateService.d.ts +4 -0
  251. package/dist/sd-service-server/src/services/SdAutoUpdateService.js.map +1 -0
  252. package/dist/sd-service-server/src/services/SdAutoUpdateService.mjs +20 -0
  253. package/dist/sd-service-server/src/services/SdCryptoService.d.ts +7 -0
  254. package/dist/sd-service-server/src/services/SdCryptoService.js.map +1 -0
  255. package/dist/sd-service-server/src/services/SdCryptoService.mjs +39 -0
  256. package/dist/sd-service-server/src/services/SdOrmService.d.ts +22 -0
  257. package/dist/sd-service-server/src/services/SdOrmService.js.map +1 -0
  258. package/dist/sd-service-server/src/services/SdOrmService.mjs +115 -0
  259. package/dist/sd-service-server/src/services/SdSmtpClientService.d.ts +6 -0
  260. package/dist/sd-service-server/src/services/SdSmtpClientService.js.map +1 -0
  261. package/dist/sd-service-server/src/services/SdSmtpClientService.mjs +44 -0
  262. package/dist/sd-service-server/src/utils/SdServiceServerConfigUtil.d.ts +4 -0
  263. package/dist/sd-service-server/src/utils/SdServiceServerConfigUtil.js.map +1 -0
  264. package/dist/sd-service-server/src/utils/SdServiceServerConfigUtil.mjs +36 -0
  265. package/dist/server-worker.d.ts +1 -0
  266. package/dist/server-worker.js.map +1 -0
  267. package/dist/server-worker.mjs +36 -0
  268. package/package.json +12 -5
  269. package/src/SdLinter.ts +41 -0
  270. package/src/SdTsIncrementalBuilder.ts +75 -0
  271. package/src/build-cluster.ts +69 -18
  272. package/src/builders/SdCliClientBuilder.ts +189 -0
  273. package/src/builders/SdCliJsLibLinter.ts +11 -23
  274. package/src/builders/SdCliServerBuilder.ts +191 -0
  275. package/src/builders/SdCliTsLibBuilder.ts +33 -202
  276. package/src/commons.ts +33 -2
  277. package/src/entry/SdCliLocalUpdate.ts +70 -0
  278. package/src/entry/SdCliProject.ts +133 -17
  279. package/src/sd-cli.ts +20 -0
  280. package/src/server-worker.ts +45 -0
  281. package/tsconfig.json +1 -10
  282. package/dist/build-cluster.js +0 -75
  283. package/dist/builders/SdCliTsLibBuilder.js +0 -205
  284. /package/dist/{commons.js → commons.mjs} +0 -0
  285. /package/dist/utils/{SdCliBuildResultUtil.js → SdCliBuildResultUtil.mjs} +0 -0
  286. /package/dist/utils/{SdCliConfigUtil.js → SdCliConfigUtil.mjs} +0 -0
@@ -0,0 +1,22 @@
1
+ import { IQueryColumnDef, IQueryResultParseOption, ISOLATION_LEVEL, TDbConnectionConfig, TDbContextOption, TQueryDef } from "@simplysm/sd-orm-common";
2
+ import { SdServiceBase } from "../commons";
3
+ import { TDbConnOptions } from "@simplysm/sd-service-common";
4
+ export declare class SdOrmService extends SdServiceBase {
5
+ private readonly _logger;
6
+ private static readonly _connections;
7
+ private static readonly _wsConnectionCloseListenerMap;
8
+ static getDbConnConfigAsync: (rootPath: string, clientName: string | undefined, opt: TDbConnOptions) => Promise<TDbConnectionConfig>;
9
+ getInfoAsync(opt: Record<string, any>): Promise<{
10
+ dialect: TDbContextOption["dialect"];
11
+ database?: string;
12
+ schema?: string;
13
+ }>;
14
+ connectAsync(opt: Record<string, any>): Promise<number>;
15
+ closeAsync(connId: number): Promise<void>;
16
+ beginTransactionAsync(connId: number, isolationLevel?: ISOLATION_LEVEL): Promise<void>;
17
+ commitTransactionAsync(connId: number): Promise<void>;
18
+ rollbackTransactionAsync(connId: number): Promise<void>;
19
+ executeAsync(connId: number, queries: string[]): Promise<any[][]>;
20
+ executeDefsAsync(connId: number, defs: TQueryDef[], options?: (IQueryResultParseOption | undefined)[]): Promise<any[][]>;
21
+ bulkInsertAsync(connId: number, tableName: string, columnDefs: IQueryColumnDef[], records: Record<string, any>[]): Promise<void>;
22
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SdOrmService.js","sourceRoot":"","sources":["../../../../../sd-service-server/src/services/SdOrmService.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAKL,YAAY,EACZ,SAAS,EAIV,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAE/E,MAAM,OAAO,YAAa,SAAQ,aAAa;IAA/C;;QACmB,YAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,mBAAmB,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IAmIlG,CAAC;IArHQ,KAAK,CAAC,YAAY,CAAC,GAAwB;QAKhD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;QACpH,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,OAAO;YACv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tC,CAAC,CAAC"}
@@ -0,0 +1,115 @@
1
+ var _a;
2
+ import { DbConnectionFactory } from "@simplysm/sd-orm-node";
3
+ import { QueryBuilder, SdOrmUtil } from "@simplysm/sd-orm-common";
4
+ import { Logger } from "@simplysm/sd-core-node";
5
+ import { SdServiceBase } from "../commons";
6
+ import { SdServiceServerConfigUtil } from "../utils/SdServiceServerConfigUtil";
7
+ export class SdOrmService extends SdServiceBase {
8
+ constructor() {
9
+ super(...arguments);
10
+ this._logger = Logger.get(["simplysm", "sd-service-server", this.constructor.name]);
11
+ }
12
+ async getInfoAsync(opt) {
13
+ const config = await SdOrmService.getDbConnConfigAsync(this.server.options.rootPath, this.request?.clientName, opt);
14
+ return {
15
+ dialect: config.dialect,
16
+ ...config.dialect === "sqlite" ? {} : {
17
+ database: config.database,
18
+ schema: config.schema
19
+ }
20
+ };
21
+ }
22
+ async connectAsync(opt) {
23
+ const config = await SdOrmService.getDbConnConfigAsync(this.server.options.rootPath, this.request?.clientName, opt);
24
+ const dbConn = await DbConnectionFactory.createAsync(config);
25
+ const lastConnId = Array.from(SdOrmService._connections.keys()).max() ?? 0;
26
+ const connId = lastConnId + 1;
27
+ SdOrmService._connections.set(connId, dbConn);
28
+ await dbConn.connectAsync();
29
+ const closeEventListener = async (code) => {
30
+ // 클라이언트 창이 닫히거나 RELOAD 될때
31
+ if (code === 1001) {
32
+ await dbConn.closeAsync();
33
+ this._logger.warn("소켓연결이 끊어져, DB 연결이 중지되었습니다.");
34
+ }
35
+ };
36
+ SdOrmService._wsConnectionCloseListenerMap.set(connId, closeEventListener);
37
+ if (this.socketId !== undefined) {
38
+ (await this.server.getWsClientAsync(this.socketId))?.on("close", closeEventListener);
39
+ }
40
+ dbConn.on("close", async () => {
41
+ SdOrmService._connections.delete(connId);
42
+ SdOrmService._wsConnectionCloseListenerMap.delete(connId);
43
+ if (this.socketId !== undefined) {
44
+ (await this.server.getWsClientAsync(this.socketId))?.off("close", closeEventListener);
45
+ }
46
+ });
47
+ return connId;
48
+ }
49
+ async closeAsync(connId) {
50
+ const conn = SdOrmService._connections.get(connId);
51
+ if (conn) {
52
+ await conn.closeAsync();
53
+ }
54
+ }
55
+ async beginTransactionAsync(connId, isolationLevel) {
56
+ const conn = SdOrmService._connections.get(connId);
57
+ if (!conn) {
58
+ throw new Error("DB에 연결되어있지 않습니다.");
59
+ }
60
+ await conn.beginTransactionAsync(isolationLevel);
61
+ }
62
+ async commitTransactionAsync(connId) {
63
+ const conn = SdOrmService._connections.get(connId);
64
+ if (!conn) {
65
+ throw new Error("DB에 연결되어있지 않습니다.");
66
+ }
67
+ await conn.commitTransactionAsync();
68
+ }
69
+ async rollbackTransactionAsync(connId) {
70
+ const conn = SdOrmService._connections.get(connId);
71
+ if (!conn) {
72
+ throw new Error("DB에 연결되어있지 않습니다.");
73
+ }
74
+ await conn.rollbackTransactionAsync();
75
+ }
76
+ async executeAsync(connId, queries) {
77
+ const conn = SdOrmService._connections.get(connId);
78
+ if (!conn) {
79
+ throw new Error("DB에 연결되어있지 않습니다.");
80
+ }
81
+ return await conn.executeAsync(queries);
82
+ }
83
+ async executeDefsAsync(connId, defs, options) {
84
+ const conn = SdOrmService._connections.get(connId);
85
+ if (!conn) {
86
+ throw new Error("DB에 연결되어있지 않습니다.");
87
+ }
88
+ // 가져올데이터가 없는것으로 옵션 설정을 했을때, 하나의 쿼리로 한번의 요청보냄
89
+ if (options && options.every((item) => item == null)) {
90
+ return await conn.executeAsync([defs.map((def) => new QueryBuilder(conn.config.dialect).query(def)).join("\n")]);
91
+ }
92
+ else {
93
+ const result = await conn.executeAsync(defs.map((def) => new QueryBuilder(conn.config.dialect).query(def)));
94
+ return result.map((item, i) => SdOrmUtil.parseQueryResult(item, options ? options[i] : undefined));
95
+ }
96
+ }
97
+ async bulkInsertAsync(connId, tableName, columnDefs, records) {
98
+ const conn = SdOrmService._connections.get(connId);
99
+ if (!conn) {
100
+ throw new Error("DB에 연결되어있지 않습니다.");
101
+ }
102
+ await conn.bulkInsertAsync(tableName, columnDefs, records);
103
+ }
104
+ }
105
+ _a = SdOrmService;
106
+ SdOrmService._connections = new Map();
107
+ SdOrmService._wsConnectionCloseListenerMap = new Map();
108
+ SdOrmService.getDbConnConfigAsync = async (rootPath, clientName, opt) => {
109
+ const config = opt.configName !== undefined ? (await SdServiceServerConfigUtil.getConfigAsync(rootPath, clientName))["orm"]?.[opt.configName] : undefined;
110
+ if (config === undefined) {
111
+ throw new Error("서버에서 ORM 설정을 찾을 수 없습니다.");
112
+ }
113
+ return { ...config, ...opt.config };
114
+ };
115
+ //# sourceMappingURL=SdOrmService.js.map
@@ -0,0 +1,6 @@
1
+ import { ISmtpClientSendByDefaultOption, ISmtpClientSendOption } from "@simplysm/sd-service-common";
2
+ import { SdServiceBase } from "../commons";
3
+ export declare class SdSmtpClientService extends SdServiceBase {
4
+ sendAsync(options: ISmtpClientSendOption): Promise<string>;
5
+ sendByConfigAsync(configName: string, options: ISmtpClientSendByDefaultOption): Promise<string>;
6
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SdSmtpClientService.js","sourceRoot":"","sources":["../../../../../sd-service-server/src/services/SdSmtpClientService.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAE/E,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IAC7C,KAAK,CAAC,SAAS,CAAC,OAA8B;QACnD,OAAO,MAAM,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnD,MAAM,SAAS,GAAG,UAAU,CAAC,eAAe,CAAC;gBAC3C,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,IAAI,EAAE;oBACJ,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,IAAI,EAAE,OAAO,CAAC,IAAI;iBACnB;gBACD,GAAG,EAAE;oBACH,kBAAkB,EAAE,KAAK;iBAC1B;aACF,CAAC,CAAC;YAEH,SAAS,CAAC,QAAQ,CAChB,OAAO,EACP,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;gBACZ,IAAI,GAAG,EAAE;oBACP,MAAM,CAAC,GAAG,CAAC,CAAC;oBACZ,OAAO;iBACR;gBAED,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC1B,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,UAAkB,EAAE,OAAuC;QACxF,MAAM,MAAM,GAAG,CACb,MAAM,yBAAyB,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CACvG,CAAC,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;QACxB,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;SAC7C;QAED,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC;YAC1B,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,IAAI,EAAE,IAAI,MAAM,CAAC,UAAoB,MAAM,CAAC,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,IAAI,CAAW,GAAG;YAC3F,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,44 @@
1
+ import nodemailer from "nodemailer";
2
+ import { SdServiceServerConfigUtil } from "../utils/SdServiceServerConfigUtil";
3
+ import { SdServiceBase } from "../commons";
4
+ export class SdSmtpClientService extends SdServiceBase {
5
+ async sendAsync(options) {
6
+ return await new Promise((resolve, reject) => {
7
+ const transport = nodemailer.createTransport({
8
+ host: options.host,
9
+ port: options.port,
10
+ secure: options.secure,
11
+ auth: {
12
+ user: options.user,
13
+ pass: options.pass
14
+ },
15
+ tls: {
16
+ rejectUnauthorized: false
17
+ }
18
+ });
19
+ transport.sendMail(options, (err, info) => {
20
+ if (err) {
21
+ reject(err);
22
+ return;
23
+ }
24
+ resolve(info.messageId);
25
+ });
26
+ });
27
+ }
28
+ async sendByConfigAsync(configName, options) {
29
+ const config = (await SdServiceServerConfigUtil.getConfigAsync(this.server.options.rootPath, this.request?.clientName))["smtp"]?.[configName];
30
+ if (config === undefined) {
31
+ throw new Error("서버에서 메일서버 설정을 찾을 수 없습니다.");
32
+ }
33
+ return await this.sendAsync({
34
+ user: config.user,
35
+ pass: config.pass,
36
+ host: config.host,
37
+ port: config.port,
38
+ secure: config.secure,
39
+ from: `"${config.senderName}" <${(config.senderEmail ?? config.user)}>`,
40
+ ...options
41
+ });
42
+ }
43
+ }
44
+ //# sourceMappingURL=SdSmtpClientService.js.map
@@ -0,0 +1,4 @@
1
+ export declare class SdServiceServerConfigUtil {
2
+ static getConfigAsync(rootPath: string, clientName?: string): Promise<Record<string, any | undefined>>;
3
+ static getConfig(rootPath: string, clientName?: string): Record<string, any | undefined>;
4
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SdServiceServerConfigUtil.js","sourceRoot":"","sources":["../../../../../sd-service-server/src/utils/SdServiceServerConfigUtil.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,OAAO,yBAAyB;IAC7B,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,QAAgB,EAAE,UAAmB;QACtE,IAAI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AAG,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC9D;SACF;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,36 @@
1
+ import path from "path";
2
+ import { ObjectUtil } from "@simplysm/sd-core-common";
3
+ import { FsUtil } from "@simplysm/sd-core-node";
4
+ export class SdServiceServerConfigUtil {
5
+ static async getConfigAsync(rootPath, clientName) {
6
+ let result = {};
7
+ const rootFilePath = path.resolve(rootPath, ".config.json");
8
+ if (FsUtil.exists(rootFilePath)) {
9
+ result = await FsUtil.readJsonAsync(rootFilePath);
10
+ }
11
+ if (clientName !== undefined) {
12
+ const targetPath = path.resolve(rootPath, "www", clientName);
13
+ const filePath = path.resolve(targetPath, ".config.json");
14
+ if (FsUtil.exists(filePath)) {
15
+ result = ObjectUtil.merge(result, await FsUtil.readJsonAsync(filePath));
16
+ }
17
+ }
18
+ return result;
19
+ }
20
+ static getConfig(rootPath, clientName) {
21
+ let result = {};
22
+ const rootFilePath = path.resolve(rootPath, ".config.json");
23
+ if (FsUtil.exists(rootFilePath)) {
24
+ result = FsUtil.readJson(rootFilePath);
25
+ }
26
+ if (clientName != undefined) {
27
+ const targetPath = path.resolve(rootPath, "www", clientName);
28
+ const filePath = path.resolve(targetPath, ".config.json");
29
+ if (FsUtil.exists(filePath)) {
30
+ result = ObjectUtil.merge(result, FsUtil.readJson(filePath));
31
+ }
32
+ }
33
+ return result;
34
+ }
35
+ }
36
+ //# sourceMappingURL=SdServiceServerConfigUtil.js.map
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-worker.js","sourceRoot":"","sources":["../../../src/server-worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,IAAI,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c,EAAE;QACnC,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;KACtC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { EventEmitter } from "events";
2
+ import { Logger, LoggerSeverity } from "@simplysm/sd-core-node";
3
+ import path from "path";
4
+ import { pathToFileURL } from "url";
5
+ Error.stackTraceLimit = Infinity;
6
+ EventEmitter.defaultMaxListeners = 0;
7
+ if (Boolean(process.env["SD_DEBUG"])) {
8
+ Logger.setConfig({
9
+ console: {
10
+ level: LoggerSeverity.debug
11
+ }
12
+ });
13
+ }
14
+ else {
15
+ Logger.setConfig({
16
+ dot: true
17
+ });
18
+ }
19
+ const logger = Logger.get(["simplysm", "sd-cli", "server-worker"]);
20
+ const pkgPath = process.argv[2];
21
+ const mainFilePath = path.resolve(pkgPath, "dist/main.mjs");
22
+ const serverModule = await import(pathToFileURL(mainFilePath).href);
23
+ const server = serverModule.default;
24
+ if (server === undefined) {
25
+ logger.error(`${mainFilePath}(0, 0): 'SdServiceServer'를 'export'해야 합니다.`);
26
+ process.exit();
27
+ }
28
+ server.on("ready", () => {
29
+ process.send({ port: server.options.port });
30
+ });
31
+ process.on("message", (message) => {
32
+ if (message.type === "setPathProxy") {
33
+ server.pathProxy = message.pathProxy;
34
+ }
35
+ });
36
+ //# sourceMappingURL=server-worker.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplysm/sd-cli",
3
- "version": "10.0.4",
3
+ "version": "10.0.22",
4
4
  "description": "심플리즘 패키지 - CLI",
5
5
  "author": "김석래",
6
6
  "repository": {
@@ -9,17 +9,24 @@
9
9
  "directory": "packages/sd-cli"
10
10
  },
11
11
  "license": "MIT",
12
- "bin": "./dist/bin/sd-cli.mjs",
12
+ "bin": "./dist/sd-cli.mjs",
13
13
  "type": "module",
14
14
  "engines": {
15
15
  "node": "^20"
16
16
  },
17
17
  "dependencies": {
18
- "@simplysm/sd-core-common": "10.0.4",
19
- "@simplysm/sd-core-node": "10.0.4",
20
- "eslint": "^8.43.0",
18
+ "@simplysm/sd-core-common": "10.0.22",
19
+ "@simplysm/sd-core-node": "10.0.22",
20
+ "@simplysm/sd-service-server": "10.0.22",
21
+ "@vitejs/plugin-react": "^4.0.2",
22
+ "esbuild": "^0.18.11",
23
+ "eslint": "^8.44.0",
24
+ "rollup": "^3.26.2",
25
+ "sass": "^1.63.6",
21
26
  "semver": "^7.5.3",
22
27
  "typescript": "^4.9.5",
28
+ "vite": "^4.4.1",
29
+ "vite-tsconfig-paths": "^4.2.0",
23
30
  "yargs": "^17.7.2"
24
31
  },
25
32
  "devDependencies": {
@@ -0,0 +1,41 @@
1
+ import { ISdCliPackageBuildResult } from "./commons";
2
+ import { ESLint } from "eslint";
3
+ import ts from "typescript";
4
+
5
+ export class SdLinter {
6
+ public static async lintAsync(filePaths: string[], program?: ts.Program): Promise<ISdCliPackageBuildResult[]> {
7
+ const linter = new ESLint(program ? {
8
+ overrideConfig: {
9
+ overrides: [
10
+ {
11
+ files: ["*.ts", "*.tsx"],
12
+ parserOptions: {
13
+ programs: [program],
14
+ tsconfigRootDir: null,
15
+ project: null
16
+ },
17
+ settings: {
18
+ "import/resolver": {
19
+ "typescript": {
20
+ programs: [program],
21
+ project: null
22
+ }
23
+ }
24
+ }
25
+ }
26
+ ]
27
+ }
28
+ } : undefined);
29
+
30
+ const lintResults = await linter.lintFiles(filePaths);
31
+
32
+ return lintResults.mapMany((lintResult) => lintResult.messages.map((msg) => ({
33
+ filePath: lintResult.filePath,
34
+ line: msg.line,
35
+ char: msg.column,
36
+ code: msg.ruleId ?? undefined,
37
+ severity: msg.severity === 1 ? "warning" as const : "error" as const,
38
+ message: msg.message
39
+ })));
40
+ }
41
+ }
@@ -0,0 +1,75 @@
1
+ import path from "path";
2
+ import ts from "typescript";
3
+ import { SdCliBuildResultUtil } from "./utils/SdCliBuildResultUtil";
4
+ import { FsUtil, PathUtil } from "@simplysm/sd-core-node";
5
+ import { ISdCliPackageBuildResult } from "./commons";
6
+
7
+ export class SdTsIncrementalBuilder {
8
+ public builderProgram?: ts.EmitAndSemanticDiagnosticsBuilderProgram;
9
+ private readonly _writeFileCache = new Map<string, string>();
10
+
11
+ public constructor(private readonly _pkgPath: string,
12
+ private readonly _options: ts.CompilerOptions,
13
+ private readonly _host: ts.CompilerHost,
14
+ private readonly _emitJs: boolean) {
15
+ }
16
+
17
+ public static async createAsync(pkgPath: string, emitJs: boolean): Promise<SdTsIncrementalBuilder> {
18
+ const tsConfigFilePath = path.resolve(pkgPath, "tsconfig.json");
19
+ const parsedTsConfig = ts.parseJsonConfigFileContent(await FsUtil.readJsonAsync(tsConfigFilePath), ts.sys, pkgPath);
20
+ const host = ts.createIncrementalCompilerHost(parsedTsConfig.options);
21
+ return new SdTsIncrementalBuilder(pkgPath, parsedTsConfig.options, host, emitJs);
22
+ }
23
+
24
+ public async buildAsync(): Promise<{
25
+ affectedFilePaths: string[];
26
+ results: ISdCliPackageBuildResult[];
27
+ }> {
28
+ const srcGlobPath = path.resolve(this._pkgPath, "src/**/*.{ts,tsx}");
29
+ const srcFilePaths = await FsUtil.globAsync(srcGlobPath);
30
+ this.builderProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram(
31
+ srcFilePaths,
32
+ this._options,
33
+ this._host,
34
+ this.builderProgram
35
+ );
36
+
37
+ const diagnostics: ts.Diagnostic[] = [];
38
+ const affectedFilePaths: string[] = [];
39
+
40
+ diagnostics.push(
41
+ ...this.builderProgram.getOptionsDiagnostics(),
42
+ ...this.builderProgram.getGlobalDiagnostics(),
43
+ );
44
+
45
+ const srcFilePathSet = new Set<string>(srcFilePaths);
46
+ while (true) {
47
+ const result = this.builderProgram.emitNextAffectedFile((filePath, data, writeByteOrderMark) => {
48
+ let realFilePath = filePath.replace(/\.js$/, ".mjs");
49
+ if (PathUtil.isChildPath(realFilePath, path.resolve(this._pkgPath, "dist", path.basename(this._pkgPath), "src"))) {
50
+ realFilePath = path.resolve(this._pkgPath, "dist", path.relative(path.resolve(this._pkgPath, "dist", path.basename(this._pkgPath), "src"), realFilePath));
51
+ }
52
+
53
+ if (this._writeFileCache.get(realFilePath) !== data) {
54
+ ts.sys.writeFile(realFilePath, data, writeByteOrderMark);
55
+ }
56
+ this._writeFileCache.set(realFilePath, data);
57
+ }, undefined, !this._emitJs);
58
+ if (!result) break;
59
+ diagnostics.push(...result.result.diagnostics);
60
+
61
+ if ("fileName" in result.affected && srcFilePathSet.has(path.resolve(result.affected.fileName))) {
62
+ diagnostics.push(...this.builderProgram.getSemanticDiagnostics(result.affected));
63
+ diagnostics.push(...this.builderProgram.getSyntacticDiagnostics(result.affected));
64
+ affectedFilePaths.push(path.resolve(result.affected.fileName));
65
+ }
66
+ }
67
+
68
+ const buildResults = diagnostics.map((item) => SdCliBuildResultUtil.convertFromTsDiag(item));
69
+
70
+ return {
71
+ affectedFilePaths,
72
+ results: buildResults
73
+ };
74
+ }
75
+ }
@@ -3,7 +3,14 @@ import { SdCliTsLibBuilder } from "./builders/SdCliTsLibBuilder";
3
3
  import { FsUtil, Logger, LoggerSeverity } from "@simplysm/sd-core-node";
4
4
  import path from "path";
5
5
  import { SdCliJsLibLinter } from "./builders/SdCliJsLibLinter";
6
+ import { EventEmitter } from "events";
7
+ import { ISdCliBuildClusterReqMessage, ISdCliBuildClusterResMessage } from "./commons";
8
+ import { NeverEntryError } from "@simplysm/sd-core-common";
9
+ import { SdCliServerBuilder } from "./builders/SdCliServerBuilder";
10
+ import { SdCliClientBuilder } from "./builders/SdCliClientBuilder";
6
11
 
12
+ Error.stackTraceLimit = Infinity;
13
+ EventEmitter.defaultMaxListeners = 0;
7
14
 
8
15
  if (Boolean(process.env["SD_DEBUG"])) {
9
16
  Logger.setConfig({
@@ -28,7 +35,7 @@ if (cluster.isPrimary) {
28
35
  });
29
36
 
30
37
  cluster.on("message", (worker, message) => {
31
- process.send!(message);
38
+ sendMessage(message);
32
39
  });
33
40
 
34
41
  process.on("message", (message) => {
@@ -39,44 +46,88 @@ if (cluster.isPrimary) {
39
46
  process.send!("ready");
40
47
  }
41
48
  else {
42
- const message = JSON.parse(process.env["SD_CLUSTER_MESSAGE"]!);
49
+ const message = JSON.parse(process.env["SD_CLUSTER_MESSAGE"]!) as ISdCliBuildClusterReqMessage;
43
50
 
44
51
  if (message.cmd === "watch") {
45
- // javascript
46
- if (!FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
52
+ // [library] javascript
53
+ if (message.pkgConf.type === "library" && !FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
47
54
  await new SdCliJsLibLinter(message.pkgPath)
48
55
  .on("change", () => {
49
- process.send!({ type: "change", ...message });
56
+ sendMessage({ type: "change", req: message });
50
57
  })
51
58
  .on("complete", (result) => {
52
- process.send!({ type: "complete", result, ...message });
59
+ sendMessage({ type: "complete", result, req: message });
53
60
  })
54
61
  .watchAsync();
55
- process.send!({ type: "ready", ...message });
62
+ sendMessage({ type: "ready", req: message });
56
63
  }
57
- // typescript
58
- else {
64
+ // [library] typescript
65
+ else if (message.pkgConf.type === "library" && FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
59
66
  await new SdCliTsLibBuilder(message.pkgPath)
60
67
  .on("change", () => {
61
- process.send!({ type: "change", ...message });
68
+ sendMessage({ type: "change", req: message });
69
+ })
70
+ .on("complete", (result) => {
71
+ sendMessage({ type: "complete", result, req: message });
72
+ })
73
+ .watchAsync();
74
+ sendMessage({ type: "ready", req: message });
75
+ }
76
+ // [server]
77
+ else if (message.pkgConf.type === "server") {
78
+ await new SdCliServerBuilder(message.pkgPath, message.pkgConf)
79
+ .on("change", () => {
80
+ sendMessage({ type: "change", req: message });
81
+ })
82
+ .on("complete", (result) => {
83
+ sendMessage({ type: "complete", result, req: message });
84
+ })
85
+ .watchAsync();
86
+ sendMessage({ type: "ready", req: message });
87
+ }
88
+ // [client]
89
+ else if (message.pkgConf.type === "client") {
90
+ await new SdCliClientBuilder(message.pkgPath)
91
+ .on("change", () => {
92
+ sendMessage({ type: "change", req: message });
62
93
  })
63
94
  .on("complete", (result) => {
64
- process.send!({ type: "complete", result, ...message });
95
+ sendMessage({ type: "complete", result, req: message });
65
96
  })
66
97
  .watchAsync();
67
- process.send!({ type: "ready", ...message });
98
+ sendMessage({ type: "ready", req: message });
99
+ }
100
+ else {
101
+ throw new NeverEntryError();
68
102
  }
69
103
  }
70
104
  else { // build
71
- // javascript
72
- if (!FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
105
+ // [library] javascript
106
+ if (message.pkgConf.type === "library" && !FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
73
107
  const result = await new SdCliJsLibLinter(message.pkgPath).buildAsync();
74
- process.send!({ type: "complete", result, ...message });
108
+ sendMessage({ type: "complete", result, req: message });
75
109
  }
76
- // typescript
77
- else {
110
+ // [library] typescript
111
+ else if (message.pkgConf.type === "library" && FsUtil.exists(path.resolve(message.pkgPath, "tsconfig.json"))) {
78
112
  const result = await new SdCliTsLibBuilder(message.pkgPath).buildAsync();
79
- process.send!({ type: "complete", result, ...message });
113
+ sendMessage({ type: "complete", result, req: message });
114
+ }
115
+ // [server]
116
+ else if (message.pkgConf.type === "server") {
117
+ const result = await new SdCliServerBuilder(message.pkgPath, message.pkgConf).buildAsync();
118
+ sendMessage({ type: "complete", result, req: message });
119
+ }
120
+ // [server]
121
+ else if (message.pkgConf.type === "client") {
122
+ const result = await new SdCliClientBuilder(message.pkgPath).buildAsync();
123
+ sendMessage({ type: "complete", result, req: message });
124
+ }
125
+ else {
126
+ throw new NeverEntryError();
80
127
  }
81
128
  }
82
129
  }
130
+
131
+ function sendMessage(message: ISdCliBuildClusterResMessage): void {
132
+ process.send!(message);
133
+ }