@lovrabet/rabetbase-cli 2.3.16-beta.3 → 2.3.16-beta.5

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 (568) hide show
  1. package/lib/api/api-doc.d.ts +9 -0
  2. package/lib/api/api-doc.js +1 -1
  3. package/lib/api/fetch-model-list.d.ts +2 -0
  4. package/lib/api/fetch-model-list.js +1 -1
  5. package/lib/api/generate-api-file.d.ts +8 -0
  6. package/lib/api/generate-api-file.js +1 -1
  7. package/lib/auth/auth-server-ui.d.ts +13 -0
  8. package/lib/auth/auth-server-ui.js +1 -1
  9. package/lib/auth/auth-server.d.ts +25 -0
  10. package/lib/auth/auth-server.js +1 -1
  11. package/lib/auth/constant.d.ts +2 -0
  12. package/lib/auth/constant.js +1 -1
  13. package/lib/auth/get-cookie.d.ts +1 -0
  14. package/lib/auth/get-cookie.js +1 -1
  15. package/lib/auth/get-session-user.d.ts +51 -0
  16. package/lib/auth/get-session-user.js +1 -1
  17. package/lib/auth/is-session-valid.d.ts +1 -0
  18. package/lib/auth/is-session-valid.js +1 -1
  19. package/lib/auth/login-success-html.d.ts +5 -0
  20. package/lib/auth/login-success-html.js +1 -1
  21. package/lib/auth/logout.d.ts +1 -0
  22. package/lib/auth/logout.js +1 -1
  23. package/lib/cli-flags.d.ts +12 -0
  24. package/lib/cli-flags.js +1 -1
  25. package/lib/cli.d.ts +2 -0
  26. package/lib/cli.js +1 -1
  27. package/lib/commands/api/generate.d.ts +2 -0
  28. package/lib/commands/api/generate.js +1 -1
  29. package/lib/commands/api/index.d.ts +2 -0
  30. package/lib/commands/api/index.js +1 -1
  31. package/lib/commands/api/list.d.ts +2 -0
  32. package/lib/commands/api/list.js +1 -1
  33. package/lib/commands/api/pull.d.ts +2 -0
  34. package/lib/commands/api/pull.js +1 -1
  35. package/lib/commands/api/shared.d.ts +18 -0
  36. package/lib/commands/api/shared.js +1 -1
  37. package/lib/commands/app/index.d.ts +5 -0
  38. package/lib/commands/app/index.js +1 -1
  39. package/lib/commands/app/list.d.ts +10 -0
  40. package/lib/commands/app/list.js +1 -1
  41. package/lib/commands/app/members-list.d.ts +2 -0
  42. package/lib/commands/app/members-list.js +1 -1
  43. package/lib/commands/app/remote-directory.d.ts +11 -0
  44. package/lib/commands/app/remote-directory.js +1 -1
  45. package/lib/commands/app/shared.d.ts +46 -0
  46. package/lib/commands/app/shared.js +1 -1
  47. package/lib/commands/app-config/delete.d.ts +2 -0
  48. package/lib/commands/app-config/delete.js +1 -1
  49. package/lib/commands/app-config/get.d.ts +2 -0
  50. package/lib/commands/app-config/get.js +1 -1
  51. package/lib/commands/app-config/index.d.ts +2 -0
  52. package/lib/commands/app-config/index.js +1 -1
  53. package/lib/commands/app-config/list.d.ts +2 -0
  54. package/lib/commands/app-config/list.js +1 -1
  55. package/lib/commands/app-config/set.d.ts +2 -0
  56. package/lib/commands/app-config/set.js +1 -1
  57. package/lib/commands/app-config/shared.d.ts +105 -0
  58. package/lib/commands/app-config/shared.js +1 -1
  59. package/lib/commands/auth/index.d.ts +2 -0
  60. package/lib/commands/auth/index.js +1 -1
  61. package/lib/commands/bff/create.d.ts +4 -0
  62. package/lib/commands/bff/create.js +1 -1
  63. package/lib/commands/bff/delete.d.ts +2 -0
  64. package/lib/commands/bff/delete.js +1 -1
  65. package/lib/commands/bff/detail.d.ts +2 -0
  66. package/lib/commands/bff/detail.js +1 -1
  67. package/lib/commands/bff/index.d.ts +5 -0
  68. package/lib/commands/bff/index.js +1 -1
  69. package/lib/commands/bff/list.d.ts +2 -0
  70. package/lib/commands/bff/list.js +1 -1
  71. package/lib/commands/bff/pull.d.ts +2 -0
  72. package/lib/commands/bff/pull.js +1 -1
  73. package/lib/commands/bff/push.d.ts +2 -0
  74. package/lib/commands/bff/push.js +1 -1
  75. package/lib/commands/bff/status.d.ts +2 -0
  76. package/lib/commands/bff/status.js +1 -1
  77. package/lib/commands/cli-skill/index.d.ts +8 -0
  78. package/lib/commands/cli-skill/index.js +1 -1
  79. package/lib/commands/cli-update.d.ts +2 -0
  80. package/lib/commands/cli-update.js +1 -1
  81. package/lib/commands/codegen/index.d.ts +2 -0
  82. package/lib/commands/codegen/index.js +1 -1
  83. package/lib/commands/codegen/sdk.d.ts +2 -0
  84. package/lib/commands/codegen/sdk.js +1 -1
  85. package/lib/commands/codegen/sql.d.ts +2 -0
  86. package/lib/commands/codegen/sql.js +1 -1
  87. package/lib/commands/common/app-registry.d.ts +17 -0
  88. package/lib/commands/common/app-registry.js +1 -1
  89. package/lib/commands/common/app-selector.d.ts +17 -0
  90. package/lib/commands/common/app-selector.js +1 -1
  91. package/lib/commands/common/async-task.d.ts +11 -0
  92. package/lib/commands/common/async-task.js +1 -1
  93. package/lib/commands/common/dry-run.d.ts +12 -0
  94. package/lib/commands/common/dry-run.js +1 -1
  95. package/lib/commands/common/flags.d.ts +26 -0
  96. package/lib/commands/common/flags.js +1 -1
  97. package/lib/commands/common/local-file.d.ts +6 -0
  98. package/lib/commands/common/local-file.js +1 -1
  99. package/lib/commands/common/validate.d.ts +13 -0
  100. package/lib/commands/common/validate.js +1 -1
  101. package/lib/commands/config/get.d.ts +5 -0
  102. package/lib/commands/config/get.js +1 -1
  103. package/lib/commands/config/index.d.ts +5 -0
  104. package/lib/commands/config/index.js +1 -1
  105. package/lib/commands/config/list.d.ts +5 -0
  106. package/lib/commands/config/list.js +1 -1
  107. package/lib/commands/config/set.d.ts +5 -0
  108. package/lib/commands/config/set.js +1 -1
  109. package/lib/commands/config/shared.d.ts +16 -0
  110. package/lib/commands/config/shared.js +1 -1
  111. package/lib/commands/data/filter.d.ts +7 -0
  112. package/lib/commands/data/filter.js +1 -1
  113. package/lib/commands/data/getOne.d.ts +7 -0
  114. package/lib/commands/data/getOne.js +1 -1
  115. package/lib/commands/data/index.d.ts +8 -0
  116. package/lib/commands/data/index.js +1 -1
  117. package/lib/commands/data/shared.d.ts +33 -0
  118. package/lib/commands/data/shared.js +1 -1
  119. package/lib/commands/dataset/business-group-update.d.ts +18 -0
  120. package/lib/commands/dataset/business-group-update.js +1 -1
  121. package/lib/commands/dataset/capability.d.ts +11 -0
  122. package/lib/commands/dataset/capability.js +1 -1
  123. package/lib/commands/dataset/delete.d.ts +2 -0
  124. package/lib/commands/dataset/delete.js +1 -1
  125. package/lib/commands/dataset/detail.d.ts +2 -0
  126. package/lib/commands/dataset/detail.js +1 -1
  127. package/lib/commands/dataset/extend-update.d.ts +26 -0
  128. package/lib/commands/dataset/extend-update.js +1 -1
  129. package/lib/commands/dataset/field-update.d.ts +27 -0
  130. package/lib/commands/dataset/field-update.js +1 -1
  131. package/lib/commands/dataset/generate.d.ts +3 -0
  132. package/lib/commands/dataset/generate.js +1 -1
  133. package/lib/commands/dataset/index.d.ts +2 -0
  134. package/lib/commands/dataset/index.js +1 -1
  135. package/lib/commands/dataset/list.d.ts +2 -0
  136. package/lib/commands/dataset/list.js +1 -1
  137. package/lib/commands/dataset/operations.d.ts +2 -0
  138. package/lib/commands/dataset/operations.js +1 -1
  139. package/lib/commands/dataset/relation-audit.d.ts +2 -0
  140. package/lib/commands/dataset/relation-audit.js +1 -1
  141. package/lib/commands/dataset/relation-create.d.ts +2 -0
  142. package/lib/commands/dataset/relation-create.js +1 -1
  143. package/lib/commands/dataset/relation-delete.d.ts +2 -0
  144. package/lib/commands/dataset/relation-delete.js +1 -1
  145. package/lib/commands/dataset/relation-shared.d.ts +128 -0
  146. package/lib/commands/dataset/relation-shared.js +1 -1
  147. package/lib/commands/dataset/relation-update.d.ts +2 -0
  148. package/lib/commands/dataset/relation-update.js +1 -1
  149. package/lib/commands/dataset/relations.d.ts +53 -0
  150. package/lib/commands/dataset/relations.js +1 -1
  151. package/lib/commands/dataset/rename.d.ts +17 -0
  152. package/lib/commands/dataset/rename.js +1 -1
  153. package/lib/commands/dataset/restore.d.ts +2 -0
  154. package/lib/commands/dataset/restore.js +1 -1
  155. package/lib/commands/db/analysis-batching.d.ts +30 -0
  156. package/lib/commands/db/analysis-batching.js +1 -1
  157. package/lib/commands/db/analyze-batch-plan.d.ts +2 -0
  158. package/lib/commands/db/analyze-batch-plan.js +1 -1
  159. package/lib/commands/db/analyze-cancel.d.ts +2 -0
  160. package/lib/commands/db/analyze-cancel.js +1 -1
  161. package/lib/commands/db/analyze-start.d.ts +2 -0
  162. package/lib/commands/db/analyze-start.js +1 -1
  163. package/lib/commands/db/analyze-status.d.ts +2 -0
  164. package/lib/commands/db/analyze-status.js +1 -1
  165. package/lib/commands/db/create.d.ts +2 -0
  166. package/lib/commands/db/create.js +1 -1
  167. package/lib/commands/db/delete.d.ts +2 -0
  168. package/lib/commands/db/delete.js +1 -1
  169. package/lib/commands/db/detail.d.ts +2 -0
  170. package/lib/commands/db/detail.js +1 -1
  171. package/lib/commands/db/diff.d.ts +2 -0
  172. package/lib/commands/db/diff.js +1 -1
  173. package/lib/commands/db/index.d.ts +5 -0
  174. package/lib/commands/db/index.js +1 -1
  175. package/lib/commands/db/list.d.ts +2 -0
  176. package/lib/commands/db/list.js +1 -1
  177. package/lib/commands/db/shared.d.ts +15 -0
  178. package/lib/commands/db/shared.js +1 -1
  179. package/lib/commands/db/tables.d.ts +2 -0
  180. package/lib/commands/db/tables.js +1 -1
  181. package/lib/commands/db/test.d.ts +2 -0
  182. package/lib/commands/db/test.js +1 -1
  183. package/lib/commands/db/update.d.ts +2 -0
  184. package/lib/commands/db/update.js +1 -1
  185. package/lib/commands/doctor.d.ts +2 -0
  186. package/lib/commands/doctor.js +1 -1
  187. package/lib/commands/file/index.d.ts +2 -0
  188. package/lib/commands/file/index.js +1 -1
  189. package/lib/commands/init/index.d.ts +11 -0
  190. package/lib/commands/init/index.js +1 -1
  191. package/lib/commands/issue/index.d.ts +2 -0
  192. package/lib/commands/issue/index.js +1 -1
  193. package/lib/commands/issue/nudge.d.ts +23 -0
  194. package/lib/commands/issue/nudge.js +1 -1
  195. package/lib/commands/issue/report.d.ts +2 -0
  196. package/lib/commands/issue/report.js +1 -1
  197. package/lib/commands/issue/shared.d.ts +32 -0
  198. package/lib/commands/issue/shared.js +1 -1
  199. package/lib/commands/kb/create.d.ts +2 -0
  200. package/lib/commands/kb/create.js +1 -1
  201. package/lib/commands/kb/delete.d.ts +2 -0
  202. package/lib/commands/kb/delete.js +1 -1
  203. package/lib/commands/kb/detail.d.ts +2 -0
  204. package/lib/commands/kb/detail.js +1 -1
  205. package/lib/commands/kb/index.d.ts +2 -0
  206. package/lib/commands/kb/index.js +1 -1
  207. package/lib/commands/kb/list.d.ts +2 -0
  208. package/lib/commands/kb/list.js +1 -1
  209. package/lib/commands/kb/shared.d.ts +33 -0
  210. package/lib/commands/kb/shared.js +1 -1
  211. package/lib/commands/kb/update.d.ts +2 -0
  212. package/lib/commands/kb/update.js +1 -1
  213. package/lib/commands/logs/index.d.ts +5 -0
  214. package/lib/commands/logs/index.js +1 -1
  215. package/lib/commands/menu/asset-update.d.ts +2 -0
  216. package/lib/commands/menu/asset-update.js +1 -1
  217. package/lib/commands/menu/delete.d.ts +2 -0
  218. package/lib/commands/menu/delete.js +1 -1
  219. package/lib/commands/menu/external-link-create.d.ts +3 -0
  220. package/lib/commands/menu/external-link-create.js +1 -1
  221. package/lib/commands/menu/external-link-update.d.ts +2 -0
  222. package/lib/commands/menu/external-link-update.js +1 -1
  223. package/lib/commands/menu/group-create.d.ts +2 -0
  224. package/lib/commands/menu/group-create.js +1 -1
  225. package/lib/commands/menu/group-update.d.ts +2 -0
  226. package/lib/commands/menu/group-update.js +1 -1
  227. package/lib/commands/menu/index.d.ts +17 -0
  228. package/lib/commands/menu/index.js +1 -1
  229. package/lib/commands/menu/list.d.ts +2 -0
  230. package/lib/commands/menu/list.js +1 -1
  231. package/lib/commands/menu/move.d.ts +2 -0
  232. package/lib/commands/menu/move.js +1 -1
  233. package/lib/commands/menu/regroup-start.d.ts +2 -0
  234. package/lib/commands/menu/regroup-start.js +1 -1
  235. package/lib/commands/menu/rename.d.ts +2 -0
  236. package/lib/commands/menu/rename.js +1 -1
  237. package/lib/commands/menu/shared/compare-table.d.ts +27 -0
  238. package/lib/commands/menu/shared/compare-table.js +1 -1
  239. package/lib/commands/menu/shared/delete-plan.d.ts +51 -0
  240. package/lib/commands/menu/shared/delete-plan.js +1 -1
  241. package/lib/commands/menu/shared/facts.d.ts +12 -0
  242. package/lib/commands/menu/shared/facts.js +1 -1
  243. package/lib/commands/menu/shared/index.d.ts +12 -0
  244. package/lib/commands/menu/shared/index.js +1 -1
  245. package/lib/commands/menu/shared/inquirer.d.ts +10 -0
  246. package/lib/commands/menu/shared/inquirer.js +1 -1
  247. package/lib/commands/menu/shared/local-pages.d.ts +12 -0
  248. package/lib/commands/menu/shared/local-pages.js +1 -1
  249. package/lib/commands/menu/shared/logic.d.ts +28 -0
  250. package/lib/commands/menu/shared/logic.js +1 -1
  251. package/lib/commands/menu/shared/mutations.d.ts +69 -0
  252. package/lib/commands/menu/shared/mutations.js +1 -1
  253. package/lib/commands/menu/shared/service.d.ts +17 -0
  254. package/lib/commands/menu/shared/service.js +1 -1
  255. package/lib/commands/menu/shared/sync-core.d.ts +7 -0
  256. package/lib/commands/menu/shared/sync-core.js +1 -1
  257. package/lib/commands/menu/shared/types.d.ts +162 -0
  258. package/lib/commands/menu/shared/update-core.d.ts +11 -0
  259. package/lib/commands/menu/shared/update-core.js +1 -1
  260. package/lib/commands/menu/shared/valid-url.d.ts +6 -0
  261. package/lib/commands/menu/shared/valid-url.js +1 -1
  262. package/lib/commands/menu/sync.d.ts +2 -0
  263. package/lib/commands/menu/sync.js +1 -1
  264. package/lib/commands/notification/config-list.d.ts +2 -0
  265. package/lib/commands/notification/config-list.js +1 -1
  266. package/lib/commands/notification/index.d.ts +2 -0
  267. package/lib/commands/notification/index.js +1 -1
  268. package/lib/commands/ocr/index.d.ts +2 -0
  269. package/lib/commands/ocr/index.js +1 -1
  270. package/lib/commands/page/generate-start.d.ts +2 -0
  271. package/lib/commands/page/generate-start.js +1 -1
  272. package/lib/commands/page/generate-status.d.ts +2 -0
  273. package/lib/commands/page/generate-status.js +1 -1
  274. package/lib/commands/page/index.d.ts +2 -0
  275. package/lib/commands/page/index.js +1 -1
  276. package/lib/commands/page/pull.d.ts +2 -0
  277. package/lib/commands/page/pull.js +1 -1
  278. package/lib/commands/page/push.d.ts +2 -0
  279. package/lib/commands/page/push.js +1 -1
  280. package/lib/commands/page/relation-audit.d.ts +2 -0
  281. package/lib/commands/page/relation-audit.js +1 -1
  282. package/lib/commands/page/restore.d.ts +2 -0
  283. package/lib/commands/page/restore.js +1 -1
  284. package/lib/commands/page/shared.d.ts +105 -0
  285. package/lib/commands/page/shared.js +1 -1
  286. package/lib/commands/page/standard-page-status.d.ts +2 -0
  287. package/lib/commands/page/standard-page-status.js +1 -1
  288. package/lib/commands/page/sync.d.ts +2 -0
  289. package/lib/commands/page/sync.js +1 -1
  290. package/lib/commands/permit/index.d.ts +2 -0
  291. package/lib/commands/permit/index.js +1 -1
  292. package/lib/commands/permit/page-get.d.ts +2 -0
  293. package/lib/commands/permit/page-get.js +1 -1
  294. package/lib/commands/permit/page-set.d.ts +2 -0
  295. package/lib/commands/permit/page-set.js +1 -1
  296. package/lib/commands/permit/role-apis-set.d.ts +2 -0
  297. package/lib/commands/permit/role-apis-set.js +1 -1
  298. package/lib/commands/permit/role-menus-set.d.ts +2 -0
  299. package/lib/commands/permit/role-menus-set.js +1 -1
  300. package/lib/commands/permit/role-menus.d.ts +2 -0
  301. package/lib/commands/permit/role-menus.js +1 -1
  302. package/lib/commands/permit/shared.d.ts +74 -0
  303. package/lib/commands/permit/shared.js +1 -1
  304. package/lib/commands/project/create/enhanced-guided-create.d.ts +7 -0
  305. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  306. package/lib/commands/project/create/format-elapsed.d.ts +1 -0
  307. package/lib/commands/project/create/format-elapsed.js +1 -1
  308. package/lib/commands/project/create/main.d.ts +6 -0
  309. package/lib/commands/project/create/main.js +1 -1
  310. package/lib/commands/project/create/non-interactive.d.ts +9 -0
  311. package/lib/commands/project/create/non-interactive.js +1 -1
  312. package/lib/commands/project/create/project-template-path.d.ts +4 -0
  313. package/lib/commands/project/create/project-template-path.js +1 -1
  314. package/lib/commands/project/create/use-copy-project-template.d.ts +1 -0
  315. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  316. package/lib/commands/project/create/use-format-code.d.ts +1 -0
  317. package/lib/commands/project/create/use-format-code.js +1 -1
  318. package/lib/commands/project/create/use-install-dependencies.d.ts +1 -0
  319. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  320. package/lib/commands/project/index.d.ts +2 -0
  321. package/lib/commands/project/index.js +1 -1
  322. package/lib/commands/project/upgrade.d.ts +1 -0
  323. package/lib/commands/project/upgrade.js +1 -1
  324. package/lib/commands/registry.d.ts +66 -0
  325. package/lib/commands/registry.js +1 -1
  326. package/lib/commands/role/create.d.ts +2 -0
  327. package/lib/commands/role/create.js +1 -1
  328. package/lib/commands/role/delete.d.ts +2 -0
  329. package/lib/commands/role/delete.js +1 -1
  330. package/lib/commands/role/detail.d.ts +2 -0
  331. package/lib/commands/role/detail.js +1 -1
  332. package/lib/commands/role/index.d.ts +2 -0
  333. package/lib/commands/role/index.js +1 -1
  334. package/lib/commands/role/list.d.ts +2 -0
  335. package/lib/commands/role/list.js +1 -1
  336. package/lib/commands/role/shared.d.ts +107 -0
  337. package/lib/commands/role/shared.js +1 -1
  338. package/lib/commands/role/update.d.ts +2 -0
  339. package/lib/commands/role/update.js +1 -1
  340. package/lib/commands/role/user-add.d.ts +2 -0
  341. package/lib/commands/role/user-add.js +1 -1
  342. package/lib/commands/role/user-remove.d.ts +2 -0
  343. package/lib/commands/role/user-remove.js +1 -1
  344. package/lib/commands/role/user-resolve.d.ts +2 -0
  345. package/lib/commands/role/user-resolve.js +1 -1
  346. package/lib/commands/run/index.d.ts +2 -0
  347. package/lib/commands/run/index.js +1 -1
  348. package/lib/commands/schema.d.ts +5 -0
  349. package/lib/commands/schema.js +1 -1
  350. package/lib/commands/sql/create.d.ts +10 -0
  351. package/lib/commands/sql/create.js +1 -1
  352. package/lib/commands/sql/delete.d.ts +5 -0
  353. package/lib/commands/sql/delete.js +1 -1
  354. package/lib/commands/sql/detail.d.ts +2 -0
  355. package/lib/commands/sql/detail.js +1 -1
  356. package/lib/commands/sql/exec.d.ts +2 -0
  357. package/lib/commands/sql/exec.js +1 -1
  358. package/lib/commands/sql/index.d.ts +5 -0
  359. package/lib/commands/sql/index.js +1 -1
  360. package/lib/commands/sql/list.d.ts +2 -0
  361. package/lib/commands/sql/list.js +1 -1
  362. package/lib/commands/sql/pull.d.ts +5 -0
  363. package/lib/commands/sql/pull.js +1 -1
  364. package/lib/commands/sql/push.d.ts +5 -0
  365. package/lib/commands/sql/push.js +1 -1
  366. package/lib/commands/sql/shared.d.ts +23 -0
  367. package/lib/commands/sql/shared.js +1 -1
  368. package/lib/commands/sql/status.d.ts +5 -0
  369. package/lib/commands/sql/status.js +1 -1
  370. package/lib/commands/sql/validate.d.ts +2 -0
  371. package/lib/commands/sql/validate.js +1 -1
  372. package/lib/commands/task/index.d.ts +2 -0
  373. package/lib/commands/task/index.js +1 -1
  374. package/lib/commands/task/status.d.ts +2 -0
  375. package/lib/commands/task/status.js +1 -1
  376. package/lib/commands/tenant/index.d.ts +2 -0
  377. package/lib/commands/tenant/index.js +1 -1
  378. package/lib/commands/tenant/members-list.d.ts +2 -0
  379. package/lib/commands/tenant/members-list.js +1 -1
  380. package/lib/commands/tenant/shared.d.ts +10 -0
  381. package/lib/commands/tenant/shared.js +1 -1
  382. package/lib/commands/workspace/add.d.ts +6 -0
  383. package/lib/commands/workspace/add.js +1 -1
  384. package/lib/commands/workspace/index.d.ts +11 -0
  385. package/lib/commands/workspace/index.js +1 -1
  386. package/lib/commands/workspace/remove.d.ts +6 -0
  387. package/lib/commands/workspace/remove.js +1 -1
  388. package/lib/config/schema.d.ts +50 -0
  389. package/lib/config/schema.js +1 -1
  390. package/lib/constant/cdn.d.ts +1 -0
  391. package/lib/constant/cdn.js +1 -1
  392. package/lib/constant/cli.d.ts +34 -0
  393. package/lib/constant/cli.js +1 -1
  394. package/lib/constant/defaults.d.ts +10 -0
  395. package/lib/constant/defaults.js +1 -1
  396. package/lib/constant/domain.d.ts +14 -0
  397. package/lib/constant/domain.js +1 -1
  398. package/lib/constant/env.d.ts +11 -0
  399. package/lib/constant/env.js +1 -1
  400. package/lib/constant/output.d.ts +1 -0
  401. package/lib/constant/output.js +1 -1
  402. package/lib/constant/paths.d.ts +5 -0
  403. package/lib/constant/paths.js +1 -1
  404. package/lib/constant/risk.d.ts +1 -0
  405. package/lib/constant/risk.js +1 -1
  406. package/lib/context/app-resolver.d.ts +36 -0
  407. package/lib/context/app-resolver.js +1 -1
  408. package/lib/context/auth-resolver.d.ts +5 -0
  409. package/lib/context/auth-resolver.js +1 -1
  410. package/lib/context/config-loader.d.ts +61 -0
  411. package/lib/context/config-loader.js +1 -1
  412. package/lib/context.d.ts +102 -0
  413. package/lib/context.js +1 -1
  414. package/lib/core/alias-resolver.d.ts +31 -0
  415. package/lib/core/alias-resolver.js +1 -1
  416. package/lib/core/api-client.d.ts +1018 -0
  417. package/lib/core/api-client.js +1 -1
  418. package/lib/core/bff/config.d.ts +8 -0
  419. package/lib/core/bff/config.js +1 -1
  420. package/lib/core/bff/file-system.d.ts +28 -0
  421. package/lib/core/bff/file-system.js +1 -1
  422. package/lib/core/bff/hash.d.ts +7 -0
  423. package/lib/core/bff/hash.js +1 -1
  424. package/lib/core/bff/lock.d.ts +25 -0
  425. package/lib/core/bff/lock.js +1 -1
  426. package/lib/core/bff/types.d.ts +92 -0
  427. package/lib/core/bff/utils.d.ts +25 -0
  428. package/lib/core/bff/utils.js +1 -1
  429. package/lib/core/db-resolver.d.ts +43 -0
  430. package/lib/core/db-resolver.js +1 -1
  431. package/lib/core/page/file-system.d.ts +6 -0
  432. package/lib/core/page/file-system.js +1 -1
  433. package/lib/core/page/hash.d.ts +4 -0
  434. package/lib/core/page/hash.js +1 -1
  435. package/lib/core/page/lock.d.ts +8 -0
  436. package/lib/core/page/lock.js +1 -1
  437. package/lib/core/page/types.d.ts +22 -0
  438. package/lib/core/sql-index-auditor.d.ts +33 -0
  439. package/lib/core/sql-index-auditor.js +1 -1
  440. package/lib/core/sql-sync/config.d.ts +7 -0
  441. package/lib/core/sql-sync/config.js +1 -1
  442. package/lib/core/sql-sync/file-system.d.ts +7 -0
  443. package/lib/core/sql-sync/file-system.js +1 -1
  444. package/lib/core/sql-sync/hash.d.ts +5 -0
  445. package/lib/core/sql-sync/hash.js +1 -1
  446. package/lib/core/sql-sync/lock.d.ts +14 -0
  447. package/lib/core/sql-sync/lock.js +1 -1
  448. package/lib/core/sql-sync/types.d.ts +43 -0
  449. package/lib/core/sql-sync/utils.d.ts +10 -0
  450. package/lib/core/sql-sync/utils.js +1 -1
  451. package/lib/core/sql-validator.d.ts +34 -0
  452. package/lib/core/sql-validator.js +1 -1
  453. package/lib/errors.d.ts +3 -0
  454. package/lib/errors.js +1 -1
  455. package/lib/framework/build-all-flags.d.ts +2 -0
  456. package/lib/framework/build-all-flags.js +1 -1
  457. package/lib/framework/error-output.d.ts +9 -0
  458. package/lib/framework/error-output.js +1 -1
  459. package/lib/framework/explicit-yes.d.ts +3 -0
  460. package/lib/framework/explicit-yes.js +1 -1
  461. package/lib/framework/flags.d.ts +3 -0
  462. package/lib/framework/flags.js +1 -1
  463. package/lib/framework/help.d.ts +4 -0
  464. package/lib/framework/help.js +1 -1
  465. package/lib/framework/index.d.ts +11 -0
  466. package/lib/framework/index.js +1 -1
  467. package/lib/framework/output.d.ts +15 -0
  468. package/lib/framework/output.js +1 -1
  469. package/lib/framework/response.d.ts +2 -0
  470. package/lib/framework/response.js +1 -1
  471. package/lib/framework/runner-alias.d.ts +14 -0
  472. package/lib/framework/runner-alias.js +1 -1
  473. package/lib/framework/runner.d.ts +36 -0
  474. package/lib/framework/runner.js +1 -1
  475. package/lib/framework/schema-export.d.ts +3 -0
  476. package/lib/framework/schema-export.js +1 -1
  477. package/lib/framework/types.d.ts +63 -0
  478. package/lib/framework/types.js +1 -1
  479. package/lib/generated/build-info.d.ts +4 -0
  480. package/lib/generated/build-info.js +1 -1
  481. package/lib/help.d.ts +1 -0
  482. package/lib/help.js +1 -1
  483. package/lib/runtime/confirmation.d.ts +4 -0
  484. package/lib/runtime/confirmation.js +1 -0
  485. package/lib/runtime/event.d.ts +5 -0
  486. package/lib/runtime/event.js +1 -0
  487. package/lib/runtime/index.d.ts +7 -0
  488. package/lib/runtime/index.js +1 -0
  489. package/lib/runtime/queue.d.ts +5 -0
  490. package/lib/runtime/queue.js +1 -0
  491. package/lib/runtime/resolve.d.ts +8 -0
  492. package/lib/runtime/resolve.js +1 -0
  493. package/lib/runtime/types.d.ts +50 -0
  494. package/lib/runtime/types.js +1 -0
  495. package/lib/skills/main.d.ts +41 -0
  496. package/lib/skills/main.js +1 -1
  497. package/lib/skills/npx-skills-add.d.ts +99 -0
  498. package/lib/skills/npx-skills-add.js +1 -1
  499. package/lib/skills/skill-presence.d.ts +44 -0
  500. package/lib/skills/skill-presence.js +1 -1
  501. package/lib/telemetry/cli-command-trace.d.ts +12 -0
  502. package/lib/telemetry/cli-command-trace.js +1 -1
  503. package/lib/telemetry/cli-help-trace.d.ts +8 -0
  504. package/lib/telemetry/cli-help-trace.js +1 -1
  505. package/lib/telemetry/ensure-cli-otel-config.d.ts +6 -0
  506. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  507. package/lib/telemetry/register-otel-exit-shutdown.d.ts +3 -0
  508. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  509. package/lib/telemetry/send-cli-trace-log.d.ts +17 -0
  510. package/lib/telemetry/send-cli-trace-log.js +1 -1
  511. package/lib/telemetry/send-platform-issue-collect-log.d.ts +26 -0
  512. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  513. package/lib/types/index.d.ts +93 -0
  514. package/lib/utils/ai_config.d.ts +47 -0
  515. package/lib/utils/ai_config.js +1 -1
  516. package/lib/utils/apply-jq-filter.d.ts +1 -0
  517. package/lib/utils/apply-jq-filter.js +1 -1
  518. package/lib/utils/cdn-config.d.ts +42 -0
  519. package/lib/utils/cdn-config.js +1 -1
  520. package/lib/utils/check-sdk-version.d.ts +23 -0
  521. package/lib/utils/check-sdk-version.js +1 -1
  522. package/lib/utils/cli-version-check.d.ts +37 -0
  523. package/lib/utils/cli-version-check.js +1 -1
  524. package/lib/utils/cli-version-policy.d.ts +9 -0
  525. package/lib/utils/cli-version-policy.js +1 -1
  526. package/lib/utils/config.d.ts +42 -0
  527. package/lib/utils/config.js +1 -1
  528. package/lib/utils/copy-directory.d.ts +1 -0
  529. package/lib/utils/copy-directory.js +1 -1
  530. package/lib/utils/entity-with-id.d.ts +30 -0
  531. package/lib/utils/entity-with-id.js +1 -1
  532. package/lib/utils/file-utils.d.ts +25 -0
  533. package/lib/utils/file-utils.js +1 -1
  534. package/lib/utils/guides-cdn.d.ts +80 -0
  535. package/lib/utils/guides-cdn.js +1 -1
  536. package/lib/utils/http-client.d.ts +30 -0
  537. package/lib/utils/http-client.js +1 -1
  538. package/lib/utils/is-non-interactive.d.ts +7 -0
  539. package/lib/utils/is-non-interactive.js +1 -1
  540. package/lib/utils/logger.d.ts +62 -0
  541. package/lib/utils/logger.js +1 -1
  542. package/lib/utils/params.d.ts +15 -0
  543. package/lib/utils/params.js +1 -1
  544. package/lib/utils/platform.d.ts +21 -0
  545. package/lib/utils/platform.js +1 -1
  546. package/lib/utils/rules-cdn.d.ts +38 -0
  547. package/lib/utils/rules-cdn.js +1 -1
  548. package/lib/utils/sleep.d.ts +1 -0
  549. package/lib/utils/sleep.js +1 -1
  550. package/lib/utils/template-replacer.d.ts +55 -0
  551. package/lib/utils/template-replacer.js +1 -1
  552. package/lib/utils/update-notice.d.ts +10 -0
  553. package/lib/utils/update-notice.js +1 -1
  554. package/lib/utils/version.d.ts +1 -0
  555. package/lib/utils/version.js +1 -1
  556. package/lib/utils/with-active-cookie.d.ts +1 -0
  557. package/lib/utils/with-active-cookie.js +1 -1
  558. package/lib/utils/write-cli-side-channel.d.ts +6 -0
  559. package/lib/utils/write-cli-side-channel.js +1 -1
  560. package/package.json +9 -1
  561. package/lib/commands/page/react/create.js +0 -1
  562. package/lib/commands/page/react/detail.js +0 -1
  563. package/lib/commands/page/react/list.js +0 -1
  564. package/lib/commands/page/react/publish.js +0 -1
  565. package/lib/commands/page/react/shared.js +0 -1
  566. package/lib/commands/page/react/syntax.js +0 -1
  567. package/lib/commands/page/react/template.js +0 -1
  568. package/lib/commands/page/react/update.js +0 -1
@@ -1 +1 @@
1
- const a181_0x57e2d4=a181_0x5cc5;(function(_0x45987b,_0xdc5b76){const _0x452acf=a181_0x5cc5,_0x4eff69=_0x45987b();while(!![]){try{const _0x2addf4=parseInt(_0x452acf(0xf8))/0x1*(-parseInt(_0x452acf(0xed))/0x2)+parseInt(_0x452acf(0x106))/0x3+parseInt(_0x452acf(0xf0))/0x4*(-parseInt(_0x452acf(0xf6))/0x5)+-parseInt(_0x452acf(0xf5))/0x6*(parseInt(_0x452acf(0xf3))/0x7)+-parseInt(_0x452acf(0xe0))/0x8+parseInt(_0x452acf(0xd2))/0x9*(-parseInt(_0x452acf(0x10c))/0xa)+-parseInt(_0x452acf(0xd9))/0xb*(-parseInt(_0x452acf(0xfe))/0xc);if(_0x2addf4===_0xdc5b76)break;else _0x4eff69['push'](_0x4eff69['shift']());}catch(_0x2472f7){_0x4eff69['push'](_0x4eff69['shift']());}}}(a181_0x555f,0x9b309));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set(['start',a181_0x57e2d4(0xf1)]);function readPackageScripts(_0x1f304d){const _0x1c4c09=a181_0x57e2d4,_0x58bae3=resolve(_0x1f304d,_0x1c4c09(0x107));if(!existsSync(_0x58bae3))return null;try{const _0x44916f=JSON[_0x1c4c09(0xdc)](readFileSync(_0x58bae3,_0x1c4c09(0x105)));return _0x44916f['scripts']??{};}catch{return null;}}function detectPackageManager(_0x422b50){const _0x5bdfdd=a181_0x57e2d4;if(existsSync(resolve(_0x422b50,_0x5bdfdd(0xe1)))||existsSync(resolve(_0x422b50,'bun.lock')))return _0x5bdfdd(0x10a);if(existsSync(resolve(_0x422b50,_0x5bdfdd(0xe7))))return'pnpm';if(existsSync(resolve(_0x422b50,_0x5bdfdd(0xee))))return _0x5bdfdd(0xda);return'npm';}async function versionCheck(_0x212eab){const _0x4de7cb=a181_0x57e2d4,_0x55dbee=await checkCliVersion();(_0x55dbee[_0x4de7cb(0x102)]||_0x55dbee[_0x4de7cb(0x108)])&&(printCliUpgradeWarning(_0x55dbee),assertCliVersionSupported(_0x55dbee));const _0x3a87f4=await checkSdkVersion(_0x212eab);if(_0x3a87f4[_0x4de7cb(0x102)])printSdkUpgradeWarning(_0x3a87f4);}function a181_0x5cc5(_0x26545b,_0x4756c3){_0x26545b=_0x26545b-0xd1;const _0x555f5d=a181_0x555f();let _0x5cc570=_0x555f5d[_0x26545b];return _0x5cc570;}function a181_0x555f(){const _0xfc28cd=['run','pnpm-lock.yaml','\x20\x20\x20\x20','node_modules','Run\x20a\x20package.json\x20script','No\x20package.json\x20found\x20in\x20current\x20directory.','cwd','4WrsbhE','yarn.lock','vite','4AzrpjJ','dev','validation','294jwcidI','Script\x20name\x20defined\x20in\x20package.json','130734NDquJD','2514685XXNOUE','keys','113494kuyNsC','args','vite\x20preview\x20exited\x20with\x20code\x20','preview','\x20run\x20start','error','1541544vYEntM','\x0a\x20\x20Available\x20scripts:\x0a','--watch','Available:\x20','needsUpgrade','close','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','utf-8','1792317wduCnH','package.json','belowMinimum','script','bun','.bin','10CQXCZo','all','2307321xoefaS','\x0a\x20\x20Usage:\x20','\x20exited\x20with\x20code\x20','push','log','(none)','inherit','253krxDdX','yarn','bool','parse','length','slice','\x22\x20not\x20found\x20in\x20package.json.','8119808ePzARH','bun.lockb','join','watch','read','\x20run\x20'];a181_0x555f=function(){return _0xfc28cd;};return a181_0x555f();}function spawnScript(_0x595608,_0x26eee3,_0x137306,_0x8019ce){return new Promise((_0x5c4667,_0x23b0e3)=>{const _0x55cf10=a181_0x5cc5,_0x1c1692=['run',_0x26eee3,..._0x137306],_0x49dffb=spawn(_0x595608,_0x1c1692,{'cwd':_0x8019ce,'stdio':_0x55cf10(0xd8),'shell':!![],'env':{...process.env,'PATH':''+join(_0x8019ce,_0x55cf10(0xe9),'.bin')+delimiter+process.env.PATH}});_0x49dffb['on'](_0x55cf10(0x103),_0xf514ce=>{const _0x59e7ac=_0x55cf10;if(_0xf514ce===0x0||_0xf514ce===null)_0x5c4667();else _0x23b0e3(new Error(_0x595608+_0x59e7ac(0xe5)+_0x26eee3+_0x59e7ac(0xd4)+_0xf514ce));}),_0x49dffb['on'](_0x55cf10(0xfd),_0x23b0e3);});}function spawnViteBuildWatch(_0x5bab80){return new Promise((_0x31b194,_0xcaaf44)=>{const _0x4555a3=a181_0x5cc5,_0x2ddcce=spawn(_0x4555a3(0xef),['build',_0x4555a3(0x100)],{'cwd':_0x5bab80,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x5bab80,'node_modules',_0x4555a3(0x10b))+delimiter+process.env.PATH}});_0x2ddcce['on'](_0x4555a3(0x103),_0xdb3018=>{const _0xf61fd8=_0x4555a3;if(_0xdb3018===0x0||_0xdb3018===null)_0x31b194();else _0xcaaf44(new Error(_0xf61fd8(0x104)+_0xdb3018));}),_0x2ddcce['on'](_0x4555a3(0xfd),_0xcaaf44);});}function spawnVitePreview(_0x3bf5c1){return new Promise((_0x2279e2,_0x531b69)=>{const _0x83ffbb=a181_0x5cc5,_0x1b9389=spawn(_0x83ffbb(0xef),['preview'],{'cwd':_0x3bf5c1,'stdio':_0x83ffbb(0xd8),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3bf5c1,_0x83ffbb(0xe9),_0x83ffbb(0x10b))+delimiter+process.env.PATH}});_0x1b9389['on'](_0x83ffbb(0x103),_0xc0ca86=>{const _0x1222d1=_0x83ffbb;if(_0xc0ca86===0x0||_0xc0ca86===null)_0x2279e2();else _0x531b69(new Error(_0x1222d1(0xfa)+_0xc0ca86));}),_0x1b9389['on'](_0x83ffbb(0xfd),_0x531b69);});}const runFlags=[{'name':a181_0x57e2d4(0xe3),'type':'boolean','description':'Enable\x20watch\x20mode\x20for\x20preview','default':![]}];export const runDefinition={'service':a181_0x57e2d4(0xe6),'command':a181_0x57e2d4(0xe6),'description':a181_0x57e2d4(0xea),'risk':a181_0x57e2d4(0xe4),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a181_0x57e2d4(0x109),'description':a181_0x57e2d4(0xf4),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x325aeb=a181_0x57e2d4,_0x2f8741=[];return _0x2f8741['push']('\x20\x20EXAMPLES'),_0x2f8741['push']('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x325aeb(0xfc)),_0x2f8741[_0x325aeb(0xd5)](_0x325aeb(0xe8)+CLI_BIN_NAME+'\x20run\x20build'),_0x2f8741[_0x325aeb(0xd5)](_0x325aeb(0xe8)+CLI_BIN_NAME+'\x20run\x20preview'),_0x2f8741[_0x325aeb(0xd5)](_0x325aeb(0xe8)+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x2f8741[_0x325aeb(0xe2)]('\x0a');},async 'execute'(_0x68224b){const _0x59ae09=a181_0x57e2d4,_0x5a55c2=process[_0x59ae09(0xec)](),_0x5b99c3=_0x68224b[_0x59ae09(0xf9)][0x0],_0x5de2d5=_0x68224b[_0x59ae09(0xf9)][_0x59ae09(0xde)](0x1),_0x2cb56f=readPackageScripts(_0x5a55c2);if(!_0x2cb56f)throw CliErrors['validation'](_0x59ae09(0xeb));if(!_0x5b99c3){const _0x2e328b=Object[_0x59ae09(0xf7)](_0x2cb56f);if(_0x2e328b[_0x59ae09(0xdd)]===0x0)console[_0x59ae09(0xd6)]('No\x20scripts\x20defined\x20in\x20package.json.');else{console[_0x59ae09(0xd6)](_0x59ae09(0xff));for(const _0x5726c2 of _0x2e328b){console[_0x59ae09(0xd6)](_0x59ae09(0xe8)+_0x5726c2);}console[_0x59ae09(0xd6)](_0x59ae09(0xd3)+CLI_BIN_NAME+'\x20run\x20<script>\x0a');}return{'ok':!![]};}if(!_0x2cb56f[_0x5b99c3])throw CliErrors[_0x59ae09(0xf2)]('Script\x20\x22'+_0x5b99c3+_0x59ae09(0xdf),_0x59ae09(0x101)+(Object[_0x59ae09(0xf7)](_0x2cb56f)['join'](',\x20')||_0x59ae09(0xd7)));const _0x44272d=detectPackageManager(_0x5a55c2);VERSION_CHECK_SCRIPTS['has'](_0x5b99c3)&&await versionCheck(_0x5a55c2);if(_0x5b99c3===_0x59ae09(0xfb)&&_0x68224b[_0x59ae09(0xdb)](_0x59ae09(0xe3)))return await Promise[_0x59ae09(0xd1)]([spawnViteBuildWatch(_0x5a55c2),spawnVitePreview(_0x5a55c2)]),{'ok':!![]};return await spawnScript(_0x44272d,_0x5b99c3,_0x5de2d5,_0x5a55c2),{'ok':!![]};}};
1
+ const a173_0x59674f=a173_0x2851;(function(_0x42e100,_0x56e71d){const _0x4f3c3c=a173_0x2851,_0xf2b6d5=_0x42e100();while(!![]){try{const _0x505596=parseInt(_0x4f3c3c(0x149))/0x1+parseInt(_0x4f3c3c(0x124))/0x2+-parseInt(_0x4f3c3c(0x11f))/0x3+parseInt(_0x4f3c3c(0x12c))/0x4+parseInt(_0x4f3c3c(0x114))/0x5+-parseInt(_0x4f3c3c(0x14b))/0x6*(parseInt(_0x4f3c3c(0x127))/0x7)+parseInt(_0x4f3c3c(0x126))/0x8*(-parseInt(_0x4f3c3c(0x12e))/0x9);if(_0x505596===_0x56e71d)break;else _0xf2b6d5['push'](_0xf2b6d5['shift']());}catch(_0x5d6aab){_0xf2b6d5['push'](_0xf2b6d5['shift']());}}}(a173_0x264d,0x40fea));import{readFileSync,existsSync}from'node:fs';import{CLI_BIN_NAME}from'../../constant/cli.js';import{resolve,delimiter,join}from'node:path';import{spawn}from'node:child_process';import{CliErrors}from'../../errors.js';import{checkSdkVersion,printSdkUpgradeWarning}from'../../utils/check-sdk-version.js';import{assertCliVersionSupported,checkCliVersion,printCliUpgradeWarning}from'../../utils/cli-version-check.js';const VERSION_CHECK_SCRIPTS=new Set([a173_0x59674f(0x138),a173_0x59674f(0x143)]);function readPackageScripts(_0x308567){const _0x1f98fd=a173_0x59674f,_0x49ef10=resolve(_0x308567,_0x1f98fd(0x129));if(!existsSync(_0x49ef10))return null;try{const _0x847da3=JSON[_0x1f98fd(0x110)](readFileSync(_0x49ef10,_0x1f98fd(0x11e)));return _0x847da3[_0x1f98fd(0x13e)]??{};}catch{return null;}}function detectPackageManager(_0x387c12){const _0x36e5fe=a173_0x59674f;if(existsSync(resolve(_0x387c12,'bun.lockb'))||existsSync(resolve(_0x387c12,'bun.lock')))return _0x36e5fe(0x122);if(existsSync(resolve(_0x387c12,'pnpm-lock.yaml')))return _0x36e5fe(0x116);if(existsSync(resolve(_0x387c12,'yarn.lock')))return _0x36e5fe(0x12a);return _0x36e5fe(0x132);}function a173_0x2851(_0x235f53,_0x28f7e2){_0x235f53=_0x235f53-0x10d;const _0x264dc5=a173_0x264d();let _0x285190=_0x264dc5[_0x235f53];return _0x285190;}async function versionCheck(_0x116567){const _0x46352b=a173_0x59674f,_0x492f28=await checkCliVersion();(_0x492f28['needsUpgrade']||_0x492f28[_0x46352b(0x134)])&&(printCliUpgradeWarning(_0x492f28),assertCliVersionSupported(_0x492f28));const _0x143a87=await checkSdkVersion(_0x116567);if(_0x143a87['needsUpgrade'])printSdkUpgradeWarning(_0x143a87);}function a173_0x264d(){const _0x4c3750=['preview','bun','\x20exited\x20with\x20code\x20','926648MnEDEj','keys','196336vkkNMQ','63049fnXdDj','\x20run\x20start','package.json','yarn','\x20run\x20preview\x20--watch','1276412SZjUHl','(none)','171rgeCre','inherit','script','\x20run\x20','npm','.bin','belowMinimum','log','\x0a\x20\x20Usage:\x20','No\x20package.json\x20found\x20in\x20current\x20directory.','start','\x20run\x20build','\x22\x20not\x20found\x20in\x20package.json.','\x20\x20EXAMPLES','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','close','scripts','\x20run\x20<script>\x0a','Enable\x20watch\x20mode\x20for\x20preview','slice','\x20\x20\x20\x20','dev','validation','length','boolean','join','vite','178592JGrNHT','Available:\x20','258FqdHKU','error','node_modules','Script\x20\x22','parse','build','vite\x20preview\x20exited\x20with\x20code\x20','all','1285135fmcIHZ','Script\x20name\x20defined\x20in\x20package.json','pnpm','Run\x20a\x20package.json\x20script','run','\x20run\x20preview','has','push','No\x20scripts\x20defined\x20in\x20package.json.','watch','utf-8','294687FckAVy','args'];a173_0x264d=function(){return _0x4c3750;};return a173_0x264d();}function spawnScript(_0x4e8c3e,_0x4bc823,_0x1cc0fe,_0x581d9d){return new Promise((_0x4bf65e,_0x4d79fc)=>{const _0x11e06b=a173_0x2851,_0x5798b2=[_0x11e06b(0x118),_0x4bc823,..._0x1cc0fe],_0x536085=spawn(_0x4e8c3e,_0x5798b2,{'cwd':_0x581d9d,'stdio':_0x11e06b(0x12f),'shell':!![],'env':{...process.env,'PATH':''+join(_0x581d9d,_0x11e06b(0x10e),_0x11e06b(0x133))+delimiter+process.env.PATH}});_0x536085['on'](_0x11e06b(0x13d),_0x5f56a8=>{const _0x29fd98=_0x11e06b;if(_0x5f56a8===0x0||_0x5f56a8===null)_0x4bf65e();else _0x4d79fc(new Error(_0x4e8c3e+_0x29fd98(0x131)+_0x4bc823+_0x29fd98(0x123)+_0x5f56a8));}),_0x536085['on'](_0x11e06b(0x10d),_0x4d79fc);});}function spawnViteBuildWatch(_0x4cb820){return new Promise((_0x187685,_0x52732f)=>{const _0x5c5c63=a173_0x2851,_0x1a0531=spawn('vite',[_0x5c5c63(0x111),'--watch'],{'cwd':_0x4cb820,'stdio':_0x5c5c63(0x12f),'shell':!![],'env':{...process.env,'PATH':''+join(_0x4cb820,_0x5c5c63(0x10e),_0x5c5c63(0x133))+delimiter+process.env.PATH}});_0x1a0531['on']('close',_0xdd39b2=>{const _0x2e0892=_0x5c5c63;if(_0xdd39b2===0x0||_0xdd39b2===null)_0x187685();else _0x52732f(new Error(_0x2e0892(0x13c)+_0xdd39b2));}),_0x1a0531['on']('error',_0x52732f);});}function spawnVitePreview(_0x4286f6){return new Promise((_0x3474a2,_0x433f6a)=>{const _0x46b4ad=a173_0x2851,_0xd20587=spawn(_0x46b4ad(0x148),[_0x46b4ad(0x121)],{'cwd':_0x4286f6,'stdio':_0x46b4ad(0x12f),'shell':!![],'env':{...process.env,'PATH':''+join(_0x4286f6,_0x46b4ad(0x10e),_0x46b4ad(0x133))+delimiter+process.env.PATH}});_0xd20587['on']('close',_0x210dc5=>{const _0x549bef=_0x46b4ad;if(_0x210dc5===0x0||_0x210dc5===null)_0x3474a2();else _0x433f6a(new Error(_0x549bef(0x112)+_0x210dc5));}),_0xd20587['on'](_0x46b4ad(0x10d),_0x433f6a);});}const runFlags=[{'name':a173_0x59674f(0x11d),'type':a173_0x59674f(0x146),'description':a173_0x59674f(0x140),'default':![]}];export const runDefinition={'service':'run','command':'run','description':a173_0x59674f(0x117),'risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a173_0x59674f(0x130),'description':a173_0x59674f(0x115),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x545ea0=a173_0x59674f,_0x40eebb=[];return _0x40eebb[_0x545ea0(0x11b)](_0x545ea0(0x13b)),_0x40eebb[_0x545ea0(0x11b)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x545ea0(0x128)),_0x40eebb[_0x545ea0(0x11b)](_0x545ea0(0x142)+CLI_BIN_NAME+_0x545ea0(0x139)),_0x40eebb[_0x545ea0(0x11b)](_0x545ea0(0x142)+CLI_BIN_NAME+_0x545ea0(0x119)),_0x40eebb[_0x545ea0(0x11b)](_0x545ea0(0x142)+CLI_BIN_NAME+_0x545ea0(0x12b)),_0x40eebb[_0x545ea0(0x147)]('\x0a');},async 'execute'(_0x58166c){const _0x22ce28=a173_0x59674f,_0x331f43=process['cwd'](),_0x38e30c=_0x58166c[_0x22ce28(0x120)][0x0],_0x4a218b=_0x58166c[_0x22ce28(0x120)][_0x22ce28(0x141)](0x1),_0x571b19=readPackageScripts(_0x331f43);if(!_0x571b19)throw CliErrors[_0x22ce28(0x144)](_0x22ce28(0x137));if(!_0x38e30c){const _0x3f1e86=Object[_0x22ce28(0x125)](_0x571b19);if(_0x3f1e86[_0x22ce28(0x145)]===0x0)console[_0x22ce28(0x135)](_0x22ce28(0x11c));else{console['log']('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x5c5814 of _0x3f1e86){console[_0x22ce28(0x135)](_0x22ce28(0x142)+_0x5c5814);}console[_0x22ce28(0x135)](_0x22ce28(0x136)+CLI_BIN_NAME+_0x22ce28(0x13f));}return{'ok':!![]};}if(!_0x571b19[_0x38e30c])throw CliErrors[_0x22ce28(0x144)](_0x22ce28(0x10f)+_0x38e30c+_0x22ce28(0x13a),_0x22ce28(0x14a)+(Object[_0x22ce28(0x125)](_0x571b19)[_0x22ce28(0x147)](',\x20')||_0x22ce28(0x12d)));const _0x1a2e1e=detectPackageManager(_0x331f43);VERSION_CHECK_SCRIPTS[_0x22ce28(0x11a)](_0x38e30c)&&await versionCheck(_0x331f43);if(_0x38e30c===_0x22ce28(0x121)&&_0x58166c['bool'](_0x22ce28(0x11d)))return await Promise[_0x22ce28(0x113)]([spawnViteBuildWatch(_0x331f43),spawnVitePreview(_0x331f43)]),{'ok':!![]};return await spawnScript(_0x1a2e1e,_0x38e30c,_0x4a218b,_0x331f43),{'ok':!![]};}};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * rabetbase schema —— 导出与 --help 同源的命令元数据(JSON)
3
+ */
4
+ import type { CommandDefinition } from "../framework/types.js";
5
+ export declare const schemaDefinition: CommandDefinition;
@@ -1 +1 @@
1
- function a182_0x2bb6(_0x1e792e,_0x164f7f){_0x1e792e=_0x1e792e-0x1c0;const _0x238b96=a182_0x238b();let _0x2bb610=_0x238b96[_0x1e792e];return _0x2bb610;}const a182_0x3aae65=a182_0x2bb6;(function(_0x4d195c,_0x1fda32){const _0x2b2c86=a182_0x2bb6,_0x163855=_0x4d195c();while(!![]){try{const _0x19a38a=parseInt(_0x2b2c86(0x1c6))/0x1*(-parseInt(_0x2b2c86(0x1cf))/0x2)+parseInt(_0x2b2c86(0x1ca))/0x3*(parseInt(_0x2b2c86(0x1cd))/0x4)+-parseInt(_0x2b2c86(0x1c1))/0x5+-parseInt(_0x2b2c86(0x1cb))/0x6*(-parseInt(_0x2b2c86(0x1c5))/0x7)+parseInt(_0x2b2c86(0x1c0))/0x8+parseInt(_0x2b2c86(0x1c3))/0x9*(parseInt(_0x2b2c86(0x1d0))/0xa)+-parseInt(_0x2b2c86(0x1c4))/0xb*(parseInt(_0x2b2c86(0x1cc))/0xc);if(_0x19a38a===_0x1fda32)break;else _0x163855['push'](_0x163855['shift']());}catch(_0x35e1e3){_0x163855['push'](_0x163855['shift']());}}}(a182_0x238b,0xdaf50));import{buildSchemaPayload}from'../framework/schema-export.js';function a182_0x238b(){const _0xeeb9f6=['331790HEMRBA','5290760JORNhl','6437505heNdEV','export','441DwzmIK','176Dbfucp','239869AntJyV','25207VSLDdN','read','Export\x20machine-readable\x20command\x20schema\x20(JSON)','schema','232263SsougF','210aUhPbJ','1150776AYXklq','68snhGXE','json','86HRfJzn'];a182_0x238b=function(){return _0xeeb9f6;};return a182_0x238b();}async function execute(_0x2bca3b){const _0x44a5ef=await buildSchemaPayload();return{'ok':!![],'data':_0x44a5ef};}export const schemaDefinition={'service':a182_0x3aae65(0x1c9),'command':a182_0x3aae65(0x1c2),'description':a182_0x3aae65(0x1c8),'risk':a182_0x3aae65(0x1c7),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a182_0x3aae65(0x1ce),'flags':[],'execute':execute};
1
+ const a174_0x23dcf4=a174_0x4289;(function(_0x4c118c,_0x276ec4){const _0x5ac064=a174_0x4289,_0x53a0cc=_0x4c118c();while(!![]){try{const _0x4c7126=parseInt(_0x5ac064(0x124))/0x1+parseInt(_0x5ac064(0x125))/0x2+parseInt(_0x5ac064(0x127))/0x3+-parseInt(_0x5ac064(0x12b))/0x4*(parseInt(_0x5ac064(0x123))/0x5)+parseInt(_0x5ac064(0x11f))/0x6*(parseInt(_0x5ac064(0x128))/0x7)+parseInt(_0x5ac064(0x120))/0x8*(-parseInt(_0x5ac064(0x126))/0x9)+-parseInt(_0x5ac064(0x129))/0xa;if(_0x4c7126===_0x276ec4)break;else _0x53a0cc['push'](_0x53a0cc['shift']());}catch(_0x38eeb2){_0x53a0cc['push'](_0x53a0cc['shift']());}}}(a174_0x23b8,0x51cb6));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x2f061c){const _0x4ff913=await buildSchemaPayload();return{'ok':!![],'data':_0x4ff913};}function a174_0x4289(_0x494351,_0x4dff46){_0x494351=_0x494351-0x11e;const _0x23b866=a174_0x23b8();let _0x4289ad=_0x23b866[_0x494351];return _0x4289ad;}export const schemaDefinition={'service':'schema','command':a174_0x23dcf4(0x12a),'description':a174_0x23dcf4(0x11e),'risk':a174_0x23dcf4(0x122),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a174_0x23dcf4(0x121),'flags':[],'execute':execute};function a174_0x23b8(){const _0x263321=['export','300IVnjKM','Export\x20machine-readable\x20command\x20schema\x20(JSON)','22020IVqwcw','42192YPHTaw','json','read','24010ufPkuq','203885YnNWLN','1337138hscimp','954zhKEFB','1274259tTTTXs','497srWgAa','3035530cvjepf'];a174_0x23b8=function(){return _0x263321;};return a174_0x23b8();}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * sql create —— 声明式命令:创建新的本地自定义 SQL 资产
3
+ *
4
+ * 说明:
5
+ * - 当前阶段不支持完全离线创建
6
+ * - 会先调用远端创建 SQL,拿到服务端生成的 sqlCode
7
+ * - 再落本地文件与 sql.lock.json
8
+ */
9
+ import type { CommandDefinition } from "../../framework/types.js";
10
+ export declare const sqlCreate: CommandDefinition;
@@ -1 +1 @@
1
- const a183_0x373880=a183_0x568a;(function(_0x15ce12,_0x119e28){const _0x1e82a1=a183_0x568a,_0x542c17=_0x15ce12();while(!![]){try{const _0x59bb4d=-parseInt(_0x1e82a1(0xdd))/0x1+-parseInt(_0x1e82a1(0xc9))/0x2*(-parseInt(_0x1e82a1(0xbe))/0x3)+-parseInt(_0x1e82a1(0xd1))/0x4*(parseInt(_0x1e82a1(0xe2))/0x5)+-parseInt(_0x1e82a1(0xd3))/0x6+parseInt(_0x1e82a1(0xf1))/0x7*(-parseInt(_0x1e82a1(0xf5))/0x8)+parseInt(_0x1e82a1(0xe4))/0x9+-parseInt(_0x1e82a1(0xb4))/0xa*(-parseInt(_0x1e82a1(0xbf))/0xb);if(_0x59bb4d===_0x119e28)break;else _0x542c17['push'](_0x542c17['shift']());}catch(_0x1a8a0c){_0x542c17['push'](_0x542c17['shift']());}}}(a183_0x53aa,0x1ce60));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a183_0x568a(_0x27f783,_0x290823){_0x27f783=_0x27f783-0xb1;const _0x53aaea=a183_0x53aa();let _0x568a7e=_0x53aaea[_0x27f783];return _0x568a7e;}import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function a183_0x53aa(){const _0x5cd5d7=['SQL\x20query\x20display\x20name','create','请选择目标数据库:','Created\x20SQL\x20query\x20','普通\x20SQL(sql)','dbId\x20不能为空','56UjJTAt','isInteger','556296jRiDxr','Target\x20database\x20ID','__manual__','trim','join','适合带动态标签的\x20MyBatis\x20XML\x20SQL','new','stringify','\x20\x20SELECT\x201\x20AS\x20id','validation','129416DZusaf','mode','string','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','mybatisXml','63955EuXOuG','<server-generated-sqlCode>','564300wgpKyj','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','请选择本地\x20SQL\x20模式:','nonInteractive','name','sqlRootDir','appCode','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','high-risk-write','Invalid\x20database\x20selection\x20payload:\x20','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','isFinite','map','14ieWFlW','sqlCode','number','parse','57584PiLVeq','请输入目标数据库\x20dbId:','/smartapi/custom/saveUserCustomSql','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','4502890yegsJw','Local\x20SQL\x20file\x20mode','catch','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','lockFilePath','flag','SQL\x20名称不能为空','sqlName','POST','sql','3FMVpOK','11epxqlg','toISOString','flagMissing','✎\x20手动输入\x20dbId','dbName','db-id','请输入\x20SQL\x20名称:','length','str','dbId','41962TOoXjj','description'];a183_0x53aa=function(){return _0x5cd5d7;};return a183_0x53aa();}function generateSqlTemplate(_0x4e4e5f){const _0x51f809=a183_0x568a;if(_0x4e4e5f==='mybatisXml')return[_0x51f809(0xeb),_0x51f809(0xdb),'</select>','']['join']('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x51f809(0xd7)]('\x0a');}export const sqlCreate={'service':'sql','command':a183_0x373880(0xcc),'description':a183_0x373880(0xe5),'risk':a183_0x373880(0xec),'flags':[{'name':'name','type':a183_0x373880(0xdf),'description':a183_0x373880(0xcb)},{'name':a183_0x373880(0xc4),'type':a183_0x373880(0xf3),'description':a183_0x373880(0xd4)},{'name':a183_0x373880(0xde),'type':a183_0x373880(0xdf),'enum':[a183_0x373880(0xbd),a183_0x373880(0xe1)],'description':a183_0x373880(0xb5)}],async 'validate'(_0x5bf12f){const _0x252002=a183_0x373880;if(!_0x5bf12f['nonInteractive'])return;if(!_0x5bf12f[_0x252002(0xc7)]('name')[_0x252002(0xd6)]())throw CliErrors['flagMissing'](_0x252002(0xe8),_0x252002(0xe0));const _0x1bff76=resolveProvidedDbId(_0x5bf12f);if(typeof _0x1bff76!==_0x252002(0xf3)||!Number[_0x252002(0xef)](_0x1bff76)||_0x1bff76<=0x0)throw CliErrors['flagMissing'](_0x252002(0xc4),_0x252002(0xb3));if(!_0x5bf12f[_0x252002(0xc7)](_0x252002(0xde))[_0x252002(0xd6)]())throw CliErrors[_0x252002(0xc1)](_0x252002(0xde),_0x252002(0xb7));},async 'dryRun'(_0xebde2c){const _0x11b8e0=a183_0x373880,_0x389d85=loadSqlProjectConfig(_0xebde2c[_0x11b8e0(0xea)]),{sqlName:_0x46ac1b,dbId:_0x333fd0,dbName:_0x331c43,mode:_0xfdea48}=await resolveSqlNewInputs(_0xebde2c),_0x2d9a8b=buildSqlRelativePath(_0x11b8e0(0xe3),_0x46ac1b,_0x331c43,_0xfdea48,_0x333fd0),_0x15bf44=_0x389d85['sqlRootDir']+'/'+_0x2d9a8b;return{'method':_0x11b8e0(0xbc),'url':_0x11b8e0(0xb2),'body':{'appCode':_0xebde2c[_0x11b8e0(0xea)],'sqlName':_0x46ac1b,'dbId':_0x333fd0,'mode':_0xfdea48,'localPath':_0x15bf44},'description':_0x11b8e0(0xee)+_0x389d85[_0x11b8e0(0xe9)]};},async 'execute'(_0x5a62df){const _0x28ece5=a183_0x373880,_0x4890a8=loadSqlProjectConfig(_0x5a62df[_0x28ece5(0xea)]),{sqlName:_0x4eb12b,dbId:_0x33ec5f,dbName:_0x128ecf,mode:_0x4ad584}=await resolveSqlNewInputs(_0x5a62df),_0x2625e8=generateSqlTemplate(_0x4ad584),_0x1fd3a6=await createSqlQuery({'appCode':_0x5a62df[_0x28ece5(0xea)],'sqlName':_0x4eb12b,'dbId':_0x33ec5f,'sqlContent':_0x2625e8}),_0x2df91f=ensureRemoteSqlContent(_0x1fd3a6),_0x51a636=_0x128ecf||await getDbName(_0x5a62df[_0x28ece5(0xea)],_0x33ec5f)[_0x28ece5(0xb6)](()=>undefined),_0x4a307b=buildSqlRelativePath(_0x1fd3a6[_0x28ece5(0xf2)],_0x1fd3a6[_0x28ece5(0xbb)],_0x51a636,_0x4ad584,_0x33ec5f),_0xd2b6aa=_0x4890a8['sqlRootDir']+'/'+_0x4a307b,_0x5ca069=buildLocalSqlFileContent({'sqlCode':_0x1fd3a6[_0x28ece5(0xf2)],'sqlName':_0x1fd3a6[_0x28ece5(0xbb)],'dbId':_0x1fd3a6[_0x28ece5(0xc8)]},_0x2df91f,{'dbName':_0x51a636,'mode':_0x4ad584,'syncedAt':new Date()[_0x28ece5(0xc0)](),'description':_0x1fd3a6[_0x28ece5(0xca)]});if(await fileExists(_0xd2b6aa))throw CliErrors[_0x28ece5(0xdc)]('File\x20already\x20exists:\x20'+_0xd2b6aa);await ensureParentDirectory(_0xd2b6aa),await writeFile(_0xd2b6aa,_0x5ca069,'utf8');const _0x42525e=await readSqlLockFile(_0x4890a8['lockFilePath']),{lockData:_0x4b9a2c,appLock:_0x4c558f}=ensureSqlLockScope(_0x42525e??createEmptySqlLock(),_0x4890a8['appCode'],_0x4890a8['sqlRoot'],_0x28ece5(0xd9));return _0x4c558f['sqls'][_0x1fd3a6['sqlCode']]={...buildSqlLockEntry(_0x1fd3a6,_0x2df91f,computeSqlContentHash(_0x5ca069),{'dbName':_0x51a636}),'path':_0x4a307b,'mode':_0x4ad584},_0x4c558f['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x4890a8[_0x28ece5(0xb8)],_0x4b9a2c),{'ok':!![],'data':{'id':_0x1fd3a6['id'],'sqlCode':_0x1fd3a6[_0x28ece5(0xf2)],'sqlName':_0x1fd3a6[_0x28ece5(0xbb)],'dbId':_0x1fd3a6['dbId'],'path':_0xd2b6aa,'mode':_0x4ad584},'message':_0x28ece5(0xce)+_0x1fd3a6[_0x28ece5(0xf2)]};}};async function resolveSqlNewInputs(_0x23007d){const _0x655c33=await resolveSqlNameInput(_0x23007d),{dbId:_0x375020,dbName:_0x3ef684}=await resolveDbSelection(_0x23007d),_0x6830c1=await resolveSqlModeInput(_0x23007d);return{'sqlName':_0x655c33,'dbId':_0x375020,'dbName':_0x3ef684,'mode':_0x6830c1};}async function resolveSqlNameInput(_0xa69dd5){const _0xdaa0f4=a183_0x373880,_0x8d3fda=_0xa69dd5[_0xdaa0f4(0xc7)](_0xdaa0f4(0xe8))[_0xdaa0f4(0xd6)]();if(_0x8d3fda)return _0x8d3fda;if(_0xa69dd5[_0xdaa0f4(0xe7)])throw CliErrors[_0xdaa0f4(0xc1)](_0xdaa0f4(0xe8),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');return(await input({'message':_0xdaa0f4(0xc5),'validate':_0x3d49f2=>_0x3d49f2[_0xdaa0f4(0xd6)]()?!![]:_0xdaa0f4(0xba)}))['trim']();}async function resolveDbSelection(_0x118f4c){const _0x348643=a183_0x373880,_0x5764f7=resolveProvidedDbId(_0x118f4c);if(typeof _0x5764f7===_0x348643(0xf3)&&Number[_0x348643(0xef)](_0x5764f7)&&_0x5764f7>0x0)return{'dbId':_0x5764f7,'dbName':await getDbName(_0x118f4c[_0x348643(0xea)],_0x5764f7)[_0x348643(0xb6)](()=>undefined)};if(_0x118f4c['nonInteractive'])throw CliErrors[_0x348643(0xc1)](_0x348643(0xc4),_0x348643(0xb3));const _0x3619ec=await listDatabases(_0x118f4c['appCode'])[_0x348643(0xb6)](()=>[]);if(_0x3619ec[_0x348643(0xc6)]===0x1)return{'dbId':_0x3619ec[0x0][_0x348643(0xc8)],'dbName':_0x3619ec[0x0]['dbName']};if(_0x3619ec[_0x348643(0xc6)]>0x1){const _0x27c866=await select({'message':_0x348643(0xcd),'choices':[..._0x3619ec[_0x348643(0xf0)](_0x674670=>({'name':_0x674670['dbName']+'\x20('+_0x674670['dbId']+')','value':serializeDbSelection(_0x674670)})),{'name':_0x348643(0xc2),'value':_0x348643(0xd5)}]});if(_0x27c866!==_0x348643(0xd5))return deserializeDbSelection(_0x27c866);}const _0x44cd28=await input({'message':_0x348643(0xb1),'validate':_0x2e5b6a=>{const _0x3a9d81=_0x348643,_0x33c56b=_0x2e5b6a['trim']();if(!_0x33c56b)return _0x3a9d81(0xd0);const _0x36c5dd=Number(_0x33c56b);if(!Number[_0x3a9d81(0xd2)](_0x36c5dd)||_0x36c5dd<=0x0)return'dbId\x20必须为正整数';return!![];}});return{'dbId':Number(_0x44cd28[_0x348643(0xd6)]())};}async function resolveSqlModeInput(_0x5bfd9b){const _0x52af7a=a183_0x373880,_0x2fbaa2=_0x5bfd9b[_0x52af7a(0xc7)](_0x52af7a(0xde))['trim']();if(_0x2fbaa2===_0x52af7a(0xbd)||_0x2fbaa2===_0x52af7a(0xe1))return _0x2fbaa2;if(_0x5bfd9b[_0x52af7a(0xe7)])throw CliErrors[_0x52af7a(0xc1)](_0x52af7a(0xde),_0x52af7a(0xb7));return await select({'message':_0x52af7a(0xe6),'choices':[{'name':_0x52af7a(0xcf),'value':'sql','description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':'MyBatis\x20XML(mybatisXml)','value':_0x52af7a(0xe1),'description':_0x52af7a(0xd8)}]});}function serializeDbSelection(_0x22437e){const _0x5c3e2d=a183_0x373880;return JSON[_0x5c3e2d(0xda)]({'dbId':_0x22437e[_0x5c3e2d(0xc8)],'dbName':_0x22437e[_0x5c3e2d(0xc3)]});}function deserializeDbSelection(_0x4e2c40){const _0x14a863=a183_0x373880;try{const _0x14142d=JSON[_0x14a863(0xf4)](_0x4e2c40);if(typeof _0x14142d[_0x14a863(0xc8)]===_0x14a863(0xf3)&&Number['isFinite'](_0x14142d[_0x14a863(0xc8)]))return{'dbId':_0x14142d[_0x14a863(0xc8)],'dbName':_0x14142d[_0x14a863(0xc3)]};}catch{}throw CliErrors['validation'](_0x14a863(0xed)+_0x4e2c40);}function resolveProvidedDbId(_0x1d99c0){const _0x2dcf1c=a183_0x373880,_0x465d14=_0x1d99c0[_0x2dcf1c(0xb9)](_0x2dcf1c(0xc4));if(typeof _0x465d14===_0x2dcf1c(0xf3)&&Number[_0x2dcf1c(0xef)](_0x465d14))return _0x465d14;return undefined;}
1
+ const a175_0x105ec5=a175_0x42a3;(function(_0x2fb0a1,_0x56c037){const _0x2a3bc9=a175_0x42a3,_0x457041=_0x2fb0a1();while(!![]){try{const _0x24ffbf=parseInt(_0x2a3bc9(0x16b))/0x1+-parseInt(_0x2a3bc9(0x15c))/0x2*(-parseInt(_0x2a3bc9(0x179))/0x3)+-parseInt(_0x2a3bc9(0x159))/0x4*(parseInt(_0x2a3bc9(0x198))/0x5)+-parseInt(_0x2a3bc9(0x17f))/0x6+parseInt(_0x2a3bc9(0x15f))/0x7+parseInt(_0x2a3bc9(0x190))/0x8+parseInt(_0x2a3bc9(0x17c))/0x9*(parseInt(_0x2a3bc9(0x182))/0xa);if(_0x24ffbf===_0x56c037)break;else _0x457041['push'](_0x457041['shift']());}catch(_0x349293){_0x457041['push'](_0x457041['shift']());}}}(a175_0x1b20,0x3c57a));import{writeFile}from'node:fs/promises';function a175_0x42a3(_0x15e469,_0xba7355){_0x15e469=_0x15e469-0x152;const _0x1b201d=a175_0x1b20();let _0x42a392=_0x1b201d[_0x15e469];return _0x42a392;}import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x1456e5){const _0x536bde=a175_0x42a3;if(_0x1456e5==='mybatisXml')return[_0x536bde(0x16c),'\x20\x20SELECT\x201\x20AS\x20id',_0x536bde(0x18a),''][_0x536bde(0x165)]('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x536bde(0x165)]('\x0a');}function a175_0x1b20(){const _0x37ef61=['738360WrMrSn','mybatisXml','string','732130gDGdvY','number','isInteger','trim','description','dbId','Target\x20database\x20ID','flag','</select>','Created\x20SQL\x20query\x20','appCode','Local\x20SQL\x20file\x20mode','Invalid\x20database\x20selection\x20payload:\x20','SQL\x20query\x20display\x20name','884400YIapNX','dbName','toISOString','POST','parse','write','请输入目标数据库\x20dbId:','mode','639335eodmQp','str','sqlRoot','map','new','__manual__','utf8','File\x20already\x20exists:\x20','8kGVMoT','SQL\x20名称不能为空','/smartapi/custom/saveUserCustomSql','8VuhAed','MyBatis\x20XML(mybatisXml)','dbId\x20必须为正整数','312298sTBbcY','nonInteractive','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','<server-generated-sqlCode>','sqls','name','join','db-id','lastSync','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','sqlCode','请输入\x20SQL\x20名称:','196415Fihllh','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','适合带动态标签的\x20MyBatis\x20XML\x20SQL','sqlRootDir','validation','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','isFinite','catch','create','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','普通\x20SQL(sql)','sql','stringify','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','150873ulbLne','flagMissing','sqlName','9rbSTOd','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','lockFilePath'];a175_0x1b20=function(){return _0x37ef61;};return a175_0x1b20();}export const sqlCreate={'service':a175_0x105ec5(0x176),'command':a175_0x105ec5(0x173),'description':a175_0x105ec5(0x161),'risk':a175_0x105ec5(0x195),'flags':[{'name':a175_0x105ec5(0x164),'type':a175_0x105ec5(0x181),'description':a175_0x105ec5(0x18f)},{'name':'db-id','type':a175_0x105ec5(0x183),'description':a175_0x105ec5(0x188)},{'name':a175_0x105ec5(0x197),'type':a175_0x105ec5(0x181),'enum':[a175_0x105ec5(0x176),a175_0x105ec5(0x180)],'description':a175_0x105ec5(0x18d)}],async 'validate'(_0x5a200d){const _0x2c3972=a175_0x105ec5;if(!_0x5a200d[_0x2c3972(0x160)])return;if(!_0x5a200d[_0x2c3972(0x152)](_0x2c3972(0x164))[_0x2c3972(0x185)]())throw CliErrors[_0x2c3972(0x17a)](_0x2c3972(0x164),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x321d1b=resolveProvidedDbId(_0x5a200d);if(typeof _0x321d1b!=='number'||!Number[_0x2c3972(0x171)](_0x321d1b)||_0x321d1b<=0x0)throw CliErrors[_0x2c3972(0x17a)](_0x2c3972(0x166),_0x2c3972(0x168));if(!_0x5a200d[_0x2c3972(0x152)](_0x2c3972(0x197))[_0x2c3972(0x185)]())throw CliErrors['flagMissing']('mode',_0x2c3972(0x178));},async 'dryRun'(_0x12179f){const _0x2a3767=a175_0x105ec5,_0x3e1037=loadSqlProjectConfig(_0x12179f[_0x2a3767(0x18c)]),{sqlName:_0x312c34,dbId:_0x9b374d,dbName:_0x47601f,mode:_0x2ad002}=await resolveSqlNewInputs(_0x12179f),_0x520609=buildSqlRelativePath(_0x2a3767(0x162),_0x312c34,_0x47601f,_0x2ad002,_0x9b374d),_0x4e8d94=_0x3e1037[_0x2a3767(0x16e)]+'/'+_0x520609;return{'method':_0x2a3767(0x193),'url':_0x2a3767(0x15b),'body':{'appCode':_0x12179f[_0x2a3767(0x18c)],'sqlName':_0x312c34,'dbId':_0x9b374d,'mode':_0x2ad002,'localPath':_0x4e8d94},'description':_0x2a3767(0x17d)+_0x3e1037[_0x2a3767(0x16e)]};},async 'execute'(_0x181173){const _0x6fae43=a175_0x105ec5,_0x53952f=loadSqlProjectConfig(_0x181173[_0x6fae43(0x18c)]),{sqlName:_0x475929,dbId:_0x3f6365,dbName:_0x1f9b14,mode:_0x460555}=await resolveSqlNewInputs(_0x181173),_0x144237=generateSqlTemplate(_0x460555),_0x496705=await createSqlQuery({'appCode':_0x181173['appCode'],'sqlName':_0x475929,'dbId':_0x3f6365,'sqlContent':_0x144237}),_0x5e205d=ensureRemoteSqlContent(_0x496705),_0x2c3630=_0x1f9b14||await getDbName(_0x181173[_0x6fae43(0x18c)],_0x3f6365)[_0x6fae43(0x172)](()=>undefined),_0x5e2b89=buildSqlRelativePath(_0x496705[_0x6fae43(0x169)],_0x496705[_0x6fae43(0x17b)],_0x2c3630,_0x460555,_0x3f6365),_0x41d2dd=_0x53952f['sqlRootDir']+'/'+_0x5e2b89,_0x5510ec=buildLocalSqlFileContent({'sqlCode':_0x496705[_0x6fae43(0x169)],'sqlName':_0x496705[_0x6fae43(0x17b)],'dbId':_0x496705[_0x6fae43(0x187)]},_0x5e205d,{'dbName':_0x2c3630,'mode':_0x460555,'syncedAt':new Date()[_0x6fae43(0x192)](),'description':_0x496705[_0x6fae43(0x186)]});if(await fileExists(_0x41d2dd))throw CliErrors[_0x6fae43(0x16f)](_0x6fae43(0x158)+_0x41d2dd);await ensureParentDirectory(_0x41d2dd),await writeFile(_0x41d2dd,_0x5510ec,_0x6fae43(0x157));const _0x428ea4=await readSqlLockFile(_0x53952f[_0x6fae43(0x17e)]),{lockData:_0x2a7016,appLock:_0x18a05b}=ensureSqlLockScope(_0x428ea4??createEmptySqlLock(),_0x53952f[_0x6fae43(0x18c)],_0x53952f[_0x6fae43(0x153)],_0x6fae43(0x155));return _0x18a05b[_0x6fae43(0x163)][_0x496705[_0x6fae43(0x169)]]={...buildSqlLockEntry(_0x496705,_0x5e205d,computeSqlContentHash(_0x5510ec),{'dbName':_0x2c3630}),'path':_0x5e2b89,'mode':_0x460555},_0x18a05b[_0x6fae43(0x167)]=new Date()[_0x6fae43(0x192)](),await writeSqlLockFile(_0x53952f[_0x6fae43(0x17e)],_0x2a7016),{'ok':!![],'data':{'id':_0x496705['id'],'sqlCode':_0x496705['sqlCode'],'sqlName':_0x496705[_0x6fae43(0x17b)],'dbId':_0x496705[_0x6fae43(0x187)],'path':_0x41d2dd,'mode':_0x460555},'message':_0x6fae43(0x18b)+_0x496705[_0x6fae43(0x169)]};}};async function resolveSqlNewInputs(_0x28f230){const _0x229b28=await resolveSqlNameInput(_0x28f230),{dbId:_0x1b0af5,dbName:_0x1af002}=await resolveDbSelection(_0x28f230),_0x499cf1=await resolveSqlModeInput(_0x28f230);return{'sqlName':_0x229b28,'dbId':_0x1b0af5,'dbName':_0x1af002,'mode':_0x499cf1};}async function resolveSqlNameInput(_0x484b8b){const _0x1403dd=a175_0x105ec5,_0x5eaa61=_0x484b8b['str'](_0x1403dd(0x164))[_0x1403dd(0x185)]();if(_0x5eaa61)return _0x5eaa61;if(_0x484b8b['nonInteractive'])throw CliErrors[_0x1403dd(0x17a)](_0x1403dd(0x164),_0x1403dd(0x170));return(await input({'message':_0x1403dd(0x16a),'validate':_0x371c52=>_0x371c52[_0x1403dd(0x185)]()?!![]:_0x1403dd(0x15a)}))[_0x1403dd(0x185)]();}async function resolveDbSelection(_0x4d16bb){const _0x192533=a175_0x105ec5,_0x1bb6f7=resolveProvidedDbId(_0x4d16bb);if(typeof _0x1bb6f7===_0x192533(0x183)&&Number[_0x192533(0x171)](_0x1bb6f7)&&_0x1bb6f7>0x0)return{'dbId':_0x1bb6f7,'dbName':await getDbName(_0x4d16bb[_0x192533(0x18c)],_0x1bb6f7)['catch'](()=>undefined)};if(_0x4d16bb[_0x192533(0x160)])throw CliErrors['flagMissing'](_0x192533(0x166),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x4728bf=await listDatabases(_0x4d16bb['appCode'])[_0x192533(0x172)](()=>[]);if(_0x4728bf['length']===0x1)return{'dbId':_0x4728bf[0x0][_0x192533(0x187)],'dbName':_0x4728bf[0x0]['dbName']};if(_0x4728bf['length']>0x1){const _0x402896=await select({'message':'请选择目标数据库:','choices':[..._0x4728bf[_0x192533(0x154)](_0x17fd4d=>({'name':_0x17fd4d[_0x192533(0x191)]+'\x20('+_0x17fd4d[_0x192533(0x187)]+')','value':serializeDbSelection(_0x17fd4d)})),{'name':'✎\x20手动输入\x20dbId','value':_0x192533(0x156)}]});if(_0x402896!==_0x192533(0x156))return deserializeDbSelection(_0x402896);}const _0x30f977=await input({'message':_0x192533(0x196),'validate':_0xb7257e=>{const _0x25a5ba=_0x192533,_0x1227f8=_0xb7257e[_0x25a5ba(0x185)]();if(!_0x1227f8)return'dbId\x20不能为空';const _0x3d9e7d=Number(_0x1227f8);if(!Number[_0x25a5ba(0x184)](_0x3d9e7d)||_0x3d9e7d<=0x0)return _0x25a5ba(0x15e);return!![];}});return{'dbId':Number(_0x30f977[_0x192533(0x185)]())};}async function resolveSqlModeInput(_0x1685b2){const _0x3f9320=a175_0x105ec5,_0x285141=_0x1685b2['str']('mode')[_0x3f9320(0x185)]();if(_0x285141===_0x3f9320(0x176)||_0x285141===_0x3f9320(0x180))return _0x285141;if(_0x1685b2[_0x3f9320(0x160)])throw CliErrors[_0x3f9320(0x17a)](_0x3f9320(0x197),_0x3f9320(0x178));return await select({'message':'请选择本地\x20SQL\x20模式:','choices':[{'name':_0x3f9320(0x175),'value':_0x3f9320(0x176),'description':_0x3f9320(0x174)},{'name':_0x3f9320(0x15d),'value':'mybatisXml','description':_0x3f9320(0x16d)}]});}function serializeDbSelection(_0x3b69e2){const _0x269fcf=a175_0x105ec5;return JSON[_0x269fcf(0x177)]({'dbId':_0x3b69e2['dbId'],'dbName':_0x3b69e2[_0x269fcf(0x191)]});}function deserializeDbSelection(_0xe08323){const _0x4cd6a7=a175_0x105ec5;try{const _0x273f95=JSON[_0x4cd6a7(0x194)](_0xe08323);if(typeof _0x273f95[_0x4cd6a7(0x187)]==='number'&&Number['isFinite'](_0x273f95[_0x4cd6a7(0x187)]))return{'dbId':_0x273f95[_0x4cd6a7(0x187)],'dbName':_0x273f95[_0x4cd6a7(0x191)]};}catch{}throw CliErrors[_0x4cd6a7(0x16f)](_0x4cd6a7(0x18e)+_0xe08323);}function resolveProvidedDbId(_0x1c70f2){const _0x1513f9=a175_0x105ec5,_0x4f5406=_0x1c70f2[_0x1513f9(0x189)](_0x1513f9(0x166));if(typeof _0x4f5406===_0x1513f9(0x183)&&Number[_0x1513f9(0x171)](_0x4f5406))return _0x4f5406;return undefined;}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * sql delete —— 声明式命令:删除远端 SQL 并清理本地文件
3
+ */
4
+ import type { CommandDefinition } from "../../framework/types.js";
5
+ export declare const sqlDelete: CommandDefinition;
@@ -1 +1 @@
1
- const a184_0xd07327=a184_0x4dd2;(function(_0x18fb2b,_0xec9754){const _0x535ad2=a184_0x4dd2,_0x165ef3=_0x18fb2b();while(!![]){try{const _0x58c28e=-parseInt(_0x535ad2(0x10c))/0x1+parseInt(_0x535ad2(0xff))/0x2*(-parseInt(_0x535ad2(0x11b))/0x3)+-parseInt(_0x535ad2(0x105))/0x4*(parseInt(_0x535ad2(0x116))/0x5)+parseInt(_0x535ad2(0x100))/0x6+parseInt(_0x535ad2(0xf8))/0x7+-parseInt(_0x535ad2(0x114))/0x8*(-parseInt(_0x535ad2(0x119))/0x9)+parseInt(_0x535ad2(0xfa))/0xa;if(_0x58c28e===_0xec9754)break;else _0x165ef3['push'](_0x165ef3['shift']());}catch(_0x3a013a){_0x165ef3['push'](_0x165ef3['shift']());}}}(a184_0x3f41,0x210df));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a184_0xd07327(0x102),'command':a184_0xd07327(0x117),'description':a184_0xd07327(0x106),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x385f87){const _0x1aeb65=a184_0xd07327,_0x269983=loadSqlProjectConfig(_0x385f87[_0x1aeb65(0x10f)]),_0x220381=await readSqlLockFile(_0x269983[_0x1aeb65(0x112)]);if(!_0x220381)throw CliErrors[_0x1aeb65(0x115)](_0x1aeb65(0x101));},async 'dryRun'(_0x423cf9){const _0x1e01c5=a184_0xd07327,_0x3ee0d=loadSqlProjectConfig(_0x423cf9[_0x1e01c5(0x10f)]),_0x330e37=await readSqlLockFile(_0x3ee0d[_0x1e01c5(0x112)]);if(!_0x330e37)throw CliErrors[_0x1e01c5(0x115)](_0x1e01c5(0x101));const {appLock:_0x752c4e}=ensureSqlLockScope(_0x330e37,_0x423cf9[_0x1e01c5(0x10f)],_0x3ee0d[_0x1e01c5(0xf4)],_0x1e01c5(0x117)),_0x876e18=_0x423cf9[_0x1e01c5(0xfc)]('sqlcode'),_0x3d0352=_0x752c4e[_0x1e01c5(0xfd)][_0x876e18];if(!_0x3d0352)throw CliErrors[_0x1e01c5(0x115)](_0x1e01c5(0x118)+_0x876e18+'\x22.');return{'method':_0x1e01c5(0x108),'url':_0x1e01c5(0x10d),'body':{'sqlCode':_0x876e18,'id':_0x3d0352[_0x1e01c5(0x11a)],'localPath':resolveLocalSqlFilePath(_0x3ee0d,_0x876e18,_0x3d0352)},'description':_0x1e01c5(0x103)+_0x876e18+_0x1e01c5(0xfb)+_0x3ee0d[_0x1e01c5(0x11d)]};},async 'execute'(_0x505595){const _0x2e401f=a184_0xd07327,_0x1acd6=loadSqlProjectConfig(_0x505595[_0x2e401f(0x10f)]),_0x112f56=await readSqlLockFile(_0x1acd6['lockFilePath']);if(!_0x112f56)throw CliErrors[_0x2e401f(0x115)](_0x2e401f(0x10e));const {lockData:_0x2b1408,appLock:_0x1b05f6}=ensureSqlLockScope(_0x112f56,_0x505595[_0x2e401f(0x10f)],_0x1acd6[_0x2e401f(0xf4)],'delete'),_0x42a3e7=_0x505595[_0x2e401f(0xfc)](_0x2e401f(0x10b)),_0x3c1378=_0x1b05f6['sqls'][_0x42a3e7];if(!_0x3c1378)throw CliErrors[_0x2e401f(0x115)](_0x2e401f(0x118)+_0x42a3e7+'\x22.');await deleteSqlQuery({'id':_0x3c1378[_0x2e401f(0x11a)],'sqlCode':_0x42a3e7}),_0x1b05f6['sqls']=Object[_0x2e401f(0xf7)](Object[_0x2e401f(0x109)](_0x1b05f6[_0x2e401f(0xfd)])[_0x2e401f(0x104)](([_0x229763])=>_0x229763!==_0x42a3e7)),_0x1b05f6[_0x2e401f(0x107)]=new Date()[_0x2e401f(0x110)](),await writeSqlLockFile(_0x1acd6[_0x2e401f(0x112)],_0x2b1408);const _0xa873ef=resolveLocalSqlFilePath(_0x1acd6,_0x42a3e7,_0x3c1378);let _0x4a1052;await fileExists(_0xa873ef)&&(_0x4a1052=await moveToTrash(_0x1acd6[_0x2e401f(0x11c)],_0x1acd6[_0x2e401f(0x11d)],_0xa873ef),await cleanupEmptyDirectories(dirname(_0xa873ef),_0x1acd6[_0x2e401f(0xf5)]));const _0x28cbf6={'deleted':_0x42a3e7,'remoteId':_0x3c1378[_0x2e401f(0x11a)]};if(_0x4a1052)_0x28cbf6[_0x2e401f(0x113)]=_0x4a1052;return{'ok':!![],'data':_0x28cbf6,'message':_0x2e401f(0xfe)+_0x42a3e7+(_0x4a1052?_0x2e401f(0xf9):'')};}};async function moveToTrash(_0x1a668d,_0x3d6388,_0x3fad6c){const _0xf62b25=a184_0xd07327,_0x4036a7=new Date()[_0xf62b25(0x110)]()[_0xf62b25(0x111)](/[:.]/g,'-'),_0x361833=relative(_0x1a668d,_0x3fad6c),_0x4ce0a0=join(_0x3d6388,_0x4036a7,_0x361833);return await mkdir(dirname(_0x4ce0a0),{'recursive':!![]}),await rename(_0x3fad6c,_0x4ce0a0),_0x4ce0a0;}function a184_0x3f41(){const _0x1ecd3c=['delete','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','4473FlwlyN','remoteId','93NMmGFL','projectRoot','trashDir','sqlRoot','sqlRootDir','length','fromEntries','811657nbVPkb','\x20(local\x20file\x20moved\x20to\x20trash)','5076700rRdkrd','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','str','sqls','Deleted\x20','16402HlDdIx','1593330AJsImy','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','sql','Would\x20delete\x20SQL\x20','filter','48QFyfWZ','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','lastSync','POST','entries','startsWith','sqlcode','258935gyIojo','/smartapi/custom/deleteUserCustomSql','SQL\x20lock\x20file\x20not\x20found.','appCode','toISOString','replace','lockFilePath','trashedTo','8wBRCWp','validation','100465XgqOLr'];a184_0x3f41=function(){return _0x1ecd3c;};return a184_0x3f41();}function a184_0x4dd2(_0x533094,_0x5e7619){_0x533094=_0x533094-0xf4;const _0x3f410b=a184_0x3f41();let _0x4dd2ad=_0x3f410b[_0x533094];return _0x4dd2ad;}async function cleanupEmptyDirectories(_0x2ccbe2,_0x28d667){const _0x565fec=a184_0xd07327;let _0x3e452d=resolve(_0x2ccbe2);const _0xcd7509=resolve(_0x28d667);while(_0x3e452d[_0x565fec(0x10a)](''+_0xcd7509+sep)||_0x3e452d===_0xcd7509){if(_0x3e452d===_0xcd7509)return;try{const _0x14f4f1=await readdir(_0x3e452d);if(_0x14f4f1[_0x565fec(0xf6)]>0x0)return;await rmdir(_0x3e452d);}catch{return;}_0x3e452d=dirname(_0x3e452d);}}
1
+ const a176_0x239e45=a176_0x10af;(function(_0xdb3b46,_0x51e2c1){const _0x3e359e=a176_0x10af,_0x3bf74b=_0xdb3b46();while(!![]){try{const _0x2889be=-parseInt(_0x3e359e(0x14c))/0x1*(parseInt(_0x3e359e(0x152))/0x2)+-parseInt(_0x3e359e(0x149))/0x3*(parseInt(_0x3e359e(0x142))/0x4)+parseInt(_0x3e359e(0x143))/0x5*(-parseInt(_0x3e359e(0x140))/0x6)+parseInt(_0x3e359e(0x15b))/0x7+-parseInt(_0x3e359e(0x145))/0x8+-parseInt(_0x3e359e(0x147))/0x9*(parseInt(_0x3e359e(0x156))/0xa)+parseInt(_0x3e359e(0x153))/0xb*(parseInt(_0x3e359e(0x148))/0xc);if(_0x2889be===_0x51e2c1)break;else _0x3bf74b['push'](_0x3bf74b['shift']());}catch(_0x311a08){_0x3bf74b['push'](_0x3bf74b['shift']());}}}(a176_0x5831,0x9618f));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a176_0x5831(){const _0x3df66a=['str','remoteId','3176240ksAePK','Deleted\x20','trashedTo','length','sqlcode','3105410iDSmrb','validation','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','Would\x20delete\x20SQL\x20','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','trashDir','\x20(local\x20file\x20moved\x20to\x20trash)','POST','appCode','replace','1706472gfNnLk','sql','4707068cFJuXI','15iXkvDq','delete','6808464ovcgvn','sqlRoot','27onteIK','384wDnYbi','3aDzilQ','/smartapi/custom/deleteUserCustomSql','lockFilePath','19605dslnTm','sqls','lastSync','projectRoot','toISOString','SQL\x20lock\x20file\x20not\x20found.','84kgqSzr','1659801RrjdoX'];a176_0x5831=function(){return _0x3df66a;};return a176_0x5831();}import{fileExists}from'../../core/bff/file-system.js';function a176_0x10af(_0x86fd24,_0x6caba6){_0x86fd24=_0x86fd24-0x13f;const _0x583171=a176_0x5831();let _0x10afeb=_0x583171[_0x86fd24];return _0x10afeb;}import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a176_0x239e45(0x141),'command':a176_0x239e45(0x144),'description':a176_0x239e45(0x15d),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x30bf74){const _0x1baf39=a176_0x239e45,_0x1902d1=loadSqlProjectConfig(_0x30bf74[_0x1baf39(0x164)]),_0x1d553e=await readSqlLockFile(_0x1902d1['lockFilePath']);if(!_0x1d553e)throw CliErrors[_0x1baf39(0x15c)](_0x1baf39(0x160));},async 'dryRun'(_0x35be17){const _0x3012fb=a176_0x239e45,_0x3d49b1=loadSqlProjectConfig(_0x35be17['appCode']),_0x47fe37=await readSqlLockFile(_0x3d49b1[_0x3012fb(0x14b)]);if(!_0x47fe37)throw CliErrors[_0x3012fb(0x15c)](_0x3012fb(0x160));const {appLock:_0x4d716b}=ensureSqlLockScope(_0x47fe37,_0x35be17['appCode'],_0x3d49b1[_0x3012fb(0x146)],_0x3012fb(0x144)),_0x3628ff=_0x35be17[_0x3012fb(0x154)](_0x3012fb(0x15a)),_0x16b013=_0x4d716b[_0x3012fb(0x14d)][_0x3628ff];if(!_0x16b013)throw CliErrors[_0x3012fb(0x15c)](_0x3012fb(0x15e)+_0x3628ff+'\x22.');return{'method':_0x3012fb(0x163),'url':_0x3012fb(0x14a),'body':{'sqlCode':_0x3628ff,'id':_0x16b013[_0x3012fb(0x155)],'localPath':resolveLocalSqlFilePath(_0x3d49b1,_0x3628ff,_0x16b013)},'description':_0x3012fb(0x15f)+_0x3628ff+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x3d49b1[_0x3012fb(0x161)]};},async 'execute'(_0x593c94){const _0x3dd219=a176_0x239e45,_0x86ebc2=loadSqlProjectConfig(_0x593c94[_0x3dd219(0x164)]),_0x52086d=await readSqlLockFile(_0x86ebc2['lockFilePath']);if(!_0x52086d)throw CliErrors[_0x3dd219(0x15c)](_0x3dd219(0x151));const {lockData:_0xd4cd24,appLock:_0x58ecdc}=ensureSqlLockScope(_0x52086d,_0x593c94[_0x3dd219(0x164)],_0x86ebc2[_0x3dd219(0x146)],_0x3dd219(0x144)),_0x19da2a=_0x593c94[_0x3dd219(0x154)](_0x3dd219(0x15a)),_0x287f7f=_0x58ecdc[_0x3dd219(0x14d)][_0x19da2a];if(!_0x287f7f)throw CliErrors[_0x3dd219(0x15c)](_0x3dd219(0x15e)+_0x19da2a+'\x22.');await deleteSqlQuery({'id':_0x287f7f[_0x3dd219(0x155)],'sqlCode':_0x19da2a}),_0x58ecdc[_0x3dd219(0x14d)]=Object['fromEntries'](Object['entries'](_0x58ecdc['sqls'])['filter'](([_0x156b64])=>_0x156b64!==_0x19da2a)),_0x58ecdc[_0x3dd219(0x14e)]=new Date()[_0x3dd219(0x150)](),await writeSqlLockFile(_0x86ebc2[_0x3dd219(0x14b)],_0xd4cd24);const _0x4c4645=resolveLocalSqlFilePath(_0x86ebc2,_0x19da2a,_0x287f7f);let _0x3632c7;await fileExists(_0x4c4645)&&(_0x3632c7=await moveToTrash(_0x86ebc2[_0x3dd219(0x14f)],_0x86ebc2[_0x3dd219(0x161)],_0x4c4645),await cleanupEmptyDirectories(dirname(_0x4c4645),_0x86ebc2['sqlRootDir']));const _0x45dbca={'deleted':_0x19da2a,'remoteId':_0x287f7f[_0x3dd219(0x155)]};if(_0x3632c7)_0x45dbca[_0x3dd219(0x158)]=_0x3632c7;return{'ok':!![],'data':_0x45dbca,'message':_0x3dd219(0x157)+_0x19da2a+(_0x3632c7?_0x3dd219(0x162):'')};}};async function moveToTrash(_0x27f2ea,_0x599545,_0x2547c2){const _0x8958ea=a176_0x239e45,_0x44f0f5=new Date()[_0x8958ea(0x150)]()[_0x8958ea(0x13f)](/[:.]/g,'-'),_0x407150=relative(_0x27f2ea,_0x2547c2),_0x1f97fe=join(_0x599545,_0x44f0f5,_0x407150);return await mkdir(dirname(_0x1f97fe),{'recursive':!![]}),await rename(_0x2547c2,_0x1f97fe),_0x1f97fe;}async function cleanupEmptyDirectories(_0x52bcd7,_0x1c1668){const _0x32ce46=a176_0x239e45;let _0x288df9=resolve(_0x52bcd7);const _0x278c04=resolve(_0x1c1668);while(_0x288df9['startsWith'](''+_0x278c04+sep)||_0x288df9===_0x278c04){if(_0x288df9===_0x278c04)return;try{const _0x1da983=await readdir(_0x288df9);if(_0x1da983[_0x32ce46(0x159)]>0x0)return;await rmdir(_0x288df9);}catch{return;}_0x288df9=dirname(_0x288df9);}}
@@ -0,0 +1,2 @@
1
+ import type { CommandDefinition } from "../../framework/types.js";
2
+ export declare const sqlDetail: CommandDefinition;
@@ -1 +1 @@
1
- function a185_0xb38d(){const _0x348deb=['sqlcode','str','8152CCEKqN','verbose','boolean','read','sqlContent','693dCvVqj','3349535ZloKTx','11655936HdfPwD','dbId','description','4890592rUDiAY','appCode','sqlCode','3166796ETHLds','bool','264750LbptCW','sqlName','11025042beheVz','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode'];a185_0xb38d=function(){return _0x348deb;};return a185_0xb38d();}const a185_0x2689cd=a185_0x101e;(function(_0x53ada2,_0x2b9f14){const _0x3b3168=a185_0x101e,_0x26a7fd=_0x53ada2();while(!![]){try{const _0x1b6fd8=parseInt(_0x3b3168(0xba))/0x1+parseInt(_0x3b3168(0xb8))/0x2+parseInt(_0x3b3168(0xc5))/0x3*(-parseInt(_0x3b3168(0xc0))/0x4)+parseInt(_0x3b3168(0xc6))/0x5+-parseInt(_0x3b3168(0xbc))/0x6+-parseInt(_0x3b3168(0xca))/0x7+parseInt(_0x3b3168(0xc7))/0x8;if(_0x1b6fd8===_0x2b9f14)break;else _0x26a7fd['push'](_0x26a7fd['shift']());}catch(_0x14504b){_0x26a7fd['push'](_0x26a7fd['shift']());}}}(a185_0xb38d,0xec5aa));import{getSqlQueryInfo}from'../../core/api-client.js';function a185_0x101e(_0x5de8ef,_0x4ba840){_0x5de8ef=_0x5de8ef-0xb8;const _0xb38d61=a185_0xb38d();let _0x101e67=_0xb38d61[_0x5de8ef];return _0x101e67;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':'detail','description':a185_0x2689cd(0xbd),'risk':a185_0x2689cd(0xc3),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a185_0x2689cd(0xc2),'description':'Return\x20full\x20raw\x20SQL\x20query\x20object'}],async 'execute'(_0xc57559){const _0x35a488=a185_0x2689cd,_0x3e0c96=await getSqlQueryInfo(_0xc57559[_0x35a488(0xcb)],_0xc57559[_0x35a488(0xbf)](_0x35a488(0xbe))),_0x2c1beb=_0xc57559[_0x35a488(0xb9)](_0x35a488(0xc1));if(_0x2c1beb)return{'ok':!![],'data':_0x3e0c96};const _0x5a4ada=_0x3e0c96[_0x35a488(0xc8)]?await getDbName(_0xc57559[_0x35a488(0xcb)],_0x3e0c96[_0x35a488(0xc8)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x3e0c96[_0x35a488(0xcc)],'sqlName':_0x3e0c96[_0x35a488(0xbb)],'db':_0x5a4ada?_0x5a4ada+'\x20('+_0x3e0c96['dbId']+')':_0x3e0c96['dbId']??'','description':_0x3e0c96[_0x35a488(0xc9)]??'','sqlContent':_0x3e0c96[_0x35a488(0xc4)]??''}};}};
1
+ const a177_0x10c481=a177_0x31a7;(function(_0x94abb6,_0x2985a3){const _0x258f9f=a177_0x31a7,_0x533647=_0x94abb6();while(!![]){try{const _0x138d51=parseInt(_0x258f9f(0x16c))/0x1+-parseInt(_0x258f9f(0x173))/0x2*(-parseInt(_0x258f9f(0x171))/0x3)+-parseInt(_0x258f9f(0x167))/0x4+parseInt(_0x258f9f(0x174))/0x5+-parseInt(_0x258f9f(0x16f))/0x6*(parseInt(_0x258f9f(0x16a))/0x7)+-parseInt(_0x258f9f(0x165))/0x8*(-parseInt(_0x258f9f(0x179))/0x9)+-parseInt(_0x258f9f(0x172))/0xa;if(_0x138d51===_0x2985a3)break;else _0x533647['push'](_0x533647['shift']());}catch(_0x377b0d){_0x533647['push'](_0x533647['shift']());}}}(a177_0x21d4,0xe6e30));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a177_0x31a7(_0x3f12e2,_0xa4bfca){_0x3f12e2=_0x3f12e2-0x165;const _0x21d413=a177_0x21d4();let _0x31a7dd=_0x21d413[_0x3f12e2];return _0x31a7dd;}function a177_0x21d4(){const _0xd9a336=['2UtljPT','4250565idhgWn','description','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','sqlcode','bool','909wkpZrf','boolean','sql','135448fDpqIP','detail','1578264JKuxiB','appCode','dbId','7anheUN','sqlName','308187flXnqE','Return\x20full\x20raw\x20SQL\x20query\x20object','sqlContent','2423478knIzlQ','read','1481079wKJVAo','16178330dJSzou'];a177_0x21d4=function(){return _0xd9a336;};return a177_0x21d4();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a177_0x10c481(0x17b),'command':a177_0x10c481(0x166),'description':a177_0x10c481(0x176),'risk':a177_0x10c481(0x170),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a177_0x10c481(0x17a),'description':a177_0x10c481(0x16d)}],async 'execute'(_0x4dd361){const _0x59b191=a177_0x10c481,_0x425407=await getSqlQueryInfo(_0x4dd361[_0x59b191(0x168)],_0x4dd361['str'](_0x59b191(0x177))),_0x47bec5=_0x4dd361[_0x59b191(0x178)]('verbose');if(_0x47bec5)return{'ok':!![],'data':_0x425407};const _0x5870af=_0x425407['dbId']?await getDbName(_0x4dd361[_0x59b191(0x168)],_0x425407[_0x59b191(0x169)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x425407['sqlCode'],'sqlName':_0x425407[_0x59b191(0x16b)],'db':_0x5870af?_0x5870af+'\x20('+_0x425407[_0x59b191(0x169)]+')':_0x425407['dbId']??'','description':_0x425407[_0x59b191(0x175)]??'','sqlContent':_0x425407[_0x59b191(0x16e)]??''}};}};
@@ -0,0 +1,2 @@
1
+ import type { CommandDefinition } from "../../framework/types.js";
2
+ export declare const sqlExec: CommandDefinition;
@@ -1 +1 @@
1
- const a186_0x502eb4=a186_0x202d;(function(_0x2f8e83,_0x80730b){const _0x263408=a186_0x202d,_0x247552=_0x2f8e83();while(!![]){try{const _0x1cbcdb=parseInt(_0x263408(0x190))/0x1+parseInt(_0x263408(0x187))/0x2*(-parseInt(_0x263408(0x191))/0x3)+-parseInt(_0x263408(0x199))/0x4+parseInt(_0x263408(0x19c))/0x5*(parseInt(_0x263408(0x19f))/0x6)+parseInt(_0x263408(0x18b))/0x7*(parseInt(_0x263408(0x189))/0x8)+-parseInt(_0x263408(0x18e))/0x9*(-parseInt(_0x263408(0x195))/0xa)+-parseInt(_0x263408(0x198))/0xb*(-parseInt(_0x263408(0x188))/0xc);if(_0x1cbcdb===_0x80730b)break;else _0x247552['push'](_0x247552['shift']());}catch(_0x164035){_0x247552['push'](_0x247552['shift']());}}}(a186_0x4469,0x1d789));import{executeSql}from'../../core/api-client.js';function a186_0x202d(_0x2605da,_0xed58a8){_0x2605da=_0x2605da-0x185;const _0x44698f=a186_0x4469();let _0x202d0f=_0x44698f[_0x2605da];return _0x202d0f;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a186_0x502eb4(0x185),'command':a186_0x502eb4(0x194),'description':a186_0x502eb4(0x192),'risk':'read','flags':[SQLCODE_FLAG,{'name':a186_0x502eb4(0x18d),'type':'string','description':a186_0x502eb4(0x19b)}],async 'execute'(_0x33bfc8){const _0xe5f694=a186_0x502eb4,_0x4ab67f=parseJsonParams(_0x33bfc8[_0xe5f694(0x18a)]('params')),_0x8a1e28=Date[_0xe5f694(0x197)](),_0x53c5c1=await executeSql(_0x33bfc8[_0xe5f694(0x186)],_0x33bfc8[_0xe5f694(0x18a)](_0xe5f694(0x19d)),_0x4ab67f),_0x4d1593=Date[_0xe5f694(0x197)]()-_0x8a1e28,_0x45e477=_0x53c5c1?.[_0xe5f694(0x193)]??_0x53c5c1,_0x1a4740=_0x53c5c1?.[_0xe5f694(0x196)]??!![];if(!_0x1a4740)return{'ok':![],'data':{'error':_0x53c5c1?.['execError']||'SQL\x20execution\x20failed','elapsed':_0x4d1593},'message':_0xe5f694(0x19a)};const _0x1de053=Array[_0xe5f694(0x19e)](_0x45e477)?_0x45e477:[];return{'ok':!![],'data':{'rows':_0x1de053,'rowCount':_0x1de053[_0xe5f694(0x18f)],'elapsed':_0x4d1593},'message':'Returned\x20'+_0x1de053['length']+_0xe5f694(0x18c)+_0x4d1593+'ms'};}};function a186_0x4469(){const _0x1afbe1=['88649pTQGBH','6FnWBEd','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','execResult','exec','185520uLcGHT','execSuccess','now','12617ESSVFx','828876ykdEeM','SQL\x20execution\x20failed','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','10hkJTNv','sqlcode','isArray','306618AnOzvo','sql','appCode','140558WBHNLA','552MGQLrl','1205320xkvfRj','str','7AVaZnN','\x20row(s)\x20in\x20','params','36tGhwpS','length'];a186_0x4469=function(){return _0x1afbe1;};return a186_0x4469();}
1
+ const a178_0x1a3d75=a178_0x3a9c;(function(_0xb2428c,_0x4ca791){const _0x37c0f6=a178_0x3a9c,_0x3e18a9=_0xb2428c();while(!![]){try{const _0x4f7ebc=parseInt(_0x37c0f6(0x1ae))/0x1+parseInt(_0x37c0f6(0x1ad))/0x2*(-parseInt(_0x37c0f6(0x1b4))/0x3)+-parseInt(_0x37c0f6(0x1a6))/0x4+-parseInt(_0x37c0f6(0x1b2))/0x5+-parseInt(_0x37c0f6(0x1a5))/0x6*(-parseInt(_0x37c0f6(0x1b0))/0x7)+-parseInt(_0x37c0f6(0x1ab))/0x8+parseInt(_0x37c0f6(0x1a8))/0x9*(parseInt(_0x37c0f6(0x1bb))/0xa);if(_0x4f7ebc===_0x4ca791)break;else _0x3e18a9['push'](_0x3e18a9['shift']());}catch(_0x244400){_0x3e18a9['push'](_0x3e18a9['shift']());}}}(a178_0x36f1,0xcfee6));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a178_0x36f1(){const _0x59cd0a=['27587GPjIBv','exec','6523175WPduKK','sqlcode','3dKkePU','execSuccess','length','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','isArray','execResult','SQL\x20execution\x20failed','12020kOyiXi','execError','654iJNUoC','1559852LpGgXp','sql','14265HXkhEz','read','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','2954224eCRsxr','Returned\x20','745606pIMyzd','953626CnGFDt','now'];a178_0x36f1=function(){return _0x59cd0a;};return a178_0x36f1();}import{parseJsonParams}from'../../utils/params.js';function a178_0x3a9c(_0x20ea49,_0x3e47c4){_0x20ea49=_0x20ea49-0x1a5;const _0x36f187=a178_0x36f1();let _0x3a9c4b=_0x36f187[_0x20ea49];return _0x3a9c4b;}export const sqlExec={'service':a178_0x1a3d75(0x1a7),'command':a178_0x1a3d75(0x1b1),'description':a178_0x1a3d75(0x1b7),'risk':a178_0x1a3d75(0x1a9),'flags':[SQLCODE_FLAG,{'name':'params','type':'string','description':a178_0x1a3d75(0x1aa)}],async 'execute'(_0x362426){const _0x29c949=a178_0x1a3d75,_0x4588c6=parseJsonParams(_0x362426['str']('params')),_0x150664=Date[_0x29c949(0x1af)](),_0x526cbb=await executeSql(_0x362426['appCode'],_0x362426['str'](_0x29c949(0x1b3)),_0x4588c6),_0x800a04=Date[_0x29c949(0x1af)]()-_0x150664,_0x5cb5e1=_0x526cbb?.[_0x29c949(0x1b9)]??_0x526cbb,_0x164f48=_0x526cbb?.[_0x29c949(0x1b5)]??!![];if(!_0x164f48)return{'ok':![],'data':{'error':_0x526cbb?.[_0x29c949(0x1bc)]||_0x29c949(0x1ba),'elapsed':_0x800a04},'message':'SQL\x20execution\x20failed'};const _0x6ca7fc=Array[_0x29c949(0x1b8)](_0x5cb5e1)?_0x5cb5e1:[];return{'ok':!![],'data':{'rows':_0x6ca7fc,'rowCount':_0x6ca7fc[_0x29c949(0x1b6)],'elapsed':_0x800a04},'message':_0x29c949(0x1ac)+_0x6ca7fc['length']+'\x20row(s)\x20in\x20'+_0x800a04+'ms'};}};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * sql 命令组 —— 声明式命令定义导出
3
+ */
4
+ import type { CommandDefinition } from "../../framework/types.js";
5
+ export declare const sqlDefinitions: CommandDefinition[];
@@ -1 +1 @@
1
- (function(_0x36011b,_0x5f475a){const _0x26f8af=a187_0x320b,_0x541b4e=_0x36011b();while(!![]){try{const _0x2774ae=-parseInt(_0x26f8af(0x1ed))/0x1+parseInt(_0x26f8af(0x1e4))/0x2*(-parseInt(_0x26f8af(0x1e5))/0x3)+parseInt(_0x26f8af(0x1eb))/0x4*(-parseInt(_0x26f8af(0x1e7))/0x5)+-parseInt(_0x26f8af(0x1e6))/0x6*(parseInt(_0x26f8af(0x1e8))/0x7)+-parseInt(_0x26f8af(0x1ee))/0x8+-parseInt(_0x26f8af(0x1e9))/0x9*(parseInt(_0x26f8af(0x1ec))/0xa)+parseInt(_0x26f8af(0x1ea))/0xb;if(_0x2774ae===_0x5f475a)break;else _0x541b4e['push'](_0x541b4e['shift']());}catch(_0x41fc59){_0x541b4e['push'](_0x541b4e['shift']());}}}(a187_0x354d,0xb5b72));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';function a187_0x354d(){const _0x1304ca=['3845816vMqTlt','10qkrXZF','1146594RTcULf','3225056bvgOYZ','285986bRrkmT','3OvTKli','206358hDAltg','5abUmas','133DbkJbF','11246913JxPWIJ','58317633XriLdA'];a187_0x354d=function(){return _0x1304ca;};return a187_0x354d();}import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';function a187_0x320b(_0x588592,_0x190731){_0x588592=_0x588592-0x1e4;const _0x354dce=a187_0x354d();let _0x320bd4=_0x354dce[_0x588592];return _0x320bd4;}import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
1
+ (function(_0x251e29,_0x403a53){const _0x525c10=a179_0x34d6,_0x5ecbb6=_0x251e29();while(!![]){try{const _0x2f35bf=-parseInt(_0x525c10(0x1c7))/0x1+parseInt(_0x525c10(0x1c9))/0x2+-parseInt(_0x525c10(0x1ce))/0x3+parseInt(_0x525c10(0x1cc))/0x4+-parseInt(_0x525c10(0x1cd))/0x5*(-parseInt(_0x525c10(0x1c6))/0x6)+-parseInt(_0x525c10(0x1c8))/0x7*(-parseInt(_0x525c10(0x1ca))/0x8)+-parseInt(_0x525c10(0x1cb))/0x9;if(_0x2f35bf===_0x403a53)break;else _0x5ecbb6['push'](_0x5ecbb6['shift']());}catch(_0x25e734){_0x5ecbb6['push'](_0x5ecbb6['shift']());}}}(a179_0x152f,0xb8c8b));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a179_0x152f(){const _0x22f07a=['2380188bPslWE','396155gNBjfA','2538831oMxDYg','114oJcXVv','782485wDNagb','3726646wNvspg','964544wbUyAz','16LJVexl','11356443kDLiKQ'];a179_0x152f=function(){return _0x22f07a;};return a179_0x152f();}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';function a179_0x34d6(_0x24ee0a,_0x334512){_0x24ee0a=_0x24ee0a-0x1c6;const _0x152f61=a179_0x152f();let _0x34d68b=_0x152f61[_0x24ee0a];return _0x34d68b;}export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
@@ -0,0 +1,2 @@
1
+ import type { CommandDefinition } from "../../framework/types.js";
2
+ export declare const sqlList: CommandDefinition;
@@ -1 +1 @@
1
- const a188_0x24c434=a188_0x3288;(function(_0x53b86b,_0x3e25ff){const _0x43bbf9=a188_0x3288,_0x25ba2d=_0x53b86b();while(!![]){try{const _0x3231b4=-parseInt(_0x43bbf9(0xe3))/0x1+parseInt(_0x43bbf9(0xde))/0x2*(-parseInt(_0x43bbf9(0xe5))/0x3)+-parseInt(_0x43bbf9(0xf2))/0x4*(-parseInt(_0x43bbf9(0xfd))/0x5)+-parseInt(_0x43bbf9(0xe9))/0x6+parseInt(_0x43bbf9(0xf5))/0x7+parseInt(_0x43bbf9(0xe7))/0x8+parseInt(_0x43bbf9(0xf3))/0x9*(parseInt(_0x43bbf9(0xf0))/0xa);if(_0x3231b4===_0x3e25ff)break;else _0x25ba2d['push'](_0x25ba2d['shift']());}catch(_0x37ca29){_0x25ba2d['push'](_0x25ba2d['shift']());}}}(a188_0x5cdf,0x36453));function a188_0x3288(_0x19cbb0,_0x382839){_0x19cbb0=_0x19cbb0-0xd9;const _0x5cdf48=a188_0x5cdf();let _0x3288c5=_0x5cdf48[_0x19cbb0];return _0x3288c5;}import{listSqlQueries}from'../../core/api-client.js';function a188_0x5cdf(){const _0x2248d5=['dbId','224133HPHaBg','sql','1113728MGtJpK','page','1827810TKjlIo','verbose','name','pagesize','paging','bool','read','30bmepAs','map','20fXlmRh','1044279vbJlHO','totalCount','2326247PuYRLb','No\x20custom\x20SQL\x20queries\x20found.','Page\x20size','boolean','Filter\x20by\x20SQL\x20name','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','number','appCode','279050CfNdot','all','Page\x20number','length','tableData','num','4AnBOZs','List\x20custom\x20SQL\x20queries','description','\x20SQL\x20queries\x20(total:\x20','str','422332iOuRdQ'];a188_0x5cdf=function(){return _0x2248d5;};return a188_0x5cdf();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a188_0x24c434(0xe6),'command':'list','description':a188_0x24c434(0xdf),'risk':a188_0x24c434(0xef),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a188_0x24c434(0xeb),'type':'string','description':a188_0x24c434(0xf9)},{'name':a188_0x24c434(0xe8),'type':'number','description':a188_0x24c434(0xda),'default':0x1},{'name':a188_0x24c434(0xec),'type':a188_0x24c434(0xfb),'description':a188_0x24c434(0xf7)},{'name':a188_0x24c434(0xea),'type':a188_0x24c434(0xf8),'description':a188_0x24c434(0xfa)}],async 'execute'(_0x981ef){const _0x193195=a188_0x24c434,_0x2f3e80=await listSqlQueries(_0x981ef[_0x193195(0xfc)],{'sqlCode':_0x981ef[_0x193195(0xe2)]('sqlcode')||undefined,'sqlName':_0x981ef['str'](_0x193195(0xeb))||undefined,'currentPage':_0x981ef['num'](_0x193195(0xe8)),'pageSize':_0x981ef[_0x193195(0xdd)](_0x193195(0xec),0x32)}),_0x44c06a=_0x981ef[_0x193195(0xee)]('verbose'),_0x2486d4=_0x2f3e80[_0x193195(0xdc)]??[],_0xb34916=_0x2f3e80[_0x193195(0xed)]?.[_0x193195(0xf4)]??_0x2486d4[_0x193195(0xdb)];let _0x32855f;return _0x44c06a?_0x32855f=_0x2486d4:_0x32855f=await Promise[_0x193195(0xd9)](_0x2486d4[_0x193195(0xf1)](async _0x2a2404=>{const _0x2870e2=_0x193195;let _0x35b73b;try{_0x35b73b=_0x2a2404['dbId']?await getDbName(_0x981ef['appCode'],_0x2a2404[_0x2870e2(0xe4)]):undefined;}catch{}return{'sqlCode':_0x2a2404['sqlCode'],'sqlName':_0x2a2404['sqlName'],'description':_0x2a2404[_0x2870e2(0xe0)]??'','db':_0x35b73b?_0x35b73b+'\x20('+_0x2a2404[_0x2870e2(0xe4)]+')':_0x2a2404['dbId']??''};})),{'ok':!![],'data':_0x32855f,'message':_0x2486d4[_0x193195(0xdb)]===0x0?_0x193195(0xf6):'Found\x20'+_0x2486d4['length']+_0x193195(0xe1)+_0xb34916+').'};}};
1
+ const a180_0x166ece=a180_0x4f64;(function(_0x1738c2,_0x194aed){const _0x4265d9=a180_0x4f64,_0x39f9bb=_0x1738c2();while(!![]){try{const _0x52a98e=parseInt(_0x4265d9(0x8c))/0x1+parseInt(_0x4265d9(0xa0))/0x2*(parseInt(_0x4265d9(0x94))/0x3)+-parseInt(_0x4265d9(0x8e))/0x4+parseInt(_0x4265d9(0x8f))/0x5+parseInt(_0x4265d9(0x90))/0x6+parseInt(_0x4265d9(0x99))/0x7+-parseInt(_0x4265d9(0x86))/0x8*(parseInt(_0x4265d9(0x8d))/0x9);if(_0x52a98e===_0x194aed)break;else _0x39f9bb['push'](_0x39f9bb['shift']());}catch(_0x3e10f8){_0x39f9bb['push'](_0x39f9bb['shift']());}}}(a180_0x5abd,0xaaee1));function a180_0x4f64(_0xea7b89,_0x5dd6ba){_0xea7b89=_0xea7b89-0x85;const _0x5abd70=a180_0x5abd();let _0x4f64a3=_0x5abd70[_0xea7b89];return _0x4f64a3;}import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a180_0x166ece(0x9e),'command':'list','description':a180_0x166ece(0xa3),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a180_0x166ece(0x85),'description':a180_0x166ece(0x9a)},{'name':a180_0x166ece(0x88),'type':a180_0x166ece(0xa7),'description':a180_0x166ece(0xa6),'default':0x1},{'name':a180_0x166ece(0x97),'type':a180_0x166ece(0xa7),'description':a180_0x166ece(0xab)},{'name':a180_0x166ece(0x93),'type':a180_0x166ece(0xa5),'description':a180_0x166ece(0x87)}],async 'execute'(_0x20f90d){const _0x25e943=a180_0x166ece,_0xceda5f=await listSqlQueries(_0x20f90d['appCode'],{'sqlCode':_0x20f90d[_0x25e943(0xa2)](_0x25e943(0x95))||undefined,'sqlName':_0x20f90d[_0x25e943(0xa2)](_0x25e943(0x96))||undefined,'currentPage':_0x20f90d[_0x25e943(0x92)](_0x25e943(0x88)),'pageSize':_0x20f90d[_0x25e943(0x92)](_0x25e943(0x97),0x32)}),_0x42de8=_0x20f90d[_0x25e943(0x91)](_0x25e943(0x93)),_0x2990e4=_0xceda5f[_0x25e943(0xa1)]??[],_0x7cd29f=_0xceda5f[_0x25e943(0x98)]?.[_0x25e943(0xa9)]??_0x2990e4[_0x25e943(0x8a)];let _0x9f991d;return _0x42de8?_0x9f991d=_0x2990e4:_0x9f991d=await Promise[_0x25e943(0x89)](_0x2990e4[_0x25e943(0x8b)](async _0x592fc5=>{const _0x23bcfb=_0x25e943;let _0x44be45;try{_0x44be45=_0x592fc5[_0x23bcfb(0xa4)]?await getDbName(_0x20f90d[_0x23bcfb(0x9d)],_0x592fc5[_0x23bcfb(0xa4)]):undefined;}catch{}return{'sqlCode':_0x592fc5[_0x23bcfb(0xa8)],'sqlName':_0x592fc5[_0x23bcfb(0xaa)],'description':_0x592fc5[_0x23bcfb(0x9c)]??'','db':_0x44be45?_0x44be45+'\x20('+_0x592fc5[_0x23bcfb(0xa4)]+')':_0x592fc5[_0x23bcfb(0xa4)]??''};})),{'ok':!![],'data':_0x9f991d,'message':_0x2990e4['length']===0x0?_0x25e943(0x9f):'Found\x20'+_0x2990e4[_0x25e943(0x8a)]+_0x25e943(0x9b)+_0x7cd29f+').'};}};function a180_0x5abd(){const _0x3f69d2=['description','appCode','sql','No\x20custom\x20SQL\x20queries\x20found.','1554582EOiOqX','tableData','str','List\x20custom\x20SQL\x20queries','dbId','boolean','Page\x20number','number','sqlCode','totalCount','sqlName','Page\x20size','string','4120ozcwUB','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','page','all','length','map','246463NNfvfM','36126TfHXEr','2345832QFXRSN','1988750VWGKQU','8375592AGrCSl','bool','num','verbose','3FqmVDk','sqlcode','name','pagesize','paging','3754527UPUodO','Filter\x20by\x20SQL\x20name','\x20SQL\x20queries\x20(total:\x20'];a180_0x5abd=function(){return _0x3f69d2;};return a180_0x5abd();}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * sql pull —— 声明式命令:从远端拉取自定义 SQL 到本地
3
+ */
4
+ import type { CommandDefinition } from "../../framework/types.js";
5
+ export declare const sqlPull: CommandDefinition;
@@ -1 +1 @@
1
- const a189_0xfc5292=a189_0x1942;(function(_0x2a3420,_0x49abae){const _0x120b15=a189_0x1942,_0x112651=_0x2a3420();while(!![]){try{const _0xfd418=parseInt(_0x120b15(0x173))/0x1*(-parseInt(_0x120b15(0x16f))/0x2)+-parseInt(_0x120b15(0x179))/0x3+parseInt(_0x120b15(0x160))/0x4+-parseInt(_0x120b15(0x164))/0x5*(parseInt(_0x120b15(0x195))/0x6)+parseInt(_0x120b15(0x172))/0x7+parseInt(_0x120b15(0x18f))/0x8+parseInt(_0x120b15(0x187))/0x9*(parseInt(_0x120b15(0x17e))/0xa);if(_0xfd418===_0x49abae)break;else _0x112651['push'](_0x112651['shift']());}catch(_0x4e07a0){_0x112651['push'](_0x112651['shift']());}}}(a189_0x1c40,0x7cc3d));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a189_0x1942(_0x2fe7ac,_0x3d64cb){_0x2fe7ac=_0x2fe7ac-0x15e;const _0x1c4074=a189_0x1c40();let _0x1942b5=_0x1c4074[_0x2fe7ac];return _0x1942b5;}import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;function a189_0x1c40(){const _0x51e8c5=['nonInteractive','bool','message','Force\x20overwrite\x20local\x20unsynced\x20changes','pull','sqls','trimStart','paging','6qtkeLz','lockFilePath','utf8','829577EWNYLb','109206QqErZi','filter','mybatisXml','\x20failed','local\x20differs\x20from\x20remote','\x20written,\x20','1550052TTPSIB','appCode','Force\x20pull\x20cancelled.','str','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','31550eguPmC','would_pull','\x20skipped,\x20','lastSync','boolean','sqlCode','unchanged','Filter\x20by\x20SQL\x20display\x20name','sqlcode','117KGljDJ','join','totalCount','force','push','cancelled','length','No\x20remote\x20SQL\x20queries\x20matched.','6132944rVlrLt','name','POST','string','sqlContent','dbId','152694YIrzcn','catch','Pull\x20complete:\x20','sql','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','split','test','\x20SQL\x20file(s)\x20into\x20','sqlRoot','2022168FqILEq','sqlRootDir','description','sqlName','15tayjZR','toISOString','path'];a189_0x1c40=function(){return _0x51e8c5;};return a189_0x1c40();}async function fetchAllSqlQueries(_0x39aa12,_0x1e12ed){const _0x3db37c=a189_0x1942,_0x32eb3e=[];let _0x25fea1=0x1;while(!![]){const _0x5e34d2=await listSqlQueries(_0x39aa12,{'currentPage':_0x25fea1,'pageSize':PAGE_SIZE,'sqlCode':_0x1e12ed[_0x3db37c(0x183)],'sqlName':_0x1e12ed['sqlName']}),_0x235d85=_0x5e34d2['tableData']??[];_0x32eb3e[_0x3db37c(0x18b)](..._0x235d85);if(_0x235d85[_0x3db37c(0x18d)]===0x0)break;const _0x23338b=_0x5e34d2[_0x3db37c(0x16e)]?.[_0x3db37c(0x189)];if(_0x23338b!=null?_0x32eb3e[_0x3db37c(0x18d)]>=_0x23338b:_0x235d85['length']<PAGE_SIZE)break;_0x25fea1++;}return _0x32eb3e;}async function ensureSqlContent(_0x3fe760){const _0xd46102=a189_0x1942;if(_0x3fe760[_0xd46102(0x193)]!=null&&String(_0x3fe760['sqlContent'])[_0xd46102(0x18d)]>0x0)return _0x3fe760;return getSqlQueryDetail(_0x3fe760['sqlCode']);}export const sqlPull={'service':a189_0xfc5292(0x198),'command':a189_0xfc5292(0x16b),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a189_0xfc5292(0x190),'type':a189_0xfc5292(0x192),'description':a189_0xfc5292(0x185)},{'name':a189_0xfc5292(0x18a),'type':a189_0xfc5292(0x182),'description':a189_0xfc5292(0x16a)}],async 'dryRun'(_0x6bafba){const _0x4647f6=a189_0xfc5292,_0x5796da=loadSqlProjectConfig(_0x6bafba[_0x4647f6(0x17a)]),_0x44159b=await readSqlLockFile(_0x5796da[_0x4647f6(0x170)]),{appLock:_0x91a91b}=ensureSqlLockScope(_0x44159b??createEmptySqlLock(),_0x5796da[_0x4647f6(0x17a)],_0x5796da[_0x4647f6(0x15f)],_0x4647f6(0x16b)),_0x4e740=await fetchAllSqlQueries(_0x6bafba[_0x4647f6(0x17a)],{'sqlCode':_0x6bafba[_0x4647f6(0x17c)](_0x4647f6(0x186))||undefined,'sqlName':_0x6bafba['str'](_0x4647f6(0x190))||undefined}),_0x19044e=[];for(const _0xaf9f31 of _0x4e740){const _0x41b980=await ensureSqlContent(_0xaf9f31),_0x2d4bd9=ensureRemoteSqlContent(_0x41b980),_0xc900fe=detectModeFromSql(_0x41b980),_0x480b8d=_0x41b980[_0x4647f6(0x194)]?await getDbName(_0x6bafba[_0x4647f6(0x17a)],Number(_0x41b980[_0x4647f6(0x194)]))[_0x4647f6(0x196)](()=>undefined):undefined,_0x4d7f7e=buildLocalSqlFileContent({'sqlCode':_0x41b980[_0x4647f6(0x183)],'sqlName':_0x41b980['sqlName'],'dbId':_0x41b980[_0x4647f6(0x194)]},_0x2d4bd9,{'dbName':_0x480b8d,'mode':_0xc900fe,'syncedAt':new Date()['toISOString'](),'description':_0x41b980[_0x4647f6(0x162)]}),_0xac7845=buildSqlLockEntry(_0x41b980,_0x2d4bd9,'',{'dbName':_0x480b8d}),_0x201d11=resolveLocalSqlFilePath(_0x5796da,_0x41b980[_0x4647f6(0x183)],_0xac7845);let _0x3c7c53=_0x4647f6(0x17f),_0x500ed;if(await fileExists(_0x201d11)){const _0x248bb5=await readFile(_0x201d11,_0x4647f6(0x171));isEquivalentPulledSqlFile(_0x248bb5,_0x4d7f7e,_0xc900fe)?(_0x3c7c53='skipped',_0x500ed='unchanged'):(_0x3c7c53='conflict',_0x500ed=_0x4647f6(0x17d));}_0x19044e['push']({'sqlCode':_0x41b980[_0x4647f6(0x183)],'sqlName':_0x41b980[_0x4647f6(0x163)],'filePath':_0x201d11,'status':_0x3c7c53,'reason':_0x500ed});}return{'method':_0x4647f6(0x191),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x6bafba['appCode'],'sqlCode':_0x6bafba[_0x4647f6(0x17c)]('sqlcode')||null,'sqlName':_0x6bafba[_0x4647f6(0x17c)](_0x4647f6(0x190))||null,'files':_0x19044e},'description':'Would\x20pull\x20'+_0x19044e[_0x4647f6(0x18d)]+_0x4647f6(0x15e)+_0x5796da[_0x4647f6(0x161)]};},async 'execute'(_0xb886c5){const _0xf62f41=a189_0xfc5292,_0x250257=loadSqlProjectConfig(_0xb886c5[_0xf62f41(0x17a)]),_0x4df998=await readSqlLockFile(_0x250257[_0xf62f41(0x170)]),{lockData:_0x1dfc35,appLock:_0x4409bf}=ensureSqlLockScope(_0x4df998??createEmptySqlLock(),_0x250257['appCode'],_0x250257[_0xf62f41(0x15f)],'pull'),_0x7fc229=_0xb886c5[_0xf62f41(0x168)]('force'),_0x20deb8=await fetchAllSqlQueries(_0xb886c5[_0xf62f41(0x17a)],{'sqlCode':_0xb886c5[_0xf62f41(0x17c)](_0xf62f41(0x186))||undefined,'sqlName':_0xb886c5[_0xf62f41(0x17c)]('name')||undefined});if(_0x20deb8[_0xf62f41(0x18d)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0xf62f41(0x18e)};const _0x5e832c=[],_0x2d9359=[];for(const _0x322b27 of _0x20deb8){try{_0x5e832c[_0xf62f41(0x18b)](await ensureSqlContent(_0x322b27));}catch(_0x2c0f02){_0x2d9359[_0xf62f41(0x18b)]({'sqlCode':_0x322b27[_0xf62f41(0x183)],'error':_0x2c0f02 instanceof Error?_0x2c0f02[_0xf62f41(0x169)]:String(_0x2c0f02)});}}if(_0x7fc229&&!_0xb886c5[_0xf62f41(0x167)]){let _0x282a70=![];for(const _0x52e161 of _0x5e832c){const _0x2ef2bf=detectModeFromSql(_0x52e161),_0x2d6b98=_0x52e161[_0xf62f41(0x194)]?await getDbName(_0xb886c5['appCode'],Number(_0x52e161[_0xf62f41(0x194)]))[_0xf62f41(0x196)](()=>undefined):undefined,_0xdb17aa=buildLocalSqlFileContent({'sqlCode':_0x52e161[_0xf62f41(0x183)],'sqlName':_0x52e161[_0xf62f41(0x163)],'dbId':_0x52e161[_0xf62f41(0x194)]},ensureRemoteSqlContent(_0x52e161),{'dbName':_0x2d6b98,'mode':_0x2ef2bf,'syncedAt':new Date()[_0xf62f41(0x165)](),'description':_0x52e161['description']}),_0x42dabb=resolveLocalSqlFilePath(_0x250257,_0x52e161[_0xf62f41(0x183)],buildSqlLockEntry(_0x52e161,ensureRemoteSqlContent(_0x52e161),'',{'dbName':_0x2d6b98}));if(await fileExists(_0x42dabb)){const _0x2aa55d=await readFile(_0x42dabb,'utf8');if(!isEquivalentPulledSqlFile(_0x2aa55d,_0xdb17aa,_0x2ef2bf)){_0x282a70=!![];break;}}}if(_0x282a70){const _0x417144=await confirmForceOverwrite(_0xf62f41(0x199));if(!_0x417144)throw CliErrors[_0xf62f41(0x18c)](_0xf62f41(0x17b));}}const _0x2ed0cb=cloneSqlLockData(_0x1dfc35),_0xf4328e=_0x2ed0cb['apps'][_0x250257[_0xf62f41(0x17a)]],_0x3763ad=[],_0x1b206a=[];for(const _0x337bd8 of _0x5e832c){const _0x273cd9=_0xf4328e[_0xf62f41(0x16c)][_0x337bd8[_0xf62f41(0x183)]],_0x3ed2a2=ensureRemoteSqlContent(_0x337bd8),_0x5cf55c=detectModeFromSql(_0x337bd8),_0x5b0097=_0x337bd8[_0xf62f41(0x194)]?await getDbName(_0xb886c5['appCode'],Number(_0x337bd8[_0xf62f41(0x194)]))[_0xf62f41(0x196)](()=>undefined):undefined,_0x385ae1=buildLocalSqlFileContent({'sqlCode':_0x337bd8[_0xf62f41(0x183)],'sqlName':_0x337bd8['sqlName'],'dbId':_0x337bd8['dbId']},_0x3ed2a2,{'dbName':_0x5b0097,'mode':_0x5cf55c,'syncedAt':new Date()[_0xf62f41(0x165)](),'description':_0x337bd8[_0xf62f41(0x162)]}),_0x286ea7=buildSqlLockEntry(_0x337bd8,_0x3ed2a2,computeSqlContentHash(_0x385ae1),{'dbName':_0x5b0097}),_0x34e338=_0x286ea7['path'],_0x3b6dfe=join(_0x250257[_0xf62f41(0x161)],_0x34e338);try{if(await fileExists(_0x3b6dfe)){const _0x12fc18=await readFile(_0x3b6dfe,_0xf62f41(0x171));if(isEquivalentPulledSqlFile(_0x12fc18,_0x385ae1,_0x5cf55c)){_0x1b206a[_0xf62f41(0x18b)]({'sqlCode':_0x337bd8[_0xf62f41(0x183)],'reason':_0xf62f41(0x184)}),_0xf4328e[_0xf62f41(0x16c)][_0x337bd8[_0xf62f41(0x183)]]={..._0x286ea7,'hash':computeSqlContentHash(_0x12fc18),'path':_0x34e338};continue;}if(!_0x7fc229){_0x1b206a[_0xf62f41(0x18b)]({'sqlCode':_0x337bd8[_0xf62f41(0x183)],'reason':_0xf62f41(0x177)});continue;}}const _0x433727=_0x273cd9?.[_0xf62f41(0x166)]?join(_0x250257[_0xf62f41(0x161)],_0x273cd9[_0xf62f41(0x166)]):undefined;_0x433727&&_0x433727!==_0x3b6dfe&&await fileExists(_0x433727)&&await rm(_0x433727,{'force':!![]}),await ensureParentDirectory(_0x3b6dfe),await writeFile(_0x3b6dfe,_0x385ae1,_0xf62f41(0x171)),_0xf4328e[_0xf62f41(0x16c)][_0x337bd8[_0xf62f41(0x183)]]={..._0x286ea7,'path':_0x34e338},_0x3763ad[_0xf62f41(0x18b)]({'sqlCode':_0x337bd8['sqlCode'],'filePath':_0x3b6dfe});}catch(_0x543e8a){_0x2d9359['push']({'sqlCode':_0x337bd8[_0xf62f41(0x183)],'error':_0x543e8a instanceof Error?_0x543e8a[_0xf62f41(0x169)]:String(_0x543e8a)});}}return _0xf4328e[_0xf62f41(0x181)]=new Date()[_0xf62f41(0x165)](),await writeSqlLockFile(_0x250257['lockFilePath'],_0x2ed0cb),{'ok':_0x2d9359['length']===0x0,'data':{'pulled':_0x3763ad,'skipped':_0x1b206a,'failed':_0x2d9359},'message':_0xf62f41(0x197)+_0x3763ad[_0xf62f41(0x18d)]+_0xf62f41(0x178)+_0x1b206a[_0xf62f41(0x18d)]+_0xf62f41(0x180)+_0x2d9359[_0xf62f41(0x18d)]+_0xf62f41(0x176)};}};function detectModeFromSql(_0x5bc5c6){const _0x1765e6=a189_0xfc5292,_0x5f3679=ensureRemoteSqlContent(_0x5bc5c6),_0xda3741=stripLocalSqlMetadata(_0x5f3679,'mybatisXml')[_0x1765e6(0x16d)]();if(/^<(select|insert|update|delete)\b/i[_0x1765e6(0x19b)](_0xda3741))return _0x1765e6(0x175);return'sql';}function isEquivalentPulledSqlFile(_0x5ecb97,_0x1637c0,_0xb4da3){return normalizePullComparableContent(_0x5ecb97,_0xb4da3)===normalizePullComparableContent(_0x1637c0,_0xb4da3);}function normalizePullComparableContent(_0x307f60,_0x2a3a43){const _0x1742c4=a189_0xfc5292,_0x1e9c3c=_0x307f60['replace'](/\r\n/g,'\x0a')[_0x1742c4(0x19a)]('\x0a'),_0x3775b0=_0x1e9c3c[_0x1742c4(0x174)](_0xd24a5a=>!isSyncedAtMetadataLine(_0xd24a5a,_0x2a3a43));return _0x3775b0[_0x1742c4(0x188)]('\x0a');}function isSyncedAtMetadataLine(_0x577bd8,_0x184e4f){const _0x48b8d9=a189_0xfc5292;if(_0x184e4f==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x48b8d9(0x19b)](_0x577bd8);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x48b8d9(0x19b)](_0x577bd8);}
1
+ const a181_0x1787c2=a181_0x4f2e;(function(_0x44925d,_0xfc4466){const _0x58f53d=a181_0x4f2e,_0x2de55a=_0x44925d();while(!![]){try{const _0x9fdda6=parseInt(_0x58f53d(0x145))/0x1+-parseInt(_0x58f53d(0x166))/0x2*(-parseInt(_0x58f53d(0x138))/0x3)+-parseInt(_0x58f53d(0x143))/0x4*(parseInt(_0x58f53d(0x160))/0x5)+parseInt(_0x58f53d(0x13d))/0x6+-parseInt(_0x58f53d(0x151))/0x7+parseInt(_0x58f53d(0x168))/0x8*(-parseInt(_0x58f53d(0x148))/0x9)+parseInt(_0x58f53d(0x13b))/0xa*(parseInt(_0x58f53d(0x150))/0xb);if(_0x9fdda6===_0xfc4466)break;else _0x2de55a['push'](_0x2de55a['shift']());}catch(_0x543dbd){_0x2de55a['push'](_0x2de55a['shift']());}}}(a181_0xae3b,0x6748e));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';function a181_0x4f2e(_0x4db13d,_0xb57c9f){_0x4db13d=_0x4db13d-0x135;const _0xae3b31=a181_0xae3b();let _0x4f2e33=_0xae3b31[_0x4db13d];return _0x4f2e33;}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x26c8c1,_0x51fc70){const _0x4dd05a=a181_0x4f2e,_0xd7c587=[];let _0x180989=0x1;while(!![]){const _0x3ff703=await listSqlQueries(_0x26c8c1,{'currentPage':_0x180989,'pageSize':PAGE_SIZE,'sqlCode':_0x51fc70[_0x4dd05a(0x14c)],'sqlName':_0x51fc70[_0x4dd05a(0x144)]}),_0x36b130=_0x3ff703[_0x4dd05a(0x147)]??[];_0xd7c587[_0x4dd05a(0x153)](..._0x36b130);if(_0x36b130[_0x4dd05a(0x14d)]===0x0)break;const _0x36fee3=_0x3ff703[_0x4dd05a(0x163)]?.['totalCount'];if(_0x36fee3!=null?_0xd7c587['length']>=_0x36fee3:_0x36b130[_0x4dd05a(0x14d)]<PAGE_SIZE)break;_0x180989++;}return _0xd7c587;}async function ensureSqlContent(_0x4ccaf6){const _0x34fc5b=a181_0x4f2e;if(_0x4ccaf6[_0x34fc5b(0x15b)]!=null&&String(_0x4ccaf6[_0x34fc5b(0x15b)])['length']>0x0)return _0x4ccaf6;return getSqlQueryDetail(_0x4ccaf6[_0x34fc5b(0x14c)]);}function a181_0xae3b(){const _0x12082d=['sqlRootDir','sqlCode','length','str','\x20skipped,\x20','847NQrKyL','529396WrrjIg','No\x20remote\x20SQL\x20queries\x20matched.','push','utf8','Filter\x20by\x20SQL\x20display\x20name','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','name','join','appCode','unchanged','sqlContent','split','\x20failed','toISOString','test','415vweTCc','string','sqls','paging','filter','Force\x20overwrite\x20local\x20unsynced\x20changes','2CqhNdy','dbId','1016rEENDn','skipped','apps','lastSync','sql','boolean','catch','Force\x20pull\x20cancelled.','lockFilePath','mybatisXml','1762797adIdWs','path','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','34070NMkUKj','pull','1134186yBOTAG','sqlcode','bool','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','message','replace','4036VMPQqO','sqlName','128930GCnDXq','description','tableData','41490wxwkTB','would_pull','Pull\x20complete:\x20'];a181_0xae3b=function(){return _0x12082d;};return a181_0xae3b();}export const sqlPull={'service':a181_0x1787c2(0x16c),'command':a181_0x1787c2(0x13c),'description':a181_0x1787c2(0x156),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a181_0x1787c2(0x157),'type':a181_0x1787c2(0x161),'description':a181_0x1787c2(0x155)},{'name':'force','type':a181_0x1787c2(0x16d),'description':a181_0x1787c2(0x165)}],async 'dryRun'(_0x540644){const _0x9f780e=a181_0x1787c2,_0x57b33b=loadSqlProjectConfig(_0x540644[_0x9f780e(0x159)]),_0x20d8db=await readSqlLockFile(_0x57b33b[_0x9f780e(0x136)]),{appLock:_0x1343e2}=ensureSqlLockScope(_0x20d8db??createEmptySqlLock(),_0x57b33b[_0x9f780e(0x159)],_0x57b33b['sqlRoot'],'pull'),_0x4bb8f1=await fetchAllSqlQueries(_0x540644['appCode'],{'sqlCode':_0x540644[_0x9f780e(0x14e)]('sqlcode')||undefined,'sqlName':_0x540644[_0x9f780e(0x14e)]('name')||undefined}),_0x32c24f=[];for(const _0xe251e8 of _0x4bb8f1){const _0x3bd712=await ensureSqlContent(_0xe251e8),_0x502a43=ensureRemoteSqlContent(_0x3bd712),_0x35d5fd=detectModeFromSql(_0x3bd712),_0x69900a=_0x3bd712[_0x9f780e(0x167)]?await getDbName(_0x540644[_0x9f780e(0x159)],Number(_0x3bd712[_0x9f780e(0x167)]))[_0x9f780e(0x16e)](()=>undefined):undefined,_0x5c84fa=buildLocalSqlFileContent({'sqlCode':_0x3bd712[_0x9f780e(0x14c)],'sqlName':_0x3bd712[_0x9f780e(0x144)],'dbId':_0x3bd712[_0x9f780e(0x167)]},_0x502a43,{'dbName':_0x69900a,'mode':_0x35d5fd,'syncedAt':new Date()[_0x9f780e(0x15e)](),'description':_0x3bd712[_0x9f780e(0x146)]}),_0x4835a7=buildSqlLockEntry(_0x3bd712,_0x502a43,'',{'dbName':_0x69900a}),_0x42537b=resolveLocalSqlFilePath(_0x57b33b,_0x3bd712['sqlCode'],_0x4835a7);let _0x2d911d=_0x9f780e(0x149),_0xa79bb1;if(await fileExists(_0x42537b)){const _0x37c301=await readFile(_0x42537b,_0x9f780e(0x154));isEquivalentPulledSqlFile(_0x37c301,_0x5c84fa,_0x35d5fd)?(_0x2d911d=_0x9f780e(0x169),_0xa79bb1=_0x9f780e(0x15a)):(_0x2d911d='conflict',_0xa79bb1='local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)');}_0x32c24f[_0x9f780e(0x153)]({'sqlCode':_0x3bd712['sqlCode'],'sqlName':_0x3bd712[_0x9f780e(0x144)],'filePath':_0x42537b,'status':_0x2d911d,'reason':_0xa79bb1});}return{'method':'POST','url':_0x9f780e(0x13a),'body':{'appCode':_0x540644[_0x9f780e(0x159)],'sqlCode':_0x540644[_0x9f780e(0x14e)](_0x9f780e(0x13e))||null,'sqlName':_0x540644['str'](_0x9f780e(0x157))||null,'files':_0x32c24f},'description':'Would\x20pull\x20'+_0x32c24f['length']+'\x20SQL\x20file(s)\x20into\x20'+_0x57b33b[_0x9f780e(0x14b)]};},async 'execute'(_0x209282){const _0x41544f=a181_0x1787c2,_0x3d85eb=loadSqlProjectConfig(_0x209282[_0x41544f(0x159)]),_0x3b06da=await readSqlLockFile(_0x3d85eb[_0x41544f(0x136)]),{lockData:_0x24e23c,appLock:_0x4b5844}=ensureSqlLockScope(_0x3b06da??createEmptySqlLock(),_0x3d85eb[_0x41544f(0x159)],_0x3d85eb['sqlRoot'],'pull'),_0x5b99f9=_0x209282[_0x41544f(0x13f)]('force'),_0x2b1781=await fetchAllSqlQueries(_0x209282[_0x41544f(0x159)],{'sqlCode':_0x209282[_0x41544f(0x14e)](_0x41544f(0x13e))||undefined,'sqlName':_0x209282[_0x41544f(0x14e)](_0x41544f(0x157))||undefined});if(_0x2b1781[_0x41544f(0x14d)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x41544f(0x152)};const _0x423d30=[],_0x8deff=[];for(const _0x178f84 of _0x2b1781){try{_0x423d30[_0x41544f(0x153)](await ensureSqlContent(_0x178f84));}catch(_0x596687){_0x8deff[_0x41544f(0x153)]({'sqlCode':_0x178f84['sqlCode'],'error':_0x596687 instanceof Error?_0x596687['message']:String(_0x596687)});}}if(_0x5b99f9&&!_0x209282['nonInteractive']){let _0x570df3=![];for(const _0x23a768 of _0x423d30){const _0x5e45f3=detectModeFromSql(_0x23a768),_0x2d2a9a=_0x23a768[_0x41544f(0x167)]?await getDbName(_0x209282['appCode'],Number(_0x23a768[_0x41544f(0x167)]))['catch'](()=>undefined):undefined,_0x51a410=buildLocalSqlFileContent({'sqlCode':_0x23a768['sqlCode'],'sqlName':_0x23a768[_0x41544f(0x144)],'dbId':_0x23a768['dbId']},ensureRemoteSqlContent(_0x23a768),{'dbName':_0x2d2a9a,'mode':_0x5e45f3,'syncedAt':new Date()['toISOString'](),'description':_0x23a768['description']}),_0x4579fd=resolveLocalSqlFilePath(_0x3d85eb,_0x23a768[_0x41544f(0x14c)],buildSqlLockEntry(_0x23a768,ensureRemoteSqlContent(_0x23a768),'',{'dbName':_0x2d2a9a}));if(await fileExists(_0x4579fd)){const _0x4efbdd=await readFile(_0x4579fd,_0x41544f(0x154));if(!isEquivalentPulledSqlFile(_0x4efbdd,_0x51a410,_0x5e45f3)){_0x570df3=!![];break;}}}if(_0x570df3){const _0x222adf=await confirmForceOverwrite(_0x41544f(0x140));if(!_0x222adf)throw CliErrors['cancelled'](_0x41544f(0x135));}}const _0x57b988=cloneSqlLockData(_0x24e23c),_0x29bada=_0x57b988[_0x41544f(0x16a)][_0x3d85eb['appCode']],_0x1e2a26=[],_0x3b63ac=[];for(const _0x5cafa9 of _0x423d30){const _0x403270=_0x29bada[_0x41544f(0x162)][_0x5cafa9['sqlCode']],_0x241233=ensureRemoteSqlContent(_0x5cafa9),_0x197619=detectModeFromSql(_0x5cafa9),_0x15a024=_0x5cafa9[_0x41544f(0x167)]?await getDbName(_0x209282[_0x41544f(0x159)],Number(_0x5cafa9[_0x41544f(0x167)]))[_0x41544f(0x16e)](()=>undefined):undefined,_0x3bce5a=buildLocalSqlFileContent({'sqlCode':_0x5cafa9[_0x41544f(0x14c)],'sqlName':_0x5cafa9[_0x41544f(0x144)],'dbId':_0x5cafa9[_0x41544f(0x167)]},_0x241233,{'dbName':_0x15a024,'mode':_0x197619,'syncedAt':new Date()[_0x41544f(0x15e)](),'description':_0x5cafa9[_0x41544f(0x146)]}),_0x36b7ed=buildSqlLockEntry(_0x5cafa9,_0x241233,computeSqlContentHash(_0x3bce5a),{'dbName':_0x15a024}),_0xb2d7af=_0x36b7ed[_0x41544f(0x139)],_0xe63df2=join(_0x3d85eb[_0x41544f(0x14b)],_0xb2d7af);try{if(await fileExists(_0xe63df2)){const _0x64af21=await readFile(_0xe63df2,_0x41544f(0x154));if(isEquivalentPulledSqlFile(_0x64af21,_0x3bce5a,_0x197619)){_0x3b63ac[_0x41544f(0x153)]({'sqlCode':_0x5cafa9[_0x41544f(0x14c)],'reason':'unchanged'}),_0x29bada[_0x41544f(0x162)][_0x5cafa9['sqlCode']]={..._0x36b7ed,'hash':computeSqlContentHash(_0x64af21),'path':_0xb2d7af};continue;}if(!_0x5b99f9){_0x3b63ac[_0x41544f(0x153)]({'sqlCode':_0x5cafa9['sqlCode'],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x417c8c=_0x403270?.[_0x41544f(0x139)]?join(_0x3d85eb[_0x41544f(0x14b)],_0x403270[_0x41544f(0x139)]):undefined;_0x417c8c&&_0x417c8c!==_0xe63df2&&await fileExists(_0x417c8c)&&await rm(_0x417c8c,{'force':!![]}),await ensureParentDirectory(_0xe63df2),await writeFile(_0xe63df2,_0x3bce5a,_0x41544f(0x154)),_0x29bada[_0x41544f(0x162)][_0x5cafa9[_0x41544f(0x14c)]]={..._0x36b7ed,'path':_0xb2d7af},_0x1e2a26[_0x41544f(0x153)]({'sqlCode':_0x5cafa9[_0x41544f(0x14c)],'filePath':_0xe63df2});}catch(_0x522974){_0x8deff[_0x41544f(0x153)]({'sqlCode':_0x5cafa9[_0x41544f(0x14c)],'error':_0x522974 instanceof Error?_0x522974[_0x41544f(0x141)]:String(_0x522974)});}}return _0x29bada[_0x41544f(0x16b)]=new Date()[_0x41544f(0x15e)](),await writeSqlLockFile(_0x3d85eb[_0x41544f(0x136)],_0x57b988),{'ok':_0x8deff['length']===0x0,'data':{'pulled':_0x1e2a26,'skipped':_0x3b63ac,'failed':_0x8deff},'message':_0x41544f(0x14a)+_0x1e2a26['length']+'\x20written,\x20'+_0x3b63ac['length']+_0x41544f(0x14f)+_0x8deff['length']+_0x41544f(0x15d)};}};function detectModeFromSql(_0x4d75fc){const _0x325949=a181_0x1787c2,_0x13d2b3=ensureRemoteSqlContent(_0x4d75fc),_0x1b0721=stripLocalSqlMetadata(_0x13d2b3,_0x325949(0x137))['trimStart']();if(/^<(select|insert|update|delete)\b/i['test'](_0x1b0721))return _0x325949(0x137);return _0x325949(0x16c);}function isEquivalentPulledSqlFile(_0x42589e,_0x6efecd,_0x1f8295){return normalizePullComparableContent(_0x42589e,_0x1f8295)===normalizePullComparableContent(_0x6efecd,_0x1f8295);}function normalizePullComparableContent(_0x282c3b,_0x1bab23){const _0x1fe7fd=a181_0x1787c2,_0x544a2d=_0x282c3b[_0x1fe7fd(0x142)](/\r\n/g,'\x0a')[_0x1fe7fd(0x15c)]('\x0a'),_0x5e0432=_0x544a2d[_0x1fe7fd(0x164)](_0x335660=>!isSyncedAtMetadataLine(_0x335660,_0x1bab23));return _0x5e0432[_0x1fe7fd(0x158)]('\x0a');}function isSyncedAtMetadataLine(_0x57c4d4,_0x2796f5){const _0x47c8a=a181_0x1787c2;if(_0x2796f5===_0x47c8a(0x137))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x57c4d4);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x47c8a(0x15f)](_0x57c4d4);}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * sql push —— 声明式命令:将本地 SQL 上传到远端
3
+ */
4
+ import type { CommandDefinition } from "../../framework/types.js";
5
+ export declare const sqlPush: CommandDefinition;
@@ -1 +1 @@
1
- const a190_0x15e478=a190_0x1028;(function(_0x5202ab,_0x7976e4){const _0x6eae8d=a190_0x1028,_0x32c838=_0x5202ab();while(!![]){try{const _0x137b94=parseInt(_0x6eae8d(0xc3))/0x1*(-parseInt(_0x6eae8d(0xef))/0x2)+-parseInt(_0x6eae8d(0xbb))/0x3+-parseInt(_0x6eae8d(0xbd))/0x4+-parseInt(_0x6eae8d(0xd3))/0x5+-parseInt(_0x6eae8d(0xde))/0x6+-parseInt(_0x6eae8d(0xe5))/0x7*(-parseInt(_0x6eae8d(0xc6))/0x8)+parseInt(_0x6eae8d(0xdf))/0x9;if(_0x137b94===_0x7976e4)break;else _0x32c838['push'](_0x32c838['shift']());}catch(_0x4ec808){_0x32c838['push'](_0x32c838['shift']());}}}(a190_0x53ba,0x1917d));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';function a190_0x53ba(){const _0x1c9997=['.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','join','toISOString','force','sqlcode','exec','36gsOssM','sqlCode','POST','version','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','dbName','high-risk-write','set','length','unchanged','boolean','445929qqaosV','sql','191720zHRFTx','catch','sqlRootDir','message','Push\x20complete:\x20','has','2671dlpWtB','Local\x20SQL\x20not\x20found:\x20','\x20failed','849672YVwSph','str','lastSync','utf8','path','appCode','No\x20local\x20SQL\x20files\x20found.','sqlName','sqlConfig','filter','No\x20database\x20matches\x20local\x20directory\x20\x22','\x20pushed,\x20','validation','52675MMxYLi','replace','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','sqls','sqlRoot','mode','filePath','push','relativePath','hash','remoteId','630126rQbMoy','3211011YbBnOP','entries','\x22\x20for\x20sqlCode\x20','/smartapi/custom/updateUserCustomSql','Push\x20local\x20SQL\x20files\x20to\x20remote','projectRoot','7dZmNzX','lockFilePath','dbId'];a190_0x53ba=function(){return _0x1c9997;};return a190_0x53ba();}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x5e7ab5,_0x3e78ba,_0x118c7a){const _0x1ff249=a190_0x1028,_0x4a46d1=await scanLocalSqlQueries(_0x5e7ab5),_0xa82136=new Map();for(const _0x33b36c of _0x4a46d1){if(_0x118c7a&&_0x33b36c['sqlCode']!==_0x118c7a)continue;const _0x1a006a=_0xa82136['get'](_0x33b36c[_0x1ff249(0xf0)])??[];_0x1a006a[_0x1ff249(0xda)](_0x33b36c),_0xa82136[_0x1ff249(0xb7)](_0x33b36c['sqlCode'],_0x1a006a);}if(_0x118c7a&&!_0xa82136[_0x1ff249(0xc2)](_0x118c7a))throw CliErrors[_0x1ff249(0xd2)](_0x1ff249(0xc4)+_0x118c7a);const _0x25b597=[];for(const [_0x3dca94,_0x527b61]of _0xa82136[_0x1ff249(0xe0)]()){if(_0x527b61[_0x1ff249(0xb8)]===0x1){_0x25b597[_0x1ff249(0xda)](_0x527b61[0x0]);continue;}const _0x46a741=_0x3e78ba['sqls'][_0x3dca94],_0x2f4a10=_0x46a741?.[_0x1ff249(0xca)],_0x178055=_0x2f4a10?_0x527b61[_0x1ff249(0xcf)](_0x176830=>_0x176830['relativePath']!==_0x2f4a10):_0x527b61;if(_0x46a741&&_0x178055[_0x1ff249(0xb8)]===0x1){_0x25b597[_0x1ff249(0xda)](_0x178055[0x0]);continue;}throw CliErrors[_0x1ff249(0xd2)](_0x1ff249(0xd5)+_0x3dca94+_0x1ff249(0xe8));}return _0x25b597;}function a190_0x1028(_0x5e5b18,_0x288163){_0x5e5b18=_0x5e5b18-0xb4;const _0x53bab5=a190_0x53ba();let _0x10284d=_0x53bab5[_0x5e5b18];return _0x10284d;}export const sqlPush={'service':a190_0x15e478(0xbc),'command':a190_0x15e478(0xda),'description':a190_0x15e478(0xe3),'risk':a190_0x15e478(0xb6),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a190_0x15e478(0xec),'type':a190_0x15e478(0xba),'description':a190_0x15e478(0xb4)}],async 'dryRun'(_0x4021b1){const _0x5d5b34=a190_0x15e478,_0x3181c7=loadSqlProjectConfig(_0x4021b1[_0x5d5b34(0xcb)]),_0x5ea372=await readSqlLockFile(_0x3181c7['lockFilePath']),{appLock:_0x71d142}=ensureSqlLockScope(_0x5ea372??createEmptySqlLock(),_0x4021b1['appCode'],_0x3181c7['sqlRoot'],_0x5d5b34(0xda)),_0x543d07=await getTargetSqlQueries(_0x3181c7,_0x71d142,_0x4021b1[_0x5d5b34(0xc7)](_0x5d5b34(0xed))||undefined),_0x4a7147=[];for(const _0x25a83a of _0x543d07){const _0x7843fa=await computeSqlFileHash(_0x25a83a[_0x5d5b34(0xd9)]),_0x2c66b1=_0x71d142['sqls'][_0x25a83a[_0x5d5b34(0xf0)]],_0x4baa54=!!_0x2c66b1&&(_0x2c66b1[_0x5d5b34(0xca)]!==_0x25a83a[_0x5d5b34(0xdb)]||!!_0x25a83a[_0x5d5b34(0xcd)]&&_0x2c66b1[_0x5d5b34(0xcd)]!==_0x25a83a[_0x5d5b34(0xcd)]);if(!_0x4021b1['bool'](_0x5d5b34(0xec))&&_0x2c66b1&&_0x2c66b1[_0x5d5b34(0xdc)]===_0x7843fa&&!_0x4baa54)continue;_0x4a7147[_0x5d5b34(0xda)](_0x25a83a[_0x5d5b34(0xf0)]);}return{'method':_0x5d5b34(0xf1),'url':_0x5d5b34(0xe2),'body':{'sqlCodes':_0x4a7147,'appCode':_0x4021b1[_0x5d5b34(0xcb)]},'description':'Would\x20push\x20'+_0x4a7147[_0x5d5b34(0xb8)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x2733d7){const _0xc15355=a190_0x15e478,_0x723bba=loadSqlProjectConfig(_0x2733d7[_0xc15355(0xcb)]),_0x14f4f5=await readSqlLockFile(_0x723bba[_0xc15355(0xe6)]),{lockData:_0x5ea3e1,appLock:_0x46344c}=ensureSqlLockScope(_0x14f4f5??createEmptySqlLock(),_0x2733d7[_0xc15355(0xcb)],_0x723bba[_0xc15355(0xd7)],_0xc15355(0xda)),_0x54bdfb=await getTargetSqlQueries(_0x723bba,_0x46344c,_0x2733d7['str'](_0xc15355(0xed))||undefined);if(_0x54bdfb[_0xc15355(0xb8)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0xc15355(0xcc)};const _0xffb0bd=[],_0x28c936=[],_0x35e7a1=[];for(const _0x15a2e6 of _0x54bdfb){const _0x283378=_0x46344c['sqls'][_0x15a2e6['sqlCode']];if(!_0x283378){_0x35e7a1[_0xc15355(0xda)]({'sqlCode':_0x15a2e6[_0xc15355(0xf0)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x12ecc4=await computeSqlFileHash(_0x15a2e6['filePath']),_0x8e7812=_0x283378[_0xc15355(0xca)]!==_0x15a2e6[_0xc15355(0xdb)]||!!_0x15a2e6[_0xc15355(0xcd)]&&_0x283378[_0xc15355(0xcd)]!==_0x15a2e6[_0xc15355(0xcd)];if(!_0x2733d7['bool'](_0xc15355(0xec))&&_0x283378[_0xc15355(0xdc)]===_0x12ecc4&&!_0x8e7812){_0x28c936[_0xc15355(0xda)]({'sqlCode':_0x15a2e6['sqlCode'],'reason':_0xc15355(0xb9)});continue;}if(_0x283378['version']==null){_0x35e7a1[_0xc15355(0xda)]({'sqlCode':_0x15a2e6['sqlCode'],'error':_0xc15355(0xe9)});continue;}const _0x4899f8=await readFile(_0x15a2e6['filePath'],_0xc15355(0xc9)),_0x3dae72=stripLocalSqlMetadata(_0x4899f8,_0x15a2e6[_0xc15355(0xd8)]),_0x3d2295=_0x15a2e6['sqlName']||_0x283378['sqlName'],_0x33b8b2=await resolveTargetDbBinding(_0x2733d7[_0xc15355(0xcb)],_0x15a2e6,_0x283378),_0xe3ad6=await updateSqlQuery({'id':_0x283378[_0xc15355(0xdd)],'appCode':_0x2733d7[_0xc15355(0xcb)],'sqlCode':_0x15a2e6[_0xc15355(0xf0)],'sqlName':_0x3d2295,'dbId':_0x33b8b2[_0xc15355(0xe7)],'version':_0x283378[_0xc15355(0xf2)],'sqlContent':_0x3dae72,'sqlConfig':_0x283378[_0xc15355(0xce)]??undefined}),_0x55a689=_0xe3ad6[_0xc15355(0xe7)]?await getDbName(_0x2733d7['appCode'],Number(_0xe3ad6[_0xc15355(0xe7)]))[_0xc15355(0xbe)](()=>_0x33b8b2[_0xc15355(0xb5)]):_0x33b8b2['dbName'];_0x46344c[_0xc15355(0xd6)][_0x15a2e6['sqlCode']]={...buildSqlLockEntry(_0xe3ad6,_0x3dae72,_0x12ecc4,{'dbName':_0x55a689}),'path':_0x15a2e6[_0xc15355(0xdb)],'mode':_0x283378[_0xc15355(0xd8)]},await archivePreviousSqlFileIfNeeded(_0x723bba,_0x283378[_0xc15355(0xca)],_0x15a2e6[_0xc15355(0xdb)]),_0xffb0bd['push']({'sqlCode':_0x15a2e6[_0xc15355(0xf0)],'remoteId':_0x283378['remoteId']});}catch(_0x2fbf21){_0x35e7a1[_0xc15355(0xda)]({'sqlCode':_0x15a2e6[_0xc15355(0xf0)],'error':_0x2fbf21 instanceof Error?_0x2fbf21[_0xc15355(0xc0)]:String(_0x2fbf21)});}}return _0x46344c[_0xc15355(0xc8)]=new Date()[_0xc15355(0xeb)](),await writeSqlLockFile(_0x723bba[_0xc15355(0xe6)],_0x5ea3e1),{'ok':_0x35e7a1[_0xc15355(0xb8)]===0x0,'data':{'pushed':_0xffb0bd,'skipped':_0x28c936,'failed':_0x35e7a1},'message':_0xc15355(0xc1)+_0xffb0bd[_0xc15355(0xb8)]+_0xc15355(0xd1)+_0x28c936['length']+'\x20skipped,\x20'+_0x35e7a1['length']+_0xc15355(0xc5)};}};async function archivePreviousSqlFileIfNeeded(_0x447ad4,_0x3de255,_0xbed1d3){const _0x227601=a190_0x15e478;if(!_0x3de255||_0x3de255===_0xbed1d3)return;const _0x100cc6=join(_0x447ad4[_0x227601(0xbf)],_0x3de255);if(!await fileExists(_0x100cc6))return;const _0x53b1f7=await moveToTrash(_0x447ad4[_0x227601(0xe4)],_0x447ad4['trashDir'],_0x100cc6);await cleanupEmptyDirectories(dirname(_0x100cc6),_0x447ad4[_0x227601(0xbf)]),void _0x53b1f7;}async function moveToTrash(_0x2a6793,_0x34c3fc,_0x231a69){const _0x101852=a190_0x15e478,_0x1e6011=new Date()[_0x101852(0xeb)]()[_0x101852(0xd4)](/[:.]/g,'-'),_0x2ac4b7=relative(_0x2a6793,_0x231a69),_0x42fdc=join(_0x34c3fc,_0x1e6011,_0x2ac4b7);return await mkdir(dirname(_0x42fdc),{'recursive':!![]}),await rename(_0x231a69,_0x42fdc),_0x42fdc;}async function cleanupEmptyDirectories(_0x4104aa,_0x157a9a){const _0x471b31=a190_0x15e478;let _0x25a800=resolve(_0x4104aa);const _0x23a63e=resolve(_0x157a9a);while(_0x25a800['startsWith'](''+_0x23a63e+sep)||_0x25a800===_0x23a63e){if(_0x25a800===_0x23a63e)return;try{const _0x55328d=await readdir(_0x25a800);if(_0x55328d[_0x471b31(0xb8)]>0x0)return;await rmdir(_0x25a800);}catch{return;}_0x25a800=dirname(_0x25a800);}}async function resolveTargetDbBinding(_0x1983ba,_0x58f451,_0xd966d5){const _0x2da3ad=a190_0x15e478,_0x3b6f11=_0x58f451['dbDirectory'];if(!_0x3b6f11)return{'dbId':_0xd966d5[_0x2da3ad(0xe7)],'dbName':_0xd966d5[_0x2da3ad(0xb5)]};const _0x260699=buildDbDirectoryName(_0xd966d5[_0x2da3ad(0xb5)],_0xd966d5[_0x2da3ad(0xe7)]);if(_0x3b6f11===_0x260699)return{'dbId':_0xd966d5[_0x2da3ad(0xe7)],'dbName':_0xd966d5[_0x2da3ad(0xb5)]};const _0x558974=parseExplicitDbDirectory(_0x3b6f11);if(_0x558974!=null)return{'dbId':_0x558974,'dbName':await getDbName(_0x1983ba,_0x558974)['catch'](()=>undefined)};const _0xf46863=await listDatabases(_0x1983ba),_0x141992=_0xf46863['filter'](_0x32ad8b=>buildDbDirectoryName(_0x32ad8b['dbName'],_0x32ad8b['dbId'])===_0x3b6f11);if(_0x141992[_0x2da3ad(0xb8)]===0x1)return{'dbId':_0x141992[0x0][_0x2da3ad(0xe7)],'dbName':_0x141992[0x0][_0x2da3ad(0xb5)]};if(_0x141992[_0x2da3ad(0xb8)]===0x0)throw CliErrors[_0x2da3ad(0xd2)](_0x2da3ad(0xd0)+_0x3b6f11+_0x2da3ad(0xe1)+_0x58f451[_0x2da3ad(0xf0)]+'.');const _0x475e9e=_0x141992['map'](_0x4b70ea=>_0x4b70ea[_0x2da3ad(0xb5)]+'\x20('+_0x4b70ea[_0x2da3ad(0xe7)]+')')[_0x2da3ad(0xea)](',\x20');throw CliErrors[_0x2da3ad(0xd2)]('Local\x20directory\x20\x22'+_0x3b6f11+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x58f451[_0x2da3ad(0xf0)]+':\x20'+_0x475e9e);}function parseExplicitDbDirectory(_0x4aede0){const _0x426066=a190_0x15e478,_0x4de434=/^db-(\d+)$/[_0x426066(0xee)](_0x4aede0);if(!_0x4de434)return null;const _0x120183=Number(_0x4de434[0x1]);return Number['isFinite'](_0x120183)&&_0x120183>0x0?_0x120183:null;}
1
+ const a182_0x4310b1=a182_0x4b6a;(function(_0x533088,_0x486b37){const _0x423be7=a182_0x4b6a,_0x432cb3=_0x533088();while(!![]){try{const _0x5869fb=parseInt(_0x423be7(0xa3))/0x1*(-parseInt(_0x423be7(0x9a))/0x2)+parseInt(_0x423be7(0xc5))/0x3*(parseInt(_0x423be7(0x8e))/0x4)+parseInt(_0x423be7(0x90))/0x5*(parseInt(_0x423be7(0x8f))/0x6)+parseInt(_0x423be7(0xb8))/0x7*(parseInt(_0x423be7(0x91))/0x8)+-parseInt(_0x423be7(0x92))/0x9+parseInt(_0x423be7(0xc8))/0xa*(parseInt(_0x423be7(0xbb))/0xb)+-parseInt(_0x423be7(0xba))/0xc*(-parseInt(_0x423be7(0xbe))/0xd);if(_0x5869fb===_0x486b37)break;else _0x432cb3['push'](_0x432cb3['shift']());}catch(_0x4ec5e5){_0x432cb3['push'](_0x432cb3['shift']());}}}(a182_0x400d,0x5c897));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a182_0x4b6a(_0x316808,_0x4fcbe0){_0x316808=_0x316808-0x87;const _0x400dc9=a182_0x400d();let _0x4b6ac6=_0x400dc9[_0x316808];return _0x4b6ac6;}import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x72b5e7,_0x3d84b8,_0x13d971){const _0x7b3a78=a182_0x4b6a,_0x18f20f=await scanLocalSqlQueries(_0x72b5e7),_0x167452=new Map();for(const _0x4cce6a of _0x18f20f){if(_0x13d971&&_0x4cce6a['sqlCode']!==_0x13d971)continue;const _0x2b2764=_0x167452[_0x7b3a78(0x93)](_0x4cce6a[_0x7b3a78(0x8c)])??[];_0x2b2764[_0x7b3a78(0xa6)](_0x4cce6a),_0x167452['set'](_0x4cce6a[_0x7b3a78(0x8c)],_0x2b2764);}if(_0x13d971&&!_0x167452[_0x7b3a78(0xa5)](_0x13d971))throw CliErrors[_0x7b3a78(0x9c)](_0x7b3a78(0xbc)+_0x13d971);const _0xcd741=[];for(const [_0x128c8e,_0x219cb5]of _0x167452[_0x7b3a78(0x88)]()){if(_0x219cb5[_0x7b3a78(0xa1)]===0x1){_0xcd741[_0x7b3a78(0xa6)](_0x219cb5[0x0]);continue;}const _0x507d38=_0x3d84b8[_0x7b3a78(0x96)][_0x128c8e],_0x25aaed=_0x507d38?.[_0x7b3a78(0x8a)],_0x2b2e1c=_0x25aaed?_0x219cb5[_0x7b3a78(0xbf)](_0x10c72f=>_0x10c72f[_0x7b3a78(0xad)]!==_0x25aaed):_0x219cb5;if(_0x507d38&&_0x2b2e1c['length']===0x1){_0xcd741['push'](_0x2b2e1c[0x0]);continue;}throw CliErrors[_0x7b3a78(0x9c)](_0x7b3a78(0xb7)+_0x128c8e+_0x7b3a78(0xaa));}return _0xcd741;}function a182_0x400d(){const _0x9f0527=['\x22\x20for\x20sqlCode\x20','has','push','exec','sqlcode','bool','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','No\x20local\x20SQL\x20files\x20found.','POST','relativePath','appCode','sqlRootDir','No\x20database\x20matches\x20local\x20directory\x20\x22','map','join','lockFilePath','str','hash','dbName','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','7aCgusl','dbId','539556sKFROR','77GBLOWU','Local\x20SQL\x20not\x20found:\x20','high-risk-write','104cCNSHn','filter','\x20failed','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','mode','isFinite','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','777381vMczXJ','boolean','unchanged','505490uizQUj','filePath','entries','projectRoot','path','version','sqlCode','\x20skipped,\x20','4BHQzyr','816faQxIY','700dDHtYN','5566992nybMNf','5109939KsqydR','get','Push\x20local\x20SQL\x20files\x20to\x20remote','sqlName','sqls','trashDir','startsWith','force','8564uZQDBq','Would\x20push\x20','validation','\x20pushed,\x20','toISOString','sqlConfig','replace','length','remoteId','173mXczqq'];a182_0x400d=function(){return _0x9f0527;};return a182_0x400d();}export const sqlPush={'service':'sql','command':'push','description':a182_0x4310b1(0x94),'risk':a182_0x4310b1(0xbd),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a182_0x4310b1(0xc6),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x1de58b){const _0x5ed830=a182_0x4310b1,_0x30531b=loadSqlProjectConfig(_0x1de58b[_0x5ed830(0xae)]),_0x59fd77=await readSqlLockFile(_0x30531b['lockFilePath']),{appLock:_0x4d842f}=ensureSqlLockScope(_0x59fd77??createEmptySqlLock(),_0x1de58b[_0x5ed830(0xae)],_0x30531b['sqlRoot'],_0x5ed830(0xa6)),_0x18dcc7=await getTargetSqlQueries(_0x30531b,_0x4d842f,_0x1de58b[_0x5ed830(0xb4)](_0x5ed830(0xa8))||undefined),_0x1375ad=[];for(const _0x3c60c5 of _0x18dcc7){const _0x39ca87=await computeSqlFileHash(_0x3c60c5['filePath']),_0x1afce7=_0x4d842f[_0x5ed830(0x96)][_0x3c60c5['sqlCode']],_0x49ce6b=!!_0x1afce7&&(_0x1afce7['path']!==_0x3c60c5[_0x5ed830(0xad)]||!!_0x3c60c5[_0x5ed830(0x95)]&&_0x1afce7[_0x5ed830(0x95)]!==_0x3c60c5[_0x5ed830(0x95)]);if(!_0x1de58b[_0x5ed830(0xa9)]('force')&&_0x1afce7&&_0x1afce7[_0x5ed830(0xb5)]===_0x39ca87&&!_0x49ce6b)continue;_0x1375ad[_0x5ed830(0xa6)](_0x3c60c5[_0x5ed830(0x8c)]);}return{'method':_0x5ed830(0xac),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x1375ad,'appCode':_0x1de58b[_0x5ed830(0xae)]},'description':_0x5ed830(0x9b)+_0x1375ad['length']+'\x20SQL\x20file(s)'};},async 'execute'(_0x15646e){const _0x2fd423=a182_0x4310b1,_0x34c651=loadSqlProjectConfig(_0x15646e[_0x2fd423(0xae)]),_0x4511b3=await readSqlLockFile(_0x34c651[_0x2fd423(0xb3)]),{lockData:_0x15309f,appLock:_0x3da71b}=ensureSqlLockScope(_0x4511b3??createEmptySqlLock(),_0x15646e[_0x2fd423(0xae)],_0x34c651['sqlRoot'],_0x2fd423(0xa6)),_0x103f4d=await getTargetSqlQueries(_0x34c651,_0x3da71b,_0x15646e[_0x2fd423(0xb4)]('sqlcode')||undefined);if(_0x103f4d[_0x2fd423(0xa1)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x2fd423(0xab)};const _0x9aa56a=[],_0xa6eb22=[],_0x31bb92=[];for(const _0xd7c512 of _0x103f4d){const _0x59ae9b=_0x3da71b[_0x2fd423(0x96)][_0xd7c512['sqlCode']];if(!_0x59ae9b){_0x31bb92[_0x2fd423(0xa6)]({'sqlCode':_0xd7c512[_0x2fd423(0x8c)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x1fff2e=await computeSqlFileHash(_0xd7c512['filePath']),_0x3d6221=_0x59ae9b[_0x2fd423(0x8a)]!==_0xd7c512[_0x2fd423(0xad)]||!!_0xd7c512['sqlName']&&_0x59ae9b[_0x2fd423(0x95)]!==_0xd7c512['sqlName'];if(!_0x15646e[_0x2fd423(0xa9)](_0x2fd423(0x99))&&_0x59ae9b[_0x2fd423(0xb5)]===_0x1fff2e&&!_0x3d6221){_0xa6eb22['push']({'sqlCode':_0xd7c512[_0x2fd423(0x8c)],'reason':_0x2fd423(0xc7)});continue;}if(_0x59ae9b[_0x2fd423(0x8b)]==null){_0x31bb92['push']({'sqlCode':_0xd7c512['sqlCode'],'error':_0x2fd423(0xc1)});continue;}const _0x2a0461=await readFile(_0xd7c512[_0x2fd423(0x87)],'utf8'),_0x39898b=stripLocalSqlMetadata(_0x2a0461,_0xd7c512['mode']),_0x2550c5=_0xd7c512[_0x2fd423(0x95)]||_0x59ae9b[_0x2fd423(0x95)],_0x483863=await resolveTargetDbBinding(_0x15646e[_0x2fd423(0xae)],_0xd7c512,_0x59ae9b),_0x29d305=await updateSqlQuery({'id':_0x59ae9b['remoteId'],'appCode':_0x15646e['appCode'],'sqlCode':_0xd7c512[_0x2fd423(0x8c)],'sqlName':_0x2550c5,'dbId':_0x483863[_0x2fd423(0xb9)],'version':_0x59ae9b[_0x2fd423(0x8b)],'sqlContent':_0x39898b,'sqlConfig':_0x59ae9b[_0x2fd423(0x9f)]??undefined}),_0x54d38e=_0x29d305['dbId']?await getDbName(_0x15646e[_0x2fd423(0xae)],Number(_0x29d305[_0x2fd423(0xb9)]))['catch'](()=>_0x483863['dbName']):_0x483863[_0x2fd423(0xb6)];_0x3da71b['sqls'][_0xd7c512[_0x2fd423(0x8c)]]={...buildSqlLockEntry(_0x29d305,_0x39898b,_0x1fff2e,{'dbName':_0x54d38e}),'path':_0xd7c512[_0x2fd423(0xad)],'mode':_0x59ae9b[_0x2fd423(0xc2)]},await archivePreviousSqlFileIfNeeded(_0x34c651,_0x59ae9b[_0x2fd423(0x8a)],_0xd7c512[_0x2fd423(0xad)]),_0x9aa56a[_0x2fd423(0xa6)]({'sqlCode':_0xd7c512[_0x2fd423(0x8c)],'remoteId':_0x59ae9b[_0x2fd423(0xa2)]});}catch(_0x336a25){_0x31bb92[_0x2fd423(0xa6)]({'sqlCode':_0xd7c512['sqlCode'],'error':_0x336a25 instanceof Error?_0x336a25['message']:String(_0x336a25)});}}return _0x3da71b['lastSync']=new Date()[_0x2fd423(0x9e)](),await writeSqlLockFile(_0x34c651[_0x2fd423(0xb3)],_0x15309f),{'ok':_0x31bb92[_0x2fd423(0xa1)]===0x0,'data':{'pushed':_0x9aa56a,'skipped':_0xa6eb22,'failed':_0x31bb92},'message':'Push\x20complete:\x20'+_0x9aa56a[_0x2fd423(0xa1)]+_0x2fd423(0x9d)+_0xa6eb22[_0x2fd423(0xa1)]+_0x2fd423(0x8d)+_0x31bb92[_0x2fd423(0xa1)]+_0x2fd423(0xc0)};}};async function archivePreviousSqlFileIfNeeded(_0x4cc714,_0x502225,_0x4e64ae){const _0xcbb3bd=a182_0x4310b1;if(!_0x502225||_0x502225===_0x4e64ae)return;const _0x379072=join(_0x4cc714['sqlRootDir'],_0x502225);if(!await fileExists(_0x379072))return;const _0x139dc5=await moveToTrash(_0x4cc714[_0xcbb3bd(0x89)],_0x4cc714[_0xcbb3bd(0x97)],_0x379072);await cleanupEmptyDirectories(dirname(_0x379072),_0x4cc714[_0xcbb3bd(0xaf)]),void _0x139dc5;}async function moveToTrash(_0x3ffb59,_0x43a304,_0x3e6694){const _0x6e2484=a182_0x4310b1,_0x561b99=new Date()[_0x6e2484(0x9e)]()[_0x6e2484(0xa0)](/[:.]/g,'-'),_0x10c3f8=relative(_0x3ffb59,_0x3e6694),_0x1cffb5=join(_0x43a304,_0x561b99,_0x10c3f8);return await mkdir(dirname(_0x1cffb5),{'recursive':!![]}),await rename(_0x3e6694,_0x1cffb5),_0x1cffb5;}async function cleanupEmptyDirectories(_0x163798,_0x47fe4f){const _0x3e1a69=a182_0x4310b1;let _0x11a4c1=resolve(_0x163798);const _0x588b12=resolve(_0x47fe4f);while(_0x11a4c1[_0x3e1a69(0x98)](''+_0x588b12+sep)||_0x11a4c1===_0x588b12){if(_0x11a4c1===_0x588b12)return;try{const _0x4ebde5=await readdir(_0x11a4c1);if(_0x4ebde5['length']>0x0)return;await rmdir(_0x11a4c1);}catch{return;}_0x11a4c1=dirname(_0x11a4c1);}}async function resolveTargetDbBinding(_0xafd2d5,_0x51f047,_0x28140c){const _0x32f184=a182_0x4310b1,_0x46ff13=_0x51f047['dbDirectory'];if(!_0x46ff13)return{'dbId':_0x28140c[_0x32f184(0xb9)],'dbName':_0x28140c[_0x32f184(0xb6)]};const _0x3fed62=buildDbDirectoryName(_0x28140c[_0x32f184(0xb6)],_0x28140c[_0x32f184(0xb9)]);if(_0x46ff13===_0x3fed62)return{'dbId':_0x28140c['dbId'],'dbName':_0x28140c['dbName']};const _0x213c44=parseExplicitDbDirectory(_0x46ff13);if(_0x213c44!=null)return{'dbId':_0x213c44,'dbName':await getDbName(_0xafd2d5,_0x213c44)['catch'](()=>undefined)};const _0x1df44f=await listDatabases(_0xafd2d5),_0x151d5f=_0x1df44f['filter'](_0x501feb=>buildDbDirectoryName(_0x501feb['dbName'],_0x501feb[_0x32f184(0xb9)])===_0x46ff13);if(_0x151d5f[_0x32f184(0xa1)]===0x1)return{'dbId':_0x151d5f[0x0][_0x32f184(0xb9)],'dbName':_0x151d5f[0x0]['dbName']};if(_0x151d5f[_0x32f184(0xa1)]===0x0)throw CliErrors[_0x32f184(0x9c)](_0x32f184(0xb0)+_0x46ff13+_0x32f184(0xa4)+_0x51f047[_0x32f184(0x8c)]+'.');const _0x3eff21=_0x151d5f[_0x32f184(0xb1)](_0x34ed8a=>_0x34ed8a[_0x32f184(0xb6)]+'\x20('+_0x34ed8a[_0x32f184(0xb9)]+')')[_0x32f184(0xb2)](',\x20');throw CliErrors['validation']('Local\x20directory\x20\x22'+_0x46ff13+_0x32f184(0xc4)+_0x51f047[_0x32f184(0x8c)]+':\x20'+_0x3eff21);}function parseExplicitDbDirectory(_0x1501ec){const _0x2e63be=a182_0x4310b1,_0x422bf2=/^db-(\d+)$/[_0x2e63be(0xa7)](_0x1501ec);if(!_0x422bf2)return null;const _0x43257f=Number(_0x422bf2[0x1]);return Number[_0x2e63be(0xc3)](_0x43257f)&&_0x43257f>0x0?_0x43257f:null;}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * sql 子命令共享:本地 SQL 同步体系的共用工具。
3
+ */
4
+ import type { SqlQuery } from "../../core/api-client.js";
5
+ import type { SqlLocalMode, SqlLockEntry, SqlLockFile, SqlLockScope } from "../../core/sql-sync/types.js";
6
+ export declare const SQL_LOCAL_REL_DIR = ".rabetbase/sql";
7
+ export declare function buildSqlLockEntry(sql: SqlQuery, sqlContent: string, hash: string, options?: {
8
+ dbName?: string;
9
+ }): SqlLockEntry;
10
+ export declare function cloneSqlLockData(lockData: SqlLockFile): SqlLockFile;
11
+ export declare function ensureRemoteSqlContent(sql: SqlQuery): string;
12
+ export declare function buildLocalSqlFileContent(sql: Pick<SqlQuery, "sqlCode" | "sqlName" | "dbId">, rawContent: string, options?: {
13
+ dbName?: string;
14
+ mode?: SqlLocalMode;
15
+ syncedAt?: string;
16
+ description?: string | null | undefined;
17
+ }): string;
18
+ export declare function stripLocalSqlMetadata(content: string, mode: SqlLocalMode): string;
19
+ export declare function resolveSqlMode(sqlContent: string, lockEntry?: SqlLockEntry): SqlLocalMode;
20
+ export declare function resolveSqlFileName(sqlCode: string, sqlContent: string, lockEntry?: SqlLockEntry): string;
21
+ export declare function resolveSqlLocalDir(projectRoot: string, appCode: string): string;
22
+ export declare function confirmForceOverwrite(message: string): Promise<boolean>;
23
+ export declare function findSqlLockScope(lockData: SqlLockFile, appCode: string): SqlLockScope | undefined;
@@ -1 +1 @@
1
- const a191_0x101a3c=a191_0x11c7;(function(_0x23dae7,_0x5322f6){const _0xd2a2e3=a191_0x11c7,_0x21752a=_0x23dae7();while(!![]){try{const _0x213296=-parseInt(_0xd2a2e3(0xaa))/0x1*(-parseInt(_0xd2a2e3(0x97))/0x2)+-parseInt(_0xd2a2e3(0xa6))/0x3+parseInt(_0xd2a2e3(0xa0))/0x4*(parseInt(_0xd2a2e3(0xab))/0x5)+-parseInt(_0xd2a2e3(0x9a))/0x6+-parseInt(_0xd2a2e3(0x98))/0x7*(parseInt(_0xd2a2e3(0xa2))/0x8)+parseInt(_0xd2a2e3(0xac))/0x9*(parseInt(_0xd2a2e3(0xb1))/0xa)+parseInt(_0xd2a2e3(0xb0))/0xb;if(_0x213296===_0x5322f6)break;else _0x21752a['push'](_0x21752a['shift']());}catch(_0x13b74b){_0x21752a['push'](_0x21752a['shift']());}}}(a191_0x2657,0xcae85));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a191_0x101a3c(0xa1);export function buildSqlLockEntry(_0x4cdfc6,_0x54ec21,_0x2a13ca,_0x1e7951){const _0x5dda67=a191_0x101a3c,_0x597f02=detectSqlMode(_0x54ec21);return{'path':buildSqlRelativePath(_0x4cdfc6['sqlCode'],_0x4cdfc6[_0x5dda67(0x96)],_0x1e7951?.[_0x5dda67(0x90)],_0x597f02,_0x4cdfc6[_0x5dda67(0x99)]),'hash':_0x2a13ca,'remoteId':_0x4cdfc6['id'],'version':_0x4cdfc6['version'],'dbId':Number(_0x4cdfc6[_0x5dda67(0x99)]),'dbName':_0x1e7951?.[_0x5dda67(0x90)],'sqlName':_0x4cdfc6[_0x5dda67(0x96)],'sqlConfig':_0x4cdfc6[_0x5dda67(0x94)]??undefined,'mode':_0x597f02};}export function cloneSqlLockData(_0x5e98fc){const _0x51ecdf=a191_0x101a3c;return{'apps':Object[_0x51ecdf(0x93)](Object[_0x51ecdf(0xa4)](_0x5e98fc[_0x51ecdf(0xae)])['map'](([_0x515853,_0x40a2b2])=>[_0x515853,{'sqlRoot':_0x40a2b2[_0x51ecdf(0x91)],'lastSync':_0x40a2b2[_0x51ecdf(0x8e)],'sqls':{..._0x40a2b2['sqls']}}]))};}export function ensureRemoteSqlContent(_0x33c937){return _0x33c937['sqlContent']??'';}export function buildLocalSqlFileContent(_0x54116a,_0x2f86e6,_0x51b203){const _0x2c9691=a191_0x101a3c,_0x11507a=_0x51b203?.[_0x2c9691(0x92)]??detectSqlMode(_0x2f86e6),_0x344e56=stripLocalSqlMetadata(_0x2f86e6,_0x11507a)[_0x2c9691(0x9d)](),_0x55dc46=[...buildMetadataHeaderLines({'sqlCode':_0x54116a['sqlCode'],'sqlName':_0x54116a['sqlName'],'dbId':_0x54116a[_0x2c9691(0x99)],'dbName':_0x51b203?.[_0x2c9691(0x90)],'mode':_0x11507a,'syncedAt':_0x51b203?.['syncedAt'],'description':_0x51b203?.[_0x2c9691(0xa9)]},_0x11507a),'',_0x344e56],_0x6dc71d=_0x55dc46[_0x2c9691(0x8b)]('\x0a');return _0x6dc71d[_0x2c9691(0xa3)]('\x0a')?_0x6dc71d:_0x6dc71d+'\x0a';}export function stripLocalSqlMetadata(_0x5d9062,_0x4f9dbd){const _0x46b14c=a191_0x101a3c,_0x122cee=_0x5d9062[_0x46b14c(0x8a)](/\r\n/g,'\x0a')[_0x46b14c(0x8d)]('\x0a'),_0x5714b6=[];let _0x1544fd=0x0;if(_0x4f9dbd===_0x46b14c(0x89))while(_0x1544fd<_0x122cee['length']){const _0x49e2cc=_0x122cee[_0x1544fd]??'';if(/^\s*<!--\s*@lovrabet\./[_0x46b14c(0x9b)](_0x49e2cc)){_0x1544fd++;continue;}if(_0x49e2cc[_0x46b14c(0x9d)]()===''&&_0x1544fd>0x0){_0x1544fd++;continue;}break;}else while(_0x1544fd<_0x122cee[_0x46b14c(0x95)]){const _0x288b02=_0x122cee[_0x1544fd]??'';if(/^\s*--\s*@lovrabet\./['test'](_0x288b02)){_0x1544fd++;continue;}if(_0x288b02[_0x46b14c(0x9d)]()===''&&_0x1544fd>0x0){_0x1544fd++;continue;}break;}for(;_0x1544fd<_0x122cee[_0x46b14c(0x95)];_0x1544fd++){_0x5714b6['push'](_0x122cee[_0x1544fd]);}return _0x5714b6[_0x46b14c(0x8b)]('\x0a')['trimStart']();}function a191_0x2657(){const _0x19b1c2=['17374dQxUOP','dbId','2485314YqLZZN','test','stderr','trim','stdin','map','340nrHBmw','.rabetbase/sql','2320RFXCsj','endsWith','entries','toLowerCase','2970873KieKkx','close','--\x20@lovrabet.','description','27884CIORIH','30415ImUADh','162gazJCG','syncedAt','apps','filter','2997368mRPSdn','877940iBSEAV','mybatisXml','replace','join','question','split','lastSync','\x20-->','dbName','sqlRoot','mode','fromEntries','sqlConfig','length','sqlName','42zucbzA'];a191_0x2657=function(){return _0x19b1c2;};return a191_0x2657();}export function resolveSqlMode(_0x56fae3,_0x2598a8){const _0x433a5f=a191_0x101a3c;if(_0x2598a8?.[_0x433a5f(0x92)])return _0x2598a8[_0x433a5f(0x92)];return detectSqlMode(_0x56fae3);}export function resolveSqlFileName(_0x58ec4d,_0x38da5e,_0x1fb90d){const _0x5e52c3=a191_0x101a3c;if(_0x1fb90d?.['path'])return _0x1fb90d['path'];if(_0x1fb90d?.[_0x5e52c3(0x96)]||_0x1fb90d?.[_0x5e52c3(0x90)])return buildSqlRelativePath(_0x58ec4d,_0x1fb90d?.['sqlName'],_0x1fb90d?.['dbName'],resolveSqlMode(_0x38da5e,_0x1fb90d),_0x1fb90d?.['dbId']);return buildDefaultSqlFileName(_0x58ec4d,resolveSqlMode(_0x38da5e,_0x1fb90d));}function a191_0x11c7(_0x1347d8,_0x118b2f){_0x1347d8=_0x1347d8-0x89;const _0x26572f=a191_0x2657();let _0x11c78c=_0x26572f[_0x1347d8];return _0x11c78c;}export function resolveSqlLocalDir(_0x12c52a,_0x3331b2){return join(_0x12c52a,SQL_LOCAL_REL_DIR,_0x3331b2);}export async function confirmForceOverwrite(_0xd541b8){const _0x587ae9=a191_0x101a3c,_0x42be6b=createInterface({'input':process[_0x587ae9(0x9e)],'output':process[_0x587ae9(0x9c)]}),_0x2a9d27=await new Promise(_0x34469d=>{const _0x3fa763=_0x587ae9;_0x42be6b[_0x3fa763(0x8c)](_0xd541b8+'\x20[y/N]\x20',_0x34469d);});return _0x42be6b[_0x587ae9(0xa7)](),['y','yes']['includes'](_0x2a9d27[_0x587ae9(0x9d)]()[_0x587ae9(0xa5)]());}export function findSqlLockScope(_0x6f4d11,_0x3aa8a7){const _0x44162b=a191_0x101a3c;return _0x6f4d11[_0x44162b(0xae)][_0x3aa8a7];}function buildMetadataHeaderLines(_0x46a985,_0x3d5853){const _0x678cf0=a191_0x101a3c,_0x129ae4=[['sqlCode',_0x46a985['sqlCode']],[_0x678cf0(0x96),_0x46a985[_0x678cf0(0x96)]],[_0x678cf0(0x99),_0x46a985[_0x678cf0(0x99)]],['dbName',_0x46a985[_0x678cf0(0x90)]],['mode',_0x46a985[_0x678cf0(0x92)]],[_0x678cf0(0xad),_0x46a985[_0x678cf0(0xad)]],['description',_0x46a985[_0x678cf0(0xa9)]]];if(_0x3d5853===_0x678cf0(0x89))return _0x129ae4[_0x678cf0(0xaf)](([,_0x518bf3])=>_0x518bf3!==undefined&&_0x518bf3!==null&&String(_0x518bf3)[_0x678cf0(0x9d)]()!=='')['map'](([_0x2b55d1,_0x226cc5])=>'<!--\x20@lovrabet.'+_0x2b55d1+':\x20'+String(_0x226cc5)+_0x678cf0(0x8f));return _0x129ae4[_0x678cf0(0xaf)](([,_0x52fb45])=>_0x52fb45!==undefined&&_0x52fb45!==null&&String(_0x52fb45)[_0x678cf0(0x9d)]()!=='')[_0x678cf0(0x9f)](([_0x206d9c,_0x5c467b])=>_0x678cf0(0xa8)+_0x206d9c+':\x20'+String(_0x5c467b));}
1
+ const a183_0x5ae91a=a183_0x2d2d;(function(_0x57c7d1,_0x32cc09){const _0x566a91=a183_0x2d2d,_0x334934=_0x57c7d1();while(!![]){try{const _0x592f1f=parseInt(_0x566a91(0x1c8))/0x1*(-parseInt(_0x566a91(0x1c5))/0x2)+-parseInt(_0x566a91(0x1bc))/0x3*(-parseInt(_0x566a91(0x1b4))/0x4)+-parseInt(_0x566a91(0x1d0))/0x5*(parseInt(_0x566a91(0x1b1))/0x6)+parseInt(_0x566a91(0x1cd))/0x7+parseInt(_0x566a91(0x1ce))/0x8*(parseInt(_0x566a91(0x1a9))/0x9)+parseInt(_0x566a91(0x1c4))/0xa*(parseInt(_0x566a91(0x1c9))/0xb)+parseInt(_0x566a91(0x1cb))/0xc*(-parseInt(_0x566a91(0x1a3))/0xd);if(_0x592f1f===_0x32cc09)break;else _0x334934['push'](_0x334934['shift']());}catch(_0x132fb3){_0x334934['push'](_0x334934['shift']());}}}(a183_0x3547,0x4431e));import{createInterface}from'node:readline';import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a183_0x5ae91a(0x1a4);export function buildSqlLockEntry(_0x4c3ac5,_0x2954fa,_0x21638b,_0x568705){const _0x19e5e7=a183_0x5ae91a,_0x3042f5=detectSqlMode(_0x2954fa);return{'path':buildSqlRelativePath(_0x4c3ac5['sqlCode'],_0x4c3ac5['sqlName'],_0x568705?.[_0x19e5e7(0x1bd)],_0x3042f5,_0x4c3ac5[_0x19e5e7(0x1be)]),'hash':_0x21638b,'remoteId':_0x4c3ac5['id'],'version':_0x4c3ac5[_0x19e5e7(0x1b7)],'dbId':Number(_0x4c3ac5[_0x19e5e7(0x1be)]),'dbName':_0x568705?.['dbName'],'sqlName':_0x4c3ac5[_0x19e5e7(0x1c7)],'sqlConfig':_0x4c3ac5[_0x19e5e7(0x1ba)]??undefined,'mode':_0x3042f5};}export function cloneSqlLockData(_0x3fa022){const _0x547076=a183_0x5ae91a;return{'apps':Object[_0x547076(0x1b8)](Object[_0x547076(0x1cf)](_0x3fa022[_0x547076(0x1a6)])['map'](([_0x256c47,_0x1c41f2])=>[_0x256c47,{'sqlRoot':_0x1c41f2[_0x547076(0x1b6)],'lastSync':_0x1c41f2['lastSync'],'sqls':{..._0x1c41f2[_0x547076(0x1c1)]}}]))};}export function ensureRemoteSqlContent(_0x52d815){return _0x52d815['sqlContent']??'';}export function buildLocalSqlFileContent(_0x38c336,_0x5ec466,_0x3044aa){const _0x4daf34=a183_0x5ae91a,_0x3f9c7b=_0x3044aa?.[_0x4daf34(0x1aa)]??detectSqlMode(_0x5ec466),_0x271e4c=stripLocalSqlMetadata(_0x5ec466,_0x3f9c7b)['trim'](),_0x3d7984=[...buildMetadataHeaderLines({'sqlCode':_0x38c336[_0x4daf34(0x1a7)],'sqlName':_0x38c336[_0x4daf34(0x1c7)],'dbId':_0x38c336[_0x4daf34(0x1be)],'dbName':_0x3044aa?.[_0x4daf34(0x1bd)],'mode':_0x3f9c7b,'syncedAt':_0x3044aa?.[_0x4daf34(0x1c2)],'description':_0x3044aa?.['description']},_0x3f9c7b),'',_0x271e4c],_0x397397=_0x3d7984[_0x4daf34(0x1ac)]('\x0a');return _0x397397['endsWith']('\x0a')?_0x397397:_0x397397+'\x0a';}export function stripLocalSqlMetadata(_0x4a8ee1,_0x9931a8){const _0x10a214=a183_0x5ae91a,_0x5a51aa=_0x4a8ee1[_0x10a214(0x1c6)](/\r\n/g,'\x0a')[_0x10a214(0x1b5)]('\x0a'),_0x4d1fd4=[];let _0x1c79a6=0x0;if(_0x9931a8===_0x10a214(0x1b3))while(_0x1c79a6<_0x5a51aa[_0x10a214(0x1cc)]){const _0x1acf3a=_0x5a51aa[_0x1c79a6]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x1acf3a)){_0x1c79a6++;continue;}if(_0x1acf3a[_0x10a214(0x1b0)]()===''&&_0x1c79a6>0x0){_0x1c79a6++;continue;}break;}else while(_0x1c79a6<_0x5a51aa[_0x10a214(0x1cc)]){const _0x5728dc=_0x5a51aa[_0x1c79a6]??'';if(/^\s*--\s*@lovrabet\./[_0x10a214(0x1c0)](_0x5728dc)){_0x1c79a6++;continue;}if(_0x5728dc[_0x10a214(0x1b0)]()===''&&_0x1c79a6>0x0){_0x1c79a6++;continue;}break;}for(;_0x1c79a6<_0x5a51aa[_0x10a214(0x1cc)];_0x1c79a6++){_0x4d1fd4[_0x10a214(0x1b9)](_0x5a51aa[_0x1c79a6]);}return _0x4d1fd4[_0x10a214(0x1ac)]('\x0a')['trimStart']();}function a183_0x3547(){const _0x28de88=['test','sqls','syncedAt','description','51710BSKpuN','310vvMQPh','replace','sqlName','1663enfpXm','869sDdzjR','toLowerCase','96Ffghdi','length','1413748gROUvt','962264ZVkkZr','entries','887115fwoAeB','721643iIgMqO','.rabetbase/sql','stdin','apps','sqlCode','--\x20@lovrabet.','18VDkNGZ','mode','stderr','join','filter','path','question','trim','6WARhpu','includes','mybatisXml','7836FePcdh','split','sqlRoot','version','fromEntries','push','sqlConfig','map','471VZMzLv','dbName','dbId','\x20-->'];a183_0x3547=function(){return _0x28de88;};return a183_0x3547();}export function resolveSqlMode(_0x3ffbf9,_0x45130d){const _0x579fff=a183_0x5ae91a;if(_0x45130d?.[_0x579fff(0x1aa)])return _0x45130d[_0x579fff(0x1aa)];return detectSqlMode(_0x3ffbf9);}export function resolveSqlFileName(_0x542d58,_0x18ff19,_0x533dc9){const _0x424625=a183_0x5ae91a;if(_0x533dc9?.['path'])return _0x533dc9[_0x424625(0x1ae)];if(_0x533dc9?.[_0x424625(0x1c7)]||_0x533dc9?.[_0x424625(0x1bd)])return buildSqlRelativePath(_0x542d58,_0x533dc9?.[_0x424625(0x1c7)],_0x533dc9?.['dbName'],resolveSqlMode(_0x18ff19,_0x533dc9),_0x533dc9?.[_0x424625(0x1be)]);return buildDefaultSqlFileName(_0x542d58,resolveSqlMode(_0x18ff19,_0x533dc9));}function a183_0x2d2d(_0x248d20,_0xc7ebdf){_0x248d20=_0x248d20-0x1a3;const _0x35473c=a183_0x3547();let _0x2d2de9=_0x35473c[_0x248d20];return _0x2d2de9;}export function resolveSqlLocalDir(_0x5b7d3c,_0x182631){return join(_0x5b7d3c,SQL_LOCAL_REL_DIR,_0x182631);}export async function confirmForceOverwrite(_0x3b411b){const _0x1aba1f=a183_0x5ae91a,_0x154177=createInterface({'input':process[_0x1aba1f(0x1a5)],'output':process[_0x1aba1f(0x1ab)]}),_0x230abf=await new Promise(_0x363633=>{const _0x351c3b=_0x1aba1f;_0x154177[_0x351c3b(0x1af)](_0x3b411b+'\x20[y/N]\x20',_0x363633);});return _0x154177['close'](),['y','yes'][_0x1aba1f(0x1b2)](_0x230abf['trim']()[_0x1aba1f(0x1ca)]());}export function findSqlLockScope(_0x76cc01,_0x5a8ce9){const _0x5449b2=a183_0x5ae91a;return _0x76cc01[_0x5449b2(0x1a6)][_0x5a8ce9];}function buildMetadataHeaderLines(_0x75848e,_0x3775eb){const _0x4c9d21=a183_0x5ae91a,_0x6f1577=[[_0x4c9d21(0x1a7),_0x75848e[_0x4c9d21(0x1a7)]],[_0x4c9d21(0x1c7),_0x75848e[_0x4c9d21(0x1c7)]],[_0x4c9d21(0x1be),_0x75848e[_0x4c9d21(0x1be)]],[_0x4c9d21(0x1bd),_0x75848e[_0x4c9d21(0x1bd)]],[_0x4c9d21(0x1aa),_0x75848e[_0x4c9d21(0x1aa)]],[_0x4c9d21(0x1c2),_0x75848e[_0x4c9d21(0x1c2)]],['description',_0x75848e[_0x4c9d21(0x1c3)]]];if(_0x3775eb===_0x4c9d21(0x1b3))return _0x6f1577[_0x4c9d21(0x1ad)](([,_0xfbbc31])=>_0xfbbc31!==undefined&&_0xfbbc31!==null&&String(_0xfbbc31)['trim']()!=='')['map'](([_0x15a07d,_0x37e508])=>'<!--\x20@lovrabet.'+_0x15a07d+':\x20'+String(_0x37e508)+_0x4c9d21(0x1bf));return _0x6f1577['filter'](([,_0x5f4f80])=>_0x5f4f80!==undefined&&_0x5f4f80!==null&&String(_0x5f4f80)[_0x4c9d21(0x1b0)]()!=='')[_0x4c9d21(0x1bb)](([_0x53cfbf,_0x4b2758])=>_0x4c9d21(0x1a8)+_0x53cfbf+':\x20'+String(_0x4b2758));}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * sql status —— 声明式命令:检查本地 SQL 同步状态
3
+ */
4
+ import type { CommandDefinition } from "../../framework/types.js";
5
+ export declare const sqlStatus: CommandDefinition;