@lovrabet/rabetbase-cli 2.3.10 → 2.3.11

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_0x5d1975=a164_0x1329;function a164_0x1329(_0xc7b777,_0x4e392f){_0xc7b777=_0xc7b777-0x141;const _0xddcd67=a164_0xddcd();let _0x13299e=_0xddcd67[_0xc7b777];return _0x13299e;}(function(_0x1c855b,_0x3051dc){const _0x126e7c=a164_0x1329,_0x3d311b=_0x1c855b();while(!![]){try{const _0xd27e46=-parseInt(_0x126e7c(0x161))/0x1+-parseInt(_0x126e7c(0x177))/0x2+parseInt(_0x126e7c(0x141))/0x3+parseInt(_0x126e7c(0x173))/0x4+-parseInt(_0x126e7c(0x15f))/0x5+-parseInt(_0x126e7c(0x163))/0x6+parseInt(_0x126e7c(0x14d))/0x7;if(_0xd27e46===_0x3051dc)break;else _0x3d311b['push'](_0x3d311b['shift']());}catch(_0x59e745){_0x3d311b['push'](_0x3d311b['shift']());}}}(a164_0xddcd,0xbec0e));function a164_0xddcd(){const _0x16b189=['slice','169060ZzFCOZ','\x20run\x20','834142JorkhT','build','2069382zHROGq','(none)','utf-8','bool','package.json','bun.lock','scripts','dev','keys','args','\x20run\x20build','bun.lockb','Enable\x20watch\x20mode\x20for\x20preview','inherit','\x0a\x20\x20Available\x20scripts:\x0a','\x0a\x20\x20Usage:\x20','6190292tValVr','\x20\x20\x20\x20','preview','Run\x20a\x20package.json\x20script','2332784TXFTyh','.bin','join','validation','No\x20scripts\x20defined\x20in\x20package.json.','needsUpgrade','pnpm','\x20run\x20start','257724Avdikw','\x20exited\x20with\x20code\x20','length','watch','boolean','Script\x20\x22','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','yarn','close','error','has','parse','10689616etECot','\x20run\x20<script>\x0a','pnpm-lock.yaml','push','No\x20package.json\x20found\x20in\x20current\x20directory.','Available:\x20','vite\x20preview\x20exited\x20with\x20code\x20','\x20run\x20preview\x20--watch','yarn.lock','script','vite','\x20run\x20preview','cwd','--watch','node_modules','run','log'];a164_0xddcd=function(){return _0x16b189;};return a164_0xddcd();}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_0x5d1975(0x16a)]);function readPackageScripts(_0x6dd840){const _0x76a26a=a164_0x5d1975,_0x8e4e7b=resolve(_0x6dd840,_0x76a26a(0x167));if(!existsSync(_0x8e4e7b))return null;try{const _0x4a92f3=JSON[_0x76a26a(0x14c)](readFileSync(_0x8e4e7b,_0x76a26a(0x165)));return _0x4a92f3[_0x76a26a(0x169)]??{};}catch{return null;}}function detectPackageManager(_0x1bad56){const _0x4cf946=a164_0x5d1975;if(existsSync(resolve(_0x1bad56,_0x4cf946(0x16e)))||existsSync(resolve(_0x1bad56,_0x4cf946(0x168))))return'bun';if(existsSync(resolve(_0x1bad56,_0x4cf946(0x14f))))return _0x4cf946(0x17d);if(existsSync(resolve(_0x1bad56,_0x4cf946(0x155))))return _0x4cf946(0x148);return'npm';}async function versionCheck(_0x21a6cd){const _0x2fc29e=a164_0x5d1975,_0x3df2e5=await checkCliVersion();(_0x3df2e5[_0x2fc29e(0x17c)]||_0x3df2e5['belowMinimum'])&&(printCliUpgradeWarning(_0x3df2e5),assertCliVersionSupported(_0x3df2e5));const _0x13e61d=await checkSdkVersion(_0x21a6cd);if(_0x13e61d[_0x2fc29e(0x17c)])printSdkUpgradeWarning(_0x13e61d);}function spawnScript(_0x5118c1,_0x4e4f04,_0x2467ea,_0xc0991f){return new Promise((_0x4e52b4,_0x5cc8ff)=>{const _0x411375=a164_0x1329,_0x2f87a8=[_0x411375(0x15c),_0x4e4f04,..._0x2467ea],_0x2d68b7=spawn(_0x5118c1,_0x2f87a8,{'cwd':_0xc0991f,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0xc0991f,_0x411375(0x15b),_0x411375(0x178))+delimiter+process.env.PATH}});_0x2d68b7['on'](_0x411375(0x149),_0xa5cc8=>{const _0x337133=_0x411375;if(_0xa5cc8===0x0||_0xa5cc8===null)_0x4e52b4();else _0x5cc8ff(new Error(_0x5118c1+_0x337133(0x160)+_0x4e4f04+_0x337133(0x142)+_0xa5cc8));}),_0x2d68b7['on']('error',_0x5cc8ff);});}function spawnViteBuildWatch(_0x2d7883){return new Promise((_0x26c13,_0x4bd4c3)=>{const _0x1b8711=a164_0x1329,_0x2717cf=spawn('vite',[_0x1b8711(0x162),_0x1b8711(0x15a)],{'cwd':_0x2d7883,'stdio':_0x1b8711(0x170),'shell':!![],'env':{...process.env,'PATH':''+join(_0x2d7883,_0x1b8711(0x15b),_0x1b8711(0x178))+delimiter+process.env.PATH}});_0x2717cf['on'](_0x1b8711(0x149),_0x35f558=>{const _0x49e7f0=_0x1b8711;if(_0x35f558===0x0||_0x35f558===null)_0x26c13();else _0x4bd4c3(new Error(_0x49e7f0(0x147)+_0x35f558));}),_0x2717cf['on']('error',_0x4bd4c3);});}function spawnVitePreview(_0x428cd9){return new Promise((_0x448bb5,_0x23dd5f)=>{const _0x5526a5=a164_0x1329,_0x437f5b=spawn(_0x5526a5(0x157),[_0x5526a5(0x175)],{'cwd':_0x428cd9,'stdio':_0x5526a5(0x170),'shell':!![],'env':{...process.env,'PATH':''+join(_0x428cd9,_0x5526a5(0x15b),_0x5526a5(0x178))+delimiter+process.env.PATH}});_0x437f5b['on'](_0x5526a5(0x149),_0x4e74d3=>{const _0x1de5ac=_0x5526a5;if(_0x4e74d3===0x0||_0x4e74d3===null)_0x448bb5();else _0x23dd5f(new Error(_0x1de5ac(0x153)+_0x4e74d3));}),_0x437f5b['on'](_0x5526a5(0x14a),_0x23dd5f);});}const runFlags=[{'name':a164_0x5d1975(0x144),'type':a164_0x5d1975(0x145),'description':a164_0x5d1975(0x16f),'default':![]}];export const runDefinition={'service':a164_0x5d1975(0x15c),'command':'run','description':a164_0x5d1975(0x176),'risk':'read','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a164_0x5d1975(0x156),'description':'Script\x20name\x20defined\x20in\x20package.json','required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x4c4d03=a164_0x5d1975,_0x222629=[];return _0x222629[_0x4c4d03(0x150)]('\x20\x20EXAMPLES'),_0x222629[_0x4c4d03(0x150)](_0x4c4d03(0x174)+CLI_BIN_NAME+_0x4c4d03(0x17e)),_0x222629[_0x4c4d03(0x150)]('\x20\x20\x20\x20'+CLI_BIN_NAME+_0x4c4d03(0x16d)),_0x222629['push'](_0x4c4d03(0x174)+CLI_BIN_NAME+_0x4c4d03(0x158)),_0x222629['push'](_0x4c4d03(0x174)+CLI_BIN_NAME+_0x4c4d03(0x154)),_0x222629[_0x4c4d03(0x179)]('\x0a');},async 'execute'(_0x50f6a1){const _0x115fa8=a164_0x5d1975,_0x102d5a=process[_0x115fa8(0x159)](),_0x339e16=_0x50f6a1[_0x115fa8(0x16c)][0x0],_0x198f84=_0x50f6a1[_0x115fa8(0x16c)][_0x115fa8(0x15e)](0x1),_0x473401=readPackageScripts(_0x102d5a);if(!_0x473401)throw CliErrors[_0x115fa8(0x17a)](_0x115fa8(0x151));if(!_0x339e16){const _0x3a3586=Object[_0x115fa8(0x16b)](_0x473401);if(_0x3a3586[_0x115fa8(0x143)]===0x0)console[_0x115fa8(0x15d)](_0x115fa8(0x17b));else{console[_0x115fa8(0x15d)](_0x115fa8(0x171));for(const _0x305260 of _0x3a3586){console[_0x115fa8(0x15d)](_0x115fa8(0x174)+_0x305260);}console[_0x115fa8(0x15d)](_0x115fa8(0x172)+CLI_BIN_NAME+_0x115fa8(0x14e));}return{'ok':!![]};}if(!_0x473401[_0x339e16])throw CliErrors['validation'](_0x115fa8(0x146)+_0x339e16+'\x22\x20not\x20found\x20in\x20package.json.',_0x115fa8(0x152)+(Object[_0x115fa8(0x16b)](_0x473401)[_0x115fa8(0x179)](',\x20')||_0x115fa8(0x164)));const _0x3d0127=detectPackageManager(_0x102d5a);VERSION_CHECK_SCRIPTS[_0x115fa8(0x14b)](_0x339e16)&&await versionCheck(_0x102d5a);if(_0x339e16===_0x115fa8(0x175)&&_0x50f6a1[_0x115fa8(0x166)]('watch'))return await Promise['all']([spawnViteBuildWatch(_0x102d5a),spawnVitePreview(_0x102d5a)]),{'ok':!![]};return await spawnScript(_0x3d0127,_0x339e16,_0x198f84,_0x102d5a),{'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_0x22be50=a165_0x5891;(function(_0x4cc3fa,_0x5dded1){const _0x9b8c71=a165_0x5891,_0x3534c3=_0x4cc3fa();while(!![]){try{const _0x12cf06=parseInt(_0x9b8c71(0x16c))/0x1*(parseInt(_0x9b8c71(0x16b))/0x2)+-parseInt(_0x9b8c71(0x171))/0x3+parseInt(_0x9b8c71(0x176))/0x4*(parseInt(_0x9b8c71(0x177))/0x5)+parseInt(_0x9b8c71(0x172))/0x6*(-parseInt(_0x9b8c71(0x175))/0x7)+-parseInt(_0x9b8c71(0x173))/0x8*(parseInt(_0x9b8c71(0x169))/0x9)+-parseInt(_0x9b8c71(0x16e))/0xa+parseInt(_0x9b8c71(0x174))/0xb;if(_0x12cf06===_0x5dded1)break;else _0x3534c3['push'](_0x3534c3['shift']());}catch(_0x326b6a){_0x3534c3['push'](_0x3534c3['shift']());}}}(a165_0x4f56,0x4e59d));function a165_0x4f56(){const _0x20b89d=['read','Export\x20machine-readable\x20command\x20schema\x20(JSON)','1446714gBLNuT','2758764cnjHtY','4648rwKpyI','12916552MxQksc','7HiHUNb','4dnBPyD','2251445genCGm','5760rqWYgH','schema','307206jXqMiq','1XbXbOw','json','1433270gDlYEZ'];a165_0x4f56=function(){return _0x20b89d;};return a165_0x4f56();}import{buildSchemaPayload}from'../framework/schema-export.js';function a165_0x5891(_0x595afa,_0x3d306a){_0x595afa=_0x595afa-0x169;const _0x4f5678=a165_0x4f56();let _0x589159=_0x4f5678[_0x595afa];return _0x589159;}async function execute(_0x109a2c){const _0x31020f=await buildSchemaPayload();return{'ok':!![],'data':_0x31020f};}export const schemaDefinition={'service':a165_0x22be50(0x16a),'command':'export','description':a165_0x22be50(0x170),'risk':a165_0x22be50(0x16f),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a165_0x22be50(0x16d),'flags':[],'execute':execute};
@@ -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_0x2f9a5d=a166_0x4af8;(function(_0x42b0b1,_0x59c406){const _0x291c15=a166_0x4af8,_0x508d49=_0x42b0b1();while(!![]){try{const _0x20ceee=parseInt(_0x291c15(0x1d7))/0x1+-parseInt(_0x291c15(0x1df))/0x2+parseInt(_0x291c15(0x1eb))/0x3*(parseInt(_0x291c15(0x1dd))/0x4)+-parseInt(_0x291c15(0x1cc))/0x5*(-parseInt(_0x291c15(0x1de))/0x6)+parseInt(_0x291c15(0x1e2))/0x7*(-parseInt(_0x291c15(0x1c5))/0x8)+-parseInt(_0x291c15(0x1c6))/0x9*(parseInt(_0x291c15(0x1d1))/0xa)+parseInt(_0x291c15(0x1ef))/0xb;if(_0x20ceee===_0x59c406)break;else _0x508d49['push'](_0x508d49['shift']());}catch(_0x350aae){_0x508d49['push'](_0x508d49['shift']());}}}(a166_0xce5c,0x3ec03));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';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';function a166_0xce5c(){const _0x5050e8=['dbId\x20不能为空','137187hUAMLJ','sqlCode','length','stringify','2010305mkaoXI','catch','appCode','lockFilePath','number','Invalid\x20database\x20selection\x20payload:\x20','mybatisXml','✎\x20手动输入\x20dbId','sql','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','dbId','Local\x20SQL\x20file\x20mode','string','str','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','dbId\x20必须为正整数','flagMissing','high-risk-write','Target\x20database\x20ID','parse','name','<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','new','lastSync','适合直接执行的普通\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20语句','sqlRoot','263832cTSFAT','36OEQhxK','utf8','isFinite','sqlRootDir','--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','map','25WSMsZI','/smartapi/custom/saveUserCustomSql','toISOString','适合带动态标签的\x20MyBatis\x20XML\x20SQL','sqls','669890quevjM','POST','join','请选择目标数据库:','sqlName','mode','189711ARXvQc','create','trim','请选择本地\x20SQL\x20模式:','dbName','Created\x20SQL\x20query\x20','8fshPfN','121776FrndCm','14884pNuSSS','MyBatis\x20XML(mybatisXml)','isInteger','7dyFwWK','db-id','SQL\x20query\x20display\x20name','普通\x20SQL(sql)','SQL\x20名称不能为空','Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','nonInteractive','请输入目标数据库\x20dbId:'];a166_0xce5c=function(){return _0x5050e8;};return a166_0xce5c();}import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x2885b2){const _0x2c12af=a166_0x4af8;if(_0x2885b2==='mybatisXml')return[_0x2c12af(0x1c0),'\x20\x20SELECT\x201\x20AS\x20id','</select>',''][_0x2c12af(0x1d3)]('\x0a');return['SELECT\x201\x20AS\x20id;',''][_0x2c12af(0x1d3)]('\x0a');}export const sqlCreate={'service':a166_0x2f9a5d(0x1b2),'command':a166_0x2f9a5d(0x1d8),'description':a166_0x2f9a5d(0x1e7),'risk':a166_0x2f9a5d(0x1bc),'flags':[{'name':a166_0x2f9a5d(0x1bf),'type':a166_0x2f9a5d(0x1b6),'description':a166_0x2f9a5d(0x1e4)},{'name':a166_0x2f9a5d(0x1e3),'type':a166_0x2f9a5d(0x1ae),'description':a166_0x2f9a5d(0x1bd)},{'name':a166_0x2f9a5d(0x1d6),'type':a166_0x2f9a5d(0x1b6),'enum':[a166_0x2f9a5d(0x1b2),a166_0x2f9a5d(0x1b0)],'description':a166_0x2f9a5d(0x1b5)}],async 'validate'(_0xaffaf8){const _0x55f90a=a166_0x2f9a5d;if(!_0xaffaf8[_0x55f90a(0x1e8)])return;if(!_0xaffaf8['str']('name')[_0x55f90a(0x1d9)]())throw CliErrors[_0x55f90a(0x1bb)](_0x55f90a(0x1bf),_0x55f90a(0x1b9));const _0x4b0294=resolveProvidedDbId(_0xaffaf8);if(typeof _0x4b0294!==_0x55f90a(0x1ae)||!Number[_0x55f90a(0x1c8)](_0x4b0294)||_0x4b0294<=0x0)throw CliErrors['flagMissing'](_0x55f90a(0x1e3),_0x55f90a(0x1ca));if(!_0xaffaf8[_0x55f90a(0x1b7)](_0x55f90a(0x1d6))['trim']())throw CliErrors[_0x55f90a(0x1bb)](_0x55f90a(0x1d6),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x3e4484){const _0xf9549f=a166_0x2f9a5d,_0x7f63db=loadSqlProjectConfig(_0x3e4484[_0xf9549f(0x1f1)]),{sqlName:_0x394d52,dbId:_0x2f9ab8,dbName:_0x4dab4e,mode:_0x3cad3a}=await resolveSqlNewInputs(_0x3e4484),_0xcbf286=buildSqlRelativePath('<server-generated-sqlCode>',_0x394d52,_0x4dab4e,_0x3cad3a,_0x2f9ab8),_0xb2ea99=_0x7f63db[_0xf9549f(0x1c9)]+'/'+_0xcbf286;return{'method':_0xf9549f(0x1d2),'url':_0xf9549f(0x1cd),'body':{'appCode':_0x3e4484['appCode'],'sqlName':_0x394d52,'dbId':_0x2f9ab8,'mode':_0x3cad3a,'localPath':_0xb2ea99},'description':_0xf9549f(0x1b3)+_0x7f63db['sqlRootDir']};},async 'execute'(_0x3b18b8){const _0x34e1ef=a166_0x2f9a5d,_0x4d2ab9=loadSqlProjectConfig(_0x3b18b8['appCode']),{sqlName:_0x34a6a5,dbId:_0x451410,dbName:_0x2b814f,mode:_0x49b21b}=await resolveSqlNewInputs(_0x3b18b8),_0x3d4e71=generateSqlTemplate(_0x49b21b),_0x2ee68d=await createSqlQuery({'appCode':_0x3b18b8[_0x34e1ef(0x1f1)],'sqlName':_0x34a6a5,'dbId':_0x451410,'sqlContent':_0x3d4e71}),_0x29fd60=ensureRemoteSqlContent(_0x2ee68d),_0xfb791b=_0x2b814f||await getDbName(_0x3b18b8[_0x34e1ef(0x1f1)],_0x451410)[_0x34e1ef(0x1f0)](()=>undefined),_0x5cd25b=buildSqlRelativePath(_0x2ee68d[_0x34e1ef(0x1ec)],_0x2ee68d[_0x34e1ef(0x1d5)],_0xfb791b,_0x49b21b,_0x451410),_0x53d85e=_0x4d2ab9[_0x34e1ef(0x1c9)]+'/'+_0x5cd25b,_0x441930=buildLocalSqlFileContent({'sqlCode':_0x2ee68d['sqlCode'],'sqlName':_0x2ee68d['sqlName'],'dbId':_0x2ee68d[_0x34e1ef(0x1b4)]},_0x29fd60,{'dbName':_0xfb791b,'mode':_0x49b21b,'syncedAt':new Date()[_0x34e1ef(0x1ce)](),'description':_0x2ee68d['description']});if(await fileExists(_0x53d85e))throw CliErrors['validation']('File\x20already\x20exists:\x20'+_0x53d85e);await ensureParentDirectory(_0x53d85e),await writeFile(_0x53d85e,_0x441930,_0x34e1ef(0x1c7));const _0x11d5c5=await readSqlLockFile(_0x4d2ab9[_0x34e1ef(0x1ad)]),{lockData:_0x5bc5b3,appLock:_0x5dbc93}=ensureSqlLockScope(_0x11d5c5??createEmptySqlLock(),_0x4d2ab9[_0x34e1ef(0x1f1)],_0x4d2ab9[_0x34e1ef(0x1c4)],_0x34e1ef(0x1c1));return _0x5dbc93[_0x34e1ef(0x1d0)][_0x2ee68d[_0x34e1ef(0x1ec)]]={...buildSqlLockEntry(_0x2ee68d,_0x29fd60,computeSqlContentHash(_0x441930),{'dbName':_0xfb791b}),'path':_0x5cd25b,'mode':_0x49b21b},_0x5dbc93[_0x34e1ef(0x1c2)]=new Date()['toISOString'](),await writeSqlLockFile(_0x4d2ab9[_0x34e1ef(0x1ad)],_0x5bc5b3),{'ok':!![],'data':{'id':_0x2ee68d['id'],'sqlCode':_0x2ee68d[_0x34e1ef(0x1ec)],'sqlName':_0x2ee68d[_0x34e1ef(0x1d5)],'dbId':_0x2ee68d[_0x34e1ef(0x1b4)],'path':_0x53d85e,'mode':_0x49b21b},'message':_0x34e1ef(0x1dc)+_0x2ee68d[_0x34e1ef(0x1ec)]};}};async function resolveSqlNewInputs(_0x3f4f7b){const _0x1a8910=await resolveSqlNameInput(_0x3f4f7b),{dbId:_0x5510f2,dbName:_0x1eeddf}=await resolveDbSelection(_0x3f4f7b),_0x1aab62=await resolveSqlModeInput(_0x3f4f7b);return{'sqlName':_0x1a8910,'dbId':_0x5510f2,'dbName':_0x1eeddf,'mode':_0x1aab62};}function a166_0x4af8(_0x230288,_0x5d76cc){_0x230288=_0x230288-0x1ad;const _0xce5c5a=a166_0xce5c();let _0x4af862=_0xce5c5a[_0x230288];return _0x4af862;}async function resolveSqlNameInput(_0x92cffd){const _0x56ca18=a166_0x2f9a5d,_0x26f80a=_0x92cffd[_0x56ca18(0x1b7)](_0x56ca18(0x1bf))[_0x56ca18(0x1d9)]();if(_0x26f80a)return _0x26f80a;if(_0x92cffd[_0x56ca18(0x1e8)])throw CliErrors[_0x56ca18(0x1bb)](_0x56ca18(0x1bf),_0x56ca18(0x1b9));return(await input({'message':'请输入\x20SQL\x20名称:','validate':_0x115d04=>_0x115d04[_0x56ca18(0x1d9)]()?!![]:_0x56ca18(0x1e6)}))['trim']();}async function resolveDbSelection(_0x2a4312){const _0x2b8fc5=a166_0x2f9a5d,_0x3422f8=resolveProvidedDbId(_0x2a4312);if(typeof _0x3422f8==='number'&&Number['isFinite'](_0x3422f8)&&_0x3422f8>0x0)return{'dbId':_0x3422f8,'dbName':await getDbName(_0x2a4312['appCode'],_0x3422f8)[_0x2b8fc5(0x1f0)](()=>undefined)};if(_0x2a4312[_0x2b8fc5(0x1e8)])throw CliErrors[_0x2b8fc5(0x1bb)]('db-id',_0x2b8fc5(0x1ca));const _0x11d18a=await listDatabases(_0x2a4312[_0x2b8fc5(0x1f1)])[_0x2b8fc5(0x1f0)](()=>[]);if(_0x11d18a['length']===0x1)return{'dbId':_0x11d18a[0x0]['dbId'],'dbName':_0x11d18a[0x0]['dbName']};if(_0x11d18a[_0x2b8fc5(0x1ed)]>0x1){const _0x489d99=await select({'message':_0x2b8fc5(0x1d4),'choices':[..._0x11d18a[_0x2b8fc5(0x1cb)](_0x10cc5f=>({'name':_0x10cc5f[_0x2b8fc5(0x1db)]+'\x20('+_0x10cc5f[_0x2b8fc5(0x1b4)]+')','value':serializeDbSelection(_0x10cc5f)})),{'name':_0x2b8fc5(0x1b1),'value':'__manual__'}]});if(_0x489d99!=='__manual__')return deserializeDbSelection(_0x489d99);}const _0x281155=await input({'message':_0x2b8fc5(0x1e9),'validate':_0x3a04ba=>{const _0x5491b5=_0x2b8fc5,_0x2def22=_0x3a04ba[_0x5491b5(0x1d9)]();if(!_0x2def22)return _0x5491b5(0x1ea);const _0x532984=Number(_0x2def22);if(!Number[_0x5491b5(0x1e1)](_0x532984)||_0x532984<=0x0)return _0x5491b5(0x1ba);return!![];}});return{'dbId':Number(_0x281155[_0x2b8fc5(0x1d9)]())};}async function resolveSqlModeInput(_0xbcf81c){const _0x4d8106=a166_0x2f9a5d,_0x1af10e=_0xbcf81c['str'](_0x4d8106(0x1d6))['trim']();if(_0x1af10e===_0x4d8106(0x1b2)||_0x1af10e==='mybatisXml')return _0x1af10e;if(_0xbcf81c['nonInteractive'])throw CliErrors[_0x4d8106(0x1bb)]('mode',_0x4d8106(0x1b8));return await select({'message':_0x4d8106(0x1da),'choices':[{'name':_0x4d8106(0x1e5),'value':_0x4d8106(0x1b2),'description':_0x4d8106(0x1c3)},{'name':_0x4d8106(0x1e0),'value':'mybatisXml','description':_0x4d8106(0x1cf)}]});}function serializeDbSelection(_0x4bbd88){const _0xd90419=a166_0x2f9a5d;return JSON[_0xd90419(0x1ee)]({'dbId':_0x4bbd88[_0xd90419(0x1b4)],'dbName':_0x4bbd88[_0xd90419(0x1db)]});}function deserializeDbSelection(_0xfd6823){const _0xb38fcf=a166_0x2f9a5d;try{const _0x3e523b=JSON[_0xb38fcf(0x1be)](_0xfd6823);if(typeof _0x3e523b[_0xb38fcf(0x1b4)]==='number'&&Number[_0xb38fcf(0x1c8)](_0x3e523b['dbId']))return{'dbId':_0x3e523b[_0xb38fcf(0x1b4)],'dbName':_0x3e523b[_0xb38fcf(0x1db)]};}catch{}throw CliErrors['validation'](_0xb38fcf(0x1af)+_0xfd6823);}function resolveProvidedDbId(_0xa87c12){const _0x47140f=a166_0x2f9a5d,_0x2e496f=_0xa87c12['flag'](_0x47140f(0x1e3));if(typeof _0x2e496f===_0x47140f(0x1ae)&&Number[_0x47140f(0x1c8)](_0x2e496f))return _0x2e496f;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_0x5ef014=a167_0xb531;(function(_0x36f4da,_0x55bad1){const _0x578347=a167_0xb531,_0x405a8d=_0x36f4da();while(!![]){try{const _0x5364d2=parseInt(_0x578347(0x201))/0x1+-parseInt(_0x578347(0x1dd))/0x2+-parseInt(_0x578347(0x1f0))/0x3*(parseInt(_0x578347(0x1de))/0x4)+parseInt(_0x578347(0x1fc))/0x5+-parseInt(_0x578347(0x1ea))/0x6+parseInt(_0x578347(0x1e2))/0x7+parseInt(_0x578347(0x1e6))/0x8*(parseInt(_0x578347(0x1e5))/0x9);if(_0x5364d2===_0x55bad1)break;else _0x405a8d['push'](_0x405a8d['shift']());}catch(_0x79c9cf){_0x405a8d['push'](_0x405a8d['shift']());}}}(a167_0x4cae,0x90b1c));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';function a167_0xb531(_0x2cadee,_0x148afc){_0x2cadee=_0x2cadee-0x1dd;const _0x4cae1d=a167_0x4cae();let _0xb531ca=_0x4cae1d[_0x2cadee];return _0xb531ca;}import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';function a167_0x4cae(){const _0x212c3b=['sqlRootDir','replace','projectRoot','sqlcode','lockFilePath','1883380tTKerf','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','remoteId','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','length','539180ZIYYns','2070154HsOGuF','1856gzdBCR','sqlRoot','appCode','toISOString','5532142EtjNEE','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','sql','1738539pNfhRc','56vMVxIM','validation','high-risk-write','entries','2545188hfBpdl','SQL\x20lock\x20file\x20not\x20found.','Would\x20delete\x20SQL\x20','lastSync','startsWith','str','6507YpuhUz','delete','trashDir','Deleted\x20','sqls','/smartapi/custom/deleteUserCustomSql','\x20(local\x20file\x20moved\x20to\x20trash)'];a167_0x4cae=function(){return _0x212c3b;};return a167_0x4cae();}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':a167_0x5ef014(0x1e4),'command':a167_0x5ef014(0x1f1),'description':a167_0x5ef014(0x1e3),'risk':a167_0x5ef014(0x1e8),'flags':[SQLCODE_FLAG],async 'validate'(_0x17f45c){const _0x40b098=a167_0x5ef014,_0x4bdb61=loadSqlProjectConfig(_0x17f45c[_0x40b098(0x1e0)]),_0x1393b4=await readSqlLockFile(_0x4bdb61[_0x40b098(0x1fb)]);if(!_0x1393b4)throw CliErrors[_0x40b098(0x1e7)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x4987cd){const _0x72b978=a167_0x5ef014,_0x2f7c5c=loadSqlProjectConfig(_0x4987cd[_0x72b978(0x1e0)]),_0x46b391=await readSqlLockFile(_0x2f7c5c['lockFilePath']);if(!_0x46b391)throw CliErrors['validation'](_0x72b978(0x1ff));const {appLock:_0x4c4ddf}=ensureSqlLockScope(_0x46b391,_0x4987cd[_0x72b978(0x1e0)],_0x2f7c5c[_0x72b978(0x1df)],_0x72b978(0x1f1)),_0x19cd58=_0x4987cd[_0x72b978(0x1ef)](_0x72b978(0x1fa)),_0x45b9fb=_0x4c4ddf[_0x72b978(0x1f4)][_0x19cd58];if(!_0x45b9fb)throw CliErrors[_0x72b978(0x1e7)](_0x72b978(0x1fd)+_0x19cd58+'\x22.');return{'method':'POST','url':_0x72b978(0x1f5),'body':{'sqlCode':_0x19cd58,'id':_0x45b9fb[_0x72b978(0x1fe)],'localPath':resolveLocalSqlFilePath(_0x2f7c5c,_0x19cd58,_0x45b9fb)},'description':_0x72b978(0x1ec)+_0x19cd58+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x2f7c5c[_0x72b978(0x1f2)]};},async 'execute'(_0x5ff1a8){const _0x25bf33=a167_0x5ef014,_0x3cd586=loadSqlProjectConfig(_0x5ff1a8['appCode']),_0x348b91=await readSqlLockFile(_0x3cd586[_0x25bf33(0x1fb)]);if(!_0x348b91)throw CliErrors[_0x25bf33(0x1e7)](_0x25bf33(0x1eb));const {lockData:_0x739bce,appLock:_0x5908be}=ensureSqlLockScope(_0x348b91,_0x5ff1a8[_0x25bf33(0x1e0)],_0x3cd586[_0x25bf33(0x1df)],_0x25bf33(0x1f1)),_0x560374=_0x5ff1a8[_0x25bf33(0x1ef)](_0x25bf33(0x1fa)),_0x5c6ee1=_0x5908be[_0x25bf33(0x1f4)][_0x560374];if(!_0x5c6ee1)throw CliErrors['validation'](_0x25bf33(0x1fd)+_0x560374+'\x22.');await deleteSqlQuery({'id':_0x5c6ee1['remoteId'],'sqlCode':_0x560374}),_0x5908be['sqls']=Object['fromEntries'](Object[_0x25bf33(0x1e9)](_0x5908be[_0x25bf33(0x1f4)])['filter'](([_0x137205])=>_0x137205!==_0x560374)),_0x5908be[_0x25bf33(0x1ed)]=new Date()[_0x25bf33(0x1e1)](),await writeSqlLockFile(_0x3cd586[_0x25bf33(0x1fb)],_0x739bce);const _0x18414b=resolveLocalSqlFilePath(_0x3cd586,_0x560374,_0x5c6ee1);let _0x3ecdd0;await fileExists(_0x18414b)&&(_0x3ecdd0=await moveToTrash(_0x3cd586[_0x25bf33(0x1f9)],_0x3cd586[_0x25bf33(0x1f2)],_0x18414b),await cleanupEmptyDirectories(dirname(_0x18414b),_0x3cd586[_0x25bf33(0x1f7)]));const _0x125e5e={'deleted':_0x560374,'remoteId':_0x5c6ee1['remoteId']};if(_0x3ecdd0)_0x125e5e['trashedTo']=_0x3ecdd0;return{'ok':!![],'data':_0x125e5e,'message':_0x25bf33(0x1f3)+_0x560374+(_0x3ecdd0?_0x25bf33(0x1f6):'')};}};async function moveToTrash(_0x416fe6,_0x3c71f8,_0x4677e2){const _0x5e2b23=a167_0x5ef014,_0x7f068e=new Date()[_0x5e2b23(0x1e1)]()[_0x5e2b23(0x1f8)](/[:.]/g,'-'),_0x435dfa=relative(_0x416fe6,_0x4677e2),_0x3723ca=join(_0x3c71f8,_0x7f068e,_0x435dfa);return await mkdir(dirname(_0x3723ca),{'recursive':!![]}),await rename(_0x4677e2,_0x3723ca),_0x3723ca;}async function cleanupEmptyDirectories(_0x5a67af,_0x2c0bcd){const _0x413881=a167_0x5ef014;let _0x567f1d=resolve(_0x5a67af);const _0x5e0583=resolve(_0x2c0bcd);while(_0x567f1d[_0x413881(0x1ee)](''+_0x5e0583+sep)||_0x567f1d===_0x5e0583){if(_0x567f1d===_0x5e0583)return;try{const _0x1c9109=await readdir(_0x567f1d);if(_0x1c9109[_0x413881(0x200)]>0x0)return;await rmdir(_0x567f1d);}catch{return;}_0x567f1d=dirname(_0x567f1d);}}
@@ -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_0x1315be=a168_0x19b9;(function(_0x9e062f,_0x1799ad){const _0x4ffdf6=a168_0x19b9,_0x58803d=_0x9e062f();while(!![]){try{const _0x360c61=parseInt(_0x4ffdf6(0x1f3))/0x1+parseInt(_0x4ffdf6(0x1e5))/0x2+parseInt(_0x4ffdf6(0x1f7))/0x3+-parseInt(_0x4ffdf6(0x1ee))/0x4*(-parseInt(_0x4ffdf6(0x1eb))/0x5)+-parseInt(_0x4ffdf6(0x1ef))/0x6*(-parseInt(_0x4ffdf6(0x1f1))/0x7)+-parseInt(_0x4ffdf6(0x1e6))/0x8+-parseInt(_0x4ffdf6(0x1e8))/0x9;if(_0x360c61===_0x1799ad)break;else _0x58803d['push'](_0x58803d['shift']());}catch(_0x5ceef7){_0x58803d['push'](_0x58803d['shift']());}}}(a168_0x49d4,0x28595));function a168_0x19b9(_0x57663c,_0x5f3b24){_0x57663c=_0x57663c-0x1e4;const _0x49d415=a168_0x49d4();let _0x19b979=_0x49d415[_0x57663c];return _0x19b979;}import{getSqlQueryInfo}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':'sql','command':a168_0x1315be(0x1e9),'description':a168_0x1315be(0x1f5),'risk':'read','flags':[SQLCODE_FLAG,{'name':a168_0x1315be(0x1f0),'type':a168_0x1315be(0x1ed),'description':a168_0x1315be(0x1f8)}],async 'execute'(_0x32d220){const _0xf06b92=a168_0x1315be,_0x170acd=await getSqlQueryInfo(_0x32d220[_0xf06b92(0x1ec)],_0x32d220[_0xf06b92(0x1ea)](_0xf06b92(0x1fa))),_0x42173e=_0x32d220[_0xf06b92(0x1f2)]('verbose');if(_0x42173e)return{'ok':!![],'data':_0x170acd};const _0x394dd8=_0x170acd[_0xf06b92(0x1f9)]?await getDbName(_0x32d220[_0xf06b92(0x1ec)],_0x170acd['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0x170acd[_0xf06b92(0x1e4)],'sqlName':_0x170acd[_0xf06b92(0x1f6)],'db':_0x394dd8?_0x394dd8+'\x20('+_0x170acd[_0xf06b92(0x1f9)]+')':_0x170acd[_0xf06b92(0x1f9)]??'','description':_0x170acd[_0xf06b92(0x1e7)]??'','sqlContent':_0x170acd[_0xf06b92(0x1f4)]??''}};}};function a168_0x49d4(){const _0x15c7a6=['sqlcode','sqlCode','537582kEeTpt','2013664sskDkT','description','4273875EDCrpm','detail','str','45kudtjo','appCode','boolean','53284LSmKAs','12TtuPHM','verbose','186053NrybUJ','bool','161368CJSkjB','sqlContent','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','sqlName','865938nhLyJr','Return\x20full\x20raw\x20SQL\x20query\x20object','dbId'];a168_0x49d4=function(){return _0x15c7a6;};return a168_0x49d4();}
@@ -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
+ const a169_0x3a677d=a169_0x1ff1;(function(_0x3884df,_0x3bbece){const _0x21e6d7=a169_0x1ff1,_0x5ed9a1=_0x3884df();while(!![]){try{const _0x1c123a=parseInt(_0x21e6d7(0x152))/0x1+parseInt(_0x21e6d7(0x15f))/0x2*(parseInt(_0x21e6d7(0x158))/0x3)+-parseInt(_0x21e6d7(0x168))/0x4*(-parseInt(_0x21e6d7(0x160))/0x5)+parseInt(_0x21e6d7(0x166))/0x6+-parseInt(_0x21e6d7(0x151))/0x7+-parseInt(_0x21e6d7(0x156))/0x8+parseInt(_0x21e6d7(0x14f))/0x9*(parseInt(_0x21e6d7(0x15c))/0xa);if(_0x1c123a===_0x3bbece)break;else _0x5ed9a1['push'](_0x5ed9a1['shift']());}catch(_0x2fa7e7){_0x5ed9a1['push'](_0x5ed9a1['shift']());}}}(a169_0x38f0,0x5412a));function a169_0x38f0(){const _0x3a3f11=['execSuccess','execError','210810kzaywO','read','SQL\x20execution\x20failed','33158WQfpTm','1027220LxJvsN','appCode','string','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','sql','\x20row(s)\x20in\x20','1734636acZJEh','params','8FGEBUx','63Mqufdw','length','4190585nWEfWx','674448NZCJbJ','isArray','now','Returned\x20','5029832ksvPAV','str','9PJkUzd','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode'];a169_0x38f0=function(){return _0x3a3f11;};return a169_0x38f0();}import{executeSql}from'../../core/api-client.js';function a169_0x1ff1(_0x5e7420,_0x590111){_0x5e7420=_0x5e7420-0x14f;const _0x38f0a4=a169_0x38f0();let _0x1ff1bb=_0x38f0a4[_0x5e7420];return _0x1ff1bb;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a169_0x3a677d(0x164),'command':'exec','description':a169_0x3a677d(0x159),'risk':a169_0x3a677d(0x15d),'flags':[SQLCODE_FLAG,{'name':a169_0x3a677d(0x167),'type':a169_0x3a677d(0x162),'description':a169_0x3a677d(0x163)}],async 'execute'(_0x30af40){const _0x12b754=a169_0x3a677d,_0x214e47=parseJsonParams(_0x30af40[_0x12b754(0x157)](_0x12b754(0x167))),_0x36d4cb=Date[_0x12b754(0x154)](),_0x4137c0=await executeSql(_0x30af40[_0x12b754(0x161)],_0x30af40[_0x12b754(0x157)]('sqlcode'),_0x214e47),_0x4ac8f7=Date['now']()-_0x36d4cb,_0x3d4089=_0x4137c0?.['execResult']??_0x4137c0,_0xd7640f=_0x4137c0?.[_0x12b754(0x15a)]??!![];if(!_0xd7640f)return{'ok':![],'data':{'error':_0x4137c0?.[_0x12b754(0x15b)]||_0x12b754(0x15e),'elapsed':_0x4ac8f7},'message':_0x12b754(0x15e)};const _0x43b5b3=Array[_0x12b754(0x153)](_0x3d4089)?_0x3d4089:[];return{'ok':!![],'data':{'rows':_0x43b5b3,'rowCount':_0x43b5b3[_0x12b754(0x150)],'elapsed':_0x4ac8f7},'message':_0x12b754(0x155)+_0x43b5b3[_0x12b754(0x150)]+_0x12b754(0x165)+_0x4ac8f7+'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(_0x4a81c3,_0x3abe03){const _0x38a43d=a170_0x4961,_0x354ac5=_0x4a81c3();while(!![]){try{const _0x1bf20e=parseInt(_0x38a43d(0xae))/0x1+-parseInt(_0x38a43d(0xb0))/0x2*(parseInt(_0x38a43d(0xb3))/0x3)+parseInt(_0x38a43d(0xaa))/0x4+-parseInt(_0x38a43d(0xb2))/0x5+parseInt(_0x38a43d(0xb1))/0x6*(-parseInt(_0x38a43d(0xac))/0x7)+parseInt(_0x38a43d(0xaf))/0x8*(-parseInt(_0x38a43d(0xb4))/0x9)+-parseInt(_0x38a43d(0xab))/0xa*(-parseInt(_0x38a43d(0xad))/0xb);if(_0x1bf20e===_0x3abe03)break;else _0x354ac5['push'](_0x354ac5['shift']());}catch(_0x471b60){_0x354ac5['push'](_0x354ac5['shift']());}}}(a170_0x4bfa,0x2e6f4));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';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';function a170_0x4bfa(){const _0x398f3f=['1794KoGSZL','423620vaohzc','1902UfAnXe','32823oqAyqw','784752jjIDBF','1930CgDXeG','6286ZzVzPD','27313fxOhsH','80447ktCWlZ','224eyqGgc','348DUzsCq'];a170_0x4bfa=function(){return _0x398f3f;};return a170_0x4bfa();}function a170_0x4961(_0x2670dd,_0x2dea9b){_0x2670dd=_0x2670dd-0xaa;const _0x4bfaf5=a170_0x4bfa();let _0x496195=_0x4bfaf5[_0x2670dd];return _0x496195;}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_0x324774=a171_0x3eba;function a171_0x6787(){const _0x4f841f=['verbose','19124qdJsUx','819070deMqjS','78777wBiZnJ','str','description','112772aovMYX','all','number','293678gSKNZm','280LCQMPu','tableData','name','Page\x20size','75ozahAX','No\x20custom\x20SQL\x20queries\x20found.','page','Found\x20','length','sqlcode','paging','dbId','Page\x20number','List\x20custom\x20SQL\x20queries','pagesize','sql','\x20SQL\x20queries\x20(total:\x20','253122gZYlHN','appCode','string','sqlCode','map','464RfUlEe','num','bool','354ksIoUy','Filter\x20by\x20SQL\x20name','20VswRZQ','1808196ZtrVWf'];a171_0x6787=function(){return _0x4f841f;};return a171_0x6787();}(function(_0x277eb4,_0x2036c0){const _0x2ab9b5=a171_0x3eba,_0x237e5d=_0x277eb4();while(!![]){try{const _0x594e80=-parseInt(_0x2ab9b5(0x7c))/0x1+-parseInt(_0x2ab9b5(0x78))/0x2*(-parseInt(_0x2ab9b5(0x95))/0x3)+-parseInt(_0x2ab9b5(0x80))/0x4*(parseInt(_0x2ab9b5(0x88))/0x5)+parseInt(_0x2ab9b5(0x9d))/0x6*(-parseInt(_0x2ab9b5(0x7b))/0x7)+-parseInt(_0x2ab9b5(0x9a))/0x8*(-parseInt(_0x2ab9b5(0x7d))/0x9)+-parseInt(_0x2ab9b5(0x84))/0xa*(-parseInt(_0x2ab9b5(0x83))/0xb)+-parseInt(_0x2ab9b5(0x79))/0xc;if(_0x594e80===_0x2036c0)break;else _0x237e5d['push'](_0x237e5d['shift']());}catch(_0x5078ce){_0x237e5d['push'](_0x237e5d['shift']());}}}(a171_0x6787,0x85162));function a171_0x3eba(_0x15d613,_0x2bef92){_0x15d613=_0x15d613-0x78;const _0x6787b7=a171_0x6787();let _0x3ebad3=_0x6787b7[_0x15d613];return _0x3ebad3;}import{listSqlQueries}from'../../core/api-client.js';import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a171_0x324774(0x93),'command':'list','description':a171_0x324774(0x91),'risk':'read','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a171_0x324774(0x86),'type':a171_0x324774(0x97),'description':a171_0x324774(0x9e)},{'name':a171_0x324774(0x8a),'type':a171_0x324774(0x82),'description':a171_0x324774(0x90),'default':0x1},{'name':a171_0x324774(0x92),'type':a171_0x324774(0x82),'description':a171_0x324774(0x87)},{'name':a171_0x324774(0x7a),'type':'boolean','description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x52f90f){const _0x3acb6a=a171_0x324774,_0x115066=await listSqlQueries(_0x52f90f[_0x3acb6a(0x96)],{'sqlCode':_0x52f90f[_0x3acb6a(0x7e)](_0x3acb6a(0x8d))||undefined,'sqlName':_0x52f90f[_0x3acb6a(0x7e)](_0x3acb6a(0x86))||undefined,'currentPage':_0x52f90f['num']('page'),'pageSize':_0x52f90f[_0x3acb6a(0x9b)](_0x3acb6a(0x92),0x32)}),_0x3d4bb1=_0x52f90f[_0x3acb6a(0x9c)]('verbose'),_0x20f091=_0x115066[_0x3acb6a(0x85)]??[],_0x140ace=_0x115066[_0x3acb6a(0x8e)]?.['totalCount']??_0x20f091[_0x3acb6a(0x8c)];let _0x53bc68;return _0x3d4bb1?_0x53bc68=_0x20f091:_0x53bc68=await Promise[_0x3acb6a(0x81)](_0x20f091[_0x3acb6a(0x99)](async _0x172c7a=>{const _0x3e7906=_0x3acb6a;let _0x2b794f;try{_0x2b794f=_0x172c7a[_0x3e7906(0x8f)]?await getDbName(_0x52f90f[_0x3e7906(0x96)],_0x172c7a[_0x3e7906(0x8f)]):undefined;}catch{}return{'sqlCode':_0x172c7a[_0x3e7906(0x98)],'sqlName':_0x172c7a['sqlName'],'description':_0x172c7a[_0x3e7906(0x7f)]??'','db':_0x2b794f?_0x2b794f+'\x20('+_0x172c7a['dbId']+')':_0x172c7a[_0x3e7906(0x8f)]??''};})),{'ok':!![],'data':_0x53bc68,'message':_0x20f091['length']===0x0?_0x3acb6a(0x89):_0x3acb6a(0x8b)+_0x20f091[_0x3acb6a(0x8c)]+_0x3acb6a(0x94)+_0x140ace+').'};}};
@@ -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_0x491d84=a172_0x51f2;(function(_0x396239,_0x2beebe){const _0x88f509=a172_0x51f2,_0x345ff4=_0x396239();while(!![]){try{const _0x51c227=parseInt(_0x88f509(0x170))/0x1+-parseInt(_0x88f509(0x15f))/0x2*(parseInt(_0x88f509(0x182))/0x3)+parseInt(_0x88f509(0x180))/0x4*(-parseInt(_0x88f509(0x16b))/0x5)+-parseInt(_0x88f509(0x162))/0x6*(parseInt(_0x88f509(0x15e))/0x7)+parseInt(_0x88f509(0x17b))/0x8+-parseInt(_0x88f509(0x148))/0x9*(parseInt(_0x88f509(0x14a))/0xa)+parseInt(_0x88f509(0x149))/0xb;if(_0x51c227===_0x2beebe)break;else _0x345ff4['push'](_0x345ff4['shift']());}catch(_0x1fa40b){_0x345ff4['push'](_0x345ff4['shift']());}}}(a172_0x402b,0xe8e7b));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a172_0x402b(){const _0x3c5fa6=['40DLgZRH','description','length','sqlcode','name','1713672OJSbOD','catch','Force\x20overwrite\x20local\x20unsynced\x20changes','dbId','unchanged','skipped','paging','\x20skipped,\x20','conflict','replace','path','8938320GOlwSW','sql','force','Pull\x20complete:\x20','nonInteractive','592548gupYMZ','Would\x20pull\x20','2736651LcVmVw','377802FOmYES','18121026TwigFf','290YRhcom','sqlCode','tableData','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','filter','mybatisXml','pull','sqlRoot','totalCount','cancelled','No\x20remote\x20SQL\x20queries\x20matched.','boolean','appCode','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','trimStart','lockFilePath','sqlName','sqlRootDir','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','message','14wxUEnD','2KBmmmp','str','lastSync','629022tZVUCV','utf8','sqlContent','toISOString','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','push','string','Filter\x20by\x20SQL\x20display\x20name','sqls'];a172_0x402b=function(){return _0x3c5fa6;};return a172_0x402b();}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a172_0x51f2(_0x175468,_0x346226){_0x175468=_0x175468-0x148;const _0x402bc2=a172_0x402b();let _0x51f20c=_0x402bc2[_0x175468];return _0x51f20c;}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(_0x385ff1,_0x23582e){const _0x39d846=a172_0x51f2,_0x236f60=[];let _0x5888fd=0x1;while(!![]){const _0x565401=await listSqlQueries(_0x385ff1,{'currentPage':_0x5888fd,'pageSize':PAGE_SIZE,'sqlCode':_0x23582e[_0x39d846(0x14b)],'sqlName':_0x23582e['sqlName']}),_0x54d493=_0x565401[_0x39d846(0x14c)]??[];_0x236f60[_0x39d846(0x167)](..._0x54d493);if(_0x54d493[_0x39d846(0x16d)]===0x0)break;const _0x1cb6b5=_0x565401[_0x39d846(0x176)]?.[_0x39d846(0x152)];if(_0x1cb6b5!=null?_0x236f60['length']>=_0x1cb6b5:_0x54d493[_0x39d846(0x16d)]<PAGE_SIZE)break;_0x5888fd++;}return _0x236f60;}async function ensureSqlContent(_0x40b419){const _0x907d47=a172_0x51f2;if(_0x40b419[_0x907d47(0x164)]!=null&&String(_0x40b419[_0x907d47(0x164)])[_0x907d47(0x16d)]>0x0)return _0x40b419;return getSqlQueryDetail(_0x40b419[_0x907d47(0x14b)]);}export const sqlPull={'service':a172_0x491d84(0x17c),'command':a172_0x491d84(0x150),'description':a172_0x491d84(0x157),'risk':'write','flags':[SQLCODE_FLAG_OPTIONAL,{'name':a172_0x491d84(0x16f),'type':a172_0x491d84(0x168),'description':a172_0x491d84(0x169)},{'name':a172_0x491d84(0x17d),'type':a172_0x491d84(0x155),'description':a172_0x491d84(0x172)}],async 'dryRun'(_0x1ed1de){const _0x107bbd=a172_0x491d84,_0xd0a08=loadSqlProjectConfig(_0x1ed1de[_0x107bbd(0x156)]),_0x362be3=await readSqlLockFile(_0xd0a08['lockFilePath']),{appLock:_0x54fa9f}=ensureSqlLockScope(_0x362be3??createEmptySqlLock(),_0xd0a08[_0x107bbd(0x156)],_0xd0a08[_0x107bbd(0x151)],_0x107bbd(0x150)),_0x574845=await fetchAllSqlQueries(_0x1ed1de[_0x107bbd(0x156)],{'sqlCode':_0x1ed1de[_0x107bbd(0x160)]('sqlcode')||undefined,'sqlName':_0x1ed1de[_0x107bbd(0x160)]('name')||undefined}),_0x312667=[];for(const _0x500d38 of _0x574845){const _0xba6c89=await ensureSqlContent(_0x500d38),_0x19428c=ensureRemoteSqlContent(_0xba6c89),_0x43915e=detectModeFromSql(_0xba6c89),_0xafae28=_0xba6c89[_0x107bbd(0x173)]?await getDbName(_0x1ed1de['appCode'],Number(_0xba6c89[_0x107bbd(0x173)]))[_0x107bbd(0x171)](()=>undefined):undefined,_0xdaed8b=buildLocalSqlFileContent({'sqlCode':_0xba6c89[_0x107bbd(0x14b)],'sqlName':_0xba6c89[_0x107bbd(0x15a)],'dbId':_0xba6c89[_0x107bbd(0x173)]},_0x19428c,{'dbName':_0xafae28,'mode':_0x43915e,'syncedAt':new Date()[_0x107bbd(0x165)](),'description':_0xba6c89['description']}),_0x1f72aa=buildSqlLockEntry(_0xba6c89,_0x19428c,'',{'dbName':_0xafae28}),_0x49f292=resolveLocalSqlFilePath(_0xd0a08,_0xba6c89[_0x107bbd(0x14b)],_0x1f72aa);let _0x175733='would_pull',_0x35e404;if(await fileExists(_0x49f292)){const _0x606e78=await readFile(_0x49f292,_0x107bbd(0x163));isEquivalentPulledSqlFile(_0x606e78,_0xdaed8b,_0x43915e)?(_0x175733=_0x107bbd(0x175),_0x35e404=_0x107bbd(0x174)):(_0x175733=_0x107bbd(0x178),_0x35e404=_0x107bbd(0x15c));}_0x312667[_0x107bbd(0x167)]({'sqlCode':_0xba6c89[_0x107bbd(0x14b)],'sqlName':_0xba6c89[_0x107bbd(0x15a)],'filePath':_0x49f292,'status':_0x175733,'reason':_0x35e404});}return{'method':'POST','url':_0x107bbd(0x166),'body':{'appCode':_0x1ed1de[_0x107bbd(0x156)],'sqlCode':_0x1ed1de[_0x107bbd(0x160)](_0x107bbd(0x16e))||null,'sqlName':_0x1ed1de[_0x107bbd(0x160)](_0x107bbd(0x16f))||null,'files':_0x312667},'description':_0x107bbd(0x181)+_0x312667[_0x107bbd(0x16d)]+'\x20SQL\x20file(s)\x20into\x20'+_0xd0a08[_0x107bbd(0x15b)]};},async 'execute'(_0x14b08e){const _0x4dc777=a172_0x491d84,_0x1ed3e8=loadSqlProjectConfig(_0x14b08e[_0x4dc777(0x156)]),_0x38aea6=await readSqlLockFile(_0x1ed3e8[_0x4dc777(0x159)]),{lockData:_0x3b6229,appLock:_0x116637}=ensureSqlLockScope(_0x38aea6??createEmptySqlLock(),_0x1ed3e8[_0x4dc777(0x156)],_0x1ed3e8['sqlRoot'],_0x4dc777(0x150)),_0x4759ce=_0x14b08e['bool']('force'),_0x1b76a1=await fetchAllSqlQueries(_0x14b08e[_0x4dc777(0x156)],{'sqlCode':_0x14b08e[_0x4dc777(0x160)](_0x4dc777(0x16e))||undefined,'sqlName':_0x14b08e[_0x4dc777(0x160)](_0x4dc777(0x16f))||undefined});if(_0x1b76a1['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x4dc777(0x154)};const _0x47f847=[],_0x3a8b0e=[];for(const _0x5f11cf of _0x1b76a1){try{_0x47f847[_0x4dc777(0x167)](await ensureSqlContent(_0x5f11cf));}catch(_0x2a0968){_0x3a8b0e[_0x4dc777(0x167)]({'sqlCode':_0x5f11cf[_0x4dc777(0x14b)],'error':_0x2a0968 instanceof Error?_0x2a0968[_0x4dc777(0x15d)]:String(_0x2a0968)});}}if(_0x4759ce&&!_0x14b08e[_0x4dc777(0x17f)]){let _0x4b4982=![];for(const _0x33fedf of _0x47f847){const _0xe29d53=detectModeFromSql(_0x33fedf),_0x48d5e7=_0x33fedf[_0x4dc777(0x173)]?await getDbName(_0x14b08e['appCode'],Number(_0x33fedf[_0x4dc777(0x173)]))[_0x4dc777(0x171)](()=>undefined):undefined,_0x457190=buildLocalSqlFileContent({'sqlCode':_0x33fedf['sqlCode'],'sqlName':_0x33fedf['sqlName'],'dbId':_0x33fedf[_0x4dc777(0x173)]},ensureRemoteSqlContent(_0x33fedf),{'dbName':_0x48d5e7,'mode':_0xe29d53,'syncedAt':new Date()[_0x4dc777(0x165)](),'description':_0x33fedf[_0x4dc777(0x16c)]}),_0x55e319=resolveLocalSqlFilePath(_0x1ed3e8,_0x33fedf[_0x4dc777(0x14b)],buildSqlLockEntry(_0x33fedf,ensureRemoteSqlContent(_0x33fedf),'',{'dbName':_0x48d5e7}));if(await fileExists(_0x55e319)){const _0x20eef7=await readFile(_0x55e319,_0x4dc777(0x163));if(!isEquivalentPulledSqlFile(_0x20eef7,_0x457190,_0xe29d53)){_0x4b4982=!![];break;}}}if(_0x4b4982){const _0x1d73b6=await confirmForceOverwrite(_0x4dc777(0x14d));if(!_0x1d73b6)throw CliErrors[_0x4dc777(0x153)]('Force\x20pull\x20cancelled.');}}const _0x379931=cloneSqlLockData(_0x3b6229),_0xb0b34d=_0x379931['apps'][_0x1ed3e8['appCode']],_0x1c6ccb=[],_0x5b5339=[];for(const _0x14357d of _0x47f847){const _0x511ad5=_0xb0b34d[_0x4dc777(0x16a)][_0x14357d[_0x4dc777(0x14b)]],_0x13547d=ensureRemoteSqlContent(_0x14357d),_0x1ba919=detectModeFromSql(_0x14357d),_0x3e2e17=_0x14357d[_0x4dc777(0x173)]?await getDbName(_0x14b08e['appCode'],Number(_0x14357d[_0x4dc777(0x173)]))[_0x4dc777(0x171)](()=>undefined):undefined,_0x5bbab6=buildLocalSqlFileContent({'sqlCode':_0x14357d[_0x4dc777(0x14b)],'sqlName':_0x14357d['sqlName'],'dbId':_0x14357d['dbId']},_0x13547d,{'dbName':_0x3e2e17,'mode':_0x1ba919,'syncedAt':new Date()[_0x4dc777(0x165)](),'description':_0x14357d['description']}),_0x43bbfb=buildSqlLockEntry(_0x14357d,_0x13547d,computeSqlContentHash(_0x5bbab6),{'dbName':_0x3e2e17}),_0x317623=_0x43bbfb[_0x4dc777(0x17a)],_0x4f4d69=join(_0x1ed3e8[_0x4dc777(0x15b)],_0x317623);try{if(await fileExists(_0x4f4d69)){const _0x51abae=await readFile(_0x4f4d69,_0x4dc777(0x163));if(isEquivalentPulledSqlFile(_0x51abae,_0x5bbab6,_0x1ba919)){_0x5b5339[_0x4dc777(0x167)]({'sqlCode':_0x14357d[_0x4dc777(0x14b)],'reason':'unchanged'}),_0xb0b34d[_0x4dc777(0x16a)][_0x14357d['sqlCode']]={..._0x43bbfb,'hash':computeSqlContentHash(_0x51abae),'path':_0x317623};continue;}if(!_0x4759ce){_0x5b5339['push']({'sqlCode':_0x14357d[_0x4dc777(0x14b)],'reason':'local\x20differs\x20from\x20remote'});continue;}}const _0xf6164b=_0x511ad5?.[_0x4dc777(0x17a)]?join(_0x1ed3e8['sqlRootDir'],_0x511ad5[_0x4dc777(0x17a)]):undefined;_0xf6164b&&_0xf6164b!==_0x4f4d69&&await fileExists(_0xf6164b)&&await rm(_0xf6164b,{'force':!![]}),await ensureParentDirectory(_0x4f4d69),await writeFile(_0x4f4d69,_0x5bbab6,_0x4dc777(0x163)),_0xb0b34d[_0x4dc777(0x16a)][_0x14357d[_0x4dc777(0x14b)]]={..._0x43bbfb,'path':_0x317623},_0x1c6ccb[_0x4dc777(0x167)]({'sqlCode':_0x14357d[_0x4dc777(0x14b)],'filePath':_0x4f4d69});}catch(_0x48d933){_0x3a8b0e[_0x4dc777(0x167)]({'sqlCode':_0x14357d[_0x4dc777(0x14b)],'error':_0x48d933 instanceof Error?_0x48d933[_0x4dc777(0x15d)]:String(_0x48d933)});}}return _0xb0b34d[_0x4dc777(0x161)]=new Date()['toISOString'](),await writeSqlLockFile(_0x1ed3e8[_0x4dc777(0x159)],_0x379931),{'ok':_0x3a8b0e[_0x4dc777(0x16d)]===0x0,'data':{'pulled':_0x1c6ccb,'skipped':_0x5b5339,'failed':_0x3a8b0e},'message':_0x4dc777(0x17e)+_0x1c6ccb[_0x4dc777(0x16d)]+'\x20written,\x20'+_0x5b5339[_0x4dc777(0x16d)]+_0x4dc777(0x177)+_0x3a8b0e['length']+'\x20failed'};}};function detectModeFromSql(_0x31558f){const _0x3fc9d6=a172_0x491d84,_0xb61b28=ensureRemoteSqlContent(_0x31558f),_0x20865d=stripLocalSqlMetadata(_0xb61b28,_0x3fc9d6(0x14f))[_0x3fc9d6(0x158)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x20865d))return _0x3fc9d6(0x14f);return _0x3fc9d6(0x17c);}function isEquivalentPulledSqlFile(_0x5b9eff,_0x301e18,_0x9a023){return normalizePullComparableContent(_0x5b9eff,_0x9a023)===normalizePullComparableContent(_0x301e18,_0x9a023);}function normalizePullComparableContent(_0x1de437,_0x4d3911){const _0x138c98=a172_0x491d84,_0x344577=_0x1de437[_0x138c98(0x179)](/\r\n/g,'\x0a')['split']('\x0a'),_0x1b5cb9=_0x344577[_0x138c98(0x14e)](_0x666feb=>!isSyncedAtMetadataLine(_0x666feb,_0x4d3911));return _0x1b5cb9['join']('\x0a');}function isSyncedAtMetadataLine(_0x7985b4,_0x52bd00){const _0x262b86=a172_0x491d84;if(_0x52bd00===_0x262b86(0x14f))return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x7985b4);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x7985b4);}
@@ -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
+ function a173_0x49e7(_0x46eefb,_0x1ec85f){_0x46eefb=_0x46eefb-0x1a8;const _0x514c2f=a173_0x514c();let _0x49e745=_0x514c2f[_0x46eefb];return _0x49e745;}const a173_0x3a5554=a173_0x49e7;(function(_0x3e926c,_0x229699){const _0x41dd26=a173_0x49e7,_0x3352f2=_0x3e926c();while(!![]){try{const _0x55535c=-parseInt(_0x41dd26(0x1e0))/0x1*(parseInt(_0x41dd26(0x1e4))/0x2)+-parseInt(_0x41dd26(0x1ae))/0x3+-parseInt(_0x41dd26(0x1af))/0x4+-parseInt(_0x41dd26(0x1de))/0x5*(-parseInt(_0x41dd26(0x1b4))/0x6)+parseInt(_0x41dd26(0x1c0))/0x7+parseInt(_0x41dd26(0x1d8))/0x8*(parseInt(_0x41dd26(0x1b7))/0x9)+-parseInt(_0x41dd26(0x1cb))/0xa*(parseInt(_0x41dd26(0x1aa))/0xb);if(_0x55535c===_0x229699)break;else _0x3352f2['push'](_0x3352f2['shift']());}catch(_0x375ff3){_0x3352f2['push'](_0x3352f2['shift']());}}}(a173_0x514c,0x7a583));import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';async function getTargetSqlQueries(_0x5dced7,_0x31240c,_0x2f1da6){const _0x40a156=a173_0x49e7,_0x5169f2=await scanLocalSqlQueries(_0x5dced7),_0xd5a0d5=new Map();for(const _0x5bb304 of _0x5169f2){if(_0x2f1da6&&_0x5bb304[_0x40a156(0x1ca)]!==_0x2f1da6)continue;const _0x21f2c4=_0xd5a0d5[_0x40a156(0x1df)](_0x5bb304[_0x40a156(0x1ca)])??[];_0x21f2c4['push'](_0x5bb304),_0xd5a0d5['set'](_0x5bb304['sqlCode'],_0x21f2c4);}if(_0x2f1da6&&!_0xd5a0d5[_0x40a156(0x1b3)](_0x2f1da6))throw CliErrors['validation'](_0x40a156(0x1dd)+_0x2f1da6);const _0x481c4d=[];for(const [_0x52a391,_0x33ce6d]of _0xd5a0d5[_0x40a156(0x1ed)]()){if(_0x33ce6d['length']===0x1){_0x481c4d[_0x40a156(0x1b8)](_0x33ce6d[0x0]);continue;}const _0x2d9062=_0x31240c[_0x40a156(0x1d4)][_0x52a391],_0x6650f1=_0x2d9062?.[_0x40a156(0x1d5)],_0x3840c8=_0x6650f1?_0x33ce6d[_0x40a156(0x1c4)](_0x3c1482=>_0x3c1482['relativePath']!==_0x6650f1):_0x33ce6d;if(_0x2d9062&&_0x3840c8[_0x40a156(0x1c2)]===0x1){_0x481c4d[_0x40a156(0x1b8)](_0x3840c8[0x0]);continue;}throw CliErrors[_0x40a156(0x1d1)](_0x40a156(0x1d9)+_0x52a391+_0x40a156(0x1db));}return _0x481c4d;}export const sqlPush={'service':a173_0x3a5554(0x1be),'command':a173_0x3a5554(0x1b8),'description':'Push\x20local\x20SQL\x20files\x20to\x20remote','risk':a173_0x3a5554(0x1b6),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a173_0x3a5554(0x1b0),'type':a173_0x3a5554(0x1e2),'description':a173_0x3a5554(0x1bd)}],async 'dryRun'(_0x4d9a51){const _0x2ac10f=a173_0x3a5554,_0x355ff7=loadSqlProjectConfig(_0x4d9a51[_0x2ac10f(0x1ab)]),_0x534962=await readSqlLockFile(_0x355ff7[_0x2ac10f(0x1c3)]),{appLock:_0x5cd4d4}=ensureSqlLockScope(_0x534962??createEmptySqlLock(),_0x4d9a51[_0x2ac10f(0x1ab)],_0x355ff7[_0x2ac10f(0x1c8)],_0x2ac10f(0x1b8)),_0x41eb1f=await getTargetSqlQueries(_0x355ff7,_0x5cd4d4,_0x4d9a51[_0x2ac10f(0x1cd)](_0x2ac10f(0x1ee))||undefined),_0x5ede22=[];for(const _0x1dabf5 of _0x41eb1f){const _0xafd3f6=await computeSqlFileHash(_0x1dabf5[_0x2ac10f(0x1b9)]),_0x337c56=_0x5cd4d4[_0x2ac10f(0x1d4)][_0x1dabf5[_0x2ac10f(0x1ca)]],_0x2a92c4=!!_0x337c56&&(_0x337c56[_0x2ac10f(0x1d5)]!==_0x1dabf5[_0x2ac10f(0x1e6)]||!!_0x1dabf5['sqlName']&&_0x337c56['sqlName']!==_0x1dabf5[_0x2ac10f(0x1c5)]);if(!_0x4d9a51['bool'](_0x2ac10f(0x1b0))&&_0x337c56&&_0x337c56[_0x2ac10f(0x1e5)]===_0xafd3f6&&!_0x2a92c4)continue;_0x5ede22[_0x2ac10f(0x1b8)](_0x1dabf5[_0x2ac10f(0x1ca)]);}return{'method':'POST','url':'/smartapi/custom/updateUserCustomSql','body':{'sqlCodes':_0x5ede22,'appCode':_0x4d9a51['appCode']},'description':_0x2ac10f(0x1c9)+_0x5ede22['length']+_0x2ac10f(0x1b1)};},async 'execute'(_0x513fa5){const _0x52608b=a173_0x3a5554,_0x28d014=loadSqlProjectConfig(_0x513fa5[_0x52608b(0x1ab)]),_0x4e1c56=await readSqlLockFile(_0x28d014[_0x52608b(0x1c3)]),{lockData:_0x56a7ee,appLock:_0x726994}=ensureSqlLockScope(_0x4e1c56??createEmptySqlLock(),_0x513fa5[_0x52608b(0x1ab)],_0x28d014[_0x52608b(0x1c8)],_0x52608b(0x1b8)),_0x623f09=await getTargetSqlQueries(_0x28d014,_0x726994,_0x513fa5[_0x52608b(0x1cd)]('sqlcode')||undefined);if(_0x623f09['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x52608b(0x1e7)};const _0x338f14=[],_0xce6020=[],_0x58f05b=[];for(const _0x1740a3 of _0x623f09){const _0x109360=_0x726994[_0x52608b(0x1d4)][_0x1740a3['sqlCode']];if(!_0x109360){_0x58f05b[_0x52608b(0x1b8)]({'sqlCode':_0x1740a3['sqlCode'],'error':_0x52608b(0x1bb)});continue;}try{const _0x562c42=await computeSqlFileHash(_0x1740a3[_0x52608b(0x1b9)]),_0x469979=_0x109360['path']!==_0x1740a3[_0x52608b(0x1e6)]||!!_0x1740a3[_0x52608b(0x1c5)]&&_0x109360[_0x52608b(0x1c5)]!==_0x1740a3[_0x52608b(0x1c5)];if(!_0x513fa5[_0x52608b(0x1ce)]('force')&&_0x109360[_0x52608b(0x1e5)]===_0x562c42&&!_0x469979){_0xce6020[_0x52608b(0x1b8)]({'sqlCode':_0x1740a3[_0x52608b(0x1ca)],'reason':'unchanged'});continue;}if(_0x109360[_0x52608b(0x1ea)]==null){_0x58f05b[_0x52608b(0x1b8)]({'sqlCode':_0x1740a3[_0x52608b(0x1ca)],'error':_0x52608b(0x1e9)});continue;}const _0x1b6255=await readFile(_0x1740a3[_0x52608b(0x1b9)],_0x52608b(0x1cc)),_0x7f3f70=stripLocalSqlMetadata(_0x1b6255,_0x1740a3[_0x52608b(0x1da)]),_0x449e80=_0x1740a3[_0x52608b(0x1c5)]||_0x109360['sqlName'],_0x4a1391=await resolveTargetDbBinding(_0x513fa5[_0x52608b(0x1ab)],_0x1740a3,_0x109360),_0x20df15=await updateSqlQuery({'id':_0x109360[_0x52608b(0x1d7)],'appCode':_0x513fa5[_0x52608b(0x1ab)],'sqlCode':_0x1740a3[_0x52608b(0x1ca)],'sqlName':_0x449e80,'dbId':_0x4a1391[_0x52608b(0x1d3)],'version':_0x109360[_0x52608b(0x1ea)],'sqlContent':_0x7f3f70,'sqlConfig':_0x109360[_0x52608b(0x1c7)]??undefined}),_0x2ba3bd=_0x20df15[_0x52608b(0x1d3)]?await getDbName(_0x513fa5['appCode'],Number(_0x20df15[_0x52608b(0x1d3)]))[_0x52608b(0x1e1)](()=>_0x4a1391[_0x52608b(0x1a9)]):_0x4a1391[_0x52608b(0x1a9)];_0x726994['sqls'][_0x1740a3['sqlCode']]={...buildSqlLockEntry(_0x20df15,_0x7f3f70,_0x562c42,{'dbName':_0x2ba3bd}),'path':_0x1740a3[_0x52608b(0x1e6)],'mode':_0x109360[_0x52608b(0x1da)]},await archivePreviousSqlFileIfNeeded(_0x28d014,_0x109360[_0x52608b(0x1d5)],_0x1740a3['relativePath']),_0x338f14[_0x52608b(0x1b8)]({'sqlCode':_0x1740a3[_0x52608b(0x1ca)],'remoteId':_0x109360[_0x52608b(0x1d7)]});}catch(_0x55f4c8){_0x58f05b['push']({'sqlCode':_0x1740a3[_0x52608b(0x1ca)],'error':_0x55f4c8 instanceof Error?_0x55f4c8[_0x52608b(0x1c1)]:String(_0x55f4c8)});}}return _0x726994[_0x52608b(0x1b2)]=new Date()[_0x52608b(0x1bf)](),await writeSqlLockFile(_0x28d014[_0x52608b(0x1c3)],_0x56a7ee),{'ok':_0x58f05b[_0x52608b(0x1c2)]===0x0,'data':{'pushed':_0x338f14,'skipped':_0xce6020,'failed':_0x58f05b},'message':_0x52608b(0x1b5)+_0x338f14[_0x52608b(0x1c2)]+_0x52608b(0x1ac)+_0xce6020[_0x52608b(0x1c2)]+'\x20skipped,\x20'+_0x58f05b[_0x52608b(0x1c2)]+_0x52608b(0x1bc)};}};function a173_0x514c(){const _0x38eefd=['sqlCode','321130HsUMTm','utf8','str','bool','projectRoot','No\x20database\x20matches\x20local\x20directory\x20\x22','validation','join','dbId','sqls','path','startsWith','remoteId','32CdXaRS','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','mode','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','map','Local\x20SQL\x20not\x20found:\x20','5nCzxLQ','get','5253HReqat','catch','boolean','sqlRootDir','2ZgOvsW','hash','relativePath','No\x20local\x20SQL\x20files\x20found.','replace','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','version','isFinite','dbDirectory','entries','sqlcode','exec','dbName','429inKoay','appCode','\x20pushed,\x20','trashDir','1012758CdIYtx','991724vHMmVm','force','\x20SQL\x20file(s)','lastSync','has','4491222WkvTBH','Push\x20complete:\x20','high-risk-write','2078181IIoIvb','push','filePath','\x22\x20for\x20sqlCode\x20','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','\x20failed','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','sql','toISOString','4704889YlpyKm','message','length','lockFilePath','filter','sqlName','Local\x20directory\x20\x22','sqlConfig','sqlRoot','Would\x20push\x20'];a173_0x514c=function(){return _0x38eefd;};return a173_0x514c();}async function archivePreviousSqlFileIfNeeded(_0x2c13a7,_0x1b6def,_0x367159){const _0x73eb05=a173_0x3a5554;if(!_0x1b6def||_0x1b6def===_0x367159)return;const _0x708189=join(_0x2c13a7[_0x73eb05(0x1e3)],_0x1b6def);if(!await fileExists(_0x708189))return;const _0x2e97f6=await moveToTrash(_0x2c13a7[_0x73eb05(0x1cf)],_0x2c13a7[_0x73eb05(0x1ad)],_0x708189);await cleanupEmptyDirectories(dirname(_0x708189),_0x2c13a7[_0x73eb05(0x1e3)]),void _0x2e97f6;}async function moveToTrash(_0x1f8d06,_0x2b082c,_0x2940e4){const _0x31983a=a173_0x3a5554,_0x481797=new Date()[_0x31983a(0x1bf)]()[_0x31983a(0x1e8)](/[:.]/g,'-'),_0x5560da=relative(_0x1f8d06,_0x2940e4),_0x4b44e4=join(_0x2b082c,_0x481797,_0x5560da);return await mkdir(dirname(_0x4b44e4),{'recursive':!![]}),await rename(_0x2940e4,_0x4b44e4),_0x4b44e4;}async function cleanupEmptyDirectories(_0x58fd8b,_0x4f0d6e){const _0x1f93f6=a173_0x3a5554;let _0x286be4=resolve(_0x58fd8b);const _0x2130ae=resolve(_0x4f0d6e);while(_0x286be4[_0x1f93f6(0x1d6)](''+_0x2130ae+sep)||_0x286be4===_0x2130ae){if(_0x286be4===_0x2130ae)return;try{const _0x1c33bf=await readdir(_0x286be4);if(_0x1c33bf[_0x1f93f6(0x1c2)]>0x0)return;await rmdir(_0x286be4);}catch{return;}_0x286be4=dirname(_0x286be4);}}async function resolveTargetDbBinding(_0x13ee88,_0x540016,_0x2969c4){const _0x3bbcda=a173_0x3a5554,_0x20c5ab=_0x540016[_0x3bbcda(0x1ec)];if(!_0x20c5ab)return{'dbId':_0x2969c4[_0x3bbcda(0x1d3)],'dbName':_0x2969c4['dbName']};const _0x3c1423=buildDbDirectoryName(_0x2969c4[_0x3bbcda(0x1a9)],_0x2969c4[_0x3bbcda(0x1d3)]);if(_0x20c5ab===_0x3c1423)return{'dbId':_0x2969c4[_0x3bbcda(0x1d3)],'dbName':_0x2969c4['dbName']};const _0x68cef=parseExplicitDbDirectory(_0x20c5ab);if(_0x68cef!=null)return{'dbId':_0x68cef,'dbName':await getDbName(_0x13ee88,_0x68cef)[_0x3bbcda(0x1e1)](()=>undefined)};const _0x30d5df=await listDatabases(_0x13ee88),_0x529b02=_0x30d5df['filter'](_0x76b1e7=>buildDbDirectoryName(_0x76b1e7[_0x3bbcda(0x1a9)],_0x76b1e7['dbId'])===_0x20c5ab);if(_0x529b02[_0x3bbcda(0x1c2)]===0x1)return{'dbId':_0x529b02[0x0][_0x3bbcda(0x1d3)],'dbName':_0x529b02[0x0]['dbName']};if(_0x529b02['length']===0x0)throw CliErrors[_0x3bbcda(0x1d1)](_0x3bbcda(0x1d0)+_0x20c5ab+_0x3bbcda(0x1ba)+_0x540016[_0x3bbcda(0x1ca)]+'.');const _0xce3768=_0x529b02[_0x3bbcda(0x1dc)](_0xf95f7f=>_0xf95f7f['dbName']+'\x20('+_0xf95f7f[_0x3bbcda(0x1d3)]+')')[_0x3bbcda(0x1d2)](',\x20');throw CliErrors[_0x3bbcda(0x1d1)](_0x3bbcda(0x1c6)+_0x20c5ab+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x540016['sqlCode']+':\x20'+_0xce3768);}function parseExplicitDbDirectory(_0x3eae12){const _0x296d64=a173_0x3a5554,_0xb5bc64=/^db-(\d+)$/[_0x296d64(0x1a8)](_0x3eae12);if(!_0xb5bc64)return null;const _0x585186=Number(_0xb5bc64[0x1]);return Number[_0x296d64(0x1eb)](_0x585186)&&_0x585186>0x0?_0x585186: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_0x2e39d3=a174_0x3231;(function(_0x436e71,_0x2d17c8){const _0x72b908=a174_0x3231,_0x72a691=_0x436e71();while(!![]){try{const _0x11c91e=parseInt(_0x72b908(0x1fa))/0x1+parseInt(_0x72b908(0x1fe))/0x2+parseInt(_0x72b908(0x1f0))/0x3*(parseInt(_0x72b908(0x1f7))/0x4)+parseInt(_0x72b908(0x202))/0x5+parseInt(_0x72b908(0x1f8))/0x6+-parseInt(_0x72b908(0x1ff))/0x7*(parseInt(_0x72b908(0x205))/0x8)+-parseInt(_0x72b908(0x1f9))/0x9*(parseInt(_0x72b908(0x1fc))/0xa);if(_0x11c91e===_0x2d17c8)break;else _0x72a691['push'](_0x72a691['shift']());}catch(_0x25a643){_0x72a691['push'](_0x72a691['shift']());}}}(a174_0x5e50,0x9812d));function a174_0x3231(_0x4f46a2,_0x30b9a6){_0x4f46a2=_0x4f46a2-0x1f0;const _0x5e5003=a174_0x5e50();let _0x323135=_0x5e5003[_0x4f46a2];return _0x323135;}import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';const SQL_SAVE_DEPRECATED_HINT=[a174_0x2e39d3(0x1fd),'Create\x20new\x20SQL\x20with\x20`rabetbase\x20sql\x20create\x20--name\x20<name>\x20--db-id\x20<id>\x20--mode\x20sql|mybatisXml`.','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');function a174_0x5e50(){const _0x2fb015=['sql','Target\x20database\x20—\x20accepts\x20a\x20numeric\x20ID\x20or\x20database\x20name\x20(e.g.\x20ecommerce_db)','1381475HXWktz','validation','description','592DVCcek','32505usfkOa','save','file','Path\x20to\x20the\x20SQL\x20file','write','sqlname','SQL\x20query\x20display\x20name','344IpisFK','1097904scZmvG','5799393igYavC','614025rzslVE','string','20wfGqfD','`rabetbase\x20sql\x20save`\x20has\x20been\x20deprecated.','1774362zHevXP','92764GTXDDr'];a174_0x5e50=function(){return _0x2fb015;};return a174_0x5e50();}export const sqlSave={'service':a174_0x2e39d3(0x200),'command':a174_0x2e39d3(0x1f1),'description':'Deprecated:\x20use\x20sql\x20create\x20to\x20create\x20and\x20sql\x20push\x20to\x20update','risk':a174_0x2e39d3(0x1f4),'requiresAuth':![],'requiresAppCode':![],'flags':[{'name':a174_0x2e39d3(0x1f2),'type':a174_0x2e39d3(0x1fb),'required':!![],'description':a174_0x2e39d3(0x1f3)},SQLCODE_FLAG_OPTIONAL,{'name':a174_0x2e39d3(0x1f5),'type':a174_0x2e39d3(0x1fb),'description':a174_0x2e39d3(0x1f6)},{'name':'db','type':'string','description':a174_0x2e39d3(0x201)},{'name':a174_0x2e39d3(0x204),'type':a174_0x2e39d3(0x1fb),'description':'Query\x20description'}],async 'validate'(){const _0xc3b172=a174_0x2e39d3;throw CliErrors[_0xc3b172(0x203)](SQL_SAVE_DEPRECATED_HINT);},async 'execute'(){const _0xb0c4cd=a174_0x2e39d3;throw CliErrors[_0xb0c4cd(0x203)](SQL_SAVE_DEPRECATED_HINT);}};
@@ -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
+ const a175_0x1bc82f=a175_0x43c9;(function(_0xacf104,_0x56edc9){const _0xa56629=a175_0x43c9,_0x446145=_0xacf104();while(!![]){try{const _0x28e78a=-parseInt(_0xa56629(0x1de))/0x1+-parseInt(_0xa56629(0x1dd))/0x2+-parseInt(_0xa56629(0x1e5))/0x3+-parseInt(_0xa56629(0x1e4))/0x4+-parseInt(_0xa56629(0x1f5))/0x5+-parseInt(_0xa56629(0x1f2))/0x6+parseInt(_0xa56629(0x1df))/0x7;if(_0x28e78a===_0x56edc9)break;else _0x446145['push'](_0x446145['shift']());}catch(_0x233263){_0x446145['push'](_0x446145['shift']());}}}(a175_0xe647,0x410ad));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_0x1bc82f(0x1f7);export function buildSqlLockEntry(_0xc3a6c2,_0x275150,_0x34bec1,_0x6de0de){const _0x39a1e0=a175_0x1bc82f,_0x1b8391=detectSqlMode(_0x275150);return{'path':buildSqlRelativePath(_0xc3a6c2[_0x39a1e0(0x1f3)],_0xc3a6c2[_0x39a1e0(0x1e6)],_0x6de0de?.[_0x39a1e0(0x1e0)],_0x1b8391,_0xc3a6c2[_0x39a1e0(0x1f0)]),'hash':_0x34bec1,'remoteId':_0xc3a6c2['id'],'version':_0xc3a6c2['version'],'dbId':Number(_0xc3a6c2[_0x39a1e0(0x1f0)]),'dbName':_0x6de0de?.[_0x39a1e0(0x1e0)],'sqlName':_0xc3a6c2[_0x39a1e0(0x1e6)],'sqlConfig':_0xc3a6c2[_0x39a1e0(0x1d2)]??undefined,'mode':_0x1b8391};}export function cloneSqlLockData(_0x4da7ae){const _0x5e58ec=a175_0x1bc82f;return{'apps':Object[_0x5e58ec(0x1ef)](Object[_0x5e58ec(0x1e1)](_0x4da7ae[_0x5e58ec(0x1e7)])[_0x5e58ec(0x1d7)](([_0x4f8a95,_0xa51dd5])=>[_0x4f8a95,{'sqlRoot':_0xa51dd5[_0x5e58ec(0x1db)],'lastSync':_0xa51dd5[_0x5e58ec(0x1d0)],'sqls':{..._0xa51dd5[_0x5e58ec(0x1eb)]}}]))};}export function ensureRemoteSqlContent(_0x4d6f11){return _0x4d6f11['sqlContent']??'';}export function buildLocalSqlFileContent(_0x15ba21,_0x20454c,_0x2216a7){const _0xd03eb8=a175_0x1bc82f,_0x194c6a=_0x2216a7?.[_0xd03eb8(0x1ed)]??detectSqlMode(_0x20454c),_0x44c2b1=stripLocalSqlMetadata(_0x20454c,_0x194c6a)[_0xd03eb8(0x1ea)](),_0x32b948=[...buildMetadataHeaderLines({'sqlCode':_0x15ba21[_0xd03eb8(0x1f3)],'sqlName':_0x15ba21['sqlName'],'dbId':_0x15ba21['dbId'],'dbName':_0x2216a7?.[_0xd03eb8(0x1e0)],'mode':_0x194c6a,'syncedAt':_0x2216a7?.[_0xd03eb8(0x1f1)],'description':_0x2216a7?.[_0xd03eb8(0x1d1)]},_0x194c6a),'',_0x44c2b1],_0x1e99b0=_0x32b948[_0xd03eb8(0x1e2)]('\x0a');return _0x1e99b0['endsWith']('\x0a')?_0x1e99b0:_0x1e99b0+'\x0a';}export function stripLocalSqlMetadata(_0x111f07,_0x405bf2){const _0x2ff39c=a175_0x1bc82f,_0xf50fe9=_0x111f07[_0x2ff39c(0x1d8)](/\r\n/g,'\x0a')[_0x2ff39c(0x1d4)]('\x0a'),_0x5ec0c4=[];let _0x6bdd70=0x0;if(_0x405bf2===_0x2ff39c(0x1cf))while(_0x6bdd70<_0xf50fe9[_0x2ff39c(0x1d9)]){const _0x5813ae=_0xf50fe9[_0x6bdd70]??'';if(/^\s*<!--\s*@lovrabet\./[_0x2ff39c(0x1dc)](_0x5813ae)){_0x6bdd70++;continue;}if(_0x5813ae['trim']()===''&&_0x6bdd70>0x0){_0x6bdd70++;continue;}break;}else while(_0x6bdd70<_0xf50fe9['length']){const _0x64db5d=_0xf50fe9[_0x6bdd70]??'';if(/^\s*--\s*@lovrabet\./[_0x2ff39c(0x1dc)](_0x64db5d)){_0x6bdd70++;continue;}if(_0x64db5d['trim']()===''&&_0x6bdd70>0x0){_0x6bdd70++;continue;}break;}for(;_0x6bdd70<_0xf50fe9[_0x2ff39c(0x1d9)];_0x6bdd70++){_0x5ec0c4[_0x2ff39c(0x1f6)](_0xf50fe9[_0x6bdd70]);}return _0x5ec0c4['join']('\x0a')['trimStart']();}function a175_0xe647(){const _0x41a304=['424355uvxgDy','push','.rabetbase/sql','mybatisXml','lastSync','description','sqlConfig','\x20-->','split','toLowerCase','path','map','replace','length','filter','sqlRoot','test','627070JPReOR','389632cBxnZu','13690439aNsZcu','dbName','entries','join','yes','719668zRZYid','1061766ugldOr','sqlName','apps','includes','\x20[y/N]\x20','trim','sqls','stdin','mode','<!--\x20@lovrabet.','fromEntries','dbId','syncedAt','2204922bhfbnN','sqlCode','close'];a175_0xe647=function(){return _0x41a304;};return a175_0xe647();}export function resolveSqlMode(_0x203010,_0x545e64){const _0x5aeb5f=a175_0x1bc82f;if(_0x545e64?.['mode'])return _0x545e64[_0x5aeb5f(0x1ed)];return detectSqlMode(_0x203010);}export function resolveSqlFileName(_0x5f0f35,_0x58d439,_0x46a089){const _0x56bfd1=a175_0x1bc82f;if(_0x46a089?.[_0x56bfd1(0x1d6)])return _0x46a089[_0x56bfd1(0x1d6)];if(_0x46a089?.[_0x56bfd1(0x1e6)]||_0x46a089?.['dbName'])return buildSqlRelativePath(_0x5f0f35,_0x46a089?.[_0x56bfd1(0x1e6)],_0x46a089?.[_0x56bfd1(0x1e0)],resolveSqlMode(_0x58d439,_0x46a089),_0x46a089?.[_0x56bfd1(0x1f0)]);return buildDefaultSqlFileName(_0x5f0f35,resolveSqlMode(_0x58d439,_0x46a089));}export function resolveSqlLocalDir(_0x309378,_0x157b5b){return join(_0x309378,SQL_LOCAL_REL_DIR,_0x157b5b);}function a175_0x43c9(_0x30427f,_0x1e27e9){_0x30427f=_0x30427f-0x1cf;const _0xe6476e=a175_0xe647();let _0x43c94a=_0xe6476e[_0x30427f];return _0x43c94a;}export async function confirmForceOverwrite(_0x20f625){const _0x111457=a175_0x1bc82f,_0x37ed56=createInterface({'input':process[_0x111457(0x1ec)],'output':process['stderr']}),_0x2e09f4=await new Promise(_0x174be6=>{const _0x7304cf=_0x111457;_0x37ed56['question'](_0x20f625+_0x7304cf(0x1e9),_0x174be6);});return _0x37ed56[_0x111457(0x1f4)](),['y',_0x111457(0x1e3)][_0x111457(0x1e8)](_0x2e09f4[_0x111457(0x1ea)]()[_0x111457(0x1d5)]());}export function findSqlLockScope(_0x316bbf,_0x500499){return _0x316bbf['apps'][_0x500499];}function buildMetadataHeaderLines(_0x5b8414,_0x549951){const _0x52434c=a175_0x1bc82f,_0x4f9887=[[_0x52434c(0x1f3),_0x5b8414['sqlCode']],[_0x52434c(0x1e6),_0x5b8414[_0x52434c(0x1e6)]],[_0x52434c(0x1f0),_0x5b8414[_0x52434c(0x1f0)]],['dbName',_0x5b8414['dbName']],[_0x52434c(0x1ed),_0x5b8414['mode']],[_0x52434c(0x1f1),_0x5b8414[_0x52434c(0x1f1)]],[_0x52434c(0x1d1),_0x5b8414['description']]];if(_0x549951===_0x52434c(0x1cf))return _0x4f9887[_0x52434c(0x1da)](([,_0x26813c])=>_0x26813c!==undefined&&_0x26813c!==null&&String(_0x26813c)['trim']()!=='')[_0x52434c(0x1d7)](([_0x19b76c,_0x5807e1])=>_0x52434c(0x1ee)+_0x19b76c+':\x20'+String(_0x5807e1)+_0x52434c(0x1d3));return _0x4f9887[_0x52434c(0x1da)](([,_0x222a10])=>_0x222a10!==undefined&&_0x222a10!==null&&String(_0x222a10)[_0x52434c(0x1ea)]()!=='')['map'](([_0x527c24,_0x196958])=>'--\x20@lovrabet.'+_0x527c24+':\x20'+String(_0x196958));}
@@ -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_0x1094c5=a176_0x550d;function a176_0x52c3(){const _0x3d1ca7=['\x20remote-only','1203665asGYwe','path','tableData','boolean','map','relativePath','6nAlGzO','filePath','lockFilePath','226449IprfGC','\x20modified,\x20','\x20added,\x20','status','has','bool','lockKey','\x20unchanged','528380gmbSqF','appCode','1378629NQdnsa','168660haUjah','read','sql','push','\x20missing,\x20','sqlCode','sqls','totalCount','sqlRoot','693024GTfpJV','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','keys','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','length','184QZzntm','remote','351804BiKAzs','sqlName'];a176_0x52c3=function(){return _0x3d1ca7;};return a176_0x52c3();}(function(_0x499ca3,_0x5294bf){const _0x29ac64=a176_0x550d,_0x42ed9e=_0x499ca3();while(!![]){try{const _0x425b1d=-parseInt(_0x29ac64(0x17d))/0x1+-parseInt(_0x29ac64(0x191))/0x2+parseInt(_0x29ac64(0x194))/0x3+-parseInt(_0x29ac64(0x176))/0x4+parseInt(_0x29ac64(0x180))/0x5*(parseInt(_0x29ac64(0x186))/0x6)+parseInt(_0x29ac64(0x193))/0x7+parseInt(_0x29ac64(0x17b))/0x8*(parseInt(_0x29ac64(0x189))/0x9);if(_0x425b1d===_0x5294bf)break;else _0x42ed9e['push'](_0x42ed9e['shift']());}catch(_0x396300){_0x42ed9e['push'](_0x42ed9e['shift']());}}}(a176_0x52c3,0x452d9));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';function a176_0x550d(_0x2247b7,_0x4d3a9c){_0x2247b7=_0x2247b7-0x173;const _0x52c3a5=a176_0x52c3();let _0x550dd5=_0x52c3a5[_0x2247b7];return _0x550dd5;}import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile}from'../../core/sql-sync/lock.js';const PAGE_SIZE=0x64;async function fetchAllSqlCodes(_0x58503f){const _0x1c10f1=a176_0x550d,_0x31e044=[];let _0x58c23e=0x1;while(!![]){const _0x533e57=await listSqlQueries(_0x58503f,{'currentPage':_0x58c23e,'pageSize':PAGE_SIZE}),_0x133939=_0x533e57[_0x1c10f1(0x182)]??[];_0x31e044[_0x1c10f1(0x197)](..._0x133939[_0x1c10f1(0x184)](_0x2f0f4e=>_0x2f0f4e[_0x1c10f1(0x199)]));if(_0x133939[_0x1c10f1(0x17a)]===0x0)break;const _0x405f34=_0x533e57['paging']?.[_0x1c10f1(0x174)];if(_0x405f34!=null?_0x31e044[_0x1c10f1(0x17a)]>=_0x405f34:_0x133939[_0x1c10f1(0x17a)]<PAGE_SIZE)break;_0x58c23e++;}return _0x31e044;}export const sqlStatus={'service':a176_0x1094c5(0x196),'command':'status','description':a176_0x1094c5(0x179),'risk':a176_0x1094c5(0x195),'flags':[{'name':'remote','type':a176_0x1094c5(0x183),'description':a176_0x1094c5(0x177)}],async 'execute'(_0x1548b2){const _0xe4d36b=a176_0x1094c5,_0x33c02f=loadSqlProjectConfig(_0x1548b2[_0xe4d36b(0x192)]),_0xf2c3ff=await readSqlLockFile(_0x33c02f[_0xe4d36b(0x188)]),{appLock:_0x5dfa0c}=ensureSqlLockScope(_0xf2c3ff??createEmptySqlLock(),_0x33c02f[_0xe4d36b(0x192)],_0x33c02f[_0xe4d36b(0x175)],_0xe4d36b(0x18c)),_0x4ab523=await scanLocalSqlQueries(_0x33c02f),_0x47f4bf=[],_0xdff39=[],_0x309c72=[],_0x3cdefe=[],_0x26a42a=new Set(_0x4ab523[_0xe4d36b(0x184)](_0x36e086=>_0x36e086[_0xe4d36b(0x18f)]));for(const _0x2ffda6 of _0x4ab523){const _0x2ccafd=await computeSqlFileHash(_0x2ffda6[_0xe4d36b(0x187)]),_0x599bb5=_0x5dfa0c['sqls'][_0x2ffda6['lockKey']],_0x3bfd31=!!_0x599bb5&&_0x599bb5[_0xe4d36b(0x181)]!==_0x2ffda6[_0xe4d36b(0x185)],_0x42f424=!!_0x599bb5&&!!_0x2ffda6[_0xe4d36b(0x17e)]&&_0x599bb5[_0xe4d36b(0x17e)]!==_0x2ffda6[_0xe4d36b(0x17e)];if(!_0x599bb5)_0x47f4bf[_0xe4d36b(0x197)](_0x2ffda6['lockKey']);else _0x599bb5['hash']!==_0x2ccafd||_0x3bfd31||_0x42f424?_0xdff39[_0xe4d36b(0x197)](_0x2ffda6[_0xe4d36b(0x18f)]):_0x309c72['push'](_0x2ffda6['lockKey']);}for(const _0x5d63b3 of Object[_0xe4d36b(0x178)](_0x5dfa0c[_0xe4d36b(0x173)])){!_0x26a42a[_0xe4d36b(0x18d)](_0x5d63b3)&&_0x3cdefe[_0xe4d36b(0x197)](_0x5d63b3);}const _0x7e2d95=[];if(_0x1548b2[_0xe4d36b(0x18e)](_0xe4d36b(0x17c))){const _0x45da4f=await fetchAllSqlCodes(_0x1548b2['appCode']);for(const _0x12c895 of _0x45da4f){!_0x26a42a['has'](_0x12c895)&&!_0x5dfa0c[_0xe4d36b(0x173)][_0x12c895]&&_0x7e2d95[_0xe4d36b(0x197)](_0x12c895);}}const _0x2eead7=_0x47f4bf['length']===0x0&&_0xdff39[_0xe4d36b(0x17a)]===0x0&&_0x3cdefe['length']===0x0&&_0x7e2d95[_0xe4d36b(0x17a)]===0x0;return{'ok':!![],'data':{'added':_0x47f4bf,'modified':_0xdff39,'missing':_0x3cdefe,'unchanged':_0x309c72,'remoteOnly':_0x7e2d95},'message':_0x2eead7?'All\x20SQL\x20queries\x20are\x20in\x20sync.':_0x47f4bf[_0xe4d36b(0x17a)]+_0xe4d36b(0x18b)+_0xdff39[_0xe4d36b(0x17a)]+_0xe4d36b(0x18a)+_0x3cdefe[_0xe4d36b(0x17a)]+_0xe4d36b(0x198)+_0x309c72[_0xe4d36b(0x17a)]+_0xe4d36b(0x190)+(_0x7e2d95[_0xe4d36b(0x17a)]>0x0?',\x20'+_0x7e2d95['length']+_0xe4d36b(0x17f):'')};}};