@lovrabet/rabetbase-cli 2.5.2-beta.1 → 2.5.2-beta.3

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 (348) hide show
  1. package/README.md +1 -1
  2. package/lib/api/api-doc.js +1 -1
  3. package/lib/api/fetch-model-list.js +1 -1
  4. package/lib/api/generate-api-file.js +1 -1
  5. package/lib/api/generate-sdk-config-file.js +1 -1
  6. package/lib/auth/auth-server-ui.js +1 -1
  7. package/lib/auth/auth-server.js +1 -1
  8. package/lib/auth/constant.js +1 -1
  9. package/lib/auth/get-cookie.js +1 -1
  10. package/lib/auth/get-session-user.js +1 -1
  11. package/lib/auth/is-session-valid.js +1 -1
  12. package/lib/auth/login-success-html.js +1 -1
  13. package/lib/auth/logout.js +1 -1
  14. package/lib/cli-flags.js +1 -1
  15. package/lib/cli.js +1 -1
  16. package/lib/commands/api/generate.js +1 -1
  17. package/lib/commands/api/index.js +1 -1
  18. package/lib/commands/api/list.js +1 -1
  19. package/lib/commands/api/pull.js +1 -1
  20. package/lib/commands/api/shared.js +1 -1
  21. package/lib/commands/app/index.js +1 -1
  22. package/lib/commands/app/list.js +1 -1
  23. package/lib/commands/app/members-list.js +1 -1
  24. package/lib/commands/app/remote-directory.js +1 -1
  25. package/lib/commands/app/shared.d.ts +1 -0
  26. package/lib/commands/app/shared.js +1 -1
  27. package/lib/commands/app-config/delete.js +1 -1
  28. package/lib/commands/app-config/get.js +1 -1
  29. package/lib/commands/app-config/index.js +1 -1
  30. package/lib/commands/app-config/list.js +1 -1
  31. package/lib/commands/app-config/set.js +1 -1
  32. package/lib/commands/app-config/shared.js +1 -1
  33. package/lib/commands/auth/index.js +1 -1
  34. package/lib/commands/bff/create.js +1 -1
  35. package/lib/commands/bff/delete.js +1 -1
  36. package/lib/commands/bff/detail.js +1 -1
  37. package/lib/commands/bff/index.js +1 -1
  38. package/lib/commands/bff/list.js +1 -1
  39. package/lib/commands/bff/pull.js +1 -1
  40. package/lib/commands/bff/push.js +1 -1
  41. package/lib/commands/bff/status.js +1 -1
  42. package/lib/commands/cli-skill/index.js +1 -1
  43. package/lib/commands/cli-update.js +1 -1
  44. package/lib/commands/codegen/index.js +1 -1
  45. package/lib/commands/codegen/sdk.js +1 -1
  46. package/lib/commands/codegen/sql.js +1 -1
  47. package/lib/commands/common/app-registry.js +1 -1
  48. package/lib/commands/common/app-selector.js +1 -1
  49. package/lib/commands/common/async-task.js +1 -1
  50. package/lib/commands/common/dry-run.js +1 -1
  51. package/lib/commands/common/flags.js +1 -1
  52. package/lib/commands/common/local-file.js +1 -1
  53. package/lib/commands/common/validate.js +1 -1
  54. package/lib/commands/config/delete.js +1 -1
  55. package/lib/commands/config/get.js +1 -1
  56. package/lib/commands/config/index.js +1 -1
  57. package/lib/commands/config/init.js +1 -1
  58. package/lib/commands/config/list.js +1 -1
  59. package/lib/commands/config/set.js +1 -1
  60. package/lib/commands/config/shared.js +1 -1
  61. package/lib/commands/dataset/business-group-update.js +1 -1
  62. package/lib/commands/dataset/business-groups.js +1 -1
  63. package/lib/commands/dataset/capability.js +1 -1
  64. package/lib/commands/dataset/delete.js +1 -1
  65. package/lib/commands/dataset/detail.js +1 -1
  66. package/lib/commands/dataset/extend-update.js +1 -1
  67. package/lib/commands/dataset/field-restore.js +1 -1
  68. package/lib/commands/dataset/field-update.js +1 -1
  69. package/lib/commands/dataset/generate.js +1 -1
  70. package/lib/commands/dataset/index.js +1 -1
  71. package/lib/commands/dataset/list.js +1 -1
  72. package/lib/commands/dataset/operations.js +1 -1
  73. package/lib/commands/dataset/relation-audit.js +1 -1
  74. package/lib/commands/dataset/relation-create.js +1 -1
  75. package/lib/commands/dataset/relation-delete.js +1 -1
  76. package/lib/commands/dataset/relation-shared.js +1 -1
  77. package/lib/commands/dataset/relation-update.js +1 -1
  78. package/lib/commands/dataset/relations.js +1 -1
  79. package/lib/commands/dataset/rename.js +1 -1
  80. package/lib/commands/dataset/restore.js +1 -1
  81. package/lib/commands/dataset/user-deleted-field-list.js +1 -1
  82. package/lib/commands/db/analysis-batching.js +1 -1
  83. package/lib/commands/db/analyze-batch-plan.js +1 -1
  84. package/lib/commands/db/analyze-cancel.js +1 -1
  85. package/lib/commands/db/analyze-start.js +1 -1
  86. package/lib/commands/db/analyze-status.js +1 -1
  87. package/lib/commands/db/create.js +1 -1
  88. package/lib/commands/db/delete.js +1 -1
  89. package/lib/commands/db/detail.js +1 -1
  90. package/lib/commands/db/diff-refresh-start.js +1 -1
  91. package/lib/commands/db/diff-refresh-status.js +1 -1
  92. package/lib/commands/db/diff.js +1 -1
  93. package/lib/commands/db/index.js +1 -1
  94. package/lib/commands/db/list.js +1 -1
  95. package/lib/commands/db/shared.js +1 -1
  96. package/lib/commands/db/table-diff-shared.js +1 -1
  97. package/lib/commands/db/tables.js +1 -1
  98. package/lib/commands/db/test.js +1 -1
  99. package/lib/commands/db/update.js +1 -1
  100. package/lib/commands/deployment/auto-sync.js +1 -1
  101. package/lib/commands/deployment/index.js +1 -1
  102. package/lib/commands/deployment/sync-all.d.ts +2 -0
  103. package/lib/commands/deployment/sync-all.js +1 -0
  104. package/lib/commands/deployment/sync-jobs.d.ts +2 -0
  105. package/lib/commands/deployment/sync-jobs.js +1 -0
  106. package/lib/commands/deployment/sync-status.d.ts +2 -0
  107. package/lib/commands/deployment/sync-status.js +1 -0
  108. package/lib/commands/deployment/sync.js +1 -1
  109. package/lib/commands/doctor.js +1 -1
  110. package/lib/commands/file/index.js +1 -1
  111. package/lib/commands/instant-api-policy/current.d.ts +2 -0
  112. package/lib/commands/instant-api-policy/current.js +1 -0
  113. package/lib/commands/instant-api-policy/index.d.ts +2 -0
  114. package/lib/commands/instant-api-policy/index.js +1 -0
  115. package/lib/commands/instant-api-policy/init.d.ts +2 -0
  116. package/lib/commands/instant-api-policy/init.js +1 -0
  117. package/lib/commands/instant-api-policy/publish.d.ts +2 -0
  118. package/lib/commands/instant-api-policy/publish.js +1 -0
  119. package/lib/commands/instant-api-policy/pull.d.ts +2 -0
  120. package/lib/commands/instant-api-policy/pull.js +1 -0
  121. package/lib/commands/instant-api-policy/revision.d.ts +2 -0
  122. package/lib/commands/instant-api-policy/revision.js +1 -0
  123. package/lib/commands/instant-api-policy/revisions.d.ts +2 -0
  124. package/lib/commands/instant-api-policy/revisions.js +1 -0
  125. package/lib/commands/instant-api-policy/rollback.d.ts +2 -0
  126. package/lib/commands/instant-api-policy/rollback.js +1 -0
  127. package/lib/commands/instant-api-policy/shared.d.ts +82 -0
  128. package/lib/commands/instant-api-policy/shared.js +1 -0
  129. package/lib/commands/instant-api-policy/validate.d.ts +2 -0
  130. package/lib/commands/instant-api-policy/validate.js +1 -0
  131. package/lib/commands/issue/index.js +1 -1
  132. package/lib/commands/issue/nudge.js +1 -1
  133. package/lib/commands/issue/report.js +1 -1
  134. package/lib/commands/issue/shared.js +1 -1
  135. package/lib/commands/kb/create.js +1 -1
  136. package/lib/commands/kb/delete.js +1 -1
  137. package/lib/commands/kb/detail.js +1 -1
  138. package/lib/commands/kb/index.js +1 -1
  139. package/lib/commands/kb/list.js +1 -1
  140. package/lib/commands/kb/search.js +1 -1
  141. package/lib/commands/kb/shared.js +1 -1
  142. package/lib/commands/kb/update.js +1 -1
  143. package/lib/commands/logs/index.js +1 -1
  144. package/lib/commands/menu/asset-update.js +1 -1
  145. package/lib/commands/menu/delete.js +1 -1
  146. package/lib/commands/menu/external-link-create.js +1 -1
  147. package/lib/commands/menu/external-link-update.js +1 -1
  148. package/lib/commands/menu/group-create.js +1 -1
  149. package/lib/commands/menu/group-update.js +1 -1
  150. package/lib/commands/menu/index.js +1 -1
  151. package/lib/commands/menu/list.js +1 -1
  152. package/lib/commands/menu/move.js +1 -1
  153. package/lib/commands/menu/regroup-start.js +1 -1
  154. package/lib/commands/menu/rename.js +1 -1
  155. package/lib/commands/menu/shared/compare-table.js +1 -1
  156. package/lib/commands/menu/shared/delete-plan.js +1 -1
  157. package/lib/commands/menu/shared/facts.js +1 -1
  158. package/lib/commands/menu/shared/index.js +1 -1
  159. package/lib/commands/menu/shared/inquirer.js +1 -1
  160. package/lib/commands/menu/shared/local-pages.js +1 -1
  161. package/lib/commands/menu/shared/logic.js +1 -1
  162. package/lib/commands/menu/shared/mutations.js +1 -1
  163. package/lib/commands/menu/shared/service.js +1 -1
  164. package/lib/commands/menu/shared/sync-core.js +1 -1
  165. package/lib/commands/menu/shared/update-core.js +1 -1
  166. package/lib/commands/menu/shared/valid-url.js +1 -1
  167. package/lib/commands/menu/sync.js +1 -1
  168. package/lib/commands/menu/visibility-update.js +1 -1
  169. package/lib/commands/notification/config-create.js +1 -1
  170. package/lib/commands/notification/config-delete.js +1 -1
  171. package/lib/commands/notification/config-list.js +1 -1
  172. package/lib/commands/notification/config-update.js +1 -1
  173. package/lib/commands/notification/index.js +1 -1
  174. package/lib/commands/notification/shared.js +1 -1
  175. package/lib/commands/ocr/index.js +1 -1
  176. package/lib/commands/page/create.js +1 -1
  177. package/lib/commands/page/custom/detail.js +1 -1
  178. package/lib/commands/page/custom/list.js +1 -1
  179. package/lib/commands/page/custom/publish.js +1 -1
  180. package/lib/commands/page/custom/shared.js +1 -1
  181. package/lib/commands/page/custom/syntax.js +1 -1
  182. package/lib/commands/page/custom/template.js +1 -1
  183. package/lib/commands/page/custom/update.js +1 -1
  184. package/lib/commands/page/data-list-status.js +1 -1
  185. package/lib/commands/page/generate-start.js +1 -1
  186. package/lib/commands/page/generate-status.js +1 -1
  187. package/lib/commands/page/index.js +1 -1
  188. package/lib/commands/page/pull.js +1 -1
  189. package/lib/commands/page/push.js +1 -1
  190. package/lib/commands/page/relation-audit.js +1 -1
  191. package/lib/commands/page/restore.js +1 -1
  192. package/lib/commands/page/shared.js +1 -1
  193. package/lib/commands/page/sync.js +1 -1
  194. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  195. package/lib/commands/project/create/format-elapsed.js +1 -1
  196. package/lib/commands/project/create/main.js +1 -1
  197. package/lib/commands/project/create/materialize-project-template.js +1 -1
  198. package/lib/commands/project/create/project-name.js +1 -1
  199. package/lib/commands/project/create/project-template-archive.js +1 -1
  200. package/lib/commands/project/create/project-template-path.js +1 -1
  201. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  202. package/lib/commands/project/create/use-format-code.js +1 -1
  203. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  204. package/lib/commands/project/domain-routing-sync.js +1 -1
  205. package/lib/commands/project/index.js +1 -1
  206. package/lib/commands/project/upgrade.js +1 -1
  207. package/lib/commands/registry.js +1 -1
  208. package/lib/commands/role/delete.js +1 -1
  209. package/lib/commands/role/detail.js +1 -1
  210. package/lib/commands/role/index.js +1 -1
  211. package/lib/commands/role/list.js +1 -1
  212. package/lib/commands/role/shared.js +1 -1
  213. package/lib/commands/role/update.js +1 -1
  214. package/lib/commands/role/user-add.js +1 -1
  215. package/lib/commands/role/user-remove.js +1 -1
  216. package/lib/commands/role/user-resolve.js +1 -1
  217. package/lib/commands/rule/get.js +1 -1
  218. package/lib/commands/rule/index.js +1 -1
  219. package/lib/commands/rule/list.js +1 -1
  220. package/lib/commands/rule/set.js +1 -1
  221. package/lib/commands/rule/shared.js +1 -1
  222. package/lib/commands/run/index.js +1 -1
  223. package/lib/commands/schema.js +1 -1
  224. package/lib/commands/sql/create.js +1 -1
  225. package/lib/commands/sql/delete.js +1 -1
  226. package/lib/commands/sql/detail.js +1 -1
  227. package/lib/commands/sql/exec.js +1 -1
  228. package/lib/commands/sql/index.js +1 -1
  229. package/lib/commands/sql/list.js +1 -1
  230. package/lib/commands/sql/pull.js +1 -1
  231. package/lib/commands/sql/push.js +1 -1
  232. package/lib/commands/sql/shared.js +1 -1
  233. package/lib/commands/sql/status.js +1 -1
  234. package/lib/commands/sql/validate.js +1 -1
  235. package/lib/commands/task/index.js +1 -1
  236. package/lib/commands/task/status.js +1 -1
  237. package/lib/commands/tenant/index.js +1 -1
  238. package/lib/commands/tenant/members-list.js +1 -1
  239. package/lib/commands/tenant/shared.js +1 -1
  240. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  241. package/lib/commands/user-account/index.js +1 -1
  242. package/lib/commands/workspace/add.js +1 -1
  243. package/lib/commands/workspace/index.js +1 -1
  244. package/lib/commands/workspace/remove.js +1 -1
  245. package/lib/config/domain-config.d.ts +3 -7
  246. package/lib/config/domain-config.js +1 -1
  247. package/lib/config/project-domain-routing.js +1 -1
  248. package/lib/config/schema.js +1 -1
  249. package/lib/constant/cdn.js +1 -1
  250. package/lib/constant/cli.js +1 -1
  251. package/lib/constant/defaults.js +1 -1
  252. package/lib/constant/domain.js +1 -1
  253. package/lib/constant/env.js +1 -1
  254. package/lib/constant/output.js +1 -1
  255. package/lib/constant/paths.js +1 -1
  256. package/lib/constant/region.js +1 -1
  257. package/lib/constant/risk.js +1 -1
  258. package/lib/constant/routing-profile.js +1 -1
  259. package/lib/context/app-resolver.js +1 -1
  260. package/lib/context/auth-resolver.js +1 -1
  261. package/lib/context/config-loader.js +1 -1
  262. package/lib/context.js +1 -1
  263. package/lib/core/alias-resolver.js +1 -1
  264. package/lib/core/api-client.d.ts +114 -0
  265. package/lib/core/api-client.js +1 -1
  266. package/lib/core/bff/config.js +1 -1
  267. package/lib/core/bff/file-system.js +1 -1
  268. package/lib/core/bff/hash.js +1 -1
  269. package/lib/core/bff/lock.js +1 -1
  270. package/lib/core/bff/utils.js +1 -1
  271. package/lib/core/db-resolver.js +1 -1
  272. package/lib/core/instant-api-policy/config.d.ts +23 -0
  273. package/lib/core/instant-api-policy/config.js +1 -0
  274. package/lib/core/kb-search-client.js +1 -1
  275. package/lib/core/page/file-system.js +1 -1
  276. package/lib/core/page/hash.js +1 -1
  277. package/lib/core/page/lock.js +1 -1
  278. package/lib/core/sql-index-auditor.js +1 -1
  279. package/lib/core/sql-sync/config.js +1 -1
  280. package/lib/core/sql-sync/file-system.js +1 -1
  281. package/lib/core/sql-sync/hash.js +1 -1
  282. package/lib/core/sql-sync/lock.js +1 -1
  283. package/lib/core/sql-sync/utils.js +1 -1
  284. package/lib/core/sql-validator.js +1 -1
  285. package/lib/errors.js +1 -1
  286. package/lib/framework/build-all-flags.js +1 -1
  287. package/lib/framework/error-output.js +1 -1
  288. package/lib/framework/explicit-yes.js +1 -1
  289. package/lib/framework/flags.js +1 -1
  290. package/lib/framework/help.js +1 -1
  291. package/lib/framework/index.js +1 -1
  292. package/lib/framework/output.js +1 -1
  293. package/lib/framework/response.js +1 -1
  294. package/lib/framework/runner-alias.js +1 -1
  295. package/lib/framework/runner.js +1 -1
  296. package/lib/framework/schema-export.js +1 -1
  297. package/lib/framework/supported-flags.js +1 -1
  298. package/lib/framework/types.js +1 -1
  299. package/lib/generated/build-info.d.ts +4 -4
  300. package/lib/generated/build-info.js +1 -1
  301. package/lib/generated/official-routing.d.ts +1 -1
  302. package/lib/generated/official-routing.js +1 -1
  303. package/lib/generated/routing-contract.d.ts +1 -3
  304. package/lib/generated/routing-contract.js +1 -1
  305. package/lib/help.js +1 -1
  306. package/lib/postinstall.js +1 -1
  307. package/lib/runtime/confirmation.js +1 -1
  308. package/lib/runtime/event.js +1 -1
  309. package/lib/runtime/index.js +1 -1
  310. package/lib/runtime/queue.js +1 -1
  311. package/lib/runtime/resolve.js +1 -1
  312. package/lib/skills/builtin-skill.js +1 -1
  313. package/lib/skills/main.js +1 -1
  314. package/lib/skills/npx-skills-add.js +1 -1
  315. package/lib/skills/skill-presence.js +1 -1
  316. package/lib/telemetry/cli-command-trace.js +1 -1
  317. package/lib/telemetry/cli-help-trace.js +1 -1
  318. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  319. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  320. package/lib/telemetry/send-cli-trace-log.js +1 -1
  321. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  322. package/lib/utils/ai_config.js +1 -1
  323. package/lib/utils/apply-jq-filter.js +1 -1
  324. package/lib/utils/cdn-config.js +1 -1
  325. package/lib/utils/check-sdk-version.js +1 -1
  326. package/lib/utils/cli-version-check.js +1 -1
  327. package/lib/utils/cli-version-policy.js +1 -1
  328. package/lib/utils/config.js +1 -1
  329. package/lib/utils/entity-with-id.js +1 -1
  330. package/lib/utils/file-utils.js +1 -1
  331. package/lib/utils/guides-cdn.js +1 -1
  332. package/lib/utils/http-client.js +1 -1
  333. package/lib/utils/is-non-interactive.js +1 -1
  334. package/lib/utils/logger.js +1 -1
  335. package/lib/utils/params.js +1 -1
  336. package/lib/utils/platform.js +1 -1
  337. package/lib/utils/sleep.js +1 -1
  338. package/lib/utils/template-replacer.js +1 -1
  339. package/lib/utils/update-notice.js +1 -1
  340. package/lib/utils/version.js +1 -1
  341. package/lib/utils/with-active-cookie.js +1 -1
  342. package/lib/utils/write-cli-side-channel.js +1 -1
  343. package/package.json +1 -1
  344. package/skills/rabetbase/SKILL.md +12 -6
  345. package/skills/rabetbase/references/rabetbase-app-members-list.md +2 -0
  346. package/skills/rabetbase/references/rabetbase-deployment-sync.md +41 -5
  347. package/skills/rabetbase/references/rabetbase-instant-api-policy.md +92 -0
  348. package/skills/rabetbase.manifest.json +4 -3
@@ -1 +1 @@
1
- const a194_0x24aee1=a194_0x4077;(function(_0x24e076,_0x496871){const _0x2b0663=a194_0x4077,_0x24014e=_0x24e076();while(!![]){try{const _0x16818a=-parseInt(_0x2b0663(0x146))/0x1*(-parseInt(_0x2b0663(0x13e))/0x2)+parseInt(_0x2b0663(0x169))/0x3*(-parseInt(_0x2b0663(0x155))/0x4)+parseInt(_0x2b0663(0x13d))/0x5*(-parseInt(_0x2b0663(0x147))/0x6)+-parseInt(_0x2b0663(0x15e))/0x7+parseInt(_0x2b0663(0x145))/0x8+parseInt(_0x2b0663(0x166))/0x9*(parseInt(_0x2b0663(0x16e))/0xa)+-parseInt(_0x2b0663(0x134))/0xb;if(_0x16818a===_0x496871)break;else _0x24014e['push'](_0x24014e['shift']());}catch(_0x4d2572){_0x24014e['push'](_0x24014e['shift']());}}}(a194_0x24b6,0xdb20b));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';function a194_0x24b6(){const _0x2733b8=['\x20run\x20<script>\x0a','.bin','\x20exited\x20with\x20code\x20','\x20run\x20preview\x20--watch','error','start','push','171uskNxH','inherit','script','3EAJrPp','vite','Script\x20\x22','validation','\x22\x20not\x20found\x20in\x20package.json.','874470EpqcsZ','parse','bool','watch','log','dev','\x20run\x20preview','981530mCBwKM','cwd','\x20\x20\x20\x20','keys','node_modules','build','package.json','run','bun.lock','6795qgVpWD','302EKygKx','\x20run\x20build','\x20run\x20','Script\x20name\x20defined\x20in\x20package.json','join','--watch','preview','3780824yjhHnS','1093DKjcBn','432wsMdiF','args','No\x20scripts\x20defined\x20in\x20package.json.','close','\x20\x20EXAMPLES','\x0a\x20\x20Usage:\x20','needsUpgrade','Enable\x20watch\x20mode\x20for\x20preview','boolean','pnpm','Run\x20a\x20package.json\x20script','slice','utf-8','vite\x20preview\x20exited\x20with\x20code\x20','937636AUKkIu','has','yarn.lock','npm','No\x20package.json\x20found\x20in\x20current\x20directory.','pnpm-lock.yaml','write','\x0a\x20\x20Available\x20scripts:\x0a','length','6860735ukuQem'];a194_0x24b6=function(){return _0x2733b8;};return a194_0x24b6();}function a194_0x4077(_0x2c1416,_0x4a639c){_0x2c1416=_0x2c1416-0x130;const _0x24b6be=a194_0x24b6();let _0x40776b=_0x24b6be[_0x2c1416];return _0x40776b;}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([a194_0x24aee1(0x164),a194_0x24aee1(0x132)]);function readPackageScripts(_0x2eb98d){const _0x1df6b1=a194_0x24aee1,_0x39c1b3=resolve(_0x2eb98d,_0x1df6b1(0x13a));if(!existsSync(_0x39c1b3))return null;try{const _0x3235ca=JSON[_0x1df6b1(0x16f)](readFileSync(_0x39c1b3,_0x1df6b1(0x153)));return _0x3235ca['scripts']??{};}catch{return null;}}function detectPackageManager(_0x4002c2){const _0x1aa2ba=a194_0x24aee1;if(existsSync(resolve(_0x4002c2,'bun.lockb'))||existsSync(resolve(_0x4002c2,_0x1aa2ba(0x13c))))return'bun';if(existsSync(resolve(_0x4002c2,_0x1aa2ba(0x15a))))return _0x1aa2ba(0x150);if(existsSync(resolve(_0x4002c2,_0x1aa2ba(0x157))))return'yarn';return _0x1aa2ba(0x158);}async function versionCheck(_0x383502){const _0x314b78=a194_0x24aee1,_0x3a6b27=await checkCliVersion();(_0x3a6b27[_0x314b78(0x14d)]||_0x3a6b27['belowMinimum'])&&(printCliUpgradeWarning(_0x3a6b27),assertCliVersionSupported(_0x3a6b27));const _0x40b6a5=await checkSdkVersion(_0x383502);if(_0x40b6a5['needsUpgrade'])printSdkUpgradeWarning(_0x40b6a5);}function spawnScript(_0x34699a,_0x4d87c7,_0x54f116,_0x3489d8){return new Promise((_0x4b473b,_0xf4ec99)=>{const _0x53cd22=a194_0x4077,_0x2e996c=[_0x53cd22(0x13b),_0x4d87c7,..._0x54f116],_0x50f90b=spawn(_0x34699a,_0x2e996c,{'cwd':_0x3489d8,'stdio':_0x53cd22(0x167),'shell':!![],'env':{...process.env,'PATH':''+join(_0x3489d8,_0x53cd22(0x138),_0x53cd22(0x160))+delimiter+process.env.PATH}});_0x50f90b['on'](_0x53cd22(0x14a),_0x5b0a09=>{const _0x24727e=_0x53cd22;if(_0x5b0a09===0x0||_0x5b0a09===null)_0x4b473b();else _0xf4ec99(new Error(_0x34699a+_0x24727e(0x140)+_0x4d87c7+_0x24727e(0x161)+_0x5b0a09));}),_0x50f90b['on'](_0x53cd22(0x163),_0xf4ec99);});}function spawnViteBuildWatch(_0x1cd3fb){return new Promise((_0x1ed3b5,_0x3e358e)=>{const _0x418892=a194_0x4077,_0x4961d8=spawn(_0x418892(0x16a),[_0x418892(0x139),_0x418892(0x143)],{'cwd':_0x1cd3fb,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x1cd3fb,_0x418892(0x138),_0x418892(0x160))+delimiter+process.env.PATH}});_0x4961d8['on'](_0x418892(0x14a),_0x32e3c6=>{if(_0x32e3c6===0x0||_0x32e3c6===null)_0x1ed3b5();else _0x3e358e(new Error('vite\x20build\x20--watch\x20exited\x20with\x20code\x20'+_0x32e3c6));}),_0x4961d8['on']('error',_0x3e358e);});}function spawnVitePreview(_0x2fab76){return new Promise((_0x4b3e19,_0x956e74)=>{const _0x335d23=a194_0x4077,_0x58f28e=spawn(_0x335d23(0x16a),[_0x335d23(0x144)],{'cwd':_0x2fab76,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x2fab76,_0x335d23(0x138),_0x335d23(0x160))+delimiter+process.env.PATH}});_0x58f28e['on'](_0x335d23(0x14a),_0x26a5da=>{const _0x328637=_0x335d23;if(_0x26a5da===0x0||_0x26a5da===null)_0x4b3e19();else _0x956e74(new Error(_0x328637(0x154)+_0x26a5da));}),_0x58f28e['on'](_0x335d23(0x163),_0x956e74);});}const runFlags=[{'name':a194_0x24aee1(0x130),'type':a194_0x24aee1(0x14f),'description':a194_0x24aee1(0x14e),'default':![]}];export const runDefinition={'service':'run','command':a194_0x24aee1(0x13b),'description':a194_0x24aee1(0x151),'risk':a194_0x24aee1(0x15b),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a194_0x24aee1(0x168),'description':a194_0x24aee1(0x141),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x4d104d=a194_0x24aee1,_0xa36549=[];return _0xa36549[_0x4d104d(0x165)](_0x4d104d(0x14b)),_0xa36549[_0x4d104d(0x165)](_0x4d104d(0x136)+CLI_BIN_NAME+'\x20run\x20start'),_0xa36549[_0x4d104d(0x165)](_0x4d104d(0x136)+CLI_BIN_NAME+_0x4d104d(0x13f)),_0xa36549[_0x4d104d(0x165)](_0x4d104d(0x136)+CLI_BIN_NAME+_0x4d104d(0x133)),_0xa36549['push'](_0x4d104d(0x136)+CLI_BIN_NAME+_0x4d104d(0x162)),_0xa36549[_0x4d104d(0x142)]('\x0a');},async 'execute'(_0x51d8b4){const _0xddc785=a194_0x24aee1,_0x1ad13c=process[_0xddc785(0x135)](),_0x10a70e=_0x51d8b4['args'][0x0],_0x16c4cb=_0x51d8b4[_0xddc785(0x148)][_0xddc785(0x152)](0x1),_0x3a9839=readPackageScripts(_0x1ad13c);if(!_0x3a9839)throw CliErrors[_0xddc785(0x16c)](_0xddc785(0x159));if(!_0x10a70e){const _0x18322a=Object['keys'](_0x3a9839);if(_0x18322a[_0xddc785(0x15d)]===0x0)console['log'](_0xddc785(0x149));else{console[_0xddc785(0x131)](_0xddc785(0x15c));for(const _0x2b2dcd of _0x18322a){console[_0xddc785(0x131)]('\x20\x20\x20\x20'+_0x2b2dcd);}console[_0xddc785(0x131)](_0xddc785(0x14c)+CLI_BIN_NAME+_0xddc785(0x15f));}return{'ok':!![]};}if(!_0x3a9839[_0x10a70e])throw CliErrors['validation'](_0xddc785(0x16b)+_0x10a70e+_0xddc785(0x16d),'Available:\x20'+(Object[_0xddc785(0x137)](_0x3a9839)[_0xddc785(0x142)](',\x20')||'(none)'));const _0x411536=detectPackageManager(_0x1ad13c);VERSION_CHECK_SCRIPTS[_0xddc785(0x156)](_0x10a70e)&&await versionCheck(_0x1ad13c);if(_0x10a70e===_0xddc785(0x144)&&_0x51d8b4[_0xddc785(0x170)](_0xddc785(0x130)))return await Promise['all']([spawnViteBuildWatch(_0x1ad13c),spawnVitePreview(_0x1ad13c)]),{'ok':!![]};return await spawnScript(_0x411536,_0x10a70e,_0x16c4cb,_0x1ad13c),{'ok':!![]};}};
1
+ const a207_0xfa70a2=a207_0x4b55;(function(_0x29588c,_0x465cb5){const _0x4a517a=a207_0x4b55,_0x55bc00=_0x29588c();while(!![]){try{const _0x385995=parseInt(_0x4a517a(0xd6))/0x1*(parseInt(_0x4a517a(0xba))/0x2)+-parseInt(_0x4a517a(0xbb))/0x3*(-parseInt(_0x4a517a(0xe5))/0x4)+-parseInt(_0x4a517a(0xc8))/0x5*(-parseInt(_0x4a517a(0xc4))/0x6)+parseInt(_0x4a517a(0xd2))/0x7+parseInt(_0x4a517a(0xe0))/0x8+parseInt(_0x4a517a(0xd3))/0x9*(-parseInt(_0x4a517a(0xd1))/0xa)+parseInt(_0x4a517a(0xc6))/0xb*(-parseInt(_0x4a517a(0xc3))/0xc);if(_0x385995===_0x465cb5)break;else _0x55bc00['push'](_0x55bc00['shift']());}catch(_0x2b4923){_0x55bc00['push'](_0x55bc00['shift']());}}}(a207_0x13bc,0x3f665));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',a207_0xfa70a2(0xd7)]);function readPackageScripts(_0x5b6e1a){const _0x5ed603=a207_0xfa70a2,_0x215918=resolve(_0x5b6e1a,_0x5ed603(0xcb));if(!existsSync(_0x215918))return null;try{const _0x567818=JSON[_0x5ed603(0xc9)](readFileSync(_0x215918,_0x5ed603(0xda)));return _0x567818[_0x5ed603(0xce)]??{};}catch{return null;}}function detectPackageManager(_0x488539){const _0x2031de=a207_0xfa70a2;if(existsSync(resolve(_0x488539,_0x2031de(0xbc)))||existsSync(resolve(_0x488539,_0x2031de(0xc7))))return _0x2031de(0xdf);if(existsSync(resolve(_0x488539,_0x2031de(0xb9))))return _0x2031de(0xbf);if(existsSync(resolve(_0x488539,_0x2031de(0xb4))))return'yarn';return _0x2031de(0xc0);}async function versionCheck(_0x219c4a){const _0x4ac8c7=a207_0xfa70a2,_0x28c0a4=await checkCliVersion();(_0x28c0a4[_0x4ac8c7(0xd0)]||_0x28c0a4['belowMinimum'])&&(printCliUpgradeWarning(_0x28c0a4),assertCliVersionSupported(_0x28c0a4));const _0x23400e=await checkSdkVersion(_0x219c4a);if(_0x23400e[_0x4ac8c7(0xd0)])printSdkUpgradeWarning(_0x23400e);}function a207_0x4b55(_0x51b486,_0x1e97b8){_0x51b486=_0x51b486-0xb3;const _0x13bcbb=a207_0x13bc();let _0x4b555b=_0x13bcbb[_0x51b486];return _0x4b555b;}function a207_0x13bc(){const _0x422af4=['push','package.json','all','Run\x20a\x20package.json\x20script','scripts','validation','needsUpgrade','50ibFLix','2852766kBWtlY','39429jJSANZ','keys','vite\x20build\x20--watch\x20exited\x20with\x20code\x20','3718WxYzsg','dev','vite\x20preview\x20exited\x20with\x20code\x20','log','utf-8','args','\x0a\x20\x20Usage:\x20','cwd','\x20run\x20start','bun','2632856njPnvd','Available:\x20','join','\x20exited\x20with\x20code\x20','boolean','2284FatsJt','--watch','watch','slice','.bin','length','bool','script','Enable\x20watch\x20mode\x20for\x20preview','\x20run\x20<script>\x0a','Script\x20\x22','yarn.lock','\x20\x20\x20\x20','(none)','preview','inherit','pnpm-lock.yaml','6IUBjcO','2643NVtxky','bun.lockb','run','node_modules','pnpm','npm','close','error','14892ZFyPTB','66AsmLdc','Script\x20name\x20defined\x20in\x20package.json','12067YnCfgv','bun.lock','178235uIYdbb','parse'];a207_0x13bc=function(){return _0x422af4;};return a207_0x13bc();}function spawnScript(_0x30c2db,_0x163579,_0x5a80b1,_0x5ec22d){return new Promise((_0x565629,_0x344cb3)=>{const _0x59d47e=a207_0x4b55,_0x17146f=[_0x59d47e(0xbd),_0x163579,..._0x5a80b1],_0x2fcfb0=spawn(_0x30c2db,_0x17146f,{'cwd':_0x5ec22d,'stdio':_0x59d47e(0xb8),'shell':!![],'env':{...process.env,'PATH':''+join(_0x5ec22d,'node_modules',_0x59d47e(0xe9))+delimiter+process.env.PATH}});_0x2fcfb0['on'](_0x59d47e(0xc1),_0x3646eb=>{const _0x3da486=_0x59d47e;if(_0x3646eb===0x0||_0x3646eb===null)_0x565629();else _0x344cb3(new Error(_0x30c2db+'\x20run\x20'+_0x163579+_0x3da486(0xe3)+_0x3646eb));}),_0x2fcfb0['on'](_0x59d47e(0xc2),_0x344cb3);});}function spawnViteBuildWatch(_0x441761){return new Promise((_0x2083a7,_0x3e280c)=>{const _0x1a5fa9=a207_0x4b55,_0x1f1a35=spawn('vite',['build',_0x1a5fa9(0xe6)],{'cwd':_0x441761,'stdio':'inherit','shell':!![],'env':{...process.env,'PATH':''+join(_0x441761,_0x1a5fa9(0xbe),_0x1a5fa9(0xe9))+delimiter+process.env.PATH}});_0x1f1a35['on']('close',_0x51b582=>{const _0x42eaf2=_0x1a5fa9;if(_0x51b582===0x0||_0x51b582===null)_0x2083a7();else _0x3e280c(new Error(_0x42eaf2(0xd5)+_0x51b582));}),_0x1f1a35['on'](_0x1a5fa9(0xc2),_0x3e280c);});}function spawnVitePreview(_0x2089a4){return new Promise((_0x3b2156,_0x1c1ed9)=>{const _0x3bd980=a207_0x4b55,_0x4c9094=spawn('vite',[_0x3bd980(0xb7)],{'cwd':_0x2089a4,'stdio':_0x3bd980(0xb8),'shell':!![],'env':{...process.env,'PATH':''+join(_0x2089a4,_0x3bd980(0xbe),'.bin')+delimiter+process.env.PATH}});_0x4c9094['on'](_0x3bd980(0xc1),_0x5b4616=>{const _0x432518=_0x3bd980;if(_0x5b4616===0x0||_0x5b4616===null)_0x3b2156();else _0x1c1ed9(new Error(_0x432518(0xd8)+_0x5b4616));}),_0x4c9094['on'](_0x3bd980(0xc2),_0x1c1ed9);});}const runFlags=[{'name':a207_0xfa70a2(0xe7),'type':a207_0xfa70a2(0xe4),'description':a207_0xfa70a2(0xed),'default':![]}];export const runDefinition={'service':a207_0xfa70a2(0xbd),'command':'run','description':a207_0xfa70a2(0xcd),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'args':[{'name':a207_0xfa70a2(0xec),'description':a207_0xfa70a2(0xc5),'required':![]}],'flags':runFlags,'helpExtra':()=>{const _0x42ad89=a207_0xfa70a2,_0x3f9568=[];return _0x3f9568['push']('\x20\x20EXAMPLES'),_0x3f9568[_0x42ad89(0xca)](_0x42ad89(0xb5)+CLI_BIN_NAME+_0x42ad89(0xde)),_0x3f9568[_0x42ad89(0xca)](_0x42ad89(0xb5)+CLI_BIN_NAME+'\x20run\x20build'),_0x3f9568['push'](_0x42ad89(0xb5)+CLI_BIN_NAME+'\x20run\x20preview'),_0x3f9568[_0x42ad89(0xca)](_0x42ad89(0xb5)+CLI_BIN_NAME+'\x20run\x20preview\x20--watch'),_0x3f9568[_0x42ad89(0xe2)]('\x0a');},async 'execute'(_0x563ede){const _0x42af62=a207_0xfa70a2,_0x506b21=process[_0x42af62(0xdd)](),_0x539b4d=_0x563ede[_0x42af62(0xdb)][0x0],_0x8b13da=_0x563ede[_0x42af62(0xdb)][_0x42af62(0xe8)](0x1),_0x2543d2=readPackageScripts(_0x506b21);if(!_0x2543d2)throw CliErrors[_0x42af62(0xcf)]('No\x20package.json\x20found\x20in\x20current\x20directory.');if(!_0x539b4d){const _0x3f47fa=Object[_0x42af62(0xd4)](_0x2543d2);if(_0x3f47fa[_0x42af62(0xea)]===0x0)console[_0x42af62(0xd9)]('No\x20scripts\x20defined\x20in\x20package.json.');else{console[_0x42af62(0xd9)]('\x0a\x20\x20Available\x20scripts:\x0a');for(const _0x56e849 of _0x3f47fa){console[_0x42af62(0xd9)]('\x20\x20\x20\x20'+_0x56e849);}console[_0x42af62(0xd9)](_0x42af62(0xdc)+CLI_BIN_NAME+_0x42af62(0xee));}return{'ok':!![]};}if(!_0x2543d2[_0x539b4d])throw CliErrors[_0x42af62(0xcf)](_0x42af62(0xb3)+_0x539b4d+'\x22\x20not\x20found\x20in\x20package.json.',_0x42af62(0xe1)+(Object[_0x42af62(0xd4)](_0x2543d2)[_0x42af62(0xe2)](',\x20')||_0x42af62(0xb6)));const _0x516bb5=detectPackageManager(_0x506b21);VERSION_CHECK_SCRIPTS['has'](_0x539b4d)&&await versionCheck(_0x506b21);if(_0x539b4d===_0x42af62(0xb7)&&_0x563ede[_0x42af62(0xeb)](_0x42af62(0xe7)))return await Promise[_0x42af62(0xcc)]([spawnViteBuildWatch(_0x506b21),spawnVitePreview(_0x506b21)]),{'ok':!![]};return await spawnScript(_0x516bb5,_0x539b4d,_0x8b13da,_0x506b21),{'ok':!![]};}};
@@ -1 +1 @@
1
- function a195_0x4af5(_0x21ebde,_0x3ae9b5){_0x21ebde=_0x21ebde-0x12f;const _0x2ee017=a195_0x2ee0();let _0x4af5a3=_0x2ee017[_0x21ebde];return _0x4af5a3;}const a195_0x31ffb0=a195_0x4af5;(function(_0x389947,_0x3b374a){const _0x56314e=a195_0x4af5,_0x592989=_0x389947();while(!![]){try{const _0x12993b=-parseInt(_0x56314e(0x134))/0x1*(parseInt(_0x56314e(0x131))/0x2)+-parseInt(_0x56314e(0x13b))/0x3+parseInt(_0x56314e(0x13c))/0x4+-parseInt(_0x56314e(0x13a))/0x5*(parseInt(_0x56314e(0x139))/0x6)+parseInt(_0x56314e(0x138))/0x7*(parseInt(_0x56314e(0x135))/0x8)+parseInt(_0x56314e(0x137))/0x9+parseInt(_0x56314e(0x136))/0xa*(parseInt(_0x56314e(0x130))/0xb);if(_0x12993b===_0x3b374a)break;else _0x592989['push'](_0x592989['shift']());}catch(_0x5e217e){_0x592989['push'](_0x592989['shift']());}}}(a195_0x2ee0,0x2053c));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x22a868){const _0xba9cae=await buildSchemaPayload();return{'ok':!![],'data':_0xba9cae};}function a195_0x2ee0(){const _0x8b5a85=['2GIFMvq','read','export','256471kCQoRe','2012440zRBDgV','20rlgiYz','1136619tTxjLO','7hmrgQX','6GRUDvx','529420gBglEG','248187qUUgdE','354272IVbBXM','schema','json','Export\x20machine-readable\x20command\x20schema\x20(JSON)','610951zehWth'];a195_0x2ee0=function(){return _0x8b5a85;};return a195_0x2ee0();}export const schemaDefinition={'service':a195_0x31ffb0(0x13d),'command':a195_0x31ffb0(0x133),'description':a195_0x31ffb0(0x12f),'risk':a195_0x31ffb0(0x132),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a195_0x31ffb0(0x13e),'flags':[],'execute':execute};
1
+ function a208_0xed31(_0x8be045,_0x523f42){_0x8be045=_0x8be045-0xaa;const _0x26198a=a208_0x2619();let _0xed31=_0x26198a[_0x8be045];return _0xed31;}const a208_0x4ed39b=a208_0xed31;(function(_0x469165,_0x770c2e){const _0x502b26=a208_0xed31,_0x15d443=_0x469165();while(!![]){try{const _0x239916=-parseInt(_0x502b26(0xb5))/0x1+-parseInt(_0x502b26(0xb6))/0x2*(parseInt(_0x502b26(0xaa))/0x3)+-parseInt(_0x502b26(0xb1))/0x4+parseInt(_0x502b26(0xb2))/0x5*(parseInt(_0x502b26(0xad))/0x6)+-parseInt(_0x502b26(0xb7))/0x7+parseInt(_0x502b26(0xb3))/0x8*(parseInt(_0x502b26(0xac))/0x9)+-parseInt(_0x502b26(0xab))/0xa*(-parseInt(_0x502b26(0xb0))/0xb);if(_0x239916===_0x770c2e)break;else _0x15d443['push'](_0x15d443['shift']());}catch(_0x49705f){_0x15d443['push'](_0x15d443['shift']());}}}(a208_0x2619,0xa203f));import{buildSchemaPayload}from'../framework/schema-export.js';async function execute(_0x24a2c6){const _0x46f324=await buildSchemaPayload();return{'ok':!![],'data':_0x46f324};}function a208_0x2619(){const _0x56f9e4=['Export\x20machine-readable\x20command\x20schema\x20(JSON)','json','1441HIENej','2844004oRZlKK','54110nzRWiX','184JHkJNQ','read','1150742jIMWVb','46ITyPOv','3916892fjhcqh','59937mUaZbB','164420CdrDwg','391671HMxwyP','216apHVxq'];a208_0x2619=function(){return _0x56f9e4;};return a208_0x2619();}export const schemaDefinition={'service':'schema','command':'export','description':a208_0x4ed39b(0xae),'risk':a208_0x4ed39b(0xb4),'requiresAuth':![],'requiresAppCode':![],'hasFormat':!![],'defaultOutputFormat':a208_0x4ed39b(0xaf),'flags':[],'execute':execute};
@@ -1 +1 @@
1
- const a196_0x2507a9=a196_0x5551;(function(_0x11d8cd,_0x1fc40d){const _0x4e6a47=a196_0x5551,_0x3f9ff1=_0x11d8cd();while(!![]){try{const _0x42a661=-parseInt(_0x4e6a47(0x171))/0x1+parseInt(_0x4e6a47(0x16f))/0x2*(parseInt(_0x4e6a47(0x140))/0x3)+parseInt(_0x4e6a47(0x150))/0x4+-parseInt(_0x4e6a47(0x146))/0x5*(parseInt(_0x4e6a47(0x147))/0x6)+-parseInt(_0x4e6a47(0x153))/0x7+-parseInt(_0x4e6a47(0x166))/0x8*(parseInt(_0x4e6a47(0x16c))/0x9)+parseInt(_0x4e6a47(0x14f))/0xa;if(_0x42a661===_0x1fc40d)break;else _0x3f9ff1['push'](_0x3f9ff1['shift']());}catch(_0x569308){_0x3f9ff1['push'](_0x3f9ff1['shift']());}}}(a196_0x1f31,0x74a0d));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';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function generateSqlTemplate(_0x3009de){const _0x50f506=a196_0x5551;if(_0x3009de===_0x50f506(0x15f))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>',_0x50f506(0x154),_0x50f506(0x157),''][_0x50f506(0x14b)]('\x0a');return['SELECT\x201\x20AS\x20id;','']['join']('\x0a');}function a196_0x5551(_0x5f34d3,_0x306ea0){_0x5f34d3=_0x5f34d3-0x139;const _0x1f3132=a196_0x1f31();let _0x55516f=_0x1f3132[_0x5f34d3];return _0x55516f;}export const sqlCreate={'service':'sql','command':a196_0x2507a9(0x15a),'description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a196_0x2507a9(0x152),'flags':[{'name':a196_0x2507a9(0x16b),'type':a196_0x2507a9(0x173),'description':a196_0x2507a9(0x16e)},{'name':a196_0x2507a9(0x165),'type':a196_0x2507a9(0x14d),'description':a196_0x2507a9(0x164)},{'name':a196_0x2507a9(0x13b),'type':'string','enum':[a196_0x2507a9(0x14e),a196_0x2507a9(0x15f)],'description':a196_0x2507a9(0x16d)}],async 'validate'(_0x3ee36b){const _0x4deab5=a196_0x2507a9;if(!_0x3ee36b[_0x4deab5(0x13a)])return;if(!_0x3ee36b[_0x4deab5(0x14c)](_0x4deab5(0x16b))[_0x4deab5(0x168)]())throw CliErrors['flagMissing']('name','--name\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x460188=resolveProvidedDbId(_0x3ee36b);if(typeof _0x460188!==_0x4deab5(0x14d)||!Number['isFinite'](_0x460188)||_0x460188<=0x0)throw CliErrors[_0x4deab5(0x162)]('db-id',_0x4deab5(0x170));if(!_0x3ee36b[_0x4deab5(0x14c)](_0x4deab5(0x13b))[_0x4deab5(0x168)]())throw CliErrors['flagMissing'](_0x4deab5(0x13b),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x7b1e59){const _0x265cbd=a196_0x2507a9,_0x3022e6=loadSqlProjectConfig(_0x7b1e59['appCode']),{sqlName:_0x3fb160,dbId:_0x18777a,dbName:_0x46aaa4,mode:_0xa7f806}=await resolveSqlNewInputs(_0x7b1e59),_0x5404e1=buildSqlRelativePath('<server-generated-sqlCode>',_0x3fb160,_0x46aaa4,_0xa7f806,_0x18777a),_0x5b6ae7=_0x3022e6[_0x265cbd(0x178)]+'/'+_0x5404e1;return{'method':_0x265cbd(0x174),'url':_0x265cbd(0x179),'body':{'appCode':_0x7b1e59['appCode'],'sqlName':_0x3fb160,'dbId':_0x18777a,'mode':_0xa7f806,'localPath':_0x5b6ae7},'description':_0x265cbd(0x15e)+_0x3022e6['sqlRootDir']};},async 'execute'(_0x445952){const _0x46cca8=a196_0x2507a9,_0x1c671b=loadSqlProjectConfig(_0x445952['appCode']),{sqlName:_0x5c2a2c,dbId:_0x89c255,dbName:_0x1aed63,mode:_0x302c7f}=await resolveSqlNewInputs(_0x445952),_0x58513=generateSqlTemplate(_0x302c7f),_0x2bd5ef=await createSqlQuery({'appCode':_0x445952[_0x46cca8(0x163)],'sqlName':_0x5c2a2c,'dbId':_0x89c255,'sqlContent':_0x58513}),_0x5be2b3=ensureRemoteSqlContent(_0x2bd5ef),_0x1569dd=_0x1aed63||await getDbName(_0x445952['appCode'],_0x89c255)['catch'](()=>undefined),_0x43b151=buildSqlRelativePath(_0x2bd5ef[_0x46cca8(0x148)],_0x2bd5ef[_0x46cca8(0x177)],_0x1569dd,_0x302c7f,_0x89c255),_0x10b9a8=_0x1c671b[_0x46cca8(0x178)]+'/'+_0x43b151,_0x1a3ef3=buildLocalSqlFileContent({'sqlCode':_0x2bd5ef[_0x46cca8(0x148)],'sqlName':_0x2bd5ef['sqlName'],'dbId':_0x2bd5ef[_0x46cca8(0x143)]},_0x5be2b3,{'dbName':_0x1569dd,'mode':_0x302c7f,'syncedAt':new Date()[_0x46cca8(0x13e)](),'description':_0x2bd5ef[_0x46cca8(0x167)]});if(await fileExists(_0x10b9a8))throw CliErrors[_0x46cca8(0x172)]('File\x20already\x20exists:\x20'+_0x10b9a8);await ensureParentDirectory(_0x10b9a8),await writeFile(_0x10b9a8,_0x1a3ef3,_0x46cca8(0x156));const _0x17ccf7=await readSqlLockFile(_0x1c671b[_0x46cca8(0x13f)]),{lockData:_0x30cc98,appLock:_0x3fd3ef}=ensureSqlLockScope(_0x17ccf7??createEmptySqlLock(),_0x1c671b['appCode'],_0x1c671b[_0x46cca8(0x15c)],'new');return _0x3fd3ef[_0x46cca8(0x175)][_0x2bd5ef[_0x46cca8(0x148)]]={...buildSqlLockEntry(_0x2bd5ef,_0x5be2b3,computeSqlContentHash(_0x1a3ef3),{'dbName':_0x1569dd}),'path':_0x43b151,'mode':_0x302c7f},_0x3fd3ef[_0x46cca8(0x144)]=new Date()[_0x46cca8(0x13e)](),await writeSqlLockFile(_0x1c671b[_0x46cca8(0x13f)],_0x30cc98),{'ok':!![],'data':{'id':_0x2bd5ef['id'],'sqlCode':_0x2bd5ef[_0x46cca8(0x148)],'sqlName':_0x2bd5ef[_0x46cca8(0x177)],'dbId':_0x2bd5ef[_0x46cca8(0x143)],'path':_0x10b9a8,'mode':_0x302c7f},'message':_0x46cca8(0x15b)+_0x2bd5ef[_0x46cca8(0x148)]};}};async function resolveSqlNewInputs(_0x4702bd){const _0x3d610e=await resolveSqlNameInput(_0x4702bd),{dbId:_0x970c16,dbName:_0x2f9186}=await resolveDbSelection(_0x4702bd),_0x463313=await resolveSqlModeInput(_0x4702bd);return{'sqlName':_0x3d610e,'dbId':_0x970c16,'dbName':_0x2f9186,'mode':_0x463313};}async function resolveSqlNameInput(_0x5360f7){const _0x579d73=a196_0x2507a9,_0x4f2725=_0x5360f7[_0x579d73(0x14c)](_0x579d73(0x16b))['trim']();if(_0x4f2725)return _0x4f2725;if(_0x5360f7[_0x579d73(0x13a)])throw CliErrors[_0x579d73(0x162)](_0x579d73(0x16b),_0x579d73(0x141));return(await input({'message':_0x579d73(0x159),'validate':_0x3f33a5=>_0x3f33a5['trim']()?!![]:_0x579d73(0x15d)}))[_0x579d73(0x168)]();}async function resolveDbSelection(_0x1a9f75){const _0x493f7f=a196_0x2507a9,_0xb4c559=resolveProvidedDbId(_0x1a9f75);if(typeof _0xb4c559===_0x493f7f(0x14d)&&Number['isFinite'](_0xb4c559)&&_0xb4c559>0x0)return{'dbId':_0xb4c559,'dbName':await getDbName(_0x1a9f75[_0x493f7f(0x163)],_0xb4c559)[_0x493f7f(0x14a)](()=>undefined)};if(_0x1a9f75[_0x493f7f(0x13a)])throw CliErrors['flagMissing'](_0x493f7f(0x165),_0x493f7f(0x170));const _0x5f16b3=await listDatabases(_0x1a9f75[_0x493f7f(0x163)])[_0x493f7f(0x14a)](()=>[]);if(_0x5f16b3['length']===0x1)return{'dbId':_0x5f16b3[0x0][_0x493f7f(0x143)],'dbName':_0x5f16b3[0x0][_0x493f7f(0x16a)]};if(_0x5f16b3[_0x493f7f(0x139)]>0x1){const _0x352504=await select({'message':'Select\x20the\x20target\x20database:','choices':[..._0x5f16b3[_0x493f7f(0x145)](_0x15c847=>({'name':_0x15c847[_0x493f7f(0x16a)]+'\x20('+_0x15c847[_0x493f7f(0x143)]+')','value':serializeDbSelection(_0x15c847)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':_0x493f7f(0x160)}]});if(_0x352504!==_0x493f7f(0x160))return deserializeDbSelection(_0x352504);}const _0x573fa2=await input({'message':'Target\x20database\x20dbId:','validate':_0x241694=>{const _0x2b28b4=_0x493f7f,_0x347dc8=_0x241694[_0x2b28b4(0x168)]();if(!_0x347dc8)return _0x2b28b4(0x176);const _0x2626d2=Number(_0x347dc8);if(!Number[_0x2b28b4(0x13d)](_0x2626d2)||_0x2626d2<=0x0)return _0x2b28b4(0x13c);return!![];}});return{'dbId':Number(_0x573fa2[_0x493f7f(0x168)]())};}async function resolveSqlModeInput(_0xb31742){const _0x288a7f=a196_0x2507a9,_0x1ccd75=_0xb31742['str']('mode')[_0x288a7f(0x168)]();if(_0x1ccd75==='sql'||_0x1ccd75===_0x288a7f(0x15f))return _0x1ccd75;if(_0xb31742['nonInteractive'])throw CliErrors[_0x288a7f(0x162)]('mode',_0x288a7f(0x158));return await select({'message':_0x288a7f(0x155),'choices':[{'name':_0x288a7f(0x149),'value':'sql','description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x288a7f(0x142),'value':_0x288a7f(0x15f),'description':_0x288a7f(0x151)}]});}function serializeDbSelection(_0x4659d6){const _0x16a9bf=a196_0x2507a9;return JSON['stringify']({'dbId':_0x4659d6[_0x16a9bf(0x143)],'dbName':_0x4659d6[_0x16a9bf(0x16a)]});}function a196_0x1f31(){const _0x38a931=['--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.','113748DydVkN','validation','string','POST','sqls','dbId\x20cannot\x20be\x20empty','sqlName','sqlRootDir','/smartapi/custom/saveUserCustomSql','length','nonInteractive','mode','dbId\x20must\x20be\x20a\x20positive\x20integer','isInteger','toISOString','lockFilePath','5361eijvYY','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','MyBatis\x20XML\x20(mybatisXml)','dbId','lastSync','map','18175MmBfEE','42ijSpaZ','sqlCode','Plain\x20SQL\x20(sql)','catch','join','str','number','sql','8935420ayEDjr','1397556tOwltB','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','write','3022033RQxTpL','\x20\x20SELECT\x201\x20AS\x20id','Select\x20the\x20local\x20SQL\x20mode:','utf8','</select>','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','SQL\x20name:','create','Created\x20SQL\x20query\x20','sqlRoot','SQL\x20name\x20cannot\x20be\x20empty','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','mybatisXml','__manual__','flag','flagMissing','appCode','Target\x20database\x20ID','db-id','608zPqGjb','description','trim','isFinite','dbName','name','75915YfPeUm','Local\x20SQL\x20file\x20mode','SQL\x20query\x20display\x20name','500HxaIYa'];a196_0x1f31=function(){return _0x38a931;};return a196_0x1f31();}function deserializeDbSelection(_0x1e521){const _0x2b4a2b=a196_0x2507a9;try{const _0x3ac61d=JSON['parse'](_0x1e521);if(typeof _0x3ac61d['dbId']===_0x2b4a2b(0x14d)&&Number[_0x2b4a2b(0x169)](_0x3ac61d[_0x2b4a2b(0x143)]))return{'dbId':_0x3ac61d[_0x2b4a2b(0x143)],'dbName':_0x3ac61d[_0x2b4a2b(0x16a)]};}catch{}throw CliErrors[_0x2b4a2b(0x172)]('Invalid\x20database\x20selection\x20payload:\x20'+_0x1e521);}function resolveProvidedDbId(_0x74cc90){const _0x5b856d=a196_0x2507a9,_0x169043=_0x74cc90[_0x5b856d(0x161)](_0x5b856d(0x165));if(typeof _0x169043===_0x5b856d(0x14d)&&Number[_0x5b856d(0x169)](_0x169043))return _0x169043;return undefined;}
1
+ const a209_0x1968a7=a209_0x442f;(function(_0x229539,_0xf8cf67){const _0x1372a1=a209_0x442f,_0x4eaee3=_0x229539();while(!![]){try{const _0x1ec23f=-parseInt(_0x1372a1(0x96))/0x1*(-parseInt(_0x1372a1(0xa7))/0x2)+-parseInt(_0x1372a1(0x91))/0x3*(-parseInt(_0x1372a1(0x8b))/0x4)+-parseInt(_0x1372a1(0xbf))/0x5*(-parseInt(_0x1372a1(0xb4))/0x6)+parseInt(_0x1372a1(0xb7))/0x7*(-parseInt(_0x1372a1(0x8f))/0x8)+parseInt(_0x1372a1(0x9c))/0x9+-parseInt(_0x1372a1(0xc0))/0xa+-parseInt(_0x1372a1(0x98))/0xb*(-parseInt(_0x1372a1(0x9d))/0xc);if(_0x1ec23f===_0xf8cf67)break;else _0x4eaee3['push'](_0x4eaee3['shift']());}catch(_0x30b9a6){_0x4eaee3['push'](_0x4eaee3['shift']());}}}(a209_0x4c95,0xe4be3));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';function a209_0x442f(_0x43a253,_0x7614d1){_0x43a253=_0x43a253-0x89;const _0x4c9559=a209_0x4c95();let _0x442f67=_0x4c9559[_0x43a253];return _0x442f67;}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{buildSqlRelativePath}from'../../core/sql-sync/utils.js';import{CliErrors}from'../../errors.js';import{buildLocalSqlFileContent,buildSqlLockEntry,ensureRemoteSqlContent}from'./shared.js';function a209_0x4c95(){const _0x28c071=['flag','12WOVDQv','length','Created\x20SQL\x20query\x20','42JxrxKO','For\x20MyBatis\x20XML\x20SQL\x20with\x20dynamic\x20tags','appCode','db-id','sqlCode','trim','sql','mybatisXml','2864630juuevs','14060920qxhpZc','str','Target\x20database\x20dbId:','name','<server-generated-sqlCode>','lockFilePath','map','8xvMdpe','toISOString','lastSync','flagMissing','1621024wakpBL','isFinite','63663XfxCsW','description','nonInteractive','isInteger','SQL\x20query\x20display\x20name','1LkUdsD','Target\x20database\x20ID','151789zYPuvs','SELECT\x201\x20AS\x20id;','SQL\x20name:','__manual__','6499080ZFHRva','1188nIcDMa','Invalid\x20database\x20selection\x20payload:\x20','sqlRootDir','Plain\x20SQL\x20(sql)','new','--mode\x20is\x20required\x20in\x20non-interactive\x20mode.','mode','sqlName','write','--name\x20is\x20required\x20in\x20non-interactive\x20mode.','564552TjgWPt','string','dbId','dbName','Would\x20create\x20a\x20new\x20SQL\x20query\x20and\x20scaffold\x20it\x20under\x20','validation','Local\x20SQL\x20file\x20mode','catch','number','sqls','MyBatis\x20XML\x20(mybatisXml)','SQL\x20name\x20cannot\x20be\x20empty'];a209_0x4c95=function(){return _0x28c071;};return a209_0x4c95();}function generateSqlTemplate(_0x489cf7){const _0x22185c=a209_0x442f;if(_0x489cf7===_0x22185c(0xbe))return['<select\x20id=\x22query\x22\x20resultType=\x22map\x22>','\x20\x20SELECT\x201\x20AS\x20id','</select>','']['join']('\x0a');return[_0x22185c(0x99),'']['join']('\x0a');}export const sqlCreate={'service':'sql','command':'create','description':'Create\x20a\x20new\x20custom\x20SQL\x20and\x20scaffold\x20it\x20locally','risk':a209_0x1968a7(0xa5),'flags':[{'name':a209_0x1968a7(0xc3),'type':a209_0x1968a7(0xa8),'description':a209_0x1968a7(0x95)},{'name':a209_0x1968a7(0xba),'type':a209_0x1968a7(0xaf),'description':a209_0x1968a7(0x97)},{'name':a209_0x1968a7(0xa3),'type':a209_0x1968a7(0xa8),'enum':[a209_0x1968a7(0xbd),a209_0x1968a7(0xbe)],'description':a209_0x1968a7(0xad)}],async 'validate'(_0x48375e){const _0x477375=a209_0x1968a7;if(!_0x48375e['nonInteractive'])return;if(!_0x48375e[_0x477375(0xc1)]('name')[_0x477375(0xbc)]())throw CliErrors[_0x477375(0x8e)]('name',_0x477375(0xa6));const _0xf86bbc=resolveProvidedDbId(_0x48375e);if(typeof _0xf86bbc!=='number'||!Number[_0x477375(0x90)](_0xf86bbc)||_0xf86bbc<=0x0)throw CliErrors[_0x477375(0x8e)](_0x477375(0xba),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');if(!_0x48375e[_0x477375(0xc1)]('mode')[_0x477375(0xbc)]())throw CliErrors[_0x477375(0x8e)](_0x477375(0xa3),'--mode\x20is\x20required\x20in\x20non-interactive\x20mode.');},async 'dryRun'(_0x4e6388){const _0x4d1fcf=a209_0x1968a7,_0x3e3549=loadSqlProjectConfig(_0x4e6388['appCode']),{sqlName:_0x554891,dbId:_0x2490e5,dbName:_0x42f7e3,mode:_0xe88bc}=await resolveSqlNewInputs(_0x4e6388),_0x4e0f17=buildSqlRelativePath(_0x4d1fcf(0xc4),_0x554891,_0x42f7e3,_0xe88bc,_0x2490e5),_0x1625f4=_0x3e3549[_0x4d1fcf(0x9f)]+'/'+_0x4e0f17;return{'method':'POST','url':'/smartapi/custom/saveUserCustomSql','body':{'appCode':_0x4e6388[_0x4d1fcf(0xb9)],'sqlName':_0x554891,'dbId':_0x2490e5,'mode':_0xe88bc,'localPath':_0x1625f4},'description':_0x4d1fcf(0xab)+_0x3e3549[_0x4d1fcf(0x9f)]};},async 'execute'(_0x516e1){const _0x291ac7=a209_0x1968a7,_0x3c831=loadSqlProjectConfig(_0x516e1[_0x291ac7(0xb9)]),{sqlName:_0x419304,dbId:_0x37b047,dbName:_0x2727e5,mode:_0xb23646}=await resolveSqlNewInputs(_0x516e1),_0x6ef36e=generateSqlTemplate(_0xb23646),_0x8a52a8=await createSqlQuery({'appCode':_0x516e1[_0x291ac7(0xb9)],'sqlName':_0x419304,'dbId':_0x37b047,'sqlContent':_0x6ef36e}),_0x2802b6=ensureRemoteSqlContent(_0x8a52a8),_0x2a9ca0=_0x2727e5||await getDbName(_0x516e1[_0x291ac7(0xb9)],_0x37b047)[_0x291ac7(0xae)](()=>undefined),_0x3f5b2e=buildSqlRelativePath(_0x8a52a8['sqlCode'],_0x8a52a8['sqlName'],_0x2a9ca0,_0xb23646,_0x37b047),_0x13d618=_0x3c831['sqlRootDir']+'/'+_0x3f5b2e,_0x99ebe7=buildLocalSqlFileContent({'sqlCode':_0x8a52a8['sqlCode'],'sqlName':_0x8a52a8[_0x291ac7(0xa4)],'dbId':_0x8a52a8[_0x291ac7(0xa9)]},_0x2802b6,{'dbName':_0x2a9ca0,'mode':_0xb23646,'syncedAt':new Date()[_0x291ac7(0x8c)](),'description':_0x8a52a8[_0x291ac7(0x92)]});if(await fileExists(_0x13d618))throw CliErrors[_0x291ac7(0xac)]('File\x20already\x20exists:\x20'+_0x13d618);await ensureParentDirectory(_0x13d618),await writeFile(_0x13d618,_0x99ebe7,'utf8');const _0x337abe=await readSqlLockFile(_0x3c831['lockFilePath']),{lockData:_0x2b1854,appLock:_0x2d66ba}=ensureSqlLockScope(_0x337abe??createEmptySqlLock(),_0x3c831[_0x291ac7(0xb9)],_0x3c831['sqlRoot'],_0x291ac7(0xa1));return _0x2d66ba[_0x291ac7(0xb0)][_0x8a52a8['sqlCode']]={...buildSqlLockEntry(_0x8a52a8,_0x2802b6,computeSqlContentHash(_0x99ebe7),{'dbName':_0x2a9ca0}),'path':_0x3f5b2e,'mode':_0xb23646},_0x2d66ba[_0x291ac7(0x8d)]=new Date()[_0x291ac7(0x8c)](),await writeSqlLockFile(_0x3c831[_0x291ac7(0x89)],_0x2b1854),{'ok':!![],'data':{'id':_0x8a52a8['id'],'sqlCode':_0x8a52a8['sqlCode'],'sqlName':_0x8a52a8[_0x291ac7(0xa4)],'dbId':_0x8a52a8['dbId'],'path':_0x13d618,'mode':_0xb23646},'message':_0x291ac7(0xb6)+_0x8a52a8[_0x291ac7(0xbb)]};}};async function resolveSqlNewInputs(_0x27a370){const _0x426756=await resolveSqlNameInput(_0x27a370),{dbId:_0x1de100,dbName:_0x3f7120}=await resolveDbSelection(_0x27a370),_0x56b6e5=await resolveSqlModeInput(_0x27a370);return{'sqlName':_0x426756,'dbId':_0x1de100,'dbName':_0x3f7120,'mode':_0x56b6e5};}async function resolveSqlNameInput(_0x2f12e9){const _0x89412d=a209_0x1968a7,_0x11c60a=_0x2f12e9[_0x89412d(0xc1)](_0x89412d(0xc3))[_0x89412d(0xbc)]();if(_0x11c60a)return _0x11c60a;if(_0x2f12e9[_0x89412d(0x93)])throw CliErrors[_0x89412d(0x8e)](_0x89412d(0xc3),_0x89412d(0xa6));return(await input({'message':_0x89412d(0x9a),'validate':_0x1d7bb6=>_0x1d7bb6[_0x89412d(0xbc)]()?!![]:_0x89412d(0xb2)}))[_0x89412d(0xbc)]();}async function resolveDbSelection(_0xc4e2d){const _0x489e3c=a209_0x1968a7,_0x56513c=resolveProvidedDbId(_0xc4e2d);if(typeof _0x56513c===_0x489e3c(0xaf)&&Number['isFinite'](_0x56513c)&&_0x56513c>0x0)return{'dbId':_0x56513c,'dbName':await getDbName(_0xc4e2d[_0x489e3c(0xb9)],_0x56513c)[_0x489e3c(0xae)](()=>undefined)};if(_0xc4e2d[_0x489e3c(0x93)])throw CliErrors['flagMissing'](_0x489e3c(0xba),'--db-id\x20is\x20required\x20in\x20non-interactive\x20mode.');const _0x32f1a4=await listDatabases(_0xc4e2d[_0x489e3c(0xb9)])[_0x489e3c(0xae)](()=>[]);if(_0x32f1a4['length']===0x1)return{'dbId':_0x32f1a4[0x0]['dbId'],'dbName':_0x32f1a4[0x0][_0x489e3c(0xaa)]};if(_0x32f1a4[_0x489e3c(0xb5)]>0x1){const _0x40ff95=await select({'message':'Select\x20the\x20target\x20database:','choices':[..._0x32f1a4[_0x489e3c(0x8a)](_0x5b3bb9=>({'name':_0x5b3bb9['dbName']+'\x20('+_0x5b3bb9[_0x489e3c(0xa9)]+')','value':serializeDbSelection(_0x5b3bb9)})),{'name':'✎\x20Enter\x20dbId\x20manually','value':'__manual__'}]});if(_0x40ff95!==_0x489e3c(0x9b))return deserializeDbSelection(_0x40ff95);}const _0x10ad09=await input({'message':_0x489e3c(0xc2),'validate':_0x180000=>{const _0x4404a5=_0x489e3c,_0x548309=_0x180000[_0x4404a5(0xbc)]();if(!_0x548309)return'dbId\x20cannot\x20be\x20empty';const _0xf6cdfd=Number(_0x548309);if(!Number[_0x4404a5(0x94)](_0xf6cdfd)||_0xf6cdfd<=0x0)return'dbId\x20must\x20be\x20a\x20positive\x20integer';return!![];}});return{'dbId':Number(_0x10ad09[_0x489e3c(0xbc)]())};}async function resolveSqlModeInput(_0x54413c){const _0x55560b=a209_0x1968a7,_0xe84dc3=_0x54413c[_0x55560b(0xc1)](_0x55560b(0xa3))['trim']();if(_0xe84dc3===_0x55560b(0xbd)||_0xe84dc3==='mybatisXml')return _0xe84dc3;if(_0x54413c['nonInteractive'])throw CliErrors[_0x55560b(0x8e)]('mode',_0x55560b(0xa2));return await select({'message':'Select\x20the\x20local\x20SQL\x20mode:','choices':[{'name':_0x55560b(0xa0),'value':_0x55560b(0xbd),'description':'For\x20SELECT\x20/\x20INSERT\x20/\x20UPDATE\x20/\x20DELETE\x20statements\x20that\x20run\x20directly'},{'name':_0x55560b(0xb1),'value':_0x55560b(0xbe),'description':_0x55560b(0xb8)}]});}function serializeDbSelection(_0x210e09){const _0x10d249=a209_0x1968a7;return JSON['stringify']({'dbId':_0x210e09[_0x10d249(0xa9)],'dbName':_0x210e09[_0x10d249(0xaa)]});}function deserializeDbSelection(_0x5e37b0){const _0xd4d90f=a209_0x1968a7;try{const _0x3c67b4=JSON['parse'](_0x5e37b0);if(typeof _0x3c67b4[_0xd4d90f(0xa9)]===_0xd4d90f(0xaf)&&Number[_0xd4d90f(0x90)](_0x3c67b4['dbId']))return{'dbId':_0x3c67b4[_0xd4d90f(0xa9)],'dbName':_0x3c67b4['dbName']};}catch{}throw CliErrors[_0xd4d90f(0xac)](_0xd4d90f(0x9e)+_0x5e37b0);}function resolveProvidedDbId(_0x3d10e3){const _0x49238f=a209_0x1968a7,_0xa0460b=_0x3d10e3[_0x49238f(0xb3)](_0x49238f(0xba));if(typeof _0xa0460b===_0x49238f(0xaf)&&Number['isFinite'](_0xa0460b))return _0xa0460b;return undefined;}
@@ -1 +1 @@
1
- const a197_0x42ff5b=a197_0x2e71;function a197_0x2e71(_0x2e39a7,_0x53960c){_0x2e39a7=_0x2e39a7-0x11d;const _0x2227f6=a197_0x2227();let _0x2e7185=_0x2227f6[_0x2e39a7];return _0x2e7185;}(function(_0x330d3e,_0x28010d){const _0x4a15f2=a197_0x2e71,_0x4ededd=_0x330d3e();while(!![]){try{const _0x3cc74f=parseInt(_0x4a15f2(0x12e))/0x1+-parseInt(_0x4a15f2(0x136))/0x2*(-parseInt(_0x4a15f2(0x125))/0x3)+parseInt(_0x4a15f2(0x122))/0x4*(parseInt(_0x4a15f2(0x12c))/0x5)+-parseInt(_0x4a15f2(0x135))/0x6+parseInt(_0x4a15f2(0x133))/0x7*(-parseInt(_0x4a15f2(0x124))/0x8)+-parseInt(_0x4a15f2(0x129))/0x9+parseInt(_0x4a15f2(0x121))/0xa;if(_0x3cc74f===_0x28010d)break;else _0x4ededd['push'](_0x4ededd['shift']());}catch(_0x234f59){_0x4ededd['push'](_0x4ededd['shift']());}}}(a197_0x2227,0xe23ce));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{fileExists}from'../../core/bff/file-system.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDelete={'service':a197_0x42ff5b(0x13c),'command':'delete','description':a197_0x42ff5b(0x123),'risk':a197_0x42ff5b(0x134),'flags':[SQLCODE_FLAG],async 'validate'(_0x5395b2){const _0x2e4ef0=a197_0x42ff5b,_0x18c4d8=loadSqlProjectConfig(_0x5395b2['appCode']),_0x22495f=await readSqlLockFile(_0x18c4d8[_0x2e4ef0(0x11d)]);if(!_0x22495f)throw CliErrors[_0x2e4ef0(0x11f)](_0x2e4ef0(0x13b));},async 'dryRun'(_0x4b3389){const _0x2113f3=a197_0x42ff5b,_0x5a082c=loadSqlProjectConfig(_0x4b3389['appCode']),_0x423977=await readSqlLockFile(_0x5a082c[_0x2113f3(0x11d)]);if(!_0x423977)throw CliErrors[_0x2113f3(0x11f)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');const {appLock:_0x4b731d}=ensureSqlLockScope(_0x423977,_0x4b3389['appCode'],_0x5a082c['sqlRoot'],'delete'),_0x3eb13c=_0x4b3389[_0x2113f3(0x141)](_0x2113f3(0x128)),_0x28d8c2=_0x4b731d[_0x2113f3(0x132)][_0x3eb13c];if(!_0x28d8c2)throw CliErrors['validation']('No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22'+_0x3eb13c+'\x22.');return{'method':'POST','url':_0x2113f3(0x13f),'body':{'sqlCode':_0x3eb13c,'id':_0x28d8c2[_0x2113f3(0x13e)],'localPath':resolveLocalSqlFilePath(_0x5a082c,_0x3eb13c,_0x28d8c2)},'description':_0x2113f3(0x12f)+_0x3eb13c+_0x2113f3(0x140)+_0x5a082c[_0x2113f3(0x139)]};},async 'execute'(_0x5ea998){const _0xa92215=a197_0x42ff5b,_0x2fb2d1=loadSqlProjectConfig(_0x5ea998[_0xa92215(0x12b)]),_0x5baa58=await readSqlLockFile(_0x2fb2d1['lockFilePath']);if(!_0x5baa58)throw CliErrors[_0xa92215(0x11f)]('SQL\x20lock\x20file\x20not\x20found.');const {lockData:_0x3839fb,appLock:_0x122eed}=ensureSqlLockScope(_0x5baa58,_0x5ea998[_0xa92215(0x12b)],_0x2fb2d1[_0xa92215(0x13d)],_0xa92215(0x12d)),_0x39a569=_0x5ea998[_0xa92215(0x141)](_0xa92215(0x128)),_0xcb4dd9=_0x122eed['sqls'][_0x39a569];if(!_0xcb4dd9)throw CliErrors['validation'](_0xa92215(0x138)+_0x39a569+'\x22.');await deleteSqlQuery({'id':_0xcb4dd9[_0xa92215(0x13e)],'sqlCode':_0x39a569}),_0x122eed[_0xa92215(0x132)]=Object[_0xa92215(0x12a)](Object['entries'](_0x122eed[_0xa92215(0x132)])[_0xa92215(0x126)](([_0x1fcbbc])=>_0x1fcbbc!==_0x39a569)),_0x122eed[_0xa92215(0x120)]=new Date()[_0xa92215(0x11e)](),await writeSqlLockFile(_0x2fb2d1['lockFilePath'],_0x3839fb);const _0x16c472=resolveLocalSqlFilePath(_0x2fb2d1,_0x39a569,_0xcb4dd9);let _0x57e306;await fileExists(_0x16c472)&&(_0x57e306=await moveToTrash(_0x2fb2d1[_0xa92215(0x130)],_0x2fb2d1[_0xa92215(0x139)],_0x16c472),await cleanupEmptyDirectories(dirname(_0x16c472),_0x2fb2d1[_0xa92215(0x137)]));const _0x7614f7={'deleted':_0x39a569,'remoteId':_0xcb4dd9[_0xa92215(0x13e)]};if(_0x57e306)_0x7614f7['trashedTo']=_0x57e306;return{'ok':!![],'data':_0x7614f7,'message':_0xa92215(0x131)+_0x39a569+(_0x57e306?'\x20(local\x20file\x20moved\x20to\x20trash)':'')};}};function a197_0x2227(){const _0x58e74a=['sqlRootDir','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','trashDir','startsWith','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','sql','sqlRoot','remoteId','/smartapi/custom/deleteUserCustomSql','\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20','str','lockFilePath','toISOString','validation','lastSync','18909850QxSkQf','88PcpLUT','Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','1792PMfnNe','162654VmDvic','filter','length','sqlcode','6437520PUrOCy','fromEntries','appCode','109205wJcTki','delete','96902eDiRRr','Would\x20delete\x20SQL\x20','projectRoot','Deleted\x20','sqls','31017kFBnrr','high-risk-write','2256450UwtBRv','20oxzetI'];a197_0x2227=function(){return _0x58e74a;};return a197_0x2227();}async function moveToTrash(_0x236cd4,_0x2469fd,_0x223a57){const _0x3f68bb=a197_0x42ff5b,_0x204fde=new Date()[_0x3f68bb(0x11e)]()['replace'](/[:.]/g,'-'),_0x1056f8=relative(_0x236cd4,_0x223a57),_0x2b4fd1=join(_0x2469fd,_0x204fde,_0x1056f8);return await mkdir(dirname(_0x2b4fd1),{'recursive':!![]}),await rename(_0x223a57,_0x2b4fd1),_0x2b4fd1;}async function cleanupEmptyDirectories(_0x423878,_0x5a5eb4){const _0x13907c=a197_0x42ff5b;let _0xb37a5d=resolve(_0x423878);const _0x13d030=resolve(_0x5a5eb4);while(_0xb37a5d[_0x13907c(0x13a)](''+_0x13d030+sep)||_0xb37a5d===_0x13d030){if(_0xb37a5d===_0x13d030)return;try{const _0x33ebe8=await readdir(_0xb37a5d);if(_0x33ebe8[_0x13907c(0x127)]>0x0)return;await rmdir(_0xb37a5d);}catch{return;}_0xb37a5d=dirname(_0xb37a5d);}}
1
+ const a210_0x10fa0a=a210_0x116b;(function(_0x203677,_0x87c4ab){const _0xe6890a=a210_0x116b,_0x3a8334=_0x203677();while(!![]){try{const _0xf1d2eb=parseInt(_0xe6890a(0x76))/0x1*(parseInt(_0xe6890a(0x7e))/0x2)+parseInt(_0xe6890a(0x65))/0x3+-parseInt(_0xe6890a(0x69))/0x4*(-parseInt(_0xe6890a(0x84))/0x5)+-parseInt(_0xe6890a(0x81))/0x6+parseInt(_0xe6890a(0x74))/0x7+parseInt(_0xe6890a(0x78))/0x8*(parseInt(_0xe6890a(0x75))/0x9)+-parseInt(_0xe6890a(0x7f))/0xa;if(_0xf1d2eb===_0x87c4ab)break;else _0x3a8334['push'](_0x3a8334['shift']());}catch(_0x2c2ba9){_0x3a8334['push'](_0x3a8334['shift']());}}}(a210_0x410d,0xb28a7));import{mkdir,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{deleteSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';function a210_0x116b(_0x7ab967,_0x55278d){_0x7ab967=_0x7ab967-0x65;const _0x410d09=a210_0x410d();let _0x116be9=_0x410d09[_0x7ab967];return _0x116be9;}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':'sql','command':a210_0x10fa0a(0x6c),'description':'Delete\x20a\x20SQL\x20query\x20from\x20remote\x20and\x20local','risk':a210_0x10fa0a(0x7a),'flags':[SQLCODE_FLAG],async 'validate'(_0x3f4416){const _0x3465dc=a210_0x10fa0a,_0x4ed6d9=loadSqlProjectConfig(_0x3f4416[_0x3465dc(0x83)]),_0x49ed09=await readSqlLockFile(_0x4ed6d9[_0x3465dc(0x66)]);if(!_0x49ed09)throw CliErrors[_0x3465dc(0x6f)]('SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.');},async 'dryRun'(_0x20b283){const _0x459eae=a210_0x10fa0a,_0x4ed901=loadSqlProjectConfig(_0x20b283[_0x459eae(0x83)]),_0x549886=await readSqlLockFile(_0x4ed901[_0x459eae(0x66)]);if(!_0x549886)throw CliErrors[_0x459eae(0x6f)](_0x459eae(0x79));const {appLock:_0x492f23}=ensureSqlLockScope(_0x549886,_0x20b283[_0x459eae(0x83)],_0x4ed901[_0x459eae(0x80)],_0x459eae(0x6c)),_0x4594bf=_0x20b283[_0x459eae(0x82)](_0x459eae(0x73)),_0x5cb391=_0x492f23[_0x459eae(0x7b)][_0x4594bf];if(!_0x5cb391)throw CliErrors[_0x459eae(0x6f)](_0x459eae(0x71)+_0x4594bf+'\x22.');return{'method':_0x459eae(0x6b),'url':_0x459eae(0x77),'body':{'sqlCode':_0x4594bf,'id':_0x5cb391['remoteId'],'localPath':resolveLocalSqlFilePath(_0x4ed901,_0x4594bf,_0x5cb391)},'description':_0x459eae(0x6e)+_0x4594bf+'\x20from\x20remote\x20and\x20move\x20local\x20file\x20to\x20'+_0x4ed901[_0x459eae(0x87)]};},async 'execute'(_0x380427){const _0x249c5b=a210_0x10fa0a,_0x872ca4=loadSqlProjectConfig(_0x380427['appCode']),_0x49c91e=await readSqlLockFile(_0x872ca4[_0x249c5b(0x66)]);if(!_0x49c91e)throw CliErrors[_0x249c5b(0x6f)](_0x249c5b(0x67));const {lockData:_0xc74cde,appLock:_0x172a3b}=ensureSqlLockScope(_0x49c91e,_0x380427['appCode'],_0x872ca4[_0x249c5b(0x80)],_0x249c5b(0x6c)),_0x11ca7c=_0x380427[_0x249c5b(0x82)](_0x249c5b(0x73)),_0x1002e3=_0x172a3b['sqls'][_0x11ca7c];if(!_0x1002e3)throw CliErrors[_0x249c5b(0x6f)](_0x249c5b(0x71)+_0x11ca7c+'\x22.');await deleteSqlQuery({'id':_0x1002e3['remoteId'],'sqlCode':_0x11ca7c}),_0x172a3b['sqls']=Object['fromEntries'](Object[_0x249c5b(0x72)](_0x172a3b[_0x249c5b(0x7b)])['filter'](([_0x2f6302])=>_0x2f6302!==_0x11ca7c)),_0x172a3b[_0x249c5b(0x7d)]=new Date()['toISOString'](),await writeSqlLockFile(_0x872ca4[_0x249c5b(0x66)],_0xc74cde);const _0x755b5f=resolveLocalSqlFilePath(_0x872ca4,_0x11ca7c,_0x1002e3);let _0x3c8de9;await fileExists(_0x755b5f)&&(_0x3c8de9=await moveToTrash(_0x872ca4[_0x249c5b(0x86)],_0x872ca4[_0x249c5b(0x87)],_0x755b5f),await cleanupEmptyDirectories(dirname(_0x755b5f),_0x872ca4[_0x249c5b(0x6d)]));const _0x40288e={'deleted':_0x11ca7c,'remoteId':_0x1002e3[_0x249c5b(0x88)]};if(_0x3c8de9)_0x40288e[_0x249c5b(0x68)]=_0x3c8de9;return{'ok':!![],'data':_0x40288e,'message':'Deleted\x20'+_0x11ca7c+(_0x3c8de9?_0x249c5b(0x6a):'')};}};async function moveToTrash(_0xd4ef3f,_0x3b7d05,_0x1d9940){const _0x1ac1a3=a210_0x10fa0a,_0x10bcbc=new Date()['toISOString']()[_0x1ac1a3(0x7c)](/[:.]/g,'-'),_0x16caf8=relative(_0xd4ef3f,_0x1d9940),_0x45c9ed=join(_0x3b7d05,_0x10bcbc,_0x16caf8);return await mkdir(dirname(_0x45c9ed),{'recursive':!![]}),await rename(_0x1d9940,_0x45c9ed),_0x45c9ed;}function a210_0x410d(){const _0x3bd257=['32nclYbz','SQL\x20lock\x20file\x20not\x20found.\x20Run\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first.','high-risk-write','sqls','replace','lastSync','190598vhPHhv','5797880DGPtgm','sqlRoot','6359736SCrbFI','str','appCode','70hqrJdW','length','projectRoot','trashDir','remoteId','666684EekNra','lockFilePath','SQL\x20lock\x20file\x20not\x20found.','trashedTo','86568AlVeUu','\x20(local\x20file\x20moved\x20to\x20trash)','POST','delete','sqlRootDir','Would\x20delete\x20SQL\x20','validation','startsWith','No\x20SQL\x20lock\x20entry\x20found\x20for\x20\x22','entries','sqlcode','1686538hSTzWs','2110059HinIJI','7oVuVth','/smartapi/custom/deleteUserCustomSql'];a210_0x410d=function(){return _0x3bd257;};return a210_0x410d();}async function cleanupEmptyDirectories(_0x5e2538,_0xce9c7b){const _0x3c1c2f=a210_0x10fa0a;let _0x299b76=resolve(_0x5e2538);const _0x244de8=resolve(_0xce9c7b);while(_0x299b76[_0x3c1c2f(0x70)](''+_0x244de8+sep)||_0x299b76===_0x244de8){if(_0x299b76===_0x244de8)return;try{const _0x275c01=await readdir(_0x299b76);if(_0x275c01[_0x3c1c2f(0x85)]>0x0)return;await rmdir(_0x299b76);}catch{return;}_0x299b76=dirname(_0x299b76);}}
@@ -1 +1 @@
1
- function a198_0x2a71(){const _0x584bd0=['sql','bool','description','1852208JDqRXJ','2BJooNb','appCode','sqlcode','sqlContent','detail','5701770hThvWv','str','42siAsDF','verbose','dbId','5307370RcJJhs','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','sqlCode','read','2212551FLrbZa','9uIEetk','boolean','3135308qicdwb','755862qRJMlo','182759iLSVHs','sqlName','Return\x20full\x20raw\x20SQL\x20query\x20object'];a198_0x2a71=function(){return _0x584bd0;};return a198_0x2a71();}const a198_0x5e72a8=a198_0x3127;(function(_0x40ffa8,_0x933a48){const _0x52398c=a198_0x3127,_0x50b0bf=_0x40ffa8();while(!![]){try{const _0x2984c8=parseInt(_0x52398c(0xf6))/0x1*(parseInt(_0x52398c(0xfd))/0x2)+-parseInt(_0x52398c(0xf1))/0x3+parseInt(_0x52398c(0xf4))/0x4+-parseInt(_0x52398c(0x102))/0x5+-parseInt(_0x52398c(0xf5))/0x6*(-parseInt(_0x52398c(0xea))/0x7)+-parseInt(_0x52398c(0xfc))/0x8*(-parseInt(_0x52398c(0xf2))/0x9)+parseInt(_0x52398c(0xed))/0xa;if(_0x2984c8===_0x933a48)break;else _0x50b0bf['push'](_0x50b0bf['shift']());}catch(_0x1ec69d){_0x50b0bf['push'](_0x50b0bf['shift']());}}}(a198_0x2a71,0x94278));import{getSqlQueryInfo}from'../../core/api-client.js';function a198_0x3127(_0x5ac1b0,_0x9900a0){_0x5ac1b0=_0x5ac1b0-0xea;const _0x2a7125=a198_0x2a71();let _0x312797=_0x2a7125[_0x5ac1b0];return _0x312797;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';export const sqlDetail={'service':a198_0x5e72a8(0xf9),'command':a198_0x5e72a8(0x101),'description':a198_0x5e72a8(0xee),'risk':a198_0x5e72a8(0xf0),'flags':[SQLCODE_FLAG,{'name':'verbose','type':a198_0x5e72a8(0xf3),'description':a198_0x5e72a8(0xf8)}],async 'execute'(_0x34cfca){const _0x588b71=a198_0x5e72a8,_0x42effd=await getSqlQueryInfo(_0x34cfca['appCode'],_0x34cfca[_0x588b71(0x103)](_0x588b71(0xff))),_0x13c9c3=_0x34cfca[_0x588b71(0xfa)](_0x588b71(0xeb));if(_0x13c9c3)return{'ok':!![],'data':_0x42effd};const _0x456e66=_0x42effd[_0x588b71(0xec)]?await getDbName(_0x34cfca[_0x588b71(0xfe)],_0x42effd[_0x588b71(0xec)]):undefined;return{'ok':!![],'data':{'sqlCode':_0x42effd[_0x588b71(0xef)],'sqlName':_0x42effd[_0x588b71(0xf7)],'db':_0x456e66?_0x456e66+'\x20('+_0x42effd[_0x588b71(0xec)]+')':_0x42effd[_0x588b71(0xec)]??'','description':_0x42effd[_0x588b71(0xfb)]??'','sqlContent':_0x42effd[_0x588b71(0x100)]??''}};}};
1
+ const a211_0x1af3e3=a211_0x1367;(function(_0x2a7020,_0x439c37){const _0x47d2da=a211_0x1367,_0x2cbfe3=_0x2a7020();while(!![]){try{const _0x397c2a=-parseInt(_0x47d2da(0x9c))/0x1+-parseInt(_0x47d2da(0x9d))/0x2+parseInt(_0x47d2da(0xaa))/0x3*(-parseInt(_0x47d2da(0xa1))/0x4)+parseInt(_0x47d2da(0xa6))/0x5*(-parseInt(_0x47d2da(0x96))/0x6)+parseInt(_0x47d2da(0x9f))/0x7+parseInt(_0x47d2da(0x9a))/0x8+-parseInt(_0x47d2da(0x97))/0x9*(-parseInt(_0x47d2da(0xa2))/0xa);if(_0x397c2a===_0x439c37)break;else _0x2cbfe3['push'](_0x2cbfe3['shift']());}catch(_0xb85fa3){_0x2cbfe3['push'](_0x2cbfe3['shift']());}}}(a211_0x29e1,0x38b23));function a211_0x29e1(){const _0x30f881=['dbId','detail','1605gMTlRB','sqlcode','appCode','sql','8550oJXvmJ','11715687vAKTbb','str','verbose','675056MtEzmM','Get\x20custom\x20SQL\x20query\x20details\x20by\x20sqlCode','399438SZHaWc','856022nxaOcy','bool','1853432TPXEsS','boolean','1320iXzPtM','10jbazhc','description','Return\x20full\x20raw\x20SQL\x20query\x20object','sqlContent','1455JgpQHR','read'];a211_0x29e1=function(){return _0x30f881;};return a211_0x29e1();}function a211_0x1367(_0x5aa805,_0x124ab0){_0x5aa805=_0x5aa805-0x94;const _0x29e1d7=a211_0x29e1();let _0x1367c9=_0x29e1d7[_0x5aa805];return _0x1367c9;}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':a211_0x1af3e3(0x95),'command':a211_0x1af3e3(0xa9),'description':a211_0x1af3e3(0x9b),'risk':a211_0x1af3e3(0xa7),'flags':[SQLCODE_FLAG,{'name':a211_0x1af3e3(0x99),'type':a211_0x1af3e3(0xa0),'description':a211_0x1af3e3(0xa4)}],async 'execute'(_0x529f09){const _0x2358f5=a211_0x1af3e3,_0x288443=await getSqlQueryInfo(_0x529f09[_0x2358f5(0x94)],_0x529f09[_0x2358f5(0x98)](_0x2358f5(0xab))),_0x277c38=_0x529f09[_0x2358f5(0x9e)](_0x2358f5(0x99));if(_0x277c38)return{'ok':!![],'data':_0x288443};const _0x4b3c3a=_0x288443[_0x2358f5(0xa8)]?await getDbName(_0x529f09[_0x2358f5(0x94)],_0x288443['dbId']):undefined;return{'ok':!![],'data':{'sqlCode':_0x288443['sqlCode'],'sqlName':_0x288443['sqlName'],'db':_0x4b3c3a?_0x4b3c3a+'\x20('+_0x288443[_0x2358f5(0xa8)]+')':_0x288443['dbId']??'','description':_0x288443[_0x2358f5(0xa3)]??'','sqlContent':_0x288443[_0x2358f5(0xa5)]??''}};}};
@@ -1 +1 @@
1
- const a199_0x517dad=a199_0x11e4;function a199_0x11e4(_0x1dbe2b,_0x5e4e0a){_0x1dbe2b=_0x1dbe2b-0x1a0;const _0x539029=a199_0x5390();let _0x11e4d1=_0x539029[_0x1dbe2b];return _0x11e4d1;}(function(_0x1fde35,_0x220177){const _0x4c642d=a199_0x11e4,_0x430423=_0x1fde35();while(!![]){try{const _0xb802a=parseInt(_0x4c642d(0x1b8))/0x1*(parseInt(_0x4c642d(0x1a5))/0x2)+-parseInt(_0x4c642d(0x1b3))/0x3+parseInt(_0x4c642d(0x1b0))/0x4+parseInt(_0x4c642d(0x1b1))/0x5*(-parseInt(_0x4c642d(0x1af))/0x6)+parseInt(_0x4c642d(0x1ac))/0x7+parseInt(_0x4c642d(0x1b4))/0x8+parseInt(_0x4c642d(0x1a3))/0x9;if(_0xb802a===_0x220177)break;else _0x430423['push'](_0x430423['shift']());}catch(_0x1f7fda){_0x430423['push'](_0x430423['shift']());}}}(a199_0x5390,0xa740d));function a199_0x5390(){const _0x2424b5=['3100012qqGsGe','44430bGEBEI','\x20row(s)\x20in\x20','2366052lvFKXT','1514480vdCjvv','execError','params','string','2ptkGal','Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','sql','length','135963IhIfLX','execSuccess','189814PzCpAy','str','SQL\x20execution\x20failed','appCode','execResult','exec','sqlcode','3624481fnSEYc','Returned\x20','SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)','144PwiCWq'];a199_0x5390=function(){return _0x2424b5;};return a199_0x5390();}import{executeSql}from'../../core/api-client.js';import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a199_0x517dad(0x1a1),'command':a199_0x517dad(0x1aa),'description':a199_0x517dad(0x1a0),'risk':'read','flags':[SQLCODE_FLAG,{'name':a199_0x517dad(0x1b6),'type':a199_0x517dad(0x1b7),'description':a199_0x517dad(0x1ae)}],async 'execute'(_0x2e49da){const _0x251c82=a199_0x517dad,_0x334ce0=parseJsonParams(_0x2e49da['str']('params')),_0x1e5f01=Date['now'](),_0x3bbdc4=await executeSql(_0x2e49da[_0x251c82(0x1a8)],_0x2e49da[_0x251c82(0x1a6)](_0x251c82(0x1ab)),_0x334ce0),_0x11604d=Date['now']()-_0x1e5f01,_0x525b11=_0x3bbdc4?.[_0x251c82(0x1a9)]??_0x3bbdc4,_0x5ead3b=_0x3bbdc4?.[_0x251c82(0x1a4)]??!![];if(!_0x5ead3b)return{'ok':![],'data':{'error':_0x3bbdc4?.[_0x251c82(0x1b5)]||_0x251c82(0x1a7),'elapsed':_0x11604d},'message':_0x251c82(0x1a7)};const _0x4434b1=Array['isArray'](_0x525b11)?_0x525b11:[];return{'ok':!![],'data':{'rows':_0x4434b1,'rowCount':_0x4434b1[_0x251c82(0x1a2)],'elapsed':_0x11604d},'message':_0x251c82(0x1ad)+_0x4434b1[_0x251c82(0x1a2)]+_0x251c82(0x1b2)+_0x11604d+'ms'};}};
1
+ const a212_0xf49c73=a212_0x13bd;(function(_0x47ef4b,_0x3afd47){const _0x5ee59b=a212_0x13bd,_0x2864f2=_0x47ef4b();while(!![]){try{const _0x149e9a=parseInt(_0x5ee59b(0x7f))/0x1+parseInt(_0x5ee59b(0x78))/0x2*(parseInt(_0x5ee59b(0x76))/0x3)+parseInt(_0x5ee59b(0x81))/0x4*(parseInt(_0x5ee59b(0x6e))/0x5)+parseInt(_0x5ee59b(0x74))/0x6+parseInt(_0x5ee59b(0x83))/0x7*(parseInt(_0x5ee59b(0x70))/0x8)+parseInt(_0x5ee59b(0x75))/0x9*(-parseInt(_0x5ee59b(0x6d))/0xa)+-parseInt(_0x5ee59b(0x7e))/0xb*(parseInt(_0x5ee59b(0x77))/0xc);if(_0x149e9a===_0x3afd47)break;else _0x2864f2['push'](_0x2864f2['shift']());}catch(_0xf481f9){_0x2864f2['push'](_0x2864f2['shift']());}}}(a212_0x35e4,0xf062c));import{executeSql}from'../../core/api-client.js';function a212_0x13bd(_0x298947,_0xe7f916){_0x298947=_0x298947-0x6b;const _0x35e4b3=a212_0x35e4();let _0x13bdc1=_0x35e4b3[_0x298947];return _0x13bdc1;}import{SQLCODE_FLAG}from'../../commands/common/flags.js';import{parseJsonParams}from'../../utils/params.js';export const sqlExec={'service':a212_0xf49c73(0x6b),'command':a212_0xf49c73(0x79),'description':'Execute\x20a\x20custom\x20SQL\x20query\x20by\x20sqlCode','risk':a212_0xf49c73(0x7b),'flags':[SQLCODE_FLAG,{'name':a212_0xf49c73(0x73),'type':'string','description':'SQL\x20parameters\x20as\x20JSON\x20string\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27)'}],async 'execute'(_0x1d2068){const _0x58b7f2=a212_0xf49c73,_0x2aac26=parseJsonParams(_0x1d2068[_0x58b7f2(0x71)]('params')),_0x2221ff=Date['now'](),_0x1de757=await executeSql(_0x1d2068[_0x58b7f2(0x7a)],_0x1d2068[_0x58b7f2(0x71)]('sqlcode'),_0x2aac26),_0x42c291=Date[_0x58b7f2(0x80)]()-_0x2221ff,_0x54f597=_0x1de757?.['execResult']??_0x1de757,_0x6ddcd5=_0x1de757?.['execSuccess']??!![];if(!_0x6ddcd5)return{'ok':![],'data':{'error':_0x1de757?.[_0x58b7f2(0x6f)]||_0x58b7f2(0x7c),'elapsed':_0x42c291},'message':_0x58b7f2(0x7c)};const _0x281b68=Array[_0x58b7f2(0x72)](_0x54f597)?_0x54f597:[];return{'ok':!![],'data':{'rows':_0x281b68,'rowCount':_0x281b68[_0x58b7f2(0x7d)],'elapsed':_0x42c291},'message':_0x58b7f2(0x6c)+_0x281b68[_0x58b7f2(0x7d)]+_0x58b7f2(0x82)+_0x42c291+'ms'};}};function a212_0x35e4(){const _0xdff159=['str','isArray','params','11740188GgnEOE','12519sicKtg','111Gijhtk','588ZrBfRt','6090fiOnfc','exec','appCode','read','SQL\x20execution\x20failed','length','629651ZDqnuU','31650MgkYXN','now','202736fOZuZw','\x20row(s)\x20in\x20','10150917ovWGGN','sql','Returned\x20','5210Xdcymh','95jOdiQe','execError','8yYCGas'];a212_0x35e4=function(){return _0xdff159;};return a212_0x35e4();}
@@ -1 +1 @@
1
- (function(_0x6ffbc2,_0x20e32e){const _0x195d56=a200_0x4420,_0x2f7bcd=_0x6ffbc2();while(!![]){try{const _0x1ba1e6=parseInt(_0x195d56(0x1bf))/0x1+parseInt(_0x195d56(0x1c1))/0x2*(-parseInt(_0x195d56(0x1c7))/0x3)+-parseInt(_0x195d56(0x1c3))/0x4*(-parseInt(_0x195d56(0x1c2))/0x5)+-parseInt(_0x195d56(0x1c4))/0x6+-parseInt(_0x195d56(0x1c5))/0x7+-parseInt(_0x195d56(0x1c0))/0x8+parseInt(_0x195d56(0x1c6))/0x9;if(_0x1ba1e6===_0x20e32e)break;else _0x2f7bcd['push'](_0x2f7bcd['shift']());}catch(_0x5d27c0){_0x2f7bcd['push'](_0x2f7bcd['shift']());}}}(a200_0x3059,0x417f2));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';function a200_0x3059(){const _0x3f14c9=['28398OReBKU','323502MLTSul','3216864ovZvhZ','98txCNHo','145RIFlPX','39836Qtewiz','2365332tlqfFW','3170328pThJHN','12321261sFubCB'];a200_0x3059=function(){return _0x3f14c9;};return a200_0x3059();}import{sqlPull}from'../../commands/sql/pull.js';function a200_0x4420(_0x457482,_0x267b0d){_0x457482=_0x457482-0x1bf;const _0x30592f=a200_0x3059();let _0x4420dd=_0x30592f[_0x457482];return _0x4420dd;}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,sqlExec,sqlPull,sqlDelete];
1
+ (function(_0x369c00,_0x4d5890){const _0x4e7622=a213_0x4d5a,_0x22073f=_0x369c00();while(!![]){try{const _0x8fbe71=parseInt(_0x4e7622(0x101))/0x1+-parseInt(_0x4e7622(0xfd))/0x2*(-parseInt(_0x4e7622(0x102))/0x3)+-parseInt(_0x4e7622(0x103))/0x4*(parseInt(_0x4e7622(0x100))/0x5)+-parseInt(_0x4e7622(0x104))/0x6+-parseInt(_0x4e7622(0xfe))/0x7+-parseInt(_0x4e7622(0x105))/0x8*(parseInt(_0x4e7622(0xfb))/0x9)+-parseInt(_0x4e7622(0xfc))/0xa*(-parseInt(_0x4e7622(0xff))/0xb);if(_0x8fbe71===_0x4d5890)break;else _0x22073f['push'](_0x22073f['shift']());}catch(_0x359a49){_0x22073f['push'](_0x22073f['shift']());}}}(a213_0x265f,0xc1942));import{sqlList}from'../../commands/sql/list.js';import{sqlDetail}from'../../commands/sql/detail.js';function a213_0x4d5a(_0x2cea1f,_0x5ba414){_0x2cea1f=_0x2cea1f-0xfb;const _0x265ff1=a213_0x265f();let _0x4d5a87=_0x265ff1[_0x2cea1f];return _0x4d5a87;}import{sqlValidate}from'../../commands/sql/validate.js';import{sqlExec}from'../../commands/sql/exec.js';import{sqlPull}from'../../commands/sql/pull.js';import{sqlCreate}from'../../commands/sql/create.js';function a213_0x265f(){const _0x19fee1=['2556402tfYRxr','10028963zRkzsC','11ppQneM','15bdZQfN','1462699cZBNrg','3gejjWz','1803576PkKbgT','941712cGrOUs','10784nIsjUp','2988segiqh','14418770PJqYAw'];a213_0x265f=function(){return _0x19fee1;};return a213_0x265f();}import{sqlStatus}from'../../commands/sql/status.js';import{sqlPush}from'../../commands/sql/push.js';import{sqlDelete}from'../../commands/sql/delete.js';export const sqlDefinitions=[sqlList,sqlDetail,sqlStatus,sqlCreate,sqlPush,sqlValidate,sqlExec,sqlPull,sqlDelete];
@@ -1 +1 @@
1
- const a201_0x53dcbd=a201_0x1003;(function(_0x1fbc39,_0x22613e){const _0x194e26=a201_0x1003,_0xc4e44a=_0x1fbc39();while(!![]){try{const _0x5986f7=parseInt(_0x194e26(0x1c4))/0x1+-parseInt(_0x194e26(0x1c6))/0x2*(parseInt(_0x194e26(0x1c2))/0x3)+-parseInt(_0x194e26(0x1b3))/0x4+parseInt(_0x194e26(0x1bf))/0x5*(parseInt(_0x194e26(0x1ce))/0x6)+-parseInt(_0x194e26(0x1b7))/0x7+parseInt(_0x194e26(0x1b0))/0x8*(-parseInt(_0x194e26(0x1cd))/0x9)+parseInt(_0x194e26(0x1cf))/0xa;if(_0x5986f7===_0x22613e)break;else _0xc4e44a['push'](_0xc4e44a['shift']());}catch(_0x45ff26){_0xc4e44a['push'](_0xc4e44a['shift']());}}}(a201_0x3171,0x7e43f));import{listSqlQueries}from'../../core/api-client.js';function a201_0x3171(){const _0x29964c=['No\x20custom\x20SQL\x20queries\x20found.','name','description','read','dbId','1615025ecRxPP','length','sqlcode','100083NZNimW','paging','1024583ZyETgY','verbose','22nasYXL','page','str','string','Found\x20','sql','number','833634ebDAIP','6wmFMls','16544280vHoHOZ','Filter\x20by\x20SQL\x20name','all','num','tableData','\x20SQL\x20queries\x20(total:\x20','64mujcwD','appCode','bool','1984140fdDuHk','map','totalCount','sqlCode','6165733ZjqUNH','Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content','sqlName'];a201_0x3171=function(){return _0x29964c;};return a201_0x3171();}function a201_0x1003(_0x36e797,_0x273e03){_0x36e797=_0x36e797-0x1ab;const _0x317128=a201_0x3171();let _0x100336=_0x317128[_0x36e797];return _0x100336;}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':a201_0x53dcbd(0x1cb),'command':'list','description':'List\x20custom\x20SQL\x20queries','risk':a201_0x53dcbd(0x1bd),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a201_0x53dcbd(0x1bb),'type':a201_0x53dcbd(0x1c9),'description':a201_0x53dcbd(0x1ab)},{'name':a201_0x53dcbd(0x1c7),'type':a201_0x53dcbd(0x1cc),'description':'Page\x20number','default':0x1},{'name':'pagesize','type':'number','description':'Page\x20size'},{'name':a201_0x53dcbd(0x1c5),'type':'boolean','description':a201_0x53dcbd(0x1b8)}],async 'execute'(_0x13e5d9){const _0x245622=a201_0x53dcbd,_0x30c880=await listSqlQueries(_0x13e5d9[_0x245622(0x1b1)],{'sqlCode':_0x13e5d9['str'](_0x245622(0x1c1))||undefined,'sqlName':_0x13e5d9[_0x245622(0x1c8)](_0x245622(0x1bb))||undefined,'currentPage':_0x13e5d9[_0x245622(0x1ad)](_0x245622(0x1c7)),'pageSize':_0x13e5d9['num']('pagesize',0x32)}),_0x499661=_0x13e5d9[_0x245622(0x1b2)]('verbose'),_0x4f3101=_0x30c880[_0x245622(0x1ae)]??[],_0x31cc95=_0x30c880[_0x245622(0x1c3)]?.[_0x245622(0x1b5)]??_0x4f3101[_0x245622(0x1c0)];let _0x5d754c;return _0x499661?_0x5d754c=_0x4f3101:_0x5d754c=await Promise[_0x245622(0x1ac)](_0x4f3101[_0x245622(0x1b4)](async _0x1346ea=>{const _0x1ff482=_0x245622;let _0x48de0b;try{_0x48de0b=_0x1346ea[_0x1ff482(0x1be)]?await getDbName(_0x13e5d9[_0x1ff482(0x1b1)],_0x1346ea[_0x1ff482(0x1be)]):undefined;}catch{}return{'sqlCode':_0x1346ea[_0x1ff482(0x1b6)],'sqlName':_0x1346ea[_0x1ff482(0x1b9)],'description':_0x1346ea[_0x1ff482(0x1bc)]??'','db':_0x48de0b?_0x48de0b+'\x20('+_0x1346ea['dbId']+')':_0x1346ea['dbId']??''};})),{'ok':!![],'data':_0x5d754c,'message':_0x4f3101[_0x245622(0x1c0)]===0x0?_0x245622(0x1ba):_0x245622(0x1ca)+_0x4f3101[_0x245622(0x1c0)]+_0x245622(0x1af)+_0x31cc95+').'};}};
1
+ function a214_0x3d70(_0x319603,_0x3c79f5){_0x319603=_0x319603-0x1a5;const _0x6a4087=a214_0x6a40();let _0x3d702e=_0x6a4087[_0x319603];return _0x3d702e;}const a214_0x23bfd5=a214_0x3d70;(function(_0x5342f6,_0x30e32e){const _0x498c4b=a214_0x3d70,_0x30aab7=_0x5342f6();while(!![]){try{const _0x449406=parseInt(_0x498c4b(0x1af))/0x1*(-parseInt(_0x498c4b(0x1b4))/0x2)+parseInt(_0x498c4b(0x1c1))/0x3*(parseInt(_0x498c4b(0x1ab))/0x4)+parseInt(_0x498c4b(0x1ba))/0x5*(-parseInt(_0x498c4b(0x1bf))/0x6)+-parseInt(_0x498c4b(0x1b7))/0x7+-parseInt(_0x498c4b(0x1bc))/0x8+-parseInt(_0x498c4b(0x1a6))/0x9+parseInt(_0x498c4b(0x1ac))/0xa*(parseInt(_0x498c4b(0x1b1))/0xb);if(_0x449406===_0x30e32e)break;else _0x30aab7['push'](_0x30aab7['shift']());}catch(_0x12dcf6){_0x30aab7['push'](_0x30aab7['shift']());}}}(a214_0x6a40,0x6df87));import{listSqlQueries}from'../../core/api-client.js';function a214_0x6a40(){const _0x511907=['6264432aVsFLY','page','list','3594knsCxm','all','111udFsxe','description','number','str','7326585HJXlpv','name','length','map','num','8780cqTZXp','218070jhwGbM','appCode','sqlCode','2bWgGYS','dbId','1738VMTCcW','Page\x20size','List\x20custom\x20SQL\x20queries','540006gJfxox','sqlName','pagesize','1735377nbAHPE','No\x20custom\x20SQL\x20queries\x20found.','read','5770rchpbN','verbose'];a214_0x6a40=function(){return _0x511907;};return a214_0x6a40();}import{getDbName}from'../../core/db-resolver.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';export const sqlList={'service':'sql','command':a214_0x23bfd5(0x1be),'description':a214_0x23bfd5(0x1b3),'risk':a214_0x23bfd5(0x1b9),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a214_0x23bfd5(0x1a7),'type':'string','description':'Filter\x20by\x20SQL\x20name'},{'name':a214_0x23bfd5(0x1bd),'type':a214_0x23bfd5(0x1c3),'description':'Page\x20number','default':0x1},{'name':a214_0x23bfd5(0x1b6),'type':a214_0x23bfd5(0x1c3),'description':a214_0x23bfd5(0x1b2)},{'name':'verbose','type':'boolean','description':'Return\x20full\x20SQL\x20query\x20objects\x20including\x20parameters\x20and\x20SQL\x20content'}],async 'execute'(_0x5917cf){const _0x2f87be=a214_0x23bfd5,_0x493555=await listSqlQueries(_0x5917cf[_0x2f87be(0x1ad)],{'sqlCode':_0x5917cf['str']('sqlcode')||undefined,'sqlName':_0x5917cf[_0x2f87be(0x1a5)](_0x2f87be(0x1a7))||undefined,'currentPage':_0x5917cf[_0x2f87be(0x1aa)](_0x2f87be(0x1bd)),'pageSize':_0x5917cf[_0x2f87be(0x1aa)](_0x2f87be(0x1b6),0x32)}),_0x2f2818=_0x5917cf['bool'](_0x2f87be(0x1bb)),_0x21225b=_0x493555['tableData']??[],_0x6eb23c=_0x493555['paging']?.['totalCount']??_0x21225b[_0x2f87be(0x1a8)];let _0x213c0b;return _0x2f2818?_0x213c0b=_0x21225b:_0x213c0b=await Promise[_0x2f87be(0x1c0)](_0x21225b[_0x2f87be(0x1a9)](async _0xcd271c=>{const _0xf3a011=_0x2f87be;let _0x1cffab;try{_0x1cffab=_0xcd271c[_0xf3a011(0x1b0)]?await getDbName(_0x5917cf[_0xf3a011(0x1ad)],_0xcd271c[_0xf3a011(0x1b0)]):undefined;}catch{}return{'sqlCode':_0xcd271c[_0xf3a011(0x1ae)],'sqlName':_0xcd271c[_0xf3a011(0x1b5)],'description':_0xcd271c[_0xf3a011(0x1c2)]??'','db':_0x1cffab?_0x1cffab+'\x20('+_0xcd271c[_0xf3a011(0x1b0)]+')':_0xcd271c[_0xf3a011(0x1b0)]??''};})),{'ok':!![],'data':_0x213c0b,'message':_0x21225b[_0x2f87be(0x1a8)]===0x0?_0x2f87be(0x1b8):'Found\x20'+_0x21225b['length']+'\x20SQL\x20queries\x20(total:\x20'+_0x6eb23c+').'};}};
@@ -1 +1 @@
1
- const a202_0x4ad68a=a202_0x28c5;(function(_0x435cd4,_0x597863){const _0x577a51=a202_0x28c5,_0x260dbe=_0x435cd4();while(!![]){try{const _0x577568=-parseInt(_0x577a51(0x9d))/0x1*(-parseInt(_0x577a51(0xb3))/0x2)+parseInt(_0x577a51(0xa4))/0x3+parseInt(_0x577a51(0xac))/0x4+parseInt(_0x577a51(0x96))/0x5*(parseInt(_0x577a51(0xa9))/0x6)+parseInt(_0x577a51(0x9f))/0x7+-parseInt(_0x577a51(0xb0))/0x8+-parseInt(_0x577a51(0x99))/0x9;if(_0x577568===_0x597863)break;else _0x260dbe['push'](_0x260dbe['shift']());}catch(_0x131848){_0x260dbe['push'](_0x260dbe['shift']());}}}(a202_0x2cee,0x64f6c));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';function a202_0x2cee(){const _0x802fd6=['split','read','boolean','lastSync','filter','mybatisXml','totalCount','string','message','tableData','Force\x20pull\x20cancelled.','No\x20remote\x20SQL\x20queries\x20matched.','utf8','trimStart','nonInteractive','replace','toISOString','skipped','conflict','pull','sqlcode','3545GGDolA','local\x20differs\x20from\x20remote','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','7967907TMMCWQ','sqlRootDir','unchanged','name','12151OBgygi','paging','3492300BsJPoT','sqlContent','would_pull','str','sqlName','902769EoyZMM','dbId','sql','push','path','1692kiVKJT','Would\x20pull\x20','appCode','3103308ipCAzE','lockFilePath','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','\x20written,\x20','4299776PQBeOv','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','10ilPVMk','sqlCode','sqlRoot','Force\x20overwrite\x20local\x20unsynced\x20changes','description','\x20skipped,\x20','force','sqls','catch','length','cancelled','\x20failed','Filter\x20by\x20SQL\x20display\x20name'];a202_0x2cee=function(){return _0x802fd6;};return a202_0x2cee();}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(_0x2d2464,_0x1bc32e){const _0x21dc11=a202_0x28c5,_0x34a185=[];let _0x49fd2c=0x1;while(!![]){const _0x35efcc=await listSqlQueries(_0x2d2464,{'currentPage':_0x49fd2c,'pageSize':PAGE_SIZE,'sqlCode':_0x1bc32e[_0x21dc11(0xb4)],'sqlName':_0x1bc32e[_0x21dc11(0xa3)]}),_0x44c6c7=_0x35efcc[_0x21dc11(0x8a)]??[];_0x34a185[_0x21dc11(0xa7)](..._0x44c6c7);if(_0x44c6c7['length']===0x0)break;const _0x551132=_0x35efcc[_0x21dc11(0x9e)]?.[_0x21dc11(0x87)];if(_0x551132!=null?_0x34a185[_0x21dc11(0x7d)]>=_0x551132:_0x44c6c7[_0x21dc11(0x7d)]<PAGE_SIZE)break;_0x49fd2c++;}return _0x34a185;}async function ensureSqlContent(_0x2b0c3c){const _0x4af7b6=a202_0x28c5;if(_0x2b0c3c['sqlContent']!=null&&String(_0x2b0c3c[_0x4af7b6(0xa0)])[_0x4af7b6(0x7d)]>0x0)return _0x2b0c3c;return getSqlQueryDetail(_0x2b0c3c[_0x4af7b6(0xb4)]);}export const sqlPull={'service':a202_0x4ad68a(0xa6),'command':a202_0x4ad68a(0x94),'description':a202_0x4ad68a(0xb2),'risk':a202_0x4ad68a(0x82),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a202_0x4ad68a(0x9c),'type':a202_0x4ad68a(0x88),'description':a202_0x4ad68a(0x80)},{'name':a202_0x4ad68a(0xb9),'type':a202_0x4ad68a(0x83),'description':a202_0x4ad68a(0xb6)}],async 'dryRun'(_0x3cb74a){const _0x583e37=a202_0x4ad68a,_0x138548=loadSqlProjectConfig(_0x3cb74a[_0x583e37(0xab)]),_0x200752=await readSqlLockFile(_0x138548[_0x583e37(0xad)]),{appLock:_0x538fb6}=ensureSqlLockScope(_0x200752??createEmptySqlLock(),_0x138548['appCode'],_0x138548['sqlRoot'],_0x583e37(0x94)),_0x271fd7=await fetchAllSqlQueries(_0x3cb74a['appCode'],{'sqlCode':_0x3cb74a['str'](_0x583e37(0x95))||undefined,'sqlName':_0x3cb74a[_0x583e37(0xa2)]('name')||undefined}),_0x33a30c=[];for(const _0xe7460b of _0x271fd7){const _0x3a5f39=await ensureSqlContent(_0xe7460b),_0x28ec15=ensureRemoteSqlContent(_0x3a5f39),_0x3862dd=detectModeFromSql(_0x3a5f39),_0x38237a=_0x3a5f39['dbId']?await getDbName(_0x3cb74a[_0x583e37(0xab)],Number(_0x3a5f39[_0x583e37(0xa5)]))['catch'](()=>undefined):undefined,_0xc58a2=buildLocalSqlFileContent({'sqlCode':_0x3a5f39[_0x583e37(0xb4)],'sqlName':_0x3a5f39[_0x583e37(0xa3)],'dbId':_0x3a5f39['dbId']},_0x28ec15,{'dbName':_0x38237a,'mode':_0x3862dd,'syncedAt':new Date()[_0x583e37(0x91)](),'description':_0x3a5f39[_0x583e37(0xb7)]}),_0x27bca0=buildSqlLockEntry(_0x3a5f39,_0x28ec15,'',{'dbName':_0x38237a}),_0x15dc1a=resolveLocalSqlFilePath(_0x138548,_0x3a5f39['sqlCode'],_0x27bca0);let _0x304a45=_0x583e37(0xa1),_0x44e6ce;if(await fileExists(_0x15dc1a)){const _0x4bcf7a=await readFile(_0x15dc1a,'utf8');isEquivalentPulledSqlFile(_0x4bcf7a,_0xc58a2,_0x3862dd)?(_0x304a45=_0x583e37(0x92),_0x44e6ce=_0x583e37(0x9b)):(_0x304a45=_0x583e37(0x93),_0x44e6ce=_0x583e37(0xae));}_0x33a30c['push']({'sqlCode':_0x3a5f39[_0x583e37(0xb4)],'sqlName':_0x3a5f39[_0x583e37(0xa3)],'filePath':_0x15dc1a,'status':_0x304a45,'reason':_0x44e6ce});}return{'method':'POST','url':_0x583e37(0x98),'body':{'appCode':_0x3cb74a['appCode'],'sqlCode':_0x3cb74a[_0x583e37(0xa2)]('sqlcode')||null,'sqlName':_0x3cb74a[_0x583e37(0xa2)](_0x583e37(0x9c))||null,'files':_0x33a30c},'description':_0x583e37(0xaa)+_0x33a30c[_0x583e37(0x7d)]+'\x20SQL\x20file(s)\x20into\x20'+_0x138548['sqlRootDir']};},async 'execute'(_0x315adc){const _0x24191f=a202_0x4ad68a,_0x22ea56=loadSqlProjectConfig(_0x315adc[_0x24191f(0xab)]),_0x40771d=await readSqlLockFile(_0x22ea56['lockFilePath']),{lockData:_0x18e777,appLock:_0x2f4613}=ensureSqlLockScope(_0x40771d??createEmptySqlLock(),_0x22ea56[_0x24191f(0xab)],_0x22ea56[_0x24191f(0xb5)],_0x24191f(0x94)),_0x35f46f=_0x315adc['bool']('force'),_0x5ca4a9=await fetchAllSqlQueries(_0x315adc[_0x24191f(0xab)],{'sqlCode':_0x315adc[_0x24191f(0xa2)]('sqlcode')||undefined,'sqlName':_0x315adc['str'](_0x24191f(0x9c))||undefined});if(_0x5ca4a9[_0x24191f(0x7d)]===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':_0x24191f(0x8c)};const _0x1da047=[],_0x45f5f3=[];for(const _0x18731a of _0x5ca4a9){try{_0x1da047[_0x24191f(0xa7)](await ensureSqlContent(_0x18731a));}catch(_0x2404f8){_0x45f5f3[_0x24191f(0xa7)]({'sqlCode':_0x18731a[_0x24191f(0xb4)],'error':_0x2404f8 instanceof Error?_0x2404f8[_0x24191f(0x89)]:String(_0x2404f8)});}}if(_0x35f46f&&!_0x315adc[_0x24191f(0x8f)]){let _0x835f29=![];for(const _0x3de7d0 of _0x1da047){const _0x34f7e4=detectModeFromSql(_0x3de7d0),_0x570947=_0x3de7d0[_0x24191f(0xa5)]?await getDbName(_0x315adc[_0x24191f(0xab)],Number(_0x3de7d0[_0x24191f(0xa5)]))['catch'](()=>undefined):undefined,_0x40d41c=buildLocalSqlFileContent({'sqlCode':_0x3de7d0[_0x24191f(0xb4)],'sqlName':_0x3de7d0['sqlName'],'dbId':_0x3de7d0[_0x24191f(0xa5)]},ensureRemoteSqlContent(_0x3de7d0),{'dbName':_0x570947,'mode':_0x34f7e4,'syncedAt':new Date()[_0x24191f(0x91)](),'description':_0x3de7d0['description']}),_0x17a56b=resolveLocalSqlFilePath(_0x22ea56,_0x3de7d0[_0x24191f(0xb4)],buildSqlLockEntry(_0x3de7d0,ensureRemoteSqlContent(_0x3de7d0),'',{'dbName':_0x570947}));if(await fileExists(_0x17a56b)){const _0xe05e13=await readFile(_0x17a56b,_0x24191f(0x8d));if(!isEquivalentPulledSqlFile(_0xe05e13,_0x40d41c,_0x34f7e4)){_0x835f29=!![];break;}}}if(_0x835f29){const _0x7ae315=await confirmForceOverwrite(_0x24191f(0xb1));if(!_0x7ae315)throw CliErrors[_0x24191f(0x7e)](_0x24191f(0x8b));}}const _0x2c6b8d=cloneSqlLockData(_0x18e777),_0x3cdb8f=_0x2c6b8d['apps'][_0x22ea56[_0x24191f(0xab)]],_0x530273=[],_0xc2e572=[];for(const _0x102a08 of _0x1da047){const _0x309cd2=_0x3cdb8f[_0x24191f(0x7b)][_0x102a08[_0x24191f(0xb4)]],_0x155858=ensureRemoteSqlContent(_0x102a08),_0x352a21=detectModeFromSql(_0x102a08),_0x5c1a58=_0x102a08[_0x24191f(0xa5)]?await getDbName(_0x315adc[_0x24191f(0xab)],Number(_0x102a08[_0x24191f(0xa5)]))[_0x24191f(0x7c)](()=>undefined):undefined,_0x3330ce=buildLocalSqlFileContent({'sqlCode':_0x102a08[_0x24191f(0xb4)],'sqlName':_0x102a08['sqlName'],'dbId':_0x102a08[_0x24191f(0xa5)]},_0x155858,{'dbName':_0x5c1a58,'mode':_0x352a21,'syncedAt':new Date()[_0x24191f(0x91)](),'description':_0x102a08[_0x24191f(0xb7)]}),_0x216d47=buildSqlLockEntry(_0x102a08,_0x155858,computeSqlContentHash(_0x3330ce),{'dbName':_0x5c1a58}),_0x25b993=_0x216d47[_0x24191f(0xa8)],_0x282b7a=join(_0x22ea56[_0x24191f(0x9a)],_0x25b993);try{if(await fileExists(_0x282b7a)){const _0x3727b2=await readFile(_0x282b7a,_0x24191f(0x8d));if(isEquivalentPulledSqlFile(_0x3727b2,_0x3330ce,_0x352a21)){_0xc2e572['push']({'sqlCode':_0x102a08[_0x24191f(0xb4)],'reason':'unchanged'}),_0x3cdb8f['sqls'][_0x102a08[_0x24191f(0xb4)]]={..._0x216d47,'hash':computeSqlContentHash(_0x3727b2),'path':_0x25b993};continue;}if(!_0x35f46f){_0xc2e572[_0x24191f(0xa7)]({'sqlCode':_0x102a08[_0x24191f(0xb4)],'reason':_0x24191f(0x97)});continue;}}const _0x873fad=_0x309cd2?.[_0x24191f(0xa8)]?join(_0x22ea56[_0x24191f(0x9a)],_0x309cd2[_0x24191f(0xa8)]):undefined;_0x873fad&&_0x873fad!==_0x282b7a&&await fileExists(_0x873fad)&&await rm(_0x873fad,{'force':!![]}),await ensureParentDirectory(_0x282b7a),await writeFile(_0x282b7a,_0x3330ce,_0x24191f(0x8d)),_0x3cdb8f[_0x24191f(0x7b)][_0x102a08[_0x24191f(0xb4)]]={..._0x216d47,'path':_0x25b993},_0x530273['push']({'sqlCode':_0x102a08[_0x24191f(0xb4)],'filePath':_0x282b7a});}catch(_0x545e2d){_0x45f5f3['push']({'sqlCode':_0x102a08[_0x24191f(0xb4)],'error':_0x545e2d instanceof Error?_0x545e2d[_0x24191f(0x89)]:String(_0x545e2d)});}}return _0x3cdb8f[_0x24191f(0x84)]=new Date()[_0x24191f(0x91)](),await writeSqlLockFile(_0x22ea56[_0x24191f(0xad)],_0x2c6b8d),{'ok':_0x45f5f3[_0x24191f(0x7d)]===0x0,'data':{'pulled':_0x530273,'skipped':_0xc2e572,'failed':_0x45f5f3},'message':'Pull\x20complete:\x20'+_0x530273[_0x24191f(0x7d)]+_0x24191f(0xaf)+_0xc2e572['length']+_0x24191f(0xb8)+_0x45f5f3[_0x24191f(0x7d)]+_0x24191f(0x7f)};}};function detectModeFromSql(_0xe0fc09){const _0x4e81d5=a202_0x4ad68a,_0x3ed212=ensureRemoteSqlContent(_0xe0fc09),_0x3bf931=stripLocalSqlMetadata(_0x3ed212,_0x4e81d5(0x86))[_0x4e81d5(0x8e)]();if(/^<(select|insert|update|delete)\b/i['test'](_0x3bf931))return _0x4e81d5(0x86);return _0x4e81d5(0xa6);}function isEquivalentPulledSqlFile(_0x14fe3d,_0x59ff85,_0x933776){return normalizePullComparableContent(_0x14fe3d,_0x933776)===normalizePullComparableContent(_0x59ff85,_0x933776);}function a202_0x28c5(_0x168019,_0x180f84){_0x168019=_0x168019-0x7b;const _0x2ceebd=a202_0x2cee();let _0x28c519=_0x2ceebd[_0x168019];return _0x28c519;}function normalizePullComparableContent(_0x12f430,_0x14da39){const _0x4c1dc3=a202_0x4ad68a,_0x378163=_0x12f430[_0x4c1dc3(0x90)](/\r\n/g,'\x0a')[_0x4c1dc3(0x81)]('\x0a'),_0x3b87e5=_0x378163[_0x4c1dc3(0x85)](_0x53b0d2=>!isSyncedAtMetadataLine(_0x53b0d2,_0x14da39));return _0x3b87e5['join']('\x0a');}function isSyncedAtMetadataLine(_0x45a169,_0x5e1205){if(_0x5e1205==='mybatisXml')return/^\s*<!--\s*@lovrabet\.syncedAt:/['test'](_0x45a169);return/^\s*--\s*@lovrabet\.syncedAt:/['test'](_0x45a169);}
1
+ const a215_0xaf4aeb=a215_0x33d7;(function(_0x864590,_0x40fe56){const _0x4be554=a215_0x33d7,_0x19bdc2=_0x864590();while(!![]){try{const _0x39e822=-parseInt(_0x4be554(0x87))/0x1*(-parseInt(_0x4be554(0x9b))/0x2)+parseInt(_0x4be554(0xa0))/0x3+-parseInt(_0x4be554(0x89))/0x4*(-parseInt(_0x4be554(0xb8))/0x5)+parseInt(_0x4be554(0xb7))/0x6*(-parseInt(_0x4be554(0x97))/0x7)+parseInt(_0x4be554(0xaa))/0x8*(parseInt(_0x4be554(0xb2))/0x9)+parseInt(_0x4be554(0xac))/0xa+-parseInt(_0x4be554(0x7d))/0xb;if(_0x39e822===_0x40fe56)break;else _0x19bdc2['push'](_0x19bdc2['shift']());}catch(_0x50375d){_0x19bdc2['push'](_0x19bdc2['shift']());}}}(a215_0x1e87,0x4c162));import{readFile,rm,writeFile}from'node:fs/promises';import{join}from'node:path';import{getSqlQueryDetail,listSqlQueries}from'../../core/api-client.js';function a215_0x33d7(_0xe8a2d0,_0x4c9b51){_0xe8a2d0=_0xe8a2d0-0x7d;const _0x1e87f1=a215_0x1e87();let _0x33d7e7=_0x1e87f1[_0xe8a2d0];return _0x33d7e7;}import{ensureParentDirectory,fileExists}from'../../core/bff/file-system.js';import{getDbName}from'../../core/db-resolver.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{computeSqlContentHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{resolveLocalSqlFilePath}from'../../core/sql-sync/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a215_0x1e87(){const _0x3c7881=['description','push','sqlRootDir','force','read','mybatisXml','523803vMzlZx','lockFilePath','apps','Force\x20pull\x20cancelled.','26UNcuyw','paging','totalCount','Pull\x20remote\x20SQL\x20queries\x20to\x20local\x20.rabetbase/sql/','sqlName','831168hshFuq','str','message','sqls','cancelled','boolean','\x20skipped,\x20','join','\x20written,\x20','sqlRoot','31832lEKukJ','string','6101970IDBrIG','test','pull','\x20failed','sqlContent','name','18xOJzod','Filter\x20by\x20SQL\x20display\x20name','bool','Pull\x20complete:\x20','Force\x20pull\x20will\x20overwrite\x20local\x20SQL\x20that\x20differs\x20from\x20remote.','18QSXrLl','32605muPIVt','trimStart','7405948Ubvadc','local\x20differs\x20from\x20remote\x20(use\x20--force\x20to\x20overwrite)','sqlCode','appCode','local\x20differs\x20from\x20remote','toISOString','Would\x20pull\x20','Force\x20overwrite\x20local\x20unsynced\x20changes','length','utf8','18651FcXhHK','sqlcode','44ageuIt','path','/smartapi/custom/queryUserCustomSqlList\x20+\x20/smartapi/custom/getUserCustomSql','replace','dbId','filter','unchanged','sql'];a215_0x1e87=function(){return _0x3c7881;};return a215_0x1e87();}import{buildLocalSqlFileContent,buildSqlLockEntry,cloneSqlLockData,confirmForceOverwrite,ensureRemoteSqlContent,stripLocalSqlMetadata}from'./shared.js';const PAGE_SIZE=0x64;async function fetchAllSqlQueries(_0x452d85,_0x3d6d5b){const _0x2b8c52=a215_0x33d7,_0x3f31d5=[];let _0x4f3fd7=0x1;while(!![]){const _0x572e90=await listSqlQueries(_0x452d85,{'currentPage':_0x4f3fd7,'pageSize':PAGE_SIZE,'sqlCode':_0x3d6d5b[_0x2b8c52(0x7f)],'sqlName':_0x3d6d5b[_0x2b8c52(0x9f)]}),_0x3d8284=_0x572e90['tableData']??[];_0x3f31d5[_0x2b8c52(0x92)](..._0x3d8284);if(_0x3d8284[_0x2b8c52(0x85)]===0x0)break;const _0x4ec874=_0x572e90[_0x2b8c52(0x9c)]?.[_0x2b8c52(0x9d)];if(_0x4ec874!=null?_0x3f31d5[_0x2b8c52(0x85)]>=_0x4ec874:_0x3d8284[_0x2b8c52(0x85)]<PAGE_SIZE)break;_0x4f3fd7++;}return _0x3f31d5;}async function ensureSqlContent(_0x490f98){const _0x5bd36e=a215_0x33d7;if(_0x490f98[_0x5bd36e(0xb0)]!=null&&String(_0x490f98[_0x5bd36e(0xb0)])['length']>0x0)return _0x490f98;return getSqlQueryDetail(_0x490f98[_0x5bd36e(0x7f)]);}export const sqlPull={'service':a215_0xaf4aeb(0x90),'command':a215_0xaf4aeb(0xae),'description':a215_0xaf4aeb(0x9e),'risk':a215_0xaf4aeb(0x95),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a215_0xaf4aeb(0xb1),'type':a215_0xaf4aeb(0xab),'description':a215_0xaf4aeb(0xb3)},{'name':a215_0xaf4aeb(0x94),'type':a215_0xaf4aeb(0xa5),'description':a215_0xaf4aeb(0x84)}],async 'dryRun'(_0x5bbeb5){const _0x230196=a215_0xaf4aeb,_0x50ad87=loadSqlProjectConfig(_0x5bbeb5[_0x230196(0x80)]),_0x3f266a=await readSqlLockFile(_0x50ad87[_0x230196(0x98)]),{appLock:_0x5715a4}=ensureSqlLockScope(_0x3f266a??createEmptySqlLock(),_0x50ad87[_0x230196(0x80)],_0x50ad87[_0x230196(0xa9)],'pull'),_0xd604ee=await fetchAllSqlQueries(_0x5bbeb5[_0x230196(0x80)],{'sqlCode':_0x5bbeb5['str'](_0x230196(0x88))||undefined,'sqlName':_0x5bbeb5[_0x230196(0xa1)](_0x230196(0xb1))||undefined}),_0x364a0e=[];for(const _0x298306 of _0xd604ee){const _0x15aeb1=await ensureSqlContent(_0x298306),_0x1a459f=ensureRemoteSqlContent(_0x15aeb1),_0x3b90b8=detectModeFromSql(_0x15aeb1),_0x4467d9=_0x15aeb1[_0x230196(0x8d)]?await getDbName(_0x5bbeb5['appCode'],Number(_0x15aeb1[_0x230196(0x8d)]))['catch'](()=>undefined):undefined,_0x3748e9=buildLocalSqlFileContent({'sqlCode':_0x15aeb1[_0x230196(0x7f)],'sqlName':_0x15aeb1[_0x230196(0x9f)],'dbId':_0x15aeb1['dbId']},_0x1a459f,{'dbName':_0x4467d9,'mode':_0x3b90b8,'syncedAt':new Date()['toISOString'](),'description':_0x15aeb1[_0x230196(0x91)]}),_0x27c653=buildSqlLockEntry(_0x15aeb1,_0x1a459f,'',{'dbName':_0x4467d9}),_0x2fa69a=resolveLocalSqlFilePath(_0x50ad87,_0x15aeb1['sqlCode'],_0x27c653);let _0x4b5455='would_pull',_0x11bad6;if(await fileExists(_0x2fa69a)){const _0x814063=await readFile(_0x2fa69a,'utf8');isEquivalentPulledSqlFile(_0x814063,_0x3748e9,_0x3b90b8)?(_0x4b5455='skipped',_0x11bad6=_0x230196(0x8f)):(_0x4b5455='conflict',_0x11bad6=_0x230196(0x7e));}_0x364a0e[_0x230196(0x92)]({'sqlCode':_0x15aeb1[_0x230196(0x7f)],'sqlName':_0x15aeb1[_0x230196(0x9f)],'filePath':_0x2fa69a,'status':_0x4b5455,'reason':_0x11bad6});}return{'method':'POST','url':_0x230196(0x8b),'body':{'appCode':_0x5bbeb5[_0x230196(0x80)],'sqlCode':_0x5bbeb5[_0x230196(0xa1)](_0x230196(0x88))||null,'sqlName':_0x5bbeb5[_0x230196(0xa1)]('name')||null,'files':_0x364a0e},'description':_0x230196(0x83)+_0x364a0e[_0x230196(0x85)]+'\x20SQL\x20file(s)\x20into\x20'+_0x50ad87['sqlRootDir']};},async 'execute'(_0x1a149a){const _0x58b685=a215_0xaf4aeb,_0x1d26ae=loadSqlProjectConfig(_0x1a149a[_0x58b685(0x80)]),_0x3eac21=await readSqlLockFile(_0x1d26ae['lockFilePath']),{lockData:_0x46ec37,appLock:_0x139d6d}=ensureSqlLockScope(_0x3eac21??createEmptySqlLock(),_0x1d26ae['appCode'],_0x1d26ae['sqlRoot'],'pull'),_0x1643fd=_0x1a149a[_0x58b685(0xb4)]('force'),_0x223e10=await fetchAllSqlQueries(_0x1a149a[_0x58b685(0x80)],{'sqlCode':_0x1a149a[_0x58b685(0xa1)](_0x58b685(0x88))||undefined,'sqlName':_0x1a149a[_0x58b685(0xa1)]('name')||undefined});if(_0x223e10['length']===0x0)return{'ok':!![],'data':{'pulled':[],'skipped':[],'failed':[]},'message':'No\x20remote\x20SQL\x20queries\x20matched.'};const _0x367f25=[],_0x332401=[];for(const _0x22974c of _0x223e10){try{_0x367f25[_0x58b685(0x92)](await ensureSqlContent(_0x22974c));}catch(_0x3da8d4){_0x332401[_0x58b685(0x92)]({'sqlCode':_0x22974c[_0x58b685(0x7f)],'error':_0x3da8d4 instanceof Error?_0x3da8d4[_0x58b685(0xa2)]:String(_0x3da8d4)});}}if(_0x1643fd&&!_0x1a149a['nonInteractive']){let _0x484305=![];for(const _0xf1b1f4 of _0x367f25){const _0x41152d=detectModeFromSql(_0xf1b1f4),_0x5e68a3=_0xf1b1f4[_0x58b685(0x8d)]?await getDbName(_0x1a149a[_0x58b685(0x80)],Number(_0xf1b1f4[_0x58b685(0x8d)]))['catch'](()=>undefined):undefined,_0x249f19=buildLocalSqlFileContent({'sqlCode':_0xf1b1f4[_0x58b685(0x7f)],'sqlName':_0xf1b1f4[_0x58b685(0x9f)],'dbId':_0xf1b1f4[_0x58b685(0x8d)]},ensureRemoteSqlContent(_0xf1b1f4),{'dbName':_0x5e68a3,'mode':_0x41152d,'syncedAt':new Date()[_0x58b685(0x82)](),'description':_0xf1b1f4[_0x58b685(0x91)]}),_0xf21bee=resolveLocalSqlFilePath(_0x1d26ae,_0xf1b1f4['sqlCode'],buildSqlLockEntry(_0xf1b1f4,ensureRemoteSqlContent(_0xf1b1f4),'',{'dbName':_0x5e68a3}));if(await fileExists(_0xf21bee)){const _0x1ccb7a=await readFile(_0xf21bee,_0x58b685(0x86));if(!isEquivalentPulledSqlFile(_0x1ccb7a,_0x249f19,_0x41152d)){_0x484305=!![];break;}}}if(_0x484305){const _0x1ebea8=await confirmForceOverwrite(_0x58b685(0xb6));if(!_0x1ebea8)throw CliErrors[_0x58b685(0xa4)](_0x58b685(0x9a));}}const _0x1da991=cloneSqlLockData(_0x46ec37),_0x431ca5=_0x1da991[_0x58b685(0x99)][_0x1d26ae[_0x58b685(0x80)]],_0x33858f=[],_0x127999=[];for(const _0x6693fc of _0x367f25){const _0x3c1c54=_0x431ca5[_0x58b685(0xa3)][_0x6693fc['sqlCode']],_0x289133=ensureRemoteSqlContent(_0x6693fc),_0x377b37=detectModeFromSql(_0x6693fc),_0x5b68dd=_0x6693fc['dbId']?await getDbName(_0x1a149a[_0x58b685(0x80)],Number(_0x6693fc[_0x58b685(0x8d)]))['catch'](()=>undefined):undefined,_0x447daa=buildLocalSqlFileContent({'sqlCode':_0x6693fc[_0x58b685(0x7f)],'sqlName':_0x6693fc[_0x58b685(0x9f)],'dbId':_0x6693fc['dbId']},_0x289133,{'dbName':_0x5b68dd,'mode':_0x377b37,'syncedAt':new Date()[_0x58b685(0x82)](),'description':_0x6693fc[_0x58b685(0x91)]}),_0x4a5fdf=buildSqlLockEntry(_0x6693fc,_0x289133,computeSqlContentHash(_0x447daa),{'dbName':_0x5b68dd}),_0x790d65=_0x4a5fdf[_0x58b685(0x8a)],_0xf36219=join(_0x1d26ae['sqlRootDir'],_0x790d65);try{if(await fileExists(_0xf36219)){const _0x4c2611=await readFile(_0xf36219,_0x58b685(0x86));if(isEquivalentPulledSqlFile(_0x4c2611,_0x447daa,_0x377b37)){_0x127999[_0x58b685(0x92)]({'sqlCode':_0x6693fc[_0x58b685(0x7f)],'reason':_0x58b685(0x8f)}),_0x431ca5['sqls'][_0x6693fc[_0x58b685(0x7f)]]={..._0x4a5fdf,'hash':computeSqlContentHash(_0x4c2611),'path':_0x790d65};continue;}if(!_0x1643fd){_0x127999[_0x58b685(0x92)]({'sqlCode':_0x6693fc[_0x58b685(0x7f)],'reason':_0x58b685(0x81)});continue;}}const _0x232248=_0x3c1c54?.[_0x58b685(0x8a)]?join(_0x1d26ae[_0x58b685(0x93)],_0x3c1c54[_0x58b685(0x8a)]):undefined;_0x232248&&_0x232248!==_0xf36219&&await fileExists(_0x232248)&&await rm(_0x232248,{'force':!![]}),await ensureParentDirectory(_0xf36219),await writeFile(_0xf36219,_0x447daa,_0x58b685(0x86)),_0x431ca5[_0x58b685(0xa3)][_0x6693fc['sqlCode']]={..._0x4a5fdf,'path':_0x790d65},_0x33858f[_0x58b685(0x92)]({'sqlCode':_0x6693fc[_0x58b685(0x7f)],'filePath':_0xf36219});}catch(_0x110c30){_0x332401[_0x58b685(0x92)]({'sqlCode':_0x6693fc[_0x58b685(0x7f)],'error':_0x110c30 instanceof Error?_0x110c30[_0x58b685(0xa2)]:String(_0x110c30)});}}return _0x431ca5['lastSync']=new Date()[_0x58b685(0x82)](),await writeSqlLockFile(_0x1d26ae[_0x58b685(0x98)],_0x1da991),{'ok':_0x332401[_0x58b685(0x85)]===0x0,'data':{'pulled':_0x33858f,'skipped':_0x127999,'failed':_0x332401},'message':_0x58b685(0xb5)+_0x33858f[_0x58b685(0x85)]+_0x58b685(0xa8)+_0x127999[_0x58b685(0x85)]+_0x58b685(0xa6)+_0x332401['length']+_0x58b685(0xaf)};}};function detectModeFromSql(_0xcd602a){const _0xc0bf69=a215_0xaf4aeb,_0x597397=ensureRemoteSqlContent(_0xcd602a),_0x32c208=stripLocalSqlMetadata(_0x597397,_0xc0bf69(0x96))[_0xc0bf69(0xb9)]();if(/^<(select|insert|update|delete)\b/i[_0xc0bf69(0xad)](_0x32c208))return'mybatisXml';return'sql';}function isEquivalentPulledSqlFile(_0x2160c1,_0x26cd08,_0x90be56){return normalizePullComparableContent(_0x2160c1,_0x90be56)===normalizePullComparableContent(_0x26cd08,_0x90be56);}function normalizePullComparableContent(_0x438dff,_0x5802ed){const _0x559edf=a215_0xaf4aeb,_0x567ed9=_0x438dff[_0x559edf(0x8c)](/\r\n/g,'\x0a')['split']('\x0a'),_0x18712b=_0x567ed9[_0x559edf(0x8e)](_0x4a3dd5=>!isSyncedAtMetadataLine(_0x4a3dd5,_0x5802ed));return _0x18712b[_0x559edf(0xa7)]('\x0a');}function isSyncedAtMetadataLine(_0x1d8ef3,_0x22f004){const _0x5b63ba=a215_0xaf4aeb;if(_0x22f004===_0x5b63ba(0x96))return/^\s*<!--\s*@lovrabet\.syncedAt:/[_0x5b63ba(0xad)](_0x1d8ef3);return/^\s*--\s*@lovrabet\.syncedAt:/[_0x5b63ba(0xad)](_0x1d8ef3);}
@@ -1 +1 @@
1
- const a203_0xfb2fb3=a203_0x5e27;(function(_0x18fb9c,_0x50f13e){const _0x3ff4a0=a203_0x5e27,_0x35b48c=_0x18fb9c();while(!![]){try{const _0xfd152f=-parseInt(_0x3ff4a0(0x212))/0x1+parseInt(_0x3ff4a0(0x1f3))/0x2+-parseInt(_0x3ff4a0(0x203))/0x3+parseInt(_0x3ff4a0(0x1eb))/0x4*(parseInt(_0x3ff4a0(0x21e))/0x5)+parseInt(_0x3ff4a0(0x20e))/0x6*(-parseInt(_0x3ff4a0(0x20b))/0x7)+-parseInt(_0x3ff4a0(0x219))/0x8*(-parseInt(_0x3ff4a0(0x1e0))/0x9)+parseInt(_0x3ff4a0(0x1e4))/0xa;if(_0xfd152f===_0x50f13e)break;else _0x35b48c['push'](_0x35b48c['shift']());}catch(_0xe6dbc4){_0x35b48c['push'](_0x35b48c['shift']());}}}(a203_0x835f,0x68dc6));function a203_0x5e27(_0x3946b1,_0x4c5c63){_0x3946b1=_0x3946b1-0x1e0;const _0x835f19=a203_0x835f();let _0x5e2797=_0x835f19[_0x3946b1];return _0x5e2797;}import{mkdir,readFile,readdir,rename,rmdir}from'node:fs/promises';import{dirname,join,relative,resolve,sep}from'node:path';import{updateSqlQuery}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{getDbName,listDatabases}from'../../core/db-resolver.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';import{computeSqlFileHash}from'../../core/sql-sync/hash.js';import{createEmptySqlLock,ensureSqlLockScope,readSqlLockFile,writeSqlLockFile}from'../../core/sql-sync/lock.js';import{fileExists}from'../../core/bff/file-system.js';import{CliErrors}from'../../errors.js';import{SQLCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a203_0x835f(){const _0x35d3e5=['1433268oopXrY','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','join','length','str','mode','validation','dbName','\x20failed','Push\x20local\x20SQL\x20files\x20to\x20remote','/smartapi/custom/updateUserCustomSql','push','filePath','sqlRootDir','toISOString','status','916371KjsOGM','dbDirectory','set','has','Local\x20SQL\x20not\x20found:\x20','missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first','\x20pushed,\x20','sqls','14HuHUDG','write','lockFilePath','1677906GQYmut','exec','force','projectRoot','660401EpnwhR','sqlRoot','lastSync','entries','trashDir','Push\x20complete:\x20','appCode','274504mRmrVX','utf8','remoteId','sql','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','985SzKRSN','No\x20local\x20SQL\x20files\x20found.','sqlConfig','sqlCode','isFinite','sqlcode','map','153TXdPUD','Local\x20directory\x20\x22','filter','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','3034640YQwJde','boolean','path','version','sqlName','message','dbId','7132FMjtXb','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','relativePath','replace','hash','POST','bool','startsWith'];a203_0x835f=function(){return _0x35d3e5;};return a203_0x835f();}import{buildSqlLockEntry,stripLocalSqlMetadata}from'./shared.js';import{buildDbDirectoryName}from'../../core/sql-sync/utils.js';import{automaticDeploymentSyncSucceeded,buildAutomaticDeploymentSyncPreview,runAutomaticDeploymentSync}from'../../commands/deployment/auto-sync.js';async function getTargetSqlQueries(_0x1f35f6,_0x29db05,_0x1efc24){const _0x366dd4=a203_0x5e27,_0x338bc2=await scanLocalSqlQueries(_0x1f35f6),_0x5a03c3=new Map();for(const _0x1476a3 of _0x338bc2){if(_0x1efc24&&_0x1476a3['sqlCode']!==_0x1efc24)continue;const _0x297c84=_0x5a03c3['get'](_0x1476a3[_0x366dd4(0x221)])??[];_0x297c84[_0x366dd4(0x1fe)](_0x1476a3),_0x5a03c3[_0x366dd4(0x205)](_0x1476a3[_0x366dd4(0x221)],_0x297c84);}if(_0x1efc24&&!_0x5a03c3[_0x366dd4(0x206)](_0x1efc24))throw CliErrors[_0x366dd4(0x1f9)](_0x366dd4(0x207)+_0x1efc24);const _0x1c139a=[];for(const [_0x2bb121,_0x583296]of _0x5a03c3[_0x366dd4(0x215)]()){if(_0x583296[_0x366dd4(0x1f6)]===0x1){_0x1c139a[_0x366dd4(0x1fe)](_0x583296[0x0]);continue;}const _0x5262a4=_0x29db05[_0x366dd4(0x20a)][_0x2bb121],_0x3a2067=_0x5262a4?.['path'],_0x2223bb=_0x3a2067?_0x583296[_0x366dd4(0x1e2)](_0x2f323c=>_0x2f323c[_0x366dd4(0x1ed)]!==_0x3a2067):_0x583296;if(_0x5262a4&&_0x2223bb[_0x366dd4(0x1f6)]===0x1){_0x1c139a[_0x366dd4(0x1fe)](_0x2223bb[0x0]);continue;}throw CliErrors[_0x366dd4(0x1f9)](_0x366dd4(0x1f4)+_0x2bb121+_0x366dd4(0x1e3));}return _0x1c139a;}export const sqlPush={'service':a203_0xfb2fb3(0x21c),'command':'push','description':a203_0xfb2fb3(0x1fc),'risk':a203_0xfb2fb3(0x20c),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a203_0xfb2fb3(0x210),'type':a203_0xfb2fb3(0x1e5),'description':a203_0xfb2fb3(0x1ec)}],async 'dryRun'(_0x3442fd){const _0x2904e9=a203_0xfb2fb3,_0x21fc35=loadSqlProjectConfig(_0x3442fd['appCode']),_0x464ea0=await readSqlLockFile(_0x21fc35[_0x2904e9(0x20d)]),{appLock:_0x5f5238}=ensureSqlLockScope(_0x464ea0??createEmptySqlLock(),_0x3442fd['appCode'],_0x21fc35[_0x2904e9(0x213)],_0x2904e9(0x1fe)),_0x45493a=await getTargetSqlQueries(_0x21fc35,_0x5f5238,_0x3442fd[_0x2904e9(0x1f7)](_0x2904e9(0x223))||undefined),_0x560757=[];for(const _0x446f42 of _0x45493a){const _0x2220d7=await computeSqlFileHash(_0x446f42[_0x2904e9(0x1ff)]),_0x322973=_0x5f5238[_0x2904e9(0x20a)][_0x446f42[_0x2904e9(0x221)]],_0x365c56=!!_0x322973&&(_0x322973[_0x2904e9(0x1e6)]!==_0x446f42[_0x2904e9(0x1ed)]||!!_0x446f42['sqlName']&&_0x322973[_0x2904e9(0x1e8)]!==_0x446f42[_0x2904e9(0x1e8)]);if(!_0x3442fd[_0x2904e9(0x1f1)](_0x2904e9(0x210))&&_0x322973&&_0x322973[_0x2904e9(0x1ef)]===_0x2220d7&&!_0x365c56)continue;_0x560757[_0x2904e9(0x1fe)](_0x446f42[_0x2904e9(0x221)]);}return{'method':_0x2904e9(0x1f0),'url':_0x2904e9(0x1fd),'deploymentSync':buildAutomaticDeploymentSyncPreview('sql',_0x560757),'body':{'sqlCodes':_0x560757,'appCode':_0x3442fd[_0x2904e9(0x218)]},'description':'Would\x20push\x20'+_0x560757[_0x2904e9(0x1f6)]+'\x20SQL\x20file(s)'};},async 'execute'(_0x31f6e9){const _0x85bba=a203_0xfb2fb3,_0x12ac1c=loadSqlProjectConfig(_0x31f6e9[_0x85bba(0x218)]),_0x320b25=await readSqlLockFile(_0x12ac1c[_0x85bba(0x20d)]),{lockData:_0x2a7bfc,appLock:_0x3bbc2a}=ensureSqlLockScope(_0x320b25??createEmptySqlLock(),_0x31f6e9[_0x85bba(0x218)],_0x12ac1c[_0x85bba(0x213)],_0x85bba(0x1fe)),_0x34cac0=await getTargetSqlQueries(_0x12ac1c,_0x3bbc2a,_0x31f6e9[_0x85bba(0x1f7)](_0x85bba(0x223))||undefined);if(_0x34cac0[_0x85bba(0x1f6)]===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x85bba(0x21f)};const _0x9b8c4e=[],_0x1f07a0=[],_0x397fc0=[];for(const _0x2eee40 of _0x34cac0){const _0x4c2256=_0x3bbc2a[_0x85bba(0x20a)][_0x2eee40['sqlCode']];if(!_0x4c2256){_0x397fc0['push']({'sqlCode':_0x2eee40[_0x85bba(0x221)],'error':_0x85bba(0x21d)});continue;}try{const _0x56e7c1=await computeSqlFileHash(_0x2eee40[_0x85bba(0x1ff)]),_0x3b1678=_0x4c2256[_0x85bba(0x1e6)]!==_0x2eee40[_0x85bba(0x1ed)]||!!_0x2eee40[_0x85bba(0x1e8)]&&_0x4c2256[_0x85bba(0x1e8)]!==_0x2eee40[_0x85bba(0x1e8)];if(!_0x31f6e9[_0x85bba(0x1f1)](_0x85bba(0x210))&&_0x4c2256['hash']===_0x56e7c1&&!_0x3b1678){_0x1f07a0[_0x85bba(0x1fe)]({'sqlCode':_0x2eee40[_0x85bba(0x221)],'reason':'unchanged'});continue;}if(_0x4c2256[_0x85bba(0x1e7)]==null){_0x397fc0['push']({'sqlCode':_0x2eee40[_0x85bba(0x221)],'error':_0x85bba(0x208)});continue;}const _0x11010d=await readFile(_0x2eee40[_0x85bba(0x1ff)],_0x85bba(0x21a)),_0x461517=stripLocalSqlMetadata(_0x11010d,_0x2eee40[_0x85bba(0x1f8)]),_0x1e85d5=_0x2eee40[_0x85bba(0x1e8)]||_0x4c2256[_0x85bba(0x1e8)],_0x45ccc2=await resolveTargetDbBinding(_0x31f6e9['appCode'],_0x2eee40,_0x4c2256),_0x3c8420=await updateSqlQuery({'id':_0x4c2256[_0x85bba(0x21b)],'appCode':_0x31f6e9['appCode'],'sqlCode':_0x2eee40[_0x85bba(0x221)],'sqlName':_0x1e85d5,'dbId':_0x45ccc2['dbId'],'version':_0x4c2256['version'],'sqlContent':_0x461517,'sqlConfig':_0x4c2256[_0x85bba(0x220)]??undefined}),_0x34e6a9=_0x3c8420['dbId']?await getDbName(_0x31f6e9[_0x85bba(0x218)],Number(_0x3c8420[_0x85bba(0x1ea)]))['catch'](()=>_0x45ccc2[_0x85bba(0x1fa)]):_0x45ccc2[_0x85bba(0x1fa)];_0x3bbc2a[_0x85bba(0x20a)][_0x2eee40[_0x85bba(0x221)]]={...buildSqlLockEntry(_0x3c8420,_0x461517,_0x56e7c1,{'dbName':_0x34e6a9}),'path':_0x2eee40[_0x85bba(0x1ed)],'mode':_0x4c2256[_0x85bba(0x1f8)]},await archivePreviousSqlFileIfNeeded(_0x12ac1c,_0x4c2256['path'],_0x2eee40[_0x85bba(0x1ed)]),_0x9b8c4e['push']({'sqlCode':_0x2eee40[_0x85bba(0x221)],'remoteId':_0x4c2256[_0x85bba(0x21b)]});}catch(_0x32b19f){_0x397fc0[_0x85bba(0x1fe)]({'sqlCode':_0x2eee40[_0x85bba(0x221)],'error':_0x32b19f instanceof Error?_0x32b19f[_0x85bba(0x1e9)]:String(_0x32b19f)});}}_0x3bbc2a[_0x85bba(0x214)]=new Date()[_0x85bba(0x201)](),await writeSqlLockFile(_0x12ac1c[_0x85bba(0x20d)],_0x2a7bfc);const _0x266877=_0x397fc0['length']===0x0,_0x59745d=await runAutomaticDeploymentSync(_0x31f6e9,_0x85bba(0x21c),_0x9b8c4e[_0x85bba(0x224)](_0x57213c=>_0x57213c[_0x85bba(0x221)]),_0x266877),_0x35c5c0=_0x266877&&automaticDeploymentSyncSucceeded(_0x59745d),_0x41ef42=',\x20deployment\x20sync\x20'+_0x59745d[_0x85bba(0x202)];return{'ok':_0x35c5c0,'data':{'pushed':_0x9b8c4e,'skipped':_0x1f07a0,'failed':_0x397fc0,'deploymentSync':_0x59745d},'message':_0x85bba(0x217)+_0x9b8c4e[_0x85bba(0x1f6)]+_0x85bba(0x209)+_0x1f07a0[_0x85bba(0x1f6)]+'\x20skipped,\x20'+_0x397fc0[_0x85bba(0x1f6)]+_0x85bba(0x1fb)+_0x41ef42};}};async function archivePreviousSqlFileIfNeeded(_0x4d3542,_0x5f9b1a,_0x1203db){const _0x21acd1=a203_0xfb2fb3;if(!_0x5f9b1a||_0x5f9b1a===_0x1203db)return;const _0x4cad3f=join(_0x4d3542[_0x21acd1(0x200)],_0x5f9b1a);if(!await fileExists(_0x4cad3f))return;const _0x947e10=await moveToTrash(_0x4d3542[_0x21acd1(0x211)],_0x4d3542[_0x21acd1(0x216)],_0x4cad3f);await cleanupEmptyDirectories(dirname(_0x4cad3f),_0x4d3542[_0x21acd1(0x200)]),void _0x947e10;}async function moveToTrash(_0x547e9b,_0x159bc2,_0x1df4ec){const _0x5f5820=a203_0xfb2fb3,_0x53e36c=new Date()[_0x5f5820(0x201)]()[_0x5f5820(0x1ee)](/[:.]/g,'-'),_0xc7e752=relative(_0x547e9b,_0x1df4ec),_0x5f39f2=join(_0x159bc2,_0x53e36c,_0xc7e752);return await mkdir(dirname(_0x5f39f2),{'recursive':!![]}),await rename(_0x1df4ec,_0x5f39f2),_0x5f39f2;}async function cleanupEmptyDirectories(_0x1b2d75,_0x16290b){const _0x274600=a203_0xfb2fb3;let _0x615912=resolve(_0x1b2d75);const _0x5a4f9a=resolve(_0x16290b);while(_0x615912[_0x274600(0x1f2)](''+_0x5a4f9a+sep)||_0x615912===_0x5a4f9a){if(_0x615912===_0x5a4f9a)return;try{const _0x1e6372=await readdir(_0x615912);if(_0x1e6372[_0x274600(0x1f6)]>0x0)return;await rmdir(_0x615912);}catch{return;}_0x615912=dirname(_0x615912);}}async function resolveTargetDbBinding(_0x162e0b,_0x578794,_0x1068db){const _0xeca1fa=a203_0xfb2fb3,_0x3279cc=_0x578794[_0xeca1fa(0x204)];if(!_0x3279cc)return{'dbId':_0x1068db[_0xeca1fa(0x1ea)],'dbName':_0x1068db[_0xeca1fa(0x1fa)]};const _0x325954=buildDbDirectoryName(_0x1068db['dbName'],_0x1068db[_0xeca1fa(0x1ea)]);if(_0x3279cc===_0x325954)return{'dbId':_0x1068db[_0xeca1fa(0x1ea)],'dbName':_0x1068db[_0xeca1fa(0x1fa)]};const _0x5bd115=parseExplicitDbDirectory(_0x3279cc);if(_0x5bd115!=null)return{'dbId':_0x5bd115,'dbName':await getDbName(_0x162e0b,_0x5bd115)['catch'](()=>undefined)};const _0xa13633=await listDatabases(_0x162e0b),_0x5d7fb1=_0xa13633[_0xeca1fa(0x1e2)](_0x880181=>buildDbDirectoryName(_0x880181['dbName'],_0x880181['dbId'])===_0x3279cc);if(_0x5d7fb1['length']===0x1)return{'dbId':_0x5d7fb1[0x0][_0xeca1fa(0x1ea)],'dbName':_0x5d7fb1[0x0][_0xeca1fa(0x1fa)]};if(_0x5d7fb1[_0xeca1fa(0x1f6)]===0x0)throw CliErrors['validation']('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x3279cc+'\x22\x20for\x20sqlCode\x20'+_0x578794[_0xeca1fa(0x221)]+'.');const _0x2830fe=_0x5d7fb1[_0xeca1fa(0x224)](_0x3b2266=>_0x3b2266['dbName']+'\x20('+_0x3b2266[_0xeca1fa(0x1ea)]+')')[_0xeca1fa(0x1f5)](',\x20');throw CliErrors[_0xeca1fa(0x1f9)](_0xeca1fa(0x1e1)+_0x3279cc+'\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20'+_0x578794['sqlCode']+':\x20'+_0x2830fe);}function parseExplicitDbDirectory(_0x47b8eb){const _0x6362d3=a203_0xfb2fb3,_0x15cd81=/^db-(\d+)$/[_0x6362d3(0x20f)](_0x47b8eb);if(!_0x15cd81)return null;const _0x4a93c3=Number(_0x15cd81[0x1]);return Number[_0x6362d3(0x222)](_0x4a93c3)&&_0x4a93c3>0x0?_0x4a93c3:null;}
1
+ const a216_0x4c4e8b=a216_0x31e7;(function(_0x390536,_0x47f946){const _0x673e0a=a216_0x31e7,_0xe8bd4c=_0x390536();while(!![]){try{const _0x980f7a=parseInt(_0x673e0a(0xea))/0x1*(-parseInt(_0x673e0a(0x10d))/0x2)+parseInt(_0x673e0a(0xdf))/0x3+-parseInt(_0x673e0a(0xfd))/0x4+parseInt(_0x673e0a(0xef))/0x5+parseInt(_0x673e0a(0xd5))/0x6+parseInt(_0x673e0a(0x100))/0x7+-parseInt(_0x673e0a(0xe7))/0x8*(-parseInt(_0x673e0a(0xe0))/0x9);if(_0x980f7a===_0x47f946)break;else _0xe8bd4c['push'](_0xe8bd4c['shift']());}catch(_0x5e1b4f){_0xe8bd4c['push'](_0xe8bd4c['shift']());}}}(a216_0xba97,0x7c761));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';import{automaticDeploymentSyncSucceeded,buildAutomaticDeploymentSyncPreview,runAutomaticDeploymentSync}from'../../commands/deployment/auto-sync.js';async function getTargetSqlQueries(_0x3e13f5,_0x928fdf,_0x2db6c0){const _0x85edbb=a216_0x31e7,_0x8f0691=await scanLocalSqlQueries(_0x3e13f5),_0x3a83a6=new Map();for(const _0x282941 of _0x8f0691){if(_0x2db6c0&&_0x282941['sqlCode']!==_0x2db6c0)continue;const _0xb11b18=_0x3a83a6[_0x85edbb(0xe6)](_0x282941['sqlCode'])??[];_0xb11b18[_0x85edbb(0x107)](_0x282941),_0x3a83a6[_0x85edbb(0xde)](_0x282941[_0x85edbb(0xd2)],_0xb11b18);}if(_0x2db6c0&&!_0x3a83a6[_0x85edbb(0x105)](_0x2db6c0))throw CliErrors[_0x85edbb(0xec)](_0x85edbb(0xeb)+_0x2db6c0);const _0x455d9d=[];for(const [_0x5154f5,_0x1d444e]of _0x3a83a6['entries']()){if(_0x1d444e[_0x85edbb(0x106)]===0x1){_0x455d9d[_0x85edbb(0x107)](_0x1d444e[0x0]);continue;}const _0x2430e3=_0x928fdf[_0x85edbb(0x108)][_0x5154f5],_0x57da56=_0x2430e3?.[_0x85edbb(0x110)],_0x411e3a=_0x57da56?_0x1d444e['filter'](_0xac613=>_0xac613['relativePath']!==_0x57da56):_0x1d444e;if(_0x2430e3&&_0x411e3a[_0x85edbb(0x106)]===0x1){_0x455d9d['push'](_0x411e3a[0x0]);continue;}throw CliErrors[_0x85edbb(0xec)](_0x85edbb(0xe8)+_0x5154f5+_0x85edbb(0xd7));}return _0x455d9d;}export const sqlPush={'service':a216_0x4c4e8b(0xd9),'command':'push','description':a216_0x4c4e8b(0xf4),'risk':a216_0x4c4e8b(0xed),'flags':[SQLCODE_FLAG_OPTIONAL,{'name':a216_0x4c4e8b(0xfa),'type':a216_0x4c4e8b(0xd4),'description':a216_0x4c4e8b(0xf1)}],async 'dryRun'(_0x5d9ab6){const _0x18b99f=a216_0x4c4e8b,_0x5862cb=loadSqlProjectConfig(_0x5d9ab6['appCode']),_0xed83c9=await readSqlLockFile(_0x5862cb['lockFilePath']),{appLock:_0x4f86c4}=ensureSqlLockScope(_0xed83c9??createEmptySqlLock(),_0x5d9ab6[_0x18b99f(0x10b)],_0x5862cb[_0x18b99f(0x10e)],_0x18b99f(0x107)),_0x1265be=await getTargetSqlQueries(_0x5862cb,_0x4f86c4,_0x5d9ab6[_0x18b99f(0xe1)](_0x18b99f(0xf3))||undefined),_0x2e6d43=[];for(const _0x32af12 of _0x1265be){const _0x1ad66a=await computeSqlFileHash(_0x32af12['filePath']),_0x4ad80d=_0x4f86c4[_0x18b99f(0x108)][_0x32af12[_0x18b99f(0xd2)]],_0x19dd89=!!_0x4ad80d&&(_0x4ad80d[_0x18b99f(0x110)]!==_0x32af12['relativePath']||!!_0x32af12['sqlName']&&_0x4ad80d['sqlName']!==_0x32af12[_0x18b99f(0x10c)]);if(!_0x5d9ab6[_0x18b99f(0xe5)](_0x18b99f(0xfa))&&_0x4ad80d&&_0x4ad80d[_0x18b99f(0x111)]===_0x1ad66a&&!_0x19dd89)continue;_0x2e6d43[_0x18b99f(0x107)](_0x32af12[_0x18b99f(0xd2)]);}return{'method':'POST','url':_0x18b99f(0xf5),'deploymentSync':buildAutomaticDeploymentSyncPreview(_0x18b99f(0xd9),_0x2e6d43),'body':{'sqlCodes':_0x2e6d43,'appCode':_0x5d9ab6[_0x18b99f(0x10b)]},'description':_0x18b99f(0x112)+_0x2e6d43[_0x18b99f(0x106)]+_0x18b99f(0xdb)};},async 'execute'(_0x2b9d91){const _0x4680dc=a216_0x4c4e8b,_0x3ac2a0=loadSqlProjectConfig(_0x2b9d91[_0x4680dc(0x10b)]),_0x11ec10=await readSqlLockFile(_0x3ac2a0[_0x4680dc(0xd8)]),{lockData:_0x24eee5,appLock:_0x434d9c}=ensureSqlLockScope(_0x11ec10??createEmptySqlLock(),_0x2b9d91['appCode'],_0x3ac2a0[_0x4680dc(0x10e)],_0x4680dc(0x107)),_0x2d5996=await getTargetSqlQueries(_0x3ac2a0,_0x434d9c,_0x2b9d91[_0x4680dc(0xe1)](_0x4680dc(0xf3))||undefined);if(_0x2d5996['length']===0x0)return{'ok':!![],'data':{'pushed':[],'skipped':[],'failed':[]},'message':_0x4680dc(0xd3)};const _0x347bed=[],_0x2eabfd=[],_0xa145d6=[];for(const _0x5e13a0 of _0x2d5996){const _0x39469b=_0x434d9c[_0x4680dc(0x108)][_0x5e13a0[_0x4680dc(0xd2)]];if(!_0x39469b){_0xa145d6[_0x4680dc(0x107)]({'sqlCode':_0x5e13a0['sqlCode'],'error':_0x4680dc(0x113)});continue;}try{const _0x59c3fd=await computeSqlFileHash(_0x5e13a0['filePath']),_0x141985=_0x39469b['path']!==_0x5e13a0['relativePath']||!!_0x5e13a0['sqlName']&&_0x39469b[_0x4680dc(0x10c)]!==_0x5e13a0[_0x4680dc(0x10c)];if(!_0x2b9d91['bool']('force')&&_0x39469b[_0x4680dc(0x111)]===_0x59c3fd&&!_0x141985){_0x2eabfd[_0x4680dc(0x107)]({'sqlCode':_0x5e13a0[_0x4680dc(0xd2)],'reason':_0x4680dc(0xf9)});continue;}if(_0x39469b[_0x4680dc(0xf6)]==null){_0xa145d6['push']({'sqlCode':_0x5e13a0['sqlCode'],'error':'missing\x20remote\x20version;\x20run\x20`rabetbase\x20sql\x20pull`\x20to\x20refresh\x20version\x20info\x20first'});continue;}const _0x43ae5b=await readFile(_0x5e13a0[_0x4680dc(0xfb)],'utf8'),_0x30a289=stripLocalSqlMetadata(_0x43ae5b,_0x5e13a0[_0x4680dc(0xfc)]),_0x1c4c46=_0x5e13a0[_0x4680dc(0x10c)]||_0x39469b[_0x4680dc(0x10c)],_0x413bac=await resolveTargetDbBinding(_0x2b9d91['appCode'],_0x5e13a0,_0x39469b),_0x1a12ad=await updateSqlQuery({'id':_0x39469b[_0x4680dc(0xe3)],'appCode':_0x2b9d91['appCode'],'sqlCode':_0x5e13a0['sqlCode'],'sqlName':_0x1c4c46,'dbId':_0x413bac[_0x4680dc(0x10a)],'version':_0x39469b[_0x4680dc(0xf6)],'sqlContent':_0x30a289,'sqlConfig':_0x39469b[_0x4680dc(0x109)]??undefined}),_0x5cdaa8=_0x1a12ad[_0x4680dc(0x10a)]?await getDbName(_0x2b9d91[_0x4680dc(0x10b)],Number(_0x1a12ad[_0x4680dc(0x10a)]))[_0x4680dc(0x10f)](()=>_0x413bac[_0x4680dc(0xf8)]):_0x413bac[_0x4680dc(0xf8)];_0x434d9c['sqls'][_0x5e13a0[_0x4680dc(0xd2)]]={...buildSqlLockEntry(_0x1a12ad,_0x30a289,_0x59c3fd,{'dbName':_0x5cdaa8}),'path':_0x5e13a0[_0x4680dc(0xdc)],'mode':_0x39469b['mode']},await archivePreviousSqlFileIfNeeded(_0x3ac2a0,_0x39469b['path'],_0x5e13a0['relativePath']),_0x347bed[_0x4680dc(0x107)]({'sqlCode':_0x5e13a0[_0x4680dc(0xd2)],'remoteId':_0x39469b[_0x4680dc(0xe3)]});}catch(_0x2ed1df){_0xa145d6['push']({'sqlCode':_0x5e13a0[_0x4680dc(0xd2)],'error':_0x2ed1df instanceof Error?_0x2ed1df[_0x4680dc(0x102)]:String(_0x2ed1df)});}}_0x434d9c[_0x4680dc(0xe9)]=new Date()[_0x4680dc(0xe4)](),await writeSqlLockFile(_0x3ac2a0[_0x4680dc(0xd8)],_0x24eee5);const _0x4520bb=_0xa145d6[_0x4680dc(0x106)]===0x0,_0x4223de=await runAutomaticDeploymentSync(_0x2b9d91,_0x4680dc(0xd9),_0x347bed['map'](_0x3b56cf=>_0x3b56cf[_0x4680dc(0xd2)]),_0x4520bb),_0x390037=_0x4520bb&&automaticDeploymentSyncSucceeded(_0x4223de),_0x4844e3=_0x4680dc(0x101)+_0x4223de[_0x4680dc(0xf2)];return{'ok':_0x390037,'data':{'pushed':_0x347bed,'skipped':_0x2eabfd,'failed':_0xa145d6,'deploymentSync':_0x4223de},'message':_0x4680dc(0x103)+_0x347bed[_0x4680dc(0x106)]+_0x4680dc(0xee)+_0x2eabfd[_0x4680dc(0x106)]+'\x20skipped,\x20'+_0xa145d6[_0x4680dc(0x106)]+_0x4680dc(0xff)+_0x4844e3};}};async function archivePreviousSqlFileIfNeeded(_0x372625,_0x40e515,_0x3ca9e4){const _0x746ada=a216_0x4c4e8b;if(!_0x40e515||_0x40e515===_0x3ca9e4)return;const _0x4a1389=join(_0x372625[_0x746ada(0xda)],_0x40e515);if(!await fileExists(_0x4a1389))return;const _0x5f33b1=await moveToTrash(_0x372625['projectRoot'],_0x372625[_0x746ada(0xd6)],_0x4a1389);await cleanupEmptyDirectories(dirname(_0x4a1389),_0x372625[_0x746ada(0xda)]),void _0x5f33b1;}async function moveToTrash(_0x57dfb8,_0x2bb420,_0x443439){const _0x3c70f3=a216_0x4c4e8b,_0x1162bf=new Date()[_0x3c70f3(0xe4)]()[_0x3c70f3(0x114)](/[:.]/g,'-'),_0x333edf=relative(_0x57dfb8,_0x443439),_0x2fcc16=join(_0x2bb420,_0x1162bf,_0x333edf);return await mkdir(dirname(_0x2fcc16),{'recursive':!![]}),await rename(_0x443439,_0x2fcc16),_0x2fcc16;}async function cleanupEmptyDirectories(_0x47e1b8,_0x320d1a){const _0x26f976=a216_0x4c4e8b;let _0x2c17c3=resolve(_0x47e1b8);const _0x5e78db=resolve(_0x320d1a);while(_0x2c17c3[_0x26f976(0xf0)](''+_0x5e78db+sep)||_0x2c17c3===_0x5e78db){if(_0x2c17c3===_0x5e78db)return;try{const _0xc3b50e=await readdir(_0x2c17c3);if(_0xc3b50e[_0x26f976(0x106)]>0x0)return;await rmdir(_0x2c17c3);}catch{return;}_0x2c17c3=dirname(_0x2c17c3);}}function a216_0xba97(){const _0x2e980a=['sqlConfig','dbId','appCode','sqlName','1891886djPPZZ','sqlRoot','catch','path','hash','Would\x20push\x20','local\x20SQL\x20is\x20not\x20tracked\x20by\x20sql.lock.json;\x20use\x20`rabetbase\x20sql\x20create`\x20or\x20`rabetbase\x20sql\x20pull`\x20first','replace','Local\x20directory\x20\x22','sqlCode','No\x20local\x20SQL\x20files\x20found.','boolean','468882RhMocr','trashDir','.\x20Keep\x20only\x20one\x20file\x20under\x20its\x20sqlCode\x20directory\x20before\x20pushing.','lockFilePath','sql','sqlRootDir','\x20SQL\x20file(s)','relativePath','join','set','118959CqqkCJ','189VXSjGY','str','filter','remoteId','toISOString','bool','get','689224rZFkOj','Multiple\x20local\x20SQL\x20files\x20found\x20for\x20sqlCode\x20','lastSync','1eLZgsG','Local\x20SQL\x20not\x20found:\x20','validation','write','\x20pushed,\x20','976705gRNwWX','startsWith','Force\x20push\x20even\x20if\x20local\x20hash\x20matches\x20lock','status','sqlcode','Push\x20local\x20SQL\x20files\x20to\x20remote','/smartapi/custom/updateUserCustomSql','version','dbDirectory','dbName','unchanged','force','filePath','mode','2681512StabWC','map','\x20failed','26320YnUCCL',',\x20deployment\x20sync\x20','message','Push\x20complete:\x20','\x22\x20matches\x20multiple\x20databases\x20for\x20sqlCode\x20','has','length','push','sqls'];a216_0xba97=function(){return _0x2e980a;};return a216_0xba97();}async function resolveTargetDbBinding(_0xd0d035,_0x6c1a36,_0x12ff62){const _0x2b524b=a216_0x4c4e8b,_0x271313=_0x6c1a36[_0x2b524b(0xf7)];if(!_0x271313)return{'dbId':_0x12ff62[_0x2b524b(0x10a)],'dbName':_0x12ff62['dbName']};const _0x3921c8=buildDbDirectoryName(_0x12ff62[_0x2b524b(0xf8)],_0x12ff62['dbId']);if(_0x271313===_0x3921c8)return{'dbId':_0x12ff62[_0x2b524b(0x10a)],'dbName':_0x12ff62[_0x2b524b(0xf8)]};const _0x34b843=parseExplicitDbDirectory(_0x271313);if(_0x34b843!=null)return{'dbId':_0x34b843,'dbName':await getDbName(_0xd0d035,_0x34b843)[_0x2b524b(0x10f)](()=>undefined)};const _0x381d84=await listDatabases(_0xd0d035),_0x92785d=_0x381d84[_0x2b524b(0xe2)](_0x6d0097=>buildDbDirectoryName(_0x6d0097[_0x2b524b(0xf8)],_0x6d0097[_0x2b524b(0x10a)])===_0x271313);if(_0x92785d['length']===0x1)return{'dbId':_0x92785d[0x0][_0x2b524b(0x10a)],'dbName':_0x92785d[0x0][_0x2b524b(0xf8)]};if(_0x92785d['length']===0x0)throw CliErrors['validation']('No\x20database\x20matches\x20local\x20directory\x20\x22'+_0x271313+'\x22\x20for\x20sqlCode\x20'+_0x6c1a36[_0x2b524b(0xd2)]+'.');const _0x43e6a6=_0x92785d[_0x2b524b(0xfe)](_0x1c6f7b=>_0x1c6f7b[_0x2b524b(0xf8)]+'\x20('+_0x1c6f7b[_0x2b524b(0x10a)]+')')[_0x2b524b(0xdd)](',\x20');throw CliErrors[_0x2b524b(0xec)](_0x2b524b(0x115)+_0x271313+_0x2b524b(0x104)+_0x6c1a36[_0x2b524b(0xd2)]+':\x20'+_0x43e6a6);}function a216_0x31e7(_0x240517,_0x5a6803){_0x240517=_0x240517-0xd2;const _0xba978=a216_0xba97();let _0x31e7b5=_0xba978[_0x240517];return _0x31e7b5;}function parseExplicitDbDirectory(_0x37a034){const _0x29c839=/^db-(\d+)$/['exec'](_0x37a034);if(!_0x29c839)return null;const _0x532bc2=Number(_0x29c839[0x1]);return Number['isFinite'](_0x532bc2)&&_0x532bc2>0x0?_0x532bc2:null;}
@@ -1 +1 @@
1
- (function(_0x175ce5,_0x12792b){const _0x2b9cd0=a204_0x50d1,_0x3f4f2d=_0x175ce5();while(!![]){try{const _0x54524b=parseInt(_0x2b9cd0(0x174))/0x1+parseInt(_0x2b9cd0(0x189))/0x2+parseInt(_0x2b9cd0(0x17c))/0x3*(-parseInt(_0x2b9cd0(0x170))/0x4)+parseInt(_0x2b9cd0(0x175))/0x5+-parseInt(_0x2b9cd0(0x173))/0x6*(-parseInt(_0x2b9cd0(0x193))/0x7)+parseInt(_0x2b9cd0(0x185))/0x8+parseInt(_0x2b9cd0(0x186))/0x9*(-parseInt(_0x2b9cd0(0x192))/0xa);if(_0x54524b===_0x12792b)break;else _0x3f4f2d['push'](_0x3f4f2d['shift']());}catch(_0x9c3c4e){_0x3f4f2d['push'](_0x3f4f2d['shift']());}}}(a204_0x40e3,0x95e9f));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='.rabetbase/sql';export function buildSqlLockEntry(_0xce9e5b,_0xfa1c88,_0x568af8,_0x1343e4){const _0x3e24ae=a204_0x50d1,_0x13af9a=detectSqlMode(_0xfa1c88);return{'path':buildSqlRelativePath(_0xce9e5b[_0x3e24ae(0x176)],_0xce9e5b[_0x3e24ae(0x190)],_0x1343e4?.[_0x3e24ae(0x16c)],_0x13af9a,_0xce9e5b['dbId']),'hash':_0x568af8,'remoteId':_0xce9e5b['id'],'version':_0xce9e5b['version'],'dbId':Number(_0xce9e5b[_0x3e24ae(0x16f)]),'dbName':_0x1343e4?.[_0x3e24ae(0x16c)],'sqlName':_0xce9e5b[_0x3e24ae(0x190)],'sqlConfig':_0xce9e5b[_0x3e24ae(0x184)]??undefined,'mode':_0x13af9a};}export function cloneSqlLockData(_0x471e4f){const _0x42bb6b=a204_0x50d1;return{'apps':Object['fromEntries'](Object[_0x42bb6b(0x179)](_0x471e4f[_0x42bb6b(0x18c)])[_0x42bb6b(0x187)](([_0x58d291,_0x5440c2])=>[_0x58d291,{'sqlRoot':_0x5440c2[_0x42bb6b(0x172)],'lastSync':_0x5440c2[_0x42bb6b(0x177)],'sqls':{..._0x5440c2[_0x42bb6b(0x17e)]}}]))};}function a204_0x50d1(_0x5ac12f,_0x3b3d78){_0x5ac12f=_0x5ac12f-0x16c;const _0x40e376=a204_0x40e3();let _0x50d1fb=_0x40e376[_0x5ac12f];return _0x50d1fb;}export function ensureRemoteSqlContent(_0x1c8183){const _0x3913fb=a204_0x50d1;return _0x1c8183[_0x3913fb(0x17a)]??'';}export function buildLocalSqlFileContent(_0x3155e4,_0x164922,_0x2691d8){const _0x3bea26=a204_0x50d1,_0x5133b0=_0x2691d8?.[_0x3bea26(0x18a)]??detectSqlMode(_0x164922),_0x56f7b0=stripLocalSqlMetadata(_0x164922,_0x5133b0)[_0x3bea26(0x191)](),_0x16e007=[...buildMetadataHeaderLines({'sqlCode':_0x3155e4['sqlCode'],'sqlName':_0x3155e4[_0x3bea26(0x190)],'dbId':_0x3155e4[_0x3bea26(0x16f)],'dbName':_0x2691d8?.[_0x3bea26(0x16c)],'mode':_0x5133b0,'syncedAt':_0x2691d8?.['syncedAt'],'description':_0x2691d8?.[_0x3bea26(0x171)]},_0x5133b0),'',_0x56f7b0],_0x212821=_0x16e007[_0x3bea26(0x194)]('\x0a');return _0x212821['endsWith']('\x0a')?_0x212821:_0x212821+'\x0a';}export function stripLocalSqlMetadata(_0x5107e7,_0x4aa8a0){const _0x2e55a7=a204_0x50d1,_0x690fa9=_0x5107e7[_0x2e55a7(0x18d)](/\r\n/g,'\x0a')['split']('\x0a'),_0xbeac27=[];let _0x8f779a=0x0;if(_0x4aa8a0===_0x2e55a7(0x195))while(_0x8f779a<_0x690fa9['length']){const _0x85119c=_0x690fa9[_0x8f779a]??'';if(/^\s*<!--\s*@lovrabet\./[_0x2e55a7(0x182)](_0x85119c)){_0x8f779a++;continue;}if(_0x85119c[_0x2e55a7(0x191)]()===''&&_0x8f779a>0x0){_0x8f779a++;continue;}break;}else while(_0x8f779a<_0x690fa9[_0x2e55a7(0x18b)]){const _0x4fde52=_0x690fa9[_0x8f779a]??'';if(/^\s*--\s*@lovrabet\./[_0x2e55a7(0x182)](_0x4fde52)){_0x8f779a++;continue;}if(_0x4fde52[_0x2e55a7(0x191)]()===''&&_0x8f779a>0x0){_0x8f779a++;continue;}break;}for(;_0x8f779a<_0x690fa9[_0x2e55a7(0x18b)];_0x8f779a++){_0xbeac27['push'](_0x690fa9[_0x8f779a]);}return _0xbeac27[_0x2e55a7(0x194)]('\x0a')['trimStart']();}export function resolveSqlMode(_0x86b1ba,_0x7b4354){const _0x591631=a204_0x50d1;if(_0x7b4354?.['mode'])return _0x7b4354[_0x591631(0x18a)];return detectSqlMode(_0x86b1ba);}export function resolveSqlFileName(_0x405ff9,_0x9da412,_0x38d1e8){const _0x210cc1=a204_0x50d1;if(_0x38d1e8?.['path'])return _0x38d1e8[_0x210cc1(0x18f)];if(_0x38d1e8?.[_0x210cc1(0x190)]||_0x38d1e8?.[_0x210cc1(0x16c)])return buildSqlRelativePath(_0x405ff9,_0x38d1e8?.[_0x210cc1(0x190)],_0x38d1e8?.[_0x210cc1(0x16c)],resolveSqlMode(_0x9da412,_0x38d1e8),_0x38d1e8?.[_0x210cc1(0x16f)]);return buildDefaultSqlFileName(_0x405ff9,resolveSqlMode(_0x9da412,_0x38d1e8));}function a204_0x40e3(){const _0x210d15=['lastSync','\x20-->','entries','sqlContent','includes','3MRKNOI','stderr','sqls','syncedAt','close','\x20[y/N]\x20','test','question','sqlConfig','800920gzJpRR','21851658wIMcKo','map','--\x20@lovrabet.','1185608fhTwRz','mode','length','apps','replace','<!--\x20@lovrabet.','path','sqlName','trim','10MBcNBD','826sAnSAl','join','mybatisXml','dbName','toLowerCase','filter','dbId','3780108PfPuJW','description','sqlRoot','61284RIdgVs','913370AJXqwN','5877475rgejHX','sqlCode'];a204_0x40e3=function(){return _0x210d15;};return a204_0x40e3();}export function resolveSqlLocalDir(_0x50be30,_0x5591ae){return join(_0x50be30,SQL_LOCAL_REL_DIR,_0x5591ae);}export async function confirmForceOverwrite(_0x1a5878){const _0x315cfd=a204_0x50d1,_0x1b7812=createInterface({'input':process['stdin'],'output':process[_0x315cfd(0x17d)]}),_0xae87a0=await new Promise(_0x7c6af0=>{const _0x56de13=_0x315cfd;_0x1b7812[_0x56de13(0x183)](_0x1a5878+_0x56de13(0x181),_0x7c6af0);});return _0x1b7812[_0x315cfd(0x180)](),['y','yes'][_0x315cfd(0x17b)](_0xae87a0[_0x315cfd(0x191)]()[_0x315cfd(0x16d)]());}export function findSqlLockScope(_0x4634dd,_0x576923){return _0x4634dd['apps'][_0x576923];}function buildMetadataHeaderLines(_0xe3f9c5,_0x10ccd7){const _0x2fb8f9=a204_0x50d1,_0x56cf6a=[['sqlCode',_0xe3f9c5['sqlCode']],[_0x2fb8f9(0x190),_0xe3f9c5[_0x2fb8f9(0x190)]],[_0x2fb8f9(0x16f),_0xe3f9c5[_0x2fb8f9(0x16f)]],[_0x2fb8f9(0x16c),_0xe3f9c5['dbName']],[_0x2fb8f9(0x18a),_0xe3f9c5[_0x2fb8f9(0x18a)]],[_0x2fb8f9(0x17f),_0xe3f9c5[_0x2fb8f9(0x17f)]],[_0x2fb8f9(0x171),_0xe3f9c5[_0x2fb8f9(0x171)]]];if(_0x10ccd7===_0x2fb8f9(0x195))return _0x56cf6a[_0x2fb8f9(0x16e)](([,_0x5e73ba])=>_0x5e73ba!==undefined&&_0x5e73ba!==null&&String(_0x5e73ba)[_0x2fb8f9(0x191)]()!=='')[_0x2fb8f9(0x187)](([_0x50dab0,_0xe0dbdb])=>_0x2fb8f9(0x18e)+_0x50dab0+':\x20'+String(_0xe0dbdb)+_0x2fb8f9(0x178));return _0x56cf6a[_0x2fb8f9(0x16e)](([,_0x3f7306])=>_0x3f7306!==undefined&&_0x3f7306!==null&&String(_0x3f7306)[_0x2fb8f9(0x191)]()!=='')['map'](([_0xef0660,_0x5b9876])=>_0x2fb8f9(0x188)+_0xef0660+':\x20'+String(_0x5b9876));}
1
+ const a217_0x3d43c9=a217_0xec6c;(function(_0x3b3320,_0x53d1e4){const _0x555faf=a217_0xec6c,_0x57ca6b=_0x3b3320();while(!![]){try{const _0x16729b=-parseInt(_0x555faf(0xf0))/0x1+parseInt(_0x555faf(0xff))/0x2*(-parseInt(_0x555faf(0xf5))/0x3)+-parseInt(_0x555faf(0xf2))/0x4*(-parseInt(_0x555faf(0xe3))/0x5)+-parseInt(_0x555faf(0xef))/0x6*(parseInt(_0x555faf(0x104))/0x7)+-parseInt(_0x555faf(0xe0))/0x8*(parseInt(_0x555faf(0xdb))/0x9)+-parseInt(_0x555faf(0xf3))/0xa*(parseInt(_0x555faf(0xe8))/0xb)+parseInt(_0x555faf(0xf1))/0xc*(parseInt(_0x555faf(0xf6))/0xd);if(_0x16729b===_0x53d1e4)break;else _0x57ca6b['push'](_0x57ca6b['shift']());}catch(_0x4abe92){_0x57ca6b['push'](_0x57ca6b['shift']());}}}(a217_0x1f39,0x809ad));function a217_0xec6c(_0x51e9e8,_0x518065){_0x51e9e8=_0x51e9e8-0xd5;const _0x1f39e1=a217_0x1f39();let _0xec6c2c=_0x1f39e1[_0x51e9e8];return _0xec6c2c;}import{createInterface}from'node:readline';import{join}from'node:path';function a217_0x1f39(){const _0x368ea9=['toLowerCase','filter','question','dbId','1426779RsICNZ','endsWith','lastSync','<!--\x20@lovrabet.','sqlCode','32WVwIUE','split','sqlConfig','3729245IJYjoD','fromEntries','apps','mybatisXml','entries','33pwQKzf','join','description','mode','dbName','\x20[y/N]\x20','push','2916138uuSiOC','787133RoBrEg','2208528qhvxqi','4oBPPla','589690UZtXIu','includes','711513dhrDpY','182THriMv','stderr','trim','sqls','syncedAt','path','.rabetbase/sql','close','map','6Sswafg','sqlName','version','sqlContent','length','7GVNqaM','replace','trimStart'];a217_0x1f39=function(){return _0x368ea9;};return a217_0x1f39();}import{buildDefaultSqlFileName,buildSqlRelativePath,detectSqlMode}from'../../core/sql-sync/utils.js';export const SQL_LOCAL_REL_DIR=a217_0x3d43c9(0xfc);export function buildSqlLockEntry(_0x2fd118,_0xf52ea4,_0x4942cb,_0x1dcc1f){const _0x20b3bf=a217_0x3d43c9,_0x1d8e9e=detectSqlMode(_0xf52ea4);return{'path':buildSqlRelativePath(_0x2fd118[_0x20b3bf(0xdf)],_0x2fd118[_0x20b3bf(0x100)],_0x1dcc1f?.[_0x20b3bf(0xec)],_0x1d8e9e,_0x2fd118[_0x20b3bf(0xda)]),'hash':_0x4942cb,'remoteId':_0x2fd118['id'],'version':_0x2fd118[_0x20b3bf(0x101)],'dbId':Number(_0x2fd118['dbId']),'dbName':_0x1dcc1f?.[_0x20b3bf(0xec)],'sqlName':_0x2fd118[_0x20b3bf(0x100)],'sqlConfig':_0x2fd118[_0x20b3bf(0xe2)]??undefined,'mode':_0x1d8e9e};}export function cloneSqlLockData(_0x138ef6){const _0x5bf0c2=a217_0x3d43c9;return{'apps':Object[_0x5bf0c2(0xe4)](Object[_0x5bf0c2(0xe7)](_0x138ef6[_0x5bf0c2(0xe5)])[_0x5bf0c2(0xfe)](([_0xec8331,_0x5b4136])=>[_0xec8331,{'sqlRoot':_0x5b4136['sqlRoot'],'lastSync':_0x5b4136[_0x5bf0c2(0xdd)],'sqls':{..._0x5b4136[_0x5bf0c2(0xf9)]}}]))};}export function ensureRemoteSqlContent(_0xa0ae55){const _0x3b79e0=a217_0x3d43c9;return _0xa0ae55[_0x3b79e0(0x102)]??'';}export function buildLocalSqlFileContent(_0xa3fea8,_0x423599,_0x4c746c){const _0x550289=a217_0x3d43c9,_0x8b8fe0=_0x4c746c?.[_0x550289(0xeb)]??detectSqlMode(_0x423599),_0x54e6cf=stripLocalSqlMetadata(_0x423599,_0x8b8fe0)['trim'](),_0x4c97bb=[...buildMetadataHeaderLines({'sqlCode':_0xa3fea8[_0x550289(0xdf)],'sqlName':_0xa3fea8[_0x550289(0x100)],'dbId':_0xa3fea8[_0x550289(0xda)],'dbName':_0x4c746c?.['dbName'],'mode':_0x8b8fe0,'syncedAt':_0x4c746c?.['syncedAt'],'description':_0x4c746c?.['description']},_0x8b8fe0),'',_0x54e6cf],_0x160c98=_0x4c97bb[_0x550289(0xe9)]('\x0a');return _0x160c98[_0x550289(0xdc)]('\x0a')?_0x160c98:_0x160c98+'\x0a';}export function stripLocalSqlMetadata(_0x113761,_0x76e74c){const _0x347b82=a217_0x3d43c9,_0x49618f=_0x113761[_0x347b82(0xd5)](/\r\n/g,'\x0a')[_0x347b82(0xe1)]('\x0a'),_0xf08384=[];let _0x347cfa=0x0;if(_0x76e74c===_0x347b82(0xe6))while(_0x347cfa<_0x49618f['length']){const _0x4e3634=_0x49618f[_0x347cfa]??'';if(/^\s*<!--\s*@lovrabet\./['test'](_0x4e3634)){_0x347cfa++;continue;}if(_0x4e3634[_0x347b82(0xf8)]()===''&&_0x347cfa>0x0){_0x347cfa++;continue;}break;}else while(_0x347cfa<_0x49618f[_0x347b82(0x103)]){const _0x3bf3c3=_0x49618f[_0x347cfa]??'';if(/^\s*--\s*@lovrabet\./['test'](_0x3bf3c3)){_0x347cfa++;continue;}if(_0x3bf3c3['trim']()===''&&_0x347cfa>0x0){_0x347cfa++;continue;}break;}for(;_0x347cfa<_0x49618f['length'];_0x347cfa++){_0xf08384[_0x347b82(0xee)](_0x49618f[_0x347cfa]);}return _0xf08384[_0x347b82(0xe9)]('\x0a')[_0x347b82(0xd6)]();}export function resolveSqlMode(_0x300ea0,_0x40cb9a){const _0x3bbf07=a217_0x3d43c9;if(_0x40cb9a?.[_0x3bbf07(0xeb)])return _0x40cb9a[_0x3bbf07(0xeb)];return detectSqlMode(_0x300ea0);}export function resolveSqlFileName(_0x39fb16,_0xa8c65e,_0x32c036){const _0x568bf2=a217_0x3d43c9;if(_0x32c036?.[_0x568bf2(0xfb)])return _0x32c036['path'];if(_0x32c036?.['sqlName']||_0x32c036?.[_0x568bf2(0xec)])return buildSqlRelativePath(_0x39fb16,_0x32c036?.[_0x568bf2(0x100)],_0x32c036?.['dbName'],resolveSqlMode(_0xa8c65e,_0x32c036),_0x32c036?.[_0x568bf2(0xda)]);return buildDefaultSqlFileName(_0x39fb16,resolveSqlMode(_0xa8c65e,_0x32c036));}export function resolveSqlLocalDir(_0x344877,_0x347c4b){return join(_0x344877,SQL_LOCAL_REL_DIR,_0x347c4b);}export async function confirmForceOverwrite(_0x383d4a){const _0x5e0364=a217_0x3d43c9,_0x1038a4=createInterface({'input':process['stdin'],'output':process[_0x5e0364(0xf7)]}),_0x51220d=await new Promise(_0x2b8e83=>{const _0x304d3e=_0x5e0364;_0x1038a4[_0x304d3e(0xd9)](_0x383d4a+_0x304d3e(0xed),_0x2b8e83);});return _0x1038a4[_0x5e0364(0xfd)](),['y','yes'][_0x5e0364(0xf4)](_0x51220d[_0x5e0364(0xf8)]()[_0x5e0364(0xd7)]());}export function findSqlLockScope(_0x9f87a7,_0x1512cd){const _0x1b93e0=a217_0x3d43c9;return _0x9f87a7[_0x1b93e0(0xe5)][_0x1512cd];}function buildMetadataHeaderLines(_0x557346,_0x31ab28){const _0x458163=a217_0x3d43c9,_0x4306df=[['sqlCode',_0x557346[_0x458163(0xdf)]],['sqlName',_0x557346['sqlName']],[_0x458163(0xda),_0x557346[_0x458163(0xda)]],[_0x458163(0xec),_0x557346['dbName']],[_0x458163(0xeb),_0x557346[_0x458163(0xeb)]],[_0x458163(0xfa),_0x557346[_0x458163(0xfa)]],[_0x458163(0xea),_0x557346[_0x458163(0xea)]]];if(_0x31ab28==='mybatisXml')return _0x4306df[_0x458163(0xd8)](([,_0x1fcc93])=>_0x1fcc93!==undefined&&_0x1fcc93!==null&&String(_0x1fcc93)[_0x458163(0xf8)]()!=='')[_0x458163(0xfe)](([_0x5a2544,_0x21ca2a])=>_0x458163(0xde)+_0x5a2544+':\x20'+String(_0x21ca2a)+'\x20-->');return _0x4306df[_0x458163(0xd8)](([,_0x599f8b])=>_0x599f8b!==undefined&&_0x599f8b!==null&&String(_0x599f8b)['trim']()!=='')[_0x458163(0xfe)](([_0x2d5d45,_0x4b60bc])=>'--\x20@lovrabet.'+_0x2d5d45+':\x20'+String(_0x4b60bc));}
@@ -1 +1 @@
1
- const a205_0x15f317=a205_0x1220;(function(_0x17dfb7,_0x4540ad){const _0x4c7552=a205_0x1220,_0x4054cd=_0x17dfb7();while(!![]){try{const _0x239813=parseInt(_0x4c7552(0x13a))/0x1+-parseInt(_0x4c7552(0x130))/0x2+parseInt(_0x4c7552(0x11f))/0x3+-parseInt(_0x4c7552(0x120))/0x4+-parseInt(_0x4c7552(0x11b))/0x5*(parseInt(_0x4c7552(0x126))/0x6)+parseInt(_0x4c7552(0x13b))/0x7+-parseInt(_0x4c7552(0x137))/0x8*(parseInt(_0x4c7552(0x132))/0x9);if(_0x239813===_0x4540ad)break;else _0x4054cd['push'](_0x4054cd['shift']());}catch(_0x1be394){_0x4054cd['push'](_0x4054cd['shift']());}}}(a205_0x26c1,0x26695));import{listSqlQueries}from'../../core/api-client.js';import{loadSqlProjectConfig}from'../../core/sql-sync/config.js';import{scanLocalSqlQueries}from'../../core/sql-sync/file-system.js';function a205_0x26c1(){const _0x284620=['bool','6FsqKbc','sqls','map','totalCount','boolean','paging','keys','sql','Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally','push','262730JJONAa','lockKey','345834EZphOL','has','\x20missing,\x20','length','\x20unchanged','24kxsQqv','remote','filePath','224224UHTzgV','441217sySTKH','sqlName','path','103415vlKVZQ','status','\x20remote-only','All\x20SQL\x20queries\x20are\x20in\x20sync.','439395MAeMHV','36244tYaOzx','sqlCode','hash','\x20modified,\x20','appCode'];a205_0x26c1=function(){return _0x284620;};return a205_0x26c1();}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(_0x1b9afe){const _0x28f7c0=a205_0x1220,_0x505ee8=[];let _0x5e45a5=0x1;while(!![]){const _0x17105a=await listSqlQueries(_0x1b9afe,{'currentPage':_0x5e45a5,'pageSize':PAGE_SIZE}),_0x91ce6b=_0x17105a['tableData']??[];_0x505ee8[_0x28f7c0(0x12f)](..._0x91ce6b['map'](_0x3697c4=>_0x3697c4[_0x28f7c0(0x121)]));if(_0x91ce6b[_0x28f7c0(0x135)]===0x0)break;const _0x16e0f6=_0x17105a[_0x28f7c0(0x12b)]?.[_0x28f7c0(0x129)];if(_0x16e0f6!=null?_0x505ee8[_0x28f7c0(0x135)]>=_0x16e0f6:_0x91ce6b['length']<PAGE_SIZE)break;_0x5e45a5++;}return _0x505ee8;}function a205_0x1220(_0x16c9f8,_0x1ce8ec){_0x16c9f8=_0x16c9f8-0x11b;const _0x26c107=a205_0x26c1();let _0x122088=_0x26c107[_0x16c9f8];return _0x122088;}export const sqlStatus={'service':a205_0x15f317(0x12d),'command':a205_0x15f317(0x11c),'description':'Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','risk':'read','flags':[{'name':a205_0x15f317(0x138),'type':a205_0x15f317(0x12a),'description':a205_0x15f317(0x12e)}],async 'execute'(_0x5b621d){const _0x1b04c2=a205_0x15f317,_0x5137d0=loadSqlProjectConfig(_0x5b621d[_0x1b04c2(0x124)]),_0x5f2c35=await readSqlLockFile(_0x5137d0['lockFilePath']),{appLock:_0x330a0b}=ensureSqlLockScope(_0x5f2c35??createEmptySqlLock(),_0x5137d0[_0x1b04c2(0x124)],_0x5137d0['sqlRoot'],_0x1b04c2(0x11c)),_0x3fccd2=await scanLocalSqlQueries(_0x5137d0),_0xe67c49=[],_0x3657c0=[],_0x162acd=[],_0x4e5c6c=[],_0x591a1f=new Set(_0x3fccd2[_0x1b04c2(0x128)](_0x386107=>_0x386107[_0x1b04c2(0x131)]));for(const _0x379cc7 of _0x3fccd2){const _0x85e4d8=await computeSqlFileHash(_0x379cc7[_0x1b04c2(0x139)]),_0x4e3a02=_0x330a0b[_0x1b04c2(0x127)][_0x379cc7[_0x1b04c2(0x131)]],_0x209fa7=!!_0x4e3a02&&_0x4e3a02[_0x1b04c2(0x13d)]!==_0x379cc7['relativePath'],_0x1bb993=!!_0x4e3a02&&!!_0x379cc7['sqlName']&&_0x4e3a02[_0x1b04c2(0x13c)]!==_0x379cc7['sqlName'];if(!_0x4e3a02)_0xe67c49[_0x1b04c2(0x12f)](_0x379cc7[_0x1b04c2(0x131)]);else _0x4e3a02[_0x1b04c2(0x122)]!==_0x85e4d8||_0x209fa7||_0x1bb993?_0x3657c0[_0x1b04c2(0x12f)](_0x379cc7['lockKey']):_0x162acd[_0x1b04c2(0x12f)](_0x379cc7[_0x1b04c2(0x131)]);}for(const _0x983322 of Object[_0x1b04c2(0x12c)](_0x330a0b['sqls'])){!_0x591a1f['has'](_0x983322)&&_0x4e5c6c[_0x1b04c2(0x12f)](_0x983322);}const _0x36a840=[];if(_0x5b621d[_0x1b04c2(0x125)](_0x1b04c2(0x138))){const _0x5b3e25=await fetchAllSqlCodes(_0x5b621d[_0x1b04c2(0x124)]);for(const _0x3ab01c of _0x5b3e25){!_0x591a1f[_0x1b04c2(0x133)](_0x3ab01c)&&!_0x330a0b[_0x1b04c2(0x127)][_0x3ab01c]&&_0x36a840[_0x1b04c2(0x12f)](_0x3ab01c);}}const _0x1a001f=_0xe67c49[_0x1b04c2(0x135)]===0x0&&_0x3657c0[_0x1b04c2(0x135)]===0x0&&_0x4e5c6c[_0x1b04c2(0x135)]===0x0&&_0x36a840['length']===0x0;return{'ok':!![],'data':{'added':_0xe67c49,'modified':_0x3657c0,'missing':_0x4e5c6c,'unchanged':_0x162acd,'remoteOnly':_0x36a840},'message':_0x1a001f?_0x1b04c2(0x11e):_0xe67c49['length']+'\x20added,\x20'+_0x3657c0[_0x1b04c2(0x135)]+_0x1b04c2(0x123)+_0x4e5c6c[_0x1b04c2(0x135)]+_0x1b04c2(0x134)+_0x162acd[_0x1b04c2(0x135)]+_0x1b04c2(0x136)+(_0x36a840[_0x1b04c2(0x135)]>0x0?',\x20'+_0x36a840[_0x1b04c2(0x135)]+_0x1b04c2(0x11d):'')};}};
1
+ const a218_0x3a7907=a218_0x2f4f;function a218_0x2f4f(_0x5c9ade,_0x34dcf2){_0x5c9ade=_0x5c9ade-0x8b;const _0x421f8a=a218_0x421f();let _0x2f4f5b=_0x421f8a[_0x5c9ade];return _0x2f4f5b;}(function(_0x380a60,_0x2c6ff4){const _0xf152b3=a218_0x2f4f,_0x6855a6=_0x380a60();while(!![]){try{const _0x28e15f=-parseInt(_0xf152b3(0xa2))/0x1*(parseInt(_0xf152b3(0x9e))/0x2)+parseInt(_0xf152b3(0x9c))/0x3*(-parseInt(_0xf152b3(0x8d))/0x4)+-parseInt(_0xf152b3(0x92))/0x5*(-parseInt(_0xf152b3(0x8c))/0x6)+parseInt(_0xf152b3(0xb2))/0x7+-parseInt(_0xf152b3(0xa5))/0x8+parseInt(_0xf152b3(0x90))/0x9+-parseInt(_0xf152b3(0x9a))/0xa*(parseInt(_0xf152b3(0x9f))/0xb);if(_0x28e15f===_0x2c6ff4)break;else _0x6855a6['push'](_0x6855a6['shift']());}catch(_0x49c01d){_0x6855a6['push'](_0x6855a6['shift']());}}}(a218_0x421f,0xb3c10));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(_0x327149){const _0x328fdf=a218_0x2f4f,_0x6467f6=[];let _0x1c6864=0x1;while(!![]){const _0x5c83be=await listSqlQueries(_0x327149,{'currentPage':_0x1c6864,'pageSize':PAGE_SIZE}),_0x5d1ffe=_0x5c83be[_0x328fdf(0x8f)]??[];_0x6467f6['push'](..._0x5d1ffe[_0x328fdf(0x8b)](_0x2e0a73=>_0x2e0a73[_0x328fdf(0xac)]));if(_0x5d1ffe['length']===0x0)break;const _0x481cad=_0x5c83be[_0x328fdf(0xa0)]?.[_0x328fdf(0xa4)];if(_0x481cad!=null?_0x6467f6['length']>=_0x481cad:_0x5d1ffe['length']<PAGE_SIZE)break;_0x1c6864++;}return _0x6467f6;}function a218_0x421f(){const _0x4121c6=['paging','lockKey','1652aSAqVe','\x20unchanged','totalCount','2094984NryPvl','relativePath','push','sqlName','status','length','has','sqlCode','appCode','lockFilePath','filePath','All\x20SQL\x20queries\x20are\x20in\x20sync.','\x20remote-only','4088441nvJBkz','map','7202694vcNhXr','14908RvONzy','\x20modified,\x20','tableData','9757089usXTgN','path','5mUxagQ','remote','keys','sqls','hash','sqlRoot','\x20added,\x20','\x20missing,\x20','94450ZhMjBm','bool','801pGcIYE','Check\x20local\x20SQL\x20sync\x20status\x20against\x20lock\x20file','934ADYcpN','121rDuRXc'];a218_0x421f=function(){return _0x4121c6;};return a218_0x421f();}export const sqlStatus={'service':'sql','command':a218_0x3a7907(0xa9),'description':a218_0x3a7907(0x9d),'risk':'read','flags':[{'name':'remote','type':'boolean','description':'Also\x20check\x20for\x20remote-only\x20SQL\x20queries\x20not\x20present\x20locally'}],async 'execute'(_0xe60182){const _0x419471=a218_0x3a7907,_0xd21796=loadSqlProjectConfig(_0xe60182[_0x419471(0xad)]),_0x25547c=await readSqlLockFile(_0xd21796[_0x419471(0xae)]),{appLock:_0xb40734}=ensureSqlLockScope(_0x25547c??createEmptySqlLock(),_0xd21796[_0x419471(0xad)],_0xd21796[_0x419471(0x97)],_0x419471(0xa9)),_0x1c74a9=await scanLocalSqlQueries(_0xd21796),_0xb733d5=[],_0x584de5=[],_0x2c89af=[],_0x421bf0=[],_0x392999=new Set(_0x1c74a9[_0x419471(0x8b)](_0x238ce9=>_0x238ce9[_0x419471(0xa1)]));for(const _0xe8e75b of _0x1c74a9){const _0x3e5990=await computeSqlFileHash(_0xe8e75b[_0x419471(0xaf)]),_0x26cf77=_0xb40734[_0x419471(0x95)][_0xe8e75b[_0x419471(0xa1)]],_0x255789=!!_0x26cf77&&_0x26cf77[_0x419471(0x91)]!==_0xe8e75b[_0x419471(0xa6)],_0x50bdd3=!!_0x26cf77&&!!_0xe8e75b['sqlName']&&_0x26cf77[_0x419471(0xa8)]!==_0xe8e75b['sqlName'];if(!_0x26cf77)_0xb733d5[_0x419471(0xa7)](_0xe8e75b[_0x419471(0xa1)]);else _0x26cf77[_0x419471(0x96)]!==_0x3e5990||_0x255789||_0x50bdd3?_0x584de5[_0x419471(0xa7)](_0xe8e75b[_0x419471(0xa1)]):_0x2c89af[_0x419471(0xa7)](_0xe8e75b[_0x419471(0xa1)]);}for(const _0x2154b3 of Object[_0x419471(0x94)](_0xb40734[_0x419471(0x95)])){!_0x392999[_0x419471(0xab)](_0x2154b3)&&_0x421bf0[_0x419471(0xa7)](_0x2154b3);}const _0x5bb0de=[];if(_0xe60182[_0x419471(0x9b)](_0x419471(0x93))){const _0x43f323=await fetchAllSqlCodes(_0xe60182[_0x419471(0xad)]);for(const _0x4870c5 of _0x43f323){!_0x392999[_0x419471(0xab)](_0x4870c5)&&!_0xb40734['sqls'][_0x4870c5]&&_0x5bb0de[_0x419471(0xa7)](_0x4870c5);}}const _0x219acd=_0xb733d5[_0x419471(0xaa)]===0x0&&_0x584de5[_0x419471(0xaa)]===0x0&&_0x421bf0['length']===0x0&&_0x5bb0de[_0x419471(0xaa)]===0x0;return{'ok':!![],'data':{'added':_0xb733d5,'modified':_0x584de5,'missing':_0x421bf0,'unchanged':_0x2c89af,'remoteOnly':_0x5bb0de},'message':_0x219acd?_0x419471(0xb0):_0xb733d5[_0x419471(0xaa)]+_0x419471(0x98)+_0x584de5['length']+_0x419471(0x8e)+_0x421bf0[_0x419471(0xaa)]+_0x419471(0x99)+_0x2c89af[_0x419471(0xaa)]+_0x419471(0xa3)+(_0x5bb0de[_0x419471(0xaa)]>0x0?',\x20'+_0x5bb0de[_0x419471(0xaa)]+_0x419471(0xb1):'')};}};