@lovrabet/rabetbase-cli 2.3.10 → 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_0x18016e=a163_0x5419;function a163_0x5419(_0x3d0a2d,_0x3c8845){_0x3d0a2d=_0x3d0a2d-0x1ee;const _0x3e970f=a163_0x3e97();let _0x541916=_0x3e970f[_0x3d0a2d];return _0x541916;}(function(_0x5785af,_0x2a43a5){const _0x5d1620=a163_0x5419,_0x3afb98=_0x5785af();while(!![]){try{const _0x21b147=-parseInt(_0x5d1620(0x22a))/0x1+-parseInt(_0x5d1620(0x213))/0x2*(parseInt(_0x5d1620(0x22c))/0x3)+-parseInt(_0x5d1620(0x207))/0x4+-parseInt(_0x5d1620(0x208))/0x5*(parseInt(_0x5d1620(0x203))/0x6)+parseInt(_0x5d1620(0x20c))/0x7*(parseInt(_0x5d1620(0x216))/0x8)+-parseInt(_0x5d1620(0x209))/0x9*(-parseInt(_0x5d1620(0x21a))/0xa)+parseInt(_0x5d1620(0x21f))/0xb*(parseInt(_0x5d1620(0x224))/0xc);if(_0x21b147===_0x2a43a5)break;else _0x3afb98['push'](_0x3afb98['shift']());}catch(_0x385e1c){_0x3afb98['push'](_0x3afb98['shift']());}}}(a163_0x3e97,0x5a201));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';function a163_0x3e97(){const _0x43c042=['utf-8','\x20run\x20start','belowMinimum','Enable\x20watch\x20mode\x20for\x20preview','all','455598AVUevW','length','9PSMxtR','Script\x20\x22','\x20\x20EXAMPLES','needsUpgrade','inherit','args','package.json','script','error','vite\x20preview\x20exited\x20with\x20code\x20','\x22\x20not\x20found\x20in\x20package.json.','\x20run\x20','boolean','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','close','\x20run\x20<script>\x0a','bun.lockb','read','watch','\x20exited\x20with\x20code\x20','\x0a\x20\x20Usage:\x20','\x20\x20\x20\x20','node_modules','--watch','6tcvItQ','keys','run','yarn','103496RBaTre','2397265PGBqAk','1971Mdfrsn','build','\x0a\x20\x20Available\x20scripts:\x0a','734629qyjtOk','No\x20package.json\x20found\x20in\x20current\x20directory.','(none)','\x20run\x20preview\x20--watch','Available:\x20','push','join','435028wxQGKI','No\x20scripts\x20defined\x20in\x20package.json.','bool','24ynELXJ','\x20run\x20preview','cwd','preview','22040gbAxuw','.bin','has','bun.lock','pnpm-lock.yaml','11EgVbGU','log','validation','dev','bun','14221236WJhSCF'];a163_0x3e97=function(){return _0x43c042;};return a163_0x3e97();}const VERSION_CHECK_SCRIPTS=new Set(['start',a163_0x18016e(0x222)]);function readPackageScripts(_0xf2f4aa){const _0x27e84d=a163_0x18016e,_0x2339b1=resolve(_0xf2f4aa,_0x27e84d(0x1f1));if(!existsSync(_0x2339b1))return null;try{const _0x43d673=JSON['parse'](readFileSync(_0x2339b1,_0x27e84d(0x225)));return _0x43d673['scripts']??{};}catch{return null;}}function detectPackageManager(_0x568ffd){const _0x15c064=a163_0x18016e;if(existsSync(resolve(_0x568ffd,_0x15c064(0x1fb)))||existsSync(resolve(_0x568ffd,_0x15c064(0x21d))))return _0x15c064(0x223);if(existsSync(resolve(_0x568ffd,_0x15c064(0x21e))))return'pnpm';if(existsSync(resolve(_0x568ffd,'yarn.lock')))return _0x15c064(0x206);return'npm';}async function versionCheck(_0x215f26){const _0x4b22d8=a163_0x18016e,_0x901eec=await checkCliVersion();(_0x901eec[_0x4b22d8(0x1ee)]||_0x901eec[_0x4b22d8(0x227)])&&(printCliUpgradeWarning(_0x901eec),assertCliVersionSupported(_0x901eec));const _0x20db39=await checkSdkVersion(_0x215f26);if(_0x20db39[_0x4b22d8(0x1ee)])printSdkUpgradeWarning(_0x20db39);}function spawnScript(_0x75e1c8,_0x11b085,_0x588b92,_0x56b9b6){return new Promise((_0x43507a,_0x3ff79e)=>{const _0x5bc7be=a163_0x5419,_0xfbdb95=['run',_0x11b085,..._0x588b92],_0x5c4350=spawn(_0x75e1c8,_0xfbdb95,{'cwd':_0x56b9b6,'stdio':_0x5bc7be(0x1ef),'shell':!![],'env':{...process.env,'PATH':''+join(_0x56b9b6,_0x5bc7be(0x201),_0x5bc7be(0x21b))+delimiter+process.env.PATH}});_0x5c4350['on'](_0x5bc7be(0x1f9),_0x7305ca=>{const _0x281d62=_0x5bc7be;if(_0x7305ca===0x0||_0x7305ca===null)_0x43507a();else _0x3ff79e(new Error(_0x75e1c8+_0x281d62(0x1f6)+_0x11b085+_0x281d62(0x1fe)+_0x7305ca));}),_0x5c4350['on'](_0x5bc7be(0x1f3),_0x3ff79e);});}function spawnViteBuildWatch(_0x47ee75){return new Promise((_0x3555e3,_0x24597d)=>{const _0x4f5590=a163_0x5419,_0x23cc8f=spawn('vite',[_0x4f5590(0x20a),_0x4f5590(0x202)],{'cwd':_0x47ee75,'stdio':_0x4f5590(0x1ef),'shell':!![],'env':{...process.env,'PATH':''+join(_0x47ee75,_0x4f5590(0x201),_0x4f5590(0x21b))+delimiter+process.env.PATH}});_0x23cc8f['on'](_0x4f5590(0x1f9),_0x18a157=>{const _0x2794d2=_0x4f5590;if(_0x18a157===0x0||_0x18a157===null)_0x3555e3();else _0x24597d(new Error(_0x2794d2(0x1f8)+_0x18a157));}),_0x23cc8f['on'](_0x4f5590(0x1f3),_0x24597d);});}function spawnVitePreview(_0x57a18d){return new Promise((_0x25ee0a,_0x4b635b)=>{const _0x391683=a163_0x5419,_0x3e755a=spawn('vite',[_0x391683(0x219)],{'cwd':_0x57a18d,'stdio':_0x391683(0x1ef),'shell':!![],'env':{...process.env,'PATH':''+join(_0x57a18d,_0x391683(0x201),_0x391683(0x21b))+delimiter+process.env.PATH}});_0x3e755a['on'](_0x391683(0x1f9),_0x23a25e=>{const _0x5928ae=_0x391683;if(_0x23a25e===0x0||_0x23a25e===null)_0x25ee0a();else _0x4b635b(new Error(_0x5928ae(0x1f4)+_0x23a25e));}),_0x3e755a['on']('error',_0x4b635b);});}const runFlags=[{'name':'watch','type':a163_0x18016e(0x1f7),'description':a163_0x18016e(0x228),'default':![]}];export const runDefinition={'service':a163_0x18016e(0x205),'command':a163_0x18016e(0x205),'description':'Run\x20a\x20package.json\x20script','risk':a163_0x18016e(0x1fc),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a163_0x18016e(0x1f2),'description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x47cc65=a163_0x18016e,_0x16ba76=[];return _0x16ba76[_0x47cc65(0x211)](_0x47cc65(0x22e)),_0x16ba76[_0x47cc65(0x211)](_0x47cc65(0x200)+CLI_BIN_NAME+_0x47cc65(0x226)),_0x16ba76[_0x47cc65(0x211)](_0x47cc65(0x200)+CLI_BIN_NAME+'\x20run\x20build'),_0x16ba76[_0x47cc65(0x211)](_0x47cc65(0x200)+CLI_BIN_NAME+_0x47cc65(0x217)),_0x16ba76['push'](_0x47cc65(0x200)+CLI_BIN_NAME+_0x47cc65(0x20f)),_0x16ba76[_0x47cc65(0x212)]('\x0a');},async 'execute'(_0x4f5a08){const _0x3d4d25=a163_0x18016e,_0x39377c=process[_0x3d4d25(0x218)](),_0x496a68=_0x4f5a08[_0x3d4d25(0x1f0)][0x0],_0x2ff955=_0x4f5a08['args']['slice'](0x1),_0x25761c=readPackageScripts(_0x39377c);if(!_0x25761c)throw CliErrors[_0x3d4d25(0x221)](_0x3d4d25(0x20d));if(!_0x496a68){const _0x2180eb=Object[_0x3d4d25(0x204)](_0x25761c);if(_0x2180eb[_0x3d4d25(0x22b)]===0x0)console[_0x3d4d25(0x220)](_0x3d4d25(0x214));else{console[_0x3d4d25(0x220)](_0x3d4d25(0x20b));for(const _0x434886 of _0x2180eb){console[_0x3d4d25(0x220)](_0x3d4d25(0x200)+_0x434886);}console[_0x3d4d25(0x220)](_0x3d4d25(0x1ff)+CLI_BIN_NAME+_0x3d4d25(0x1fa));}return{'ok':!![]};}if(!_0x25761c[_0x496a68])throw CliErrors[_0x3d4d25(0x221)](_0x3d4d25(0x22d)+_0x496a68+_0x3d4d25(0x1f5),_0x3d4d25(0x210)+(Object[_0x3d4d25(0x204)](_0x25761c)[_0x3d4d25(0x212)](',\x20')||_0x3d4d25(0x20e)));const _0x737142=detectPackageManager(_0x39377c);VERSION_CHECK_SCRIPTS[_0x3d4d25(0x21c)](_0x496a68)&&await versionCheck(_0x39377c);if(_0x496a68===_0x3d4d25(0x219)&&_0x4f5a08[_0x3d4d25(0x215)](_0x3d4d25(0x1fd)))return await Promise[_0x3d4d25(0x229)]([spawnViteBuildWatch(_0x39377c),spawnVitePreview(_0x39377c)]),{'ok':!![]};return await spawnScript(_0x737142,_0x496a68,_0x2ff955,_0x39377c),{'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
- function a164_0x2b16(){const _0x40640f=['2xtiJmx','262103BHgcIh','2175PXvOeG','json','read','16hcPKfa','27243yqYaWC','schema','6936589DJKJpu','49JGjMHO','2851641Edwnwq','206072fEtWlP','4625100WBbCIg','2304nlfapu'];a164_0x2b16=function(){return _0x40640f;};return a164_0x2b16();}function a164_0x42e4(_0x2a4c5f,_0x1f5c04){_0x2a4c5f=_0x2a4c5f-0x101;const _0x2b16e6=a164_0x2b16();let _0x42e473=_0x2b16e6[_0x2a4c5f];return _0x42e473;}const a164_0x15b9e5=a164_0x42e4;(function(_0x5050c4,_0x431574){const _0xf03f2f=a164_0x42e4,_0x58fefa=_0x5050c4();while(!![]){try{const _0x2b6bf1=parseInt(_0xf03f2f(0x105))/0x1*(parseInt(_0xf03f2f(0x104))/0x2)+-parseInt(_0xf03f2f(0x10a))/0x3*(-parseInt(_0xf03f2f(0x109))/0x4)+parseInt(_0xf03f2f(0x106))/0x5*(parseInt(_0xf03f2f(0x103))/0x6)+-parseInt(_0xf03f2f(0x10d))/0x7*(parseInt(_0xf03f2f(0x101))/0x8)+parseInt(_0xf03f2f(0x10e))/0x9+parseInt(_0xf03f2f(0x102))/0xa+-parseInt(_0xf03f2f(0x10c))/0xb;if(_0x2b6bf1===_0x431574)break;else _0x58fefa['push'](_0x58fefa['shift']());}catch(_0x3e87f1){_0x58fefa['push'](_0x58fefa['shift']());}}}(a164_0x2b16,0x69efa));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x101906){const _0xbe8f07=await buildSchemaPayload();return{'ok':!![],'data':_0xbe8f07};}export const schemaDefinition={'service':a164_0x15b9e5(0x10b),'command':'export','description':'Export\x20machine-readable\x20command\x20schema\x20(JSON)','risk':a164_0x15b9e5(0x108),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a164_0x15b9e5(0x107),'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_0x525a6c=a165_0x37e3;function a165_0x37e3(_0x331e17,_0x4490bf){_0x331e17=_0x331e17-0xe1;const _0x2fa7ba=a165_0x2fa7();let _0x37e35d=_0x2fa7ba[_0x331e17];return _0x37e35d;}(function(_0xc225ca,_0x50ffc8){const _0x218198=a165_0x37e3,_0x1fda7e=_0xc225ca();while(!![]){try{const _0x3c5707=-parseInt(_0x218198(0x112))/0x1*(parseInt(_0x218198(0x103))/0x2)+parseInt(_0x218198(0x102))/0x3+parseInt(_0x218198(0xe4))/0x4+-parseInt(_0x218198(0xfb))/0x5*(-parseInt(_0x218198(0x109))/0x6)+-parseInt(_0x218198(0x119))/0x7+parseInt(_0x218198(0xfa))/0x8+parseInt(_0x218198(0x121))/0x9*(-parseInt(_0x218198(0xf2))/0xa);if(_0x3c5707===_0x50ffc8)break;else _0x1fda7e['push'](_0x1fda7e['shift']());}catch(_0x289273){_0x1fda7e['push'](_0x1fda7e['shift']());}}}(a165_0x2fa7,0x7013f));import{writeFile}from'node:fs/promises';import{input,select}from'@inquirer/prompts';import{createSqlQuery}from'../../core/api-client.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a165_0x2fa7(){const _0x29252f=['File\x20already\x20exists:\x20','appCode','POST','3519Mskobg','SELECT\x201\x20AS\x20id;','Created\x20SQL\x20query\x20','nonInteractive','sqlCode','join','create','1811320pCvyri','length','sql','dbName','lockFilePath','Target\x20database\x20ID','high-risk-write','number','适合带动态标签的\x20MyBatis\x20XML\x20SQL','string','SQL\x20名称不能为空','trim','isFinite','parse','32830cVbjot','sqlRoot','isInteger','utf8','SQL\x20query\x20display\x20name','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','mode','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','6952480icMFkL','13685bARTeF','\x20\x20SELECT\x201\x20AS\x20id','new','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','dbId\x20必须为正整数','MyBatis\x20XML(mybatisXml)','2532465EJzOFf','8LgDQdx','请输入\x20SQL\x20名称:','flagMissing','__manual__','</select>','db-id','1578sfRPpI','description','sqlRootDir','dbId\x20不能为空','Invalid\x20database\x20selection\x20payload:\x20','stringify','name','Local\x20SQL\x20file\x20mode','validation','172961kEFOvq','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','catch','mybatisXml','sqlName','map','普通\x20SQL(sql)','3159156aDpdlf','请输入目标数据库\x20dbId:','str','dbId','✎\x20手动输入\x20dbId'];a165_0x2fa7=function(){return _0x29252f;};return a165_0x2fa7();}import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x17c861){const _0x27a50f=a165_0x37e3;if(_0x17c861===_0x27a50f(0x115))return[_0x27a50f(0xff),_0x27a50f(0xfc),_0x27a50f(0x107),'']['join']('\x0a');return[_0x27a50f(0x122),''][_0x27a50f(0xe2)]('\x0a');}export const sqlCreate={'service':'sql','command':a165_0x525a6c(0xe3),'description':a165_0x525a6c(0xf7),'risk':a165_0x525a6c(0xea),'flags':[{'name':a165_0x525a6c(0x10f),'type':a165_0x525a6c(0xed),'description':a165_0x525a6c(0xf6)},{'name':a165_0x525a6c(0x108),'type':a165_0x525a6c(0xeb),'description':a165_0x525a6c(0xe9)},{'name':a165_0x525a6c(0xf8),'type':'string','enum':[a165_0x525a6c(0xe6),a165_0x525a6c(0x115)],'description':a165_0x525a6c(0x110)}],async 'validate'(_0x4adad1){const _0x15c515=a165_0x525a6c;if(!_0x4adad1[_0x15c515(0x124)])return;if(!_0x4adad1[_0x15c515(0x11b)](_0x15c515(0x10f))[_0x15c515(0xef)]())throw CliErrors[_0x15c515(0x105)](_0x15c515(0x10f),_0x15c515(0xfe));const _0xcf9484=resolveProvidedDbId(_0x4adad1);if(typeof _0xcf9484!=='number'||!Number[_0x15c515(0xf0)](_0xcf9484)||_0xcf9484<=0x0)throw CliErrors[_0x15c515(0x105)](_0x15c515(0x108),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x4adad1[_0x15c515(0x11b)]('mode')[_0x15c515(0xef)]())throw CliErrors[_0x15c515(0x105)](_0x15c515(0xf8),_0x15c515(0x113));},async 'dryRun'(_0x49f5a6){const _0x58bc41=a165_0x525a6c,_0x1527e4=loadSqlProjectConfig(_0x49f5a6[_0x58bc41(0x11f)]),{sqlName:_0x43b50a,dbId:_0x14c8bf,dbName:_0x1a5f3e,mode:_0x29e4cf}=await resolveSqlNewInputs(_0x49f5a6),_0x20e903=buildSqlRelativePath('<server-generated-sqlCode>',_0x43b50a,_0x1a5f3e,_0x29e4cf,_0x14c8bf),_0x11d30c=_0x1527e4[_0x58bc41(0x10b)]+'/'+_0x20e903;return{'method':_0x58bc41(0x120),'url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x49f5a6[_0x58bc41(0x11f)],'sqlName':_0x43b50a,'dbId':_0x14c8bf,'mode':_0x29e4cf,'localPath':_0x11d30c},'description':_0x58bc41(0xf9)+_0x1527e4['sqlRootDir']};},async 'execute'(_0x3802de){const _0x276539=a165_0x525a6c,_0xa5bce8=loadSqlProjectConfig(_0x3802de[_0x276539(0x11f)]),{sqlName:_0x1896ec,dbId:_0x89e802,dbName:_0x181536,mode:_0x533e0b}=await resolveSqlNewInputs(_0x3802de),_0xec1fff=generateSqlTemplate(_0x533e0b),_0x4d5c14=await createSqlQuery({'appCode':_0x3802de['appCode'],'sqlName':_0x1896ec,'dbId':_0x89e802,'sqlContent':_0xec1fff}),_0x375d23=ensureRemoteSqlContent(_0x4d5c14),_0xdd775c=_0x181536||await getDbName(_0x3802de[_0x276539(0x11f)],_0x89e802)[_0x276539(0x114)](()=>undefined),_0x3a28f9=buildSqlRelativePath(_0x4d5c14['sqlCode'],_0x4d5c14['sqlName'],_0xdd775c,_0x533e0b,_0x89e802),_0x2429b5=_0xa5bce8[_0x276539(0x10b)]+'/'+_0x3a28f9,_0x22b730=buildLocalSqlFileContent({'sqlCode':_0x4d5c14[_0x276539(0xe1)],'sqlName':_0x4d5c14[_0x276539(0x116)],'dbId':_0x4d5c14[_0x276539(0x11c)]},_0x375d23,{'dbName':_0xdd775c,'mode':_0x533e0b,'syncedAt':new Date()['toISOString'](),'description':_0x4d5c14[_0x276539(0x10a)]});if(await fileExists(_0x2429b5))throw CliErrors[_0x276539(0x111)](_0x276539(0x11e)+_0x2429b5);await ensureParentDirectory(_0x2429b5),await writeFile(_0x2429b5,_0x22b730,_0x276539(0xf5));const _0x1a5163=await readSqlLockFile(_0xa5bce8[_0x276539(0xe8)]),{lockData:_0x1d84f3,appLock:_0x14db5}=ensureSqlLockScope(_0x1a5163??createEmptySqlLock(),_0xa5bce8['appCode'],_0xa5bce8[_0x276539(0xf3)],_0x276539(0xfd));return _0x14db5['sqls'][_0x4d5c14[_0x276539(0xe1)]]={...buildSqlLockEntry(_0x4d5c14,_0x375d23,computeSqlContentHash(_0x22b730),{'dbName':_0xdd775c}),'path':_0x3a28f9,'mode':_0x533e0b},_0x14db5['lastSync']=new Date()['toISOString'](),await writeSqlLockFile(_0xa5bce8[_0x276539(0xe8)],_0x1d84f3),{'ok':!![],'data':{'id':_0x4d5c14['id'],'sqlCode':_0x4d5c14[_0x276539(0xe1)],'sqlName':_0x4d5c14[_0x276539(0x116)],'dbId':_0x4d5c14['dbId'],'path':_0x2429b5,'mode':_0x533e0b},'message':_0x276539(0x123)+_0x4d5c14[_0x276539(0xe1)]};}};async function resolveSqlNewInputs(_0x43e8eb){const _0x1fe370=await resolveSqlNameInput(_0x43e8eb),{dbId:_0xec5e16,dbName:_0x4ea4ba}=await resolveDbSelection(_0x43e8eb),_0x49bc0d=await resolveSqlModeInput(_0x43e8eb);return{'sqlName':_0x1fe370,'dbId':_0xec5e16,'dbName':_0x4ea4ba,'mode':_0x49bc0d};}async function resolveSqlNameInput(_0x257e69){const _0x547fc4=a165_0x525a6c,_0x1c3e75=_0x257e69[_0x547fc4(0x11b)](_0x547fc4(0x10f))[_0x547fc4(0xef)]();if(_0x1c3e75)return _0x1c3e75;if(_0x257e69[_0x547fc4(0x124)])throw CliErrors['flagMissing']('name',_0x547fc4(0xfe));return(await input({'message':_0x547fc4(0x104),'validate':_0x5c3a01=>_0x5c3a01[_0x547fc4(0xef)]()?!![]:_0x547fc4(0xee)}))[_0x547fc4(0xef)]();}async function resolveDbSelection(_0x2ba09f){const _0x369e29=a165_0x525a6c,_0x1d3827=resolveProvidedDbId(_0x2ba09f);if(typeof _0x1d3827===_0x369e29(0xeb)&&Number[_0x369e29(0xf0)](_0x1d3827)&&_0x1d3827>0x0)return{'dbId':_0x1d3827,'dbName':await getDbName(_0x2ba09f[_0x369e29(0x11f)],_0x1d3827)[_0x369e29(0x114)](()=>undefined)};if(_0x2ba09f[_0x369e29(0x124)])throw CliErrors[_0x369e29(0x105)](_0x369e29(0x108),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x4007b0=await listDatabases(_0x2ba09f[_0x369e29(0x11f)])['catch'](()=>[]);if(_0x4007b0[_0x369e29(0xe5)]===0x1)return{'dbId':_0x4007b0[0x0][_0x369e29(0x11c)],'dbName':_0x4007b0[0x0][_0x369e29(0xe7)]};if(_0x4007b0[_0x369e29(0xe5)]>0x1){const _0x4c0a79=await select({'message':'请选择目标数据库:','choices':[..._0x4007b0[_0x369e29(0x117)](_0x570003=>({'name':_0x570003[_0x369e29(0xe7)]+'\x20('+_0x570003[_0x369e29(0x11c)]+')','value':serializeDbSelection(_0x570003)})),{'name':_0x369e29(0x11d),'value':_0x369e29(0x106)}]});if(_0x4c0a79!==_0x369e29(0x106))return deserializeDbSelection(_0x4c0a79);}const _0x25bd24=await input({'message':_0x369e29(0x11a),'validate':_0xe91219=>{const _0x33788a=_0x369e29,_0x5516dd=_0xe91219[_0x33788a(0xef)]();if(!_0x5516dd)return _0x33788a(0x10c);const _0x77452=Number(_0x5516dd);if(!Number[_0x33788a(0xf4)](_0x77452)||_0x77452<=0x0)return _0x33788a(0x100);return!![];}});return{'dbId':Number(_0x25bd24[_0x369e29(0xef)]())};}async function resolveSqlModeInput(_0x2273c6){const _0x103f4a=a165_0x525a6c,_0x46c9a7=_0x2273c6['str'](_0x103f4a(0xf8))[_0x103f4a(0xef)]();if(_0x46c9a7===_0x103f4a(0xe6)||_0x46c9a7===_0x103f4a(0x115))return _0x46c9a7;if(_0x2273c6['nonInteractive'])throw CliErrors[_0x103f4a(0x105)](_0x103f4a(0xf8),_0x103f4a(0x113));return await select({'message':'请选择本地\x20SQL\x20模式:','choices':[{'name':_0x103f4a(0x118),'value':_0x103f4a(0xe6),'description':'适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句'},{'name':_0x103f4a(0x101),'value':_0x103f4a(0x115),'description':_0x103f4a(0xec)}]});}function serializeDbSelection(_0x120274){const _0x44161e=a165_0x525a6c;return JSON[_0x44161e(0x10e)]({'dbId':_0x120274[_0x44161e(0x11c)],'dbName':_0x120274[_0x44161e(0xe7)]});}function deserializeDbSelection(_0x1e6d60){const _0x13aaa7=a165_0x525a6c;try{const _0x406021=JSON[_0x13aaa7(0xf1)](_0x1e6d60);if(typeof _0x406021[_0x13aaa7(0x11c)]==='number'&&Number['isFinite'](_0x406021['dbId']))return{'dbId':_0x406021['dbId'],'dbName':_0x406021['dbName']};}catch{}throw CliErrors[_0x13aaa7(0x111)](_0x13aaa7(0x10d)+_0x1e6d60);}function resolveProvidedDbId(_0x55bd17){const _0x553e14=a165_0x525a6c,_0x656b6b=_0x55bd17['flag']('db-id');if(typeof _0x656b6b===_0x553e14(0xeb)&&Number[_0x553e14(0xf0)](_0x656b6b))return _0x656b6b;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_0x483393=a166_0x56f6;(function(_0x201287,_0x16bae8){const _0x405edf=a166_0x56f6,_0x439243=_0x201287();while(!![]){try{const _0x183c1d=parseInt(_0x405edf(0x83))/0x1*(parseInt(_0x405edf(0x92))/0x2)+parseInt(_0x405edf(0x9d))/0x3+-parseInt(_0x405edf(0x82))/0x4+parseInt(_0x405edf(0x8c))/0x5+parseInt(_0x405edf(0x95))/0x6*(-parseInt(_0x405edf(0x84))/0x7)+parseInt(_0x405edf(0x7f))/0x8*(parseInt(_0x405edf(0x8d))/0x9)+-parseInt(_0x405edf(0x86))/0xa;if(_0x183c1d===_0x16bae8)break;else _0x439243['push'](_0x439243['shift']());}catch(_0x9c8b){_0x439243['push'](_0x439243['shift']());}}}(a166_0x3494,0xb5fc9));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';function a166_0x3494(){const _0x430db4=['POST','validation','Would\x20delete\x20SQL\x20','/smartapi/custom/deleteUserCustomSql','4402794vxWsSb','projectRoot','str','toISOString','fromEntries','sqlcode','520dOwynR','sqlRootDir','lockFilePath','95620pCvLKA','1426213uJdAJR','798qgwLsu','trashDir','29444010QllZud','sql','high-risk-write','sqlRoot','appCode','startsWith','2067670fLrnCj','60498HlKzCd','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','remoteId','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','filter','2XmAOir','\x20(local\x20file\x20moved\x20to\x20trash)','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','1608zXMDcM','delete','length','sqls'];a166_0x3494=function(){return _0x430db4;};return a166_0x3494();}function a166_0x56f6(_0x558a3b,_0x104010){_0x558a3b=_0x558a3b-0x7f;const _0x3494c1=a166_0x3494();let _0x56f64b=_0x3494c1[_0x558a3b];return _0x56f64b;}import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a166_0x483393(0x87),'command':a166_0x483393(0x96),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a166_0x483393(0x88),'flags':[SQLCODE_FLAG],async 'validate'(_0x4e4147){const _0x458f3e=a166_0x483393,_0x4e13ed=loadSqlProjectConfig(_0x4e4147[_0x458f3e(0x8a)]),_0x4df216=await readSqlLockFile(_0x4e13ed['lockFilePath']);if(!_0x4df216)throw CliErrors[_0x458f3e(0x9a)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x256a16){const _0x43e148=a166_0x483393,_0x9f3034=loadSqlProjectConfig(_0x256a16[_0x43e148(0x8a)]),_0x563c98=await readSqlLockFile(_0x9f3034[_0x43e148(0x81)]);if(!_0x563c98)throw CliErrors['validation'](_0x43e148(0x94));const {appLock:_0x2f271d}=ensureSqlLockScope(_0x563c98,_0x256a16[_0x43e148(0x8a)],_0x9f3034[_0x43e148(0x89)],_0x43e148(0x96)),_0x35262d=_0x256a16[_0x43e148(0x9f)](_0x43e148(0xa2)),_0x212fe5=_0x2f271d[_0x43e148(0x98)][_0x35262d];if(!_0x212fe5)throw CliErrors['validation'](_0x43e148(0x8e)+_0x35262d+'\x22.');return{'method':_0x43e148(0x99),'url':_0x43e148(0x9c),'body':{'sqlCode':_0x35262d,'id':_0x212fe5[_0x43e148(0x8f)],'localPath':resolveLocalSqlFilePath(_0x9f3034,_0x35262d,_0x212fe5)},'description':_0x43e148(0x9b)+_0x35262d+_0x43e148(0x90)+_0x9f3034[_0x43e148(0x85)]};},async 'execute'(_0x696339){const _0x57d845=a166_0x483393,_0x269fdb=loadSqlProjectConfig(_0x696339[_0x57d845(0x8a)]),_0x2e28df=await readSqlLockFile(_0x269fdb[_0x57d845(0x81)]);if(!_0x2e28df)throw CliErrors[_0x57d845(0x9a)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x25ad0d,appLock:_0x5147e9}=ensureSqlLockScope(_0x2e28df,_0x696339[_0x57d845(0x8a)],_0x269fdb['sqlRoot'],_0x57d845(0x96)),_0x328f41=_0x696339[_0x57d845(0x9f)](_0x57d845(0xa2)),_0x448b8a=_0x5147e9[_0x57d845(0x98)][_0x328f41];if(!_0x448b8a)throw CliErrors['validation'](_0x57d845(0x8e)+_0x328f41+'\x22.');await deleteSqlQuery({'id':_0x448b8a[_0x57d845(0x8f)],'sqlCode':_0x328f41}),_0x5147e9['sqls']=Object[_0x57d845(0xa1)](Object['entries'](_0x5147e9['sqls'])[_0x57d845(0x91)](([_0x176e6b])=>_0x176e6b!==_0x328f41)),_0x5147e9['lastSync']=new Date()[_0x57d845(0xa0)](),await writeSqlLockFile(_0x269fdb[_0x57d845(0x81)],_0x25ad0d);const _0x190517=resolveLocalSqlFilePath(_0x269fdb,_0x328f41,_0x448b8a);let _0x5355b2;await fileExists(_0x190517)&&(_0x5355b2=await moveToTrash(_0x269fdb[_0x57d845(0x9e)],_0x269fdb[_0x57d845(0x85)],_0x190517),await cleanupEmptyDirectories(dirname(_0x190517),_0x269fdb[_0x57d845(0x80)]));const _0x56b12a={'deleted':_0x328f41,'remoteId':_0x448b8a['remoteId']};if(_0x5355b2)_0x56b12a['trashedTo']=_0x5355b2;return{'ok':!![],'data':_0x56b12a,'message':'Deleted\x20'+_0x328f41+(_0x5355b2?_0x57d845(0x93):'')};}};async function moveToTrash(_0x347c7c,_0xd3c6ba,_0x209af5){const _0x5402f1=a166_0x483393,_0x4cfb98=new Date()[_0x5402f1(0xa0)]()['replace'](/[:.]/g,'-'),_0x519358=relative(_0x347c7c,_0x209af5),_0x34b5ae=join(_0xd3c6ba,_0x4cfb98,_0x519358);return await mkdir(dirname(_0x34b5ae),{'recursive':!![]}),await rename(_0x209af5,_0x34b5ae),_0x34b5ae;}async function cleanupEmptyDirectories(_0x3e30b5,_0x1b678c){const _0x11d414=a166_0x483393;let _0x1f5e51=resolve(_0x3e30b5);const _0x5c1a63=resolve(_0x1b678c);while(_0x1f5e51[_0x11d414(0x8b)](''+_0x5c1a63+sep)||_0x1f5e51===_0x5c1a63){if(_0x1f5e51===_0x5c1a63)return;try{const _0x1f0307=await readdir(_0x1f5e51);if(_0x1f0307[_0x11d414(0x97)]>0x0)return;await rmdir(_0x1f5e51);}catch{return;}_0x1f5e51=dirname(_0x1f5e51);}}
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_0x255dbe=a167_0x14e9;(function(_0x108abf,_0x1a2b76){const _0x2e2b71=a167_0x14e9,_0x3f51a1=_0x108abf();while(!![]){try{const _0x24522f=-parseInt(_0x2e2b71(0x12d))/0x1*(parseInt(_0x2e2b71(0x132))/0x2)+parseInt(_0x2e2b71(0x123))/0x3+parseInt(_0x2e2b71(0x126))/0x4+-parseInt(_0x2e2b71(0x138))/0x5+-parseInt(_0x2e2b71(0x137))/0x6*(-parseInt(_0x2e2b71(0x12b))/0x7)+parseInt(_0x2e2b71(0x129))/0x8+parseInt(_0x2e2b71(0x131))/0x9*(-parseInt(_0x2e2b71(0x136))/0xa);if(_0x24522f===_0x1a2b76)break;else _0x3f51a1['push'](_0x3f51a1['shift']());}catch(_0x545f8f){_0x3f51a1['push'](_0x3f51a1['shift']());}}}(a167_0x51d9,0x4b656));import{getSqlQueryInfo}from'../../core/api-client.js';function a167_0x51d9(){const _0x26d10a=['40tMHTuR','bool','sql','verbose','170wjzRtA','6hlfdsd','1024940oMnMBc','boolean','dbId','311880vnLbnO','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','sqlCode','1780776zhqBrD','read','sqlcode','4335808MSZITm','appCode','1172514lOnzNZ','sqlName','11532YOQTCl','Return\x20full\x20raw\x20SQL\x20query\x20object','detail','str','272214WcXwPz'];a167_0x51d9=function(){return _0x26d10a;};return a167_0x51d9();}import{getDbName}from'../../core/db-resolver.js';function a167_0x14e9(_0x4bc759,_0xb9652e){_0x4bc759=_0x4bc759-0x121;const _0x51d969=a167_0x51d9();let _0x14e956=_0x51d969[_0x4bc759];return _0x14e956;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a167_0x255dbe(0x134),'command':a167_0x255dbe(0x12f),'description':a167_0x255dbe(0x124),'risk':a167_0x255dbe(0x127),'flags':[SQLCODE_FLAG,{'name':a167_0x255dbe(0x135),'type':a167_0x255dbe(0x121),'description':a167_0x255dbe(0x12e)}],async 'execute'(_0x435003){const _0x4a9b2e=a167_0x255dbe,_0x51c8f5=await getSqlQueryInfo(_0x435003[_0x4a9b2e(0x12a)],_0x435003[_0x4a9b2e(0x130)](_0x4a9b2e(0x128))),_0x54bb9c=_0x435003[_0x4a9b2e(0x133)](_0x4a9b2e(0x135));if(_0x54bb9c)return{'ok':!![],'data':_0x51c8f5};const _0x1c1ee6=_0x51c8f5[_0x4a9b2e(0x122)]?await getDbName(_0x435003['appCode'],_0x51c8f5[_0x4a9b2e(0x122)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x51c8f5[_0x4a9b2e(0x125)],'sqlName':_0x51c8f5[_0x4a9b2e(0x12c)],'db':_0x1c1ee6?_0x1c1ee6+'\x20('+_0x51c8f5[_0x4a9b2e(0x122)]+')':_0x51c8f5[_0x4a9b2e(0x122)]??'','description':_0x51c8f5['description']??'','sqlContent':_0x51c8f5['sqlContent']??''}};}};
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
- const a168_0x3f7088=a168_0x1f8e;(function(_0x39a453,_0x1e7278){const _0x1c2095=a168_0x1f8e,_0x1b2cf4=_0x39a453();while(!![]){try{const _0x19765d=parseInt(_0x1c2095(0x78))/0x1+-parseInt(_0x1c2095(0x86))/0x2*(parseInt(_0x1c2095(0x8b))/0x3)+parseInt(_0x1c2095(0x73))/0x4*(parseInt(_0x1c2095(0x87))/0x5)+parseInt(_0x1c2095(0x72))/0x6*(parseInt(_0x1c2095(0x75))/0x7)+-parseInt(_0x1c2095(0x81))/0x8*(-parseInt(_0x1c2095(0x71))/0x9)+parseInt(_0x1c2095(0x77))/0xa+-parseInt(_0x1c2095(0x7c))/0xb;if(_0x19765d===_0x1e7278)break;else _0x1b2cf4['push'](_0x1b2cf4['shift']());}catch(_0x16665c){_0x1b2cf4['push'](_0x1b2cf4['shift']());}}}(a168_0xfd37,0xc00fb));import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';function a168_0x1f8e(_0x307508,_0x271f7){_0x307508=_0x307508-0x71;const _0xfd3738=a168_0xfd37();let _0x1f8e7a=_0xfd3738[_0x307508];return _0x1f8e7a;}export const sqlExec={'service':a168_0x3f7088(0x7b),'command':'exec','description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a168_0x3f7088(0x82),'flags':[SQLCODE_FLAG,{'name':a168_0x3f7088(0x85),'type':a168_0x3f7088(0x76),'description':a168_0x3f7088(0x80)}],async 'execute'(_0x40517f){const _0x187ec7=a168_0x3f7088,_0x30cc81=parseJsonParams(_0x40517f[_0x187ec7(0x7d)](_0x187ec7(0x85))),_0x4cbfcc=Date['now'](),_0x2c510f=await executeSql(_0x40517f[_0x187ec7(0x84)],_0x40517f[_0x187ec7(0x7d)](_0x187ec7(0x79)),_0x30cc81),_0x31a20f=Date[_0x187ec7(0x7a)]()-_0x4cbfcc,_0x12f9c3=_0x2c510f?.[_0x187ec7(0x83)]??_0x2c510f,_0x42007a=_0x2c510f?.[_0x187ec7(0x7e)]??!![];if(!_0x42007a)return{'ok':![],'data':{'error':_0x2c510f?.[_0x187ec7(0x74)]||'SQL\x20execution\x20failed','elapsed':_0x31a20f},'message':_0x187ec7(0x89)};const _0x53d177=Array['isArray'](_0x12f9c3)?_0x12f9c3:[];return{'ok':!![],'data':{'rows':_0x53d177,'rowCount':_0x53d177[_0x187ec7(0x8a)],'elapsed':_0x31a20f},'message':_0x187ec7(0x7f)+_0x53d177[_0x187ec7(0x8a)]+_0x187ec7(0x88)+_0x31a20f+'ms'};}};function a168_0xfd37(){const _0x8767c3=['params','2rovsLj','15wmXNds','\x20row(s)\x20in\x20','SQL\x20execution\x20failed','length','629544sPxwpg','26469TeDfnI','111156ddmmIa','1279288xmjVTF','execError','252qEnzyc','string','4347170lHGflC','590107SeLugt','sqlcode','now','sql','29395091mMqSqr','str','execSuccess','Returned\x20','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','2768HkjjCp','read','execResult','appCode'];a168_0xfd37=function(){return _0x8767c3;};return a168_0xfd37();}
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(_0x55bfcd,_0x1a206e){const _0x27b07a=a169_0x318f,_0x137de2=_0x55bfcd();while(!![]){try{const _0xa37788=-parseInt(_0x27b07a(0x1eb))/0x1*(parseInt(_0x27b07a(0x1ea))/0x2)+parseInt(_0x27b07a(0x1ee))/0x3+parseInt(_0x27b07a(0x1ed))/0x4*(-parseInt(_0x27b07a(0x1e9))/0x5)+parseInt(_0x27b07a(0x1e7))/0x6+parseInt(_0x27b07a(0x1ec))/0x7*(-parseInt(_0x27b07a(0x1e4))/0x8)+parseInt(_0x27b07a(0x1e8))/0x9+-parseInt(_0x27b07a(0x1e6))/0xa*(-parseInt(_0x27b07a(0x1e5))/0xb);if(_0xa37788===_0x1a206e)break;else _0x137de2['push'](_0x137de2['shift']());}catch(_0x39ec1c){_0x137de2['push'](_0x137de2['shift']());}}}(a169_0x54e2,0x5f5b3));import{sqlList}from'../../commands/sql/list.js';function a169_0x54e2(){const _0x23094e=['2362248fCeTdA','6921135hTvaBF','1385SuckGz','2dKfPUl','424823JEjjsT','7pRaRKv','5876yQjhgM','1025625Rusgbe','6066344ASNxKN','193930zaVkZx','270JMcwLI'];a169_0x54e2=function(){return _0x23094e;};return a169_0x54e2();}import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlSave}from'../../commands/sql/save.js';function a169_0x318f(_0x1b35fd,_0x33b001){_0x1b35fd=_0x1b35fd-0x1e4;const _0x54e277=a169_0x54e2();let _0x318fea=_0x54e277[_0x1b35fd];return _0x318fea;}import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';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_0xc3cca4=a170_0x3165;(function(_0x43c94c,_0xe48048){const _0x592ec6=a170_0x3165,_0x570bba=_0x43c94c();while(!![]){try{const _0x4fe84a=parseInt(_0x592ec6(0x1a2))/0x1*(-parseInt(_0x592ec6(0x18d))/0x2)+parseInt(_0x592ec6(0x196))/0x3*(parseInt(_0x592ec6(0x182))/0x4)+-parseInt(_0x592ec6(0x1a7))/0x5+-parseInt(_0x592ec6(0x186))/0x6+-parseInt(_0x592ec6(0x1a6))/0x7*(parseInt(_0x592ec6(0x18a))/0x8)+parseInt(_0x592ec6(0x191))/0x9*(parseInt(_0x592ec6(0x197))/0xa)+parseInt(_0x592ec6(0x184))/0xb*(parseInt(_0x592ec6(0x19f))/0xc);if(_0x4fe84a===_0xe48048)break;else _0x570bba['push'](_0x570bba['shift']());}catch(_0x504003){_0x570bba['push'](_0x570bba['shift']());}}}(a170_0x1168,0xc6eb6));import{listSqlQueries}from'../../core/api-client.js';function a170_0x3165(_0x4fd679,_0x17869f){_0x4fd679=_0x4fd679-0x182;const _0x116811=a170_0x1168();let _0x316556=_0x116811[_0x4fd679];return _0x316556;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a170_0x1168(){const _0x40adf2=['4101PekcmY','10XcTHUl','description','pagesize','dbId','map','Page\x20size','paging','tableData','60iAwNQP','sqlcode','number','20762RIApfQ','sql','bool','page','1981441evKsGv','6960400BbIHOO','boolean','num','932GivDzY','str','1570382aDVyhR','Filter\x20by\x20SQL\x20name','29994AYEwYu','appCode','List\x20custom\x20SQL\x20queries','length','8RiwoKv','totalCount','No\x20custom\x20SQL\x20queries\x20found.','2kikoDx','name','read','Found\x20','13350213WiZjRI','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','all','\x20SQL\x20queries\x20(total:\x20','list'];a170_0x1168=function(){return _0x40adf2;};return a170_0x1168();}export const sqlList={'service':a170_0xc3cca4(0x1a3),'command':a170_0xc3cca4(0x195),'description':a170_0xc3cca4(0x188),'risk':a170_0xc3cca4(0x18f),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a170_0xc3cca4(0x18e),'type':'string','description':a170_0xc3cca4(0x185)},{'name':a170_0xc3cca4(0x1a5),'type':a170_0xc3cca4(0x1a1),'description':'Page\x20number','default':0x1},{'name':a170_0xc3cca4(0x199),'type':'number','description':a170_0xc3cca4(0x19c)},{'name':'verbose','type':a170_0xc3cca4(0x1a8),'description':a170_0xc3cca4(0x192)}],async 'execute'(_0x12a064){const _0x2107f1=a170_0xc3cca4,_0x4162fe=await listSqlQueries(_0x12a064[_0x2107f1(0x187)],{'sqlCode':_0x12a064[_0x2107f1(0x183)](_0x2107f1(0x1a0))||undefined,'sqlName':_0x12a064[_0x2107f1(0x183)](_0x2107f1(0x18e))||undefined,'currentPage':_0x12a064[_0x2107f1(0x1a9)](_0x2107f1(0x1a5)),'pageSize':_0x12a064['num'](_0x2107f1(0x199),0x32)}),_0x40acae=_0x12a064[_0x2107f1(0x1a4)]('verbose'),_0x3d1d87=_0x4162fe[_0x2107f1(0x19e)]??[],_0x133633=_0x4162fe[_0x2107f1(0x19d)]?.[_0x2107f1(0x18b)]??_0x3d1d87[_0x2107f1(0x189)];let _0x259210;return _0x40acae?_0x259210=_0x3d1d87:_0x259210=await Promise[_0x2107f1(0x193)](_0x3d1d87[_0x2107f1(0x19b)](async _0x5009a8=>{const _0xb9ee36=_0x2107f1;let _0x361257;try{_0x361257=_0x5009a8['dbId']?await getDbName(_0x12a064[_0xb9ee36(0x187)],_0x5009a8[_0xb9ee36(0x19a)]):undefined;}catch{}return{'sqlCode':_0x5009a8['sqlCode'],'sqlName':_0x5009a8['sqlName'],'description':_0x5009a8[_0xb9ee36(0x198)]??'','db':_0x361257?_0x361257+'\x20('+_0x5009a8[_0xb9ee36(0x19a)]+')':_0x5009a8[_0xb9ee36(0x19a)]??''};})),{'ok':!![],'data':_0x259210,'message':_0x3d1d87['length']===0x0?_0x2107f1(0x18c):_0x2107f1(0x190)+_0x3d1d87[_0x2107f1(0x189)]+_0x2107f1(0x194)+_0x133633+').'};}};
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_0x21510c=a171_0x42a9;(function(_0x2c773d,_0xee39b0){const _0x168d05=a171_0x42a9,_0x1f344f=_0x2c773d();while(!![]){try{const _0x5174f2=parseInt(_0x168d05(0x108))/0x1+-parseInt(_0x168d05(0x101))/0x2*(-parseInt(_0x168d05(0x133))/0x3)+-parseInt(_0x168d05(0x106))/0x4*(-parseInt(_0x168d05(0x122))/0x5)+parseInt(_0x168d05(0x125))/0x6*(parseInt(_0x168d05(0x13c))/0x7)+-parseInt(_0x168d05(0x11e))/0x8+parseInt(_0x168d05(0x12d))/0x9+-parseInt(_0x168d05(0x11b))/0xa;if(_0x5174f2===_0xee39b0)break;else _0x1f344f['push'](_0x1f344f['shift']());}catch(_0x1f4d51){_0x1f344f['push'](_0x1f344f['shift']());}}}(a171_0x4622,0x7d3f1));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';function a171_0x4622(){const _0x535528=['string','515163BilkXb','apps','mybatisXml','\x20SQL\x20file(s)\x20into\x20','totalCount','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','description','would_pull','bool','No\x20remote\x20SQL\x20queries\x20matched.','appCode','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqls','paging','conflict','toISOString','dbId','sql','sqlcode','11290500GmEbLf','sqlRootDir','length','3569808nlxXrt','push','lockFilePath','Force\x20pull\x20cancelled.','150460OkfCNy','nonInteractive','name','24wshUHg','sqlCode','tableData','utf8','\x20skipped,\x20','sqlName','test','Filter\x20by\x20SQL\x20display\x20name','1132299BgWYVr','sqlRoot','message','POST','join','force','3EhIMQw','cancelled','catch','filter','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','replace','unchanged','split','\x20written,\x20','979391TXUEbX','Pull\x20complete:\x20','str','\x20failed','391086uzsvNd','sqlContent','lastSync','path','boolean','92QLAaLx'];a171_0x4622=function(){return _0x535528;};return a171_0x4622();}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(_0x7b7f5a,_0xb129f6){const _0x520295=a171_0x42a9,_0x466c04=[];let _0x4e423c=0x1;while(!![]){const _0x3971c8=await listSqlQueries(_0x7b7f5a,{'currentPage':_0x4e423c,'pageSize':PAGE_SIZE,'sqlCode':_0xb129f6[_0x520295(0x126)],'sqlName':_0xb129f6[_0x520295(0x12a)]}),_0x6c842=_0x3971c8[_0x520295(0x127)]??[];_0x466c04[_0x520295(0x11f)](..._0x6c842);if(_0x6c842[_0x520295(0x11d)]===0x0)break;const _0x543855=_0x3971c8[_0x520295(0x115)]?.[_0x520295(0x10c)];if(_0x543855!=null?_0x466c04['length']>=_0x543855:_0x6c842[_0x520295(0x11d)]<PAGE_SIZE)break;_0x4e423c++;}return _0x466c04;}async function ensureSqlContent(_0x5d738c){const _0x2d4933=a171_0x42a9;if(_0x5d738c['sqlContent']!=null&&String(_0x5d738c[_0x2d4933(0x102)])[_0x2d4933(0x11d)]>0x0)return _0x5d738c;return getSqlQueryDetail(_0x5d738c['sqlCode']);}function a171_0x42a9(_0x35521b,_0x59ae5c){_0x35521b=_0x35521b-0xff;const _0x46221f=a171_0x4622();let _0x42a9f9=_0x46221f[_0x35521b];return _0x42a9f9;}export const sqlPull={'service':a171_0x21510c(0x119),'command':'pull','description':a171_0x21510c(0x113),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a171_0x21510c(0x124),'type':a171_0x21510c(0x107),'description':a171_0x21510c(0x12c)},{'name':'force','type':a171_0x21510c(0x105),'description':'Force\x20overwrite\x20local\x20unsynced\x20changes'}],async 'dryRun'(_0x29dd6a){const _0x526514=a171_0x21510c,_0x2f804a=loadSqlProjectConfig(_0x29dd6a[_0x526514(0x112)]),_0x53ca3e=await readSqlLockFile(_0x2f804a['lockFilePath']),{appLock:_0x51c9cb}=ensureSqlLockScope(_0x53ca3e??createEmptySqlLock(),_0x2f804a[_0x526514(0x112)],_0x2f804a[_0x526514(0x12e)],'pull'),_0x3c21d4=await fetchAllSqlQueries(_0x29dd6a[_0x526514(0x112)],{'sqlCode':_0x29dd6a['str'](_0x526514(0x11a))||undefined,'sqlName':_0x29dd6a[_0x526514(0xff)](_0x526514(0x124))||undefined}),_0x3c6ad8=[];for(const _0x5d05f5 of _0x3c21d4){const _0x17c0ad=await ensureSqlContent(_0x5d05f5),_0x2a94ce=ensureRemoteSqlContent(_0x17c0ad),_0x3fead7=detectModeFromSql(_0x17c0ad),_0x1301c0=_0x17c0ad[_0x526514(0x118)]?await getDbName(_0x29dd6a[_0x526514(0x112)],Number(_0x17c0ad[_0x526514(0x118)]))[_0x526514(0x135)](()=>undefined):undefined,_0x1372a0=buildLocalSqlFileContent({'sqlCode':_0x17c0ad[_0x526514(0x126)],'sqlName':_0x17c0ad[_0x526514(0x12a)],'dbId':_0x17c0ad[_0x526514(0x118)]},_0x2a94ce,{'dbName':_0x1301c0,'mode':_0x3fead7,'syncedAt':new Date()['toISOString'](),'description':_0x17c0ad['description']}),_0x4992c5=buildSqlLockEntry(_0x17c0ad,_0x2a94ce,'',{'dbName':_0x1301c0}),_0x417895=resolveLocalSqlFilePath(_0x2f804a,_0x17c0ad[_0x526514(0x126)],_0x4992c5);let _0x2e3d3d=_0x526514(0x10f),_0x2604e0;if(await fileExists(_0x417895)){const _0x50a9a1=await readFile(_0x417895,_0x526514(0x128));isEquivalentPulledSqlFile(_0x50a9a1,_0x1372a0,_0x3fead7)?(_0x2e3d3d='skipped',_0x2604e0='unchanged'):(_0x2e3d3d=_0x526514(0x116),_0x2604e0=_0x526514(0x10d));}_0x3c6ad8[_0x526514(0x11f)]({'sqlCode':_0x17c0ad[_0x526514(0x126)],'sqlName':_0x17c0ad[_0x526514(0x12a)],'filePath':_0x417895,'status':_0x2e3d3d,'reason':_0x2604e0});}return{'method':_0x526514(0x130),'url':'/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','body':{'appCode':_0x29dd6a[_0x526514(0x112)],'sqlCode':_0x29dd6a[_0x526514(0xff)](_0x526514(0x11a))||null,'sqlName':_0x29dd6a[_0x526514(0xff)](_0x526514(0x124))||null,'files':_0x3c6ad8},'description':'Would\x20pull\x20'+_0x3c6ad8[_0x526514(0x11d)]+_0x526514(0x10b)+_0x2f804a[_0x526514(0x11c)]};},async 'execute'(_0x526c5b){const _0x28a7bf=a171_0x21510c,_0x1b32ef=loadSqlProjectConfig(_0x526c5b[_0x28a7bf(0x112)]),_0x243215=await readSqlLockFile(_0x1b32ef[_0x28a7bf(0x120)]),{lockData:_0x276e89,appLock:_0x222f42}=ensureSqlLockScope(_0x243215??createEmptySqlLock(),_0x1b32ef['appCode'],_0x1b32ef[_0x28a7bf(0x12e)],'pull'),_0x3a4f5d=_0x526c5b[_0x28a7bf(0x110)](_0x28a7bf(0x132)),_0xf38bec=await fetchAllSqlQueries(_0x526c5b['appCode'],{'sqlCode':_0x526c5b[_0x28a7bf(0xff)]('sqlcode')||undefined,'sqlName':_0x526c5b[_0x28a7bf(0xff)](_0x28a7bf(0x124))||undefined});if(_0xf38bec['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x28a7bf(0x111)};const _0x39d75b=[],_0x42c3c7=[];for(const _0x5734a8 of _0xf38bec){try{_0x39d75b[_0x28a7bf(0x11f)](await ensureSqlContent(_0x5734a8));}catch(_0xa65193){_0x42c3c7[_0x28a7bf(0x11f)]({'sqlCode':_0x5734a8[_0x28a7bf(0x126)],'error':_0xa65193 instanceof Error?_0xa65193[_0x28a7bf(0x12f)]:String(_0xa65193)});}}if(_0x3a4f5d&&!_0x526c5b[_0x28a7bf(0x123)]){let _0x16c74e=![];for(const _0x583147 of _0x39d75b){const _0x4be860=detectModeFromSql(_0x583147),_0x17fc38=_0x583147['dbId']?await getDbName(_0x526c5b['appCode'],Number(_0x583147['dbId']))[_0x28a7bf(0x135)](()=>undefined):undefined,_0x14e27b=buildLocalSqlFileContent({'sqlCode':_0x583147['sqlCode'],'sqlName':_0x583147['sqlName'],'dbId':_0x583147[_0x28a7bf(0x118)]},ensureRemoteSqlContent(_0x583147),{'dbName':_0x17fc38,'mode':_0x4be860,'syncedAt':new Date()[_0x28a7bf(0x117)](),'description':_0x583147['description']}),_0x2b3461=resolveLocalSqlFilePath(_0x1b32ef,_0x583147[_0x28a7bf(0x126)],buildSqlLockEntry(_0x583147,ensureRemoteSqlContent(_0x583147),'',{'dbName':_0x17fc38}));if(await fileExists(_0x2b3461)){const _0x363c78=await readFile(_0x2b3461,_0x28a7bf(0x128));if(!isEquivalentPulledSqlFile(_0x363c78,_0x14e27b,_0x4be860)){_0x16c74e=!![];break;}}}if(_0x16c74e){const _0x58817c=await confirmForceOverwrite(_0x28a7bf(0x137));if(!_0x58817c)throw CliErrors[_0x28a7bf(0x134)](_0x28a7bf(0x121));}}const _0x3e405c=cloneSqlLockData(_0x276e89),_0x2814d2=_0x3e405c[_0x28a7bf(0x109)][_0x1b32ef['appCode']],_0x5f2a17=[],_0x32e845=[];for(const _0x216e7a of _0x39d75b){const _0x4a408e=_0x2814d2[_0x28a7bf(0x114)][_0x216e7a[_0x28a7bf(0x126)]],_0x5813ec=ensureRemoteSqlContent(_0x216e7a),_0x282051=detectModeFromSql(_0x216e7a),_0x1fb912=_0x216e7a[_0x28a7bf(0x118)]?await getDbName(_0x526c5b[_0x28a7bf(0x112)],Number(_0x216e7a[_0x28a7bf(0x118)]))[_0x28a7bf(0x135)](()=>undefined):undefined,_0x39dfbe=buildLocalSqlFileContent({'sqlCode':_0x216e7a['sqlCode'],'sqlName':_0x216e7a[_0x28a7bf(0x12a)],'dbId':_0x216e7a[_0x28a7bf(0x118)]},_0x5813ec,{'dbName':_0x1fb912,'mode':_0x282051,'syncedAt':new Date()[_0x28a7bf(0x117)](),'description':_0x216e7a[_0x28a7bf(0x10e)]}),_0x474c45=buildSqlLockEntry(_0x216e7a,_0x5813ec,computeSqlContentHash(_0x39dfbe),{'dbName':_0x1fb912}),_0x361e24=_0x474c45[_0x28a7bf(0x104)],_0x2208e2=join(_0x1b32ef['sqlRootDir'],_0x361e24);try{if(await fileExists(_0x2208e2)){const _0x1c7ceb=await readFile(_0x2208e2,_0x28a7bf(0x128));if(isEquivalentPulledSqlFile(_0x1c7ceb,_0x39dfbe,_0x282051)){_0x32e845[_0x28a7bf(0x11f)]({'sqlCode':_0x216e7a['sqlCode'],'reason':_0x28a7bf(0x139)}),_0x2814d2[_0x28a7bf(0x114)][_0x216e7a[_0x28a7bf(0x126)]]={..._0x474c45,'hash':computeSqlContentHash(_0x1c7ceb),'path':_0x361e24};continue;}if(!_0x3a4f5d){_0x32e845[_0x28a7bf(0x11f)]({'sqlCode':_0x216e7a[_0x28a7bf(0x126)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0x1da3c=_0x4a408e?.[_0x28a7bf(0x104)]?join(_0x1b32ef[_0x28a7bf(0x11c)],_0x4a408e[_0x28a7bf(0x104)]):undefined;_0x1da3c&&_0x1da3c!==_0x2208e2&&await fileExists(_0x1da3c)&&await rm(_0x1da3c,{'force':!![]}),await ensureParentDirectory(_0x2208e2),await writeFile(_0x2208e2,_0x39dfbe,_0x28a7bf(0x128)),_0x2814d2[_0x28a7bf(0x114)][_0x216e7a[_0x28a7bf(0x126)]]={..._0x474c45,'path':_0x361e24},_0x5f2a17['push']({'sqlCode':_0x216e7a[_0x28a7bf(0x126)],'filePath':_0x2208e2});}catch(_0xc8b1c){_0x42c3c7[_0x28a7bf(0x11f)]({'sqlCode':_0x216e7a[_0x28a7bf(0x126)],'error':_0xc8b1c instanceof Error?_0xc8b1c['message']:String(_0xc8b1c)});}}return _0x2814d2[_0x28a7bf(0x103)]=new Date()[_0x28a7bf(0x117)](),await writeSqlLockFile(_0x1b32ef[_0x28a7bf(0x120)],_0x3e405c),{'ok':_0x42c3c7[_0x28a7bf(0x11d)]===0x0,'data':{'pulled':_0x5f2a17,'skipped':_0x32e845,'failed':_0x42c3c7},'message':_0x28a7bf(0x13d)+_0x5f2a17[_0x28a7bf(0x11d)]+_0x28a7bf(0x13b)+_0x32e845[_0x28a7bf(0x11d)]+_0x28a7bf(0x129)+_0x42c3c7[_0x28a7bf(0x11d)]+_0x28a7bf(0x100)};}};function detectModeFromSql(_0x2ac638){const _0x23d0c0=a171_0x21510c,_0x53aeb8=ensureRemoteSqlContent(_0x2ac638),_0x503525=stripLocalSqlMetadata(_0x53aeb8,_0x23d0c0(0x10a))['trimStart']();if(/^<(select|insert|update|delete)\b/i[_0x23d0c0(0x12b)](_0x503525))return'mybatisXml';return _0x23d0c0(0x119);}function isEquivalentPulledSqlFile(_0x20c840,_0x16c59e,_0x3615cf){return normalizePullComparableContent(_0x20c840,_0x3615cf)===normalizePullComparableContent(_0x16c59e,_0x3615cf);}function normalizePullComparableContent(_0x42fe98,_0x1af20e){const _0x50e89c=a171_0x21510c,_0x4d3ba7=_0x42fe98[_0x50e89c(0x138)](/\r\n/g,'\x0a')[_0x50e89c(0x13a)]('\x0a'),_0x2cc19c=_0x4d3ba7[_0x50e89c(0x136)](_0x74f792=>!isSyncedAtMetadataLine(_0x74f792,_0x1af20e));return _0x2cc19c[_0x50e89c(0x131)]('\x0a');}function isSyncedAtMetadataLine(_0x25553a,_0x407c1e){const _0x49b8a3=a171_0x21510c;if(_0x407c1e===_0x49b8a3(0x10a))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x49b8a3(0x12b)](_0x25553a);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x49b8a3(0x12b)](_0x25553a);}
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_0x398eb1=a172_0xf3b8;(function(_0x285433,_0x2fe65f){const _0x1f66a8=a172_0xf3b8,_0x404f09=_0x285433();while(!![]){try{const _0x254ae2=parseInt(_0x1f66a8(0x1f2))/0x1+-parseInt(_0x1f66a8(0x1f1))/0x2*(-parseInt(_0x1f66a8(0x20e))/0x3)+-parseInt(_0x1f66a8(0x1e9))/0x4+parseInt(_0x1f66a8(0x212))/0x5+-parseInt(_0x1f66a8(0x202))/0x6+parseInt(_0x1f66a8(0x1d7))/0x7*(-parseInt(_0x1f66a8(0x203))/0x8)+-parseInt(_0x1f66a8(0x1f5))/0x9*(parseInt(_0x1f66a8(0x201))/0xa);if(_0x254ae2===_0x2fe65f)break;else _0x404f09['push'](_0x404f09['shift']());}catch(_0x511930){_0x404f09['push'](_0x404f09['shift']());}}}(a172_0x1111,0x3cddd));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';function a172_0xf3b8(_0x39129b,_0x7517dd){_0x39129b=_0x39129b-0x1d6;const _0x111159=a172_0x1111();let _0xf3b8e4=_0x111159[_0x39129b];return _0xf3b8e4;}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(_0x1f8ed4,_0x55666b,_0x2869a7){const _0x159f3a=a172_0xf3b8,_0xe18ed6=await scanLocalSqlQueries(_0x1f8ed4),_0x267b04=new Map();for(const _0x54ee5c of _0xe18ed6){if(_0x2869a7&&_0x54ee5c[_0x159f3a(0x204)]!==_0x2869a7)continue;const _0x41ec11=_0x267b04['get'](_0x54ee5c['sqlCode'])??[];_0x41ec11[_0x159f3a(0x1e7)](_0x54ee5c),_0x267b04[_0x159f3a(0x1e2)](_0x54ee5c[_0x159f3a(0x204)],_0x41ec11);}if(_0x2869a7&&!_0x267b04[_0x159f3a(0x1eb)](_0x2869a7))throw CliErrors[_0x159f3a(0x205)](_0x159f3a(0x209)+_0x2869a7);const _0x40ee90=[];for(const [_0x5480b1,_0x493c5a]of _0x267b04['entries']()){if(_0x493c5a[_0x159f3a(0x1fc)]===0x1){_0x40ee90[_0x159f3a(0x1e7)](_0x493c5a[0x0]);continue;}const _0x5a107c=_0x55666b['sqls'][_0x5480b1],_0x4e6895=_0x5a107c?.[_0x159f3a(0x1ee)],_0xa92583=_0x4e6895?_0x493c5a[_0x159f3a(0x1ff)](_0x1f8ce6=>_0x1f8ce6[_0x159f3a(0x1ef)]!==_0x4e6895):_0x493c5a;if(_0x5a107c&&_0xa92583[_0x159f3a(0x1fc)]===0x1){_0x40ee90[_0x159f3a(0x1e7)](_0xa92583[0x0]);continue;}throw CliErrors[_0x159f3a(0x205)](_0x159f3a(0x215)+_0x5480b1+_0x159f3a(0x1e5));}return _0x40ee90;}function a172_0x1111(){const _0x406e2e=['hash','filter','\x22\x20for\x20sqlCode\x20','1135100mfsRpP','1212174ueQAmu','10232RaLIwo','sqlCode','validation','high-risk-write','trashDir','unchanged','Local\x20SQL\x20not\x20found:\x20','boolean','\x20skipped,\x20','force','str','25089MVrjeL','Would\x20push\x20','\x20pushed,\x20','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','1376575PBrKVu','startsWith','version','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','No\x20database\x20matches\x20local\x20directory\x20\x22','filePath','POST','sqlRootDir','1414YxCXBK','map','/smartapi/custom/updateUserCustomSql','isFinite','dbDirectory','lockFilePath','sqlcode','join','sql','sqlRoot','bool','set','exec','sqlName','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','dbName','push','mode','44964WDJFHT','sqlConfig','has','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','dbId','path','relativePath','sqls','62WAgiDD','413389Qkifsm','Local\x20directory\x20\x22','replace','18pyFOzh','remoteId','toISOString','appCode','projectRoot','\x20SQL\x20file(s)','message','length','catch'];a172_0x1111=function(){return _0x406e2e;};return a172_0x1111();}export const sqlPush={'service':a172_0x398eb1(0x1df),'command':'push','description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a172_0x398eb1(0x206),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':'force','type':a172_0x398eb1(0x20a),'description':'Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock'}],async 'dryRun'(_0x5d0ec1){const _0xb68e33=a172_0x398eb1,_0x1883b8=loadSqlProjectConfig(_0x5d0ec1[_0xb68e33(0x1f8)]),_0x364143=await readSqlLockFile(_0x1883b8[_0xb68e33(0x1dc)]),{appLock:_0xc7a42a}=ensureSqlLockScope(_0x364143??createEmptySqlLock(),_0x5d0ec1['appCode'],_0x1883b8[_0xb68e33(0x1e0)],_0xb68e33(0x1e7)),_0x15da49=await getTargetSqlQueries(_0x1883b8,_0xc7a42a,_0x5d0ec1[_0xb68e33(0x20d)](_0xb68e33(0x1dd))||undefined),_0x57d891=[];for(const _0x3f971a of _0x15da49){const _0x25976f=await computeSqlFileHash(_0x3f971a[_0xb68e33(0x217)]),_0x3d8118=_0xc7a42a['sqls'][_0x3f971a['sqlCode']],_0x1a3b58=!!_0x3d8118&&(_0x3d8118['path']!==_0x3f971a[_0xb68e33(0x1ef)]||!!_0x3f971a[_0xb68e33(0x1e4)]&&_0x3d8118[_0xb68e33(0x1e4)]!==_0x3f971a[_0xb68e33(0x1e4)]);if(!_0x5d0ec1[_0xb68e33(0x1e1)](_0xb68e33(0x20c))&&_0x3d8118&&_0x3d8118[_0xb68e33(0x1fe)]===_0x25976f&&!_0x1a3b58)continue;_0x57d891[_0xb68e33(0x1e7)](_0x3f971a[_0xb68e33(0x204)]);}return{'method':_0xb68e33(0x218),'url':_0xb68e33(0x1d9),'body':{'sqlCodes':_0x57d891,'appCode':_0x5d0ec1['appCode']},'description':_0xb68e33(0x20f)+_0x57d891[_0xb68e33(0x1fc)]+_0xb68e33(0x1fa)};},async 'execute'(_0x130d94){const _0x47ffbf=a172_0x398eb1,_0x139bf3=loadSqlProjectConfig(_0x130d94[_0x47ffbf(0x1f8)]),_0x64d7a3=await readSqlLockFile(_0x139bf3['lockFilePath']),{lockData:_0x3a01bc,appLock:_0x99e30}=ensureSqlLockScope(_0x64d7a3??createEmptySqlLock(),_0x130d94[_0x47ffbf(0x1f8)],_0x139bf3['sqlRoot'],_0x47ffbf(0x1e7)),_0x30503a=await getTargetSqlQueries(_0x139bf3,_0x99e30,_0x130d94[_0x47ffbf(0x20d)](_0x47ffbf(0x1dd))||undefined);if(_0x30503a[_0x47ffbf(0x1fc)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':'No\x20local\x20SQL\x20files\x20found.'};const _0x2e0b79=[],_0x3664da=[],_0x241bab=[];for(const _0x5e76af of _0x30503a){const _0x44e80b=_0x99e30[_0x47ffbf(0x1f0)][_0x5e76af['sqlCode']];if(!_0x44e80b){_0x241bab['push']({'sqlCode':_0x5e76af[_0x47ffbf(0x204)],'error':'local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first'});continue;}try{const _0x2ba81f=await computeSqlFileHash(_0x5e76af[_0x47ffbf(0x217)]),_0x28f4c6=_0x44e80b['path']!==_0x5e76af[_0x47ffbf(0x1ef)]||!!_0x5e76af[_0x47ffbf(0x1e4)]&&_0x44e80b[_0x47ffbf(0x1e4)]!==_0x5e76af[_0x47ffbf(0x1e4)];if(!_0x130d94[_0x47ffbf(0x1e1)](_0x47ffbf(0x20c))&&_0x44e80b[_0x47ffbf(0x1fe)]===_0x2ba81f&&!_0x28f4c6){_0x3664da['push']({'sqlCode':_0x5e76af['sqlCode'],'reason':_0x47ffbf(0x208)});continue;}if(_0x44e80b[_0x47ffbf(0x214)]==null){_0x241bab[_0x47ffbf(0x1e7)]({'sqlCode':_0x5e76af[_0x47ffbf(0x204)],'error':_0x47ffbf(0x1ec)});continue;}const _0x152235=await readFile(_0x5e76af[_0x47ffbf(0x217)],'utf8'),_0x5ad4af=stripLocalSqlMetadata(_0x152235,_0x5e76af[_0x47ffbf(0x1e8)]),_0x41e0bc=_0x5e76af[_0x47ffbf(0x1e4)]||_0x44e80b['sqlName'],_0x356c99=await resolveTargetDbBinding(_0x130d94[_0x47ffbf(0x1f8)],_0x5e76af,_0x44e80b),_0x35aab7=await updateSqlQuery({'id':_0x44e80b['remoteId'],'appCode':_0x130d94[_0x47ffbf(0x1f8)],'sqlCode':_0x5e76af['sqlCode'],'sqlName':_0x41e0bc,'dbId':_0x356c99[_0x47ffbf(0x1ed)],'version':_0x44e80b['version'],'sqlContent':_0x5ad4af,'sqlConfig':_0x44e80b[_0x47ffbf(0x1ea)]??undefined}),_0x1779c8=_0x35aab7[_0x47ffbf(0x1ed)]?await getDbName(_0x130d94[_0x47ffbf(0x1f8)],Number(_0x35aab7['dbId']))[_0x47ffbf(0x1fd)](()=>_0x356c99['dbName']):_0x356c99[_0x47ffbf(0x1e6)];_0x99e30[_0x47ffbf(0x1f0)][_0x5e76af[_0x47ffbf(0x204)]]={...buildSqlLockEntry(_0x35aab7,_0x5ad4af,_0x2ba81f,{'dbName':_0x1779c8}),'path':_0x5e76af['relativePath'],'mode':_0x44e80b['mode']},await archivePreviousSqlFileIfNeeded(_0x139bf3,_0x44e80b[_0x47ffbf(0x1ee)],_0x5e76af[_0x47ffbf(0x1ef)]),_0x2e0b79[_0x47ffbf(0x1e7)]({'sqlCode':_0x5e76af['sqlCode'],'remoteId':_0x44e80b[_0x47ffbf(0x1f6)]});}catch(_0x44dc83){_0x241bab[_0x47ffbf(0x1e7)]({'sqlCode':_0x5e76af['sqlCode'],'error':_0x44dc83 instanceof Error?_0x44dc83[_0x47ffbf(0x1fb)]:String(_0x44dc83)});}}return _0x99e30['lastSync']=new Date()[_0x47ffbf(0x1f7)](),await writeSqlLockFile(_0x139bf3['lockFilePath'],_0x3a01bc),{'ok':_0x241bab['length']===0x0,'data':{'pushed':_0x2e0b79,'skipped':_0x3664da,'failed':_0x241bab},'message':'Push\x20complete:\x20'+_0x2e0b79['length']+_0x47ffbf(0x210)+_0x3664da[_0x47ffbf(0x1fc)]+_0x47ffbf(0x20b)+_0x241bab[_0x47ffbf(0x1fc)]+'\x20failed'};}};async function archivePreviousSqlFileIfNeeded(_0x75980f,_0x17cfae,_0x18476c){const _0x2d2d42=a172_0x398eb1;if(!_0x17cfae||_0x17cfae===_0x18476c)return;const _0x4edfb0=join(_0x75980f[_0x2d2d42(0x1d6)],_0x17cfae);if(!await fileExists(_0x4edfb0))return;const _0x391943=await moveToTrash(_0x75980f[_0x2d2d42(0x1f9)],_0x75980f[_0x2d2d42(0x207)],_0x4edfb0);await cleanupEmptyDirectories(dirname(_0x4edfb0),_0x75980f['sqlRootDir']),void _0x391943;}async function moveToTrash(_0x4d8024,_0xfa7125,_0x3ac5e1){const _0x1e457c=a172_0x398eb1,_0x5ecea7=new Date()[_0x1e457c(0x1f7)]()[_0x1e457c(0x1f4)](/[:.]/g,'-'),_0x128f37=relative(_0x4d8024,_0x3ac5e1),_0x4c4867=join(_0xfa7125,_0x5ecea7,_0x128f37);return await mkdir(dirname(_0x4c4867),{'recursive':!![]}),await rename(_0x3ac5e1,_0x4c4867),_0x4c4867;}async function cleanupEmptyDirectories(_0xd60fd5,_0x2777e8){const _0x191ceb=a172_0x398eb1;let _0x5bb0f8=resolve(_0xd60fd5);const _0x22c7d2=resolve(_0x2777e8);while(_0x5bb0f8[_0x191ceb(0x213)](''+_0x22c7d2+sep)||_0x5bb0f8===_0x22c7d2){if(_0x5bb0f8===_0x22c7d2)return;try{const _0x3fb5c1=await readdir(_0x5bb0f8);if(_0x3fb5c1[_0x191ceb(0x1fc)]>0x0)return;await rmdir(_0x5bb0f8);}catch{return;}_0x5bb0f8=dirname(_0x5bb0f8);}}async function resolveTargetDbBinding(_0x279484,_0x4c4ed2,_0x3885f9){const _0x56e130=a172_0x398eb1,_0x86e0cd=_0x4c4ed2[_0x56e130(0x1db)];if(!_0x86e0cd)return{'dbId':_0x3885f9[_0x56e130(0x1ed)],'dbName':_0x3885f9[_0x56e130(0x1e6)]};const _0x37ca41=buildDbDirectoryName(_0x3885f9['dbName'],_0x3885f9['dbId']);if(_0x86e0cd===_0x37ca41)return{'dbId':_0x3885f9[_0x56e130(0x1ed)],'dbName':_0x3885f9[_0x56e130(0x1e6)]};const _0x4eb392=parseExplicitDbDirectory(_0x86e0cd);if(_0x4eb392!=null)return{'dbId':_0x4eb392,'dbName':await getDbName(_0x279484,_0x4eb392)['catch'](()=>undefined)};const _0x14c761=await listDatabases(_0x279484),_0x35bd53=_0x14c761[_0x56e130(0x1ff)](_0x2dee42=>buildDbDirectoryName(_0x2dee42[_0x56e130(0x1e6)],_0x2dee42[_0x56e130(0x1ed)])===_0x86e0cd);if(_0x35bd53[_0x56e130(0x1fc)]===0x1)return{'dbId':_0x35bd53[0x0]['dbId'],'dbName':_0x35bd53[0x0][_0x56e130(0x1e6)]};if(_0x35bd53[_0x56e130(0x1fc)]===0x0)throw CliErrors[_0x56e130(0x205)](_0x56e130(0x216)+_0x86e0cd+_0x56e130(0x200)+_0x4c4ed2[_0x56e130(0x204)]+'.');const _0x172bec=_0x35bd53[_0x56e130(0x1d8)](_0x31a80a=>_0x31a80a[_0x56e130(0x1e6)]+'\x20('+_0x31a80a[_0x56e130(0x1ed)]+')')[_0x56e130(0x1de)](',\x20');throw CliErrors[_0x56e130(0x205)](_0x56e130(0x1f3)+_0x86e0cd+_0x56e130(0x211)+_0x4c4ed2[_0x56e130(0x204)]+':\x20'+_0x172bec);}function parseExplicitDbDirectory(_0x1b59c2){const _0x35c772=a172_0x398eb1,_0x40d530=/^db-(\d+)$/[_0x35c772(0x1e3)](_0x1b59c2);if(!_0x40d530)return null;const _0x320be3=Number(_0x40d530[0x1]);return Number[_0x35c772(0x1da)](_0x320be3)&&_0x320be3>0x0?_0x320be3: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_0x18bceb=a173_0x1be1;function a173_0x1be1(_0x31c734,_0x59a2c8){_0x31c734=_0x31c734-0x1e9;const _0x4363cd=a173_0x4363();let _0x1be1bb=_0x4363cd[_0x31c734];return _0x1be1bb;}(function(_0x2f41e2,_0x271310){const _0x279317=a173_0x1be1,_0x3493f9=_0x2f41e2();while(!![]){try{const _0x559d94=parseInt(_0x279317(0x1f4))/0x1+parseInt(_0x279317(0x1f8))/0x2*(parseInt(_0x279317(0x1ea))/0x3)+parseInt(_0x279317(0x1f6))/0x4*(parseInt(_0x279317(0x1ed))/0x5)+-parseInt(_0x279317(0x1ec))/0x6+-parseInt(_0x279317(0x1f0))/0x7+parseInt(_0x279317(0x1f3))/0x8+-parseInt(_0x279317(0x1f9))/0x9;if(_0x559d94===_0x271310)break;else _0x3493f9['push'](_0x3493f9['shift']());}catch(_0xb24b29){_0x3493f9['push'](_0x3493f9['shift']());}}}(a173_0x4363,0xb54f5));function a173_0x4363(){const _0x5bfc92=['Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','5012064OmjwMK','3779785LFGUJc','Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','SQL\x20query\x20display\x20name','976038czgYPs','sqlname','join','8279728ModaBV','798143SkQgwH','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','4vcQejd','Path\x20to\x20the\x20SQL\x20file','2ExUGkP','17841834MrlXYh','sql','file','string','3332349MJDosq'];a173_0x4363=function(){return _0x5bfc92;};return a173_0x4363();}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a173_0x18bceb(0x1f5),a173_0x18bceb(0x1eb),'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`.'][a173_0x18bceb(0x1f2)]('\x0a');export const sqlSave={'service':a173_0x18bceb(0x1fa),'command':'save','description':a173_0x18bceb(0x1ee),'risk':'write','requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a173_0x18bceb(0x1fb),'type':'string','required':!![],'description':a173_0x18bceb(0x1f7)},SQLCODE_FLAG_OPTIONAL,{'name':a173_0x18bceb(0x1f1),'type':a173_0x18bceb(0x1e9),'description':a173_0x18bceb(0x1ef)},{'name':'db','type':a173_0x18bceb(0x1e9),'description':'Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)'},{'name':'description','type':a173_0x18bceb(0x1e9),'description':'Query\x20description'}],async 'validate'(){throw CliErrors['validation'](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
- const a174_0x419c34=a174_0x3c1f;(function(_0x42396a,_0x535bac){const _0x35251d=a174_0x3c1f,_0x5a63fa=_0x42396a();while(!![]){try{const _0x13d8ba=-parseInt(_0x35251d(0x10d))/0x1*(-parseInt(_0x35251d(0xe8))/0x2)+-parseInt(_0x35251d(0xf9))/0x3*(-parseInt(_0x35251d(0xf5))/0x4)+-parseInt(_0x35251d(0xf4))/0x5+parseInt(_0x35251d(0x10c))/0x6*(parseInt(_0x35251d(0x105))/0x7)+parseInt(_0x35251d(0x102))/0x8*(parseInt(_0x35251d(0x10a))/0x9)+-parseInt(_0x35251d(0xe2))/0xa*(parseInt(_0x35251d(0x101))/0xb)+parseInt(_0x35251d(0xee))/0xc;if(_0x13d8ba===_0x535bac)break;else _0x5a63fa['push'](_0x5a63fa['shift']());}catch(_0x517f9c){_0x5a63fa['push'](_0x5a63fa['shift']());}}}(a174_0x1cf5,0xb0f09));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=a174_0x419c34(0xe3);export function buildSqlLockEntry(_0xf9bd26,_0x515dc5,_0x422a88,_0x12fc67){const _0x5203d5=a174_0x419c34,_0x204476=detectSqlMode(_0x515dc5);return{'path':buildSqlRelativePath(_0xf9bd26[_0x5203d5(0xe5)],_0xf9bd26['sqlName'],_0x12fc67?.[_0x5203d5(0x108)],_0x204476,_0xf9bd26[_0x5203d5(0x109)]),'hash':_0x422a88,'remoteId':_0xf9bd26['id'],'version':_0xf9bd26[_0x5203d5(0xfc)],'dbId':Number(_0xf9bd26[_0x5203d5(0x109)]),'dbName':_0x12fc67?.[_0x5203d5(0x108)],'sqlName':_0xf9bd26['sqlName'],'sqlConfig':_0xf9bd26[_0x5203d5(0xf2)]??undefined,'mode':_0x204476};}export function cloneSqlLockData(_0x509ef4){const _0x1cd476=a174_0x419c34;return{'apps':Object[_0x1cd476(0xf1)](Object[_0x1cd476(0x10f)](_0x509ef4[_0x1cd476(0xed)])['map'](([_0x31ee25,_0x4f2578])=>[_0x31ee25,{'sqlRoot':_0x4f2578[_0x1cd476(0x10b)],'lastSync':_0x4f2578[_0x1cd476(0xfb)],'sqls':{..._0x4f2578[_0x1cd476(0xef)]}}]))};}export function ensureRemoteSqlContent(_0x1819fc){const _0x51225b=a174_0x419c34;return _0x1819fc[_0x51225b(0xfa)]??'';}export function buildLocalSqlFileContent(_0x157ab8,_0x218bdf,_0xddf74e){const _0x314528=a174_0x419c34,_0x360048=_0xddf74e?.['mode']??detectSqlMode(_0x218bdf),_0x21d2e5=stripLocalSqlMetadata(_0x218bdf,_0x360048)[_0x314528(0xfd)](),_0xade7be=[...buildMetadataHeaderLines({'sqlCode':_0x157ab8[_0x314528(0xe5)],'sqlName':_0x157ab8[_0x314528(0xe4)],'dbId':_0x157ab8['dbId'],'dbName':_0xddf74e?.['dbName'],'mode':_0x360048,'syncedAt':_0xddf74e?.['syncedAt'],'description':_0xddf74e?.[_0x314528(0xfe)]},_0x360048),'',_0x21d2e5],_0x4ab2d9=_0xade7be[_0x314528(0xec)]('\x0a');return _0x4ab2d9[_0x314528(0xf8)]('\x0a')?_0x4ab2d9:_0x4ab2d9+'\x0a';}export function stripLocalSqlMetadata(_0x80f017,_0x53d1d0){const _0x43282d=a174_0x419c34,_0x160638=_0x80f017['replace'](/\r\n/g,'\x0a')[_0x43282d(0x103)]('\x0a'),_0x2af3fb=[];let _0x382764=0x0;if(_0x53d1d0===_0x43282d(0xe0))while(_0x382764<_0x160638[_0x43282d(0xf7)]){const _0x175d87=_0x160638[_0x382764]??'';if(/^\s*<!--\s*@lovrabet\./[_0x43282d(0x106)](_0x175d87)){_0x382764++;continue;}if(_0x175d87[_0x43282d(0xfd)]()===''&&_0x382764>0x0){_0x382764++;continue;}break;}else while(_0x382764<_0x160638[_0x43282d(0xf7)]){const _0x47ae15=_0x160638[_0x382764]??'';if(/^\s*--\s*@lovrabet\./[_0x43282d(0x106)](_0x47ae15)){_0x382764++;continue;}if(_0x47ae15[_0x43282d(0xfd)]()===''&&_0x382764>0x0){_0x382764++;continue;}break;}for(;_0x382764<_0x160638['length'];_0x382764++){_0x2af3fb[_0x43282d(0xf6)](_0x160638[_0x382764]);}return _0x2af3fb[_0x43282d(0xec)]('\x0a')[_0x43282d(0xea)]();}export function resolveSqlMode(_0x35ba7d,_0x5f0eac){const _0x27fffc=a174_0x419c34;if(_0x5f0eac?.[_0x27fffc(0xff)])return _0x5f0eac[_0x27fffc(0xff)];return detectSqlMode(_0x35ba7d);}export function resolveSqlFileName(_0x23d820,_0x26e05c,_0x5d7a94){const _0x3ca6e9=a174_0x419c34;if(_0x5d7a94?.[_0x3ca6e9(0x10e)])return _0x5d7a94[_0x3ca6e9(0x10e)];if(_0x5d7a94?.[_0x3ca6e9(0xe4)]||_0x5d7a94?.['dbName'])return buildSqlRelativePath(_0x23d820,_0x5d7a94?.[_0x3ca6e9(0xe4)],_0x5d7a94?.[_0x3ca6e9(0x108)],resolveSqlMode(_0x26e05c,_0x5d7a94),_0x5d7a94?.[_0x3ca6e9(0x109)]);return buildDefaultSqlFileName(_0x23d820,resolveSqlMode(_0x26e05c,_0x5d7a94));}function a174_0x1cf5(){const _0x51c3fb=['apps','8269344eNCJtB','sqls','--\x20@lovrabet.','fromEntries','sqlConfig','filter','3346090QzgbGP','12zYEEcw','push','length','endsWith','521907yDxqbE','sqlContent','lastSync','version','trim','description','mode','syncedAt','11keLBQz','13576srGOmH','split','includes','105bwaJcS','test','\x20[y/N]\x20','dbName','dbId','63DtylTT','sqlRoot','141402reclPv','12731TPMBCd','path','entries','mybatisXml','stderr','11881890LDVJYQ','.rabetbase/sql','sqlName','sqlCode','question','\x20-->','158BmmsgS','stdin','trimStart','<!--\x20@lovrabet.','join'];a174_0x1cf5=function(){return _0x51c3fb;};return a174_0x1cf5();}function a174_0x3c1f(_0x301660,_0x52a32f){_0x301660=_0x301660-0xe0;const _0x1cf5c6=a174_0x1cf5();let _0x3c1fa8=_0x1cf5c6[_0x301660];return _0x3c1fa8;}export function resolveSqlLocalDir(_0x2f26ee,_0x5d08cb){return join(_0x2f26ee,SQL_LOCAL_REL_DIR,_0x5d08cb);}export async function confirmForceOverwrite(_0xe78961){const _0x56bdd4=a174_0x419c34,_0x498e19=createInterface({'input':process[_0x56bdd4(0xe9)],'output':process[_0x56bdd4(0xe1)]}),_0x1f8fe8=await new Promise(_0x4fbe3b=>{const _0x3e576e=_0x56bdd4;_0x498e19[_0x3e576e(0xe6)](_0xe78961+_0x3e576e(0x107),_0x4fbe3b);});return _0x498e19['close'](),['y','yes'][_0x56bdd4(0x104)](_0x1f8fe8[_0x56bdd4(0xfd)]()['toLowerCase']());}export function findSqlLockScope(_0x18c739,_0x55b13e){const _0x2defc2=a174_0x419c34;return _0x18c739[_0x2defc2(0xed)][_0x55b13e];}function buildMetadataHeaderLines(_0x1877da,_0x39db89){const _0x2eb100=a174_0x419c34,_0x4043d4=[['sqlCode',_0x1877da[_0x2eb100(0xe5)]],['sqlName',_0x1877da[_0x2eb100(0xe4)]],['dbId',_0x1877da[_0x2eb100(0x109)]],['dbName',_0x1877da[_0x2eb100(0x108)]],[_0x2eb100(0xff),_0x1877da[_0x2eb100(0xff)]],[_0x2eb100(0x100),_0x1877da['syncedAt']],['description',_0x1877da[_0x2eb100(0xfe)]]];if(_0x39db89===_0x2eb100(0xe0))return _0x4043d4[_0x2eb100(0xf3)](([,_0x934318])=>_0x934318!==undefined&&_0x934318!==null&&String(_0x934318)[_0x2eb100(0xfd)]()!=='')['map'](([_0x3e1a86,_0x43284c])=>_0x2eb100(0xeb)+_0x3e1a86+':\x20'+String(_0x43284c)+_0x2eb100(0xe7));return _0x4043d4[_0x2eb100(0xf3)](([,_0x251e96])=>_0x251e96!==undefined&&_0x251e96!==null&&String(_0x251e96)['trim']()!=='')['map'](([_0x5305d3,_0x5b8a18])=>_0x2eb100(0xf0)+_0x5305d3+':\x20'+String(_0x5b8a18));}
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
- function a175_0x1d0a(){const _0x44d39e=['\x20added,\x20','\x20remote-only','5626472tMiVxU','hash','tableData','remote','554332KRWPCE','length','sqlName','1538082sqWakh','has','boolean','All\x20SQL\x20queries\x20are\x20in\x20sync.','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','relativePath','bool','path','keys','2365098AYhLnn','42130pvjnbC','paging','265829JwJXqs','push','status','\x20unchanged','appCode','\x20missing,\x20','sqlCode','totalCount','map','sqls','lockKey','2573602pkZQBR','filePath','822DHNtSP','lockFilePath','sql','read'];a175_0x1d0a=function(){return _0x44d39e;};return a175_0x1d0a();}function a175_0x715b(_0xf5dd33,_0x56ff0d){_0xf5dd33=_0xf5dd33-0x16a;const _0x1d0a68=a175_0x1d0a();let _0x715bcf=_0x1d0a68[_0xf5dd33];return _0x715bcf;}const a175_0x18c5b3=a175_0x715b;(function(_0x5685b7,_0x4e1f31){const _0x4b778d=a175_0x715b,_0x3643aa=_0x5685b7();while(!![]){try{const _0x7a5e64=-parseInt(_0x4b778d(0x16b))/0x1+-parseInt(_0x4b778d(0x176))/0x2+parseInt(_0x4b778d(0x18e))/0x3+-parseInt(_0x4b778d(0x182))/0x4+-parseInt(_0x4b778d(0x18f))/0x5*(-parseInt(_0x4b778d(0x178))/0x6)+-parseInt(_0x4b778d(0x185))/0x7+parseInt(_0x4b778d(0x17e))/0x8;if(_0x7a5e64===_0x4e1f31)break;else _0x3643aa['push'](_0x3643aa['shift']());}catch(_0x50990c){_0x3643aa['push'](_0x3643aa['shift']());}}}(a175_0x1d0a,0xb377a));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';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x1368c7){const _0x26975b=a175_0x715b,_0x447f2b=[];let _0x940453=0x1;while(!![]){const _0x57cf41=await listSqlQueries(_0x1368c7,{'currentPage':_0x940453,'pageSize':PAGE_SIZE}),_0x23bbd5=_0x57cf41[_0x26975b(0x180)]??[];_0x447f2b[_0x26975b(0x16c)](..._0x23bbd5[_0x26975b(0x173)](_0x405963=>_0x405963[_0x26975b(0x171)]));if(_0x23bbd5[_0x26975b(0x183)]===0x0)break;const _0x175d8a=_0x57cf41[_0x26975b(0x16a)]?.[_0x26975b(0x172)];if(_0x175d8a!=null?_0x447f2b[_0x26975b(0x183)]>=_0x175d8a:_0x23bbd5[_0x26975b(0x183)]<PAGE_SIZE)break;_0x940453++;}return _0x447f2b;}export const sqlStatus={'service':a175_0x18c5b3(0x17a),'command':'status','description':a175_0x18c5b3(0x189),'risk':a175_0x18c5b3(0x17b),'flags':[{'name':a175_0x18c5b3(0x181),'type':a175_0x18c5b3(0x187),'description':'Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'}],async 'execute'(_0x42f2c9){const _0x13c56a=a175_0x18c5b3,_0x5d8db5=loadSqlProjectConfig(_0x42f2c9[_0x13c56a(0x16f)]),_0x3a15eb=await readSqlLockFile(_0x5d8db5[_0x13c56a(0x179)]),{appLock:_0x1e83d3}=ensureSqlLockScope(_0x3a15eb??createEmptySqlLock(),_0x5d8db5[_0x13c56a(0x16f)],_0x5d8db5['sqlRoot'],_0x13c56a(0x16d)),_0x44be40=await scanLocalSqlQueries(_0x5d8db5),_0x6b1027=[],_0x4a4ee5=[],_0x257608=[],_0x3d5cba=[],_0x1fb05b=new Set(_0x44be40[_0x13c56a(0x173)](_0x14842c=>_0x14842c[_0x13c56a(0x175)]));for(const _0x2b78f3 of _0x44be40){const _0x3f5674=await computeSqlFileHash(_0x2b78f3[_0x13c56a(0x177)]),_0x36504e=_0x1e83d3[_0x13c56a(0x174)][_0x2b78f3[_0x13c56a(0x175)]],_0x15ca0d=!!_0x36504e&&_0x36504e[_0x13c56a(0x18c)]!==_0x2b78f3[_0x13c56a(0x18a)],_0x5225a6=!!_0x36504e&&!!_0x2b78f3[_0x13c56a(0x184)]&&_0x36504e[_0x13c56a(0x184)]!==_0x2b78f3['sqlName'];if(!_0x36504e)_0x6b1027['push'](_0x2b78f3[_0x13c56a(0x175)]);else _0x36504e[_0x13c56a(0x17f)]!==_0x3f5674||_0x15ca0d||_0x5225a6?_0x4a4ee5['push'](_0x2b78f3[_0x13c56a(0x175)]):_0x257608[_0x13c56a(0x16c)](_0x2b78f3[_0x13c56a(0x175)]);}for(const _0xe04b6 of Object[_0x13c56a(0x18d)](_0x1e83d3[_0x13c56a(0x174)])){!_0x1fb05b['has'](_0xe04b6)&&_0x3d5cba[_0x13c56a(0x16c)](_0xe04b6);}const _0x5f1c4a=[];if(_0x42f2c9[_0x13c56a(0x18b)]('remote')){const _0x47e492=await fetchAllSqlCodes(_0x42f2c9[_0x13c56a(0x16f)]);for(const _0x55c47a of _0x47e492){!_0x1fb05b[_0x13c56a(0x186)](_0x55c47a)&&!_0x1e83d3[_0x13c56a(0x174)][_0x55c47a]&&_0x5f1c4a[_0x13c56a(0x16c)](_0x55c47a);}}const _0x58347f=_0x6b1027[_0x13c56a(0x183)]===0x0&&_0x4a4ee5[_0x13c56a(0x183)]===0x0&&_0x3d5cba[_0x13c56a(0x183)]===0x0&&_0x5f1c4a['length']===0x0;return{'ok':!![],'data':{'added':_0x6b1027,'modified':_0x4a4ee5,'missing':_0x3d5cba,'unchanged':_0x257608,'remoteOnly':_0x5f1c4a},'message':_0x58347f?_0x13c56a(0x188):_0x6b1027[_0x13c56a(0x183)]+_0x13c56a(0x17c)+_0x4a4ee5['length']+'\x20modified,\x20'+_0x3d5cba[_0x13c56a(0x183)]+_0x13c56a(0x170)+_0x257608[_0x13c56a(0x183)]+_0x13c56a(0x16e)+(_0x5f1c4a[_0x13c56a(0x183)]>0x0?',\x20'+_0x5f1c4a[_0x13c56a(0x183)]+_0x13c56a(0x17d):'')};}};
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();}