@lovrabet/rabetbase-cli 2.3.10-beta.2 → 2.3.11-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/fetch-model-list.js +1 -1
  3. package/lib/api/generate-api-file.js +1 -1
  4. package/lib/auth/auth-server-ui.js +1 -1
  5. package/lib/auth/auth-server.js +1 -1
  6. package/lib/auth/constant.js +1 -1
  7. package/lib/auth/get-cookie.js +1 -1
  8. package/lib/auth/get-session-user.js +1 -1
  9. package/lib/auth/is-session-valid.js +1 -1
  10. package/lib/auth/login-success-html.js +1 -1
  11. package/lib/auth/logout.js +1 -1
  12. package/lib/cli-flags.js +1 -1
  13. package/lib/cli.js +1 -1
  14. package/lib/commands/api/generate.js +1 -1
  15. package/lib/commands/api/index.js +1 -1
  16. package/lib/commands/api/list.js +1 -1
  17. package/lib/commands/api/pull.js +1 -1
  18. package/lib/commands/api/shared.js +1 -1
  19. package/lib/commands/app/add.js +1 -1
  20. package/lib/commands/app/index.js +1 -1
  21. package/lib/commands/app/list.js +1 -1
  22. package/lib/commands/app/remote-directory.js +1 -1
  23. package/lib/commands/app/remove.js +1 -1
  24. package/lib/commands/app/shared.js +1 -1
  25. package/lib/commands/app-config/delete.js +1 -1
  26. package/lib/commands/app-config/get.js +1 -1
  27. package/lib/commands/app-config/index.js +1 -1
  28. package/lib/commands/app-config/list.js +1 -1
  29. package/lib/commands/app-config/set.js +1 -1
  30. package/lib/commands/app-config/shared.js +1 -1
  31. package/lib/commands/auth/index.js +1 -1
  32. package/lib/commands/bff/create.js +1 -1
  33. package/lib/commands/bff/delete.js +1 -1
  34. package/lib/commands/bff/detail.js +1 -1
  35. package/lib/commands/bff/index.js +1 -1
  36. package/lib/commands/bff/list.js +1 -1
  37. package/lib/commands/bff/pull.js +1 -1
  38. package/lib/commands/bff/push.js +1 -1
  39. package/lib/commands/bff/status.js +1 -1
  40. package/lib/commands/cli-skill/index.js +1 -1
  41. package/lib/commands/cli-update.js +1 -1
  42. package/lib/commands/codegen/index.js +1 -1
  43. package/lib/commands/codegen/sdk.js +1 -1
  44. package/lib/commands/codegen/sql.js +1 -1
  45. package/lib/commands/common/app-registry.js +1 -1
  46. package/lib/commands/common/app-selector.js +1 -1
  47. package/lib/commands/common/async-task.js +1 -1
  48. package/lib/commands/common/dry-run.js +1 -1
  49. package/lib/commands/common/flags.js +1 -1
  50. package/lib/commands/common/local-file.js +1 -1
  51. package/lib/commands/common/validate.js +1 -1
  52. package/lib/commands/config/get.js +1 -1
  53. package/lib/commands/config/index.js +1 -1
  54. package/lib/commands/config/list.js +1 -1
  55. package/lib/commands/config/set.js +1 -1
  56. package/lib/commands/config/shared.js +1 -1
  57. package/lib/commands/data/filter.js +1 -1
  58. package/lib/commands/data/getOne.js +1 -1
  59. package/lib/commands/data/index.js +1 -1
  60. package/lib/commands/data/shared.js +1 -1
  61. package/lib/commands/dataset/business-group-update.js +1 -1
  62. package/lib/commands/dataset/capability.js +1 -1
  63. package/lib/commands/dataset/delete.js +1 -1
  64. package/lib/commands/dataset/detail.js +1 -1
  65. package/lib/commands/dataset/extend-update.js +1 -1
  66. package/lib/commands/dataset/field-update.js +1 -1
  67. package/lib/commands/dataset/generate.js +1 -1
  68. package/lib/commands/dataset/index.js +1 -1
  69. package/lib/commands/dataset/list.js +1 -1
  70. package/lib/commands/dataset/operations.js +1 -1
  71. package/lib/commands/dataset/relation-audit.js +1 -1
  72. package/lib/commands/dataset/relation-create.js +1 -1
  73. package/lib/commands/dataset/relation-delete.js +1 -1
  74. package/lib/commands/dataset/relation-shared.js +1 -1
  75. package/lib/commands/dataset/relation-update.js +1 -1
  76. package/lib/commands/dataset/relations.js +1 -1
  77. package/lib/commands/dataset/rename.js +1 -1
  78. package/lib/commands/dataset/restore.js +1 -1
  79. package/lib/commands/db/analysis-batching.js +1 -1
  80. package/lib/commands/db/analyze-batch-plan.js +1 -1
  81. package/lib/commands/db/analyze-cancel.js +1 -1
  82. package/lib/commands/db/analyze-start.js +1 -1
  83. package/lib/commands/db/analyze-status.js +1 -1
  84. package/lib/commands/db/create.js +1 -1
  85. package/lib/commands/db/delete.js +1 -1
  86. package/lib/commands/db/detail.js +1 -1
  87. package/lib/commands/db/diff.js +1 -1
  88. package/lib/commands/db/index.js +1 -1
  89. package/lib/commands/db/list.js +1 -1
  90. package/lib/commands/db/shared.js +1 -1
  91. package/lib/commands/db/tables.js +1 -1
  92. package/lib/commands/db/test.js +1 -1
  93. package/lib/commands/db/update.js +1 -1
  94. package/lib/commands/doctor.js +1 -1
  95. package/lib/commands/file/index.js +1 -1
  96. package/lib/commands/init/index.js +1 -1
  97. package/lib/commands/issue/index.js +1 -1
  98. package/lib/commands/issue/nudge.js +1 -1
  99. package/lib/commands/issue/report.js +1 -1
  100. package/lib/commands/issue/shared.js +1 -1
  101. package/lib/commands/logs/index.js +1 -1
  102. package/lib/commands/menu/delete.js +1 -1
  103. package/lib/commands/menu/external-link-create.js +1 -1
  104. package/lib/commands/menu/group-create.js +1 -1
  105. package/lib/commands/menu/group-update.js +1 -1
  106. package/lib/commands/menu/index.js +1 -1
  107. package/lib/commands/menu/list.js +1 -1
  108. package/lib/commands/menu/move.js +1 -0
  109. package/lib/commands/menu/regroup-start.js +1 -1
  110. package/lib/commands/menu/shared/compare-table.js +1 -1
  111. package/lib/commands/menu/shared/delete-plan.js +1 -1
  112. package/lib/commands/menu/shared/facts.js +1 -1
  113. package/lib/commands/menu/shared/index.js +1 -1
  114. package/lib/commands/menu/shared/inquirer.js +1 -1
  115. package/lib/commands/menu/shared/local-pages.js +1 -1
  116. package/lib/commands/menu/shared/logic.js +1 -1
  117. package/lib/commands/menu/shared/mutations.js +1 -1
  118. package/lib/commands/menu/shared/service.js +1 -1
  119. package/lib/commands/menu/shared/sync-core.js +1 -1
  120. package/lib/commands/menu/shared/update-core.js +1 -1
  121. package/lib/commands/menu/shared/valid-url.js +1 -1
  122. package/lib/commands/menu/sync.js +1 -1
  123. package/lib/commands/menu/update.js +1 -1
  124. package/lib/commands/notification/config-list.js +1 -1
  125. package/lib/commands/notification/index.js +1 -1
  126. package/lib/commands/page/generate-start.js +1 -1
  127. package/lib/commands/page/generate-status.js +1 -1
  128. package/lib/commands/page/index.js +1 -1
  129. package/lib/commands/page/pull.js +1 -1
  130. package/lib/commands/page/push.js +1 -1
  131. package/lib/commands/page/relation-audit.js +1 -1
  132. package/lib/commands/page/shared.js +1 -1
  133. package/lib/commands/page/standard-page-status.js +1 -1
  134. package/lib/commands/page/sync.js +1 -1
  135. package/lib/commands/permit/index.js +1 -1
  136. package/lib/commands/permit/page-get.js +1 -1
  137. package/lib/commands/permit/page-set.js +1 -1
  138. package/lib/commands/permit/role-apis-set.js +1 -1
  139. package/lib/commands/permit/role-menus-set.js +1 -1
  140. package/lib/commands/permit/role-menus.js +1 -1
  141. package/lib/commands/permit/shared.js +1 -1
  142. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  143. package/lib/commands/project/create/format-elapsed.js +1 -1
  144. package/lib/commands/project/create/main.js +1 -1
  145. package/lib/commands/project/create/non-interactive.js +1 -1
  146. package/lib/commands/project/create/project-template-path.js +1 -1
  147. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  148. package/lib/commands/project/create/use-format-code.js +1 -1
  149. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  150. package/lib/commands/project/index.js +1 -1
  151. package/lib/commands/project/init.js +1 -1
  152. package/lib/commands/project/upgrade.js +1 -1
  153. package/lib/commands/registry.js +1 -1
  154. package/lib/commands/role/create.js +1 -1
  155. package/lib/commands/role/delete.js +1 -1
  156. package/lib/commands/role/detail.js +1 -1
  157. package/lib/commands/role/index.js +1 -1
  158. package/lib/commands/role/list.js +1 -1
  159. package/lib/commands/role/shared.js +1 -1
  160. package/lib/commands/role/update.js +1 -1
  161. package/lib/commands/role/user-add.js +1 -1
  162. package/lib/commands/role/user-remove.js +1 -1
  163. package/lib/commands/role/user-resolve.js +1 -1
  164. package/lib/commands/run/index.js +1 -1
  165. package/lib/commands/schema.js +1 -1
  166. package/lib/commands/sql/create.js +1 -1
  167. package/lib/commands/sql/delete.js +1 -1
  168. package/lib/commands/sql/detail.js +1 -1
  169. package/lib/commands/sql/exec.js +1 -1
  170. package/lib/commands/sql/index.js +1 -1
  171. package/lib/commands/sql/list.js +1 -1
  172. package/lib/commands/sql/pull.js +1 -1
  173. package/lib/commands/sql/push.js +1 -1
  174. package/lib/commands/sql/save.js +1 -1
  175. package/lib/commands/sql/shared.js +1 -1
  176. package/lib/commands/sql/status.js +1 -1
  177. package/lib/commands/sql/validate.js +1 -1
  178. package/lib/commands/task/index.js +1 -1
  179. package/lib/commands/task/status.js +1 -1
  180. package/lib/commands/workspace/add.js +1 -1
  181. package/lib/commands/workspace/index.js +1 -1
  182. package/lib/commands/workspace/remove.js +1 -1
  183. package/lib/config/schema.js +1 -1
  184. package/lib/constant/cdn.js +1 -1
  185. package/lib/constant/cli.js +1 -1
  186. package/lib/constant/defaults.js +1 -1
  187. package/lib/constant/domain.js +1 -1
  188. package/lib/constant/env.js +1 -1
  189. package/lib/constant/output.js +1 -1
  190. package/lib/constant/paths.js +1 -1
  191. package/lib/constant/risk.js +1 -1
  192. package/lib/context/app-resolver.js +1 -1
  193. package/lib/context/auth-resolver.js +1 -1
  194. package/lib/context/config-loader.js +1 -1
  195. package/lib/context.js +1 -1
  196. package/lib/core/alias-resolver.js +1 -1
  197. package/lib/core/api-client.js +1 -1
  198. package/lib/core/bff/config.js +1 -1
  199. package/lib/core/bff/file-system.js +1 -1
  200. package/lib/core/bff/hash.js +1 -1
  201. package/lib/core/bff/lock.js +1 -1
  202. package/lib/core/bff/utils.js +1 -1
  203. package/lib/core/db-resolver.js +1 -1
  204. package/lib/core/page/file-system.js +1 -1
  205. package/lib/core/page/hash.js +1 -1
  206. package/lib/core/page/lock.js +1 -1
  207. package/lib/core/sql-index-auditor.js +1 -1
  208. package/lib/core/sql-sync/config.js +1 -1
  209. package/lib/core/sql-sync/file-system.js +1 -1
  210. package/lib/core/sql-sync/hash.js +1 -1
  211. package/lib/core/sql-sync/lock.js +1 -1
  212. package/lib/core/sql-sync/utils.js +1 -1
  213. package/lib/core/sql-validator.js +1 -1
  214. package/lib/errors.js +1 -1
  215. package/lib/framework/build-all-flags.js +1 -1
  216. package/lib/framework/error-output.js +1 -1
  217. package/lib/framework/explicit-yes.js +1 -1
  218. package/lib/framework/flags.js +1 -1
  219. package/lib/framework/help.js +1 -1
  220. package/lib/framework/index.js +1 -1
  221. package/lib/framework/output.js +1 -1
  222. package/lib/framework/response.js +1 -1
  223. package/lib/framework/runner-alias.js +1 -1
  224. package/lib/framework/runner.js +1 -1
  225. package/lib/framework/schema-export.js +1 -1
  226. package/lib/framework/types.js +1 -1
  227. package/lib/generated/build-info.js +1 -1
  228. package/lib/help.js +1 -1
  229. package/lib/skills/main.js +1 -1
  230. package/lib/skills/npx-skills-add.js +1 -1
  231. package/lib/telemetry/cli-command-trace.js +1 -1
  232. package/lib/telemetry/cli-help-trace.js +1 -1
  233. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  234. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  235. package/lib/telemetry/send-cli-trace-log.js +1 -1
  236. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  237. package/lib/utils/ai_config.js +1 -1
  238. package/lib/utils/apply-jq-filter.js +1 -1
  239. package/lib/utils/cdn-config.js +1 -1
  240. package/lib/utils/check-sdk-version.js +1 -1
  241. package/lib/utils/cli-version-check.js +1 -1
  242. package/lib/utils/cli-version-policy.js +1 -1
  243. package/lib/utils/config.js +1 -1
  244. package/lib/utils/copy-directory.js +1 -1
  245. package/lib/utils/entity-with-id.js +1 -1
  246. package/lib/utils/file-utils.js +1 -1
  247. package/lib/utils/guides-cdn.js +1 -1
  248. package/lib/utils/http-client.js +1 -1
  249. package/lib/utils/is-non-interactive.js +1 -1
  250. package/lib/utils/logger.js +1 -1
  251. package/lib/utils/params.js +1 -1
  252. package/lib/utils/platform.js +1 -1
  253. package/lib/utils/rules-cdn.js +1 -1
  254. package/lib/utils/sleep.js +1 -1
  255. package/lib/utils/template-replacer.js +1 -1
  256. package/lib/utils/update-notice.js +1 -1
  257. package/lib/utils/version.js +1 -1
  258. package/lib/utils/with-active-cookie.js +1 -1
  259. package/lib/utils/write-cli-side-channel.js +1 -1
  260. package/package.json +1 -1
@@ -1 +1 @@
1
- const a163_0x34b64e=a163_0x1fef;(function(_0x4d2389,_0xed23e4){const _0x384496=a163_0x1fef,_0x271253=_0x4d2389();while(!![]){try{const _0x2e7344=-parseInt(_0x384496(0x124))/0x1*(parseInt(_0x384496(0x120))/0x2)+-parseInt(_0x384496(0x147))/0x3+-parseInt(_0x384496(0x125))/0x4*(parseInt(_0x384496(0x136))/0x5)+-parseInt(_0x384496(0x139))/0x6+parseInt(_0x384496(0x143))/0x7+-parseInt(_0x384496(0x12e))/0x8*(-parseInt(_0x384496(0x153))/0x9)+parseInt(_0x384496(0x144))/0xa;if(_0x2e7344===_0xed23e4)break;else _0x271253['push'](_0x271253['shift']());}catch(_0x12bc20){_0x271253['push'](_0x271253['shift']());}}}(a163_0x4fa6,0xcac93));function a163_0x1fef(_0x26accc,_0x4ec1db){_0x26accc=_0x26accc-0x120;const _0x4fa642=a163_0x4fa6();let _0x1fef7a=_0x4fa642[_0x26accc];return _0x1fef7a;}import{readFileSync,existsSync}from'node:fs';function a163_0x4fa6(){const _0x534010=['yarn','needsUpgrade','vite','args','boolean','script','bun.lockb','parse','7402444jCYAmA','16038590PeyuBV','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','npm','1624638VGsokA','run','Available:\x20','error','\x20\x20\x20\x20','Run\x20a\x20package.json\x20script','pnpm','package.json','join','log','keys','belowMinimum','811827mDnzND','push','vite\x20preview\x20exited\x20with\x20code\x20','\x0a\x20\x20Available\x20scripts:\x0a','Script\x20\x22','cwd','close','bool','\x20exited\x20with\x20code\x20','\x20run\x20build','utf-8','scripts','yarn.lock','\x20run\x20<script>\x0a','52772mDfiPm','Enable\x20watch\x20mode\x20for\x20preview','read','--watch','5SHMKdN','58228tNAUHc','\x20run\x20preview','.bin','\x20run\x20','validation','\x20\x20EXAMPLES','node_modules','pnpm-lock.yaml','all','8IdmmRH','Script\x20name\x20defined\x20in\x20package.json','has','dev','(none)','inherit','\x0a\x20\x20Usage:\x20','bun','400icEmsW','watch','slice','497442RuedgZ','preview'];a163_0x4fa6=function(){return _0x534010;};return a163_0x4fa6();}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',a163_0x34b64e(0x131)]);function readPackageScripts(_0x1bb097){const _0x183aab=a163_0x34b64e,_0x6b27d5=resolve(_0x1bb097,_0x183aab(0x14e));if(!existsSync(_0x6b27d5))return null;try{const _0x11af5d=JSON[_0x183aab(0x142)](readFileSync(_0x6b27d5,_0x183aab(0x15d)));return _0x11af5d[_0x183aab(0x15e)]??{};}catch{return null;}}function detectPackageManager(_0x428abc){const _0x50b230=a163_0x34b64e;if(existsSync(resolve(_0x428abc,_0x50b230(0x141)))||existsSync(resolve(_0x428abc,'bun.lock')))return _0x50b230(0x135);if(existsSync(resolve(_0x428abc,_0x50b230(0x12c))))return _0x50b230(0x14d);if(existsSync(resolve(_0x428abc,_0x50b230(0x15f))))return _0x50b230(0x13b);return _0x50b230(0x146);}async function versionCheck(_0x3ac9bc){const _0x6aec97=a163_0x34b64e,_0x1361ef=await checkCliVersion();(_0x1361ef[_0x6aec97(0x13c)]||_0x1361ef[_0x6aec97(0x152)])&&(printCliUpgradeWarning(_0x1361ef),assertCliVersionSupported(_0x1361ef));const _0x678b3d=await checkSdkVersion(_0x3ac9bc);if(_0x678b3d['needsUpgrade'])printSdkUpgradeWarning(_0x678b3d);}function spawnScript(_0x222e82,_0x24e23f,_0x198b71,_0x1d9058){return new Promise((_0x4cf632,_0x5e97dc)=>{const _0x143d41=a163_0x1fef,_0x26cc42=['run',_0x24e23f,..._0x198b71],_0x256293=spawn(_0x222e82,_0x26cc42,{'cwd':_0x1d9058,'stdio':_0x143d41(0x133),'shell':!![],'env':{...process.env,'PATH':''+join(_0x1d9058,_0x143d41(0x12b),_0x143d41(0x127))+delimiter+process.env.PATH}});_0x256293['on'](_0x143d41(0x159),_0x49c4cf=>{const _0xe42c59=_0x143d41;if(_0x49c4cf===0x0||_0x49c4cf===null)_0x4cf632();else _0x5e97dc(new Error(_0x222e82+_0xe42c59(0x128)+_0x24e23f+_0xe42c59(0x15b)+_0x49c4cf));}),_0x256293['on'](_0x143d41(0x14a),_0x5e97dc);});}function spawnViteBuildWatch(_0x2e7216){return new Promise((_0x178c76,_0x159f7d)=>{const _0x4c9c87=a163_0x1fef,_0x3d39bd=spawn(_0x4c9c87(0x13d),['build',_0x4c9c87(0x123)],{'cwd':_0x2e7216,'stdio':_0x4c9c87(0x133),'shell':!![],'env':{...process.env,'PATH':''+join(_0x2e7216,_0x4c9c87(0x12b),_0x4c9c87(0x127))+delimiter+process.env.PATH}});_0x3d39bd['on'](_0x4c9c87(0x159),_0x1d26e3=>{const _0x13b2d2=_0x4c9c87;if(_0x1d26e3===0x0||_0x1d26e3===null)_0x178c76();else _0x159f7d(new Error(_0x13b2d2(0x145)+_0x1d26e3));}),_0x3d39bd['on'](_0x4c9c87(0x14a),_0x159f7d);});}function spawnVitePreview(_0x538667){return new Promise((_0x221c90,_0x195440)=>{const _0x48c6da=a163_0x1fef,_0x5df7b3=spawn(_0x48c6da(0x13d),['preview'],{'cwd':_0x538667,'stdio':_0x48c6da(0x133),'shell':!![],'env':{...process.env,'PATH':''+join(_0x538667,'node_modules',_0x48c6da(0x127))+delimiter+process.env.PATH}});_0x5df7b3['on'](_0x48c6da(0x159),_0x416a59=>{const _0xa5b4bd=_0x48c6da;if(_0x416a59===0x0||_0x416a59===null)_0x221c90();else _0x195440(new Error(_0xa5b4bd(0x155)+_0x416a59));}),_0x5df7b3['on'](_0x48c6da(0x14a),_0x195440);});}const runFlags=[{'name':a163_0x34b64e(0x137),'type':a163_0x34b64e(0x13f),'description':a163_0x34b64e(0x121),'default':![]}];export const runDefinition={'service':a163_0x34b64e(0x148),'command':a163_0x34b64e(0x148),'description':a163_0x34b64e(0x14c),'risk':a163_0x34b64e(0x122),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a163_0x34b64e(0x140),'description':a163_0x34b64e(0x12f),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x4f3856=a163_0x34b64e,_0x362ffd=[];return _0x362ffd[_0x4f3856(0x154)](_0x4f3856(0x12a)),_0x362ffd[_0x4f3856(0x154)](_0x4f3856(0x14b)+CLI_BIN_NAME+'\x20run\x20start'),_0x362ffd[_0x4f3856(0x154)](_0x4f3856(0x14b)+CLI_BIN_NAME+_0x4f3856(0x15c)),_0x362ffd['push'](_0x4f3856(0x14b)+CLI_BIN_NAME+_0x4f3856(0x126)),_0x362ffd[_0x4f3856(0x154)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x362ffd[_0x4f3856(0x14f)]('\x0a');},async 'execute'(_0x37d161){const _0x2e10b5=a163_0x34b64e,_0x4ce108=process[_0x2e10b5(0x158)](),_0x796248=_0x37d161[_0x2e10b5(0x13e)][0x0],_0x2cef22=_0x37d161[_0x2e10b5(0x13e)][_0x2e10b5(0x138)](0x1),_0x1b889e=readPackageScripts(_0x4ce108);if(!_0x1b889e)throw CliErrors[_0x2e10b5(0x129)]('No\x20package.json\x20found\x20in\x20current\x20directory.');if(!_0x796248){const _0x38ab75=Object[_0x2e10b5(0x151)](_0x1b889e);if(_0x38ab75['length']===0x0)console[_0x2e10b5(0x150)]('No\x20scripts\x20defined\x20in\x20package.json.');else{console['log'](_0x2e10b5(0x156));for(const _0xb8342e of _0x38ab75){console[_0x2e10b5(0x150)](_0x2e10b5(0x14b)+_0xb8342e);}console[_0x2e10b5(0x150)](_0x2e10b5(0x134)+CLI_BIN_NAME+_0x2e10b5(0x160));}return{'ok':!![]};}if(!_0x1b889e[_0x796248])throw CliErrors['validation'](_0x2e10b5(0x157)+_0x796248+'\x22\x20not\x20found\x20in\x20package.json.',_0x2e10b5(0x149)+(Object['keys'](_0x1b889e)['join'](',\x20')||_0x2e10b5(0x132)));const _0x37a2a3=detectPackageManager(_0x4ce108);VERSION_CHECK_SCRIPTS[_0x2e10b5(0x130)](_0x796248)&&await versionCheck(_0x4ce108);if(_0x796248===_0x2e10b5(0x13a)&&_0x37d161[_0x2e10b5(0x15a)](_0x2e10b5(0x137)))return await Promise[_0x2e10b5(0x12d)]([spawnViteBuildWatch(_0x4ce108),spawnVitePreview(_0x4ce108)]),{'ok':!![]};return await spawnScript(_0x37a2a3,_0x796248,_0x2cef22,_0x4ce108),{'ok':!![]};}};
1
+ const a164_0x25fb7a=a164_0x1455;(function(_0x4f3f75,_0x960ce5){const _0x401196=a164_0x1455,_0x10d821=_0x4f3f75();while(!![]){try{const _0x4a004a=parseInt(_0x401196(0x1cf))/0x1+-parseInt(_0x401196(0x19b))/0x2*(-parseInt(_0x401196(0x1b8))/0x3)+-parseInt(_0x401196(0x1bb))/0x4*(parseInt(_0x401196(0x1a5))/0x5)+-parseInt(_0x401196(0x1b5))/0x6*(-parseInt(_0x401196(0x1b1))/0x7)+-parseInt(_0x401196(0x19c))/0x8*(-parseInt(_0x401196(0x1cc))/0x9)+-parseInt(_0x401196(0x195))/0xa*(-parseInt(_0x401196(0x1ad))/0xb)+-parseInt(_0x401196(0x1a6))/0xc;if(_0x4a004a===_0x960ce5)break;else _0x10d821['push'](_0x10d821['shift']());}catch(_0x3c8f9d){_0x10d821['push'](_0x10d821['shift']());}}}(a164_0x28d2,0x770a8));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',a164_0x25fb7a(0x19d)]);function readPackageScripts(_0x120846){const _0x430f22=a164_0x25fb7a,_0x74d089=resolve(_0x120846,_0x430f22(0x1b3));if(!existsSync(_0x74d089))return null;try{const _0x1abf2d=JSON['parse'](readFileSync(_0x74d089,_0x430f22(0x1c4)));return _0x1abf2d[_0x430f22(0x1d1)]??{};}catch{return null;}}function detectPackageManager(_0x5d9ef2){const _0x29d3a3=a164_0x25fb7a;if(existsSync(resolve(_0x5d9ef2,_0x29d3a3(0x1c0)))||existsSync(resolve(_0x5d9ef2,_0x29d3a3(0x1ce))))return'bun';if(existsSync(resolve(_0x5d9ef2,_0x29d3a3(0x1ac))))return'pnpm';if(existsSync(resolve(_0x5d9ef2,_0x29d3a3(0x1af))))return _0x29d3a3(0x197);return _0x29d3a3(0x1d3);}async function versionCheck(_0x336e05){const _0x1f2a8b=a164_0x25fb7a,_0x30555c=await checkCliVersion();(_0x30555c['needsUpgrade']||_0x30555c['belowMinimum'])&&(printCliUpgradeWarning(_0x30555c),assertCliVersionSupported(_0x30555c));const _0x79d224=await checkSdkVersion(_0x336e05);if(_0x79d224[_0x1f2a8b(0x1cd)])printSdkUpgradeWarning(_0x79d224);}function spawnScript(_0x580a7b,_0x54e1a0,_0x50c4c7,_0x5d0cb0){return new Promise((_0x205f2f,_0x13ca8f)=>{const _0x543e66=a164_0x1455,_0x2dfaf3=[_0x543e66(0x198),_0x54e1a0,..._0x50c4c7],_0x435e16=spawn(_0x580a7b,_0x2dfaf3,{'cwd':_0x5d0cb0,'stdio':_0x543e66(0x1a2),'shell':!![],'env':{...process.env,'PATH':''+join(_0x5d0cb0,_0x543e66(0x1b9),_0x543e66(0x1b7))+delimiter+process.env.PATH}});_0x435e16['on'](_0x543e66(0x1d0),_0x1e6ff8=>{const _0x1e5418=_0x543e66;if(_0x1e6ff8===0x0||_0x1e6ff8===null)_0x205f2f();else _0x13ca8f(new Error(_0x580a7b+_0x1e5418(0x1aa)+_0x54e1a0+_0x1e5418(0x1b0)+_0x1e6ff8));}),_0x435e16['on'](_0x543e66(0x1b6),_0x13ca8f);});}function spawnViteBuildWatch(_0x24df3e){return new Promise((_0x2f991d,_0x5bb744)=>{const _0x366233=a164_0x1455,_0x4bdbc0=spawn(_0x366233(0x19e),[_0x366233(0x1a8),_0x366233(0x1a1)],{'cwd':_0x24df3e,'stdio':_0x366233(0x1a2),'shell':!![],'env':{...process.env,'PATH':''+join(_0x24df3e,_0x366233(0x1b9),_0x366233(0x1b7))+delimiter+process.env.PATH}});_0x4bdbc0['on'](_0x366233(0x1d0),_0x4601be=>{const _0x1d956d=_0x366233;if(_0x4601be===0x0||_0x4601be===null)_0x2f991d();else _0x5bb744(new Error(_0x1d956d(0x1ae)+_0x4601be));}),_0x4bdbc0['on'](_0x366233(0x1b6),_0x5bb744);});}function a164_0x1455(_0x8bf7af,_0x5d6ed8){_0x8bf7af=_0x8bf7af-0x195;const _0x28d288=a164_0x28d2();let _0x145590=_0x28d288[_0x8bf7af];return _0x145590;}function spawnVitePreview(_0x40bcd1){return new Promise((_0x5d4fb9,_0x259323)=>{const _0x1b296c=a164_0x1455,_0x59ba8a=spawn('vite',[_0x1b296c(0x1be)],{'cwd':_0x40bcd1,'stdio':_0x1b296c(0x1a2),'shell':!![],'env':{...process.env,'PATH':''+join(_0x40bcd1,_0x1b296c(0x1b9),_0x1b296c(0x1b7))+delimiter+process.env.PATH}});_0x59ba8a['on'](_0x1b296c(0x1d0),_0x10a557=>{if(_0x10a557===0x0||_0x10a557===null)_0x5d4fb9();else _0x259323(new Error('vite\x20preview\x20exited\x20with\x20code\x20'+_0x10a557));}),_0x59ba8a['on']('error',_0x259323);});}function a164_0x28d2(){const _0x4f4dc1=['bool','2356XfNbJb','\x20run\x20start','\x20\x20EXAMPLES','preview','\x22\x20not\x20found\x20in\x20package.json.','bun.lockb','slice','log','keys','utf-8','Script\x20\x22','Available:\x20','No\x20scripts\x20defined\x20in\x20package.json.','has','Enable\x20watch\x20mode\x20for\x20preview','\x0a\x20\x20Usage:\x20','\x20\x20\x20\x20','21159dOlVht','needsUpgrade','bun.lock','748829XnirXz','close','scripts','Run\x20a\x20package.json\x20script','npm','11080hVtVHp','length','yarn','run','(none)','read','8eDNDTS','1592WyGpPo','dev','vite','push','watch','--watch','inherit','\x20run\x20build','args','950SGMmcE','19144392dtVKvP','boolean','build','\x20run\x20preview\x20--watch','\x20run\x20','join','pnpm-lock.yaml','385CnXFqL','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','yarn.lock','\x20exited\x20with\x20code\x20','4618474UQUtNA','No\x20package.json\x20found\x20in\x20current\x20directory.','package.json','validation','6fcHHBz','error','.bin','209721OlBVag','node_modules'];a164_0x28d2=function(){return _0x4f4dc1;};return a164_0x28d2();}const runFlags=[{'name':a164_0x25fb7a(0x1a0),'type':a164_0x25fb7a(0x1a7),'description':a164_0x25fb7a(0x1c9),'default':![]}];export const runDefinition={'service':a164_0x25fb7a(0x198),'command':'run','description':a164_0x25fb7a(0x1d2),'risk':a164_0x25fb7a(0x19a),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':'script','description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x5e4008=a164_0x25fb7a,_0x16e2cc=[];return _0x16e2cc[_0x5e4008(0x19f)](_0x5e4008(0x1bd)),_0x16e2cc[_0x5e4008(0x19f)](_0x5e4008(0x1cb)+CLI_BIN_NAME+_0x5e4008(0x1bc)),_0x16e2cc[_0x5e4008(0x19f)](_0x5e4008(0x1cb)+CLI_BIN_NAME+_0x5e4008(0x1a3)),_0x16e2cc[_0x5e4008(0x19f)]('\x20\x20\x20\x20'+CLI_BIN_NAME+'\x20run\x20preview'),_0x16e2cc[_0x5e4008(0x19f)](_0x5e4008(0x1cb)+CLI_BIN_NAME+_0x5e4008(0x1a9)),_0x16e2cc[_0x5e4008(0x1ab)]('\x0a');},async 'execute'(_0x4e3dbb){const _0xc47301=a164_0x25fb7a,_0x36e85d=process['cwd'](),_0x170690=_0x4e3dbb[_0xc47301(0x1a4)][0x0],_0x4e940a=_0x4e3dbb['args'][_0xc47301(0x1c1)](0x1),_0x56f937=readPackageScripts(_0x36e85d);if(!_0x56f937)throw CliErrors['validation'](_0xc47301(0x1b2));if(!_0x170690){const _0x5022fe=Object[_0xc47301(0x1c3)](_0x56f937);if(_0x5022fe[_0xc47301(0x196)]===0x0)console[_0xc47301(0x1c2)](_0xc47301(0x1c7));else{console[_0xc47301(0x1c2)]('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x197afe of _0x5022fe){console[_0xc47301(0x1c2)](_0xc47301(0x1cb)+_0x197afe);}console[_0xc47301(0x1c2)](_0xc47301(0x1ca)+CLI_BIN_NAME+'\x20run\x20<script>\x0a');}return{'ok':!![]};}if(!_0x56f937[_0x170690])throw CliErrors[_0xc47301(0x1b4)](_0xc47301(0x1c5)+_0x170690+_0xc47301(0x1bf),_0xc47301(0x1c6)+(Object['keys'](_0x56f937)[_0xc47301(0x1ab)](',\x20')||_0xc47301(0x199)));const _0x320d2b=detectPackageManager(_0x36e85d);VERSION_CHECK_SCRIPTS[_0xc47301(0x1c8)](_0x170690)&&await versionCheck(_0x36e85d);if(_0x170690===_0xc47301(0x1be)&&_0x4e3dbb[_0xc47301(0x1ba)](_0xc47301(0x1a0)))return await Promise['all']([spawnViteBuildWatch(_0x36e85d),spawnVitePreview(_0x36e85d)]),{'ok':!![]};return await spawnScript(_0x320d2b,_0x170690,_0x4e940a,_0x36e85d),{'ok':!![]};}};
@@ -1 +1 @@
1
- const a164_0x362a51=a164_0x1572;function a164_0x1572(_0x1f000d,_0x3d52d4){_0x1f000d=_0x1f000d-0x1aa;const _0x51b0bf=a164_0x51b0();let _0x1572d5=_0x51b0bf[_0x1f000d];return _0x1572d5;}(function(_0x2570e7,_0x2b8632){const _0x42a92=a164_0x1572,_0x45f3df=_0x2570e7();while(!![]){try{const _0x2c2c6e=parseInt(_0x42a92(0x1b1))/0x1+parseInt(_0x42a92(0x1b6))/0x2*(-parseInt(_0x42a92(0x1b7))/0x3)+-parseInt(_0x42a92(0x1ab))/0x4*(-parseInt(_0x42a92(0x1ad))/0x5)+-parseInt(_0x42a92(0x1b5))/0x6+-parseInt(_0x42a92(0x1b0))/0x7*(-parseInt(_0x42a92(0x1b3))/0x8)+parseInt(_0x42a92(0x1aa))/0x9+parseInt(_0x42a92(0x1ac))/0xa;if(_0x2c2c6e===_0x2b8632)break;else _0x45f3df['push'](_0x45f3df['shift']());}catch(_0x1ae19a){_0x45f3df['push'](_0x45f3df['shift']());}}}(a164_0x51b0,0x712a4));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0xfc31c5){const _0x5bac17=await buildSchemaPayload();return{'ok':!![],'data':_0x5bac17};}function a164_0x51b0(){const _0xc79598=['14UcyxNi','484228xfXRhF','schema','289504ICPFaZ','export','5161020cXBbOd','416752ipxaPs','6qBHPBJ','4196340WmiPDU','4xgwyZz','1503620YdIgQO','2836100NXSwXh','json','read'];a164_0x51b0=function(){return _0xc79598;};return a164_0x51b0();}export const schemaDefinition={'service':a164_0x362a51(0x1b2),'command':a164_0x362a51(0x1b4),'description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a164_0x362a51(0x1af),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a164_0x362a51(0x1ae),'flags':[],'execute':execute};
1
+ const a165_0x2690ef=a165_0x3ebf;(function(_0x577c4d,_0xec1535){const _0x28cac7=a165_0x3ebf,_0x1875b8=_0x577c4d();while(!![]){try{const _0x1f8b07=-parseInt(_0x28cac7(0x1f9))/0x1+parseInt(_0x28cac7(0x1f0))/0x2*(-parseInt(_0x28cac7(0x1f5))/0x3)+-parseInt(_0x28cac7(0x1f1))/0x4*(-parseInt(_0x28cac7(0x1ff))/0x5)+parseInt(_0x28cac7(0x1ef))/0x6*(parseInt(_0x28cac7(0x1fb))/0x7)+-parseInt(_0x28cac7(0x1f4))/0x8*(parseInt(_0x28cac7(0x1f3))/0x9)+-parseInt(_0x28cac7(0x1f2))/0xa+-parseInt(_0x28cac7(0x1fc))/0xb*(-parseInt(_0x28cac7(0x1fd))/0xc);if(_0x1f8b07===_0xec1535)break;else _0x1875b8['push'](_0x1875b8['shift']());}catch(_0x2e3e0e){_0x1875b8['push'](_0x1875b8['shift']());}}}(a165_0x46f6,0xbb4e4));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x12cbeb){const _0x4ced78=await buildSchemaPayload();return{'ok':!![],'data':_0x4ced78};}export const schemaDefinition={'service':a165_0x2690ef(0x1fa),'command':a165_0x2690ef(0x1f6),'description':a165_0x2690ef(0x1f8),'risk':a165_0x2690ef(0x1f7),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a165_0x2690ef(0x1fe),'flags':[],'execute':execute};function a165_0x3ebf(_0x16c520,_0x2d4c9b){_0x16c520=_0x16c520-0x1ef;const _0x46f670=a165_0x46f6();let _0x3ebfca=_0x46f670[_0x16c520];return _0x3ebfca;}function a165_0x46f6(){const _0x2bab2c=['10133199XfQvCo','8XagLeq','2481hndPsn','export','read','Export\x20machine-readable\x20command\x20schema\x20(JSON)','1178277fUrrVb','schema','8521912kFozRn','143gvOYcp','2393520iZRVLm','json','127405eCXElf','6TQspls','542GNNkiM','100XelkwK','11519120VxIskx'];a165_0x46f6=function(){return _0x2bab2c;};return a165_0x46f6();}
@@ -1 +1 @@
1
- const a165_0x588350=a165_0x3c57;(function(_0x139626,_0x5d6bb1){const _0x5af22f=a165_0x3c57,_0x3be5b8=_0x139626();while(!![]){try{const _0x11400a=-parseInt(_0x5af22f(0x180))/0x1*(parseInt(_0x5af22f(0x187))/0x2)+-parseInt(_0x5af22f(0x182))/0x3*(parseInt(_0x5af22f(0x16e))/0x4)+parseInt(_0x5af22f(0x174))/0x5+parseInt(_0x5af22f(0x14d))/0x6+-parseInt(_0x5af22f(0x170))/0x7+parseInt(_0x5af22f(0x18c))/0x8*(-parseInt(_0x5af22f(0x166))/0x9)+-parseInt(_0x5af22f(0x185))/0xa*(-parseInt(_0x5af22f(0x159))/0xb);if(_0x11400a===_0x5d6bb1)break;else _0x3be5b8['push'](_0x3be5b8['shift']());}catch(_0x5d2984){_0x3be5b8['push'](_0x3be5b8['shift']());}}}(a165_0x5a61,0xddadb));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';function a165_0x3c57(_0x80b98b,_0x4214b3){_0x80b98b=_0x80b98b-0x145;const _0x5a61eb=a165_0x5a61();let _0x3c57c3=_0x5a61eb[_0x80b98b];return _0x3c57c3;}import{createSqlQuery}from'../../core/api-client.js';function a165_0x5a61(){const _0x151b8f=['1414252rmxEIA','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','sql','db-id','4352970vzFTMp','map','length','lockFilePath','parse','str','\x20\x20SELECT\x201\x20AS\x20id','✎\x20手动输入\x20dbId','Local\x20SQL\x20file\x20mode','join','File\x20already\x20exists:\x20','dbId\x20必须为正整数','16gVwlhk','flagMissing','93IxliDs','MyBatis\x20XML(mybatisXml)','trim','31028170LUNFmL','SQL\x20query\x20display\x20name','135748VpSSkF','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','Invalid\x20database\x20selection\x20payload:\x20','SELECT\x201\x20AS\x20id;','普通\x20SQL(sql)','247088orpYaq','sqlRootDir','mode','flag','__manual__','lastSync','POST','请选择本地\x20SQL\x20模式:','validation','5058390wQWHFf','dbName','string','Target\x20database\x20ID','create','nonInteractive','isFinite','SQL\x20名称不能为空','sqlCode','sqlName','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','11jNXgNI','number','toISOString','mybatisXml','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','name','utf8','请选择目标数据库:','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','</select>','sqls','stringify','279tCTsKj','appCode','new','<server-generated-sqlCode>','description','catch','请输入目标数据库\x20dbId:','dbId','214580QkehBM','/smartapi/custom/saveUserCustomSql'];a165_0x5a61=function(){return _0x151b8f;};return a165_0x5a61();}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(_0x424d9d){const _0x16648f=a165_0x3c57;if(_0x424d9d===_0x16648f(0x15c))return[_0x16648f(0x188),_0x16648f(0x17a),_0x16648f(0x163),''][_0x16648f(0x17d)]('\x0a');return[_0x16648f(0x18a),''][_0x16648f(0x17d)]('\x0a');}export const sqlCreate={'service':'sql','command':a165_0x588350(0x151),'description':a165_0x588350(0x157),'risk':'high-risk-write','flags':[{'name':a165_0x588350(0x15f),'type':'string','description':a165_0x588350(0x186)},{'name':a165_0x588350(0x173),'type':a165_0x588350(0x15a),'description':a165_0x588350(0x150)},{'name':'mode','type':a165_0x588350(0x14f),'enum':[a165_0x588350(0x172),a165_0x588350(0x15c)],'description':a165_0x588350(0x17c)}],async 'validate'(_0x8f022b){const _0x14760f=a165_0x588350;if(!_0x8f022b[_0x14760f(0x152)])return;if(!_0x8f022b[_0x14760f(0x179)](_0x14760f(0x15f))[_0x14760f(0x184)]())throw CliErrors['flagMissing'](_0x14760f(0x15f),'--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x369ba2=resolveProvidedDbId(_0x8f022b);if(typeof _0x369ba2!=='number'||!Number['isFinite'](_0x369ba2)||_0x369ba2<=0x0)throw CliErrors[_0x14760f(0x181)](_0x14760f(0x173),_0x14760f(0x15d));if(!_0x8f022b[_0x14760f(0x179)](_0x14760f(0x146))[_0x14760f(0x184)]())throw CliErrors[_0x14760f(0x181)](_0x14760f(0x146),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x22f4a9){const _0x53e728=a165_0x588350,_0x1cd54f=loadSqlProjectConfig(_0x22f4a9[_0x53e728(0x167)]),{sqlName:_0xec9339,dbId:_0x44bbd5,dbName:_0x40b519,mode:_0x307f09}=await resolveSqlNewInputs(_0x22f4a9),_0x26d660=buildSqlRelativePath(_0x53e728(0x169),_0xec9339,_0x40b519,_0x307f09,_0x44bbd5),_0x1db9f5=_0x1cd54f['sqlRootDir']+'/'+_0x26d660;return{'method':_0x53e728(0x14a),'url':_0x53e728(0x16f),'body':{'appCode':_0x22f4a9[_0x53e728(0x167)],'sqlName':_0xec9339,'dbId':_0x44bbd5,'mode':_0x307f09,'localPath':_0x1db9f5},'description':_0x53e728(0x15e)+_0x1cd54f[_0x53e728(0x145)]};},async 'execute'(_0x177c27){const _0x1a16c8=a165_0x588350,_0x50f80a=loadSqlProjectConfig(_0x177c27[_0x1a16c8(0x167)]),{sqlName:_0x280f46,dbId:_0x8e9d4f,dbName:_0x4c23fd,mode:_0x592743}=await resolveSqlNewInputs(_0x177c27),_0x1cae79=generateSqlTemplate(_0x592743),_0x45b53b=await createSqlQuery({'appCode':_0x177c27[_0x1a16c8(0x167)],'sqlName':_0x280f46,'dbId':_0x8e9d4f,'sqlContent':_0x1cae79}),_0x49d6a1=ensureRemoteSqlContent(_0x45b53b),_0x37ccf1=_0x4c23fd||await getDbName(_0x177c27[_0x1a16c8(0x167)],_0x8e9d4f)[_0x1a16c8(0x16b)](()=>undefined),_0x555bf6=buildSqlRelativePath(_0x45b53b[_0x1a16c8(0x155)],_0x45b53b[_0x1a16c8(0x156)],_0x37ccf1,_0x592743,_0x8e9d4f),_0x5aeeaf=_0x50f80a[_0x1a16c8(0x145)]+'/'+_0x555bf6,_0x2870cb=buildLocalSqlFileContent({'sqlCode':_0x45b53b[_0x1a16c8(0x155)],'sqlName':_0x45b53b[_0x1a16c8(0x156)],'dbId':_0x45b53b['dbId']},_0x49d6a1,{'dbName':_0x37ccf1,'mode':_0x592743,'syncedAt':new Date()[_0x1a16c8(0x15b)](),'description':_0x45b53b[_0x1a16c8(0x16a)]});if(await fileExists(_0x5aeeaf))throw CliErrors[_0x1a16c8(0x14c)](_0x1a16c8(0x17e)+_0x5aeeaf);await ensureParentDirectory(_0x5aeeaf),await writeFile(_0x5aeeaf,_0x2870cb,_0x1a16c8(0x160));const _0x1efbc9=await readSqlLockFile(_0x50f80a[_0x1a16c8(0x177)]),{lockData:_0x25b792,appLock:_0x5f3794}=ensureSqlLockScope(_0x1efbc9??createEmptySqlLock(),_0x50f80a['appCode'],_0x50f80a['sqlRoot'],_0x1a16c8(0x168));return _0x5f3794[_0x1a16c8(0x164)][_0x45b53b['sqlCode']]={...buildSqlLockEntry(_0x45b53b,_0x49d6a1,computeSqlContentHash(_0x2870cb),{'dbName':_0x37ccf1}),'path':_0x555bf6,'mode':_0x592743},_0x5f3794[_0x1a16c8(0x149)]=new Date()[_0x1a16c8(0x15b)](),await writeSqlLockFile(_0x50f80a['lockFilePath'],_0x25b792),{'ok':!![],'data':{'id':_0x45b53b['id'],'sqlCode':_0x45b53b[_0x1a16c8(0x155)],'sqlName':_0x45b53b['sqlName'],'dbId':_0x45b53b['dbId'],'path':_0x5aeeaf,'mode':_0x592743},'message':'Created\x20SQL\x20query\x20'+_0x45b53b[_0x1a16c8(0x155)]};}};async function resolveSqlNewInputs(_0x30df68){const _0x39d141=await resolveSqlNameInput(_0x30df68),{dbId:_0x53beb0,dbName:_0x1cfa33}=await resolveDbSelection(_0x30df68),_0x1fb43c=await resolveSqlModeInput(_0x30df68);return{'sqlName':_0x39d141,'dbId':_0x53beb0,'dbName':_0x1cfa33,'mode':_0x1fb43c};}async function resolveSqlNameInput(_0x2899a1){const _0x5ed26b=a165_0x588350,_0x38e732=_0x2899a1['str']('name')['trim']();if(_0x38e732)return _0x38e732;if(_0x2899a1[_0x5ed26b(0x152)])throw CliErrors[_0x5ed26b(0x181)](_0x5ed26b(0x15f),_0x5ed26b(0x162));return(await input({'message':'请输入\x20SQL\x20名称:','validate':_0x50a45c=>_0x50a45c[_0x5ed26b(0x184)]()?!![]:_0x5ed26b(0x154)}))[_0x5ed26b(0x184)]();}async function resolveDbSelection(_0x57af6a){const _0x5af6af=a165_0x588350,_0xa165fd=resolveProvidedDbId(_0x57af6a);if(typeof _0xa165fd===_0x5af6af(0x15a)&&Number[_0x5af6af(0x153)](_0xa165fd)&&_0xa165fd>0x0)return{'dbId':_0xa165fd,'dbName':await getDbName(_0x57af6a['appCode'],_0xa165fd)['catch'](()=>undefined)};if(_0x57af6a[_0x5af6af(0x152)])throw CliErrors[_0x5af6af(0x181)]('db-id',_0x5af6af(0x15d));const _0x1b8f7e=await listDatabases(_0x57af6a['appCode'])[_0x5af6af(0x16b)](()=>[]);if(_0x1b8f7e[_0x5af6af(0x176)]===0x1)return{'dbId':_0x1b8f7e[0x0][_0x5af6af(0x16d)],'dbName':_0x1b8f7e[0x0][_0x5af6af(0x14e)]};if(_0x1b8f7e['length']>0x1){const _0x35cb83=await select({'message':_0x5af6af(0x161),'choices':[..._0x1b8f7e[_0x5af6af(0x175)](_0x5c456a=>({'name':_0x5c456a['dbName']+'\x20('+_0x5c456a[_0x5af6af(0x16d)]+')','value':serializeDbSelection(_0x5c456a)})),{'name':_0x5af6af(0x17b),'value':_0x5af6af(0x148)}]});if(_0x35cb83!==_0x5af6af(0x148))return deserializeDbSelection(_0x35cb83);}const _0x47572b=await input({'message':_0x5af6af(0x16c),'validate':_0x143e2e=>{const _0x134f2c=_0x5af6af,_0x135b6d=_0x143e2e[_0x134f2c(0x184)]();if(!_0x135b6d)return'dbId\x20不能为空';const _0x39101a=Number(_0x135b6d);if(!Number['isInteger'](_0x39101a)||_0x39101a<=0x0)return _0x134f2c(0x17f);return!![];}});return{'dbId':Number(_0x47572b[_0x5af6af(0x184)]())};}async function resolveSqlModeInput(_0x554edd){const _0x507894=a165_0x588350,_0x314558=_0x554edd['str'](_0x507894(0x146))[_0x507894(0x184)]();if(_0x314558===_0x507894(0x172)||_0x314558==='mybatisXml')return _0x314558;if(_0x554edd['nonInteractive'])throw CliErrors[_0x507894(0x181)](_0x507894(0x146),_0x507894(0x158));return await select({'message':_0x507894(0x14b),'choices':[{'name':_0x507894(0x18b),'value':_0x507894(0x172),'description':_0x507894(0x171)},{'name':_0x507894(0x183),'value':'mybatisXml','description':'适合带动态标签的\x20MyBatis\x20XML\x20SQL'}]});}function serializeDbSelection(_0x55bc13){const _0x192a45=a165_0x588350;return JSON[_0x192a45(0x165)]({'dbId':_0x55bc13[_0x192a45(0x16d)],'dbName':_0x55bc13[_0x192a45(0x14e)]});}function deserializeDbSelection(_0x5d58a0){const _0x490fca=a165_0x588350;try{const _0x188c02=JSON[_0x490fca(0x178)](_0x5d58a0);if(typeof _0x188c02[_0x490fca(0x16d)]===_0x490fca(0x15a)&&Number[_0x490fca(0x153)](_0x188c02[_0x490fca(0x16d)]))return{'dbId':_0x188c02[_0x490fca(0x16d)],'dbName':_0x188c02[_0x490fca(0x14e)]};}catch{}throw CliErrors[_0x490fca(0x14c)](_0x490fca(0x189)+_0x5d58a0);}function resolveProvidedDbId(_0x4bca59){const _0x19191c=a165_0x588350,_0x34316b=_0x4bca59[_0x19191c(0x147)]('db-id');if(typeof _0x34316b===_0x19191c(0x15a)&&Number['isFinite'](_0x34316b))return _0x34316b;return undefined;}
1
+ const a166_0x272503=a166_0x2a60;function a166_0x2a60(_0x33c69f,_0x382e90){_0x33c69f=_0x33c69f-0xd0;const _0x31eae0=a166_0x31ea();let _0x2a60ec=_0x31eae0[_0x33c69f];return _0x2a60ec;}(function(_0x1bba6f,_0x9b6b58){const _0x182642=a166_0x2a60,_0x331e5e=_0x1bba6f();while(!![]){try{const _0xa8c9f8=-parseInt(_0x182642(0xea))/0x1*(parseInt(_0x182642(0xdc))/0x2)+parseInt(_0x182642(0xe9))/0x3+-parseInt(_0x182642(0xd7))/0x4*(-parseInt(_0x182642(0xe3))/0x5)+-parseInt(_0x182642(0xd8))/0x6+parseInt(_0x182642(0xd5))/0x7+parseInt(_0x182642(0xe8))/0x8+-parseInt(_0x182642(0xfc))/0x9;if(_0xa8c9f8===_0x9b6b58)break;else _0x331e5e['push'](_0x331e5e['shift']());}catch(_0x527ea4){_0x331e5e['push'](_0x331e5e['shift']());}}}(a166_0x31ea,0xbcc95));import{writeFile}from'node:fs/promises';function a166_0x31ea(){const _0x72cc41=['flagMissing','9773028lfiRdu','dbId\x20不能为空','mode','isInteger','nonInteractive','请选择目标数据库:','Invalid\x20database\x20selection\x20payload:\x20','MyBatis\x20XML(mybatisXml)','description','sqlName','string','sql','</select>','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','dbId','name','catch','toISOString','sqlRootDir','5420163tkcFYz','trim','1684cjlWKB','5525250pKXRvO','__manual__','<server-generated-sqlCode>','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','2612MwyhSB','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','isFinite','map','请选择本地\x20SQL\x20模式:','dbName','普通\x20SQL(sql)','1465ancVFd','validation','\x20\x20SELECT\x201\x20AS\x20id','/smartapi/custom/saveUserCustomSql','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','9379440xSTwgq','4077078AJHmLY','497HRozTE','dbId\x20必须为正整数','stringify','lockFilePath','请输入\x20SQL\x20名称:','mybatisXml','sqlCode','✎\x20手动输入\x20dbId','适合带动态标签的\x20MyBatis\x20XML\x20SQL','appCode','Created\x20SQL\x20query\x20','number','db-id','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','str','new','high-risk-write'];a166_0x31ea=function(){return _0x72cc41;};return a166_0x31ea();}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(_0x1c648b){const _0x45e3f5=a166_0x2a60;if(_0x1c648b===_0x45e3f5(0xef))return[_0x45e3f5(0xdb),_0x45e3f5(0xe5),_0x45e3f5(0x108),'']['join']('\x0a');return['SELECT\x201\x20AS\x20id;','']['join']('\x0a');}export const sqlCreate={'service':a166_0x272503(0x107),'command':'create','description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a166_0x272503(0xfa),'flags':[{'name':a166_0x272503(0xd1),'type':'string','description':'SQL\x20query\x20display\x20name'},{'name':a166_0x272503(0xf6),'type':a166_0x272503(0xf5),'description':'Target\x20database\x20ID'},{'name':a166_0x272503(0xfe),'type':a166_0x272503(0x106),'enum':[a166_0x272503(0x107),a166_0x272503(0xef)],'description':'Local\x20SQL\x20file\x20mode'}],async 'validate'(_0x149f6a){const _0x88b131=a166_0x272503;if(!_0x149f6a[_0x88b131(0x100)])return;if(!_0x149f6a['str'](_0x88b131(0xd1))['trim']())throw CliErrors['flagMissing'](_0x88b131(0xd1),_0x88b131(0xdd));const _0x3c94a8=resolveProvidedDbId(_0x149f6a);if(typeof _0x3c94a8!==_0x88b131(0xf5)||!Number[_0x88b131(0xde)](_0x3c94a8)||_0x3c94a8<=0x0)throw CliErrors['flagMissing'](_0x88b131(0xf6),_0x88b131(0xe7));if(!_0x149f6a[_0x88b131(0xf8)](_0x88b131(0xfe))['trim']())throw CliErrors[_0x88b131(0xfb)](_0x88b131(0xfe),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x1342cf){const _0x57fa35=a166_0x272503,_0x21f97=loadSqlProjectConfig(_0x1342cf[_0x57fa35(0xf3)]),{sqlName:_0x4c004c,dbId:_0x503387,dbName:_0x561263,mode:_0x1c1a76}=await resolveSqlNewInputs(_0x1342cf),_0x2697c0=buildSqlRelativePath(_0x57fa35(0xda),_0x4c004c,_0x561263,_0x1c1a76,_0x503387),_0x11d2dc=_0x21f97[_0x57fa35(0xd4)]+'/'+_0x2697c0;return{'method':'POST','url':_0x57fa35(0xe6),'body':{'appCode':_0x1342cf['appCode'],'sqlName':_0x4c004c,'dbId':_0x503387,'mode':_0x1c1a76,'localPath':_0x11d2dc},'description':'Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20'+_0x21f97[_0x57fa35(0xd4)]};},async 'execute'(_0x247359){const _0x4e1f5f=a166_0x272503,_0x45a6f6=loadSqlProjectConfig(_0x247359[_0x4e1f5f(0xf3)]),{sqlName:_0x508037,dbId:_0x3502db,dbName:_0xce0e7,mode:_0x5a113c}=await resolveSqlNewInputs(_0x247359),_0xe0a19a=generateSqlTemplate(_0x5a113c),_0x3c0d06=await createSqlQuery({'appCode':_0x247359[_0x4e1f5f(0xf3)],'sqlName':_0x508037,'dbId':_0x3502db,'sqlContent':_0xe0a19a}),_0x4be6b1=ensureRemoteSqlContent(_0x3c0d06),_0x417bf6=_0xce0e7||await getDbName(_0x247359['appCode'],_0x3502db)[_0x4e1f5f(0xd2)](()=>undefined),_0x579e1d=buildSqlRelativePath(_0x3c0d06[_0x4e1f5f(0xf0)],_0x3c0d06[_0x4e1f5f(0x105)],_0x417bf6,_0x5a113c,_0x3502db),_0x2856fc=_0x45a6f6['sqlRootDir']+'/'+_0x579e1d,_0x3e637e=buildLocalSqlFileContent({'sqlCode':_0x3c0d06[_0x4e1f5f(0xf0)],'sqlName':_0x3c0d06['sqlName'],'dbId':_0x3c0d06[_0x4e1f5f(0xd0)]},_0x4be6b1,{'dbName':_0x417bf6,'mode':_0x5a113c,'syncedAt':new Date()[_0x4e1f5f(0xd3)](),'description':_0x3c0d06[_0x4e1f5f(0x104)]});if(await fileExists(_0x2856fc))throw CliErrors[_0x4e1f5f(0xe4)]('File\x20already\x20exists:\x20'+_0x2856fc);await ensureParentDirectory(_0x2856fc),await writeFile(_0x2856fc,_0x3e637e,'utf8');const _0x28dcaf=await readSqlLockFile(_0x45a6f6[_0x4e1f5f(0xed)]),{lockData:_0x30d240,appLock:_0x3ac5d5}=ensureSqlLockScope(_0x28dcaf??createEmptySqlLock(),_0x45a6f6[_0x4e1f5f(0xf3)],_0x45a6f6['sqlRoot'],_0x4e1f5f(0xf9));return _0x3ac5d5['sqls'][_0x3c0d06[_0x4e1f5f(0xf0)]]={...buildSqlLockEntry(_0x3c0d06,_0x4be6b1,computeSqlContentHash(_0x3e637e),{'dbName':_0x417bf6}),'path':_0x579e1d,'mode':_0x5a113c},_0x3ac5d5['lastSync']=new Date()[_0x4e1f5f(0xd3)](),await writeSqlLockFile(_0x45a6f6['lockFilePath'],_0x30d240),{'ok':!![],'data':{'id':_0x3c0d06['id'],'sqlCode':_0x3c0d06[_0x4e1f5f(0xf0)],'sqlName':_0x3c0d06['sqlName'],'dbId':_0x3c0d06[_0x4e1f5f(0xd0)],'path':_0x2856fc,'mode':_0x5a113c},'message':_0x4e1f5f(0xf4)+_0x3c0d06['sqlCode']};}};async function resolveSqlNewInputs(_0x3ff239){const _0x630372=await resolveSqlNameInput(_0x3ff239),{dbId:_0x55941f,dbName:_0x55e496}=await resolveDbSelection(_0x3ff239),_0x567240=await resolveSqlModeInput(_0x3ff239);return{'sqlName':_0x630372,'dbId':_0x55941f,'dbName':_0x55e496,'mode':_0x567240};}async function resolveSqlNameInput(_0x15273d){const _0x3d8c6c=a166_0x272503,_0x1ab8e3=_0x15273d[_0x3d8c6c(0xf8)](_0x3d8c6c(0xd1))[_0x3d8c6c(0xd6)]();if(_0x1ab8e3)return _0x1ab8e3;if(_0x15273d[_0x3d8c6c(0x100)])throw CliErrors[_0x3d8c6c(0xfb)](_0x3d8c6c(0xd1),_0x3d8c6c(0xdd));return(await input({'message':_0x3d8c6c(0xee),'validate':_0x341347=>_0x341347[_0x3d8c6c(0xd6)]()?!![]:'SQL\x20名称不能为空'}))[_0x3d8c6c(0xd6)]();}async function resolveDbSelection(_0x549472){const _0x58cedb=a166_0x272503,_0x331e0b=resolveProvidedDbId(_0x549472);if(typeof _0x331e0b===_0x58cedb(0xf5)&&Number[_0x58cedb(0xde)](_0x331e0b)&&_0x331e0b>0x0)return{'dbId':_0x331e0b,'dbName':await getDbName(_0x549472[_0x58cedb(0xf3)],_0x331e0b)[_0x58cedb(0xd2)](()=>undefined)};if(_0x549472[_0x58cedb(0x100)])throw CliErrors['flagMissing'](_0x58cedb(0xf6),_0x58cedb(0xe7));const _0x594ffb=await listDatabases(_0x549472[_0x58cedb(0xf3)])[_0x58cedb(0xd2)](()=>[]);if(_0x594ffb['length']===0x1)return{'dbId':_0x594ffb[0x0][_0x58cedb(0xd0)],'dbName':_0x594ffb[0x0]['dbName']};if(_0x594ffb['length']>0x1){const _0x43f232=await select({'message':_0x58cedb(0x101),'choices':[..._0x594ffb[_0x58cedb(0xdf)](_0x27cce6=>({'name':_0x27cce6[_0x58cedb(0xe1)]+'\x20('+_0x27cce6['dbId']+')','value':serializeDbSelection(_0x27cce6)})),{'name':_0x58cedb(0xf1),'value':_0x58cedb(0xd9)}]});if(_0x43f232!=='__manual__')return deserializeDbSelection(_0x43f232);}const _0x17c1df=await input({'message':'请输入目标数据库\x20dbId:','validate':_0x2cc2b6=>{const _0x3f282a=_0x58cedb,_0x2b48b1=_0x2cc2b6['trim']();if(!_0x2b48b1)return _0x3f282a(0xfd);const _0x27ea2c=Number(_0x2b48b1);if(!Number[_0x3f282a(0xff)](_0x27ea2c)||_0x27ea2c<=0x0)return _0x3f282a(0xeb);return!![];}});return{'dbId':Number(_0x17c1df[_0x58cedb(0xd6)]())};}async function resolveSqlModeInput(_0x1c9cc5){const _0x18b1b3=a166_0x272503,_0x466dd8=_0x1c9cc5[_0x18b1b3(0xf8)](_0x18b1b3(0xfe))[_0x18b1b3(0xd6)]();if(_0x466dd8===_0x18b1b3(0x107)||_0x466dd8==='mybatisXml')return _0x466dd8;if(_0x1c9cc5[_0x18b1b3(0x100)])throw CliErrors['flagMissing'](_0x18b1b3(0xfe),_0x18b1b3(0x109));return await select({'message':_0x18b1b3(0xe0),'choices':[{'name':_0x18b1b3(0xe2),'value':_0x18b1b3(0x107),'description':_0x18b1b3(0xf7)},{'name':_0x18b1b3(0x103),'value':'mybatisXml','description':_0x18b1b3(0xf2)}]});}function serializeDbSelection(_0x5a090d){const _0xdca921=a166_0x272503;return JSON[_0xdca921(0xec)]({'dbId':_0x5a090d[_0xdca921(0xd0)],'dbName':_0x5a090d['dbName']});}function deserializeDbSelection(_0x1e1d9f){const _0x2c1ab6=a166_0x272503;try{const _0x5a4e2c=JSON['parse'](_0x1e1d9f);if(typeof _0x5a4e2c[_0x2c1ab6(0xd0)]===_0x2c1ab6(0xf5)&&Number[_0x2c1ab6(0xde)](_0x5a4e2c[_0x2c1ab6(0xd0)]))return{'dbId':_0x5a4e2c[_0x2c1ab6(0xd0)],'dbName':_0x5a4e2c[_0x2c1ab6(0xe1)]};}catch{}throw CliErrors[_0x2c1ab6(0xe4)](_0x2c1ab6(0x102)+_0x1e1d9f);}function resolveProvidedDbId(_0x56168c){const _0x204345=a166_0x272503,_0x52043e=_0x56168c['flag'](_0x204345(0xf6));if(typeof _0x52043e===_0x204345(0xf5)&&Number['isFinite'](_0x52043e))return _0x52043e;return undefined;}
@@ -1 +1 @@
1
- const a166_0x1f866f=a166_0x192a;(function(_0x315ff5,_0x1d108c){const _0x4dd0d8=a166_0x192a,_0x380f31=_0x315ff5();while(!![]){try{const _0x3eb5a1=-parseInt(_0x4dd0d8(0xda))/0x1*(parseInt(_0x4dd0d8(0xef))/0x2)+parseInt(_0x4dd0d8(0xf3))/0x3+parseInt(_0x4dd0d8(0xf1))/0x4+-parseInt(_0x4dd0d8(0xf2))/0x5*(-parseInt(_0x4dd0d8(0xd7))/0x6)+parseInt(_0x4dd0d8(0xed))/0x7*(-parseInt(_0x4dd0d8(0xfc))/0x8)+parseInt(_0x4dd0d8(0xe0))/0x9+-parseInt(_0x4dd0d8(0xe9))/0xa*(parseInt(_0x4dd0d8(0xf7))/0xb);if(_0x3eb5a1===_0x1d108c)break;else _0x380f31['push'](_0x380f31['shift']());}catch(_0x39092d){_0x380f31['push'](_0x380f31['shift']());}}}(a166_0x2f32,0x9a7b1));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';function a166_0x2f32(){const _0x5ac322=['/smartapi/custom/deleteUserCustomSql','str','267613yfpCpq','toISOString','sqlRoot','length','\x20(local\x20file\x20moved\x20to\x20trash)','validation','8316963qRhTzp','delete','appCode','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','SQL\x20lock\x20file\x20not\x20found.','entries','projectRoot','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','Would\x20delete\x20SQL\x20','3710owxQtD','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','startsWith','high-risk-write','474488QEHfLB','lockFilePath','6slpmek','trashedTo','4982108TRGYOs','5KDsVEq','449601JWUVCW','sqls','sqlRootDir','sqlcode','58146ngwuzz','Deleted\x20','replace','remoteId','sql','16ENIqij','7276590UhoIvZ'];a166_0x2f32=function(){return _0x5ac322;};return a166_0x2f32();}import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';function a166_0x192a(_0x32b752,_0x4ce3f2){_0x32b752=_0x32b752-0xd7;const _0x2f32ac=a166_0x2f32();let _0x192a37=_0x2f32ac[_0x32b752];return _0x192a37;}export const sqlDelete={'service':a166_0x1f866f(0xfb),'command':a166_0x1f866f(0xe1),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a166_0x1f866f(0xec),'flags':[SQLCODE_FLAG],async 'validate'(_0x392f72){const _0x42f2c=a166_0x1f866f,_0x3c2bbc=loadSqlProjectConfig(_0x392f72[_0x42f2c(0xe2)]),_0x5b9ab0=await readSqlLockFile(_0x3c2bbc['lockFilePath']);if(!_0x5b9ab0)throw CliErrors[_0x42f2c(0xdf)](_0x42f2c(0xe7));},async 'dryRun'(_0x4ee34e){const _0x1b28f1=a166_0x1f866f,_0x49d109=loadSqlProjectConfig(_0x4ee34e[_0x1b28f1(0xe2)]),_0x4f5d7a=await readSqlLockFile(_0x49d109[_0x1b28f1(0xee)]);if(!_0x4f5d7a)throw CliErrors['validation'](_0x1b28f1(0xe7));const {appLock:_0xe3068a}=ensureSqlLockScope(_0x4f5d7a,_0x4ee34e[_0x1b28f1(0xe2)],_0x49d109[_0x1b28f1(0xdc)],_0x1b28f1(0xe1)),_0x437ec5=_0x4ee34e[_0x1b28f1(0xd9)](_0x1b28f1(0xf6)),_0x39d301=_0xe3068a['sqls'][_0x437ec5];if(!_0x39d301)throw CliErrors[_0x1b28f1(0xdf)](_0x1b28f1(0xe3)+_0x437ec5+'\x22.');return{'method':'POST','url':_0x1b28f1(0xd8),'body':{'sqlCode':_0x437ec5,'id':_0x39d301[_0x1b28f1(0xfa)],'localPath':resolveLocalSqlFilePath(_0x49d109,_0x437ec5,_0x39d301)},'description':_0x1b28f1(0xe8)+_0x437ec5+_0x1b28f1(0xea)+_0x49d109['trashDir']};},async 'execute'(_0x8e6c7e){const _0x14f9be=a166_0x1f866f,_0x18f249=loadSqlProjectConfig(_0x8e6c7e[_0x14f9be(0xe2)]),_0x31a531=await readSqlLockFile(_0x18f249['lockFilePath']);if(!_0x31a531)throw CliErrors[_0x14f9be(0xdf)](_0x14f9be(0xe4));const {lockData:_0x5933f9,appLock:_0x1a958f}=ensureSqlLockScope(_0x31a531,_0x8e6c7e[_0x14f9be(0xe2)],_0x18f249[_0x14f9be(0xdc)],_0x14f9be(0xe1)),_0x2c3cb7=_0x8e6c7e[_0x14f9be(0xd9)](_0x14f9be(0xf6)),_0x5c3373=_0x1a958f[_0x14f9be(0xf4)][_0x2c3cb7];if(!_0x5c3373)throw CliErrors['validation'](_0x14f9be(0xe3)+_0x2c3cb7+'\x22.');await deleteSqlQuery({'id':_0x5c3373['remoteId'],'sqlCode':_0x2c3cb7}),_0x1a958f[_0x14f9be(0xf4)]=Object['fromEntries'](Object[_0x14f9be(0xe5)](_0x1a958f['sqls'])['filter'](([_0x536890])=>_0x536890!==_0x2c3cb7)),_0x1a958f['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0x18f249[_0x14f9be(0xee)],_0x5933f9);const _0x22fbf1=resolveLocalSqlFilePath(_0x18f249,_0x2c3cb7,_0x5c3373);let _0x542fc3;await fileExists(_0x22fbf1)&&(_0x542fc3=await moveToTrash(_0x18f249[_0x14f9be(0xe6)],_0x18f249['trashDir'],_0x22fbf1),await cleanupEmptyDirectories(dirname(_0x22fbf1),_0x18f249[_0x14f9be(0xf5)]));const _0xbf0712={'deleted':_0x2c3cb7,'remoteId':_0x5c3373[_0x14f9be(0xfa)]};if(_0x542fc3)_0xbf0712[_0x14f9be(0xf0)]=_0x542fc3;return{'ok':!![],'data':_0xbf0712,'message':_0x14f9be(0xf8)+_0x2c3cb7+(_0x542fc3?_0x14f9be(0xde):'')};}};async function moveToTrash(_0x5d0823,_0x521d98,_0x5194f7){const _0x715019=a166_0x1f866f,_0x1e693b=new Date()[_0x715019(0xdb)]()[_0x715019(0xf9)](/[:.]/g,'-'),_0x990050=relative(_0x5d0823,_0x5194f7),_0x3dabbd=join(_0x521d98,_0x1e693b,_0x990050);return await mkdir(dirname(_0x3dabbd),{'recursive':!![]}),await rename(_0x5194f7,_0x3dabbd),_0x3dabbd;}async function cleanupEmptyDirectories(_0x2c58a6,_0x470845){const _0x18fdc0=a166_0x1f866f;let _0x7a7aab=resolve(_0x2c58a6);const _0x4b6136=resolve(_0x470845);while(_0x7a7aab[_0x18fdc0(0xeb)](''+_0x4b6136+sep)||_0x7a7aab===_0x4b6136){if(_0x7a7aab===_0x4b6136)return;try{const _0x59fcee=await readdir(_0x7a7aab);if(_0x59fcee[_0x18fdc0(0xdd)]>0x0)return;await rmdir(_0x7a7aab);}catch{return;}_0x7a7aab=dirname(_0x7a7aab);}}
1
+ const a167_0x1e27d7=a167_0x293a;(function(_0x27291f,_0x3a8f83){const _0x5c1a69=a167_0x293a,_0x173d52=_0x27291f();while(!![]){try{const _0x1d6ab7=parseInt(_0x5c1a69(0x1b9))/0x1+parseInt(_0x5c1a69(0x1b8))/0x2+parseInt(_0x5c1a69(0x1b7))/0x3+-parseInt(_0x5c1a69(0x1bc))/0x4*(-parseInt(_0x5c1a69(0x1a9))/0x5)+parseInt(_0x5c1a69(0x1aa))/0x6+-parseInt(_0x5c1a69(0x1af))/0x7*(-parseInt(_0x5c1a69(0x1b5))/0x8)+-parseInt(_0x5c1a69(0x1ac))/0x9;if(_0x1d6ab7===_0x3a8f83)break;else _0x173d52['push'](_0x173d52['shift']());}catch(_0x32bc56){_0x173d52['push'](_0x173d52['shift']());}}}(a167_0x743b,0x85b6c));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a167_0x293a(_0x44d4c7,_0x3087e4){_0x44d4c7=_0x44d4c7-0x1a4;const _0x743b17=a167_0x743b();let _0x293ab5=_0x743b17[_0x44d4c7];return _0x293ab5;}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';function a167_0x743b(){const _0x24d815=['fromEntries','lastSync','sqlcode','sqlRoot','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','delete','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','projectRoot','lockFilePath','filter','entries','POST','5arUReq','2874642OwNFSV','sqls','22319280nfgAOF','toISOString','str','260792DTmjfv','sql','startsWith','SQL\x20lock\x20file\x20not\x20found.','appCode','length','128UnIXso','/smartapi/custom/deleteUserCustomSql','433347QruFsg','1457104NzYtfq','501406SljfOk','validation','remoteId','2312008pUmZfm','trashDir','trashedTo','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','Deleted\x20','Would\x20delete\x20SQL\x20','replace'];a167_0x743b=function(){return _0x24d815;};return a167_0x743b();}export const sqlDelete={'service':a167_0x1e27d7(0x1b0),'command':a167_0x1e27d7(0x1c8),'description':a167_0x1e27d7(0x1c7),'risk':'high-risk-write','flags':[SQLCODE_FLAG],async 'validate'(_0x3db9e7){const _0x5d9ef7=a167_0x1e27d7,_0x5c1ad6=loadSqlProjectConfig(_0x3db9e7[_0x5d9ef7(0x1b3)]),_0x581071=await readSqlLockFile(_0x5c1ad6['lockFilePath']);if(!_0x581071)throw CliErrors[_0x5d9ef7(0x1ba)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x27a2ad){const _0xf0e417=a167_0x1e27d7,_0x36195a=loadSqlProjectConfig(_0x27a2ad[_0xf0e417(0x1b3)]),_0x3f7a15=await readSqlLockFile(_0x36195a[_0xf0e417(0x1a5)]);if(!_0x3f7a15)throw CliErrors[_0xf0e417(0x1ba)](_0xf0e417(0x1c9));const {appLock:_0x1bc493}=ensureSqlLockScope(_0x3f7a15,_0x27a2ad[_0xf0e417(0x1b3)],_0x36195a[_0xf0e417(0x1c6)],_0xf0e417(0x1c8)),_0x16421d=_0x27a2ad[_0xf0e417(0x1ae)](_0xf0e417(0x1c5)),_0x40f67a=_0x1bc493[_0xf0e417(0x1ab)][_0x16421d];if(!_0x40f67a)throw CliErrors[_0xf0e417(0x1ba)](_0xf0e417(0x1bf)+_0x16421d+'\x22.');return{'method':_0xf0e417(0x1a8),'url':_0xf0e417(0x1b6),'body':{'sqlCode':_0x16421d,'id':_0x40f67a[_0xf0e417(0x1bb)],'localPath':resolveLocalSqlFilePath(_0x36195a,_0x16421d,_0x40f67a)},'description':_0xf0e417(0x1c1)+_0x16421d+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x36195a[_0xf0e417(0x1bd)]};},async 'execute'(_0x33e74b){const _0x22c995=a167_0x1e27d7,_0xe92605=loadSqlProjectConfig(_0x33e74b[_0x22c995(0x1b3)]),_0x3cb4be=await readSqlLockFile(_0xe92605[_0x22c995(0x1a5)]);if(!_0x3cb4be)throw CliErrors[_0x22c995(0x1ba)](_0x22c995(0x1b2));const {lockData:_0x1b3196,appLock:_0x4a772d}=ensureSqlLockScope(_0x3cb4be,_0x33e74b[_0x22c995(0x1b3)],_0xe92605['sqlRoot'],_0x22c995(0x1c8)),_0x4a20f7=_0x33e74b[_0x22c995(0x1ae)](_0x22c995(0x1c5)),_0x41ab02=_0x4a772d[_0x22c995(0x1ab)][_0x4a20f7];if(!_0x41ab02)throw CliErrors['validation']('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x4a20f7+'\x22.');await deleteSqlQuery({'id':_0x41ab02[_0x22c995(0x1bb)],'sqlCode':_0x4a20f7}),_0x4a772d[_0x22c995(0x1ab)]=Object[_0x22c995(0x1c3)](Object[_0x22c995(0x1a7)](_0x4a772d[_0x22c995(0x1ab)])[_0x22c995(0x1a6)](([_0x4c768e])=>_0x4c768e!==_0x4a20f7)),_0x4a772d[_0x22c995(0x1c4)]=new Date()[_0x22c995(0x1ad)](),await writeSqlLockFile(_0xe92605['lockFilePath'],_0x1b3196);const _0x6aefde=resolveLocalSqlFilePath(_0xe92605,_0x4a20f7,_0x41ab02);let _0x2b332f;await fileExists(_0x6aefde)&&(_0x2b332f=await moveToTrash(_0xe92605[_0x22c995(0x1a4)],_0xe92605[_0x22c995(0x1bd)],_0x6aefde),await cleanupEmptyDirectories(dirname(_0x6aefde),_0xe92605['sqlRootDir']));const _0x280753={'deleted':_0x4a20f7,'remoteId':_0x41ab02['remoteId']};if(_0x2b332f)_0x280753[_0x22c995(0x1be)]=_0x2b332f;return{'ok':!![],'data':_0x280753,'message':_0x22c995(0x1c0)+_0x4a20f7+(_0x2b332f?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};async function moveToTrash(_0x28b7df,_0x432f95,_0x4686e9){const _0x334aa7=a167_0x1e27d7,_0x233cf2=new Date()[_0x334aa7(0x1ad)]()[_0x334aa7(0x1c2)](/[:.]/g,'-'),_0x515dc6=relative(_0x28b7df,_0x4686e9),_0x5ee91a=join(_0x432f95,_0x233cf2,_0x515dc6);return await mkdir(dirname(_0x5ee91a),{'recursive':!![]}),await rename(_0x4686e9,_0x5ee91a),_0x5ee91a;}async function cleanupEmptyDirectories(_0x39378a,_0x33376d){const _0x16fbfa=a167_0x1e27d7;let _0x3718c9=resolve(_0x39378a);const _0x30e4d1=resolve(_0x33376d);while(_0x3718c9[_0x16fbfa(0x1b1)](''+_0x30e4d1+sep)||_0x3718c9===_0x30e4d1){if(_0x3718c9===_0x30e4d1)return;try{const _0x306095=await readdir(_0x3718c9);if(_0x306095[_0x16fbfa(0x1b4)]>0x0)return;await rmdir(_0x3718c9);}catch{return;}_0x3718c9=dirname(_0x3718c9);}}
@@ -1 +1 @@
1
- const a167_0xeb3f5b=a167_0x32fe;function a167_0x32fe(_0x4d104d,_0x5a6d0f){_0x4d104d=_0x4d104d-0x149;const _0x113681=a167_0x1136();let _0x32fe83=_0x113681[_0x4d104d];return _0x32fe83;}(function(_0x8d79a6,_0xa5ebc6){const _0x27f448=a167_0x32fe,_0x4f4270=_0x8d79a6();while(!![]){try{const _0x3e2951=-parseInt(_0x27f448(0x153))/0x1*(parseInt(_0x27f448(0x149))/0x2)+-parseInt(_0x27f448(0x154))/0x3+-parseInt(_0x27f448(0x160))/0x4+parseInt(_0x27f448(0x151))/0x5*(-parseInt(_0x27f448(0x15d))/0x6)+parseInt(_0x27f448(0x157))/0x7+-parseInt(_0x27f448(0x156))/0x8+parseInt(_0x27f448(0x14d))/0x9;if(_0x3e2951===_0xa5ebc6)break;else _0x4f4270['push'](_0x4f4270['shift']());}catch(_0x49a144){_0x4f4270['push'](_0x4f4270['shift']());}}}(a167_0x1136,0xec9a0));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a167_0x1136(){const _0x323d9c=['dbId','57mSZwUr','4654680sxXLHN','sqlName','7197080SCZPFG','10820068RdPNgN','sqlCode','sqlContent','boolean','sql','detail','6lsKLZS','Return\x20full\x20raw\x20SQL\x20query\x20object','str','1749532GRjmWr','88qGNMGs','description','verbose','sqlcode','33510753MGZuhh','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','appCode','read','7044675pzAxSl'];a167_0x1136=function(){return _0x323d9c;};return a167_0x1136();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a167_0xeb3f5b(0x15b),'command':a167_0xeb3f5b(0x15c),'description':a167_0xeb3f5b(0x14e),'risk':a167_0xeb3f5b(0x150),'flags':[SQLCODE_FLAG,{'name':a167_0xeb3f5b(0x14b),'type':a167_0xeb3f5b(0x15a),'description':a167_0xeb3f5b(0x15e)}],async 'execute'(_0x2e5fa3){const _0x5f0c25=a167_0xeb3f5b,_0x84bc98=await getSqlQueryInfo(_0x2e5fa3[_0x5f0c25(0x14f)],_0x2e5fa3[_0x5f0c25(0x15f)](_0x5f0c25(0x14c))),_0x30d547=_0x2e5fa3['bool'](_0x5f0c25(0x14b));if(_0x30d547)return{'ok':!![],'data':_0x84bc98};const _0x46d69a=_0x84bc98[_0x5f0c25(0x152)]?await getDbName(_0x2e5fa3[_0x5f0c25(0x14f)],_0x84bc98[_0x5f0c25(0x152)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x84bc98[_0x5f0c25(0x158)],'sqlName':_0x84bc98[_0x5f0c25(0x155)],'db':_0x46d69a?_0x46d69a+'\x20('+_0x84bc98[_0x5f0c25(0x152)]+')':_0x84bc98[_0x5f0c25(0x152)]??'','description':_0x84bc98[_0x5f0c25(0x14a)]??'','sqlContent':_0x84bc98[_0x5f0c25(0x159)]??''}};}};
1
+ const a168_0x57376e=a168_0x3651;(function(_0x21f701,_0x214b89){const _0x48eb5b=a168_0x3651,_0x45af5c=_0x21f701();while(!![]){try{const _0x3eceb8=-parseInt(_0x48eb5b(0x9b))/0x1+parseInt(_0x48eb5b(0x9f))/0x2*(parseInt(_0x48eb5b(0xa3))/0x3)+parseInt(_0x48eb5b(0xa1))/0x4*(parseInt(_0x48eb5b(0x97))/0x5)+parseInt(_0x48eb5b(0xa2))/0x6+-parseInt(_0x48eb5b(0x96))/0x7*(-parseInt(_0x48eb5b(0x93))/0x8)+-parseInt(_0x48eb5b(0x9e))/0x9*(parseInt(_0x48eb5b(0xa4))/0xa)+parseInt(_0x48eb5b(0x9d))/0xb;if(_0x3eceb8===_0x214b89)break;else _0x45af5c['push'](_0x45af5c['shift']());}catch(_0x412968){_0x45af5c['push'](_0x45af5c['shift']());}}}(a168_0x18b7,0x8596f));import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a168_0x3651(_0x11d0f1,_0x37f2a8){_0x11d0f1=_0x11d0f1-0x93;const _0x18b7ba=a168_0x18b7();let _0x3651af=_0x18b7ba[_0x11d0f1];return _0x3651af;}function a168_0x18b7(){const _0x4bdc42=['42626YwPqGd','detail','8trmaZr','272904QHuAwA','33QentIW','519190uHpNPj','str','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','bool','read','verbose','boolean','description','dbId','5496rDPBdb','sql','Return\x20full\x20raw\x20SQL\x20query\x20object','6377xPArXF','784820nItDqp','sqlcode','sqlContent','appCode','777507KzScmX','sqlCode','5152521BNBHvX','63GVMjwB'];a168_0x18b7=function(){return _0x4bdc42;};return a168_0x18b7();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a168_0x57376e(0x94),'command':a168_0x57376e(0xa0),'description':a168_0x57376e(0xa6),'risk':a168_0x57376e(0xa8),'flags':[SQLCODE_FLAG,{'name':a168_0x57376e(0xa9),'type':a168_0x57376e(0xaa),'description':a168_0x57376e(0x95)}],async 'execute'(_0x2cecb6){const _0x59695d=a168_0x57376e,_0x8e3fbf=await getSqlQueryInfo(_0x2cecb6[_0x59695d(0x9a)],_0x2cecb6[_0x59695d(0xa5)](_0x59695d(0x98))),_0x144c5a=_0x2cecb6[_0x59695d(0xa7)](_0x59695d(0xa9));if(_0x144c5a)return{'ok':!![],'data':_0x8e3fbf};const _0x1f915d=_0x8e3fbf[_0x59695d(0xac)]?await getDbName(_0x2cecb6[_0x59695d(0x9a)],_0x8e3fbf['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0x8e3fbf[_0x59695d(0x9c)],'sqlName':_0x8e3fbf['sqlName'],'db':_0x1f915d?_0x1f915d+'\x20('+_0x8e3fbf[_0x59695d(0xac)]+')':_0x8e3fbf['dbId']??'','description':_0x8e3fbf[_0x59695d(0xab)]??'','sqlContent':_0x8e3fbf[_0x59695d(0x99)]??''}};}};
@@ -1 +1 @@
1
- function a168_0x428b(_0x6bdd5e,_0x3e8ba7){_0x6bdd5e=_0x6bdd5e-0xa6;const _0x4f24a4=a168_0x4f24();let _0x428b02=_0x4f24a4[_0x6bdd5e];return _0x428b02;}const a168_0x3e92f4=a168_0x428b;(function(_0x21b131,_0x2cf484){const _0x5e1d65=a168_0x428b,_0x348338=_0x21b131();while(!![]){try{const _0x1fc94e=parseInt(_0x5e1d65(0xbb))/0x1+parseInt(_0x5e1d65(0xa7))/0x2*(-parseInt(_0x5e1d65(0xa9))/0x3)+-parseInt(_0x5e1d65(0xb3))/0x4+parseInt(_0x5e1d65(0xb6))/0x5+parseInt(_0x5e1d65(0xb5))/0x6+-parseInt(_0x5e1d65(0xad))/0x7+parseInt(_0x5e1d65(0xb0))/0x8;if(_0x1fc94e===_0x2cf484)break;else _0x348338['push'](_0x348338['shift']());}catch(_0x319b1c){_0x348338['push'](_0x348338['shift']());}}}(a168_0x4f24,0xeee8f));import{executeSql}from'../../core/api-client.js';function a168_0x4f24(){const _0x5f17ba=['Returned\x20','now','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','1797159MDohXQ','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','4062gZjjQo','execSuccess','2793TTwToZ','read','SQL\x20execution\x20failed','str','2274692VcMwqr','sql','\x20row(s)\x20in\x20','3830744ICgILk','exec','execError','60608fOwjAN','string','1615650sMyzBH','3321335HhRBxn','params'];a168_0x4f24=function(){return _0x5f17ba;};return a168_0x4f24();}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a168_0x3e92f4(0xae),'command':a168_0x3e92f4(0xb1),'description':a168_0x3e92f4(0xa6),'risk':a168_0x3e92f4(0xaa),'flags':[SQLCODE_FLAG,{'name':a168_0x3e92f4(0xb7),'type':a168_0x3e92f4(0xb4),'description':a168_0x3e92f4(0xba)}],async 'execute'(_0x4bec1d){const _0x5400b6=a168_0x3e92f4,_0x2a184b=parseJsonParams(_0x4bec1d['str'](_0x5400b6(0xb7))),_0x2ef319=Date[_0x5400b6(0xb9)](),_0x5493a8=await executeSql(_0x4bec1d['appCode'],_0x4bec1d[_0x5400b6(0xac)]('sqlcode'),_0x2a184b),_0x3ac09d=Date[_0x5400b6(0xb9)]()-_0x2ef319,_0x511a54=_0x5493a8?.['execResult']??_0x5493a8,_0x428c03=_0x5493a8?.[_0x5400b6(0xa8)]??!![];if(!_0x428c03)return{'ok':![],'data':{'error':_0x5493a8?.[_0x5400b6(0xb2)]||_0x5400b6(0xab),'elapsed':_0x3ac09d},'message':'SQL\x20execution\x20failed'};const _0x552aee=Array['isArray'](_0x511a54)?_0x511a54:[];return{'ok':!![],'data':{'rows':_0x552aee,'rowCount':_0x552aee['length'],'elapsed':_0x3ac09d},'message':_0x5400b6(0xb8)+_0x552aee['length']+_0x5400b6(0xaf)+_0x3ac09d+'ms'};}};
1
+ function a169_0x169e(_0x324835,_0x43c497){_0x324835=_0x324835-0x1a8;const _0x5e2749=a169_0x5e27();let _0x169e06=_0x5e2749[_0x324835];return _0x169e06;}const a169_0x32217a=a169_0x169e;(function(_0x36691b,_0x152f7f){const _0x565566=a169_0x169e,_0x46d812=_0x36691b();while(!![]){try{const _0x252356=parseInt(_0x565566(0x1bb))/0x1*(-parseInt(_0x565566(0x1b0))/0x2)+-parseInt(_0x565566(0x1b2))/0x3+-parseInt(_0x565566(0x1ad))/0x4+-parseInt(_0x565566(0x1b5))/0x5+parseInt(_0x565566(0x1ba))/0x6+-parseInt(_0x565566(0x1b7))/0x7*(-parseInt(_0x565566(0x1a8))/0x8)+parseInt(_0x565566(0x1b1))/0x9;if(_0x252356===_0x152f7f)break;else _0x46d812['push'](_0x46d812['shift']());}catch(_0xc68f17){_0x46d812['push'](_0x46d812['shift']());}}}(a169_0x5e27,0x3d988));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a169_0x5e27(){const _0x4b39c8=['Returned\x20','str','1798485FfwSOo','execResult','45689UHEOFY','params','sqlcode','2949150nJMXYt','88MPaoTp','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','exec','appCode','execError','now','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','\x20row(s)\x20in\x20','isArray','64erwupJ','execSuccess','read','length','sql','1378116uRiTIb','string','SQL\x20execution\x20failed','8546cjCnlU','10743012xTfRUR','1214589ZAaSqK'];a169_0x5e27=function(){return _0x4b39c8;};return a169_0x5e27();}export const sqlExec={'service':a169_0x32217a(0x1ac),'command':a169_0x32217a(0x1bd),'description':a169_0x32217a(0x1c1),'risk':a169_0x32217a(0x1aa),'flags':[SQLCODE_FLAG,{'name':a169_0x32217a(0x1b8),'type':a169_0x32217a(0x1ae),'description':a169_0x32217a(0x1bc)}],async 'execute'(_0x59b1a4){const _0x367a75=a169_0x32217a,_0x2aae00=parseJsonParams(_0x59b1a4[_0x367a75(0x1b4)](_0x367a75(0x1b8))),_0x5065eb=Date[_0x367a75(0x1c0)](),_0x3fa80d=await executeSql(_0x59b1a4[_0x367a75(0x1be)],_0x59b1a4[_0x367a75(0x1b4)](_0x367a75(0x1b9)),_0x2aae00),_0x5764d9=Date[_0x367a75(0x1c0)]()-_0x5065eb,_0x4722ec=_0x3fa80d?.[_0x367a75(0x1b6)]??_0x3fa80d,_0xb3b39d=_0x3fa80d?.[_0x367a75(0x1a9)]??!![];if(!_0xb3b39d)return{'ok':![],'data':{'error':_0x3fa80d?.[_0x367a75(0x1bf)]||_0x367a75(0x1af),'elapsed':_0x5764d9},'message':'SQL\x20execution\x20failed'};const _0x198c57=Array[_0x367a75(0x1c3)](_0x4722ec)?_0x4722ec:[];return{'ok':!![],'data':{'rows':_0x198c57,'rowCount':_0x198c57['length'],'elapsed':_0x5764d9},'message':_0x367a75(0x1b3)+_0x198c57[_0x367a75(0x1ab)]+_0x367a75(0x1c2)+_0x5764d9+'ms'};}};
@@ -1 +1 @@
1
- (function(_0x3606ae,_0x3e8f44){const _0x22bba5=a169_0x2b3d,_0x11aabb=_0x3606ae();while(!![]){try{const _0x2692e7=-parseInt(_0x22bba5(0x199))/0x1+-parseInt(_0x22bba5(0x198))/0x2*(parseInt(_0x22bba5(0x19d))/0x3)+parseInt(_0x22bba5(0x19a))/0x4+parseInt(_0x22bba5(0x1a1))/0x5+parseInt(_0x22bba5(0x19e))/0x6*(-parseInt(_0x22bba5(0x19b))/0x7)+-parseInt(_0x22bba5(0x19f))/0x8+-parseInt(_0x22bba5(0x1a0))/0x9*(-parseInt(_0x22bba5(0x19c))/0xa);if(_0x2692e7===_0x3e8f44)break;else _0x11aabb['push'](_0x11aabb['shift']());}catch(_0x4b9967){_0x11aabb['push'](_0x11aabb['shift']());}}}(a169_0x17bb,0x56239));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';function a169_0x2b3d(_0x2f2948,_0x560b62){_0x2f2948=_0x2f2948-0x198;const _0x17bbd9=a169_0x17bb();let _0x2b3de4=_0x17bbd9[_0x2f2948];return _0x2b3de4;}import{sqlSave}from'../../commands/sql/save.js';import{sqlExec}from'../../commands/sql/exec.js';function a169_0x17bb(){const _0x4d08ec=['1077tBoHpg','2133156kqzBUZ','4848024FezuHL','9993438lQnQOR','2385555ZvcQIN','3478CYPVtw','57414YCIUOF','1634304TpBmZJ','7tZxyUv','10htLICO'];a169_0x17bb=function(){return _0x4d08ec;};return a169_0x17bb();}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';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlSave,sqlExec,sqlPull,sqlDelete];
1
+ (function(_0x4c0c18,_0x38da73){const _0x5244be=a170_0xab9d,_0x2ef32d=_0x4c0c18();while(!![]){try{const _0xf46db8=-parseInt(_0x5244be(0xc9))/0x1*(-parseInt(_0x5244be(0xc8))/0x2)+parseInt(_0x5244be(0xc4))/0x3+parseInt(_0x5244be(0xc3))/0x4+parseInt(_0x5244be(0xc2))/0x5*(-parseInt(_0x5244be(0xca))/0x6)+parseInt(_0x5244be(0xc1))/0x7+-parseInt(_0x5244be(0xc7))/0x8*(parseInt(_0x5244be(0xc6))/0x9)+parseInt(_0x5244be(0xcb))/0xa*(-parseInt(_0x5244be(0xc5))/0xb);if(_0xf46db8===_0x38da73)break;else _0x2ef32d['push'](_0x2ef32d['shift']());}catch(_0x3a5c7e){_0x2ef32d['push'](_0x2ef32d['shift']());}}}(a170_0x40fa,0x8a334));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';function a170_0x40fa(){const _0x2719e4=['6762105FvFrLj','2907395TgpMas','3557952QrnpLX','3307236yQUBTn','682aiZJGd','9Bphhth','5983544SyItqL','146VYBGqa','3715JrfIRL','6moqNjT','215100KXmAuH'];a170_0x40fa=function(){return _0x2719e4;};return a170_0x40fa();}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';function a170_0xab9d(_0x1117fa,_0xb762b){_0x1117fa=_0x1117fa-0xc1;const _0x40fa48=a170_0x40fa();let _0xab9db6=_0x40fa48[_0x1117fa];return _0xab9db6;}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,sqlSave,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- const a170_0x569f16=a170_0x13ef;function a170_0x13ef(_0x35f374,_0x4a9853){_0x35f374=_0x35f374-0x15a;const _0x4cd7f8=a170_0x4cd7();let _0x13ef46=_0x4cd7f8[_0x35f374];return _0x13ef46;}(function(_0x162790,_0x20a7bf){const _0x1d4797=a170_0x13ef,_0x5f3999=_0x162790();while(!![]){try{const _0x21b534=-parseInt(_0x1d4797(0x179))/0x1*(parseInt(_0x1d4797(0x172))/0x2)+parseInt(_0x1d4797(0x169))/0x3+parseInt(_0x1d4797(0x162))/0x4+parseInt(_0x1d4797(0x165))/0x5+-parseInt(_0x1d4797(0x16a))/0x6+parseInt(_0x1d4797(0x161))/0x7*(-parseInt(_0x1d4797(0x15e))/0x8)+parseInt(_0x1d4797(0x174))/0x9;if(_0x21b534===_0x20a7bf)break;else _0x5f3999['push'](_0x5f3999['shift']());}catch(_0x10fb71){_0x5f3999['push'](_0x5f3999['shift']());}}}(a170_0x4cd7,0xefb86));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a170_0x4cd7(){const _0x1048f3=['4400457qLwFkP','7637502bOOZyD','pagesize','bool','page','tableData','number','paging','dbId','2PbvshX','string','9769887XIBDjY','length','verbose','Page\x20size','sqlcode','1538079DyNbcX','\x20SQL\x20queries\x20(total:\x20','description','str','sqlCode','No\x20custom\x20SQL\x20queries\x20found.','List\x20custom\x20SQL\x20queries','list','all','sql','4322184OiPgqu','name','Found\x20','21HYvkEm','4912500DlQRGh','num','Filter\x20by\x20SQL\x20name','8166110mvhSPs','Page\x20number','sqlName','appCode'];a170_0x4cd7=function(){return _0x1048f3;};return a170_0x4cd7();}export const sqlList={'service':a170_0x569f16(0x15d),'command':a170_0x569f16(0x15b),'description':a170_0x569f16(0x15a),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a170_0x569f16(0x15f),'type':a170_0x569f16(0x173),'description':a170_0x569f16(0x164)},{'name':a170_0x569f16(0x16d),'type':a170_0x569f16(0x16f),'description':a170_0x569f16(0x166),'default':0x1},{'name':'pagesize','type':a170_0x569f16(0x16f),'description':a170_0x569f16(0x177)},{'name':a170_0x569f16(0x176),'type':'boolean','description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x2476a8){const _0x27627c=a170_0x569f16,_0x9cc765=await listSqlQueries(_0x2476a8[_0x27627c(0x168)],{'sqlCode':_0x2476a8['str'](_0x27627c(0x178))||undefined,'sqlName':_0x2476a8[_0x27627c(0x17c)]('name')||undefined,'currentPage':_0x2476a8[_0x27627c(0x163)]('page'),'pageSize':_0x2476a8[_0x27627c(0x163)](_0x27627c(0x16b),0x32)}),_0x1d6163=_0x2476a8[_0x27627c(0x16c)](_0x27627c(0x176)),_0x445b3b=_0x9cc765[_0x27627c(0x16e)]??[],_0x539096=_0x9cc765[_0x27627c(0x170)]?.['totalCount']??_0x445b3b['length'];let _0x167208;return _0x1d6163?_0x167208=_0x445b3b:_0x167208=await Promise[_0x27627c(0x15c)](_0x445b3b['map'](async _0x2b04e1=>{const _0x59b78c=_0x27627c;let _0x3be20a;try{_0x3be20a=_0x2b04e1['dbId']?await getDbName(_0x2476a8['appCode'],_0x2b04e1[_0x59b78c(0x171)]):undefined;}catch{}return{'sqlCode':_0x2b04e1[_0x59b78c(0x17d)],'sqlName':_0x2b04e1[_0x59b78c(0x167)],'description':_0x2b04e1[_0x59b78c(0x17b)]??'','db':_0x3be20a?_0x3be20a+'\x20('+_0x2b04e1[_0x59b78c(0x171)]+')':_0x2b04e1[_0x59b78c(0x171)]??''};})),{'ok':!![],'data':_0x167208,'message':_0x445b3b[_0x27627c(0x175)]===0x0?_0x27627c(0x17e):_0x27627c(0x160)+_0x445b3b[_0x27627c(0x175)]+_0x27627c(0x17a)+_0x539096+').'};}};
1
+ const a171_0x13054d=a171_0xb969;(function(_0x528198,_0x432856){const _0x2fcd23=a171_0xb969,_0x388207=_0x528198();while(!![]){try{const _0x16fa26=-parseInt(_0x2fcd23(0x1e7))/0x1*(-parseInt(_0x2fcd23(0x1da))/0x2)+parseInt(_0x2fcd23(0x1d3))/0x3*(parseInt(_0x2fcd23(0x1cd))/0x4)+parseInt(_0x2fcd23(0x1e9))/0x5+parseInt(_0x2fcd23(0x1db))/0x6+-parseInt(_0x2fcd23(0x1ea))/0x7*(-parseInt(_0x2fcd23(0x1c8))/0x8)+parseInt(_0x2fcd23(0x1d4))/0x9+-parseInt(_0x2fcd23(0x1d2))/0xa;if(_0x16fa26===_0x432856)break;else _0x388207['push'](_0x388207['shift']());}catch(_0x4d20b5){_0x388207['push'](_0x388207['shift']());}}}(a171_0x2a09,0x6affc));import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';function a171_0x2a09(){const _0x59acde=['dbId','2vyJhnd','totalCount','3330530SoRDlS','7frxzek','Filter\x20by\x20SQL\x20name','read','name','length','list','288376jxfRfF','verbose','sql','string','page','22684LjjwrL','\x20SQL\x20queries\x20(total:\x20','Found\x20','Page\x20size','No\x20custom\x20SQL\x20queries\x20found.','18098300yZzMXM','213KvWPmx','3773124iHXluN','Page\x20number','num','bool','appCode','pagesize','718302DuacPM','34596OZMKId','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','description','sqlCode','sqlcode','paging','str','number','map','boolean','tableData'];a171_0x2a09=function(){return _0x59acde;};return a171_0x2a09();}function a171_0xb969(_0x35ca8e,_0x1238f9){_0x35ca8e=_0x35ca8e-0x1c8;const _0x2a0929=a171_0x2a09();let _0xb969d=_0x2a0929[_0x35ca8e];return _0xb969d;}import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a171_0x13054d(0x1ca),'command':a171_0x13054d(0x1ef),'description':'List\x20custom\x20SQL\x20queries','risk':a171_0x13054d(0x1ec),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'name','type':a171_0x13054d(0x1cb),'description':a171_0x13054d(0x1eb)},{'name':a171_0x13054d(0x1cc),'type':a171_0x13054d(0x1e2),'description':a171_0x13054d(0x1d5),'default':0x1},{'name':a171_0x13054d(0x1d9),'type':a171_0x13054d(0x1e2),'description':a171_0x13054d(0x1d0)},{'name':a171_0x13054d(0x1c9),'type':a171_0x13054d(0x1e4),'description':a171_0x13054d(0x1dc)}],async 'execute'(_0x146137){const _0x4e6cea=a171_0x13054d,_0x3925be=await listSqlQueries(_0x146137['appCode'],{'sqlCode':_0x146137[_0x4e6cea(0x1e1)](_0x4e6cea(0x1df))||undefined,'sqlName':_0x146137[_0x4e6cea(0x1e1)](_0x4e6cea(0x1ed))||undefined,'currentPage':_0x146137[_0x4e6cea(0x1d6)]('page'),'pageSize':_0x146137[_0x4e6cea(0x1d6)](_0x4e6cea(0x1d9),0x32)}),_0x58c00c=_0x146137[_0x4e6cea(0x1d7)](_0x4e6cea(0x1c9)),_0x15df67=_0x3925be[_0x4e6cea(0x1e5)]??[],_0x14a37b=_0x3925be[_0x4e6cea(0x1e0)]?.[_0x4e6cea(0x1e8)]??_0x15df67[_0x4e6cea(0x1ee)];let _0xa78138;return _0x58c00c?_0xa78138=_0x15df67:_0xa78138=await Promise['all'](_0x15df67[_0x4e6cea(0x1e3)](async _0x3ab449=>{const _0x514104=_0x4e6cea;let _0x31eb2e;try{_0x31eb2e=_0x3ab449[_0x514104(0x1e6)]?await getDbName(_0x146137[_0x514104(0x1d8)],_0x3ab449[_0x514104(0x1e6)]):undefined;}catch{}return{'sqlCode':_0x3ab449[_0x514104(0x1de)],'sqlName':_0x3ab449['sqlName'],'description':_0x3ab449[_0x514104(0x1dd)]??'','db':_0x31eb2e?_0x31eb2e+'\x20('+_0x3ab449[_0x514104(0x1e6)]+')':_0x3ab449[_0x514104(0x1e6)]??''};})),{'ok':!![],'data':_0xa78138,'message':_0x15df67[_0x4e6cea(0x1ee)]===0x0?_0x4e6cea(0x1d1):_0x4e6cea(0x1cf)+_0x15df67['length']+_0x4e6cea(0x1ce)+_0x14a37b+').'};}};
@@ -1 +1 @@
1
- const a171_0x2f03e6=a171_0x580d;(function(_0xbab3b9,_0x144d3c){const _0x55d225=a171_0x580d,_0x34caf6=_0xbab3b9();while(!![]){try{const _0xbd3f1d=parseInt(_0x55d225(0xfe))/0x1*(parseInt(_0x55d225(0xf9))/0x2)+parseInt(_0x55d225(0x113))/0x3*(-parseInt(_0x55d225(0x114))/0x4)+parseInt(_0x55d225(0xf5))/0x5*(-parseInt(_0x55d225(0xef))/0x6)+parseInt(_0x55d225(0x118))/0x7*(parseInt(_0x55d225(0xe8))/0x8)+parseInt(_0x55d225(0x10e))/0x9+-parseInt(_0x55d225(0xea))/0xa+-parseInt(_0x55d225(0xdd))/0xb*(-parseInt(_0x55d225(0x11d))/0xc);if(_0xbd3f1d===_0x144d3c)break;else _0x34caf6['push'](_0x34caf6['shift']());}catch(_0x284752){_0x34caf6['push'](_0x34caf6['shift']());}}}(a171_0x16a6,0x3e5b5));import{readFile,rm,writeFile}from'node:fs/promises';function a171_0x580d(_0x3630fe,_0x26bb9c){_0x3630fe=_0x3630fe-0xdd;const _0x16a6fc=a171_0x16a6();let _0x580d6b=_0x16a6fc[_0x3630fe];return _0x580d6b;}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';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(_0x11112e,_0x276ae2){const _0x42149e=a171_0x580d,_0x272719=[];let _0x5bc19f=0x1;while(!![]){const _0x536149=await listSqlQueries(_0x11112e,{'currentPage':_0x5bc19f,'pageSize':PAGE_SIZE,'sqlCode':_0x276ae2[_0x42149e(0x10b)],'sqlName':_0x276ae2[_0x42149e(0xeb)]}),_0x243e78=_0x536149['tableData']??[];_0x272719[_0x42149e(0xdf)](..._0x243e78);if(_0x243e78[_0x42149e(0xec)]===0x0)break;const _0x139f59=_0x536149[_0x42149e(0x111)]?.[_0x42149e(0xe9)];if(_0x139f59!=null?_0x272719[_0x42149e(0xec)]>=_0x139f59:_0x243e78['length']<PAGE_SIZE)break;_0x5bc19f++;}return _0x272719;}async function ensureSqlContent(_0x3c23d3){const _0x2e887d=a171_0x580d;if(_0x3c23d3['sqlContent']!=null&&String(_0x3c23d3[_0x2e887d(0xe4)])[_0x2e887d(0xec)]>0x0)return _0x3c23d3;return getSqlQueryDetail(_0x3c23d3[_0x2e887d(0x10b)]);}function a171_0x16a6(){const _0x2b789e=['bool','2417945icIYah','appCode','path','description','943802wfOKOO','force','mybatisXml','Filter\x20by\x20SQL\x20display\x20name','lastSync','1RlHxPS','boolean','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','\x20written,\x20','skipped','str','sqlcode','test','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','utf8','local\x20differs\x20from\x20remote','POST','Force\x20pull\x20cancelled.','sqlCode','conflict','pull','3515274UgeHmI','join','trimStart','paging','sqls','24iNZwBu','149308sEWMQa','toISOString','Pull\x20complete:\x20','nonInteractive','7KsuSBw','catch','dbId','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','\x20skipped,\x20','398592TmPtzj','Force\x20overwrite\x20local\x20unsynced\x20changes','22xKzcTd','would_pull','push','cancelled','\x20SQL\x20file(s)\x20into\x20','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','apps','sqlContent','lockFilePath','\x20failed','message','1632296IxWBxB','totalCount','953380xNNZaL','sqlName','length','sqlRootDir','sqlRoot','6MwJRBO','No\x20remote\x20SQL\x20queries\x20matched.','string','write','name'];a171_0x16a6=function(){return _0x2b789e;};return a171_0x16a6();}export const sqlPull={'service':'sql','command':a171_0x2f03e6(0x10d),'description':a171_0x2f03e6(0x106),'risk':a171_0x2f03e6(0xf2),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a171_0x2f03e6(0xf3),'type':a171_0x2f03e6(0xf1),'description':a171_0x2f03e6(0xfc)},{'name':a171_0x2f03e6(0xfa),'type':a171_0x2f03e6(0xff),'description':a171_0x2f03e6(0x11e)}],async 'dryRun'(_0x94680c){const _0x410ecd=a171_0x2f03e6,_0x39fd21=loadSqlProjectConfig(_0x94680c[_0x410ecd(0xf6)]),_0x694c6a=await readSqlLockFile(_0x39fd21[_0x410ecd(0xe5)]),{appLock:_0x54f855}=ensureSqlLockScope(_0x694c6a??createEmptySqlLock(),_0x39fd21['appCode'],_0x39fd21[_0x410ecd(0xee)],_0x410ecd(0x10d)),_0x53c1b4=await fetchAllSqlQueries(_0x94680c[_0x410ecd(0xf6)],{'sqlCode':_0x94680c[_0x410ecd(0x103)](_0x410ecd(0x104))||undefined,'sqlName':_0x94680c[_0x410ecd(0x103)](_0x410ecd(0xf3))||undefined}),_0x414904=[];for(const _0x356335 of _0x53c1b4){const _0x40702c=await ensureSqlContent(_0x356335),_0x456989=ensureRemoteSqlContent(_0x40702c),_0x3d6b17=detectModeFromSql(_0x40702c),_0x30b7a0=_0x40702c[_0x410ecd(0x11a)]?await getDbName(_0x94680c['appCode'],Number(_0x40702c['dbId']))[_0x410ecd(0x119)](()=>undefined):undefined,_0x346cd2=buildLocalSqlFileContent({'sqlCode':_0x40702c[_0x410ecd(0x10b)],'sqlName':_0x40702c[_0x410ecd(0xeb)],'dbId':_0x40702c[_0x410ecd(0x11a)]},_0x456989,{'dbName':_0x30b7a0,'mode':_0x3d6b17,'syncedAt':new Date()[_0x410ecd(0x115)](),'description':_0x40702c[_0x410ecd(0xf8)]}),_0xd7ebb1=buildSqlLockEntry(_0x40702c,_0x456989,'',{'dbName':_0x30b7a0}),_0x399e91=resolveLocalSqlFilePath(_0x39fd21,_0x40702c['sqlCode'],_0xd7ebb1);let _0x3cc8fa=_0x410ecd(0xde),_0x21dc93;if(await fileExists(_0x399e91)){const _0x58a759=await readFile(_0x399e91,_0x410ecd(0x107));isEquivalentPulledSqlFile(_0x58a759,_0x346cd2,_0x3d6b17)?(_0x3cc8fa=_0x410ecd(0x102),_0x21dc93='unchanged'):(_0x3cc8fa=_0x410ecd(0x10c),_0x21dc93=_0x410ecd(0x100));}_0x414904['push']({'sqlCode':_0x40702c[_0x410ecd(0x10b)],'sqlName':_0x40702c[_0x410ecd(0xeb)],'filePath':_0x399e91,'status':_0x3cc8fa,'reason':_0x21dc93});}return{'method':_0x410ecd(0x109),'url':_0x410ecd(0xe2),'body':{'appCode':_0x94680c[_0x410ecd(0xf6)],'sqlCode':_0x94680c[_0x410ecd(0x103)](_0x410ecd(0x104))||null,'sqlName':_0x94680c[_0x410ecd(0x103)](_0x410ecd(0xf3))||null,'files':_0x414904},'description':'Would\x20pull\x20'+_0x414904['length']+_0x410ecd(0xe1)+_0x39fd21[_0x410ecd(0xed)]};},async 'execute'(_0x414285){const _0x5b49c8=a171_0x2f03e6,_0x56d725=loadSqlProjectConfig(_0x414285['appCode']),_0x51e72e=await readSqlLockFile(_0x56d725[_0x5b49c8(0xe5)]),{lockData:_0x38188b,appLock:_0x14a4f3}=ensureSqlLockScope(_0x51e72e??createEmptySqlLock(),_0x56d725[_0x5b49c8(0xf6)],_0x56d725[_0x5b49c8(0xee)],_0x5b49c8(0x10d)),_0x45cb4a=_0x414285[_0x5b49c8(0xf4)](_0x5b49c8(0xfa)),_0x4bbc3c=await fetchAllSqlQueries(_0x414285[_0x5b49c8(0xf6)],{'sqlCode':_0x414285['str']('sqlcode')||undefined,'sqlName':_0x414285['str'](_0x5b49c8(0xf3))||undefined});if(_0x4bbc3c[_0x5b49c8(0xec)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x5b49c8(0xf0)};const _0x5e00aa=[],_0x13e4e0=[];for(const _0x3892e6 of _0x4bbc3c){try{_0x5e00aa[_0x5b49c8(0xdf)](await ensureSqlContent(_0x3892e6));}catch(_0x4b30d7){_0x13e4e0['push']({'sqlCode':_0x3892e6['sqlCode'],'error':_0x4b30d7 instanceof Error?_0x4b30d7[_0x5b49c8(0xe7)]:String(_0x4b30d7)});}}if(_0x45cb4a&&!_0x414285[_0x5b49c8(0x117)]){let _0x2f1903=![];for(const _0x5cf721 of _0x5e00aa){const _0x1afbf6=detectModeFromSql(_0x5cf721),_0x474c15=_0x5cf721[_0x5b49c8(0x11a)]?await getDbName(_0x414285[_0x5b49c8(0xf6)],Number(_0x5cf721['dbId']))['catch'](()=>undefined):undefined,_0x5eaf3e=buildLocalSqlFileContent({'sqlCode':_0x5cf721[_0x5b49c8(0x10b)],'sqlName':_0x5cf721['sqlName'],'dbId':_0x5cf721[_0x5b49c8(0x11a)]},ensureRemoteSqlContent(_0x5cf721),{'dbName':_0x474c15,'mode':_0x1afbf6,'syncedAt':new Date()[_0x5b49c8(0x115)](),'description':_0x5cf721['description']}),_0x4999ab=resolveLocalSqlFilePath(_0x56d725,_0x5cf721[_0x5b49c8(0x10b)],buildSqlLockEntry(_0x5cf721,ensureRemoteSqlContent(_0x5cf721),'',{'dbName':_0x474c15}));if(await fileExists(_0x4999ab)){const _0x5c2ae8=await readFile(_0x4999ab,'utf8');if(!isEquivalentPulledSqlFile(_0x5c2ae8,_0x5eaf3e,_0x1afbf6)){_0x2f1903=!![];break;}}}if(_0x2f1903){const _0x13e09e=await confirmForceOverwrite(_0x5b49c8(0x11b));if(!_0x13e09e)throw CliErrors[_0x5b49c8(0xe0)](_0x5b49c8(0x10a));}}const _0x50edc5=cloneSqlLockData(_0x38188b),_0x49e5d4=_0x50edc5[_0x5b49c8(0xe3)][_0x56d725['appCode']],_0x543025=[],_0x217eda=[];for(const _0x11e6dd of _0x5e00aa){const _0x576af0=_0x49e5d4[_0x5b49c8(0x112)][_0x11e6dd[_0x5b49c8(0x10b)]],_0x554ff7=ensureRemoteSqlContent(_0x11e6dd),_0x3cbf85=detectModeFromSql(_0x11e6dd),_0x317e87=_0x11e6dd[_0x5b49c8(0x11a)]?await getDbName(_0x414285[_0x5b49c8(0xf6)],Number(_0x11e6dd[_0x5b49c8(0x11a)]))[_0x5b49c8(0x119)](()=>undefined):undefined,_0x7b9f40=buildLocalSqlFileContent({'sqlCode':_0x11e6dd['sqlCode'],'sqlName':_0x11e6dd[_0x5b49c8(0xeb)],'dbId':_0x11e6dd['dbId']},_0x554ff7,{'dbName':_0x317e87,'mode':_0x3cbf85,'syncedAt':new Date()[_0x5b49c8(0x115)](),'description':_0x11e6dd[_0x5b49c8(0xf8)]}),_0x4f35cc=buildSqlLockEntry(_0x11e6dd,_0x554ff7,computeSqlContentHash(_0x7b9f40),{'dbName':_0x317e87}),_0x5535da=_0x4f35cc[_0x5b49c8(0xf7)],_0xef6d9d=join(_0x56d725[_0x5b49c8(0xed)],_0x5535da);try{if(await fileExists(_0xef6d9d)){const _0x3d1ca8=await readFile(_0xef6d9d,_0x5b49c8(0x107));if(isEquivalentPulledSqlFile(_0x3d1ca8,_0x7b9f40,_0x3cbf85)){_0x217eda[_0x5b49c8(0xdf)]({'sqlCode':_0x11e6dd[_0x5b49c8(0x10b)],'reason':'unchanged'}),_0x49e5d4[_0x5b49c8(0x112)][_0x11e6dd[_0x5b49c8(0x10b)]]={..._0x4f35cc,'hash':computeSqlContentHash(_0x3d1ca8),'path':_0x5535da};continue;}if(!_0x45cb4a){_0x217eda[_0x5b49c8(0xdf)]({'sqlCode':_0x11e6dd[_0x5b49c8(0x10b)],'reason':_0x5b49c8(0x108)});continue;}}const _0x2ebc61=_0x576af0?.[_0x5b49c8(0xf7)]?join(_0x56d725[_0x5b49c8(0xed)],_0x576af0[_0x5b49c8(0xf7)]):undefined;_0x2ebc61&&_0x2ebc61!==_0xef6d9d&&await fileExists(_0x2ebc61)&&await rm(_0x2ebc61,{'force':!![]}),await ensureParentDirectory(_0xef6d9d),await writeFile(_0xef6d9d,_0x7b9f40,_0x5b49c8(0x107)),_0x49e5d4[_0x5b49c8(0x112)][_0x11e6dd['sqlCode']]={..._0x4f35cc,'path':_0x5535da},_0x543025['push']({'sqlCode':_0x11e6dd[_0x5b49c8(0x10b)],'filePath':_0xef6d9d});}catch(_0x3f3f05){_0x13e4e0['push']({'sqlCode':_0x11e6dd[_0x5b49c8(0x10b)],'error':_0x3f3f05 instanceof Error?_0x3f3f05[_0x5b49c8(0xe7)]:String(_0x3f3f05)});}}return _0x49e5d4[_0x5b49c8(0xfd)]=new Date()[_0x5b49c8(0x115)](),await writeSqlLockFile(_0x56d725[_0x5b49c8(0xe5)],_0x50edc5),{'ok':_0x13e4e0['length']===0x0,'data':{'pulled':_0x543025,'skipped':_0x217eda,'failed':_0x13e4e0},'message':_0x5b49c8(0x116)+_0x543025['length']+_0x5b49c8(0x101)+_0x217eda[_0x5b49c8(0xec)]+_0x5b49c8(0x11c)+_0x13e4e0[_0x5b49c8(0xec)]+_0x5b49c8(0xe6)};}};function detectModeFromSql(_0x501b87){const _0x1d67c1=a171_0x2f03e6,_0x5dab0f=ensureRemoteSqlContent(_0x501b87),_0x23e530=stripLocalSqlMetadata(_0x5dab0f,_0x1d67c1(0xfb))[_0x1d67c1(0x110)]();if(/^<(select|insert|update|delete)\b/i[_0x1d67c1(0x105)](_0x23e530))return _0x1d67c1(0xfb);return'sql';}function isEquivalentPulledSqlFile(_0xfdac28,_0x2cc223,_0xb18f7d){return normalizePullComparableContent(_0xfdac28,_0xb18f7d)===normalizePullComparableContent(_0x2cc223,_0xb18f7d);}function normalizePullComparableContent(_0x28d23a,_0x5c8361){const _0xadb117=a171_0x2f03e6,_0x570e61=_0x28d23a['replace'](/\r\n/g,'\x0a')['split']('\x0a'),_0x485c3d=_0x570e61['filter'](_0x342af1=>!isSyncedAtMetadataLine(_0x342af1,_0x5c8361));return _0x485c3d[_0xadb117(0x10f)]('\x0a');}function isSyncedAtMetadataLine(_0x6da229,_0xf8ece2){const _0x244b53=a171_0x2f03e6;if(_0xf8ece2===_0x244b53(0xfb))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x244b53(0x105)](_0x6da229);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x244b53(0x105)](_0x6da229);}
1
+ const a172_0x11b6c7=a172_0x2cbc;(function(_0x1c4461,_0xa5c385){const _0x1f5ccf=a172_0x2cbc,_0x5ada5d=_0x1c4461();while(!![]){try{const _0x2e0f1e=-parseInt(_0x1f5ccf(0x86))/0x1*(-parseInt(_0x1f5ccf(0xb4))/0x2)+-parseInt(_0x1f5ccf(0x85))/0x3*(-parseInt(_0x1f5ccf(0x91))/0x4)+parseInt(_0x1f5ccf(0xb6))/0x5*(parseInt(_0x1f5ccf(0x8e))/0x6)+parseInt(_0x1f5ccf(0xa3))/0x7*(-parseInt(_0x1f5ccf(0x9d))/0x8)+-parseInt(_0x1f5ccf(0x84))/0x9*(parseInt(_0x1f5ccf(0xa7))/0xa)+parseInt(_0x1f5ccf(0xae))/0xb*(parseInt(_0x1f5ccf(0x9c))/0xc)+-parseInt(_0x1f5ccf(0x8a))/0xd;if(_0x2e0f1e===_0xa5c385)break;else _0x5ada5d['push'](_0x5ada5d['shift']());}catch(_0xaea6ee){_0x5ada5d['push'](_0x5ada5d['shift']());}}}(a172_0x3e60,0x81eb9));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';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(_0x5ce6ae,_0x1dc06e){const _0x4000e3=a172_0x2cbc,_0x50b151=[];let _0x2fa0c8=0x1;while(!![]){const _0x1a03b7=await listSqlQueries(_0x5ce6ae,{'currentPage':_0x2fa0c8,'pageSize':PAGE_SIZE,'sqlCode':_0x1dc06e[_0x4000e3(0x83)],'sqlName':_0x1dc06e[_0x4000e3(0xb3)]}),_0x15c665=_0x1a03b7['tableData']??[];_0x50b151[_0x4000e3(0xb2)](..._0x15c665);if(_0x15c665[_0x4000e3(0xba)]===0x0)break;const _0x3cb53a=_0x1a03b7[_0x4000e3(0xb0)]?.['totalCount'];if(_0x3cb53a!=null?_0x50b151[_0x4000e3(0xba)]>=_0x3cb53a:_0x15c665[_0x4000e3(0xba)]<PAGE_SIZE)break;_0x2fa0c8++;}return _0x50b151;}async function ensureSqlContent(_0x2d5d3f){const _0x5cc6e7=a172_0x2cbc;if(_0x2d5d3f['sqlContent']!=null&&String(_0x2d5d3f['sqlContent'])[_0x5cc6e7(0xba)]>0x0)return _0x2d5d3f;return getSqlQueryDetail(_0x2d5d3f[_0x5cc6e7(0x83)]);}export const sqlPull={'service':'sql','command':a172_0x11b6c7(0x7e),'description':'Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','risk':a172_0x11b6c7(0x99),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a172_0x11b6c7(0x90),'type':'string','description':'Filter\x20by\x20SQL\x20display\x20name'},{'name':a172_0x11b6c7(0x9f),'type':a172_0x11b6c7(0x8f),'description':a172_0x11b6c7(0x92)}],async 'dryRun'(_0x3145b8){const _0x4afbe0=a172_0x11b6c7,_0x24e6c0=loadSqlProjectConfig(_0x3145b8['appCode']),_0x2a664=await readSqlLockFile(_0x24e6c0['lockFilePath']),{appLock:_0x16a5c3}=ensureSqlLockScope(_0x2a664??createEmptySqlLock(),_0x24e6c0[_0x4afbe0(0x94)],_0x24e6c0[_0x4afbe0(0x8b)],_0x4afbe0(0x7e)),_0x42ac03=await fetchAllSqlQueries(_0x3145b8[_0x4afbe0(0x94)],{'sqlCode':_0x3145b8[_0x4afbe0(0x93)]('sqlcode')||undefined,'sqlName':_0x3145b8['str']('name')||undefined}),_0x2da737=[];for(const _0x455a6c of _0x42ac03){const _0x84325c=await ensureSqlContent(_0x455a6c),_0x50eb9d=ensureRemoteSqlContent(_0x84325c),_0x35c694=detectModeFromSql(_0x84325c),_0x195565=_0x84325c[_0x4afbe0(0x8c)]?await getDbName(_0x3145b8['appCode'],Number(_0x84325c[_0x4afbe0(0x8c)]))[_0x4afbe0(0x87)](()=>undefined):undefined,_0x28fec0=buildLocalSqlFileContent({'sqlCode':_0x84325c['sqlCode'],'sqlName':_0x84325c[_0x4afbe0(0xb3)],'dbId':_0x84325c[_0x4afbe0(0x8c)]},_0x50eb9d,{'dbName':_0x195565,'mode':_0x35c694,'syncedAt':new Date()[_0x4afbe0(0x88)](),'description':_0x84325c[_0x4afbe0(0xa5)]}),_0x3b0a3e=buildSqlLockEntry(_0x84325c,_0x50eb9d,'',{'dbName':_0x195565}),_0x42f558=resolveLocalSqlFilePath(_0x24e6c0,_0x84325c['sqlCode'],_0x3b0a3e);let _0x5148bc='would_pull',_0x39fad1;if(await fileExists(_0x42f558)){const _0xb1c70b=await readFile(_0x42f558,'utf8');isEquivalentPulledSqlFile(_0xb1c70b,_0x28fec0,_0x35c694)?(_0x5148bc=_0x4afbe0(0xb5),_0x39fad1=_0x4afbe0(0xb1)):(_0x5148bc=_0x4afbe0(0x9a),_0x39fad1=_0x4afbe0(0x80));}_0x2da737[_0x4afbe0(0xb2)]({'sqlCode':_0x84325c[_0x4afbe0(0x83)],'sqlName':_0x84325c[_0x4afbe0(0xb3)],'filePath':_0x42f558,'status':_0x5148bc,'reason':_0x39fad1});}return{'method':'POST','url':_0x4afbe0(0x98),'body':{'appCode':_0x3145b8[_0x4afbe0(0x94)],'sqlCode':_0x3145b8[_0x4afbe0(0x93)](_0x4afbe0(0x97))||null,'sqlName':_0x3145b8[_0x4afbe0(0x93)]('name')||null,'files':_0x2da737},'description':'Would\x20pull\x20'+_0x2da737[_0x4afbe0(0xba)]+_0x4afbe0(0xb9)+_0x24e6c0[_0x4afbe0(0x95)]};},async 'execute'(_0x296e55){const _0x4ea2ee=a172_0x11b6c7,_0x65dd7c=loadSqlProjectConfig(_0x296e55['appCode']),_0x2aa7cd=await readSqlLockFile(_0x65dd7c[_0x4ea2ee(0x96)]),{lockData:_0x2fb71e,appLock:_0x37a350}=ensureSqlLockScope(_0x2aa7cd??createEmptySqlLock(),_0x65dd7c['appCode'],_0x65dd7c[_0x4ea2ee(0x8b)],'pull'),_0x4b2d43=_0x296e55[_0x4ea2ee(0xb8)](_0x4ea2ee(0x9f)),_0x413248=await fetchAllSqlQueries(_0x296e55['appCode'],{'sqlCode':_0x296e55[_0x4ea2ee(0x93)](_0x4ea2ee(0x97))||undefined,'sqlName':_0x296e55[_0x4ea2ee(0x93)](_0x4ea2ee(0x90))||undefined});if(_0x413248[_0x4ea2ee(0xba)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4ea2ee(0x81)};const _0x5589e2=[],_0x5a6460=[];for(const _0xd14cd5 of _0x413248){try{_0x5589e2[_0x4ea2ee(0xb2)](await ensureSqlContent(_0xd14cd5));}catch(_0x2ce045){_0x5a6460['push']({'sqlCode':_0xd14cd5[_0x4ea2ee(0x83)],'error':_0x2ce045 instanceof Error?_0x2ce045[_0x4ea2ee(0x7f)]:String(_0x2ce045)});}}if(_0x4b2d43&&!_0x296e55[_0x4ea2ee(0xa1)]){let _0x424598=![];for(const _0x5c77c3 of _0x5589e2){const _0x502b3f=detectModeFromSql(_0x5c77c3),_0x2cb210=_0x5c77c3[_0x4ea2ee(0x8c)]?await getDbName(_0x296e55[_0x4ea2ee(0x94)],Number(_0x5c77c3['dbId']))[_0x4ea2ee(0x87)](()=>undefined):undefined,_0x317a83=buildLocalSqlFileContent({'sqlCode':_0x5c77c3[_0x4ea2ee(0x83)],'sqlName':_0x5c77c3[_0x4ea2ee(0xb3)],'dbId':_0x5c77c3[_0x4ea2ee(0x8c)]},ensureRemoteSqlContent(_0x5c77c3),{'dbName':_0x2cb210,'mode':_0x502b3f,'syncedAt':new Date()[_0x4ea2ee(0x88)](),'description':_0x5c77c3[_0x4ea2ee(0xa5)]}),_0x4bae88=resolveLocalSqlFilePath(_0x65dd7c,_0x5c77c3['sqlCode'],buildSqlLockEntry(_0x5c77c3,ensureRemoteSqlContent(_0x5c77c3),'',{'dbName':_0x2cb210}));if(await fileExists(_0x4bae88)){const _0x4cea38=await readFile(_0x4bae88,_0x4ea2ee(0xa2));if(!isEquivalentPulledSqlFile(_0x4cea38,_0x317a83,_0x502b3f)){_0x424598=!![];break;}}}if(_0x424598){const _0x5a7042=await confirmForceOverwrite(_0x4ea2ee(0xaf));if(!_0x5a7042)throw CliErrors[_0x4ea2ee(0xa4)](_0x4ea2ee(0x8d));}}const _0x1acf45=cloneSqlLockData(_0x2fb71e),_0x142b5f=_0x1acf45[_0x4ea2ee(0x82)][_0x65dd7c[_0x4ea2ee(0x94)]],_0x525665=[],_0x19ffff=[];for(const _0xd1f52 of _0x5589e2){const _0x1a0983=_0x142b5f[_0x4ea2ee(0xb7)][_0xd1f52['sqlCode']],_0x4ffbbd=ensureRemoteSqlContent(_0xd1f52),_0x159ec2=detectModeFromSql(_0xd1f52),_0x1135ac=_0xd1f52[_0x4ea2ee(0x8c)]?await getDbName(_0x296e55[_0x4ea2ee(0x94)],Number(_0xd1f52[_0x4ea2ee(0x8c)]))[_0x4ea2ee(0x87)](()=>undefined):undefined,_0x213bde=buildLocalSqlFileContent({'sqlCode':_0xd1f52[_0x4ea2ee(0x83)],'sqlName':_0xd1f52['sqlName'],'dbId':_0xd1f52[_0x4ea2ee(0x8c)]},_0x4ffbbd,{'dbName':_0x1135ac,'mode':_0x159ec2,'syncedAt':new Date()[_0x4ea2ee(0x88)](),'description':_0xd1f52['description']}),_0x42d4c0=buildSqlLockEntry(_0xd1f52,_0x4ffbbd,computeSqlContentHash(_0x213bde),{'dbName':_0x1135ac}),_0x2fd3ea=_0x42d4c0['path'],_0x38f93f=join(_0x65dd7c[_0x4ea2ee(0x95)],_0x2fd3ea);try{if(await fileExists(_0x38f93f)){const _0x10ab23=await readFile(_0x38f93f,_0x4ea2ee(0xa2));if(isEquivalentPulledSqlFile(_0x10ab23,_0x213bde,_0x159ec2)){_0x19ffff[_0x4ea2ee(0xb2)]({'sqlCode':_0xd1f52[_0x4ea2ee(0x83)],'reason':_0x4ea2ee(0xb1)}),_0x142b5f[_0x4ea2ee(0xb7)][_0xd1f52[_0x4ea2ee(0x83)]]={..._0x42d4c0,'hash':computeSqlContentHash(_0x10ab23),'path':_0x2fd3ea};continue;}if(!_0x4b2d43){_0x19ffff[_0x4ea2ee(0xb2)]({'sqlCode':_0xd1f52[_0x4ea2ee(0x83)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x49a385=_0x1a0983?.[_0x4ea2ee(0x9b)]?join(_0x65dd7c[_0x4ea2ee(0x95)],_0x1a0983[_0x4ea2ee(0x9b)]):undefined;_0x49a385&&_0x49a385!==_0x38f93f&&await fileExists(_0x49a385)&&await rm(_0x49a385,{'force':!![]}),await ensureParentDirectory(_0x38f93f),await writeFile(_0x38f93f,_0x213bde,_0x4ea2ee(0xa2)),_0x142b5f['sqls'][_0xd1f52['sqlCode']]={..._0x42d4c0,'path':_0x2fd3ea},_0x525665[_0x4ea2ee(0xb2)]({'sqlCode':_0xd1f52['sqlCode'],'filePath':_0x38f93f});}catch(_0x1f4abe){_0x5a6460[_0x4ea2ee(0xb2)]({'sqlCode':_0xd1f52['sqlCode'],'error':_0x1f4abe instanceof Error?_0x1f4abe[_0x4ea2ee(0x7f)]:String(_0x1f4abe)});}}return _0x142b5f['lastSync']=new Date()[_0x4ea2ee(0x88)](),await writeSqlLockFile(_0x65dd7c['lockFilePath'],_0x1acf45),{'ok':_0x5a6460[_0x4ea2ee(0xba)]===0x0,'data':{'pulled':_0x525665,'skipped':_0x19ffff,'failed':_0x5a6460},'message':_0x4ea2ee(0x89)+_0x525665[_0x4ea2ee(0xba)]+_0x4ea2ee(0xac)+_0x19ffff[_0x4ea2ee(0xba)]+'\x20skipped,\x20'+_0x5a6460[_0x4ea2ee(0xba)]+_0x4ea2ee(0xa6)};}};function detectModeFromSql(_0x11c370){const _0x4c4ef7=a172_0x11b6c7,_0x500542=ensureRemoteSqlContent(_0x11c370),_0x49dd56=stripLocalSqlMetadata(_0x500542,_0x4c4ef7(0xa0))[_0x4c4ef7(0xad)]();if(/^<(select|insert|update|delete)\b/i[_0x4c4ef7(0xa9)](_0x49dd56))return'mybatisXml';return _0x4c4ef7(0xaa);}function a172_0x3e60(){const _0x526d50=['boolean','name','8dgQahY','Force\x20overwrite\x20local\x20unsynced\x20changes','str','appCode','sqlRootDir','lockFilePath','sqlcode','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','write','conflict','path','882180UMeZyK','8dopSVH','split','force','mybatisXml','nonInteractive','utf8','6839651SZZmeQ','cancelled','description','\x20failed','2010QlKURM','filter','test','sql','join','\x20written,\x20','trimStart','88VxfNxH','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','paging','unchanged','push','sqlName','263234dhoQkk','skipped','1415mOYXvI','sqls','bool','\x20SQL\x20file(s)\x20into\x20','length','pull','message','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','No\x20remote\x20SQL\x20queries\x20matched.','apps','sqlCode','13968OExcNF','119355ROZXdE','4bOAKsc','catch','toISOString','Pull\x20complete:\x20','19539xlcZPJ','sqlRoot','dbId','Force\x20pull\x20cancelled.','13326AZziXQ'];a172_0x3e60=function(){return _0x526d50;};return a172_0x3e60();}function isEquivalentPulledSqlFile(_0x382650,_0x29d4ea,_0x473bc5){return normalizePullComparableContent(_0x382650,_0x473bc5)===normalizePullComparableContent(_0x29d4ea,_0x473bc5);}function normalizePullComparableContent(_0x376fd5,_0x197a24){const _0x302f41=a172_0x11b6c7,_0x1e923f=_0x376fd5['replace'](/\r\n/g,'\x0a')[_0x302f41(0x9e)]('\x0a'),_0x331e05=_0x1e923f[_0x302f41(0xa8)](_0x2149a2=>!isSyncedAtMetadataLine(_0x2149a2,_0x197a24));return _0x331e05[_0x302f41(0xab)]('\x0a');}function a172_0x2cbc(_0x54fcff,_0x4c317e){_0x54fcff=_0x54fcff-0x7e;const _0x3e6059=a172_0x3e60();let _0x2cbc9d=_0x3e6059[_0x54fcff];return _0x2cbc9d;}function isSyncedAtMetadataLine(_0x3aa05b,_0x376740){const _0x4d05ca=a172_0x11b6c7;if(_0x376740===_0x4d05ca(0xa0))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x4d05ca(0xa9)](_0x3aa05b);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x4d05ca(0xa9)](_0x3aa05b);}
@@ -1 +1 @@
1
- const a172_0x2eea6c=a172_0x3658;(function(_0x51322e,_0x1f51bf){const _0x2c4626=a172_0x3658,_0x213f28=_0x51322e();while(!![]){try{const _0x1f07ca=parseInt(_0x2c4626(0x183))/0x1+parseInt(_0x2c4626(0x15f))/0x2*(parseInt(_0x2c4626(0x169))/0x3)+parseInt(_0x2c4626(0x159))/0x4+-parseInt(_0x2c4626(0x15b))/0x5*(parseInt(_0x2c4626(0x172))/0x6)+-parseInt(_0x2c4626(0x180))/0x7+-parseInt(_0x2c4626(0x16f))/0x8+-parseInt(_0x2c4626(0x168))/0x9*(parseInt(_0x2c4626(0x151))/0xa);if(_0x1f07ca===_0x1f51bf)break;else _0x213f28['push'](_0x213f28['shift']());}catch(_0x25d210){_0x213f28['push'](_0x213f28['shift']());}}}(a172_0x4d44,0xd1a4f));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 a172_0x3658(_0x2852ce,_0x5259e7){_0x2852ce=_0x2852ce-0x14e;const _0x4d44c2=a172_0x4d44();let _0x3658b4=_0x4d44c2[_0x2852ce];return _0x3658b4;}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(_0x102f77,_0x26dea1,_0x2b0bac){const _0x16c979=a172_0x3658,_0x3df178=await scanLocalSqlQueries(_0x102f77),_0x507524=new Map();for(const _0x9328e6 of _0x3df178){if(_0x2b0bac&&_0x9328e6[_0x16c979(0x152)]!==_0x2b0bac)continue;const _0x5e99a6=_0x507524['get'](_0x9328e6['sqlCode'])??[];_0x5e99a6['push'](_0x9328e6),_0x507524[_0x16c979(0x153)](_0x9328e6[_0x16c979(0x152)],_0x5e99a6);}if(_0x2b0bac&&!_0x507524[_0x16c979(0x14e)](_0x2b0bac))throw CliErrors[_0x16c979(0x187)](_0x16c979(0x16a)+_0x2b0bac);const _0xde3976=[];for(const [_0x403aa6,_0x3f0762]of _0x507524[_0x16c979(0x15d)]()){if(_0x3f0762[_0x16c979(0x170)]===0x1){_0xde3976[_0x16c979(0x164)](_0x3f0762[0x0]);continue;}const _0x25f6c1=_0x26dea1['sqls'][_0x403aa6],_0x34609d=_0x25f6c1?.['path'],_0x1a907d=_0x34609d?_0x3f0762[_0x16c979(0x177)](_0x94b1a8=>_0x94b1a8['relativePath']!==_0x34609d):_0x3f0762;if(_0x25f6c1&&_0x1a907d['length']===0x1){_0xde3976[_0x16c979(0x164)](_0x1a907d[0x0]);continue;}throw CliErrors['validation'](_0x16c979(0x17b)+_0x403aa6+_0x16c979(0x16d));}return _0xde3976;}export const sqlPush={'service':a172_0x2eea6c(0x157),'command':'push','description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':'high-risk-write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':'boolean','description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x5d265d){const _0x59e9e6=a172_0x2eea6c,_0x163808=loadSqlProjectConfig(_0x5d265d[_0x59e9e6(0x150)]),_0x1f592d=await readSqlLockFile(_0x163808[_0x59e9e6(0x155)]),{appLock:_0x5c87e3}=ensureSqlLockScope(_0x1f592d??createEmptySqlLock(),_0x5d265d[_0x59e9e6(0x150)],_0x163808[_0x59e9e6(0x17d)],_0x59e9e6(0x164)),_0x266916=await getTargetSqlQueries(_0x163808,_0x5c87e3,_0x5d265d['str'](_0x59e9e6(0x17e))||undefined),_0x29166e=[];for(const _0x3bc624 of _0x266916){const _0x4462d2=await computeSqlFileHash(_0x3bc624['filePath']),_0x17d09a=_0x5c87e3['sqls'][_0x3bc624['sqlCode']],_0x1c77a8=!!_0x17d09a&&(_0x17d09a['path']!==_0x3bc624[_0x59e9e6(0x16c)]||!!_0x3bc624[_0x59e9e6(0x175)]&&_0x17d09a[_0x59e9e6(0x175)]!==_0x3bc624[_0x59e9e6(0x175)]);if(!_0x5d265d['bool'](_0x59e9e6(0x156))&&_0x17d09a&&_0x17d09a['hash']===_0x4462d2&&!_0x1c77a8)continue;_0x29166e['push'](_0x3bc624['sqlCode']);}return{'method':_0x59e9e6(0x16e),'url':_0x59e9e6(0x165),'body':{'sqlCodes':_0x29166e,'appCode':_0x5d265d[_0x59e9e6(0x150)]},'description':_0x59e9e6(0x163)+_0x29166e[_0x59e9e6(0x170)]+_0x59e9e6(0x167)};},async 'execute'(_0x27c94c){const _0x84fc6f=a172_0x2eea6c,_0x28b66e=loadSqlProjectConfig(_0x27c94c[_0x84fc6f(0x150)]),_0x4fbfed=await readSqlLockFile(_0x28b66e[_0x84fc6f(0x155)]),{lockData:_0x110d0d,appLock:_0x41cfc7}=ensureSqlLockScope(_0x4fbfed??createEmptySqlLock(),_0x27c94c[_0x84fc6f(0x150)],_0x28b66e[_0x84fc6f(0x17d)],_0x84fc6f(0x164)),_0x2bace4=await getTargetSqlQueries(_0x28b66e,_0x41cfc7,_0x27c94c['str'](_0x84fc6f(0x17e))||undefined);if(_0x2bace4[_0x84fc6f(0x170)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x57671f=[],_0x3e7183=[],_0x380b05=[];for(const _0x40e837 of _0x2bace4){const _0x37296d=_0x41cfc7[_0x84fc6f(0x174)][_0x40e837[_0x84fc6f(0x152)]];if(!_0x37296d){_0x380b05['push']({'sqlCode':_0x40e837['sqlCode'],'error':_0x84fc6f(0x179)});continue;}try{const _0x298eca=await computeSqlFileHash(_0x40e837[_0x84fc6f(0x186)]),_0x4381ae=_0x37296d[_0x84fc6f(0x15e)]!==_0x40e837[_0x84fc6f(0x16c)]||!!_0x40e837[_0x84fc6f(0x175)]&&_0x37296d[_0x84fc6f(0x175)]!==_0x40e837[_0x84fc6f(0x175)];if(!_0x27c94c[_0x84fc6f(0x160)](_0x84fc6f(0x156))&&_0x37296d[_0x84fc6f(0x15c)]===_0x298eca&&!_0x4381ae){_0x3e7183[_0x84fc6f(0x164)]({'sqlCode':_0x40e837['sqlCode'],'reason':_0x84fc6f(0x17c)});continue;}if(_0x37296d[_0x84fc6f(0x171)]==null){_0x380b05[_0x84fc6f(0x164)]({'sqlCode':_0x40e837['sqlCode'],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x146c88=await readFile(_0x40e837['filePath'],_0x84fc6f(0x162)),_0x1b9705=stripLocalSqlMetadata(_0x146c88,_0x40e837[_0x84fc6f(0x176)]),_0x103b68=_0x40e837[_0x84fc6f(0x175)]||_0x37296d[_0x84fc6f(0x175)],_0x47663d=await resolveTargetDbBinding(_0x27c94c[_0x84fc6f(0x150)],_0x40e837,_0x37296d),_0x15307a=await updateSqlQuery({'id':_0x37296d[_0x84fc6f(0x188)],'appCode':_0x27c94c[_0x84fc6f(0x150)],'sqlCode':_0x40e837[_0x84fc6f(0x152)],'sqlName':_0x103b68,'dbId':_0x47663d[_0x84fc6f(0x182)],'version':_0x37296d[_0x84fc6f(0x171)],'sqlContent':_0x1b9705,'sqlConfig':_0x37296d['sqlConfig']??undefined}),_0x5c5e29=_0x15307a[_0x84fc6f(0x182)]?await getDbName(_0x27c94c[_0x84fc6f(0x150)],Number(_0x15307a[_0x84fc6f(0x182)]))['catch'](()=>_0x47663d[_0x84fc6f(0x166)]):_0x47663d[_0x84fc6f(0x166)];_0x41cfc7[_0x84fc6f(0x174)][_0x40e837[_0x84fc6f(0x152)]]={...buildSqlLockEntry(_0x15307a,_0x1b9705,_0x298eca,{'dbName':_0x5c5e29}),'path':_0x40e837[_0x84fc6f(0x16c)],'mode':_0x37296d[_0x84fc6f(0x176)]},await archivePreviousSqlFileIfNeeded(_0x28b66e,_0x37296d['path'],_0x40e837[_0x84fc6f(0x16c)]),_0x57671f[_0x84fc6f(0x164)]({'sqlCode':_0x40e837[_0x84fc6f(0x152)],'remoteId':_0x37296d[_0x84fc6f(0x188)]});}catch(_0x1ad578){_0x380b05[_0x84fc6f(0x164)]({'sqlCode':_0x40e837[_0x84fc6f(0x152)],'error':_0x1ad578 instanceof Error?_0x1ad578[_0x84fc6f(0x178)]:String(_0x1ad578)});}}return _0x41cfc7[_0x84fc6f(0x18a)]=new Date()[_0x84fc6f(0x18b)](),await writeSqlLockFile(_0x28b66e['lockFilePath'],_0x110d0d),{'ok':_0x380b05[_0x84fc6f(0x170)]===0x0,'data':{'pushed':_0x57671f,'skipped':_0x3e7183,'failed':_0x380b05},'message':'Push\x20complete:\x20'+_0x57671f[_0x84fc6f(0x170)]+_0x84fc6f(0x15a)+_0x3e7183[_0x84fc6f(0x170)]+_0x84fc6f(0x161)+_0x380b05[_0x84fc6f(0x170)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x504135,_0x11ea27,_0x18acb8){const _0x3bab94=a172_0x2eea6c;if(!_0x11ea27||_0x11ea27===_0x18acb8)return;const _0x126010=join(_0x504135[_0x3bab94(0x16b)],_0x11ea27);if(!await fileExists(_0x126010))return;const _0x2cbe93=await moveToTrash(_0x504135[_0x3bab94(0x181)],_0x504135[_0x3bab94(0x154)],_0x126010);await cleanupEmptyDirectories(dirname(_0x126010),_0x504135[_0x3bab94(0x16b)]),void _0x2cbe93;}async function moveToTrash(_0x24c369,_0x130da2,_0x3f1cae){const _0xfc6792=a172_0x2eea6c,_0x26e174=new Date()[_0xfc6792(0x18b)]()[_0xfc6792(0x158)](/[:.]/g,'-'),_0x3f945b=relative(_0x24c369,_0x3f1cae),_0x27d4dd=join(_0x130da2,_0x26e174,_0x3f945b);return await mkdir(dirname(_0x27d4dd),{'recursive':!![]}),await rename(_0x3f1cae,_0x27d4dd),_0x27d4dd;}function a172_0x4d44(){const _0x3b6b11=['lastSync','toISOString','has','exec','appCode','1930fryIvb','sqlCode','set','trashDir','lockFilePath','force','sql','replace','2906152pPKpKG','\x20pushed,\x20','2240795cDPgSM','hash','entries','path','1741742IhUONt','bool','\x20skipped,\x20','utf8','Would\x20push\x20','push','/smartapi/custom/updateUserCustomSql','dbName','\x20SQL\x20file(s)','53307bwaLCg','3dnVYtS','Local\x20SQL\x20not\x20found:\x20','sqlRootDir','relativePath','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','POST','955080vnsjQJ','length','version','12GnqekX','\x22\x20for\x20sqlCode\x20','sqls','sqlName','mode','filter','message','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','catch','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','unchanged','sqlRoot','sqlcode','startsWith','1350825dGzdaM','projectRoot','dbId','1613111tezjwt','No\x20database\x20matches\x20local\x20directory\x20\x22','map','filePath','validation','remoteId','Local\x20directory\x20\x22'];a172_0x4d44=function(){return _0x3b6b11;};return a172_0x4d44();}async function cleanupEmptyDirectories(_0x9f1893,_0x40d2cd){const _0x16641f=a172_0x2eea6c;let _0x86bd6=resolve(_0x9f1893);const _0x14b374=resolve(_0x40d2cd);while(_0x86bd6[_0x16641f(0x17f)](''+_0x14b374+sep)||_0x86bd6===_0x14b374){if(_0x86bd6===_0x14b374)return;try{const _0x26d105=await readdir(_0x86bd6);if(_0x26d105[_0x16641f(0x170)]>0x0)return;await rmdir(_0x86bd6);}catch{return;}_0x86bd6=dirname(_0x86bd6);}}async function resolveTargetDbBinding(_0x60ad34,_0x3b7b1c,_0x1f7f97){const _0x4ed602=a172_0x2eea6c,_0x5eebb9=_0x3b7b1c['dbDirectory'];if(!_0x5eebb9)return{'dbId':_0x1f7f97[_0x4ed602(0x182)],'dbName':_0x1f7f97[_0x4ed602(0x166)]};const _0x175ac0=buildDbDirectoryName(_0x1f7f97[_0x4ed602(0x166)],_0x1f7f97[_0x4ed602(0x182)]);if(_0x5eebb9===_0x175ac0)return{'dbId':_0x1f7f97['dbId'],'dbName':_0x1f7f97[_0x4ed602(0x166)]};const _0x5eeece=parseExplicitDbDirectory(_0x5eebb9);if(_0x5eeece!=null)return{'dbId':_0x5eeece,'dbName':await getDbName(_0x60ad34,_0x5eeece)[_0x4ed602(0x17a)](()=>undefined)};const _0xa63623=await listDatabases(_0x60ad34),_0x531bff=_0xa63623[_0x4ed602(0x177)](_0x1fa30b=>buildDbDirectoryName(_0x1fa30b[_0x4ed602(0x166)],_0x1fa30b[_0x4ed602(0x182)])===_0x5eebb9);if(_0x531bff['length']===0x1)return{'dbId':_0x531bff[0x0][_0x4ed602(0x182)],'dbName':_0x531bff[0x0][_0x4ed602(0x166)]};if(_0x531bff[_0x4ed602(0x170)]===0x0)throw CliErrors[_0x4ed602(0x187)](_0x4ed602(0x184)+_0x5eebb9+_0x4ed602(0x173)+_0x3b7b1c['sqlCode']+'.');const _0x42fb09=_0x531bff[_0x4ed602(0x185)](_0x3abec4=>_0x3abec4['dbName']+'\x20('+_0x3abec4[_0x4ed602(0x182)]+')')['join'](',\x20');throw CliErrors[_0x4ed602(0x187)](_0x4ed602(0x189)+_0x5eebb9+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x3b7b1c[_0x4ed602(0x152)]+':\x20'+_0x42fb09);}function parseExplicitDbDirectory(_0x46887c){const _0x1a02dc=a172_0x2eea6c,_0x4d630d=/^db-(\d+)$/[_0x1a02dc(0x14f)](_0x46887c);if(!_0x4d630d)return null;const _0x56cc78=Number(_0x4d630d[0x1]);return Number['isFinite'](_0x56cc78)&&_0x56cc78>0x0?_0x56cc78:null;}
1
+ const a173_0x948c4d=a173_0x1c1c;(function(_0x39e5e1,_0x4c7d3b){const _0x447393=a173_0x1c1c,_0x45a3c7=_0x39e5e1();while(!![]){try{const _0x123c64=parseInt(_0x447393(0x1e0))/0x1+-parseInt(_0x447393(0x1f4))/0x2+-parseInt(_0x447393(0x1df))/0x3*(parseInt(_0x447393(0x1d5))/0x4)+-parseInt(_0x447393(0x204))/0x5+-parseInt(_0x447393(0x1d1))/0x6+parseInt(_0x447393(0x1f5))/0x7+parseInt(_0x447393(0x1da))/0x8*(parseInt(_0x447393(0x1e4))/0x9);if(_0x123c64===_0x4c7d3b)break;else _0x45a3c7['push'](_0x45a3c7['shift']());}catch(_0x5e3e2f){_0x45a3c7['push'](_0x45a3c7['shift']());}}}(a173_0x31c7,0x47830));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';function a173_0x31c7(){const _0x5b0ec5=['1412VxNlXL','lockFilePath','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','projectRoot','force','859128pTAiMa','filter','length','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','remoteId','309nhFvqo','2328zAOqPd','lastSync','toISOString','str','45RwqRJM','Local\x20SQL\x20not\x20found:\x20','isFinite','has','trashDir','\x20SQL\x20file(s)','Push\x20local\x20SQL\x20files\x20to\x20remote','join','Push\x20complete:\x20','entries','hash','No\x20local\x20SQL\x20files\x20found.','POST','unchanged','\x20pushed,\x20','filePath','468688ffsjXX','2850106DvgYfZ','message','sqlName','dbDirectory','dbId','catch','push','Local\x20directory\x20\x22','bool','sqlRoot','\x22\x20for\x20sqlCode\x20','path','relativePath','sqlRootDir','appCode','1436725PvCaMb','dbName','map','sql','version','\x20skipped,\x20','sqls','sqlCode','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','utf8','validation','sqlcode','startsWith','high-risk-write','572886ZiiuXB','No\x20database\x20matches\x20local\x20directory\x20\x22','replace','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'];a173_0x31c7=function(){return _0x5b0ec5;};return a173_0x31c7();}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';function a173_0x1c1c(_0x5a600d,_0x397c3f){_0x5a600d=_0x5a600d-0x1c5;const _0x31c7d9=a173_0x31c7();let _0x1c1c6f=_0x31c7d9[_0x5a600d];return _0x1c1c6f;}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(_0x1caddf,_0x527097,_0x172ff8){const _0x19031b=a173_0x1c1c,_0x259010=await scanLocalSqlQueries(_0x1caddf),_0x4eeda0=new Map();for(const _0x312567 of _0x259010){if(_0x172ff8&&_0x312567[_0x19031b(0x1ca)]!==_0x172ff8)continue;const _0x2180af=_0x4eeda0['get'](_0x312567[_0x19031b(0x1ca)])??[];_0x2180af[_0x19031b(0x1fb)](_0x312567),_0x4eeda0['set'](_0x312567[_0x19031b(0x1ca)],_0x2180af);}if(_0x172ff8&&!_0x4eeda0[_0x19031b(0x1e7)](_0x172ff8))throw CliErrors[_0x19031b(0x1cd)](_0x19031b(0x1e5)+_0x172ff8);const _0xb9a470=[];for(const [_0x29908d,_0xbc98d7]of _0x4eeda0[_0x19031b(0x1ed)]()){if(_0xbc98d7['length']===0x1){_0xb9a470[_0x19031b(0x1fb)](_0xbc98d7[0x0]);continue;}const _0x27b686=_0x527097[_0x19031b(0x1c9)][_0x29908d],_0x11c926=_0x27b686?.[_0x19031b(0x200)],_0x325406=_0x11c926?_0xbc98d7[_0x19031b(0x1db)](_0x1c856e=>_0x1c856e['relativePath']!==_0x11c926):_0xbc98d7;if(_0x27b686&&_0x325406[_0x19031b(0x1dc)]===0x1){_0xb9a470['push'](_0x325406[0x0]);continue;}throw CliErrors[_0x19031b(0x1cd)](_0x19031b(0x1dd)+_0x29908d+'.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.');}return _0xb9a470;}export const sqlPush={'service':a173_0x948c4d(0x1c6),'command':a173_0x948c4d(0x1fb),'description':a173_0x948c4d(0x1ea),'risk':a173_0x948c4d(0x1d0),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a173_0x948c4d(0x1d9),'type':'boolean','description':a173_0x948c4d(0x1d4)}],async 'dryRun'(_0x359b80){const _0x52332e=a173_0x948c4d,_0x45385f=loadSqlProjectConfig(_0x359b80['appCode']),_0x4ca9c4=await readSqlLockFile(_0x45385f[_0x52332e(0x1d6)]),{appLock:_0x1deac0}=ensureSqlLockScope(_0x4ca9c4??createEmptySqlLock(),_0x359b80[_0x52332e(0x203)],_0x45385f['sqlRoot'],_0x52332e(0x1fb)),_0x3d7f03=await getTargetSqlQueries(_0x45385f,_0x1deac0,_0x359b80[_0x52332e(0x1e3)](_0x52332e(0x1ce))||undefined),_0x52e5f0=[];for(const _0x429912 of _0x3d7f03){const _0x1217aa=await computeSqlFileHash(_0x429912[_0x52332e(0x1f3)]),_0x15f89e=_0x1deac0[_0x52332e(0x1c9)][_0x429912[_0x52332e(0x1ca)]],_0x279462=!!_0x15f89e&&(_0x15f89e['path']!==_0x429912[_0x52332e(0x201)]||!!_0x429912[_0x52332e(0x1f7)]&&_0x15f89e[_0x52332e(0x1f7)]!==_0x429912[_0x52332e(0x1f7)]);if(!_0x359b80[_0x52332e(0x1fd)](_0x52332e(0x1d9))&&_0x15f89e&&_0x15f89e[_0x52332e(0x1ee)]===_0x1217aa&&!_0x279462)continue;_0x52e5f0[_0x52332e(0x1fb)](_0x429912[_0x52332e(0x1ca)]);}return{'method':_0x52332e(0x1f0),'url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x52e5f0,'appCode':_0x359b80['appCode']},'description':'Would\x20push\x20'+_0x52e5f0[_0x52332e(0x1dc)]+_0x52332e(0x1e9)};},async 'execute'(_0x27d60e){const _0x4a4630=a173_0x948c4d,_0x476f1a=loadSqlProjectConfig(_0x27d60e['appCode']),_0x4c1ee0=await readSqlLockFile(_0x476f1a['lockFilePath']),{lockData:_0x21c598,appLock:_0x665578}=ensureSqlLockScope(_0x4c1ee0??createEmptySqlLock(),_0x27d60e[_0x4a4630(0x203)],_0x476f1a[_0x4a4630(0x1fe)],_0x4a4630(0x1fb)),_0x5b373a=await getTargetSqlQueries(_0x476f1a,_0x665578,_0x27d60e[_0x4a4630(0x1e3)](_0x4a4630(0x1ce))||undefined);if(_0x5b373a[_0x4a4630(0x1dc)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x4a4630(0x1ef)};const _0x2d2dd3=[],_0x4483d0=[],_0x3a8a48=[];for(const _0x5163aa of _0x5b373a){const _0x83afd6=_0x665578[_0x4a4630(0x1c9)][_0x5163aa[_0x4a4630(0x1ca)]];if(!_0x83afd6){_0x3a8a48[_0x4a4630(0x1fb)]({'sqlCode':_0x5163aa['sqlCode'],'error':_0x4a4630(0x1cb)});continue;}try{const _0x3e2d64=await computeSqlFileHash(_0x5163aa['filePath']),_0x10a1ae=_0x83afd6[_0x4a4630(0x200)]!==_0x5163aa['relativePath']||!!_0x5163aa['sqlName']&&_0x83afd6['sqlName']!==_0x5163aa[_0x4a4630(0x1f7)];if(!_0x27d60e['bool'](_0x4a4630(0x1d9))&&_0x83afd6['hash']===_0x3e2d64&&!_0x10a1ae){_0x4483d0[_0x4a4630(0x1fb)]({'sqlCode':_0x5163aa[_0x4a4630(0x1ca)],'reason':_0x4a4630(0x1f1)});continue;}if(_0x83afd6[_0x4a4630(0x1c7)]==null){_0x3a8a48[_0x4a4630(0x1fb)]({'sqlCode':_0x5163aa[_0x4a4630(0x1ca)],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x557a15=await readFile(_0x5163aa[_0x4a4630(0x1f3)],_0x4a4630(0x1cc)),_0x30cf7b=stripLocalSqlMetadata(_0x557a15,_0x5163aa['mode']),_0x516328=_0x5163aa[_0x4a4630(0x1f7)]||_0x83afd6[_0x4a4630(0x1f7)],_0x13ba78=await resolveTargetDbBinding(_0x27d60e['appCode'],_0x5163aa,_0x83afd6),_0x424ebb=await updateSqlQuery({'id':_0x83afd6[_0x4a4630(0x1de)],'appCode':_0x27d60e[_0x4a4630(0x203)],'sqlCode':_0x5163aa['sqlCode'],'sqlName':_0x516328,'dbId':_0x13ba78['dbId'],'version':_0x83afd6[_0x4a4630(0x1c7)],'sqlContent':_0x30cf7b,'sqlConfig':_0x83afd6['sqlConfig']??undefined}),_0x518472=_0x424ebb[_0x4a4630(0x1f9)]?await getDbName(_0x27d60e[_0x4a4630(0x203)],Number(_0x424ebb[_0x4a4630(0x1f9)]))[_0x4a4630(0x1fa)](()=>_0x13ba78[_0x4a4630(0x205)]):_0x13ba78[_0x4a4630(0x205)];_0x665578[_0x4a4630(0x1c9)][_0x5163aa[_0x4a4630(0x1ca)]]={...buildSqlLockEntry(_0x424ebb,_0x30cf7b,_0x3e2d64,{'dbName':_0x518472}),'path':_0x5163aa['relativePath'],'mode':_0x83afd6['mode']},await archivePreviousSqlFileIfNeeded(_0x476f1a,_0x83afd6[_0x4a4630(0x200)],_0x5163aa[_0x4a4630(0x201)]),_0x2d2dd3[_0x4a4630(0x1fb)]({'sqlCode':_0x5163aa[_0x4a4630(0x1ca)],'remoteId':_0x83afd6['remoteId']});}catch(_0x382b03){_0x3a8a48['push']({'sqlCode':_0x5163aa[_0x4a4630(0x1ca)],'error':_0x382b03 instanceof Error?_0x382b03[_0x4a4630(0x1f6)]:String(_0x382b03)});}}return _0x665578[_0x4a4630(0x1e1)]=new Date()[_0x4a4630(0x1e2)](),await writeSqlLockFile(_0x476f1a[_0x4a4630(0x1d6)],_0x21c598),{'ok':_0x3a8a48[_0x4a4630(0x1dc)]===0x0,'data':{'pushed':_0x2d2dd3,'skipped':_0x4483d0,'failed':_0x3a8a48},'message':_0x4a4630(0x1ec)+_0x2d2dd3['length']+_0x4a4630(0x1f2)+_0x4483d0[_0x4a4630(0x1dc)]+_0x4a4630(0x1c8)+_0x3a8a48[_0x4a4630(0x1dc)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x403d9a,_0x120a8a,_0x15179b){const _0x520f45=a173_0x948c4d;if(!_0x120a8a||_0x120a8a===_0x15179b)return;const _0x980eb3=join(_0x403d9a[_0x520f45(0x202)],_0x120a8a);if(!await fileExists(_0x980eb3))return;const _0x20c4e6=await moveToTrash(_0x403d9a[_0x520f45(0x1d8)],_0x403d9a[_0x520f45(0x1e8)],_0x980eb3);await cleanupEmptyDirectories(dirname(_0x980eb3),_0x403d9a[_0x520f45(0x202)]),void _0x20c4e6;}async function moveToTrash(_0x54504f,_0xa02a4b,_0x1262b6){const _0x3ed83c=a173_0x948c4d,_0x4ee370=new Date()[_0x3ed83c(0x1e2)]()[_0x3ed83c(0x1d3)](/[:.]/g,'-'),_0x56f422=relative(_0x54504f,_0x1262b6),_0x567e00=join(_0xa02a4b,_0x4ee370,_0x56f422);return await mkdir(dirname(_0x567e00),{'recursive':!![]}),await rename(_0x1262b6,_0x567e00),_0x567e00;}async function cleanupEmptyDirectories(_0x2f42a7,_0x41c03f){const _0x1c4dd9=a173_0x948c4d;let _0x808a65=resolve(_0x2f42a7);const _0x221461=resolve(_0x41c03f);while(_0x808a65[_0x1c4dd9(0x1cf)](''+_0x221461+sep)||_0x808a65===_0x221461){if(_0x808a65===_0x221461)return;try{const _0x54e9bf=await readdir(_0x808a65);if(_0x54e9bf[_0x1c4dd9(0x1dc)]>0x0)return;await rmdir(_0x808a65);}catch{return;}_0x808a65=dirname(_0x808a65);}}async function resolveTargetDbBinding(_0x84ce24,_0x182c4e,_0x3a2069){const _0x591710=a173_0x948c4d,_0x2a89ef=_0x182c4e[_0x591710(0x1f8)];if(!_0x2a89ef)return{'dbId':_0x3a2069[_0x591710(0x1f9)],'dbName':_0x3a2069[_0x591710(0x205)]};const _0x1609b3=buildDbDirectoryName(_0x3a2069['dbName'],_0x3a2069[_0x591710(0x1f9)]);if(_0x2a89ef===_0x1609b3)return{'dbId':_0x3a2069[_0x591710(0x1f9)],'dbName':_0x3a2069[_0x591710(0x205)]};const _0x38a982=parseExplicitDbDirectory(_0x2a89ef);if(_0x38a982!=null)return{'dbId':_0x38a982,'dbName':await getDbName(_0x84ce24,_0x38a982)[_0x591710(0x1fa)](()=>undefined)};const _0x35a9a7=await listDatabases(_0x84ce24),_0x3d407a=_0x35a9a7[_0x591710(0x1db)](_0x586928=>buildDbDirectoryName(_0x586928[_0x591710(0x205)],_0x586928[_0x591710(0x1f9)])===_0x2a89ef);if(_0x3d407a['length']===0x1)return{'dbId':_0x3d407a[0x0]['dbId'],'dbName':_0x3d407a[0x0][_0x591710(0x205)]};if(_0x3d407a[_0x591710(0x1dc)]===0x0)throw CliErrors[_0x591710(0x1cd)](_0x591710(0x1d2)+_0x2a89ef+_0x591710(0x1ff)+_0x182c4e[_0x591710(0x1ca)]+'.');const _0x24151f=_0x3d407a[_0x591710(0x1c5)](_0x534550=>_0x534550[_0x591710(0x205)]+'\x20('+_0x534550[_0x591710(0x1f9)]+')')[_0x591710(0x1eb)](',\x20');throw CliErrors[_0x591710(0x1cd)](_0x591710(0x1fc)+_0x2a89ef+_0x591710(0x1d7)+_0x182c4e[_0x591710(0x1ca)]+':\x20'+_0x24151f);}function parseExplicitDbDirectory(_0x159152){const _0x80af1e=a173_0x948c4d,_0x59ae9e=/^db-(\d+)$/['exec'](_0x159152);if(!_0x59ae9e)return null;const _0x28d57e=Number(_0x59ae9e[0x1]);return Number[_0x80af1e(0x1e6)](_0x28d57e)&&_0x28d57e>0x0?_0x28d57e:null;}
@@ -1 +1 @@
1
- const a173_0x506b9c=a173_0x3824;function a173_0x3824(_0xa06940,_0x49a271){_0xa06940=_0xa06940-0xe0;const _0x2472c3=a173_0x2472();let _0x3824cd=_0x2472c3[_0xa06940];return _0x3824cd;}(function(_0x29ced5,_0xffc39){const _0x811f28=a173_0x3824,_0x5a11f5=_0x29ced5();while(!![]){try{const _0x4c0607=-parseInt(_0x811f28(0xe1))/0x1*(-parseInt(_0x811f28(0xef))/0x2)+parseInt(_0x811f28(0xee))/0x3*(parseInt(_0x811f28(0xf5))/0x4)+parseInt(_0x811f28(0xea))/0x5*(parseInt(_0x811f28(0xe8))/0x6)+-parseInt(_0x811f28(0xec))/0x7*(parseInt(_0x811f28(0xf6))/0x8)+parseInt(_0x811f28(0xe6))/0x9*(-parseInt(_0x811f28(0xf7))/0xa)+-parseInt(_0x811f28(0xe0))/0xb+parseInt(_0x811f28(0xe9))/0xc;if(_0x4c0607===_0xffc39)break;else _0x5a11f5['push'](_0x5a11f5['shift']());}catch(_0x1849bf){_0x5a11f5['push'](_0x5a11f5['shift']());}}}(a173_0x2472,0x80ffe));import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a173_0x2472(){const _0x1ac053=['validation','108XmFKZQ','29740248ICPRFK','1735zgdpbf','SQL\x20query\x20display\x20name','60466SHuYNW','Path\x20to\x20the\x20SQL\x20file','5847WjzvZj','12DEWhhN','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','write','file','sql','sqlname','1708uPjiBH','968Fcctew','3050kiUssd','string','9936454rjLdak','2701oTcNEO','save','description','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','25263lrmsGw'];a173_0x2472=function(){return _0x1ac053;};return a173_0x2472();}const SQL_SAVE_DEPRECATED_HINT=[a173_0x506b9c(0xf0),a173_0x506b9c(0xe5),'Update\x20existing\x20SQL\x20by\x20editing\x20the\x20synced\x20file\x20under\x20`.rabetbase/sql/<appCode>/<dbName|db-<id>>/`\x20and\x20then\x20running\x20`rabetbase\x20sql\x20push\x20--sqlcode\x20<code>\x20--yes`.']['join']('\x0a');export const sqlSave={'service':a173_0x506b9c(0xf3),'command':a173_0x506b9c(0xe2),'description':'Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','risk':a173_0x506b9c(0xf1),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a173_0x506b9c(0xf2),'type':a173_0x506b9c(0xf8),'required':!![],'description':a173_0x506b9c(0xed)},SQLCODE_FLAG_OPTIONAL,{'name':a173_0x506b9c(0xf4),'type':a173_0x506b9c(0xf8),'description':a173_0x506b9c(0xeb)},{'name':'db','type':a173_0x506b9c(0xf8),'description':a173_0x506b9c(0xe4)},{'name':a173_0x506b9c(0xe3),'type':a173_0x506b9c(0xf8),'description':'Query\x20description'}],async 'validate'(){const _0x536858=a173_0x506b9c;throw CliErrors[_0x536858(0xe7)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){throw CliErrors['validation'](SQL_SAVE_DEPRECATED_HINT);}};
1
+ const a174_0xf25f30=a174_0x121b;(function(_0x9d284d,_0x156058){const _0x5ae68a=a174_0x121b,_0x4786b8=_0x9d284d();while(!![]){try{const _0x3ba475=-parseInt(_0x5ae68a(0x131))/0x1+-parseInt(_0x5ae68a(0x13f))/0x2+-parseInt(_0x5ae68a(0x139))/0x3*(-parseInt(_0x5ae68a(0x135))/0x4)+parseInt(_0x5ae68a(0x13e))/0x5*(parseInt(_0x5ae68a(0x13a))/0x6)+parseInt(_0x5ae68a(0x134))/0x7+-parseInt(_0x5ae68a(0x12e))/0x8*(-parseInt(_0x5ae68a(0x13c))/0x9)+-parseInt(_0x5ae68a(0x138))/0xa;if(_0x3ba475===_0x156058)break;else _0x4786b8['push'](_0x4786b8['shift']());}catch(_0x3d006b){_0x4786b8['push'](_0x4786b8['shift']());}}}(a174_0x315d,0x8f9ec));function a174_0x121b(_0x5437e5,_0x401125){_0x5437e5=_0x5437e5-0x12d;const _0x315df8=a174_0x315d();let _0x121b05=_0x315df8[_0x5437e5];return _0x121b05;}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a174_0xf25f30(0x140),a174_0xf25f30(0x12f),'Update\x20existing\x20SQL\x20by\x20editing\x20the\x20synced\x20file\x20under\x20`.rabetbase/sql/<appCode>/<dbName|db-<id>>/`\x20and\x20then\x20running\x20`rabetbase\x20sql\x20push\x20--sqlcode\x20<code>\x20--yes`.']['join']('\x0a');export const sqlSave={'service':a174_0xf25f30(0x141),'command':a174_0xf25f30(0x130),'description':a174_0xf25f30(0x136),'risk':'write','requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a174_0xf25f30(0x12d),'type':a174_0xf25f30(0x133),'required':!![],'description':'Path\x20to\x20the\x20SQL\x20file'},SQLCODE_FLAG_OPTIONAL,{'name':a174_0xf25f30(0x13d),'type':'string','description':a174_0xf25f30(0x13b)},{'name':'db','type':a174_0xf25f30(0x133),'description':a174_0xf25f30(0x137)},{'name':'description','type':'string','description':'Query\x20description'}],async 'validate'(){const _0x179354=a174_0xf25f30;throw CliErrors[_0x179354(0x132)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0x1f5e69=a174_0xf25f30;throw CliErrors[_0x1f5e69(0x132)](SQL_SAVE_DEPRECATED_HINT);}};function a174_0x315d(){const _0x2fab62=['SQL\x20query\x20display\x20name','198SioJZy','sqlname','10yVruPd','807670DPDYuv','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','sql','file','311768fcaSLl','Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','save','811824pMVkcX','validation','string','5199922mEnhjs','4yFYzdd','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','2193180Ciphol','498831jCWQJL','770280KhmyVl'];a174_0x315d=function(){return _0x2fab62;};return a174_0x315d();}
@@ -1 +1 @@
1
- (function(_0xd5e980,_0x4e3d95){const _0x217792=a174_0x2155,_0xa3634=_0xd5e980();while(!![]){try{const _0x3a0e84=-parseInt(_0x217792(0x1e1))/0x1*(-parseInt(_0x217792(0x1fc))/0x2)+-parseInt(_0x217792(0x1e8))/0x3+-parseInt(_0x217792(0x1ea))/0x4+-parseInt(_0x217792(0x1ec))/0x5*(parseInt(_0x217792(0x1f6))/0x6)+parseInt(_0x217792(0x1df))/0x7+-parseInt(_0x217792(0x1fd))/0x8*(-parseInt(_0x217792(0x1d6))/0x9)+-parseInt(_0x217792(0x1f2))/0xa*(-parseInt(_0x217792(0x1f0))/0xb);if(_0x3a0e84===_0x4e3d95)break;else _0xa3634['push'](_0xa3634['shift']());}catch(_0x297772){_0xa3634['push'](_0xa3634['shift']());}}}(a174_0x45ee,0xa4308));import{createInterface}from'node:readline';function a174_0x45ee(){const _0x4fc82c=['--\x20@lovrabet.','dbName','join','1115415omDNpD','path','description','includes','sqlName','trim','endsWith','fromEntries','mybatisXml','4260949FLDbQz','lastSync','1qLeQrf','question','stdin','sqls','close','syncedAt','map','2908716GPwcOl','filter','1276868axAvgV','push','6636785cQYpjs','mode','<!--\x20@lovrabet.','sqlCode','33MpoLjh','replace','3848300uIaOBB','test','split','dbId','6yXipvc','length','entries','\x20-->','toLowerCase','trimStart','2555198rjeULw','16HZjFqE','version'];a174_0x45ee=function(){return _0x4fc82c;};return a174_0x45ee();}import{join}from'node:path';import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR='.rabetbase/sql';export function buildSqlLockEntry(_0x251a29,_0x22fb50,_0x59b04c,_0x39374e){const _0xca125=a174_0x2155,_0x112f0d=detectSqlMode(_0x22fb50);return{'path':buildSqlRelativePath(_0x251a29[_0xca125(0x1ef)],_0x251a29[_0xca125(0x1da)],_0x39374e?.[_0xca125(0x1d4)],_0x112f0d,_0x251a29[_0xca125(0x1f5)]),'hash':_0x59b04c,'remoteId':_0x251a29['id'],'version':_0x251a29[_0xca125(0x1fe)],'dbId':Number(_0x251a29[_0xca125(0x1f5)]),'dbName':_0x39374e?.[_0xca125(0x1d4)],'sqlName':_0x251a29[_0xca125(0x1da)],'sqlConfig':_0x251a29['sqlConfig']??undefined,'mode':_0x112f0d};}export function cloneSqlLockData(_0x47c4d4){const _0x176023=a174_0x2155;return{'apps':Object[_0x176023(0x1dd)](Object[_0x176023(0x1f8)](_0x47c4d4['apps'])[_0x176023(0x1e7)](([_0x2410a6,_0x29206c])=>[_0x2410a6,{'sqlRoot':_0x29206c['sqlRoot'],'lastSync':_0x29206c[_0x176023(0x1e0)],'sqls':{..._0x29206c[_0x176023(0x1e4)]}}]))};}export function ensureRemoteSqlContent(_0x54af92){return _0x54af92['sqlContent']??'';}function a174_0x2155(_0x4ebd69,_0x3fc754){_0x4ebd69=_0x4ebd69-0x1d3;const _0x45eedb=a174_0x45ee();let _0x21556e=_0x45eedb[_0x4ebd69];return _0x21556e;}export function buildLocalSqlFileContent(_0x1c5010,_0x2b4ba8,_0x4be723){const _0x476b71=a174_0x2155,_0x5c16c1=_0x4be723?.['mode']??detectSqlMode(_0x2b4ba8),_0x39e853=stripLocalSqlMetadata(_0x2b4ba8,_0x5c16c1)[_0x476b71(0x1db)](),_0xe86567=[...buildMetadataHeaderLines({'sqlCode':_0x1c5010[_0x476b71(0x1ef)],'sqlName':_0x1c5010[_0x476b71(0x1da)],'dbId':_0x1c5010[_0x476b71(0x1f5)],'dbName':_0x4be723?.[_0x476b71(0x1d4)],'mode':_0x5c16c1,'syncedAt':_0x4be723?.[_0x476b71(0x1e6)],'description':_0x4be723?.[_0x476b71(0x1d8)]},_0x5c16c1),'',_0x39e853],_0x15b842=_0xe86567['join']('\x0a');return _0x15b842[_0x476b71(0x1dc)]('\x0a')?_0x15b842:_0x15b842+'\x0a';}export function stripLocalSqlMetadata(_0x503fcf,_0x1e8edd){const _0x2cfdfc=a174_0x2155,_0x5a9f48=_0x503fcf[_0x2cfdfc(0x1f1)](/\r\n/g,'\x0a')[_0x2cfdfc(0x1f4)]('\x0a'),_0x2aecef=[];let _0x4ad776=0x0;if(_0x1e8edd===_0x2cfdfc(0x1de))while(_0x4ad776<_0x5a9f48['length']){const _0x3dbc9b=_0x5a9f48[_0x4ad776]??'';if(/^\s*<!--\s*@lovrabet\./[_0x2cfdfc(0x1f3)](_0x3dbc9b)){_0x4ad776++;continue;}if(_0x3dbc9b[_0x2cfdfc(0x1db)]()===''&&_0x4ad776>0x0){_0x4ad776++;continue;}break;}else while(_0x4ad776<_0x5a9f48[_0x2cfdfc(0x1f7)]){const _0x502cfd=_0x5a9f48[_0x4ad776]??'';if(/^\s*--\s*@lovrabet\./['test'](_0x502cfd)){_0x4ad776++;continue;}if(_0x502cfd[_0x2cfdfc(0x1db)]()===''&&_0x4ad776>0x0){_0x4ad776++;continue;}break;}for(;_0x4ad776<_0x5a9f48[_0x2cfdfc(0x1f7)];_0x4ad776++){_0x2aecef[_0x2cfdfc(0x1eb)](_0x5a9f48[_0x4ad776]);}return _0x2aecef[_0x2cfdfc(0x1d5)]('\x0a')[_0x2cfdfc(0x1fb)]();}export function resolveSqlMode(_0x75f7ee,_0x204c80){const _0x1b8dce=a174_0x2155;if(_0x204c80?.[_0x1b8dce(0x1ed)])return _0x204c80[_0x1b8dce(0x1ed)];return detectSqlMode(_0x75f7ee);}export function resolveSqlFileName(_0x10ee76,_0x31a4fa,_0x3b1ea){const _0x2b6f60=a174_0x2155;if(_0x3b1ea?.[_0x2b6f60(0x1d7)])return _0x3b1ea[_0x2b6f60(0x1d7)];if(_0x3b1ea?.[_0x2b6f60(0x1da)]||_0x3b1ea?.[_0x2b6f60(0x1d4)])return buildSqlRelativePath(_0x10ee76,_0x3b1ea?.[_0x2b6f60(0x1da)],_0x3b1ea?.[_0x2b6f60(0x1d4)],resolveSqlMode(_0x31a4fa,_0x3b1ea),_0x3b1ea?.[_0x2b6f60(0x1f5)]);return buildDefaultSqlFileName(_0x10ee76,resolveSqlMode(_0x31a4fa,_0x3b1ea));}export function resolveSqlLocalDir(_0x186402,_0x426f83){return join(_0x186402,SQL_LOCAL_REL_DIR,_0x426f83);}export async function confirmForceOverwrite(_0x5637d2){const _0x3d040d=a174_0x2155,_0x4e6bdd=createInterface({'input':process[_0x3d040d(0x1e3)],'output':process['stderr']}),_0x1ba44a=await new Promise(_0xcaded=>{const _0x5edbe9=_0x3d040d;_0x4e6bdd[_0x5edbe9(0x1e2)](_0x5637d2+'\x20[y/N]\x20',_0xcaded);});return _0x4e6bdd[_0x3d040d(0x1e5)](),['y','yes'][_0x3d040d(0x1d9)](_0x1ba44a[_0x3d040d(0x1db)]()[_0x3d040d(0x1fa)]());}export function findSqlLockScope(_0xf232b7,_0x3ad622){return _0xf232b7['apps'][_0x3ad622];}function buildMetadataHeaderLines(_0x273d51,_0x465e9f){const _0x2b7dbb=a174_0x2155,_0x41e6e7=[[_0x2b7dbb(0x1ef),_0x273d51[_0x2b7dbb(0x1ef)]],[_0x2b7dbb(0x1da),_0x273d51['sqlName']],[_0x2b7dbb(0x1f5),_0x273d51[_0x2b7dbb(0x1f5)]],['dbName',_0x273d51[_0x2b7dbb(0x1d4)]],[_0x2b7dbb(0x1ed),_0x273d51[_0x2b7dbb(0x1ed)]],[_0x2b7dbb(0x1e6),_0x273d51[_0x2b7dbb(0x1e6)]],[_0x2b7dbb(0x1d8),_0x273d51[_0x2b7dbb(0x1d8)]]];if(_0x465e9f==='mybatisXml')return _0x41e6e7[_0x2b7dbb(0x1e9)](([,_0x53d088])=>_0x53d088!==undefined&&_0x53d088!==null&&String(_0x53d088)[_0x2b7dbb(0x1db)]()!=='')[_0x2b7dbb(0x1e7)](([_0x10cf64,_0x4eb1f5])=>_0x2b7dbb(0x1ee)+_0x10cf64+':\x20'+String(_0x4eb1f5)+_0x2b7dbb(0x1f9));return _0x41e6e7['filter'](([,_0x227968])=>_0x227968!==undefined&&_0x227968!==null&&String(_0x227968)['trim']()!=='')[_0x2b7dbb(0x1e7)](([_0x3afa83,_0x4c417c])=>_0x2b7dbb(0x1d3)+_0x3afa83+':\x20'+String(_0x4c417c));}
1
+ function a175_0x384c(_0x5b647b,_0x44f54b){_0x5b647b=_0x5b647b-0x6b;const _0x5f3490=a175_0x5f34();let _0x384c34=_0x5f3490[_0x5b647b];return _0x384c34;}const a175_0x4a22fe=a175_0x384c;(function(_0xbe112e,_0x2d5535){const _0x220576=a175_0x384c,_0x2aac16=_0xbe112e();while(!![]){try{const _0x66471d=parseInt(_0x220576(0x6e))/0x1*(-parseInt(_0x220576(0x72))/0x2)+parseInt(_0x220576(0x6c))/0x3*(-parseInt(_0x220576(0x97))/0x4)+-parseInt(_0x220576(0x99))/0x5*(-parseInt(_0x220576(0x71))/0x6)+-parseInt(_0x220576(0x80))/0x7+-parseInt(_0x220576(0x96))/0x8+parseInt(_0x220576(0x87))/0x9*(parseInt(_0x220576(0x91))/0xa)+parseInt(_0x220576(0x86))/0xb;if(_0x66471d===_0x2d5535)break;else _0x2aac16['push'](_0x2aac16['shift']());}catch(_0x3616fd){_0x2aac16['push'](_0x2aac16['shift']());}}}(a175_0x5f34,0xe5b87));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=a175_0x4a22fe(0x6f);export function buildSqlLockEntry(_0x2cd7a9,_0x462278,_0xea5a12,_0x116ba9){const _0x5df8db=a175_0x4a22fe,_0x493067=detectSqlMode(_0x462278);return{'path':buildSqlRelativePath(_0x2cd7a9[_0x5df8db(0x7c)],_0x2cd7a9[_0x5df8db(0x82)],_0x116ba9?.[_0x5df8db(0x95)],_0x493067,_0x2cd7a9['dbId']),'hash':_0xea5a12,'remoteId':_0x2cd7a9['id'],'version':_0x2cd7a9['version'],'dbId':Number(_0x2cd7a9['dbId']),'dbName':_0x116ba9?.[_0x5df8db(0x95)],'sqlName':_0x2cd7a9['sqlName'],'sqlConfig':_0x2cd7a9['sqlConfig']??undefined,'mode':_0x493067};}export function cloneSqlLockData(_0x4ba5d7){const _0x1cc974=a175_0x4a22fe;return{'apps':Object[_0x1cc974(0x7d)](Object[_0x1cc974(0x88)](_0x4ba5d7[_0x1cc974(0x8e)])['map'](([_0x2d0a7b,_0x38b680])=>[_0x2d0a7b,{'sqlRoot':_0x38b680[_0x1cc974(0x79)],'lastSync':_0x38b680[_0x1cc974(0x92)],'sqls':{..._0x38b680[_0x1cc974(0x6b)]}}]))};}export function ensureRemoteSqlContent(_0x43e907){const _0xcb395=a175_0x4a22fe;return _0x43e907[_0xcb395(0x83)]??'';}export function buildLocalSqlFileContent(_0x29ac86,_0x4f3aa4,_0x456999){const _0x4024b5=a175_0x4a22fe,_0x487472=_0x456999?.[_0x4024b5(0x74)]??detectSqlMode(_0x4f3aa4),_0x3639a8=stripLocalSqlMetadata(_0x4f3aa4,_0x487472)['trim'](),_0x3aa998=[...buildMetadataHeaderLines({'sqlCode':_0x29ac86['sqlCode'],'sqlName':_0x29ac86['sqlName'],'dbId':_0x29ac86[_0x4024b5(0x94)],'dbName':_0x456999?.[_0x4024b5(0x95)],'mode':_0x487472,'syncedAt':_0x456999?.[_0x4024b5(0x7f)],'description':_0x456999?.[_0x4024b5(0x6d)]},_0x487472),'',_0x3639a8],_0x106aa6=_0x3aa998[_0x4024b5(0x8d)]('\x0a');return _0x106aa6[_0x4024b5(0x93)]('\x0a')?_0x106aa6:_0x106aa6+'\x0a';}export function stripLocalSqlMetadata(_0x27d582,_0xfd792b){const _0x4f7ee1=a175_0x4a22fe,_0x1d2944=_0x27d582[_0x4f7ee1(0x8b)](/\r\n/g,'\x0a')[_0x4f7ee1(0x98)]('\x0a'),_0x192431=[];let _0x2c999a=0x0;if(_0xfd792b==='mybatisXml')while(_0x2c999a<_0x1d2944['length']){const _0xc2ad46=_0x1d2944[_0x2c999a]??'';if(/^\s*<!--\s*@lovrabet\./[_0x4f7ee1(0x85)](_0xc2ad46)){_0x2c999a++;continue;}if(_0xc2ad46['trim']()===''&&_0x2c999a>0x0){_0x2c999a++;continue;}break;}else while(_0x2c999a<_0x1d2944[_0x4f7ee1(0x84)]){const _0x1fa321=_0x1d2944[_0x2c999a]??'';if(/^\s*--\s*@lovrabet\./[_0x4f7ee1(0x85)](_0x1fa321)){_0x2c999a++;continue;}if(_0x1fa321[_0x4f7ee1(0x73)]()===''&&_0x2c999a>0x0){_0x2c999a++;continue;}break;}for(;_0x2c999a<_0x1d2944[_0x4f7ee1(0x84)];_0x2c999a++){_0x192431['push'](_0x1d2944[_0x2c999a]);}return _0x192431['join']('\x0a')[_0x4f7ee1(0x77)]();}export function resolveSqlMode(_0x1e33d9,_0x161289){const _0x5f174e=a175_0x4a22fe;if(_0x161289?.[_0x5f174e(0x74)])return _0x161289[_0x5f174e(0x74)];return detectSqlMode(_0x1e33d9);}export function resolveSqlFileName(_0x21f73e,_0x21fd1e,_0x42d212){const _0x451537=a175_0x4a22fe;if(_0x42d212?.['path'])return _0x42d212[_0x451537(0x7a)];if(_0x42d212?.['sqlName']||_0x42d212?.[_0x451537(0x95)])return buildSqlRelativePath(_0x21f73e,_0x42d212?.['sqlName'],_0x42d212?.[_0x451537(0x95)],resolveSqlMode(_0x21fd1e,_0x42d212),_0x42d212?.[_0x451537(0x94)]);return buildDefaultSqlFileName(_0x21f73e,resolveSqlMode(_0x21fd1e,_0x42d212));}export function resolveSqlLocalDir(_0x592ae6,_0x3ad71e){return join(_0x592ae6,SQL_LOCAL_REL_DIR,_0x3ad71e);}export async function confirmForceOverwrite(_0x2a3b47){const _0x38dcb6=a175_0x4a22fe,_0x22f15f=createInterface({'input':process[_0x38dcb6(0x78)],'output':process['stderr']}),_0x28309f=await new Promise(_0xb82e01=>{const _0x5995aa=_0x38dcb6;_0x22f15f[_0x5995aa(0x7b)](_0x2a3b47+_0x5995aa(0x76),_0xb82e01);});return _0x22f15f[_0x38dcb6(0x8c)](),['y',_0x38dcb6(0x70)][_0x38dcb6(0x89)](_0x28309f[_0x38dcb6(0x73)]()['toLowerCase']());}function a175_0x5f34(){const _0x26c1a4=['close','join','apps','mybatisXml','filter','1850rprvSt','lastSync','endsWith','dbId','dbName','4971296ZxFdBn','4678588AYsORu','split','78775zktRGB','sqls','3OFBKwR','description','13ykpkIr','.rabetbase/sql','yes','606yiqLHb','189644IguViD','trim','mode','map','\x20[y/N]\x20','trimStart','stdin','sqlRoot','path','question','sqlCode','fromEntries','--\x20@lovrabet.','syncedAt','4879847YeaAEk','\x20-->','sqlName','sqlContent','length','test','29130101TVNtfo','20547otrrxv','entries','includes','<!--\x20@lovrabet.','replace'];a175_0x5f34=function(){return _0x26c1a4;};return a175_0x5f34();}export function findSqlLockScope(_0x5255ad,_0x4034a6){const _0x1d192b=a175_0x4a22fe;return _0x5255ad[_0x1d192b(0x8e)][_0x4034a6];}function buildMetadataHeaderLines(_0x32621f,_0x5c6d4d){const _0x1b8b1c=a175_0x4a22fe,_0x100101=[[_0x1b8b1c(0x7c),_0x32621f['sqlCode']],['sqlName',_0x32621f[_0x1b8b1c(0x82)]],[_0x1b8b1c(0x94),_0x32621f[_0x1b8b1c(0x94)]],[_0x1b8b1c(0x95),_0x32621f[_0x1b8b1c(0x95)]],[_0x1b8b1c(0x74),_0x32621f[_0x1b8b1c(0x74)]],[_0x1b8b1c(0x7f),_0x32621f[_0x1b8b1c(0x7f)]],[_0x1b8b1c(0x6d),_0x32621f[_0x1b8b1c(0x6d)]]];if(_0x5c6d4d===_0x1b8b1c(0x8f))return _0x100101[_0x1b8b1c(0x90)](([,_0x10ea87])=>_0x10ea87!==undefined&&_0x10ea87!==null&&String(_0x10ea87)[_0x1b8b1c(0x73)]()!=='')[_0x1b8b1c(0x75)](([_0x301a73,_0x31fba1])=>_0x1b8b1c(0x8a)+_0x301a73+':\x20'+String(_0x31fba1)+_0x1b8b1c(0x81));return _0x100101['filter'](([,_0x109c77])=>_0x109c77!==undefined&&_0x109c77!==null&&String(_0x109c77)[_0x1b8b1c(0x73)]()!=='')[_0x1b8b1c(0x75)](([_0x4f9a4a,_0x61797a])=>_0x1b8b1c(0x7e)+_0x4f9a4a+':\x20'+String(_0x61797a));}
@@ -1 +1 @@
1
- const a175_0x4c662c=a175_0x1ccb;(function(_0xc2ae42,_0x237a57){const _0x50ee85=a175_0x1ccb,_0x9dfbe1=_0xc2ae42();while(!![]){try{const _0x30cf7d=parseInt(_0x50ee85(0x1bd))/0x1*(-parseInt(_0x50ee85(0x1b3))/0x2)+parseInt(_0x50ee85(0x1c5))/0x3*(parseInt(_0x50ee85(0x1ac))/0x4)+-parseInt(_0x50ee85(0x1c8))/0x5+-parseInt(_0x50ee85(0x1c9))/0x6+-parseInt(_0x50ee85(0x1b6))/0x7+parseInt(_0x50ee85(0x1d0))/0x8*(-parseInt(_0x50ee85(0x1b4))/0x9)+parseInt(_0x50ee85(0x1bc))/0xa;if(_0x30cf7d===_0x237a57)break;else _0x9dfbe1['push'](_0x9dfbe1['shift']());}catch(_0x39b6f6){_0x9dfbe1['push'](_0x9dfbe1['shift']());}}}(a175_0x35c7,0xcfe21));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';function a175_0x35c7(){const _0x4d7b3e=['push','sqlCode','sql','paging','\x20remote-only','totalCount','3WyqDls','bool','keys','7880550YEKOaM','5714676wJNtvL','lockFilePath','All\x20SQL\x20queries\x20are\x20in\x20sync.','sqls','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','status','sqlRoot','8osmTcl','appCode','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','has','1755556uFgTNw','length','path','lockKey','\x20modified,\x20','\x20unchanged','hash','214874WvrFJN','9770481AGiRie','boolean','6071842DqmKnj','map','remote','\x20added,\x20','sqlName','\x20missing,\x20','51090450UCebmV','2UzLGps','read'];a175_0x35c7=function(){return _0x4d7b3e;};return a175_0x35c7();}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;function a175_0x1ccb(_0x5be776,_0x1fb541){_0x5be776=_0x5be776-0x1ac;const _0x35c785=a175_0x35c7();let _0x1ccb86=_0x35c785[_0x5be776];return _0x1ccb86;}async function fetchAllSqlCodes(_0x973ee3){const _0x5d77af=a175_0x1ccb,_0x20d67b=[];let _0x2aa51b=0x1;while(!![]){const _0x98bb4a=await listSqlQueries(_0x973ee3,{'currentPage':_0x2aa51b,'pageSize':PAGE_SIZE}),_0x30f314=_0x98bb4a['tableData']??[];_0x20d67b[_0x5d77af(0x1bf)](..._0x30f314['map'](_0xb7fb73=>_0xb7fb73[_0x5d77af(0x1c0)]));if(_0x30f314[_0x5d77af(0x1ad)]===0x0)break;const _0x3d1bf4=_0x98bb4a[_0x5d77af(0x1c2)]?.[_0x5d77af(0x1c4)];if(_0x3d1bf4!=null?_0x20d67b[_0x5d77af(0x1ad)]>=_0x3d1bf4:_0x30f314['length']<PAGE_SIZE)break;_0x2aa51b++;}return _0x20d67b;}export const sqlStatus={'service':a175_0x4c662c(0x1c1),'command':a175_0x4c662c(0x1ce),'description':a175_0x4c662c(0x1d2),'risk':a175_0x4c662c(0x1be),'flags':[{'name':a175_0x4c662c(0x1b8),'type':a175_0x4c662c(0x1b5),'description':a175_0x4c662c(0x1cd)}],async 'execute'(_0x5234b6){const _0x595ac3=a175_0x4c662c,_0x119d9d=loadSqlProjectConfig(_0x5234b6[_0x595ac3(0x1d1)]),_0x5a544d=await readSqlLockFile(_0x119d9d[_0x595ac3(0x1ca)]),{appLock:_0xc8f19c}=ensureSqlLockScope(_0x5a544d??createEmptySqlLock(),_0x119d9d[_0x595ac3(0x1d1)],_0x119d9d[_0x595ac3(0x1cf)],'status'),_0x10ce66=await scanLocalSqlQueries(_0x119d9d),_0x477b5e=[],_0x465adb=[],_0x1c0d00=[],_0x20a543=[],_0x4c773c=new Set(_0x10ce66[_0x595ac3(0x1b7)](_0x30a6e1=>_0x30a6e1[_0x595ac3(0x1af)]));for(const _0x2fe615 of _0x10ce66){const _0x42c2c4=await computeSqlFileHash(_0x2fe615['filePath']),_0x7fcd04=_0xc8f19c['sqls'][_0x2fe615[_0x595ac3(0x1af)]],_0x159aad=!!_0x7fcd04&&_0x7fcd04[_0x595ac3(0x1ae)]!==_0x2fe615['relativePath'],_0x5a5b26=!!_0x7fcd04&&!!_0x2fe615[_0x595ac3(0x1ba)]&&_0x7fcd04['sqlName']!==_0x2fe615[_0x595ac3(0x1ba)];if(!_0x7fcd04)_0x477b5e['push'](_0x2fe615[_0x595ac3(0x1af)]);else _0x7fcd04[_0x595ac3(0x1b2)]!==_0x42c2c4||_0x159aad||_0x5a5b26?_0x465adb[_0x595ac3(0x1bf)](_0x2fe615[_0x595ac3(0x1af)]):_0x1c0d00[_0x595ac3(0x1bf)](_0x2fe615['lockKey']);}for(const _0x2a1447 of Object[_0x595ac3(0x1c7)](_0xc8f19c[_0x595ac3(0x1cc)])){!_0x4c773c['has'](_0x2a1447)&&_0x20a543[_0x595ac3(0x1bf)](_0x2a1447);}const _0x20a0c2=[];if(_0x5234b6[_0x595ac3(0x1c6)]('remote')){const _0x568426=await fetchAllSqlCodes(_0x5234b6[_0x595ac3(0x1d1)]);for(const _0x13e017 of _0x568426){!_0x4c773c[_0x595ac3(0x1d3)](_0x13e017)&&!_0xc8f19c['sqls'][_0x13e017]&&_0x20a0c2[_0x595ac3(0x1bf)](_0x13e017);}}const _0x2a76c1=_0x477b5e['length']===0x0&&_0x465adb[_0x595ac3(0x1ad)]===0x0&&_0x20a543[_0x595ac3(0x1ad)]===0x0&&_0x20a0c2[_0x595ac3(0x1ad)]===0x0;return{'ok':!![],'data':{'added':_0x477b5e,'modified':_0x465adb,'missing':_0x20a543,'unchanged':_0x1c0d00,'remoteOnly':_0x20a0c2},'message':_0x2a76c1?_0x595ac3(0x1cb):_0x477b5e[_0x595ac3(0x1ad)]+_0x595ac3(0x1b9)+_0x465adb[_0x595ac3(0x1ad)]+_0x595ac3(0x1b0)+_0x20a543[_0x595ac3(0x1ad)]+_0x595ac3(0x1bb)+_0x1c0d00['length']+_0x595ac3(0x1b1)+(_0x20a0c2[_0x595ac3(0x1ad)]>0x0?',\x20'+_0x20a0c2[_0x595ac3(0x1ad)]+_0x595ac3(0x1c3):'')};}};
1
+ const a176_0x591f7e=a176_0x2bbf;(function(_0x299565,_0x2649b7){const _0x485202=a176_0x2bbf,_0x2b3765=_0x299565();while(!![]){try{const _0x1777ea=-parseInt(_0x485202(0x15e))/0x1+-parseInt(_0x485202(0x168))/0x2*(-parseInt(_0x485202(0x156))/0x3)+parseInt(_0x485202(0x161))/0x4+parseInt(_0x485202(0x16e))/0x5+-parseInt(_0x485202(0x163))/0x6+-parseInt(_0x485202(0x175))/0x7*(-parseInt(_0x485202(0x16b))/0x8)+-parseInt(_0x485202(0x16a))/0x9;if(_0x1777ea===_0x2649b7)break;else _0x2b3765['push'](_0x2b3765['shift']());}catch(_0x1f7975){_0x2b3765['push'](_0x2b3765['shift']());}}}(a176_0x540e,0x2e62b));import{listSqlQueries}from'../../core/api-client.js';function a176_0x2bbf(_0x15a2e4,_0x1d8cdd){_0x15a2e4=_0x15a2e4-0x154;const _0x540ec4=a176_0x540e();let _0x2bbf6c=_0x540ec4[_0x15a2e4];return _0x2bbf6c;}import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x48b88a){const _0x12bb37=a176_0x2bbf,_0x5002c0=[];let _0x6b9835=0x1;while(!![]){const _0x260d7d=await listSqlQueries(_0x48b88a,{'currentPage':_0x6b9835,'pageSize':PAGE_SIZE}),_0x291fb3=_0x260d7d[_0x12bb37(0x157)]??[];_0x5002c0[_0x12bb37(0x169)](..._0x291fb3[_0x12bb37(0x15c)](_0x1b1d92=>_0x1b1d92['sqlCode']));if(_0x291fb3['length']===0x0)break;const _0x5a233c=_0x260d7d[_0x12bb37(0x155)]?.['totalCount'];if(_0x5a233c!=null?_0x5002c0[_0x12bb37(0x173)]>=_0x5a233c:_0x291fb3[_0x12bb37(0x173)]<PAGE_SIZE)break;_0x6b9835++;}return _0x5002c0;}export const sqlStatus={'service':a176_0x591f7e(0x15a),'command':a176_0x591f7e(0x162),'description':a176_0x591f7e(0x171),'risk':'read','flags':[{'name':a176_0x591f7e(0x159),'type':a176_0x591f7e(0x166),'description':'Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'}],async 'execute'(_0x3ce0ec){const _0x20dae5=a176_0x591f7e,_0x524080=loadSqlProjectConfig(_0x3ce0ec[_0x20dae5(0x172)]),_0x1a8559=await readSqlLockFile(_0x524080[_0x20dae5(0x176)]),{appLock:_0x31db38}=ensureSqlLockScope(_0x1a8559??createEmptySqlLock(),_0x524080[_0x20dae5(0x172)],_0x524080[_0x20dae5(0x16c)],_0x20dae5(0x162)),_0xab0370=await scanLocalSqlQueries(_0x524080),_0x46272c=[],_0x53cdfc=[],_0x527d1f=[],_0x9c7660=[],_0x4abeb1=new Set(_0xab0370[_0x20dae5(0x15c)](_0x3487a3=>_0x3487a3[_0x20dae5(0x164)]));for(const _0x275648 of _0xab0370){const _0x16a59c=await computeSqlFileHash(_0x275648[_0x20dae5(0x165)]),_0x28ba31=_0x31db38[_0x20dae5(0x167)][_0x275648[_0x20dae5(0x164)]],_0x3daf58=!!_0x28ba31&&_0x28ba31['path']!==_0x275648[_0x20dae5(0x16d)],_0x2f3949=!!_0x28ba31&&!!_0x275648['sqlName']&&_0x28ba31[_0x20dae5(0x154)]!==_0x275648['sqlName'];if(!_0x28ba31)_0x46272c[_0x20dae5(0x169)](_0x275648[_0x20dae5(0x164)]);else _0x28ba31['hash']!==_0x16a59c||_0x3daf58||_0x2f3949?_0x53cdfc['push'](_0x275648[_0x20dae5(0x164)]):_0x527d1f[_0x20dae5(0x169)](_0x275648[_0x20dae5(0x164)]);}for(const _0x365fce of Object[_0x20dae5(0x158)](_0x31db38[_0x20dae5(0x167)])){!_0x4abeb1[_0x20dae5(0x174)](_0x365fce)&&_0x9c7660[_0x20dae5(0x169)](_0x365fce);}const _0x2fbd36=[];if(_0x3ce0ec[_0x20dae5(0x15b)](_0x20dae5(0x159))){const _0x20463b=await fetchAllSqlCodes(_0x3ce0ec['appCode']);for(const _0x44dfe4 of _0x20463b){!_0x4abeb1[_0x20dae5(0x174)](_0x44dfe4)&&!_0x31db38[_0x20dae5(0x167)][_0x44dfe4]&&_0x2fbd36['push'](_0x44dfe4);}}const _0x418477=_0x46272c[_0x20dae5(0x173)]===0x0&&_0x53cdfc['length']===0x0&&_0x9c7660[_0x20dae5(0x173)]===0x0&&_0x2fbd36[_0x20dae5(0x173)]===0x0;return{'ok':!![],'data':{'added':_0x46272c,'modified':_0x53cdfc,'missing':_0x9c7660,'unchanged':_0x527d1f,'remoteOnly':_0x2fbd36},'message':_0x418477?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0x46272c[_0x20dae5(0x173)]+_0x20dae5(0x16f)+_0x53cdfc['length']+_0x20dae5(0x160)+_0x9c7660[_0x20dae5(0x173)]+_0x20dae5(0x15f)+_0x527d1f[_0x20dae5(0x173)]+_0x20dae5(0x170)+(_0x2fbd36[_0x20dae5(0x173)]>0x0?',\x20'+_0x2fbd36[_0x20dae5(0x173)]+_0x20dae5(0x15d):'')};}};function a176_0x540e(){const _0x51abec=['has','21NFbCfV','lockFilePath','sqlName','paging','39phHZLU','tableData','keys','remote','sql','bool','map','\x20remote-only','202619wpxylJ','\x20missing,\x20','\x20modified,\x20','371556jnzoxK','status','1235442FBUhno','lockKey','filePath','boolean','sqls','33938hzOyoB','push','3582396XBVDhG','972184qrMBFX','sqlRoot','relativePath','1592550uCrlUj','\x20added,\x20','\x20unchanged','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','appCode','length'];a176_0x540e=function(){return _0x51abec;};return a176_0x540e();}